【问题标题】:Redux Native How to navigate with react-navigation-redux-helpersRedux Native 如何使用 react-navigation-redux-helpers 导航
【发布时间】:2018-06-08 15:00:09
【问题描述】:

我想知道如何在 React Native 中触发导航操作(使用 react-navigation-redux-helpers)?

我厌倦了使用 NavigationActions.navigate({ routeName: 'App' }) 功能,但不行 :(

【问题讨论】:

    标签: react-native redux navigation action


    【解决方案1】:

    react-navigation 为您提供动作创建者,请参阅https://reactnavigation.org/docs/en/navigation-actions.html

    import { NavigationActions } from 'react-navigation';
    
    const navigateAction = NavigationActions.navigate({
      routeName: 'Profile',
    
      params: {},
    
      action: NavigationActions.navigate({ routeName: 'SubProfileRoute' }),
    });
    
    this.props.navigation.dispatch(navigateAction);
    

    【讨论】:

      【解决方案2】:

      试试:

      this.props.navigation.navigate('ScreenName')
      

      【讨论】:

      • 那很好,但我想使用 redux 助手来触发导航。
      • nvm 解决了,我不得不调度函数本身。无论如何,谢谢m8! :)
      猜你喜欢
      • 1970-01-01
      • 2018-04-08
      • 2020-10-30
      • 1970-01-01
      • 1970-01-01
      • 2016-08-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多