Album渲染tabBar的时候样式没有渲染出来
来源:11-6 频道页面Tab标签(下)

mid_one
2021-09-01
Tab.tsx
renderTabBar = (props: SceneRendererProps & {navigationState: IState}) => {
return (
<TabBar
{...props}
scrollEnabled
style={styles.tabbar}
tabStyle={styles.tabStyle}
indicatorStyle={styles.indicator}
labelStyle={styles.label}
/>
);
};
const styles = StyleSheet.create({
tabStyle: {
width: 80,
},
label: {
color: '#333',
},
tabbar: {
backgroundColor: '#fff',
...Platform.select({
android: {
elevation: 0,
borderBottomColor: '#e3e3e3',
borderBottomWidth: StyleSheet.hairlineWidth,
},
}),
},
indicator: {
backgroundColor: '#eb6d48',
borderLeftWidth: 20,
borderRightWidth: 20,
borderColor: '#fff',
},
});
我检查了代码跟视频里一样但是样式没有渲染出来。
注释掉tabBar背景色
const styles = StyleSheet.create({
tabbar: {
// backgroundColor: '#fff',
...Platform.select({
android: {
elevation: 0,
borderBottomColor: '#e3e3e3',
borderBottomWidth: StyleSheet.hairlineWidth,
},
}),
},
});
tabbar的background导致label无法显示. 同时indicatorStyle的样式也不知道怎么滴没渲染出来
找了好久也没发现问题出现在哪里, 老师帮忙给看看.
写回答
2回答
-
今朝
2021-09-01
这是我用的的版本,你的小版本是多少呢
012021-09-01 -
今朝
2021-09-01
你的react-navigation版本应该和我的不一样
可以看看你的版本对应的文档
012021-09-01
相似问题