From bfd50a7a96416e38fe623721b0da6211b9fc6008 Mon Sep 17 00:00:00 2001 From: Will Thomson Date: Thu, 23 Apr 2020 15:21:13 +1200 Subject: [PATCH] Fix hardware back button being double handled --- src/navigation/utilities.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/navigation/utilities.js b/src/navigation/utilities.js index edfa3d4b7..1ce4f22fc 100644 --- a/src/navigation/utilities.js +++ b/src/navigation/utilities.js @@ -44,8 +44,14 @@ export const getRouteTitle = (pageObject, routeName) => { /** * Simple hardware backhandler which dispatches a goBack action on a * provided store. + * + * WARNING: if returns falsey value, event will be "double handled", + * which will result in the stack being popped twice. */ -export const backHandler = store => () => store.dispatch(goBack()); +export const backHandler = store => () => { + store.dispatch(goBack()); + return true; +}; /** * Simple middleware which intercepts navigation actions and calls a function