向后滑动可移动多个场景

时间:2017-06-14 05:37:28

标签: react-native react-router react-native-android react-native-ios react-native-router-flux

设置

  

"反应":" 16.0.0-alpha.3",

     

"反应原生":" 0.43.1",

     

" react-native-router-flux":" ^ 3.26.16"

预期行为

在向后滑动手势时,我希望仅为单个场景制作动画并返回该场景。

实际行为

不时(+ - 50%),向后滑动手势会动画1或多个场景。尽管在向后滑动过程中它会激活多个场景,但在每种情况下都可以通过单个场景返回。

enter description here

重现的步骤

提供以下场景层次结构,轻扫后退手势

<Router createReducer={createNavigationReducer}>
  <Scene key="auth" component={RootScene} hideNavBar initial={true} />
  <Scene key="sceneLogin">
    <Scene key="sceneLogin1" component={LoginScene} title="Login" renderLeftButton={renderLeftButton} />
  </Scene>
  <Scene key="sceneRegister">
    <Scene key="sceneRegister1"
      component={RegistrationScene} title="New User" renderLeftButton={renderLeftButton} />
    <Scene key="sceneRegister2"
      component={RegistrationScene2} title="New User2" />
  </Scene>
</Router>

减速机(基本)

export const createNavigationReducer = (params) => {
  const defaultReducer = Reducer(params);
  return (state, action) => {
    if (__DEV__) {
      /* eslint-disable no-console */
      if (console.group) console.group('Navigation:');
      console.log('ACTION:', action);
      if (console.groupEnd) console.groupEnd();
      /* eslint-enable no-console */
    }

    console.log(defaultReducer(state, action));
    return defaultReducer(state, action);
  };
};

导航操作

//根视图(使用&#34;新用户&#34;按钮)

  

新用户 - &gt; Actions.sceneRegister

//新用户场景

  

go next - &gt; Actions.sceneRegister2

1 个答案:

答案 0 :(得分:1)

在场景中使用panHandlers={null}