PedroBern / react-native-collapsible-tab-view

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

v3 - rework #41

Closed PedroBern closed 3 years ago

PedroBern commented 3 years ago

@andreialecu @alexpchin

rework with reanimated v2

github-actions[bot] commented 3 years ago

The Expo app for the example from this branch is ready!

expo.io/@pedrobern/react-native-collapsible-tab-view-demos?release-channel=pr-41

alexpchin commented 3 years ago

Hi @PedroBern Before integrating thisreact-native-collapsible-tab-view, I started doing something similar to this. Initial thoughts (not problems, just thoughts).

I will look in more detail later, I'm trying to implement the current version into an app (without any bugs) so that it can be pushed live. Once that is done, I can come back to this!

PedroBern commented 3 years ago

Scrolling on the header will only work when you touch the Header, if the header included Touchables, it might cause a problem?

The recent push can scroll anywhere. Don't know about touchables yet.

I thought there was a warning about VirtualizedLists should never be nested inside plain ScrollViews but as the components are Animated, this might not apply

It does not apply here because we have the following structure:

_ Vertical Scrollview Horizontal Flatlist <- would have the warning if we don't have this intermediate component ____ Vertical Flatlist

Check out the new expo preview, now there are 2 examples, in the second one we can see all tabs at once, which makes it easy to develop.

alexpchin commented 3 years ago

_ Vertical Scrollview Horizontal Flatlist <- would have the warning if we don't have this intermediate component ____ Vertical Flatlist

Isso é muito sorrateiro.

PedroBern commented 3 years ago

@alexpchin removed the top level scrollview. Now it is very performant, (not reusable yet, just a demo).

I removed the sync scroll offsets. It's translating just the header now. Not sure if it's good or bad for the user experience, what you think?

PedroBern commented 3 years ago

I'm canceling this PR.

PedroBern commented 3 years ago

sorry for taking your time

alexpchin commented 3 years ago

@PedroBern No problem!

PedroBern commented 3 years ago

@alexpchin @andreialecu v3 is ready, just need to update the README, now all animations/scrolls are done in the UI thread with reanimated.

Can someone please run the preview on iOS and give me feedback? I tested only on android.

New features:

Removed

andreialecu commented 3 years ago

I can take a look in a couple of days. Would probably stay on v2 for the current project though as that has been working well so far.

Lacking react navigation support would be a blocker anyway.

Do you plan on adding it back later?

PedroBern commented 3 years ago

That would be nice, thanks.

We definitely can add it back later.

Right now the v3 does not even come with a tab bar, the user must provide a custom one, but there is a nice example in the examples folder, a simplified version of the material one.

But the performance gains were fantastic, all computations are done in the UI thread now. Including the scroll sync and snapping. In v2 all these computations are done in the JS thread and that was causing a bug where the tabs do not sync. It was reported for at least 4 people and me, one has even sent a reproducible snack.

alexpchin commented 3 years ago

Going to review this tomorrow, time permitting. Nice work @PedroBern

PedroBern commented 3 years ago

Now we have real lazy support in v3.2

With react-native-tab-view it was an issue.