File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -268,11 +268,14 @@ function handleLoading(
268
268
setBlurComplete ( true )
269
269
}
270
270
if ( onLoadRef ?. current ) {
271
+ // Since we don't have the SyntheticEvent here,
272
+ // we must create one with the same shape.
273
+ // See https://reactjs.org/docs/events.html
271
274
const event = new Event ( 'load' )
272
275
Object . defineProperty ( event , 'target' , { writable : false , value : img } )
273
276
let prevented = false
274
277
let stopped = false
275
- const sytheticEvent = {
278
+ onLoadRef . current ( {
276
279
...event ,
277
280
nativeEvent : event ,
278
281
currentTarget : img ,
@@ -288,8 +291,7 @@ function handleLoading(
288
291
stopped = true
289
292
event . stopPropagation ( )
290
293
} ,
291
- }
292
- onLoadRef . current ( sytheticEvent )
294
+ } )
293
295
}
294
296
if ( onLoadingCompleteRef ?. current ) {
295
297
onLoadingCompleteRef . current ( img )
You can’t perform that action at this time.
0 commit comments