React-native-tab-view: RTL is not supported!

Created on 27 Mar 2017  路  30Comments  路  Source: satya164/react-native-tab-view

What i'm suffering from is that the tabs still functioning the same as the LTR after switching to RTL, I know what seems to be the issue because I have a custom indicator, but i'm not able to use negative values to translate them to the opposite.

Thank you so much.

untitled

help wanted

Most helpful comment

@satya164 - I created a pull request to add support for RTL. I hope it can be accepted and merged.

Thank you.

All 30 comments

Can you send a PR to fix this?

This bug also affects react-navigation. The TabNavigator is not working:

https://github.com/react-community/react-navigation/issues/860

Inside TabViewPagerScroll.js putting flexDirection: 'row-reverse' on the <ScrollView /> fixes the problem partially. The tab's contents is shown but the order is reverse.

@yaronlevi, look at my last comment here: https://github.com/facebook/react-native/issues/11960#issuecomment-292732636

@moerabaya, I sent a PR #194, until it merged, you can use one of these:

  • npm i -S https://github.com/dastoori/react-native-tab-view.git#rtl-support
  • npm i -S https://github.com/dastoori/react-navigation.git#rtl-support

Re-opening this since RTL is not yet supported in TabViewPagerScroll, hence unsupported on iOS.

@satya164, iOS ScrollView has been fixed in ReactNative v0.43.2 (https://github.com/facebook/react-native/issues/11960#issuecomment-292732636)

Nice. I think we may still need to handle the scroll position etc.

I tested this in v0.0.59, I used the examples from examples folder. These examples doesn't work properly:

  • "1. Scrollbar top bar"

scrollabletopbar

  • "3. Bottom bar with indicator"

bottombarwithindicator

Other examples are works fine:

scrollviews

  1. Bottom bar with indicator

This one uses a custom indicator, that's why. Should be easy to fix.

"1. Scrollbar top bar"

Yeah, this one will be more involved

Any updates on this one?

If you need this, pull requests are welcome.

@satya164 - I created a pull request to add support for RTL. I hope it can be accepted and merged.

Thank you.

Adding a link to the PR - not sure if 2 months is a reasonable time or not. I'm sure the team is busy...

https://github.com/react-native-community/react-native-tab-view/pull/556

Hey there @noambonnie. I've taken a look at your fix and I've tested it on both iOS and android. While this fixes the issue on android, it breaks iOS so I've just added a platform specific condition. Take a look at my fork:

https://github.com/horodnicdragos/react-native-tab-view

Not sure if this is the best approach on the long term but having this merged would be amazing. Do you want to update your PR or should I do one?

@horodnicdragos what's broken on iOS? Does your code (ignoring iOS for those calculation) work fine on iOS RTL?

If broken on iOS we'll need to fix it there too. If your fix works on both platforms in RTL (and LTR...) then fine

Yes, for some reason the calculations are not required on iOS. I'll make the PR and hope for the best.

602

@horodnicdragos please note that your PR failed the linter requirements. Follow the test procedures at the bottom of the project page (under "Contributing"). Otherwise it won't even be considered.

@noambonnie Done!

@satya164 can you check #602 and merge it?

I hope it gets merged soon...

is it going to be merged soon?

it is already merged and released. but the PR is Android only.

@0xori It is working just fine on iOS for me. Did you encounter any RTL issues? By the way, I've only fixed the issue on the scrollbar top bar which I was using. Didn't get the change to look at the bottom one.

still having the same issue on android , for ios it is fixed using this #675

any updates on this ?

@FadiAboMsalam It's marked as "help wanted". PR welcome.

in TabBar.js
modify this function
_this.resetScroll = function (value) {
const tabLength=this.props.navigationState.routes.length-1;

    const target=I18nManager.isRTL?tabLength-value:value;
    console.log(tabLength+' '+target)
    if (_this.props.scrollEnabled) {
        _this.scrollView && _this.scrollView.scrollTo({
            x: _this.getScrollAmount(_this.props, _this.state,target),
            animated: true
        });
    }
};

this issue doesn't fix, please don't close

@hosseinmd please open a new issue with a runnable repro as mentioned in the issue template.

I resolve this, that is my fault

Was this page helpful?
0 / 5 - 0 ratings

Related issues

moerabaya picture moerabaya  路  4Comments

compojoom picture compojoom  路  4Comments

hyochan35 picture hyochan35  路  3Comments

AndriiUhryn picture AndriiUhryn  路  3Comments

lubomyr picture lubomyr  路  3Comments