项目中用到
<ScrollableTabView
style={{marginTop: 0, }}
tabBarPosition={"bottom"}//在页面中显示位置
initialPage={0}//初始化时被选中的Tab下标,默认是0(即第一页)
locked={true}//表示手指是否能拖动视图,默认为false(表示可以拖动)
tabBarActiveTextColor ={theme.color}//选中tab字的颜色
tabBarUnderlineStyle={{backgroundColor:theme.color}}
renderTabBar={() => <MyTabBar tabNames={this.state.tabNames} tabIconNames={this.state.tabIconNames}/>
}//渲染tab函数
onChangeTab={(obj) => {//点击tab
this.changeTab(obj)
}
}
>
{/*首页列表*/}
<ScrollView tabLabel="首页" style={styles.tabView}></ScrollView>
<ScrollView tabLabel="店铺" style={styles.tabView}></ScrollView>
<ScrollView tabLabel="订单" style={styles.tabView}></ScrollView>
</ScrollableTabView>
onChangeTab obj的返回结果如下:from=>之前的tab,i=>现在的tab,ref