为什么我不能使用:global.App_BottomTabBarHeight 在 React Navigation createBottomTabNavigator 中设置高度?哪里 global.App_BottomTabBarHeight = '8%'。这是在另一个类中定义的。我正在使用 0.63.3 开发 iOS 应用程序
//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 // DOESN'T WORK but manually typing '8%' or 0.08 does
},
indicatorStyle: {
backgroundColor: 'black'
},
showLabel: false
},
}
);
Run Code Online (Sandbox Code Playgroud)
高度不会用变量设置global.App_BottomTabBarHeight = '8%'。
我也试过这样做:
height: Dimensions.get('window').height * global.App_BottomTabBarHeight, where global.App_BottomTabBarHeight = 0.08 …
我想listOfVideosRated[]在我的用户表中的列表中添加一个字符串单词。
我花了很长时间在当前的 iOS React Native 项目上遇到了一些问题。我决定重新开始。但是,我确实花了很多时间确保我获得了各种 React Native 模块的正确版本并将它们配置为工作。这些位于我旧的“node_modules”文件夹中。
我可以将这些模块/文件夹(从旧的“node_modules”)复制到我的新项目中吗?我是否需要使用“react-native link xxxxx”更新“package.json”或链接?理论上就这么简单吗?
如何确保我不会重复得到随机数?目前,这不起作用。我正在使用本地数组来存储以前的结果。
getUniqueRandomNumber(x){
var index;
var viewedIndices = [];
index = Math.floor(Math.random() * (x));
if(viewedIndices.includes(index))
{
viewedIndices.push(index);
this.getUniqueRandomNumber(x);
}
else {
console.log(index);
return index;
}
}
Run Code Online (Sandbox Code Playgroud) 我在我的项目中使用 React Native。在我的旧机器上,当我运行 amplify status 时,我列出了Auth和Api服务Storage。
我搬到我的新机器,安装了节点、watchman、brew 等...然后导航到我的 React Native 项目并运行:react-native run-ios,瞧,我的应用程序正在运行。对我的 AWS Api、Auth 和 Storage 的所有调用都运行良好。
现在我可以发出一些放大命令。例如amplify status。我试过:amplify env add这就是我得到的:
Users-MBP-2:projectname username$ amplify env add\nNote: It is recommended to run this command from the root of your app directory\n? Do you want to use an existing environment? Yes\n? Choose the environment you would like to use: dev\nUsing default provider awscloudformation\n\xe2\x9c\x96 There was an error …Run Code Online (Sandbox Code Playgroud) javascript ×4
aws-appsync ×2
react-native ×2
reactjs ×2
arrays ×1
aws-amplify ×1
database ×1
graphql ×1
numbers ×1
random ×1