React-native-router-flux: Hardware Back not working when on First Scene

Created on 24 Aug 2017  路  6Comments  路  Source: aksonov/react-native-router-flux

Version

Tell us which versions you are using:

  • react-native-router-flux v4.0.0-beta.18
  • react-native v0.47.1

Expected behaviour

On Press on Hardware Back button on First Scene it should close the app.

Actual behaviour

App does not close.

Steps to reproduce

Here is my Router Component
const RouterComponent = () => {
return (
createReducer={reducerCreate}
getSceneStyle={getSceneStyle}
navBarStyle={styles.navBarStyle}
>


key="login"
component={Login}
title={I18n.t('title_login')}
onEnter={isLoggedIn}
/>


key="main"
component={Login}
title={I18n.t('title_login')}
/>

key="error"
component={Error}
/>


);
};

const isLoggedIn = () => {
const auth = AuthService.getAuthObject();
console.log(TAG, 'IsLoggedIn Check');
if (auth && auth.loggedIn) {
//Actions.home({ type: ActionConst.RESET });
}
};

Most helpful comment

Do you have hardware IOS back button??

All 6 comments

Same problem here

Just pass prop backAndroidHandler to Router with own handler of back. Many users of RNRF didn't want to exit app for back button for some reason, so it works in such way.

Ah okay, that seems to fix it. I used to use onBackAndroid.

@aksonov
Help me please, as I understood, onBackAndroid works only on Android?
How to resolve this problem on IOS?

Do you have hardware IOS back button??

Oh, sorry)
I use only Android.

Was this page helpful?
0 / 5 - 0 ratings