react-native - 我正在尝试以 react-native 修复屏幕底部的标签栏,在输入一些文本时
问题描述
我试图在 react-native 中修复屏幕底部的标签栏,当我输入一些文本或写东西时,标签栏出现在键盘的顶部,它不再固定在底部。我也试过绝对位置,
在这里,我附上了我给 tabNavigator 的代码
<Tab.Navigator
screenOptions={{
headerShown: false,
tabBarActiveTintColor: '#000',
tabBarInactiveTintColor: '#fff',
tabBarShowLabel: true,
tabBarStyle: {
backgroundColor: '#327B5B',
position: 'absolute',
bottom: 0,
left: 0,
elevation: 0,
// flex: 1,
height: 70,
paddingBottom: 10,
},
}}>
解决方案
尝试向道具添加keyboardHidesTabBar
选项。tabBarOptions
这将告诉键盘在键盘处于活动状态时隐藏该 tabBar。这是它的样子:
<Tab.Navigator
tabBarOptions={{
keyboardHidesTabBar: true
}}
screenOptions={{
headerShown: false,
tabBarActiveTintColor: '#000',
tabBarInactiveTintColor: '#fff',
tabBarShowLabel: true,
tabBarStyle: {
backgroundColor: '#327B5B',
position: 'absolute',
bottom: 0,
left: 0,
elevation: 0,
// flex: 1,
height: 70,
paddingBottom: 10,
}
}}>
之前已经回答过这个问题,但是我更新了您提交的代码,以便为您提供一些指导,以防您遇到问题!
编辑:我的错误,tabBarOptions 需要在 screenOptions 之外。
推荐阅读
- java - 调用 SplashScreenActivity 后,应用程序最小化
- ios - 如何在文本字段中实现“使用键盘移动视图”功能
- sql - 两个不同的表之间不存在
- c++ - C++ 值初始化自定义容器的项
- ios - 按下按钮时无法播放声音
- uwp - 如何从 Windows IoT 后台应用程序扫描可用的 WiFi 网络?
- eslint - 在同一个项目中同时使用 ESLint 和 stylelint 是个好主意吗
- amazon-web-services - 将镶木地板复制到 Redshift 出现错误 1216 Missing newline: Unexpected character 0x15 found at location 4
- python - 如何将表情符号代码转换为 unicode?
- google-apps-script - 如何向 Google 群组中的每个人授予 Google Apps Script 独立脚本的权限?