尝试复制以下内容,但是对于底部标签栏(移动标签栏下方用户选择后面的基础蓝线):
https://raw.githubusercontent.com/brentvatne/react-native-scrollable-tab-view/master/demo.gif
这是我到目前为止(但红色下划线没有滑动,根据用户的选择是静态的):
到目前为止,这是我的代码:
return <Tabbar
selected={this.state.selected}
tabHeight={window.height/16}
style={styles.menu}
onTabItemPress={name => this.setState({ selected: name })}
renderTabComponent
renderTabComponent={(name, isActive) => (
<View
style={[
{ borderBottomWidth: 2, justifyContent: 'center', alignItems: 'center' },
isActive ? { borderColor: '#DB202A'} : { borderColor: 'transparent' }
]}>
<Text style={styles.menuText}>{ name }</Text>
</View>
)}>
<Tabbar.Item name="Causes" >
<Text>This is the Causes tab</Text>
</Tabbar.Item>
<Tabbar.Item name="Trending" >
<Text>This is the Trending tab</Text>
</Tabbar.Item>
<Tabbar.Item
name="Home" >
<View style={styles.containerSuper}>
<View style={styles.container}>
{this.renderListView()}
</View>
</View>
</Tabbar.Item>
<Tabbar.Item name="Profile" >
<Text>This is the Profile tab</Text>
</Tabbar.Item>
<Tabbar.Item name="Settings" >
<Text>This is the Settings tab</Text>
</Tabbar.Item>
</Tabbar>