【发布时间】:2017-10-23 09:39:10
【问题描述】:
【问题讨论】:
标签: react-native react-native-navigation
【问题讨论】:
标签: react-native react-native-navigation
您可以使用Screen's Navigation Options 添加所需样式的tabBarIcon
tabBarIcon
给定
{ focused: boolean, tintColor: string }的 React 元素或函数返回React.Element,以显示在标签栏中tabBarLabel
标签栏或 React Element 中显示的标签的标题字符串或 给定
{ focused: boolean, tintColor: string }的函数返回React.Element,显示在标签栏中。未定义时,场景标题 用来。要隐藏,参见前面的tabBarOptions.showLabel部分。tabBarOnPress
回调处理点击事件;参数是被点击的
scene: { route, index }和可以执行的jumpToIndex方法 为您导航。
示例
const MyApp = TabNavigator({
Home: {
screen: MyHomeScreen,
navigationOptions: ({navigation}) => ({
tabBarIcon: ({focuced, tintColor}) => (
<MyCustomIcon focuced={focuced} tintColor={tintColor} name="Home" />
)
})
},
Notifications: {
screen: MyNotificationsScreen,
navigationOptions: ({navigation}) => ({
tabBarIcon: ({focuced, tintColor}) => (
<MyCustomIcon focuced={focuced} tintColor={tintColor} name="Notifications" />
)
})
},
});
【讨论】: