import React, {useEffect, useState, createRef} from 'react'; import { ScrollView, View, Text, TouchableOpacity, SafeAreaView, Platform, FlatList, DeviceEventEmitter, PixelRatio, } from 'react-native'; import NavigationService from '../../services/NavigationService'; import { COLOR_SCHEME, SIZE, br, ph, pv, opacity, FONT, WEIGHT, COLOR_SCHEME_DARK, setColorScheme, COLOR_SCHEME_LIGHT, clearThemeUpdateListener, onThemeUpdate, } from '../../common/common'; import Icon from 'react-native-vector-icons/Feather'; import {getElevation, w, h, Toast} from '../../utils/utils'; import AsyncStorage from '@react-native-community/async-storage'; import {useForceUpdate} from '../../views/ListsEditor'; import {AnimatedSafeAreaView} from '../../views/Home'; import {useAppContext} from '../../provider/useAppContext'; export const Menu = ({close = () => {}, hide, update = () => {}}) => { const {colors, changeColorScheme} = useAppContext(); return ( NavigationService.push('Home'), close: true, }, { name: 'Notebooks', icon: 'book', func: () => NavigationService.push('Folders', { title: 'Notebooks', }), close: true, }, { name: 'Lists', icon: 'list', func: () => NavigationService.push('Lists'), close: true, }, { name: 'Favorites', icon: 'star', func: () => NavigationService.push('Favorites'), close: true, }, { name: 'Dark Mode', icon: 'moon', func: () => { if (!colors.night) { AsyncStorage.setItem( 'theme', JSON.stringify(COLOR_SCHEME_DARK), ); changeColorScheme(COLOR_SCHEME_DARK); } else { AsyncStorage.setItem( 'theme', JSON.stringify(COLOR_SCHEME_LIGHT), ); changeColorScheme(COLOR_SCHEME_LIGHT); } }, switch: true, on: colors.night ? true : false, close: false, }, { name: 'Trash', icon: 'trash', func: () => NavigationService.push('Trash'), close: true, }, { name: 'Settings', icon: 'settings', func: () => NavigationService.push('Settings'), close: true, }, ]} keyExtractor={(item, index) => item.name} renderItem={({item, index}) => ( { item.close === false ? null : close(); item.func(); }} style={{ width: '100%', alignSelf: 'center', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', paddingHorizontal: '5%', paddingVertical: pv + 5, }}> {item.name} {item.switch ? ( ) : ( undefined )} )} /> { close(); NavigationService.navigate('Tags'); }} style={{ width: '100%', alignSelf: 'center', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'flex-end', paddingHorizontal: '5%', marginTop: 15, }}> Tags {[ 'home', 'office', 'work', 'book_notes', 'poem', 'lists', 'water', ].map(item => ( { close(); NavigationService.navigate('Notes', { heading: item, }); }} style={{ flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'center', padding: 7, paddingLeft: 3.5, }}> #{item} ))} {['red', 'yellow', 'green', 'blue', 'purple', 'orange', 'gray'].map( item => ( ), )} {/* Upgrade to Pro */} { close(); NavigationService.navigate('Login'); }} activeOpacity={opacity} style={{ paddingVertical: pv + 5, width: '100%', borderRadius: 5, justifyContent: 'flex-start', alignItems: 'center', flexDirection: 'row', }}> {' '}Login {/* Hi, Ammar! 80.45/100 MB */} {/* Basic User */} ); };