1.:swipeEnabled: true,这样可以滑动切换,点击item不能切换
2:swipeEnabled: false,这样滑动和点击都不能切换
需求是点击切换,问题出在哪里,各位大神帮忙看看
const Tabs = TabNavigator({
Newest: {
screen: Newest,
navigationOptions: {
tabBarLabel:'首页',
tabBarIcon:({tintColor}) => (<Image source={require('./image/find.png')} style={[{tintColor: tintColor},styles.icon]}/>),
},
},
Coming: {
screen: Coming,
navigationOptions: {
tabBarLabel:'热门',
tabBarIcon:({tintColor}) => (<Image source={require('./image/find.png')} style={[{tintColor: tintColor},styles.icon]}/>),
}
},
Search: {
screen: Search,
navigationOptions: {
tabBarLabel:'搜索',
tabBarIcon:({tintColor}) => (<Image source={require('./image/find.png')} style={[{tintColor: tintColor},styles.icon]}/>),
}
}
}, {
trueinitialRouteName:Search,
animationEnabled: false, // 切换页面时是否有动画效果
tabBarPosition: 'bottom', // 显示在底端,android 默认是显示在页面顶端的
swipeEnabled: true, // 是否可以左右滑动切换tab
backBehavior: 'none', // 按 back 键是否跳转到第一个Tab(首页), none 为不跳转
tabBarOptions: {
activeTintColor: '#47aaff', // 文字和图片选中颜色
inactiveTintColor: '#000', // 文字和图片未选中颜色
showIcon: true, // android 默认不显示 icon, 需要设置为 true 才会显示
indicatorStyle: {
height: 0 // 如TabBar下面显示有一条线,可以设高度为0后隐藏
},
style: {
backgroundColor: '#fff', // TabBar 背景色
height: 50,
},
labelStyle: {
fontSize: 12, // 文字大小,
margin:0,
},
},
pressColor:'material',
});
测试机系统升级,但是android的相应版本工具没有下载,更新到一致就好了