如何在类中定义底部标签导航

时间:2019-11-20 05:39:40

标签: react-native react-native-navigation

如何在类中放置bottomtab以便访问异步存储功能。我需要将其放在类中。我试图将代码直接放置到class tab extends component{}中 但只显示白屏,任何人都可以帮助我。谢谢。

const TabNavigator = createBottomTabNavigator(
  {
    Home: {
      screen: HomeScreen,
      navigationOptions: {
        tabBarLabel: 'Home',
        tabBarIcon: ({ tintColor }) => (
          <Icon name="home" color={tintColor} size={25} />
        ),
      },
    },


    Settings: {
      screen: SettingScreen,
      navigationOptions: {
        tabBarLabel: 'Profile',
        tabBarIcon: ({ tintColor }) => (
          <Icon name="user" color={tintColor} size={25} />
        ),
      },
    },
  {
    initialRouteName: 'Home',
    tabBarOptions: {
      activeTintColor: 'white',
      style: {
        backgroundColor: '#2D2D2D',
      }
    }
  }
);

0 个答案:

没有答案