React native 专注于反应导航选项卡导航器
键:React Native-React Navigation-TabNavigator 我不明白专注于TabNavigator如何与“专注”配合使用React native 专注于反应导航选项卡导航器,react-native,react-navigation,React Native,React Navigation,键:React Native-React Navigation-TabNavigator 我不明白专注于TabNavigator如何与“专注”配合使用 但是“聚焦”对于颜色来说是合适的。所以我真的不明白这是怎么回事。因为console.log上说一切都处于相同的状态:false。你最终发现了吗?@Natim不,对不起。 export default TabNavigator({ Leaderboard: { screen: LeaderboardScreen }, Game:
但是“聚焦”对于颜色来说是合适的。所以我真的不明白这是怎么回事。因为console.log上说一切都处于相同的状态:false。你最终发现了吗?@Natim不,对不起。
export default TabNavigator({
Leaderboard: {
screen: LeaderboardScreen
},
Game: {
screen: GameScreen
},
Settings: {
screen: SettingsScreen
}
}, {
initialRouteName: 'Game',
navigationOptions: ({navigation}) => ({
tabBarIcon: ({focused}) => {
const {routeName} = navigation.state;
let iconName;
let labelName;
switch (routeName) {
case "Game":
labelName = 'Game';
iconName = "md-information-circle";
break;
case "Leaderboard":
labelName = 'Leaderboard';
iconName = "md-link";
break;
case "Settings":
labelName = 'Settings';
iconName = "md-options";
}
console.log(labelName, focused)
return (
<IconTextAnimation text={labelName} focused={focused}><Ionicons
name={iconName}
size={32}
style={{
marginBottom: -3
}}
color={focused
? Colors.tabIconSelected
: Colors.tabIconDefault}/>
</IconTextAnimation>
);
}
}),
}
Leaderboard true
Leaderboard false
Game true
Game false
Settings true
Settings false