我是 react-native 的新手。我第一次使用底部标签栏。 所以我创建了一个 home.js,其中存在以下选项卡导航代码。
const TabNavigator = createMaterialBottomTabNavigator(
{
Home: {
screen: Home,
navigationOptions: {
//tabBarLabel:'Home',
activeColor: '#800080',
inactiveColor: '#000000',
labeled:false,
barStyle: { backgroundColor: 'white' },
tabBarIcon: ({ focused }) => {
const image = focused
? require('../../assets/images/homeactive.png') //active
: require('../../assets/images/Homeicon.png') //inactive
return (
<Image
source={image}
style={{height:15, width:15}}
/>
)
}
}
},
Profile: {
screen: Profile,
navigationOptions: {
//tabBarLabel:'Favourites',
labeled:false,
activeColor: '#800080',
inactiveColor: '#000000',
barStyle: { backgroundColor: 'white' },
tabBarVisible:true,
tabBarIcon: ({ focused }) => {
const image = focused
? require('../../assets/images/usericon.png') //active
: require('../../assets/images/userinactive.png') //inactive
return (
<Image
source={image}
style={{height:15, width:15}}
/>
)
}
}
}
} );
所以点击个人资料,当我能够看到底部栏时,个人资料屏幕会加载。当我尝试从个人资料页面移动到编辑个人资料屏幕时,底部栏会隐藏,这很好。但是当我移动时从 editprofile 返回到 profile 我无法显示底部菜单。 profile.js 和 editprofile.js 不包含任何底部标签条码,它只存在于 home.js 中。 所以请帮我展示