【发布时间】:2021-05-07 22:57:15
【问题描述】:
在将 expo 从 37 版更新到 40 版后,我不再看到图标,它们不知何故是不可见的。
我发现了具有类似问题的主题,但没有一个解决方案适合我。我读到我需要用 defaultNavigationOptions 替换 navigationOptions 但这并没有解决问题。
有人知道我该如何解决这个问题吗?
const tabNavigator = TabNavigator.createStyles();
export default createBottomTabNavigator(
{
Overview: {
resetOnBlur: true,
screen: OverviewStack,
navigationOptions: {
title: "Home",
},
},
Settings: {
screen: SettingsStack,
resetOnBlur: true,
navigationOptions: {
title: "Settings",
},
},
},
{
tabBarOptions: {
showLabel: true,
labelStyle: {},
hidden: true,
activeBackgroundColor: Colors.navigationBkgdActive,
activeTintColor: Colors.navigationColorActive,
inactiveBackgroundColor: Colors.navigationBkgd,
inactiveTintColor: Colors.navigationColor,
backgroundColor: Colors.navigationColor,
labelBottomStyle: {
fontSize: Fonts.bodyFontSizeSmall,
},
style: {
backgroundColor: Colors.navigationBkgd,
height: 64,
},
indicatorStyle: {
backgroundColor: "transparent",
},
},
navigationOptions: ({ navigation }) => ({
tabBarIcon: ({ focused }) => {
const icons = {
Overview: "home-outline",
Settings: "settings",
};
const style = focused ? tabNavigator.activeTab : {};
return (
<View style={tabNavigator.container}>
<View style={style} />
<Icon
style={[
tabNavigator.icon,
{ color: focused ? "#D97D54" : "lightgray" },
]}
size={28}
name={icons[navigation.state.key]}
/>
</View>
);
},
showIcon: true,
}),
}
);
【问题讨论】:
标签: reactjs react-native expo jsx