本文中的报错解决方案,大家仅供参考,这些都是本人自己工作中遇到的报错信息

React  Native
1.报错信息(“红屏解决方案”)
     Packager unable to resolve module from /Users/node_modules/ (无法解析某个模块)
     https://github.com/facebook/react-native/issues/4968
     
2.Text strings must be rendred within a<Text> component 语法错误
    这个错在你的代码中注释写错,或者有多余的标点(注意代码中的注释格式)
   https://www.jianshu.com/p/7ce4522953fd      
  代码注释错误,不能在组件里面写注释, <View>里面不能写//  只能{**}</View>的注释,
  
3.引入图片报错500   可能是引入图片路径错误(../../) 
  undefined is not an object (evaluating 'RNGestureHandlerModule.State'
  Rn null is not an object (evaluating 't.languages)  空对象      onPress={this.login.bind(this)} 是否有bind
  有的第三方组件没有link  会报错  ----------->   react-native link      
  https://blog.csdn.net/quhongqiang/article/details/86597694

4. Application AwesomeProject has not beenregistered.
    Hint: This error often happens when you're runningthe packager (local dev server) from a wrongfolder. 
    For example you have multiple apps and  the packager is still running for the app you wereworking on before.
    If this is the case, simply kill the old packager  instance (e.g. close the packager terminal window)and start the packager
    in the correct app folder    (e.g.cd into app folder and run 'npm start').
    This error can also happen due to a require0error during initialization or failure to callAppRegistry.registerompo
      可能忘记引入组件(好好检查一下)
      
5. 引入第三方报错   popupWindows(26,27,28,)直接注释;
   https://xiangzhihong.iteye.com/blog/2393480(仿微信PopWindow)
  缓存清理:报错69,80,简书链接
  https://blog.csdn.net/qq_39910762/article/details/82970348 (缓存处理)
  https://github.com/reactnativecn/react-native-http-cache
  解决报错
  https://www.jianshu.com/p/00807d61515f

6.关闭黄色警告(关闭所有的警告)
  https://blog.csdn.net/qq_25905161/article/details/81298050


----------------------------------------------------------------------------------------------------------
7.报错信息如下
react-navigation报错(0 , _reactNavigation.StackNavigator) is not a function
这是由于版本不同之间,写法不一样造成的错误,在npm install react-navigation  指定一下版本就OK
例如:npm install react-navigation@2.0.0 --save
在这里我也附上我参考的链接      https://www.jianshu.com/p/13f339fcaa90



Logo

开源鸿蒙跨平台开发社区汇聚开发者与厂商,共建“一次开发,多端部署”的开源生态,致力于降低跨端开发门槛,推动万物智联创新。

更多推荐