Skip to content

Instantly share code, notes, and snippets.

@roycechua
Created September 28, 2021 15:38
Show Gist options
  • Save roycechua/8376e099d83a50351d56b1789c94979c to your computer and use it in GitHub Desktop.
Save roycechua/8376e099d83a50351d56b1789c94979c to your computer and use it in GitHub Desktop.
Patch for React Native 0.63 and below for iOS 14 devices not showing images
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
@roycechua
Copy link
Author

Picked up and reposted based on this issue facebook/react-native#29279

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment