cannot add a child that doesn’t have a YogaNode …
布局文件编写错误,可能是布局文件中注视导致的.
cannot find variable React
需要导入React. import React, {Component} from ‘react’;
The development server returned response error code: 500
js代码出现问题,查看node黑框框是否提示错误信息,如果有,则是本地js代码出现错误
设置虚拟机的ip地址,ctrl+M打开开发者菜单,选择Dev Setting ,选择Debug server host & port for device ,设置ip地址和端口号 localhost:8081.
You likely forgot to export your component from the file it’s defined in, or you might have mixed up default and named imports.
导包错误导致的.需要判断导入的类是默认导包还是其他导包,默认导包不需要添加{},其他导包需要添加{}
warning: isMounted(…) is deprecated in plain JavaScript React classes.
在app入口文件index.js中使用
import RootStackNavigator from "./pages/navigator/RootStackNavigator"; YellowBox.ignoreWarnings(['Warning: isMounted(...) is deprecated', 'Module RCTImageLoader']);
VirtualizedList: missing keys for items, make sure to specify a key property on each item or provide a custom keyExtractor.
FlatList使用的时候,需要指定keyExtractor属性
<FlatList ItemSeparatorComponent={() => this.renderItemSeparator()} enderItem={info => this._renderItem(info)} data={this.state.data} keyExtractor={(info) => this._keyExtractor(info)} /> _keyExtractor(item, index) { return index+''; }
subscriptions[i] is not a function
函数需要绑定this,例如
this.onBackAndroid.bind(this)
_react3.default.createClass is not a function
一些老的框架,使用的是下面的这种方式创建的Component,React最新版本抛弃使用了createClass这个函数,因此会提示错误.
var Popover = React.createClass() { ... } module.exports = Popover;
这时候需要做一些修改,改成下面的方式创建Component
export default class Popover extends Component{ ... }
Possible Unhandled Promise Rejection (id: 0):
提示未处理的promise异常,例如使用await时,如果promise reject一个结果,那么会提示这个错误,并导致后面的代码得不到执行..这时候可以try…catch一下,或者catch处理一下,例如:
async testError() { return Promise.reject('hello async error....'); }
async test() { let v2 = await this.testError().catch(err => { console.log(err); }); console.log(v2); }
标签:info,React,Component,新手入门,导包,keyExtractor,createClass,BUG,ReactNative From: https://www.cnblogs.com/sexintercourse/p/16954075.html