Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native 启动react本机应用程序时发生异常_React Native - Fatal编程技术网

React native 启动react本机应用程序时发生异常

React native 启动react本机应用程序时发生异常,react-native,React Native,我找不到哪里做错了 它发生在我运行Metro bundler时 BUNDLE [android, dev] ./index.js ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.0% (1491/1491), done. LOG Running "Trepr" with {"rootTag":1} WARN Possible Unhandled Promise Rejection (id: 0): TypeError: Cannot read property 'length' of un

我找不到哪里做错了

它发生在我运行Metro bundler时

BUNDLE  [android, dev] ./index.js ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.0% (1491/1491), done.

 LOG  Running "Trepr" with {"rootTag":1}
 WARN  Possible Unhandled Promise Rejection (id: 0):
TypeError: Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
    at render (http://10.0.3.2:8081/index.bundle?platform=android&dev=true&minify=false:183726:35)
    at finishClassComponent (http://10.0.3.2:8081/index.bundle?platform=android&dev=true&minify=false:17810:43)

您可以尝试获取
null
数组的属性
legnth
。 所以你需要像这样编码

array !== null && array !== undefined && array.length

“length”有问题您必须在代码中将length与字符串或数组一起使用。