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
Can't wrap RefreshControl in a custom component on Android? #11784
Comments
Never mind - turns out the issue was that I wasn't passing From the way it's called, it's not really clear that there are other props being implicitly passed on to the RefreshControl. Might be useful if that was mentioned in the docs, or there was an error if those props aren't being provided. |
This caught me too. Thanks for following up with a resolution, @jamesisaac. |
YES! Thank you @jamesisaac. Just saved me a ton of time. |
Hi @jamesisaac, is your example still available somewhere? I am trying to wrap the native refresh control within a custom component without success. When I put a container view around it, I get the following error:
I basically want to add something similar as |
Hi @toytonic . I wasn't putting a view around it, just wrapping it in another React component so that I could pass in some props by default. By wrapping it in a view you're affecting the view hierarchy, which would have unknown consequences... not really related to this issue. |
Description
If I want common swipe-to-refresh functionality to be re-used across several screens in my app (across both ListViews and ScrollViews), surely the cleanest solution to this would be to have a custom
MyRefreshControl
, which encapsulates its own state / syncing logic / styling, that can be composed in with a single line -refreshControl={<MyRefreshControl />}
. But from what I can tell this doesn't seem to work.Reproduction
https://rnplay.org/apps/41CAVQ
Example above works on iOS, but not Android. Uncommenting line 27 and commenting 28 (i.e. removing the custom component wrapper) fixes it for Android.
Additional Information
The text was updated successfully, but these errors were encountered: