react native 踩坑记录

  • 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 component cannot contain children. If you want to render content on top of the image, consider using the component or absolute positioning.
    解决办法:
用ImageBackground 代替 Image

-问题:
Text strings must be rendered within a 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 踩坑记录)