【问题标题】:React Native Router (react-native-router-flux) - more control in action triggeringReact Native Router (react-native-router-flux) - 更多控制动作触发
【发布时间】:2016-09-22 12:10:04
【问题描述】:

我们使用React Native Router 来管理导航。我们路由器的渲染函数如下所示:

<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>

在我们的应用中,不允许立即从 TAB_1 跳转到 TAB_5。您必须通过 TAB_2 到 TAB_5。目前什么时候可以从头跳到尾

现在我找不到任何可能在触发 Action 之前触发类似函数的东西。

伪代码:

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

我可以使用任何功能或回调道具吗?

【问题讨论】:

    标签: javascript reactjs react-native react-router react-native-router-flux


    【解决方案1】:

    您需要跟踪您在 Redux 中导航过的路线(我想),并创建自定义 Redux 操作创建器,以便在触发导航之前运行您的检查伪代码。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-29
      • 1970-01-01
      • 1970-01-01
      • 2017-08-25
      • 1970-01-01
      相关资源
      最近更新 更多