0

In the following code snippet, how to directly go to completeInfo from login without executing the home?

Thanks.

<Scene key="root">
    <Scene key="loginScene">
        <Scene key="login" component={Login} initial={true}/>
        <Scene key="register" component={Register}/>
    </Scene>
    <Scene key="homeScene">
        <Scene key="home" component={Home}/>
        <Scene key="completeInfo" component={CompleteInfo}/>
    </Scene>
</Scene>
liupeixin
  • 718
  • 1
  • 9
  • 15

1 Answers1

1

Add clone={true} prop to completeInfo scene, then you can directly push it.

binchik
  • 909
  • 8
  • 10
  • Thank You, it worked. Scenes marked with clone will be treated as templates and cloned into the current scene's parent when pushed. If current scene is `home`, then `Actions.completeInfo()`, will clone new `completeInfo` scene? and `homeScene` will contain 3 scenes? – liupeixin Feb 09 '17 at 02:25
  • I have no idea, but if it was the case, I think debugger would throw a warning about duplicate keys (if they do not mutate keys on cloned scenes). @liupeixin In their example they do it the same way: https://github.com/aksonov/react-native-router-flux/blob/master/Example/Example.js – binchik Feb 09 '17 at 03:46