diff --git a/Libraries/Image/Image.android.js b/Libraries/Image/Image.android.js index cc2ffe258..bd5b0bd16 100644 --- a/Libraries/Image/Image.android.js +++ b/Libraries/Image/Image.android.js @@ -119,6 +119,10 @@ var Image = React.createClass({ * Invoked on load start */ onLoadStart: PropTypes.func, + /** + * Invoked on load error + */ + onError: PropTypes.func, /** * Invoked when load completes successfully */ @@ -284,10 +288,10 @@ var Image = React.createClass({ sources = source; } - const {onLoadStart, onLoad, onLoadEnd} = this.props; + const {onLoadStart, onLoad, onLoadEnd, onError} = this.props; const nativeProps = merge(this.props, { style, - shouldNotifyLoadEvents: !!(onLoadStart || onLoad || onLoadEnd), + shouldNotifyLoadEvents: !!(onLoadStart || onLoad || onLoadEnd || onError), src: sources, loadingIndicatorSrc: loadingIndicatorSource ? loadingIndicatorSource.uri : null, }); diff --git a/Libraries/Image/Image.ios.js b/Libraries/Image/Image.ios.js index b1acae8cd..04c78d6cb 100644 --- a/Libraries/Image/Image.ios.js +++ b/Libraries/Image/Image.ios.js @@ -255,7 +255,6 @@ const Image = React.createClass({ onProgress: PropTypes.func, /** * Invoked on load error with `{nativeEvent: {error}}`. - * @platform ios */ onError: PropTypes.func, /** diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageManager.java index 3acc27778..62d0e4540 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageManager.java @@ -178,6 +178,8 @@ public class ReactImageManager extends SimpleViewManager { MapBuilder.of("registrationName", "onLoadStart"), ImageLoadEvent.eventNameForType(ImageLoadEvent.ON_LOAD), MapBuilder.of("registrationName", "onLoad"), + ImageLoadEvent.eventNameForType(ImageLoadEvent.ON_ERROR), + MapBuilder.of("registrationName", "onError"), ImageLoadEvent.eventNameForType(ImageLoadEvent.ON_LOAD_END), MapBuilder.of("registrationName", "onLoadEnd")); }