React-native-screens: RefreshControl does not work properly with NativeStackNavigator and headerLargeTitle=true

Created on 27 Feb 2020  ·  24Comments  ·  Source: software-mansion/react-native-screens

"@react-navigation/native": "5.0.8"
"react-native-screens": "2.1.0"

screenOptions={{
  headerLargeTitle: true,
}}

Current behavior: RefreshControl partially hidden under header
ijoa4BqQHS

Expected behavior (screenshot from iOS Mail app): RefreshControl is displayed on top of the header
IMG_40F0EC6E32A2-1

bug native-stack scrollView

Most helpful comment

@WoLewicki ah, you’re absolutely right, was checking in master. Should be in the next release then. Thx for the hint.

All 24 comments

I can confirm this too. I played around with it a bit today and it’s not useable on large header

Can you provide a repo with minimal configuration needed to reproduce the issue?

I have the same issue. I've created a Snack where you can see the bug in action. It isn't pretty, but it does the job. 😄 Just try and pull-to-refresh on the Overview screen.

https://snack.expo.io/@dami-mollie/4cc07f

I think it is an issue with how RCTScrollView and RCTRefreshControl works. Can you try and apply this: https://github.com/facebook/react-native/pull/28236 and check if it fixes the issue?

I tested it and it looks like applying this commit: https://github.com/facebook/react-native/commit/1b0fb9bead4d158d14df5a994423d06716b5e377 and setting the translucent header and contentInsetAdjustmentBehavior=“automatic” on your ScrollView (which are recommended options) makes the RefreshControl work correctly. Can someone check it too?

I am closing this issue since there is nothing more to do from the side of react-native-screens. Feel free to comment if something is wrong to reopen it.

@WoLewicki looks like https://github.com/facebook/react-native/commit/1b0fb9bead4d158d14df5a994423d06716b5e377 has been merged, but I’m still seeing the same behaviour with the latest Expo SDK 39 (uses React Native 0.63 under the hood). Example here: https://snack.expo.io/CRaFk41At

refresh-control

But is it available in the 0.63? I think the 0.63 branch was cut earlier and this commit is not included in there. You can check in the bare react-native project if this commit is available there, but IIRC it is not, unfortunately.

@WoLewicki ah, you’re absolutely right, was checking in master. Should be in the next release then. Thx for the hint.

Hello, I downloaded *.zip file v0.64.0-rc.1.zip from here https://github.com/facebook/react-native/releases, unzip to folder, then copy all files from React\Views\ScrollView and React\ViewsRefreshControl to same folders of my App myProjectnode_modulesreact-native\React\ViewsRefreshControl and myProjectnode_modulesreact-native\React\ViewsRefreshControl, but I'm still see the same behaviour. What else I should do to make changes affect?

I think it would be better to use patch-package for this than manually coping files, since after e.g. using yarn command, the node_modules can be changed and patch-package ensures that the changes are applied. Also, did you check if these changes are available in rc.1? They should be, but it is always better to check.

@WoLewicki
I am currently using a refreshControl on my FlatList, and I do have a Large Title, but I still experience the pull to refresh bug mentioned above.

It has been about 5 months since the last comment on this issue, would you know if this bug is fixed in the release? Any suggestions/Help on this would be appreciated!

@pouyarezvani it is available in RN 0.64 since the fix was made RCTScrollView, not in our repo.

@WoLewicki I'm a bit confused. I am using 0.64. If there was a fix made, why does the refreshControl still trigger below the LargeHeader? Do you experience this same issue?
Do you have an example snack that has a large header and a refreshControl that doesn't have this issue, that I can try out, please?
Any help would be appreciated!

Did you apply translucency to the header and automatic behavior on the ScrollView like I mentioned here: https://github.com/software-mansion/react-native-screens/issues/395#issuecomment-674043236 ?

@WoLewicki Yes sir.
I've put together this snack. Could you check it out, please?

When you pull down to Refresh, the Header Jumps and the refresh happens below the large header.

Oh so you are testing it in Expo managed workflow? Unfortunately, SDK 41 is using RN 0.63, so the change is not available there. After running it in bare RN project, it works just fine:

https://user-images.githubusercontent.com/32481228/117183001-5294f600-add7-11eb-8eda-20115d254dce.mp4

Got it. That clears up a lot of things!
Looks like I just need to wait until SDK 42 (End of June), for refresh Control AND the iOS search Bar to be resolved/usable.
I assume that the searchBar will be part of react-native-screens guides/Documentation till then?

Again, thank you for your quick response and guidance!

It should!

@pouyarezvani using EAS could be helpful for you. Managed projects are supported by EAS now, even though I did not try to change the internal RN version with EAS (but in theory it should just work fine)

@Hirbod Thanks for the suggestions. Any sources/links to this?
Will EAS fix those mentioned issues above?

@pouyarezvani EAS can build any React Project.
https://blog.expo.io/

Read the last 3 blog posts. Using any native package is very easy and straight forward with EAS and 10x smaller binaries, but I am not 100% sure how much effort it will take to change the underlaying RN Version.

@Hirbod I tried to build it with EAS, however, I got this :
Your account doesn't have access to Expo Application Services (EAS) features. Enroll in EAS to give it a try: https://expo.io/eas

Do I need to have EAS Priority to build?
I am logged into EAS & Expo btw.

Yes, you need the EAS Priority Build. You can activate a 30 days trial

Was this page helpful?
0 / 5 - 0 ratings