PedroBern / react-native-collapsible-tab-view

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

fix: tab indicator did not work correctly in RTL mode #193

Closed mustafaskyer closed 2 years ago

mustafaskyer commented 3 years ago

what => fix invisible indicator in RTL mode why => Tab bar indicator not works as expected in RTL mode how => just added v.x * -1 in RTL mode, otherwise will be v.x

andreialecu commented 2 years ago

Released in 4.3.0 🚀

Audeos commented 2 weeks ago

@andreialecu thank you for your work. But there's a problem. With this, the tab orders on the header are reversed. Also the indicator is moving with respect to rtl. However actual rendered tab orders did not change. Ex:

initial page is page 1

normal LTR: Header: page1 | page2 | page3 Render: page1 | page2 | page3

RTL: Header: page3 | page2 | page1 (<-- indicator moves this way) Render: page1 | page2 | page3 (but this stays the same)

Rendered page orders should be reversed too. In order to fix it, I have to give my tabs in reversed order,

if (!isRTL) return tabRoutes; else return tabRoutes.reverse();

and then use it.

image

As well as giving MaterialTabBar a conditional style, which gives flexDirection row or row-reverse accordingly. For my app to align rendered pages as in order of 3 | 2 | 1 too.

image

So please, include this behavior in RTL too. More important, when I do these changes, the indicator gets reversed once more because of my additions above yours outside the package, and gets outside of screen with it's intended animation leftwards.

andreialecu commented 2 weeks ago

Would you like to open a PR with the fix?