react native 使用react-navigation (嵌套路由) 隱藏標(biāo)題欄

AppNavigator 的header給隱藏掉,先給每一個(gè)控制器加上導(dǎo)航欄在隱藏TabNavigator 的導(dǎo)航欄

const Tab = createBottomTabNavigator({
    Home: {
        screen: HomePage,
    },
    Classfy: {
        screen: ClassfyPage,
    },
    Chart: {
        screen: ChartPage,
    },
    Setting: {
        screen: SettingPage,
    }
}, {
    animationEnabled: true,
    swipeEnabled: false,
    swipeEnabled: true,//是否可以滑動(dòng)切換
    animationEnabled: true,//切換是否有動(dòng)畫
    initialRouteName: 'Home', //進(jìn)入App的首頁(yè)面
    backBehavior: 'none', // 按 back 鍵是否跳轉(zhuǎn)到第一個(gè) Tab, none 為不跳轉(zhuǎn)
    tabBarOptions: { //對(duì)于導(dǎo)航的設(shè)置
        indicatorStyle: {height: 0},  //android特有下劃線的顏色1
        inactiveTintColor: '#a9a9a9', // 文字和圖片默認(rèn)顏色
        activeTintColor: color.activeBarText,
        labelStyle: {     //文字的樣式
            fontSize: 10,
            textAlign: 'center',
        },
        style: {    //對(duì)于導(dǎo)航的stytles
            backgroundColor: 'white', // TabBar 背景色
            borderTopColor: '#ebebeb',
            borderTopWidth: 1,
            height: Dimensions.get('window').height * 0.08,
            height: 50
        }
    },
});

Tab.navigationOptions = ({navigation}) => {
    //  關(guān)鍵這一行設(shè)置 header:null
    return{
        header: null,
    }
};

export default Tab;
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容