ios - 在 BottomTabNavigator 上使用 safearealayoutguide 或 SafeAreaView 删除空白
问题描述
我正在开发一个应用程序,我正在使用 createBottomTabNavigator 创建我的菜单。这是它在 ios 11 及更多版本上的样子:
我正在尝试删除空格,我发表了另一篇我现在已经删除的帖子,有人建议使用 safearealayoutguide,我不知道在哪里使用。
这是我的 createBottomTabNavigator:
const Tab = createBottomTabNavigator();
const BottomTabs = () => (
<Tab.Navigator
initialRouteName="Home"
tabBarOptions={{
style: {
borderTopWidth: 0,
},
activeBackgroundColor: "#01ba73",
inactiveBackgroundColor: "#003923",
showLabel: false,
}}
>
<Tab.Screen
name="Home"
..
/>
<Tab.Screen
name="Search"
..
/>
<Tab.Screen
name="Scanner"
component={ScannerScreen}
..
/>
<Tab.Screen
name="Chat"
...
/>
<Tab.Screen
name="Profile"
....
/>
</Tab.Navigator>
);
在我的主页中,如果我使用 SafeAreaView 并放置所有无法解决问题的 brtween,我在这个网站上看到我必须使用insets
我已经尝试过,但它确实有效。
我正在参加世博会,我真的很想解决这个问题,花了很多时间在这个问题上,但仍然遇到同样的问题。会有一些帮助!
解决方案
您可以在Tab.Navigator
's中执行以下操作tabBarOptions
safeAreaInsets: {
bottom: 0,
},
但我猜它看起来不太好。更好的方法是使用 SafeAreaView
推荐阅读
- asp.net - 当我创建带有字段的文档模板时,如果我使用 API 将其发送给其他人,字段会消失吗?
- kubernetes - NGINX 入口未到达服务(clusterIP)
- django - Excel文件不能被浏览器自动下载
- node.js - 无法安装 Expo CLI。(不推荐使用 NPM 警告)
- maven - mvn clean install 或任何其他创建 maven 项目的命令不起作用 [构建失败]
- oracle - 如何在 obiee 的左外连接的一部分中包含分析过滤器(左连接变为内连接)
- ios-simulator - watchOS 应用程序未部署到模拟器 - VS 2019 Mac
- python - 小行星EOFError
- html - Jquery 使用带有时间延迟的 append/appendTo
- reactjs - 如何使 flatelist 成为可重用的组件