diff --git a/apps/mobile/src/components/Container/index.js b/apps/mobile/src/components/Container/index.js index 22413a87e..20ad03b8e 100644 --- a/apps/mobile/src/components/Container/index.js +++ b/apps/mobile/src/components/Container/index.js @@ -98,20 +98,19 @@ export const Container = ({ data[0].data ? db.notes.all : data, text, ); - - if (!searchResults && searchResults.length < 0) { - ToastEvent.show('No search results found', 'error', 3000, () => {}, ''); + if (!searchResult || searchResult.length === 0) { + ToastEvent.show('No search results found for ' + text, 'error'); return; + } else { + dispatch({ + type: ACTIONS.SEARCH_RESULTS, + results: { + type, + results: searchResult, + keyword: text, + }, + }); } - - dispatch({ - type: ACTIONS.SEARCH_RESULTS, - results: { - type, - results: searchResult, - keyword: text, - }, - }); }; const onBlur = () => { diff --git a/apps/mobile/src/components/Menu/index.js b/apps/mobile/src/components/Menu/index.js index b131edb9e..296452e3b 100644 --- a/apps/mobile/src/components/Menu/index.js +++ b/apps/mobile/src/components/Menu/index.js @@ -206,7 +206,14 @@ export const Menu = ({ inputRef.current?.setNativeProps({ text: '', }); - dispatch({type: ACTIONS.SEARCH_RESULTS, results: []}); + dispatch({ + type: ACTIONS.SEARCH_RESULTS, + results: { + type: null, + results: [], + keyword: null, + }, + }); } item.func(); }} diff --git a/apps/mobile/src/utils/storage.js b/apps/mobile/src/utils/storage.js index 149c2611b..63f656c01 100644 --- a/apps/mobile/src/utils/storage.js +++ b/apps/mobile/src/utils/storage.js @@ -7,17 +7,15 @@ async function read(key, isArray = false) { let data; if (isArray) { data = await getArray(key); - data.push('hello'); } else { data = await FastStorage.getMap(key); } - console.log('READ', data, key); + return data; } async function write(key, data) { if (data.length !== undefined) { - console.log(data, key); return await setArray(key, data); } else { return await FastStorage.setMap(key, data);