withNavigationFocus无法访问导航道具

时间:2020-08-19 15:04:37

标签: react-native react-navigation

我正在使用react-navigation中的createBottomTabNavigator创建底部标签栏。我需要从选项卡屏幕之一(配置文件)内部使用的内部组件访问导航道具。为此,我在主屏幕中使用了NavigationFocus。

//HomeScreen.js

//Tab navigator 
const TabScreens = createBottomTabNavigator(
  {
        Profile: {
            screen: ProfileTab,
            path: 'Profile'
        },
    // other screens
  },
  {
    // Tab bar configs
  }
);

// Usage of withNavigation

export default withNavigation(
    connect(mapStateToProps)(withNavigationFocus(HomeScreen))
);

但是我在内部组件中获得undefined的导航。

0 个答案:

没有答案