一、现象
应用在IOS 14.0下调试无法显示图片
二、解决
1、在依赖包中找到文件:RCTUIImageViewAnimated.m
路径如:/node_modules/react-native/Libraries/Image 下
2、修改文件,大概269行
原:
if (_currentFrame) {
layer.contentsScale = self.animatedImageScale;
layer.contents = (__bridge id)_currentFrame.CGImage;
}
修改后:
if (_currentFrame) {
layer.contentsScale = self.animatedImageScale;
layer.contents = (__bridge id)_currentFrame.CGImage;
} else {
[super displayLayer:layer];
}
三、总结
参考文档:React Native 中文网的讨论问题: https://github.com/reactnativecn/react-native-website/issues/299