You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Image onLoad event (ImageLoadEvent) object is empty in Chrome version 109.0.5414.87 on M1 Mac #2469
In the latest version of Chrome on an M1 Mac (Version 109.0.5414.87 (Official Build) (arm64)), the Image onLoad event no longer contains all expected fields - for example, path and target are not available fields as expected in https://reactnative.dev/docs/image#imageloadevent.
changed the title [-]Image onLoad event (ImageLoadEvent) object is empty in latest Chrome version[/-][+]Image onLoad event (ImageLoadEvent) object is empty in Chrome version 109.0.5414.87 on M1 Mac[/+]on Jan 20, 2023
I believe it did include a path/target or some reference the DOM node that caused the event
Yes a path did exist at some point, and it was an array like [img] where img was the html element
It seems it was recently deprecated: https://chromestatus.com/feature/5726124632965120
This is not a bug in react-native-web or related to M1 / arm64
Event.path is a non-standard API that returns the event's path, which is an array of the objects on which listeners will be invoked. It is supported by Blink only, causing web compatibility issues
If you load an image the way react-native-web does, target would be null
A target exposing the html element can be exposed from onLoad, but I think most people that need it would just pass a ref as it is the most common way to work with underlying elements
Hi @kidroca@musnit , img ref will be the parent view, it seems quite hacky to find img element inside the view then get the img properties. Can we consider to use the patch 80ee858? Or is there any better way to get img's width/height ?
Hi @kidroca@musnit , img ref will be the parent view, it seems quite hacky to find img element inside the view then get the img properties. Can we consider to use the patch 80ee858? Or is there any better way to get img's width/height ?
Hi @kidroca@musnit , img ref will be the parent view, it seems quite hacky to find img element inside the view then get the img properties. Can we consider to use the patch 80ee858? Or is there any better way to get img's width/height ?
Activity
[-]Image onLoad event (ImageLoadEvent) object is empty in latest Chrome version[/-][+]Image onLoad event (ImageLoadEvent) object is empty in Chrome version 109.0.5414.87 on M1 Mac[/+]kidroca commentedon Jan 21, 2023
AFAIK onload never matched the RN Image Load event
And it shouldn't contain path or target, but
sourcewith uri, width and heightkidroca commentedon Jan 21, 2023
I'm trying to make onload match the react-native Image interface here: 80ee858
musnit commentedon Jan 21, 2023
I believe it did include a path/target or some reference the DOM node that caused the event
kidroca commentedon Jan 23, 2023
Yes a
pathdid exist at some point, and it was an array like[img]whereimgwas the html elementIt seems it was recently deprecated: https://chromestatus.com/feature/5726124632965120
This is not a bug in react-native-web or related to M1 / arm64
If you load an image the way react-native-web does,
targetwould benullA
targetexposing the html element can be exposed fromonLoad, but I think most people that need it would just pass arefas it is the most common way to work with underlying elementsmusnit commentedon Jan 24, 2023
Ah thanks for digging in and finding the Chrome change! and yeah, ref fix seems more appropriate, thanks!
xilin commentedon Aug 8, 2025
Hi @kidroca @musnit , img ref will be the parent view, it seems quite hacky to find img element inside the view then get the img properties. Can we consider to use the patch 80ee858? Or is there any better way to get img's width/height ?
kidroca commentedon Aug 8, 2025
Hi, @xilin
You can borrow this patch https://github.com/Expensify/App/blob/b7436524af53a84f5471bc3af14390632500882e/patches/react-native-web%2B0.20.0%2B003%2Bimage-header-support.patch
and apply it using
npx patch-packageIt's based on this Pull Request: #2442
Then the
onLoadprop would be called with image dimensionsThe hacky solution with the ref might be less taxing overall, especially if you're not managing other patches with
patch-packagexilin commentedon Aug 11, 2025
Thanks for sharing! Yeah we've used
patch-packageand adding a patch works for us. But still hope we can merge your PR soon to have build in support.