RefreshControl on initial render will not beginRefresh when refreshing state is false
Summary: There's an edge case in the `RefreshControl` which causes it to show as refreshing when the state is set to false. When the component is initialized with `refreshing` set to `true` on initial render but set to `false` before `layoutSubviews` is called, it will call `beginRefresh` and ignore its state. That's because `layoutSubviews` never checks if `_currentRefreshingState` is in fact still `true`, it merely assumes it is. This is fixed by simply doing a check for `_currentRefreshingState` before entering `beginRefresh` from `layoutSubviews`. Closes https://github.com/facebook/react-native/pull/7556 Differential Revision: D3300124 fbshipit-source-id: d1dce8612e2c03b1f14284d513803d00af4b5c8a
This commit is contained in:
parent
8975bb8e70
commit
cac5ce3b93
|
@ -35,7 +35,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
|
|||
|
||||
// If the control is refreshing when mounted we need to call
|
||||
// beginRefreshing in layoutSubview or it doesn't work.
|
||||
if (_isInitialRender && _initialRefreshingState) {
|
||||
if (_currentRefreshingState && _isInitialRender && _initialRefreshingState) {
|
||||
[self beginRefreshing];
|
||||
}
|
||||
_isInitialRender = false;
|
||||
|
|
Loading…
Reference in New Issue