react-native-router-flux: Unable to navigate to Scene with Actions.key
Version
Tell us which versions you are using:
- react-native-router-flux v4. latest
- react-native v0.47.2
Expected behaviour
expect ACTIONS.KEY to take me to the necessary scene.
Actual behaviour
nothing happens. no errors i just stay stuck on the same scene.
Steps to reproduce
class NavigationRouter extends Component {
render() {
return (
<Router>
{/*<Scene key='drawer' component={NavigationDrawer} open={false}>*/}
{/*<Scene key='drawerChildrenWrapper' navigationBarStyle={Styles.navBar} titleStyle={Styles.title}*/}
{/*leftButtonIconStyle={Styles.leftButton} rightButtonTextStyle={Styles.rightButton}>*/}
<Stack key="root">
<Scene key='Dashboard' component={Dashboard} hideNavBar/>
<Scene key='SignUpDetailsScreen' component={SignUpDetailsScreen} hideNavBar/>
<Scene key='ResetPasswordScreen' component={ResetPasswordScreen} hideNavBar/>
<Scene key='SignUpScreen' component={SignUpScreen} hideNavBar/>
<Scene key='LoginScreen' component={LoginScreen} hideNavBar/>
<Scene initial key='WalkThroughScreen' component={WalkThroughScreen} hideNavBar/>
{/*
</Scene>
</Scene>*/}
</Stack>
</Router>
)
}
}
export default NavigationRouter
and here is where i am calling it
<RectangleButton
onPress={()=>Actions.LoginScreen}
text="LOGIN"
type="primary"
height={75}
backgroundColors={['#BF9C65', '#CEA76A']}
gradientStart={{ x: 0.5, y: 1 }}
gradientEnd={{ x: 1, y: 1 }}
>
</RectangleButton>
i have tried these permutations of the onPress
:
{() => Actions.LoginScreen}
{() => Actions.LoginScreen()}
{Actions.LoginScreen}
So thats not the problem. one gentleman solved this by going to v3. thats not working for me
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 27 (3 by maintainers)
Did you not read my bug report. I already said i tried all variations of function call in onPress. None of them are working. This bug should not be closed On Wed, Oct 4, 2017 at 7:04 AM Miguel notifications@github.com wrote:
onPress={()=>Actions.LoginScreen}
needs to beonPress={()=>Actions.LoginScreen()}
This is an issue with the latest update of the library. Trying adding both the scenes under the same parent scene. If both of them exist under different scenes. Try : Actions.parentKey; Actions.scene
I am also getting this error. Can’t navigate to another scene and no error is displayed. RN 0.48.3, react-native-router-flux 4.0.0-beta.21
It worked . . Old code :
onPress={() => { Actions.map() }}
Modified code :onPress={() => { Actions.menu();Actions.map() }}
Thanks lot @gagantaneja
you said you tried {ACTIONS.LoginScreen()}, that isn’t the same as {() => Actions.LoginScreen()}
I have updated your description of the problem to better explain your situation, please review it when you have a moment.
use
Actions.anotherPage
instead ofActions.anotherPage()