标签图标未显示

时间:2019-11-06 19:14:23

标签: react-native tabs navigation react-navigation

我正在设置标签导航器,并且由于某些原因我的标签图标未显示。这只是另一个似乎可以正常工作的Tab导航移动应用程序的提升。 (貌似)已使用CocoaPods正确下载了该程序包

我正在使用React Native .60 +,React Navigation v4和React Native矢量图标(离子子)。

帮助!

const TabNavigator = createBottomTabNavigator(
  {
    Routine: RoutineStack,
    Habits: HabitsStack,
    Settings: SettingsStack,
  },
  {
    initialRouteName: 'Routine',
  },
  {
    defaultNavigationOptions: ({ navigation }) => ({
      tabBarIcon: ({ focused, tintColor }) => {
        const { routeName } = navigation.state;
        let IconComponent = Ionicons;
        let iconName;

        if (routeName === 'Routine') {
          (Platform.OS === 'android' ? iconName = 'md-menu' : iconName = 'ios-menu');
        }
        else if (routeName === 'Habits') {
          (Platform.OS === 'android' ? iconName = 'md-stats' : iconName = 'ios-stats');
        }
        else if (routeName === 'Settings') {
          (Platform.OS === 'android' ? iconName = 'md-settings' : iconName = 'ios-settings');
        }
        return <IconComponent name={iconName} size={25} color={tintColor} />;
      },
    }),
    tabBarOptions: {
      activeTintColor: 'rgb(86, 177, 121)',
      inactiveTintColor: 'gray',
    },
  }
);


0 个答案:

没有答案