本机基础选项卡 - 知道如何删除选项卡周围的边框吗?
native base Tabs - any idea how to remove the border around the tabs?
以下屏幕截图是下面提供的代码的结果。知道如何删除选项卡周围的边框吗?
import React from 'react';
import { SafeAreaView } from 'react-native';
import { Container, Header, Title, Text, Tabs, Tab } from 'native-base';
export default class Settings extends React.Component {
static navigationOptions = {
header: null
};
render() {
return (
<SafeAreaView style={{ flex: 1 }}>
<Container
style={{ flex: 1, backgroundColor: '#fff', marginTop: 30 }}>
<Header hasTabs transparent>
<Title style={{ color: 'grey' }}>
Settings
</Title>
</Header>
<Tabs tabBarUnderlineStyle={{ backgroundColor: 'blue', height: 1 }}>
<Tab heading="Tab1"
tabStyle={{ backgroundColor: 'white' }}
textStyle={{ color: 'grey' }}
activeTabStyle={{ backgroundColor: 'white' }}
activeTextStyle={{ color: 'blue' }}>
<Text>TODO: Tab1</Text>
</Tab>
<Tab heading="Tab2"
tabStyle={{ backgroundColor: 'white' }}
textStyle={{ color: 'grey' }}
activeTabStyle={{ backgroundColor: 'white' }}
activeTextStyle={{ color: 'blue' }}>
<Text>TODO: Tab2</Text>
</Tab>
</Tabs>
</Container>
</SafeAreaView>
);
}
}
默认选项卡组件无法做到这一点,还有一个 using scrollable tabs, and if you want to do it modifying the source code , there's this workaround
将 tabContainerStyle={{ elevation: 0 }}
添加到 <Tabs>
可以解决此问题。
似乎是 Elevation(阴影)而不是 Border
以下屏幕截图是下面提供的代码的结果。知道如何删除选项卡周围的边框吗?
import React from 'react';
import { SafeAreaView } from 'react-native';
import { Container, Header, Title, Text, Tabs, Tab } from 'native-base';
export default class Settings extends React.Component {
static navigationOptions = {
header: null
};
render() {
return (
<SafeAreaView style={{ flex: 1 }}>
<Container
style={{ flex: 1, backgroundColor: '#fff', marginTop: 30 }}>
<Header hasTabs transparent>
<Title style={{ color: 'grey' }}>
Settings
</Title>
</Header>
<Tabs tabBarUnderlineStyle={{ backgroundColor: 'blue', height: 1 }}>
<Tab heading="Tab1"
tabStyle={{ backgroundColor: 'white' }}
textStyle={{ color: 'grey' }}
activeTabStyle={{ backgroundColor: 'white' }}
activeTextStyle={{ color: 'blue' }}>
<Text>TODO: Tab1</Text>
</Tab>
<Tab heading="Tab2"
tabStyle={{ backgroundColor: 'white' }}
textStyle={{ color: 'grey' }}
activeTabStyle={{ backgroundColor: 'white' }}
activeTextStyle={{ color: 'blue' }}>
<Text>TODO: Tab2</Text>
</Tab>
</Tabs>
</Container>
</SafeAreaView>
);
}
}
默认选项卡组件无法做到这一点,还有一个
将 tabContainerStyle={{ elevation: 0 }}
添加到 <Tabs>
可以解决此问题。
似乎是 Elevation(阴影)而不是 Border