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 = {
122
122
id += 1 ;
123
123
const image = new window . Image ( ) ;
124
124
image . onerror = onError ;
125
- image . onload = ( e ) => {
125
+ image . onload = ( nativeEvent ) => {
126
126
// 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
+ } ;
128
137
if ( typeof image . decode === 'function' ) {
129
138
// Safari currently throws exceptions when decoding svgs.
130
139
// We want to catch that error and allow the load handler
You can’t perform that action at this time.
0 commit comments