Fix onLoad and onError on iOS.
This commit is contained in:
parent
a891bcf014
commit
e98bacc84f
|
@ -44,6 +44,8 @@ const FastImageSourcePropType = PropTypes.shape({
|
|||
FastImage.propTypes = {
|
||||
...View.propTypes,
|
||||
source: FastImageSourcePropType,
|
||||
onFastImageError: PropTypes.func,
|
||||
onFastImageLoad: PropTypes.func,
|
||||
}
|
||||
|
||||
FastImage.defaultProps = {
|
||||
|
@ -53,7 +55,7 @@ FastImage.defaultProps = {
|
|||
}
|
||||
|
||||
const FastImageView = requireNativeComponent('FastImageView', FastImage, {
|
||||
nativeOnly: { onError: true, onLoad: true },
|
||||
nativeOnly: { onFastImageError: true, onFastImageLoad: true },
|
||||
})
|
||||
|
||||
export default FastImage
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
@interface FFFastImageView : UIImageView
|
||||
|
||||
@property(nonatomic, copy) RCTDirectEventBlock onError;
|
||||
@property(nonatomic, copy) RCTDirectEventBlock onLoad;
|
||||
@property(nonatomic, copy) RCTDirectEventBlock onFastImageError;
|
||||
@property(nonatomic, copy) RCTDirectEventBlock onFastImageLoad;
|
||||
@property(nonatomic, assign) RCTResizeMode resizeMode;
|
||||
@property(nonatomic, strong) FFFastImageSource *source;
|
||||
|
||||
|
|
|
@ -42,12 +42,12 @@
|
|||
SDImageCacheType cacheType,
|
||||
NSURL *imageURL) {
|
||||
if (error) {
|
||||
if (_onError) {
|
||||
_onError(@{});
|
||||
if (_onFastImageError) {
|
||||
_onFastImageError(@{});
|
||||
}
|
||||
} else {
|
||||
if (_onLoad) {
|
||||
_onLoad(@{});
|
||||
if (_onFastImageLoad) {
|
||||
_onFastImageLoad(@{});
|
||||
}
|
||||
}
|
||||
}];
|
||||
|
|
|
@ -14,7 +14,7 @@ RCT_EXPORT_MODULE(FastImageView)
|
|||
|
||||
RCT_EXPORT_VIEW_PROPERTY(source, FFFastImageSource);
|
||||
RCT_EXPORT_VIEW_PROPERTY(resizeMode, RCTResizeMode);
|
||||
RCT_EXPORT_VIEW_PROPERTY(onError, RCTDirectEventBlock);
|
||||
RCT_EXPORT_VIEW_PROPERTY(onLoad, RCTDirectEventBlock);
|
||||
RCT_EXPORT_VIEW_PROPERTY(onFastImageError, RCTDirectEventBlock);
|
||||
RCT_EXPORT_VIEW_PROPERTY(onFastImageLoad, RCTDirectEventBlock);
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in New Issue