We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
nativeEvent
1 parent 45ff86b commit b433435Copy full SHA for b433435
packages/react-native-web/src/modules/ImageLoader/index.js
@@ -122,9 +122,18 @@ const ImageLoader = {
122
id += 1;
123
const image = new window.Image();
124
image.onerror = onError;
125
- image.onload = (e) => {
+ image.onload = (nativeEvent) => {
126
// avoid blocking the main thread
127
- const onDecode = () => onLoad({ nativeEvent: e });
+ 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
137
if (typeof image.decode === 'function') {
138
// Safari currently throws exceptions when decoding svgs.
139
// We want to catch that error and allow the load handler
0 commit comments