fix: notes not change

This commit is contained in:
ammarahm-ed
2020-05-04 15:56:47 +05:00
parent ed1dd6c06f
commit 12d545b7ac
2 changed files with 13 additions and 7 deletions

View File

@@ -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={{

View File

@@ -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);