[fix] Add event parameter to Image onLoad callback

Close #1723
This commit is contained in:
Harrison Mendonça
2020-09-03 12:02:54 -03:00
committed by Nicolas Gallagher
parent 8add92f776
commit c6425a0048
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -236,7 +236,7 @@ const Image = forwardRef<ImageProps, *>((props, ref) => {
function load(e) {
updateState(LOADED);
if (onLoad) {
onLoad();
onLoad(e);
}
if (onLoadEnd) {
onLoadEnd();
+1 -1
View File
@@ -119,7 +119,7 @@ const ImageLoader = {
image.onerror = onError;
image.onload = e => {
// avoid blocking the main thread
const onDecode = () => onLoad();
const onDecode = () => onLoad({ nativeEvent: e });
if (typeof image.decode === 'function') {
// Safari currently throws exceptions when decoding svgs.
// We want to catch that error and allow the load handler