Move width and height to onLoad. Document dimensions event.
This commit is contained in:
parent
eb78e9c2cd
commit
60130cb326
|
@ -114,9 +114,11 @@ e.g. `onProgress={e => console.log(e.nativeEvent.loaded / e.nativeEvent.total)}`
|
|||
|
||||
---
|
||||
|
||||
### `onLoad?: () => void`
|
||||
### `onLoad?: (event) => void`
|
||||
|
||||
Called on a successful image fetch.
|
||||
Called on a successful image fetch. Called with the width and height of the loaded image.
|
||||
|
||||
e.g. `onLoad={e => console.log(e.nativeEvent.width, e.nativeEvent.height)}`
|
||||
|
||||
---
|
||||
|
||||
|
|
|
@ -104,16 +104,15 @@
|
|||
}
|
||||
} else {
|
||||
hasCompleted = YES;
|
||||
if (_onFastImageLoad) {
|
||||
_onFastImageLoad(@{});
|
||||
}
|
||||
|
||||
NSDictionary* params = @{
|
||||
@"width":[NSNumber numberWithDouble:image.size.width],
|
||||
@"height":[NSNumber numberWithDouble:image.size.height]
|
||||
};
|
||||
if (_onFastImageLoad) {
|
||||
_onFastImageLoad(params);
|
||||
}
|
||||
if (_onFastImageLoadEnd) {
|
||||
_onFastImageLoadEnd(params);
|
||||
_onFastImageLoadEnd(@{});
|
||||
}
|
||||
}
|
||||
}];
|
||||
|
|
|
@ -14,7 +14,7 @@ const getTestProgressCallbacks = label => ({
|
|||
console.log(
|
||||
`${label} - onProgress - ${e.nativeEvent.loaded / e.nativeEvent.total}`,
|
||||
),
|
||||
onLoad: () => console.log(`${label} - onLoad`),
|
||||
onLoad: (e) => console.log(`${label} - onLoad`, e.nativeEvent),
|
||||
onError: () => console.log(`${label} - onError`),
|
||||
onLoadEnd: () => console.log(`${label} - onLoadEnd`),
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue