設定畫面Navigation
設置TabBar中每個TabBar的名稱
{
Home: { screen: Home },
Counter: { screen: Counter },
Camera: { screen: Camera },
PersonalInfo: { screen: PersonalInfo, navigationOptions: { title: '個人資訊' } },
MerchandiseList: { screen: MerchandiseList, navigationOptions: { title: '我的商品' } },
NewMerchandise: { screen: NewMerchandise, navigationOptions: { title: '建立商品' } },
MerchandiseGrid: { screen: MerchandiseGrid, navigationOptions: { title: '商城' } },
MerchandiseDetail: { screen: MerchandiseDetail, navigationOptions: { title: '商品詳細' } }
},設置TabBar的Icon
{
navigationOptions: ({ navigation }) => ({
tabBarIcon: ({ focused, tintColor }) => {
const { routeName } = navigation.state;
const ICON_MAP = {
PersonalInfo: 'user',
MerchandiseList: 'archive',
NewMerchandise: 'plus',
MerchandiseGrid: 'th',
MerchandiseDetail: 'info-circle'
};
// You can return any component that you like here! We usually use an
// icon component from react-native-vector-icons
return <Icon name={ICON_MAP[routeName] || ''} size={24} color={tintColor} />;
}
}),
tabBarOptions: {
activeTintColor: 'tomato',
inactiveTintColor: 'gray'
},
tabBarComponent: TabBarBottom,
tabBarPosition: 'bottom',
animationEnabled: false,
swipeEnabled: false
}調整TabBar 的高度與Tab中 每個TabBar的文字大小
將某些畫面不在TabNavigator 中出現
新增BadgeIcon
部分頁面關掉TabBar顯示或是部分頁面打開 StackNavigator's Header
Last updated
