mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 15:09:33 +01:00
fix backhandler
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user