[C-422] Add pull to refresh on android#1275
Conversation
dylanjeffers
left a comment
There was a problem hiding this comment.
Looks great on lists at the top of the screen! regarding your issue with the profile... is there any way to add a refreshcontrol to a normal view and trigger manually depending on scroll or something?
| <RefreshControl | ||
| progressViewOffset={scrollPropsAndRef.progressViewOffset} | ||
| refreshing={!!refreshing} | ||
| onRefresh={onRefresh ?? undefined} |
There was a problem hiding this comment.
i believe as long as onRefresh is undefined coming down don't need the ??. Is it null or something sometimes?
There was a problem hiding this comment.
Yeah it has a null in there so typescript was angry
| refreshing={!!isRefreshing} | ||
| onRefresh={onRefresh ?? undefined} | ||
| colors={[neutral]} | ||
| /> |
There was a problem hiding this comment.
kinda a nit, but maybe we make this a base component that all the lists can use? handles color, maybe also platform etc?
There was a problem hiding this comment.
That was my first approach, but for some reason having anything other than RefreshControl at the top level of this value breaks the entire flatlist. Might have to do with how it's interfacing with native components. This code is necessarily WET
There was a problem hiding this comment.
oh woww interesting! well thanks for the context
Unfortunately there is no way to add RefreshControl outside of a scroll view, we would have to roll our own which would probably require designs because currently the refresh indicators aren't displayed on top of other components (except the cover photo). I think what I have should be good for a first android release and we can maybe do another pass at it! |
Thank you for helping me realize all the limitations with this api, this looks like a great first step |
Description
Unfortunately, android does not support "overscrolling" or scrolling past the ends of a scrollview (contrary to what this prob would lead you to believe https://reactnative.dev/docs/scrollview#overscrollmode-android). So there is no way to use the same refresh indicator as we do on ios. Instead, we can use the native android one which looks a lot better than on ios
The only strange part of this is on the collapsible tabs on the profile screen. The indicator shows at the top of the list instead of at the top of the screen, which looks a little weird when scrolling down while the indicator is visible. But I think probably the best we can do for now because when shown at the top, the header covers the indicator and there seems to be no way of bringing the indicator to the front
22-05-02-15-23-32.mp4
Dragons
Possible pull to refresh bugs
How Has This Been Tested?
android and ios
How will this change be monitored?
Testflight / playstore