Sriraman
Sriraman

Reputation: 7947

Call a Sub-scene in React Native Router Flux without calling an Initial sub-scene

I have two sub scene in my react-native-router-flux Router like

<Router>
  <Scene key="root" ... >
    <Scene key="login" ... />
    <Scene key="parent" component={drawer}>
      <Scene key="page1" ... />
      <Scene key="page2" ... />
    </Scene>
  </Scene>
</Router>

Now, I'm in login scene. If I want to call page2, I'm using the following snippet.

Actions.parent()
Actions.page2()

It is working. But, Before rendering the page2 It is executing the page1 also, Since it is the initial element. How to open page2 without executing the page1?

Thanks in Advance,

Upvotes: 4

Views: 873

Answers (1)

BootCamp
BootCamp

Reputation: 46

Try this -

import { Actions, ActionConst } from 'react-native-router-flux';

<Button onPress={() => {
    Actions.parent({type:ActionConst.RESET});
    Actions.page2();
}}>

Upvotes: 2

Related Questions