0

we are using the React Native Router to manage the navigation. The render function of our router looks like this:

<Scene key="tabbar" tabs={true} hideNavBar={true} tabBarStyle={{position: 'absolute', top: 0, left: 0}}>
    <Scene key={TAB_1} component={Tab1Container} icon={TabIcon} title={TAB_1_TITLE} hideNavBar={true} />
    <Scene key={TAB_2}  component={Tab2Container} icon={TabIcon} title={TAB_2_TITLE} hideNavBar={true} />
    <Scene key={TAB_3}  component={Tab3Container} icon={TabIcon} title={TAB_3_TITLE}  hideNavBar={true} />
    <Scene key={TAB_4} component={Tab4Container} icon={TabIcon} title={TAB_4_TITLE}  hideNavBar={true} />
    <Scene key={TAB_5} component={Tab5Container} icon={TabIcon} title={TAB_5_TITLE}  hideNavBar={true} />
</Scene>

In our app it's not allowed to jump from TAB_1 to TAB_5 immediately. You have to go through TAB_2 to TAB_5. Currently when I can jump from the beginning to the end

Now I can't find any possibility to have something like a function which could be triggered before the Action is fired.

Pseudocode:

if(current_pressed_tab <= progress_tab){
  //head on to next tab
}
else{
  //make nothing
}

Is there any functionality or callback-prop what I can use?

Yetispapa
  • 2,174
  • 2
  • 30
  • 52

1 Answers1

0

You need to keep track of which routes you've navigated in Redux (I presume) and create custom Redux action creators that will run your checking pseudo code before triggering a navigation.

rclai
  • 1,880
  • 14
  • 25