Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix crash

ammarahm-ed5bf59664fa62
diff --git a/apps/mobile/src/components/NotesList/index.js b/apps/mobile/src/components/NotesList/index.js
index cd96165a9..1b31fde51 100644
--- a/apps/mobile/src/components/NotesList/index.js
+++ b/apps/mobile/src/components/NotesList/index.js
@@ -15,13 +15,16 @@ import {NotesPlaceHolder} from '../ListPlaceholders';
import NoteItem from '../NoteItem';
import SelectionWrapper from '../SelectionWrapper';
-export const NotesList = ({
- isSearch = false,
- isGrouped = false,
- searchResults,
-}) => {
+export const NotesList = ({isGrouped = false}) => {
const [state, dispatch] = useTracked();
- const {colors, selectionMode, currentEditingNote, loading} = state;
+ const {
+ colors,
+ selectionMode,
+ currentEditingNote,
+ loading,
+ searchResults,
+ keyword,
+ } = state;
const notes = [...state.notes];
const _renderItem = ({item, index}) => (
@@ -165,7 +168,7 @@ export const NotesList = ({
const _listKeyExtractor = (item, index) => item.dateCreated.toString();
- return isGrouped && !isSearch ? (
+ return isGrouped && searchResults.length === 0 ? (
<SectionList
ref={ref => (sectionListRef = ref)}
sections={notes}
diff --git a/apps/mobile/src/provider/defaultState.js b/apps/mobile/src/provider/defaultState.js
index 13c9c03da..6ebb53d06 100644
--- a/apps/mobile/src/provider/defaultState.js
+++ b/apps/mobile/src/provider/defaultState.js
@@ -33,4 +33,6 @@ export const defaultState = {
isLoginNavigator: false,
currenEditingNote: null,
loading: true,
+ searchResults: [],
+ keyword: [],
};
diff --git a/apps/mobile/src/views/Editor/index.js b/apps/mobile/src/views/Editor/index.js
index ea1a01610..47f91b12f 100755
--- a/apps/mobile/src/views/Editor/index.js
+++ b/apps/mobile/src/views/Editor/index.js
@@ -421,8 +421,8 @@ const Editor = ({navigation, noMenu}) => {
Platform.OS === 'ios'
? sourceUri
: {
- uri: 'http://192.168.10.7:8080/texteditor.html',
- baseUrl: 'http://192.168.10.7:8080',
+ uri: 'file:///android_asset/texteditor.html',
+ baseUrl: 'file:///android_asset/',
}
}
style={{
diff --git a/apps/mobile/src/views/Home/index.js b/apps/mobile/src/views/Home/index.js
index e47abe440..6e81e8aed 100755
--- a/apps/mobile/src/views/Home/index.js
+++ b/apps/mobile/src/views/Home/index.js
@@ -16,19 +16,15 @@ export const AnimatedSafeAreaView = Animatable.createAnimatableComponent(
);
export const Home = ({navigation}) => {
- // State
const [state, dispatch] = useTracked();
- const {notes, searchResults, keyword} = state;
- const isFocused = useIsFocused();
+ const {notes} = state;
- // Effects
+ const isFocused = useIsFocused();
useEffect(() => {
dispatch({type: ACTIONS.NOTES});
}, [isFocused]);
- // Render
-
return (
<Container
bottomButtonText="Add a new note"
@@ -41,13 +37,8 @@ export const Home = ({navigation}) => {
NavigationService.navigate('Editor');
}
}}
- data={notes}>
- <NotesList
- isGrouped={true}
- isSearch={searchResults.length > 0 ? true : false}
- searchResults={searchResults.length > 0 ? searchResults : null}
- keyword={keyword}
- />
+ data={notes ? notes : []}>
+ <NotesList isGrouped={true} />
</Container>
);
};