From 7c8b91442b3547cf94c752f234210bef0848c00a Mon Sep 17 00:00:00 2001 From: Clement Genzmer Date: Mon, 13 Jun 2016 17:44:55 -0700 Subject: [PATCH] Fix rtcRefreshControl Reviewed By: javache Differential Revision: D3428671 fbshipit-source-id: c3ae599d4a1a831513b4a7c88ae6aa3b3469e92a --- React/Views/RCTScrollView.m | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/React/Views/RCTScrollView.m b/React/Views/RCTScrollView.m index 3f2cd82ef..cee26c180 100644 --- a/React/Views/RCTScrollView.m +++ b/React/Views/RCTScrollView.m @@ -140,7 +140,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init) @property (nonatomic, copy) NSIndexSet *stickyHeaderIndices; @property (nonatomic, assign) BOOL centerContent; -@property (nonatomic, strong) RCTRefreshControl *refreshControl; +@property (nonatomic, strong) RCTRefreshControl *rctRefreshControl; @end @@ -275,8 +275,8 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init) CGFloat scrollTop = self.bounds.origin.y + self.contentInset.top; // If the RefreshControl is refreshing, remove it's height so sticky headers are // positioned properly when scrolling down while refreshing. - if (self.refreshControl != nil && self.refreshControl.refreshing) { - scrollTop -= self.refreshControl.frame.size.height; + if (_rctRefreshControl != nil && _rctRefreshControl.refreshing) { + scrollTop -= _rctRefreshControl.frame.size.height; } // Find the section headers that need to be docked @@ -358,13 +358,13 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init) return [super hitTest:point withEvent:event]; } -- (void)setRefreshControl:(RCTRefreshControl *)refreshControl +- (void)setRctRefreshControl:(RCTRefreshControl *)refreshControl { - if (_refreshControl) { - [_refreshControl removeFromSuperview]; + if (_rctRefreshControl) { + [_rctRefreshControl removeFromSuperview]; } - _refreshControl = refreshControl; - [self addSubview:_refreshControl]; + _rctRefreshControl = refreshControl; + [self addSubview:_rctRefreshControl]; } @end @@ -422,7 +422,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder) { [super insertReactSubview:view atIndex:atIndex]; if ([view isKindOfClass:[RCTRefreshControl class]]) { - _scrollView.refreshControl = (RCTRefreshControl*)view; + [_scrollView setRctRefreshControl:(RCTRefreshControl *)view]; } else { RCTAssert(_contentView == nil, @"RCTScrollView may only contain a single subview"); _contentView = view; @@ -434,7 +434,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder) { [super removeReactSubview:subview]; if ([subview isKindOfClass:[RCTRefreshControl class]]) { - _scrollView.refreshControl = nil; + [_scrollView setRctRefreshControl:nil]; } else { RCTAssert(_contentView == subview, @"Attempted to remove non-existent subview"); _contentView = nil; @@ -490,7 +490,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder) _scrollView.contentOffset = originalOffset; // Adjust the refresh control frame if the scrollview layout changes. - RCTRefreshControl *refreshControl = _scrollView.refreshControl; + RCTRefreshControl *refreshControl = _scrollView.rctRefreshControl; if (refreshControl && refreshControl.refreshing) { refreshControl.frame = (CGRect){_scrollView.contentOffset, {_scrollView.frame.size.width, refreshControl.frame.size.height}}; }