File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
packages/react-native-web/src/modules/ImageLoader Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -122,9 +122,18 @@ const ImageLoader = {
122122 id += 1 ;
123123 const image = new window . Image ( ) ;
124124 image . onerror = onError ;
125- image . onload = ( e ) => {
125+ image . onload = ( nativeEvent ) => {
126126 // avoid blocking the main thread
127- const onDecode = ( ) => onLoad ( { nativeEvent : e } ) ;
127+ const onDecode = ( ) => {
128+ // Append `source` to match RN's ImageLoadEvent interface
129+ nativeEvent . source = {
130+ uri : image . src ,
131+ width : image . naturalWidth ,
132+ height : image . naturalHeight
133+ } ;
134+
135+ onLoad ( { nativeEvent } ) ;
136+ } ;
128137 if ( typeof image . decode === 'function' ) {
129138 // Safari currently throws exceptions when decoding svgs.
130139 // We want to catch that error and allow the load handler
You can’t perform that action at this time.
0 commit comments