PedroBern / react-native-collapsible-tab-view

A cross-platform Collapsible Tab View component for React Native
MIT License
875 stars 172 forks source link

Scroll on Header not scrolling other tabs (iOS) #66

Closed andreialecu closed 3 years ago

andreialecu commented 3 years ago

Current behavior

In the scroll on header example, if I go to contacts and scroll to the end, then tap the status bar, it correctly scrolls the current tab to the top.

However, all the other tabs are not synced.

Expected behaviour

All tabs should be scrolled to the top.

Screenshots (if applicable)

IMG_E4F8296E5D88-1

PedroBern commented 3 years ago

... then tap the status bar ...

Do you mean the status bar or the tab bar? Maybe it's not syncing when tapping on the status bar, not sure how can I solve this...

Is it only in this example?

andreialecu commented 3 years ago

Oh, interesting. I didn't know it meant tapping the tab bar.

On iOS the native way to scroll to the top is by tapping the top status bar of the phone (where the time and battery are displayed)

Is likely easy to hook into and detect. I'll look into it tomorrow.

andreialecu commented 3 years ago

Actually: https://reactnative.dev/docs/scrollview#onscrolltotop

PedroBern commented 3 years ago

ok, perfect, should be easy to fix then 👍

andreialecu commented 3 years ago

So actually I don't think the right fix is to handle that event.

The normal onScroll event is fired when scrolling to the top, but because the gesture is not started by onBeginDrag, sync ends up being false:

https://github.com/PedroBern/react-native-collapsible-tab-view/blob/49ef109ef547360368a8033b5e91be6205e2b55a/src/createCollapsibleTabs.tsx#L664-L667