fix(mobile): Fixed issue where pressing the back button on editor screen wouldn't switch back to the items list on Android

This commit is contained in:
Aman Harwara
2022-12-04 16:49:46 +05:30
parent 90e10c76f7
commit 07cb00a815
7 changed files with 32 additions and 17 deletions

View File

@@ -34,19 +34,14 @@ const AndroidBackHandlerProvider = ({ application, children }: ProviderProps) =>
)
useEffect(() => {
const removeListener = addAndroidBackHandler(() => {
application.setAndroidBackHandlerFallbackListener(() => {
const shouldConfirm = (application.getValue(AndroidConfirmBeforeExitKey) as boolean) ?? true
application.mobileDevice().exitApp(shouldConfirm)
return true
})
return () => {
if (removeListener) {
removeListener()
}
}
}, [addAndroidBackHandler, application])
}, [application])
return (
<BackHandlerContext.Provider value={addAndroidBackHandler}>