在静态navigationOptions中反应导航堆栈手势ResponseDistance

时间:2019-10-20 13:05:09

标签: reactjs react-native react-navigation react-navigation-stack

我想根据react组件(+ Stack Navigator)中的条件来更改gestureResponseDistance,我尝试了以下操作,而对响应距离没有任何影响:

class MyComponent extends React.Component {
  ...
  static navigationOptions = ({ navigation }) => {
    const { params = {} } = navigation.state;
    return {
      gestureResponseDistance: {
        horizontal: params.enabled ? 100 : 0,
      },
    }
  }
  setEnabled = () => this.props.navigation.setParams({ enabled: true });
  ...
}

我如何使它工作?

0 个答案:

没有答案