react-native 之react-navigation createMaterialTopTabNavigator设置

Posted liuw-flexi

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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 中文介绍的很详细

 

以上是关于react-native 之react-navigation createMaterialTopTabNavigator设置的主要内容,如果未能解决你的问题,请参考以下文章