【问题标题】:react native 62.2 up to 63 images are not able to show in IOS 14, IOS issuereact native 62.2 up to 63 images are not able to show in IOS 14, IOS issue
【发布时间】:2020-11-12 01:55:00
【问题描述】:

React-Native 在 IOS 14 或更高版本中不显示图像,甚至在模拟器上也不显示图像。问题来自 react-native 版本 62.2 等等,直到 63.3 版本修复了它。

【问题讨论】:

标签: react-native


【解决方案1】:

在 react-native 62.2 中删除此错误的最佳方法是遵循 5 个步骤:

diff --git a/node_modules/react-native/Libraries/Image/RCTUIImageViewAnimated.m b/node_modules/react-native/Libraries/Image/RCTUIImageViewAnimated.m
index 21f1a06..2444713 100644
--- a/node_modules/react-native/Libraries/Image/RCTUIImageViewAnimated.m
+++ b/node_modules/react-native/Libraries/Image/RCTUIImageViewAnimated.m
@@ -272,6 +272,9 @@ - (void)displayDidRefresh:(CADisplayLink *)displayLink
 
 - (void)displayLayer:(CALayer *)layer
 {
+  if (!_currentFrame) {
+    _currentFrame = self.image;
+  }
   if (_currentFrame) {
     layer.contentsScale = self.animatedImageScale;
     layer.contents = (__bridge id)_currentFrame.CGImage;
diff --git a/node_modules/react-native/scripts/.packager.env b/node_modules/react-native/scripts/.packager.env
new file mode 100644
index 0000000..361f5fb
--- /dev/null
+++ b/node_modules/react-native/scripts/.packager.env
@@ -0,0 +1 @@
+export RCT_METRO_PORT=8081

1.- 运行“npm i -g patch-package”

2.- 创建一个名为 patch 的新文件夹

3.- 在该文件夹中创建一个名为 react-native+0.63.0.patch 的新文件

4.- 在上面添加源代码。

5.- 在项目根目录运行“patch-package”

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-12-26
    • 2022-12-26
    • 2022-12-27
    • 1970-01-01
    • 2022-11-02
    • 2019-05-04
    • 2022-12-26
    相关资源
    最近更新 更多