Skip to content

Commit e98bacc

Browse files
committed
Fix onLoad and onError on iOS.
1 parent a891bcf commit e98bacc

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

FastImage.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ const FastImageSourcePropType = PropTypes.shape({
4444
FastImage.propTypes = {
4545
...View.propTypes,
4646
source: FastImageSourcePropType,
47+
onFastImageError: PropTypes.func,
48+
onFastImageLoad: PropTypes.func,
4749
}
4850

4951
FastImage.defaultProps = {
@@ -53,7 +55,7 @@ FastImage.defaultProps = {
5355
}
5456

5557
const FastImageView = requireNativeComponent('FastImageView', FastImage, {
56-
nativeOnly: { onError: true, onLoad: true },
58+
nativeOnly: { onFastImageError: true, onFastImageLoad: true },
5759
})
5860

5961
export default FastImage

ios/FastImage/FFFastImageView.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
@interface FFFastImageView : UIImageView
1111

12-
@property(nonatomic, copy) RCTDirectEventBlock onError;
13-
@property(nonatomic, copy) RCTDirectEventBlock onLoad;
12+
@property(nonatomic, copy) RCTDirectEventBlock onFastImageError;
13+
@property(nonatomic, copy) RCTDirectEventBlock onFastImageLoad;
1414
@property(nonatomic, assign) RCTResizeMode resizeMode;
1515
@property(nonatomic, strong) FFFastImageSource *source;
1616

ios/FastImage/FFFastImageView.m

+4-4
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ - (void)setSource:(FFFastImageSource *)source {
4242
SDImageCacheType cacheType,
4343
NSURL *imageURL) {
4444
if (error) {
45-
if (_onError) {
46-
_onError(@{});
45+
if (_onFastImageError) {
46+
_onFastImageError(@{});
4747
}
4848
} else {
49-
if (_onLoad) {
50-
_onLoad(@{});
49+
if (_onFastImageLoad) {
50+
_onFastImageLoad(@{});
5151
}
5252
}
5353
}];

ios/FastImage/FFFastImageViewManager.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ - (FFFastImageView*)view {
1414

1515
RCT_EXPORT_VIEW_PROPERTY(source, FFFastImageSource);
1616
RCT_EXPORT_VIEW_PROPERTY(resizeMode, RCTResizeMode);
17-
RCT_EXPORT_VIEW_PROPERTY(onError, RCTDirectEventBlock);
18-
RCT_EXPORT_VIEW_PROPERTY(onLoad, RCTDirectEventBlock);
17+
RCT_EXPORT_VIEW_PROPERTY(onFastImageError, RCTDirectEventBlock);
18+
RCT_EXPORT_VIEW_PROPERTY(onFastImageLoad, RCTDirectEventBlock);
1919

2020
@end

0 commit comments

Comments
 (0)