我使用的是react-native-tab-view,但是TabBar太大了,我想让它变小。如何进行自定义?应用边距/填充0不起作用。应用小高度可以工作,但文本丢失。如何让它变得更小或更具定制化?
<TabView
...
renderTabBar={props =>
<TabBar
{...props}
indicatorStyle={{ backgroundColor: 'white' }}
style={{ backgroundColor: 'pink' }}
tabStyle={{ backgroundColor: 'teal' }}
renderLabel={({ route, focused, color }) => (
<Text style={{ color, margin: 8 }}>
{route.title}
</Text>
)}
}发布于 2019-07-15 20:44:31
尝试使用TabBar的tabStyle prop。默认情况下,它会has一个样式:
minHeight: 48,所以在你的例子中:
<TabView
...
renderTabBar={props =>
<TabBar
{...props}
indicatorStyle={{ backgroundColor: 'white' }}
style={{ backgroundColor: 'pink' }}
tabStyle={{ backgroundColor: 'teal', minHeight: 30 }} // here
renderLabel={({ route, focused, color }) => (
<Text style={{ color, margin: 8 }}>
{route.title}
</Text>
)}
}https://stackoverflow.com/questions/57039255
复制相似问题