小编cha*_*i86的帖子

错误:无法将 NSstring 类型的 JSON 值转换为 YGValue。您是否忘记了 % 或 pt 后缀

为什么我不能使用: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 …

javascript reactjs react-native react-navigation

6
推荐指数
1
解决办法
1842
查看次数

如何将项目添加到列表中?

我想listOfVideosRated[]在我的用户表中的列表中添加一个字符串单词。

javascript database amazon-dynamodb graphql aws-appsync

3
推荐指数
1
解决办法
3241
查看次数

我可以将 node_modules 文件夹移动到另一个项目吗?

我花了很长时间在当前的 iOS React Native 项目上遇到了一些问题。我决定重新开始。但是,我确实花了很多时间确保我获得了各种 React Native 模块的正确版本并将它们配置为工作。这些位于我旧的“node_modules”文件夹中。

我可以将这些模块/文件夹(从旧的“node_modules”)复制到我的新项目中吗?我是否需要使用“react-native link xxxxx”更新“package.json”或链接?理论上就这么简单吗?

javascript reactjs react-native

2
推荐指数
1
解决办法
8178
查看次数

在 JavaScript 中生成不重复的随机数

如何确保我不会重复得到随机数?目前,这不起作用。我正在使用本地数组来存储以前的结果。

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)

javascript arrays random numbers

1
推荐指数
1
解决办法
2990
查看次数

如何在新机器上继续使用 Amplify?

我在我的项目中使用 React Native。在我的旧机器上,当我运行 amplify status 时,我列出了AuthApi服务Storage

\n\n

我搬到我的新机器,安装了节点、watchman、brew 等...然后导航到我的 React Native 项目并运行:react-native run-ios,瞧,我的应用程序正在运行。对我的 AWS Api、Auth 和 Storage 的所有调用都运行良好。

\n\n

现在我可以发出一些放大命令。例如amplify status。我试过:amplify env add这就是我得到的:

\n\n
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)

amazon-web-services amazon-cognito aws-appsync aws-amplify

1
推荐指数
1
解决办法
1万
查看次数