Rreact Native 常见错误总结
2017-03-01 00:00
423 查看
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/>
创建自定义组件首字母要大写,否则会报错.
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/>
相关文章推荐
- Rreact Native 常见错误总结
- Rreact Native 常见错误总结
- Android Rreact Native 常见错误总结
- Rreact Native 常见错误总结
- 【React Native】Rreact Native 常见错误总结
- Rreact Native 常见错误总结
- ReactNative常见错误
- React Native 开发常见错误
- React native 常见错误:unable to resolve module react-native-scrollable-tab-view
- react native 学习一(环境搭配和常见错误的解决)
- React-Native 常见错误及其原因
- React-native 常见错误:Seems you're trying to access 'ReactNative.Component' from the 'react-native'
- React-native 常见错误:Could not get BatchedBridge, make sure your bundle is packaged correctly
- React Native 常见问题总结(android端)
- Embedded linux移植常见错误及使用总结
- ssh开发常见错误总结(转)