Skip to content

Commit

Permalink
Merge pull request #2775 from openmsupply/#2752-fix-navigation-double…
Browse files Browse the repository at this point in the history
…-handling-hardware-back

#2752 fix hardware back button being double handled
  • Loading branch information
wlthomson authored Apr 27, 2020
2 parents fdeeb8b + bfd50a7 commit 9abca3b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/navigation/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9abca3b

Please sign in to comment.