在配置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-native 之react-navigation createMaterialTopTabNavigator设置

 

react-navigation 的

createMaterialTopTabNavigator 

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

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

 

相关文章:

  • 2021-06-08
  • 2021-12-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-28
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-04
  • 2021-08-07
  • 2021-08-12
  • 2021-10-08
相关资源
相似解决方案