fix backhandler

This commit is contained in:
ammarahm-ed
2020-04-20 11:47:11 +05:00
parent 9f27bde628
commit d3adbc5f98

View File

@@ -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) {