Search code examples
androidreact-nativereact-native-router-flux

react-native-router-flux disabling android back button from going back to login screen


Using react-native-router-flux, after user was success login, I would like to disable the back button from going back to the login screen. But I can not seem to find a way of getting the current "Scene" or "Stack" and then make some login as:

backAndroidHandler={() => {
                        if (currentScene === afterLoginScreeen) {
                         return true;   
                        }
                    }}

Did any one manage to deal with this issue?


Solution

  • As my experience on react-native-router-flux i had use

    type={ActionConst.RESET} in Scene

    <Scene duration={0} key="main" component={Main} title="Some Title" type={ActionConst.RESET} />
    

    It should what you need to avoid back to Login Screen

    ActionConst and Scene.type explaination