Skip to content

Commit

Permalink
RefreshControl on initial render will not beginRefresh when refreshin…
Browse files Browse the repository at this point in the history
…g 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 #7556

Differential Revision: D3300124

fbshipit-source-id: d1dce8612e2c03b1f14284d513803d00af4b5c8a
  • Loading branch information
aforty authored and Facebook Github Bot 3 committed May 13, 2016
1 parent 8975bb8 commit cac5ce3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion React/Views/RCTRefreshControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ - (void)layoutSubviews

// 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;
Expand Down

0 comments on commit cac5ce3

Please sign in to comment.