【发布时间】:2018-06-14 09:39:23
【问题描述】:
我在我的项目中使用React Native Navigation v2。我正在尝试使用 createBottomTabNavigator 设置两个不同的 IonIcon。
他们的site举了一个这样的例子:
navigationOptions: ({ navigation }) => ({
tabBarIcon: ({ focused, tintColor }) => {
const { routeName } = navigation.state;
let iconName;
if (routeName === 'Home') {
iconName = `ios-information-circle${focused ? '' : '-outline'}`;
} else if (routeName === 'Settings') {
iconName = `ios-options${focused ? '' : '-outline'}`;
}
// You can return any component that you like here! We usually use an
// icon component from react-native-vector-icons
return <Ionicons name={iconName} size={25} color={tintColor} />;
},
}),
但对我来说,这似乎很无聊。我可以在组件本身中定义 IonIcon 吗? 如何使用 React Native Navigation v2 单独定义符号?
【问题讨论】:
标签: javascript reactjs react-native react-navigation