javascript - 为什么我不能设置底部标签栏的高度?
问题描述
我在 gloabls.js 文件中设置了全局变量,这些变量可以完美地工作并且可以很好地设置在我的 App.js 文件中。例如
global.App_paddingLeft = 3,
global.App_BottomTabBarHeight = '8%',
在我的 App.js 中,我这样做:
//Tabs across the bottom of the screen
const MainScreenTabNavigator = createBottomTabNavigator(
{
HomeStack,
OtherStack,
},
{
tabBarOptions: {
activeTintColor: 'orange',
inactiveTintColor: 'black', //white
style: {
backgroundColor: '#ff8278',
height: global.App_BottomTabBarHeight //'8%'
},
indicatorStyle: {
backgroundColor: 'black'
},
showLabel: false
},
}
);
高度不会用变量设置global.App_BottomTabBarHeight = '8%'
。这global.App_BottomTabBarHeight
肯定会将“8%”传递给 App.js 文件,因为我已经控制台记录了它。
我也试过这样做:
height: Dimensions.get('window').height * global.App_BottomTabBarHeight
, where global.App_BottomTabBarHeight = 0.08
,但仍然没有
为什么我不能将高度设置为 '8%' ?
如果我手动输入height: '8%'
它工作正常。奇怪的
解决方案
推荐阅读
- reactjs - 会话 cookie 不与 XHR 请求一起发送
- php - 如何在 Markmail 支持中写问题(即开放会议支持)
- angular - 如何使用 cdkDropListEnterPredicate 检查多个条件?
- android - React Native:自定义标题未设置为标题导航
- c++ - Visual Studio 2019 中的自动递增 FileVersion (build nr)
- mysql - 使用 sequelize 和 MySQL 方言生成模型
- node.js - 如何使这个 axios 删除请求起作用?
- sql - 使用公共列 POSTGRESQL 在两个表之间映射不同的值
- javascript - 用if条件分割字符串 - JS
- javascript - vue.set() 一个 vuex 突变中的数组