Tell us which versions you are using:
<Router>
<Scene key="root" >
<Scene key='Login' component={Login} />
<Scene key='Drawer' component={SideDrawer} />
<Scene key='drawerRoot' />
<Scene key='Home' component={Home} />
</Scene>
</Scene>
</Scene>
</Router>
Go to initial Scene on LogOut
If i put Actions.Login() navigation go to Drawer.
If i put Actions.Login({type: 'reset'}) app crash with: Cannot read property sceneKey of undefined
Cannot read property sceneKey of undefinedHow can i fix it?
Some help?
Do like this Actions.Drawer() without {type: 'reset'}.
If i dont use {type: 'reset'}, user can go back with Android back button. I need add it after login.
See this issue #1146
But {type: 'reset'} should work fine. I use it in other app with Drawer and TabBar and dont have this issue.
Haven't done much on Android. Try this let's see if it works Actions.root({key: 'Login'})
When i put Actions.Login() orActions.root({key: 'Login'})without reset, navigation flash 1 sec in Login component but after navigate to Drawer.
on Logout: Actions.root({key: 'Login', type: 'reset'})
Mine is working fine on iOS. IDK.
With Actions.root({key: 'Login', type: 'reset'}) give same error: Cannot read property 'sceneKey' of undefinded
I have other project with router-flux working fine, but in this project i cant.
The problem is you have already reset the scene history stack after login so login scene is no longer in the stack, it is empty. And you are looking for a sceneKey which is no longer in the stack.
But i want start new stack from "Login" component. If i do Action.Login without reset, Login scene is presented a few seconds. But after going back to Drawer
Ok the error is for this functions of my SideDrawercomponent:
onOpen={()=>Actions.refresh({key:state.key, open: true})}
onClose={()=>Actions.refresh({key:state.key, open: false})}
For fix it, i only have to remove drawer.close(); from LogOut onPress button in SideDrawerContent.js
Thanks for help @dragfire
TypeError: Cannot read property 'eventName' of undefined, I got the error while using Actions.root({key: 'Login', type: 'reset'});
Can Anyone tell me how can i solve it??
@TRIPTI-JAIN did you even have a look on the Example project?
Most helpful comment
Ok the error is for this functions of my
SideDrawercomponent:For fix it, i only have to remove
drawer.close();fromLogOutonPress button inSideDrawerContent.jsThanks for help @dragfire