首页 > 解决方案 > IOS 14图像渲染问题本机反应

问题描述

我无法在 IOS 14 模拟器上渲染图像

我试过以下

问题解决

但是在尝试了上面的代码之后,当我重新构建代码时,更改会自动撤消,并且问题仍然存在。

标签: iosreact-nativeios14

解决方案


添加[super displayLayer:layer]后可以显示图像;如果 _currentFrame 是 nil 如果我理解正确的话, _currentFrame 应该是用于动画图像,所以如果它是静止图像,我们可以使用 UIImage 实现来处理图像渲染,不确定它是否是正确的修复。react-native/Libraries/Image/RCTUIImageViewAnimated.m

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

推荐阅读