1.invariant violation:expected a component class,got[object object]
创建自定义组件首字母要大写,否则会报错.
2.Module 0 is not a registered callable module.
将gradle升级成最新版本(cd Android 进入android目录执行:sudo ./gradlew clean) 或者通过android studio工具升级.
3.android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?
该错误属于安卓Native的错误,如果引用的Activity不存在或者已经销毁,再次引用就会报该错误,如果是React Native 调用原生控件的话,创建控件需要引用:getCurrentActivity()
4.android.app.Application cannot be cast to com.facebook.React.ReactApplication
需要将创建的MainApplication在AndroidManifest.xml配置好.
5.Element type is invalid: expected a string (for built-in components) or a class/function but got: object
发生原生一般是你引用了无效的组件,如果组件确实正确,看下引用的组件是否正常导出:(export defalut)
6.react native undefined is not an object (evaluating this....
发生该错误的一般是忘记bind(this),只要回调函数中需要用到this的,一般都需要bind.
** 7.react native - expected a component class, got [object Object]**
** 该错误可能是你引用了小写的组件,组件首字母一定要大写,比如<login/>应该写成<Login/>**