From a1dc453b5c8584c4859efd510beea08f9d91b0f8 Mon Sep 17 00:00:00 2001 From: Janic Duplessis Date: Sun, 21 Feb 2021 18:19:18 -0500 Subject: [PATCH 1/2] Fix RefreshControl layout when removed from window --- React/Views/RefreshControl/RCTRefreshControl.m | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/React/Views/RefreshControl/RCTRefreshControl.m b/React/Views/RefreshControl/RCTRefreshControl.m index 1022b7896d8867..79acb6e5285566 100644 --- a/React/Views/RefreshControl/RCTRefreshControl.m +++ b/React/Views/RefreshControl/RCTRefreshControl.m @@ -49,6 +49,16 @@ - (void)layoutSubviews _isInitialRender = false; } +- (void)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; From 376cee6adbdb29b51b6995c68a5913db39957e13 Mon Sep 17 00:00:00 2001 From: Janic Duplessis Date: Tue, 23 Feb 2021 13:24:36 -0500 Subject: [PATCH 2/2] Update RCTRefreshControl.m --- React/Views/RefreshControl/RCTRefreshControl.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/React/Views/RefreshControl/RCTRefreshControl.m b/React/Views/RefreshControl/RCTRefreshControl.m index 79acb6e5285566..6985c38bce40b2 100644 --- a/React/Views/RefreshControl/RCTRefreshControl.m +++ b/React/Views/RefreshControl/RCTRefreshControl.m @@ -51,6 +51,8 @@ - (void)layoutSubviews - (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.