/* eslint-disable enforce-react-hooks/enforce-react-hooks */
const React = require('react');
const Component = React.Component;
const { TouchableOpacity, Text, StyleSheet, ScrollView, View } = require('react-native');
const { connect } = require('react-redux');
const Icon = require('react-native-vector-icons/Ionicons').default;
const { globalStyle, themeStyle } = require('lib/components/global-style.js');
Icon.loadFont();
class SideMenuContentNoteComponent extends Component {
constructor() {
super();
this.styles_ = {};
}
styles() {
const theme = themeStyle(this.props.theme);
if (this.styles_[this.props.theme]) return this.styles_[this.props.theme];
this.styles_ = {};
let styles = {
menu: {
flex: 1,
backgroundColor: theme.backgroundColor,
},
button: {
flex: 1,
flexDirection: 'row',
height: 36,
alignItems: 'center',
paddingLeft: theme.marginLeft,
paddingRight: theme.marginRight,
},
sidebarIcon: {
fontSize: 22,
color: theme.color,
},
sideButtonText: {
color: theme.color,
},
};
styles.sideButton = Object.assign({}, styles.button, { flex: 0 });
styles.sideButtonDisabled = Object.assign({}, styles.sideButton, { opacity: 0.6 });
this.styles_[this.props.theme] = StyleSheet.create(styles);
return this.styles_[this.props.theme];
}
renderDivider(key) {
return ;
}
renderSideBarButton(key, title, iconName, onPressHandler) {
const content = (
{!iconName ? null : }
{title}
);
if (!onPressHandler) return content;
return (
{content}
);
}
render() {
const theme = themeStyle(this.props.theme);
let items = [];
const options = this.props.options ? this.props.options : [];
let dividerIndex = 0;
for (const option of options) {
if (option.isDivider) {
items.push(this.renderDivider(`divider_${dividerIndex++}`));
} else {
items.push(this.renderSideBarButton(option.title, option.title, null, option.onPress));
}
}
let style = {
flex: 1,
borderRightWidth: 1,
borderRightColor: globalStyle.dividerColor,
backgroundColor: theme.backgroundColor,
paddingTop: 10,
};
return (
{items}
);
}
}
const SideMenuContentNote = connect(state => {
return {
theme: state.settings.theme,
};
})(SideMenuContentNoteComponent);
module.exports = { SideMenuContentNote };