PedroBern / react-native-collapsible-tab-view

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

Container Lazy and Tabs.Lazy bug #275

Closed burgetrostislav closed 2 months ago

burgetrostislav commented 1 year ago

Hi, I have found bug with repositioning of Tabs with lazy loading. Loading is using index of lazy component which doesn't change position. So It loads Tabs based on their original position.

E.g. original Tabs: Tab0, Tab1, Tab2 If you change position of tabs to: Tab0, Tab2, Tab1 Then on click Tab2 you will load Tab1, but Tab2 will stay unloaded. It will be loaded only if 1) it was loaded before changing tab position or 2) if you click on Tab1 as it has index of Tab2 original position.

In Expo examples this should be in example: 15. Adding and removing tabs dynamically Where you can add Tabs and shuffle them, but right now example is not working (you cannot Add new tab). Here is example build locally without images: LazyOrderingBug

I haven't found a way how to get around this. Please consider fixing this issue as it disable the option of lazy loading if you have sorting or ordering of tabs.

andreialecu commented 1 year ago

PRs are more than welcome!

Shouldn't be hard to fix.

burgetrostislav commented 1 year ago

I have looked at it, but I have not found any simple changes that would effectively fix this bug. Could you please take a look at it?

nica0012 commented 10 months ago

I too am having this issue. when changing between user profiles that have different tabs, it does not know which one to use behind the scenes

FabianDean commented 2 months ago

Running into a similar issue -- haven't found a solution yet but will keep looking

andreialecu commented 2 months ago

394 should fix this, I released it as 7.0.1-beta.0 on npm. Please help test it for unwanted side effects and report back. Thanks!

FabianDean commented 2 months ago

@andreialecu Will give this a try! Cheers 👍

FabianDean commented 2 months ago

@andreialecu From what I've tested so far, the issue seems to have been fixed 🤞

I had a workaround where I was using tab names as a key for Tabs.Container, but that isn't the most practical solution