美文网首页
react native 踩坑记录

react native 踩坑记录

作者: _若无 | 来源:发表于2020-11-24 08:51 被阅读0次
    • Warning: Failed child context type: Invalid child context virtualizedCell.cellKey of type number supplied to CellRenderer, expected string.
      in CellRenderer (at VirtualizedList.js:851)
      in RCTView (at ScrollView.js:1063)
      解决方法:
    将keyExtractor = (item, index) => index转为keyExtractor = {(item, index) => index.toString()}
    
    image.png
    • 问题:
      Image的!!!重大变革:
      Error: The <Image> component cannot contain children. If you want to render content on top of the image, consider using the <ImageBackground> component or absolute positioning.
      解决办法:
    用ImageBackground 代替 Image
    

    -问题:
    Text strings must be rendered within a <Text> component.
    原因:是因为多了两个‘’


    image.png

    解决办法:
    去掉就可以了!!坑啊


    image.png
    • 问题:
      黄色警告
      例如:Remote debugger is in a background tab which may cause apps to perform slowly. Fix this by foregrounding the tab (or opening it in a separate window).

    解决办法:

    去掉黄色警告:
    在index.js 添加
    console.ignoredYellowBox = ['Warning: BackAndroid is deprecated. Please use BackHandler instead.','source.uri should not be an empty string','Invalid props.style key'];
    console.disableYellowBox = true // 关闭全部黄色警告
    
    • 问题:
      Native module cannot be bull.


      问题

      解决办法:
      相关包内容没有安装好,重新安装

    相关文章

      网友评论

          本文标题:react native 踩坑记录

          本文链接:https://www.haomeiwen.com/subject/swgxhktx.html