React Native Bottom Tabs导航顶部标题移除方法求助
移除Bottom Tabs导航的顶部标题栏

如图所示,使用Bottom Tabs导航时屏幕顶部自动出现了标题栏,以下是移除方法:
你当前代码仅设置了headerTitle: false,只能隐藏标题文字,无法移除标题栏本身。要完全移除标题栏,需将header配置为null,有两种实现方式:
方式一:全局移除所有Tab页面的标题栏
直接在Tab.Navigator的screenOptions中设置header: null:
<View style={{ height: "100%" }}> <Tab.Navigator screenOptions={{ header: null }} initialRouteName="home" tabBar={(props) => <BottomNavigator {...props} />} > <Tab.Screen name="cash" component={Savings} /> <Tab.Screen name="bar-chart" component={Statistics} /> <Tab.Screen name="home" component={Home} /> <Tab.Screen name="card" component={Budgeting} /> <Tab.Screen name="person" component={Profile} /> </Tab.Navigator> </View>
方式二:单独移除指定页面的标题栏
如果只需移除某个页面的标题栏,在对应的Tab.Screen的options中配置:
<Tab.Screen name="home" component={Home} options={{ header: null }} />
内容的提问来源于stack exchange,提问作者ayus
相关产品推荐
相关产品推荐

