diff --git a/apps/mobile/src/components/AddNotebookDialog/index.js b/apps/mobile/src/components/AddNotebookDialog/index.js index dbe0ff69b..8b0c7b5e1 100644 --- a/apps/mobile/src/components/AddNotebookDialog/index.js +++ b/apps/mobile/src/components/AddNotebookDialog/index.js @@ -12,7 +12,7 @@ import Icon from 'react-native-vector-icons/Feather'; import {db, DDS} from '../../../App'; import {opacity, ph, pv, SIZE, WEIGHT} from '../../common/common'; import {ACTIONS} from '../../provider'; -import {getElevation, ToastEvent, timeSince} from '../../utils/utils'; +import {getElevation, ToastEvent} from '../../utils/utils'; import {updateEvent} from '../DialogManager'; let refs = []; diff --git a/apps/mobile/src/components/Container/index.js b/apps/mobile/src/components/Container/index.js index ff10c0580..edaf80933 100644 --- a/apps/mobile/src/components/Container/index.js +++ b/apps/mobile/src/components/Container/index.js @@ -17,6 +17,10 @@ export const AnimatedSafeAreaView = Animatable.createAnimatableComponent( SafeAreaView, ); +const AnimatedTouchableOpacity = Animatable.createAnimatableComponent( + TouchableOpacity, +); + export const Container = ({ children, bottomButtonOnPress, @@ -31,21 +35,25 @@ export const Container = ({ useEffect(() => { Keyboard.addListener('keyboardDidShow', () => { - setButtonHide(true); + setTimeout(() => { + setButtonHide(true); + }, 300); }); Keyboard.addListener('keyboardDidHide', () => { setTimeout(() => { setButtonHide(false); - }, 100); + }, 300); }); return () => { Keyboard.removeListener('keyboardDidShow', () => { - setButtonHide(true); + setTimeout(() => { + setButtonHide(true); + }, 300); }); Keyboard.removeListener('keyboardDidHide', () => { setTimeout(() => { setButtonHide(false); - }, 100); + }, 300); }); }; }, []); @@ -67,8 +75,11 @@ export const Container = ({ }}> {children} - {buttonHide || noBottomButton ? null : ( - - + )} diff --git a/apps/mobile/src/components/Menu/index.js b/apps/mobile/src/components/Menu/index.js index 509ded602..2a70abd05 100644 --- a/apps/mobile/src/components/Menu/index.js +++ b/apps/mobile/src/components/Menu/index.js @@ -6,6 +6,7 @@ import { Text, TouchableOpacity, View, + DeviceEventEmitter, } from 'react-native'; import FastStorage from 'react-native-fast-storage'; import Icon from 'react-native-vector-icons/Feather'; @@ -30,6 +31,8 @@ export const Menu = ({close = () => {}, hide, update = () => {}}) => { // todo + let overlayRef; + function changeColorScheme(colors = COLOR_SCHEME, accent = ACCENT) { let newColors = setColorScheme(colors, accent); StatusBar.setBarStyle(newColors.night ? 'light-content' : 'dark-content'); @@ -116,6 +119,19 @@ export const Menu = ({close = () => {}, hide, update = () => {}}) => { marginTop: Platform.OS == 'ios' ? 0 : StatusBar.currentHeight - 10, }} /> + (overlayRef = ref)} + onLayout={() => { + DeviceEventEmitter.emit('sendOverlayViewRef', {ref: overlayRef}); + }} + style={{ + height: '100%', + width: '100%', + position: 'absolute', + zIndex: 999, + backgroundColor: colors.bg, + }} + /> ( - - + {item.favorite ? ( + + ) : null} { const [state, dispatch] = useTracked(); const {colors} = state; - /// - const updateDB = () => {}; - // Local State const [sidebar, setSidebar] = useState(DDS.isTab ? true : false); - const [noteProps, setNoteProps] = useState({ - tags: [], - locked: false, - pinned: false, - favorite: false, - colors: [], - }); - // FUNCTIONS const post = value => EditorWebView.postMessage(value); @@ -72,8 +59,7 @@ const Editor = ({navigation}) => { timer = null; onChange(evt.nativeEvent.data); timer = setTimeout(() => { - saveNote(noteProps, true); - console.log('saved'); + saveNote(true); }, 1000); } }; @@ -103,8 +89,8 @@ const Editor = ({navigation}) => { }, dateCreated: timestamp, }); - updateDB(); - if (lockNote && noteProps.locked) { + + if (lockNote && db.getNote(timestamp).locked) { db.lockNote(timestamp, 'password'); } }; @@ -118,15 +104,6 @@ const Editor = ({navigation}) => { }; const updateEditor = () => { - let props = { - tags: note.tags, - colors: note.colors, - pinned: note.pinned, - favorite: note.favorite, - locked: note.locked, - }; - setNoteProps({...props}); - post(JSON.stringify(note.content.delta)); post( JSON.stringify({ diff --git a/apps/mobile/src/views/Tags/index.js b/apps/mobile/src/views/Tags/index.js index 2d14fd705..e9964fe64 100644 --- a/apps/mobile/src/views/Tags/index.js +++ b/apps/mobile/src/views/Tags/index.js @@ -12,98 +12,92 @@ const h = Dimensions.get('window').height; export const Tags = ({navigation}) => { const [state, dispatch] = useTracked(); const {colors} = state; - let isFocused = useIsFocused(); - if (!isFocused) { - console.log('block rerender'); - return <>; - } else { - return ( - -
+ return ( + +
- - + + + - - - Tags added to notes appear here - - - No tags found - - - } - renderItem={({item, index}) => ( - + + No tags found + + + } + renderItem={({item, index}) => ( + + - - # - - {item.slice(1)} - - {'\n'} - - 10 notes - + # - - )} - /> - - - ); - } + {item.slice(1)} + + {'\n'} + + 10 notes + + + + )} + /> + + + ); }; Tags.navigationOptions = {