Skip to content

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

fix: crash due to missing import

ammarahm-edb31f7f47d04a
diff --git a/apps/mobile/src/views/Editor/index.js b/apps/mobile/src/views/Editor/index.js
index c89939c2e..526b31848 100755
--- a/apps/mobile/src/views/Editor/index.js
+++ b/apps/mobile/src/views/Editor/index.js
@@ -27,6 +27,7 @@ import ActionSheet from '../../components/ActionSheet';
import {ActionSheetComponent} from '../../components/ActionSheetComponent';
import {VaultDialog} from '../../components/VaultDialog';
import NavigationService from '../../services/NavigationService';
+import {useIsFocused} from 'react-navigation-hooks';
const w = Dimensions.get('window').width;
const h = Dimensions.get('window').height;
@@ -39,291 +40,292 @@ let timer = null;
let note = {};
const Editor = ({navigation}) => {
- if (!isFocused) {
- console.log('block rerender');
- return <></>;
- } else {
- // Global State
- const {colors} = useAppContext();
-
- // Local State
-
- const [dialog, setDialog] = useState(false);
- const [isOpen, setOpen] = useState(false);
- const [sidebar, setSidebar] = useState(DDS.isTab ? true : false);
- const [vaultDialog, setVaultDialog] = useState(false);
- const [unlock, setUnlock] = useState(false);
- const [visible, setVisible] = useState(false);
- const [noteProps, setNoteProps] = useState({
- tags: [],
- locked: false,
- pinned: false,
- favorite: false,
- colors: [],
+ // Global State
+ const {colors} = useAppContext();
+
+ // Local State
+
+ const [dialog, setDialog] = useState(false);
+ const [isOpen, setOpen] = useState(false);
+ const [sidebar, setSidebar] = useState(DDS.isTab ? true : false);
+ const [vaultDialog, setVaultDialog] = useState(false);
+ const [unlock, setUnlock] = useState(false);
+ const [visible, setVisible] = useState(false);
+ const [noteProps, setNoteProps] = useState({
+ tags: [],
+ locked: false,
+ pinned: false,
+ favorite: false,
+ colors: [],
+ });
+
+ // VARIABLES
+
+ let willRefresh = false;
+ let customNote = null;
+ let actionSheet;
+ let show;
+ const isFocused = useIsFocused();
+ // FUNCTIONS
+
+ const post = value => EditorWebView.postMessage(value);
+
+ const onChange = data => {
+ if (data !== '') {
+ content = JSON.parse(data);
+ }
+ };
+
+ const saveNote = async (noteProps = {}, lockNote = true) => {
+ if (!content) {
+ content = {
+ text: '',
+ delta: null,
+ };
+ }
+
+ timestamp = await db.addNote({
+ ...noteProps,
+ title,
+ content: {
+ text: content.text,
+ delta: content.delta,
+ },
+ dateCreated: timestamp,
});
- // VARIABLES
-
- let willRefresh = false;
- let customNote = null;
- let actionSheet;
- let show;
- // FUNCTIONS
-
- const post = value => EditorWebView.postMessage(value);
-
- const onChange = data => {
- if (data !== '') {
- content = JSON.parse(data);
- }
+ if (lockNote && noteProps.locked) {
+ db.lockNote(timestamp, 'password');
+ }
+ };
+
+ const onWebViewLoad = () => {
+ post(JSON.stringify(colors));
+ if (navigation.state.params && navigation.state.params.note) {
+ note = navigation.state.params.note;
+ updateEditor();
+ }
+ };
+
+ const updateEditor = () => {
+ let props = {
+ tags: note.tags,
+ colors: note.colors,
+ pinned: note.pinned,
+ favorite: note.favorite,
+ locked: note.locked,
};
+ setNoteProps({...props});
- const saveNote = async (noteProps = {}, lockNote = true) => {
- if (!content) {
- content = {
- text: '',
- delta: null,
- };
- }
-
- timestamp = await db.addNote({
- ...noteProps,
- title,
- content: {
- text: content.text,
- delta: content.delta,
- },
- dateCreated: timestamp,
+ post(JSON.stringify(note.content.delta));
+ setTimeout(() => {
+ title = note.title;
+ titleRef.setNativeProps({
+ text: title,
});
-
- if (lockNote && noteProps.locked) {
- db.lockNote(timestamp, 'password');
- }
- };
-
- const onWebViewLoad = () => {
- post(JSON.stringify(colors));
- if (navigation.state.params && navigation.state.params.note) {
- note = navigation.state.params.note;
- updateEditor();
- }
- };
-
- 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));
- setTimeout(() => {
- title = note.title;
- titleRef.setNativeProps({
- text: title,
- });
- timestamp = note.dateCreated;
- content = note.content;
- }, 200);
- };
-
- const onTitleTextChange = value => {
- title = value;
- };
-
- const onMenuHide = () => {
- if (show) {
- if (show === 'lock') {
- if (unlock) {
- setUnlock(false);
- }
- setVaultDialog(true);
- } else if (show === 'unlock') {
- setUnlock(true);
- setVaultDialog(true);
- } else if (show == 'delete') {
- setVisible(true);
+ timestamp = note.dateCreated;
+ content = note.content;
+ }, 200);
+ };
+
+ const onTitleTextChange = value => {
+ title = value;
+ };
+
+ const onMenuHide = () => {
+ if (show) {
+ if (show === 'lock') {
+ if (unlock) {
+ setUnlock(false);
}
+ setVaultDialog(true);
+ } else if (show === 'unlock') {
+ setUnlock(true);
+ setVaultDialog(true);
+ } else if (show == 'delete') {
+ setVisible(true);
}
- };
-
- const deleteItem = async () => {
- await db.deleteNotes([note]);
- ToastEvent.show('Note moved to trash', 'success', 3000);
- setVisible(false);
- navigation.goBack();
- };
-
- const _renderEditor = () => {
- return (
- <KeyboardAvoidingView
- behavior={Platform.OS === 'ios' ? 'padding' : null}
- style={{height: '100%'}}>
+ }
+ };
+
+ const deleteItem = async () => {
+ await db.deleteNotes([note]);
+ ToastEvent.show('Note moved to trash', 'success', 3000);
+ setVisible(false);
+ navigation.goBack();
+ };
+
+ const _renderEditor = () => {
+ return (
+ <KeyboardAvoidingView
+ behavior={Platform.OS === 'ios' ? 'padding' : null}
+ style={{height: '100%'}}>
+ <View
+ style={{
+ height: '100%',
+ }}>
<View
style={{
- height: '100%',
+ flexDirection: 'row',
+ justifyContent: 'flex-start',
+ alignItems: 'center',
+ paddingHorizontal: 12,
+ width: '100%',
+ alignSelf: 'center',
+ height: 50,
+
+ marginTop: Platform.OS == 'ios' ? 0 : StatusBar.currentHeight,
}}>
- <View
+ <TouchableOpacity
+ onPress={() => {
+ setDialog(true);
+ }}
style={{
- flexDirection: 'row',
- justifyContent: 'flex-start',
- alignItems: 'center',
- paddingHorizontal: 12,
- width: '100%',
- alignSelf: 'center',
- height: 50,
-
- marginTop: Platform.OS == 'ios' ? 0 : StatusBar.currentHeight,
+ width: '12.5%',
+ height: 40,
+ justifyContent: 'center',
+ alignItems: 'flex-start',
}}>
- <TouchableOpacity
- onPress={() => {
- setDialog(true);
- }}
- style={{
- width: '12.5%',
- height: 40,
- justifyContent: 'center',
- alignItems: 'flex-start',
- }}>
- <Icon
- style={{
- marginLeft: -7,
- }}
- name="chevron-left"
- color={colors.icon}
- size={SIZE.xxxl - 3}
- />
- </TouchableOpacity>
-
- <TextInput
- placeholder="Untitled Note"
- ref={ref => (titleRef = ref)}
- placeholderTextColor={colors.icon}
- defaultValue={note && note.title ? note.title : title}
+ <Icon
style={{
- width: '75%',
- fontFamily: WEIGHT.bold,
- fontSize: SIZE.xl,
- color: colors.pri,
- maxWidth: '75%',
- paddingVertical: 0,
- paddingHorizontal: 0,
+ marginLeft: -7,
}}
- onChangeText={onTitleTextChange}
- onSubmitEditing={saveNote}
+ name="chevron-left"
+ color={colors.icon}
+ size={SIZE.xxxl - 3}
/>
+ </TouchableOpacity>
- <TouchableOpacity
- onPress={() => {
- DDS.isTab
- ? setSidebar(!sidebar)
- : actionSheet._setModalVisible();
- }}
- style={{
- width: '12.5%',
- height: 40,
- justifyContent: 'center',
- alignItems: 'flex-end',
- }}>
- <Icon
- name="more-horizontal"
- color={colors.icon}
- size={SIZE.xxxl}
- />
- </TouchableOpacity>
- </View>
-
- <WebView
- ref={ref => (EditorWebView = ref)}
- onError={error => console.log(error)}
- onLoad={onWebViewLoad}
- javaScriptEnabled
- onShouldStartLoadWithRequest={request => {
- if (request.url.includes('https')) {
- Linking.openURL(request.url);
- return false;
- } else {
- return true;
- }
- }}
- renderLoading={() => (
- <View
- style={{
- width: '100%',
- height: '100%',
- backgroundColor: 'transparent',
- }}
- />
- )}
- cacheEnabled={true}
- cacheMode="LOAD_CACHE_ELSE_NETWORK"
- domStorageEnabled
- scrollEnabled={false}
- bounces={true}
- scalesPageToFit={true}
- source={
- Platform.OS === 'ios'
- ? require('./web/texteditor.html')
- : {
- uri: 'file:///android_asset/texteditor.html',
- baseUrl: 'baseUrl:"file:///android_asset/',
- }
- }
+ <TextInput
+ placeholder="Untitled Note"
+ ref={ref => (titleRef = ref)}
+ placeholderTextColor={colors.icon}
+ defaultValue={note && note.title ? note.title : title}
style={{
- height: '100%',
- maxHeight: '100%',
- backgroundColor: 'transparent',
- }}
- onMessage={evt => {
- if (evt.nativeEvent.data !== '') {
- clearTimeout(timer);
- timer = null;
- onChange(evt.nativeEvent.data);
- timer = setTimeout(() => {
- saveNote(noteProps, true);
- console.log('saved');
- }, 1000);
- }
+ width: '75%',
+ fontFamily: WEIGHT.bold,
+ fontSize: SIZE.xl,
+ color: colors.pri,
+ maxWidth: '75%',
+ paddingVertical: 0,
+ paddingHorizontal: 0,
}}
+ onChangeText={onTitleTextChange}
+ onSubmitEditing={saveNote}
/>
+
+ <TouchableOpacity
+ onPress={() => {
+ DDS.isTab
+ ? setSidebar(!sidebar)
+ : actionSheet._setModalVisible();
+ }}
+ style={{
+ width: '12.5%',
+ height: 40,
+ justifyContent: 'center',
+ alignItems: 'flex-end',
+ }}>
+ <Icon
+ name="more-horizontal"
+ color={colors.icon}
+ size={SIZE.xxxl}
+ />
+ </TouchableOpacity>
</View>
- </KeyboardAvoidingView>
- );
- };
- // EFFECTS
+ <WebView
+ ref={ref => (EditorWebView = ref)}
+ onError={error => console.log(error)}
+ onLoad={onWebViewLoad}
+ javaScriptEnabled
+ onShouldStartLoadWithRequest={request => {
+ if (request.url.includes('https')) {
+ Linking.openURL(request.url);
+ return false;
+ } else {
+ return true;
+ }
+ }}
+ renderLoading={() => (
+ <View
+ style={{
+ width: '100%',
+ height: '100%',
+ backgroundColor: 'transparent',
+ }}
+ />
+ )}
+ cacheEnabled={true}
+ cacheMode="LOAD_CACHE_ELSE_NETWORK"
+ domStorageEnabled
+ scrollEnabled={false}
+ bounces={true}
+ scalesPageToFit={true}
+ source={
+ Platform.OS === 'ios'
+ ? require('./web/texteditor.html')
+ : {
+ uri: 'file:///android_asset/texteditor.html',
+ baseUrl: 'baseUrl:"file:///android_asset/',
+ }
+ }
+ style={{
+ height: '100%',
+ maxHeight: '100%',
+ backgroundColor: 'transparent',
+ }}
+ onMessage={evt => {
+ if (evt.nativeEvent.data !== '') {
+ clearTimeout(timer);
+ timer = null;
+ onChange(evt.nativeEvent.data);
+ timer = setTimeout(() => {
+ saveNote(noteProps, true);
+ console.log('saved');
+ }, 1000);
+ }
+ }}
+ />
+ </View>
+ </KeyboardAvoidingView>
+ );
+ };
+
+ // EFFECTS
- useEffect(() => {
- let handleBack = BackHandler.addEventListener('hardwareBackPress', () => {
- setDialog(true);
- return true;
- });
- return () => {
- handleBack.remove();
- handleBack = null;
- title = null;
- content = null;
- timer = null;
- timestamp = null;
- };
- }, []);
-
- useEffect(() => {
- SideMenuEvent.close();
- SideMenuEvent.disable();
- return () => {
- DDS.isTab ? SideMenuEvent.open() : null;
- SideMenuEvent.enable();
- };
+ useEffect(() => {
+ let handleBack = BackHandler.addEventListener('hardwareBackPress', () => {
+ setDialog(true);
+ return true;
});
+ return () => {
+ handleBack.remove();
+ handleBack = null;
+ title = null;
+ content = null;
+ timer = null;
+ timestamp = null;
+ };
+ }, []);
+
+ useEffect(() => {
+ SideMenuEvent.close();
+ SideMenuEvent.disable();
+ return () => {
+ DDS.isTab ? SideMenuEvent.open() : null;
+ SideMenuEvent.enable();
+ };
+ });
- useEffect(() => {
- EditorWebView.reload();
- }, [colors]);
+ useEffect(() => {
+ EditorWebView.reload();
+ }, [colors]);
+ if (!isFocused) {
+ console.log('block rerender');
+ return <></>;
+ } else {
return DDS.isTab ? (
<View
style={{
diff --git a/apps/mobile/src/views/Favorites/index.js b/apps/mobile/src/views/Favorites/index.js
index f2e84a6a5..c57511167 100644
--- a/apps/mobile/src/views/Favorites/index.js
+++ b/apps/mobile/src/views/Favorites/index.js
@@ -9,6 +9,7 @@ import NoteItem from '../../components/NoteItem';
import {NotebookItem} from '../../components/NotebookItem';
import {FavoritesPlaceHolder} from '../../components/ListPlaceholders';
import Container from '../../components/Container';
+import {useIsFocused} from 'react-navigation-hooks';
export const Favorites = ({navigation}) => {
// Global State
@@ -29,36 +30,35 @@ export const Favorites = ({navigation}) => {
// Variables
let isFocused = useIsFocused();
+ let offsetY = 0;
+ let countUp = 1;
+ let countDown = 0;
+
+ // Functions
+
+ // Effects
+ const onScroll = event => {
+ let y = event.nativeEvent.contentOffset.y;
+ if (buttonHide) return;
+ if (y < 30) setHideHeader(false);
+ if (y > offsetY) {
+ if (y - offsetY < 150 || countDown > 0) return;
+ countDown = 1;
+ countUp = 0;
+ setHideHeader(true);
+ } else {
+ if (offsetY - y < 150 || countUp > 0) return;
+ countDown = 0;
+ countUp = 1;
+ setHideHeader(false);
+ }
+ offsetY = y;
+ };
+ // Render
if (!isFocused) {
console.log('block rerender');
return <></>;
} else {
- let offsetY = 0;
- let countUp = 1;
- let countDown = 0;
-
- // Functions
-
- // Effects
- const onScroll = event => {
- let y = event.nativeEvent.contentOffset.y;
- if (buttonHide) return;
- if (y < 30) setHideHeader(false);
- if (y > offsetY) {
- if (y - offsetY < 150 || countDown > 0) return;
- countDown = 1;
- countUp = 0;
- setHideHeader(true);
- } else {
- if (offsetY - y < 150 || countUp > 0) return;
- countDown = 0;
- countUp = 1;
- setHideHeader(false);
- }
- offsetY = y;
- };
- // Render
-
return (
<Container noBottomButton={true}>
<Animatable.View
diff --git a/apps/mobile/src/views/Folders/index.js b/apps/mobile/src/views/Folders/index.js
index 3e291edc6..2333d9c3f 100644
--- a/apps/mobile/src/views/Folders/index.js
+++ b/apps/mobile/src/views/Folders/index.js
@@ -13,6 +13,7 @@ import Container from '../../components/Container';
import SelectionHeader from '../../components/SelectionHeader';
import SelectionWrapper from '../../components/SelectionWrapper';
import {w} from '../../utils/utils';
+import {useIsFocused} from 'react-navigation-hooks';
export const Folders = ({navigation}) => {
const {
@@ -29,33 +30,33 @@ export const Folders = ({navigation}) => {
let isFocused = useIsFocused();
+ const params = navigation.state.params;
+ let offsetY = 0;
+ let countUp = 0;
+ let countDown = 0;
+
+ const onScroll = event => {
+ y = event.nativeEvent.contentOffset.y;
+ if (y < 30) setHideHeader(false);
+ //if (buttonHide) return;
+ if (y > offsetY) {
+ if (y - offsetY < 150 || countDown > 0) return;
+ countDown = 1;
+ countUp = 0;
+ setHideHeader(true);
+ } else {
+ if (offsetY - y < 150 || countUp > 0) return;
+ countDown = 0;
+ countUp = 1;
+ setHideHeader(false);
+ }
+ offsetY = y;
+ };
+
if (!isFocused) {
console.log('block rerender');
return <></>;
} else {
- const params = navigation.state.params;
- let offsetY = 0;
- let countUp = 0;
- let countDown = 0;
-
- const onScroll = event => {
- y = event.nativeEvent.contentOffset.y;
- if (y < 30) setHideHeader(false);
- //if (buttonHide) return;
- if (y > offsetY) {
- if (y - offsetY < 150 || countDown > 0) return;
- countDown = 1;
- countUp = 0;
- setHideHeader(true);
- } else {
- if (offsetY - y < 150 || countUp > 0) return;
- countDown = 0;
- countUp = 1;
- setHideHeader(false);
- }
- offsetY = y;
- };
- console.log('rerendering folders');
return (
<Container
bottomButtonText="Add a new notebook"
diff --git a/apps/mobile/src/views/Home/index.js b/apps/mobile/src/views/Home/index.js
index 6e4eee97b..2c14c8175 100755
--- a/apps/mobile/src/views/Home/index.js
+++ b/apps/mobile/src/views/Home/index.js
@@ -26,79 +26,73 @@ export const Home = ({navigation}) => {
// Variables
let isFocused = useIsFocused();
+ let offsetY = 0;
+ let countUp = 1;
+ let countDown = 0;
+ let searchResult = null;
+
+ // Effects
+
+ useEffect(() => {
+ DDS.isTab ? setMenuOpen() : null;
+ }, []);
+
+ // Functions
+
+ const onChangeText = value => {
+ setText(value);
+ };
+ const onSubmitEditing = async () => {
+ if (!text || text.length < 1) {
+ clearSearch();
+ } else {
+ setKeyword(text);
+ searchResult = await db.searchNotes(text);
+
+ if (searchResult && searchResult.length > 0) {
+ setSearchResults([...searchResult]);
+ } else {
+ ToastEvent.show('No search results found', 'error', 3000, () => {}, '');
+ }
+ }
+ };
+
+ const onBlur = () => {
+ if (text && text.length < 1) {
+ clearSearch();
+ }
+ };
+
+ const onFocus = () => {
+ //setSearch(false);
+ };
+
+ const clearSearch = () => {
+ searchResult = null;
+ setSearchResults([...[]]);
+ };
+
+ const onScroll = y => {
+ if (searchResults.length > 0) return;
+ if (y < 30) setHideHeader(false);
+ if (y > offsetY) {
+ if (y - offsetY < 150 || countDown > 0) return;
+ countDown = 1;
+ countUp = 0;
+ setHideHeader(true);
+ } else {
+ if (offsetY - y < 150 || countUp > 0) return;
+ countDown = 0;
+ countUp = 1;
+ setHideHeader(false);
+ }
+ offsetY = y;
+ };
+
if (!isFocused) {
console.log('block rerender');
return <></>;
} else {
- let offsetY = 0;
- let countUp = 1;
- let countDown = 0;
- let searchResult = null;
-
- // Effects
-
- useEffect(() => {
- DDS.isTab ? setMenuOpen() : null;
- }, []);
-
- // Functions
-
- const onChangeText = value => {
- setText(value);
- };
- const onSubmitEditing = async () => {
- if (!text || text.length < 1) {
- clearSearch();
- } else {
- setKeyword(text);
- searchResult = await db.searchNotes(text);
-
- if (searchResult && searchResult.length > 0) {
- setSearchResults([...searchResult]);
- } else {
- ToastEvent.show(
- 'No search results found',
- 'error',
- 3000,
- () => {},
- '',
- );
- }
- }
- };
-
- const onBlur = () => {
- if (text && text.length < 1) {
- clearSearch();
- }
- };
-
- const onFocus = () => {
- //setSearch(false);
- };
-
- const clearSearch = () => {
- searchResult = null;
- setSearchResults([...[]]);
- };
-
- const onScroll = y => {
- if (searchResults.length > 0) return;
- if (y < 30) setHideHeader(false);
- if (y > offsetY) {
- if (y - offsetY < 150 || countDown > 0) return;
- countDown = 1;
- countUp = 0;
- setHideHeader(true);
- } else {
- if (offsetY - y < 150 || countUp > 0) return;
- countDown = 0;
- countUp = 1;
- setHideHeader(false);
- }
- offsetY = y;
- };
-
// Render
console.log('rerendering home');
return (
diff --git a/apps/mobile/src/views/Notebook/index.js b/apps/mobile/src/views/Notebook/index.js
index b89e0b999..755557866 100644
--- a/apps/mobile/src/views/Notebook/index.js
+++ b/apps/mobile/src/views/Notebook/index.js
@@ -19,21 +19,21 @@ export const Notebook = ({navigation}) => {
let isFocused = useIsFocused();
- if (!isFocused) {
- console.log('block rerender');
- return <></>;
- } else {
- // State
+ // State
- // Variables
- let offsetY = 0;
- let countUp = 0;
- let countDown = 0;
+ // Variables
+ let offsetY = 0;
+ let countUp = 0;
+ let countDown = 0;
- // Effects
+ // Effects
- // Functions
+ // Functions
+ if (!isFocused) {
+ console.log('block rerender');
+ return <></>;
+ } else {
// Render
return (
<Container
diff --git a/apps/mobile/src/views/Notes/index.js b/apps/mobile/src/views/Notes/index.js
index c6175ffb7..6f93d2078 100644
--- a/apps/mobile/src/views/Notes/index.js
+++ b/apps/mobile/src/views/Notes/index.js
@@ -1,30 +1,12 @@
import React, {useEffect, useState} from 'react';
-import {
- Text,
- TouchableOpacity,
- Dimensions,
- KeyboardAvoidingView,
-} from 'react-native';
-import {
- SIZE,
- ph,
- pv,
- opacity,
- WEIGHT,
- onThemeUpdate,
- clearThemeUpdateListener,
-} from '../../common/common';
-import Icon from 'react-native-vector-icons/Feather';
import {Header} from '../../components/header';
import {Search} from '../../components/SearchInput';
-import {useForceUpdate} from '../ListsEditor';
import {NotesList} from '../../components/NotesList';
-import {AnimatedSafeAreaView} from '../Home';
import {db} from '../../../App';
import * as Animatable from 'react-native-animatable';
import {useAppContext} from '../../provider/useAppContext';
-import {w} from '../../utils/utils';
import Container from '../../components/Container';
+import {useIsFocused} from 'react-navigation-hooks';
export const Notes = ({navigation}) => {
const {colors} = useAppContext();
@@ -32,47 +14,35 @@ export const Notes = ({navigation}) => {
const [margin, setMargin] = useState(200);
const [buttonHide, setButtonHide] = useState(false);
const [notes, setNotes] = useState([]);
- const forceUpdate = useForceUpdate();
let isFocused = useIsFocused();
+ let params = navigation.state ? navigation.state.params : null;
+ let offsetY = 0;
+ let countUp = 0;
+ let countDown = 0;
+ let headerHeight = 0;
+ let searchHeight = 0;
+ let marginSet = false;
+
+ useEffect(() => {
+ if (!params) {
+ params = {
+ heading: 'Notes',
+ };
+ }
+ }, []);
+
+ useEffect(() => {
+ let allNotes = db.getTopic(params.notebookID, params.title);
+ if (allNotes && allNotes.length > 0) {
+ setNotes(allNotes);
+ }
+ }, []);
if (!isFocused) {
console.log('block rerender');
return <></>;
} else {
- let params = navigation.state ? navigation.state.params : null;
- let offsetY = 0;
- let countUp = 0;
- let countDown = 0;
- let headerHeight = 0;
- let searchHeight = 0;
- let marginSet = false;
- useEffect(() => {
- onThemeUpdate(() => {
- forceUpdate();
- });
- return () => {
- clearThemeUpdateListener(() => {
- forceUpdate();
- });
- };
- }, []);
-
- useEffect(() => {
- if (!params) {
- params = {
- heading: 'Notes',
- };
- }
- }, []);
-
- useEffect(() => {
- let allNotes = db.getTopic(params.notebookID, params.title);
- if (allNotes && allNotes.length > 0) {
- setNotes(allNotes);
- }
- }, []);
-
return (
<Container
bottomButtonText="Create a new note"
diff --git a/apps/mobile/src/views/Settings/index.js b/apps/mobile/src/views/Settings/index.js
index c63711058..6edcce33c 100644
--- a/apps/mobile/src/views/Settings/index.js
+++ b/apps/mobile/src/views/Settings/index.js
@@ -19,7 +19,6 @@ import Icon from 'react-native-vector-icons/Feather';
import {Header} from '../../components/header';
import {FlatList} from 'react-native-gesture-handler';
import AsyncStorage from '@react-native-community/async-storage';
-import {AnimatedSafeAreaView} from '../Home';
import {useAppContext} from '../../provider/useAppContext';
import {useIsFocused} from 'react-navigation-hooks';
import Container from '../../components/Container';
diff --git a/apps/mobile/src/views/Trash/index.js b/apps/mobile/src/views/Trash/index.js
index 8495ea9e6..4bfade850 100644
--- a/apps/mobile/src/views/Trash/index.js
+++ b/apps/mobile/src/views/Trash/index.js
@@ -1,12 +1,6 @@
import React, {useEffect, useState} from 'react';
-import {
- Text,
- TouchableOpacity,
- SafeAreaView,
- FlatList,
- View,
-} from 'react-native';
-import {SIZE, ph, pv, opacity, WEIGHT} from '../../common/common';
+import {Text, FlatList, View} from 'react-native';
+import {SIZE, WEIGHT} from '../../common/common';
import Icon from 'react-native-vector-icons/Feather';
import {Header} from '../../components/header';
import NoteItem from '../../components/NoteItem';
@@ -18,6 +12,7 @@ import {ToastEvent, w} from '../../utils/utils';
import {TrashPlaceHolder} from '../../components/ListPlaceholders';
import Container from '../../components/Container';
import SelectionHeader from '../../components/SelectionHeader';
+import {useIsFocused} from 'react-navigation-hooks';
export const Trash = ({navigation}) => {
const {