Skip to content

Commit

Permalink
Restore refresh spinner fix (#30978)
Browse files Browse the repository at this point in the history
Summary:
Fixes #30912
Reverts #31024 which did not fix the issue

This fix was removed in #28236, however it caused bug #7976 to resurface, as reported in #30912

Pull Request resolved: #30978

Test Plan:
This code had been present for quite some time before being removed in #28236

## Changelog

[Internal] [fixed] - regression with refresh control

Reviewed By: p-sun

Differential Revision: D26981600

Pulled By: PeteTheHeat

fbshipit-source-id: 2560e7dba1cfd6ed41d98f2c9ff4cd07a0e5fa24
  • Loading branch information
swrobel authored and facebook-github-bot committed Mar 11, 2021
1 parent e194018 commit 0afba0e
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions React/Views/RefreshControl/RCTRefreshControl.m
Expand Up @@ -43,6 +43,11 @@ - (void)layoutSubviews
[super layoutSubviews];
[self _applyProgressViewOffset];

// 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 @@ -51,18 +56,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 0afba0e

Please sign in to comment.