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 => { const loadNote = async item => {
//EditorWebView.current?.requestFocus(); //EditorWebView.current?.requestFocus();
editing.currentlyEditing = true; editing.currentlyEditing = true;
if (!DDS.isTab) {
handleBack = BackHandler.addEventListener(
'hardwareBackPress',
_onHardwareBackPress,
);
}
noMenu ? null : sideMenuRef.current?.setGestureEnabled(false); noMenu ? null : sideMenuRef.current?.setGestureEnabled(false);
if (note && note.id) { if (note && note.id) {
dispatch({type: ACTIONS.NOTES}); dispatch({type: ACTIONS.NOTES});
@@ -450,21 +456,6 @@ const Editor = ({noMenu}) => {
}; };
}, [noMenu]); }, [noMenu]);
useEffect(() => {
if (!DDS.isTab) {
handleBack = BackHandler.addEventListener(
'hardwareBackPress',
_onHardwareBackPress,
);
}
return () => {
if (handleBack) {
handleBack.remove();
handleBack = null;
}
};
}, []);
const _onBackPress = async () => { const _onBackPress = async () => {
editing.currentlyEditing = true; editing.currentlyEditing = true;
if (DDS.isTab) { if (DDS.isTab) {