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 中文介紹的很詳細

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM