New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Buggy RefreshControl #7414
Comments
@facebook-github-bot stack-overlow |
I already saw this happen at some point but I couldn't reproduce it consistently. Assuming that set state will be sync is definetly a bad idea, I'll try to figure out a better way to do this. |
I think we want this code to work even if |
The goal of this code is to keep the native refresh control in sync with the JS props. If the user doesn't call Maybe a better way to do this is call |
Summary: There was an issue with the way we made `RefreshControl` a controlled component when react doesn't render synchronously. This fixes the issue by using the same technique used in the commit 0cd2904 for`PickerAndroid` **Test plan (required)** Tested normal behaviour and tested that if not setting the `refreshing` prop to `true` during the `onRefresh` callback that the `RefreshControl` stops refreshing immediately. Also made sure that `setNativeProps` is only called if needed when the native refreshing state is not in sync with JS. Fix facebook#7414 Closes facebook#7445 Differential Revision: D3274981 fb-gh-sync-id: a1b9d46329f552984e33d11fa0e29ad6da689511 fbshipit-source-id: a1b9d46329f552984e33d11fa0e29ad6da689511
Summary: There was an issue with the way we made `RefreshControl` a controlled component when react doesn't render synchronously. This fixes the issue by using the same technique used in the commit 0cd2904 for`PickerAndroid` **Test plan (required)** Tested normal behaviour and tested that if not setting the `refreshing` prop to `true` during the `onRefresh` callback that the `RefreshControl` stops refreshing immediately. Also made sure that `setNativeProps` is only called if needed when the native refreshing state is not in sync with JS. Fix facebook#7414 Closes facebook#7445 Differential Revision: D3274981 fb-gh-sync-id: a1b9d46329f552984e33d11fa0e29ad6da689511 fbshipit-source-id: a1b9d46329f552984e33d11fa0e29ad6da689511
Summary: There was an issue with the way we made `RefreshControl` a controlled component when react doesn't render synchronously. This fixes the issue by using the same technique used in the commit 0cd2904 for`PickerAndroid` **Test plan (required)** Tested normal behaviour and tested that if not setting the `refreshing` prop to `true` during the `onRefresh` callback that the `RefreshControl` stops refreshing immediately. Also made sure that `setNativeProps` is only called if needed when the native refreshing state is not in sync with JS. Fix facebook#7414 Closes facebook#7445 Differential Revision: D3274981 fb-gh-sync-id: a1b9d46329f552984e33d11fa0e29ad6da689511 fbshipit-source-id: a1b9d46329f552984e33d11fa0e29ad6da689511
Summary: There was an issue with the way we made `RefreshControl` a controlled component when react doesn't render synchronously. This fixes the issue by using the same technique used in the commit 0cd2904 for`PickerAndroid` **Test plan (required)** Tested normal behaviour and tested that if not setting the `refreshing` prop to `true` during the `onRefresh` callback that the `RefreshControl` stops refreshing immediately. Also made sure that `setNativeProps` is only called if needed when the native refreshing state is not in sync with JS. Fix facebook#7414 Closes facebook#7445 Differential Revision: D3274981 fb-gh-sync-id: a1b9d46329f552984e33d11fa0e29ad6da689511 fbshipit-source-id: a1b9d46329f552984e33d11fa0e29ad6da689511
According to the docs for RefreshControl:
Within my onRefresh function, I'm using setState to set an
isRefreshing
flag totrue
. However, according to the React docs:As a result, when the following code is run in
RefreshControl.js
,this.props.refreshing
is still false (since the state hasn't been updated and thus RefreshControl hasn't been re-rendered), causing the refresh indicator to stop immediately.When I comment out the
setNativeProps
function call, my refresh indicator works as expected.Am I missing something/doing something incorrectly here?
The text was updated successfully, but these errors were encountered: