Skip to content

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

fix backhandler

ammarahm-edd3adbc5f9813
diff --git a/apps/mobile/src/views/Editor/index.js b/apps/mobile/src/views/Editor/index.js
index fbbaa5741..ffe60d1b7 100755
--- a/apps/mobile/src/views/Editor/index.js
+++ b/apps/mobile/src/views/Editor/index.js
@@ -82,6 +82,12 @@ const Editor = ({noMenu}) => {
const loadNote = async item => {
//EditorWebView.current?.requestFocus();
editing.currentlyEditing = true;
+ if (!DDS.isTab) {
+ handleBack = BackHandler.addEventListener(
+ 'hardwareBackPress',
+ _onHardwareBackPress,
+ );
+ }
noMenu ? null : sideMenuRef.current?.setGestureEnabled(false);
if (note && note.id) {
dispatch({type: ACTIONS.NOTES});
@@ -450,21 +456,6 @@ const Editor = ({noMenu}) => {
};
}, [noMenu]);
- useEffect(() => {
- if (!DDS.isTab) {
- handleBack = BackHandler.addEventListener(
- 'hardwareBackPress',
- _onHardwareBackPress,
- );
- }
- return () => {
- if (handleBack) {
- handleBack.remove();
- handleBack = null;
- }
- };
- }, []);
-
const _onBackPress = async () => {
editing.currentlyEditing = true;
if (DDS.isTab) {