RN + Xcode12 + iOS14 本地图片加载不出解决方案

更新到Xcode12 之后运行项目、然后图片不显示
解决方案:

Xcode快捷键 command+shift+O 搜索 RCTUIImageViewAnimated
在RCTUIImageViewAnimated.m 找到 267行
修改如下方法即可

- (void)displayLayer:(CALayer *)layer
{
  if (_currentFrame) {
    layer.contentsScale = self.animatedImageScale;
    layer.contents = (__bridge id)_currentFrame.CGImage;
  }
}

修改为:

- (void)displayLayer:(CALayer *)layer
{
  if (_currentFrame) {
    layer.contentsScale = self.animatedImageScale;
    layer.contents = (__bridge id)_currentFrame.CGImage;
  } else {
    [super displayLayer:layer];
  }
}

注:该bug在rn0.63已解决

你可能感兴趣的:(RN + Xcode12 + iOS14 本地图片加载不出解决方案)