diff --git a/React/Views/RefreshControl/RCTRefreshControl.h b/React/Views/RefreshControl/RCTRefreshControl.h index 35c60c2878b648..e9b330fa7c29c4 100644 --- a/React/Views/RefreshControl/RCTRefreshControl.h +++ b/React/Views/RefreshControl/RCTRefreshControl.h @@ -10,7 +10,7 @@ #import #import -@interface RCTRefreshControl : UIRefreshControl +@interface RCTRefreshControl : UIRefreshControl @property (nonatomic, copy) NSString *title; @property (nonatomic, copy) RCTDirectEventBlock onRefresh; diff --git a/React/Views/ScrollView/RCTScrollView.m b/React/Views/ScrollView/RCTScrollView.m index f9819b47bc3a9f..2929f2dfdf3831 100644 --- a/React/Views/ScrollView/RCTScrollView.m +++ b/React/Views/ScrollView/RCTScrollView.m @@ -29,7 +29,7 @@ @interface RCTCustomScrollView : UIScrollView @property (nonatomic, assign) BOOL centerContent; -@property (nonatomic, strong) UIView *customRefreshControl; +@property (nonatomic, strong) UIView *customRefreshControl; @property (nonatomic, assign) BOOL pinchGestureEnabled; @end @@ -215,14 +215,14 @@ - (void)setFrame:(CGRect)frame } } -- (void)setCustomRefreshControl:(UIView *)refreshControl +- (void)setCustomRefreshControl:(UIView *)refreshControl { if (_customRefreshControl) { [_customRefreshControl removeFromSuperview]; } _customRefreshControl = refreshControl; // We have to set this because we can't always guarantee the - // `RCTCustomRefreshContolProtocol`'s superview will always be of class + // `RCTCustomRefreshControlProtocol`'s superview will always be of class // `UIScrollView` like we were previously if ([_customRefreshControl respondsToSelector:@selector(setScrollView:)]) { _customRefreshControl.scrollView = self; @@ -412,8 +412,8 @@ - (void)setRemoveClippedSubviews:(__unused BOOL)removeClippedSubviews - (void)insertReactSubview:(UIView *)view atIndex:(NSInteger)atIndex { [super insertReactSubview:view atIndex:atIndex]; - if ([view conformsToProtocol:@protocol(RCTCustomRefreshContolProtocol)]) { - [_scrollView setCustomRefreshControl:(UIView *)view]; + if ([view conformsToProtocol:@protocol(RCTCustomRefreshControlProtocol)]) { + [_scrollView setCustomRefreshControl:(UIView *)view]; if (![view isKindOfClass:[UIRefreshControl class]] && [view conformsToProtocol:@protocol(UIScrollViewDelegate)]) { [self addScrollListener:(UIView *)view]; } @@ -431,7 +431,7 @@ - (void)insertReactSubview:(UIView *)view atIndex:(NSInteger)atIndex - (void)removeReactSubview:(UIView *)subview { [super removeReactSubview:subview]; - if ([subview conformsToProtocol:@protocol(RCTCustomRefreshContolProtocol)]) { + if ([subview conformsToProtocol:@protocol(RCTCustomRefreshControlProtocol)]) { [_scrollView setCustomRefreshControl:nil]; if (![subview isKindOfClass:[UIRefreshControl class]] && [subview conformsToProtocol:@protocol(UIScrollViewDelegate)]) { @@ -486,7 +486,7 @@ - (void)layoutSubviews #if !TARGET_OS_TV // Adjust the refresh control frame if the scrollview layout changes. - UIView *refreshControl = _scrollView.customRefreshControl; + UIView *refreshControl = _scrollView.customRefreshControl; if (refreshControl && refreshControl.isRefreshing && ![refreshControl isKindOfClass:UIRefreshControl.class]) { refreshControl.frame = (CGRect){_scrollView.contentOffset, {_scrollView.frame.size.width, refreshControl.frame.size.height}}; diff --git a/React/Views/ScrollView/RCTScrollableProtocol.h b/React/Views/ScrollView/RCTScrollableProtocol.h index 706900b2514835..91b17034c0ba8e 100644 --- a/React/Views/ScrollView/RCTScrollableProtocol.h +++ b/React/Views/ScrollView/RCTScrollableProtocol.h @@ -33,7 +33,7 @@ /** * Denotes a view which implements custom pull to refresh functionality. */ -@protocol RCTCustomRefreshContolProtocol +@protocol RCTCustomRefreshControlProtocol @property (nonatomic, copy) RCTDirectEventBlock onRefresh; @property (nonatomic, readonly, getter=isRefreshing) BOOL refreshing; @@ -41,4 +41,8 @@ @optional @property (nonatomic, weak) UIScrollView *scrollView; +@end + + __attribute__ ((deprecated("Use RCTCustomRefreshControlProtocol instead"))) +@protocol RCTCustomRefreshContolProtocol @end