react-native 之react-navigation createMaterialTopTabNavigator设置

在配置navigationOptions 时可以这样,设置标题和图片icon

navigationOptions:{
          tabBarLabel:(({tintColor,focused})=>{
            return (
              <View>
                <Text style={(item.label=='计划')?styles.labelStyle:styles.noniconlabelStyle}>{item.label}</Text>
              </View>
            )
          }),
          tabBarIcon:(({tintColor,focused})=> {
            return(
                  <View>
                    <Image
                      source={item.icon}
                      style={(item.label=='计划')?styles.iconStyle:styles.noniconStyle}
                    />
                  </View>
              )
          })
        }

 

react-navigation 的

createMaterialTopTabNavigator 

API 可参考 官网 https://reactnavigation.org/docs/zh-Hans/material-top-tab-navigator.html

也可参考:https://www.jianshu.com/p/86f37fb7fd02 中文介绍的很详细

 

posted @ 2020-02-05 12:18  liuw_flexi  阅读(1028)  评论(0编辑  收藏  举报