diff --git a/apps/mobile/src/components/Menu/index.js b/apps/mobile/src/components/Menu/index.js index eb41ba07c..aaf982215 100644 --- a/apps/mobile/src/components/Menu/index.js +++ b/apps/mobile/src/components/Menu/index.js @@ -27,7 +27,7 @@ import { import {useTracked} from '../../provider'; import {ACTIONS} from '../../provider/actions'; import {eSendEvent} from '../../services/eventManager'; -import {eClearSearch, eOpenModalMenu} from '../../services/events'; +import {eClearSearch, eOpenModalMenu, refreshNotesPage} from '../../services/events'; import NavigationService from '../../services/NavigationService'; import {db, DDS, hexToRGBA, timeSince, ToastEvent} from '../../utils/utils'; import {sideMenuOverlayRef} from '../../utils/refs'; @@ -320,6 +320,7 @@ export const Menu = ({ tag: item, type: 'tag', }); + }} style={{ flexDirection: 'row', @@ -383,11 +384,13 @@ export const Menu = ({ key={item.id} activeOpacity={opacity / 2} onPress={() => { - NavigationService.navigate('Notes', { + let params = { type: 'color', title: item.title, color: item, - }); + } + NavigationService.navigate('Notes', params); + eSendEvent(refreshNotesPage, params); close(); }} style={{ @@ -496,7 +499,6 @@ export const Menu = ({ activeOpacity={opacity / 2} onPress={() => { item.close === false ? null : close(); - item.func(); }} style={{ diff --git a/apps/mobile/src/views/Notes/index.js b/apps/mobile/src/views/Notes/index.js index 2d50617af..29c35ef61 100644 --- a/apps/mobile/src/views/Notes/index.js +++ b/apps/mobile/src/views/Notes/index.js @@ -37,6 +37,7 @@ export const Notes = ({navigation}) => { }; } }, []); + useEffect(() => { if (isFocused) { init(); @@ -45,6 +46,7 @@ export const Notes = ({navigation}) => { screen: params.type, }); } else { + setNotes([]); editing.actionAfterFirstSave = { type: null, }; @@ -53,7 +55,6 @@ export const Notes = ({navigation}) => { useEffect(() => { eSubscribeEvent(refreshNotesPage, init); - return () => { eUnSubscribeEvent(refreshNotesPage, init); editing.actionAfterFirstSave = { @@ -62,8 +63,11 @@ export const Notes = ({navigation}) => { }; }, []); - const init = () => { - console.log(params.color); + const init = (data) => { + params = navigation.state.params; + if (data) { + params = data; + } eSendEvent(eScrollEvent, 0); if (params.type === 'tag') { let notesInTag = db.notes.tagged(params.tag.title);