react-native-screens icon indicating copy to clipboard operation
react-native-screens copied to clipboard

RefreshControl does not work properly with NativeStackNavigator and headerLargeTitle=true

Open davidruisinger opened this issue 6 years ago • 29 comments

"@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

davidruisinger avatar Feb 27 '20 08:02 davidruisinger

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

hirbod avatar Apr 22 '20 22:04 hirbod

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

WoLewicki avatar Apr 28 '20 08:04 WoLewicki

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

CosmaTrix avatar Jul 02 '20 11:07 CosmaTrix

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?

WoLewicki avatar Jul 15 '20 10:07 WoLewicki

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?

WoLewicki avatar Aug 14 '20 12:08 WoLewicki

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 avatar Aug 20 '20 12:08 WoLewicki

@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

rppld avatar Nov 16 '20 15:11 rppld

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 avatar Nov 16 '20 15:11 WoLewicki

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

rppld avatar Nov 16 '20 15:11 rppld

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\Views\RefreshControl to same folders of my App myProject\node_modules\react-native\React\Views\RefreshControl and myProject\node_modules\react-native\React\Views\RefreshControl, but I'm still see the same behaviour. What else I should do to make changes affect?

mistermadness87 avatar Dec 04 '20 08:12 mistermadness87

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 avatar Dec 07 '20 10:12 WoLewicki

@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 avatar May 04 '21 22:05 pouyarezvani

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

WoLewicki avatar May 05 '21 08:05 WoLewicki

@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!

pouyarezvani avatar May 05 '21 16:05 pouyarezvani

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 avatar May 05 '21 16:05 WoLewicki

@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.

pouyarezvani avatar May 05 '21 17:05 pouyarezvani

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

WoLewicki avatar May 05 '21 17:05 WoLewicki

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!

pouyarezvani avatar May 05 '21 17:05 pouyarezvani

It should!

WoLewicki avatar May 05 '21 17:05 WoLewicki

@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 avatar May 05 '21 17:05 hirbod