【发布时间】:2019-09-19 11:23:58
【问题描述】:
我正在使用MaterialTopTabNavigator 制作顶部标签。但是风格有问题。
我可以使用多种样式设置MaterialTopTabNavigator 的样式。而当我设置tab的高度时,容器的高度会改变,而不是我认为的tab。下面的图片是一个示例。
- 应用高度之前的样式对象
labelStyle: {
color: '#7d3aff',
fontSize: 12,
lineHeight: 12,
backgroundColor: '#a0f312',
},
tabStyle: {
borderWidth: 1,
borderColor: '#7d3aff',
borderRadius: 10,
backgroundColor: '#f012',
},
style: {
backgroundColor: '#fff',
},
indicatorStyle: {
height: 0,
},
和标签图像。
- 应用高度后的样式对象
labelStyle: {
color: '#7d3aff',
fontSize: 12,
lineHeight: 12,
backgroundColor: '#a0f312',
},
tabStyle: {
height: 30, // the only change is here
borderWidth: 1,
borderColor: '#7d3aff',
borderRadius: 10,
backgroundColor: '#f012',
},
style: {
// height: 30, // there is no difference do it or apply height in tabStyle
backgroundColor: '#fff',
},
indicatorStyle: {
height: 0,
},
和标签图片
如您所见,高度应用于标签栏的容器,而不是标签或标签栏,即标签的高度没有变化。
如何为每个标签应用高度?
【问题讨论】:
标签: react-native react-navigation