From 7698cd09536ebf99c3b56696a7bb75d714abfb18 Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Fri, 28 Jun 2024 04:35:39 -0700 Subject: [PATCH] Fixes Image load event in new arch (#44918) Summary: Fixes https://github.com/facebook/react-native/issues/44896. cc cipolleschi ## Changelog: [IOS] [FIXED] - Fixes Image load event in new arch Pull Request resolved: https://github.com/facebook/react-native/pull/44918 Test Plan: https://github.com/facebook/react-native/issues/44896 Reviewed By: dmytrorykun Differential Revision: D59108500 Pulled By: cipolleschi fbshipit-source-id: 1fad4f82288141e9fc37f525be7073deb81c542c --- .../Mounting/ComponentViews/Image/RCTImageComponentView.mm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm index b023a7d12d6c46..665b2979a79fff 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm @@ -136,7 +136,10 @@ - (void)didReceiveImage:(UIImage *)image metadata:(id)metadata fromObserver:(con return; } - static_cast(*_eventEmitter).onLoad(_state->getData().getImageSource()); + auto imageSource = _state->getData().getImageSource(); + imageSource.size = {image.size.width, image.size.height}; + + static_cast(*_eventEmitter).onLoad(imageSource); static_cast(*_eventEmitter).onLoadEnd(); const auto &imageProps = static_cast(*_props);