Skip to content

Commit

Permalink
fix: restore refresh control fix
Browse files Browse the repository at this point in the history
  • Loading branch information
grabbou committed Mar 11, 2021
1 parent 7f3f80f commit 138fdbc
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions React/Views/RefreshControl/RCTRefreshControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ - (void)layoutSubviews
{
[super layoutSubviews];

// Fix for bug #7976
if (self.backgroundColor == nil) {
self.backgroundColor = [UIColor clearColor];
}

// If the control is refreshing when mounted we need to call
// beginRefreshing in layoutSubview or it doesn't work.
if (_currentRefreshingState && _isInitialRender) {
Expand All @@ -49,18 +54,6 @@ - (void)layoutSubviews
_isInitialRender = false;
}

- (void)didMoveToWindow
{
[super didMoveToWindow];

// Since iOS 14 there seems to be a bug where refresh control becomes
// visible if the view gets removed from window then added back again.
// Calling endRefreshing fixes the layout.
if (!_currentRefreshingState) {
[super endRefreshing];
}
}

- (void)beginRefreshingProgrammatically
{
UInt64 beginRefreshingTimestamp = _currentRefreshingStateTimestamp;
Expand Down

0 comments on commit 138fdbc

Please sign in to comment.