2017-05-24 21:27:13 +02:00
|
|
|
import { connect } from 'react-redux'
|
|
|
|
import { Button } from 'react-native';
|
2017-06-24 20:06:28 +02:00
|
|
|
import { Log } from 'lib/log.js';
|
|
|
|
import { Note } from 'lib/models/note.js';
|
2017-07-05 23:29:00 +02:00
|
|
|
import { NotesScreenUtils } from 'lib/components/screens/notes-utils.js'
|
2017-05-24 21:27:13 +02:00
|
|
|
|
|
|
|
const React = require('react');
|
|
|
|
const {
|
|
|
|
Dimensions,
|
|
|
|
StyleSheet,
|
|
|
|
ScrollView,
|
|
|
|
View,
|
|
|
|
Image,
|
|
|
|
Text,
|
|
|
|
} = require('react-native');
|
|
|
|
const { Component } = React;
|
|
|
|
|
|
|
|
const window = Dimensions.get('window');
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
menu: {
|
|
|
|
flex: 1,
|
|
|
|
backgroundColor: 'white',
|
|
|
|
padding: 20,
|
|
|
|
},
|
|
|
|
name: {
|
|
|
|
position: 'absolute',
|
|
|
|
left: 70,
|
|
|
|
top: 20,
|
|
|
|
},
|
|
|
|
item: {
|
|
|
|
fontSize: 14,
|
|
|
|
fontWeight: '300',
|
|
|
|
paddingTop: 5,
|
|
|
|
},
|
|
|
|
button: {
|
|
|
|
flex: 1,
|
|
|
|
textAlign: 'left',
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
class SideMenuContentComponent extends Component {
|
|
|
|
|
|
|
|
folder_press(folder) {
|
|
|
|
this.props.dispatch({
|
|
|
|
type: 'SIDE_MENU_CLOSE',
|
|
|
|
});
|
2017-05-24 22:11:37 +02:00
|
|
|
|
2017-07-05 23:29:00 +02:00
|
|
|
NotesScreenUtils.openNoteList(folder.id);
|
2017-05-24 21:27:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
let buttons = [];
|
|
|
|
for (let i = 0; i < this.props.folders.length; i++) {
|
|
|
|
let f = this.props.folders[i];
|
2017-07-06 21:48:17 +02:00
|
|
|
let title = f.title ? f.title : '';
|
2017-05-24 21:27:13 +02:00
|
|
|
buttons.push(
|
2017-06-04 15:30:12 +02:00
|
|
|
<Button style={styles.button} title={title} onPress={() => { this.folder_press(f) }} key={f.id} />
|
2017-05-24 21:27:13 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<ScrollView scrollsToTop={false} style={styles.menu}>
|
|
|
|
{ buttons }
|
|
|
|
</ScrollView>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const SideMenuContent = connect(
|
|
|
|
(state) => {
|
|
|
|
return {
|
|
|
|
folders: state.folders,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
)(SideMenuContentComponent)
|
|
|
|
|
|
|
|
export { SideMenuContent };
|