From d1a090b0afe94ed5d5f55cf0b6f0ecc044ac332e Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Fri, 21 Mar 2025 13:27:50 -0700 Subject: [PATCH] Fix animated images missing from offscreen render (#50187) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/50187 D70668516 broke some SSTs, where asset that previously was black, showed up as clear. I was assuming that was because we fixed a separate bug where assets could erroneously show as black layer, but these tests were actually just using a black asset. Real bug here, is that the change led to only setting image when we have a displayLink, ie showing on screen, where before, we set image (implicitly at first frame) as layer content. This change fixes that behavior, so first frame is rendered as part of off-screen view rendering, for images considered animatable. Changelog: [iOS][Fixed] - Fix animated images missing from offscreen render Reviewed By: cipolleschi Differential Revision: D71590856 fbshipit-source-id: f5da690b27f2da0f6979f25ece031ff0d418cca6 --- .../react-native/Libraries/Image/RCTUIImageViewAnimated.mm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/react-native/Libraries/Image/RCTUIImageViewAnimated.mm b/packages/react-native/Libraries/Image/RCTUIImageViewAnimated.mm index 28896293710..670493e83a9 100644 --- a/packages/react-native/Libraries/Image/RCTUIImageViewAnimated.mm +++ b/packages/react-native/Libraries/Image/RCTUIImageViewAnimated.mm @@ -123,11 +123,9 @@ static NSUInteger RCTDeviceFreeMemory(void) if ([self paused]) { [self start]; } - - [self.layer setNeedsDisplay]; - } else { - super.image = image; } + + super.image = image; } #pragma mark - Private