react-native-tab-view icon indicating copy to clipboard operation
react-native-tab-view copied to clipboard

Tab not pressed in RTL

Open anastely opened this issue 4 years ago • 21 comments

Current behavior

I can't navigate to any tab when pressing on them in RTL

Expected behavior

I can navigate to any tab when pressing on them in RTL

Reproduction

https://github.com/anastely/TabViewTest

Platform

  • [X] Android
  • [X] iOS
  • [ ] Web
  • [ ] Windows
  • [ ] MacOS

Environment

package version
react-native-tab-view 3.1.1
react-native-pager-view 5.4.4
react-native 0.65.1
node v16.9.1
npm or yarn yarn

anastely avatar Sep 19 '21 13:09 anastely

I'm Facing this issue on IOS, works fine on android

Hady207 avatar Oct 07 '21 15:10 Hady207

I am also facing this issue on iOS @Hady207. Did you. manage to find a work around at all?

thompson-ad avatar Oct 22 '21 09:10 thompson-ad

any updates ??

ghoudi01 avatar Nov 04 '21 09:11 ghoudi01

I checked the onTabPress function, the button is actually pressed but it's not changing the screen.

i ended up using this package https://github.com/kirankalyan5/react-native-segmented-control-tab instead until this get fixed, note it doesn't provide swiping functionality.

Hady207 avatar Nov 04 '21 12:11 Hady207

for time being I have down graded the version to 2.15.2 and it worked for me. "react-native-tab-view": "2.15.2", and make sure to remove the "^".

rahmath30 avatar Nov 09 '21 19:11 rahmath30

Did anyone manage to solve this issue? I tried downgrading to @2.15.2 but didn’t work for me.

matifriaz avatar Nov 24 '21 06:11 matifriaz

i check the code and i found that the error not in react-native-tab-view but in react-native-pager-view in ios you can try to edit ReactNativePageView.m

if (isForward && diff > 0) { for (NSInteger i=_currentIndex; i<=index; i++) { if (i == _currentIndex) { continue; } [self goToViewController:i direction:direction animated:animated shouldCallOnPageSelected: i == index]; } } if (!isForward && diff > 0) { for (NSInteger i=_currentIndex; i>=index; i--) { // Prevent removal of one or many pages at a time if (index == _currentIndex || i >= numberOfPages) { continue; } [self goToViewController:i direction:direction animated:animated shouldCallOnPageSelected: i == index]; } }

to

if (index > _currentIndex) { for (NSInteger i=_currentIndex; i<=index; i++) { if (i == _currentIndex) { continue; } [self goToViewController:i direction:direction animated:animated shouldCallOnPageSelected: i == index]; } } if (index < _currentIndex) { for (NSInteger i=_currentIndex; i>=index; i--) { // Prevent removal of one or many pages at a time if (index == _currentIndex || i >= numberOfPages) { continue; } [self goToViewController:i direction:direction animated:animated shouldCallOnPageSelected: i == index]; } }

ghoudi01 avatar Nov 24 '21 08:11 ghoudi01

i check the code and i found that the error not in react-native-tab-view but in react-native-pager-view in ios you can try to edit ReactNativePageView.m

if (isForward && diff > 0) { for (NSInteger i=_currentIndex; i<=index; i++) { if (i == _currentIndex) { continue; } [self goToViewController:i direction:direction animated:animated shouldCallOnPageSelected: i == index]; } } if (!isForward && diff > 0) { for (NSInteger i=_currentIndex; i>=index; i--) { // Prevent removal of one or many pages at a time if (index == _currentIndex || i >= numberOfPages) { continue; } [self goToViewController:i direction:direction animated:animated shouldCallOnPageSelected: i == index]; } }

to

if (index > _currentIndex) { for (NSInteger i=_currentIndex; i<=index; i++) { if (i == _currentIndex) { continue; } [self goToViewController:i direction:direction animated:animated shouldCallOnPageSelected: i == index]; } } if (index < _currentIndex) { for (NSInteger i=_currentIndex; i>=index; i--) { // Prevent removal of one or many pages at a time if (index == _currentIndex || i >= numberOfPages) { continue; } [self goToViewController:i direction:direction animated:animated shouldCallOnPageSelected: i == index]; } }

It worked for me.

matifriaz avatar Nov 25 '21 09:11 matifriaz

i check the code and i found that the error not in react-native-tab-view but in react-native-pager-view in ios you can try to edit ReactNativePageView.m

if (isForward && diff > 0) { for (NSInteger i=_currentIndex; i<=index; i++) { if (i == _currentIndex) { continue; } [self goToViewController:i direction:direction animated:animated shouldCallOnPageSelected: i == index]; } } if (!isForward && diff > 0) { for (NSInteger i=_currentIndex; i>=index; i--) { // Prevent removal of one or many pages at a time if (index == _currentIndex || i >= numberOfPages) { continue; } [self goToViewController:i direction:direction animated:animated shouldCallOnPageSelected: i == index]; } }

to

if (index > _currentIndex) { for (NSInteger i=_currentIndex; i<=index; i++) { if (i == _currentIndex) { continue; } [self goToViewController:i direction:direction animated:animated shouldCallOnPageSelected: i == index]; } } if (index < _currentIndex) { for (NSInteger i=_currentIndex; i>=index; i--) { // Prevent removal of one or many pages at a time if (index == _currentIndex || i >= numberOfPages) { continue; } [self goToViewController:i direction:direction animated:animated shouldCallOnPageSelected: i == index]; } }

No effect.

imdkbj avatar Nov 28 '21 08:11 imdkbj

i check the code and i found that the error not in react-native-tab-view but in react-native-pager-view in ios you can try to edit ReactNativePageView.m

if (isForward && diff > 0) { for (NSInteger i=_currentIndex; i<=index; i++) { if (i == _currentIndex) { continue; } [self goToViewController:i direction:direction animated:animated shouldCallOnPageSelected: i == index]; } } if (!isForward && diff > 0) { for (NSInteger i=_currentIndex; i>=index; i--) { // Prevent removal of one or many pages at a time if (index == _currentIndex || i >= numberOfPages) { continue; } [self goToViewController:i direction:direction animated:animated shouldCallOnPageSelected: i == index]; } }

to

if (index > _currentIndex) { for (NSInteger i=_currentIndex; i<=index; i++) { if (i == _currentIndex) { continue; } [self goToViewController:i direction:direction animated:animated shouldCallOnPageSelected: i == index]; } } if (index < _currentIndex) { for (NSInteger i=_currentIndex; i>=index; i--) { // Prevent removal of one or many pages at a time if (index == _currentIndex || i >= numberOfPages) { continue; } [self goToViewController:i direction:direction animated:animated shouldCallOnPageSelected: i == index]; } }

Worked with me tested on ios simulator

Hady207 avatar Nov 28 '21 09:11 Hady207

thanks @ghoudi01 :)

indeed change isForward && diff > 0 to index > _currentIndex and !isForward && diff > 0 to index < _currentIndex fixed it for me (using react navigation tabs)

YogiHa avatar Jan 01 '22 12:01 YogiHa

any idea for Android @ghoudi01 @YogiHa

prayaslashkari avatar Feb 07 '22 12:02 prayaslashkari

tab press event not firing on ios in RTL layout

creativitycomkw avatar Feb 21 '22 12:02 creativitycomkw

@creativitycomkw can you give more info

ghoudi01 avatar Feb 21 '22 12:02 ghoudi01

@callmemonky

For fixing android I had to add android:supportsRtl="true" at AndroidManifest at the application tag as well as adjust mainActivity to had import com.facebook.react.modules.i18nmanager.I18nUtil; at the top of the file and I18nUtil sharedI18nUtilInstance = I18nUtil.getInstance(); sharedI18nUtilInstance.allowRTL(getApplicationContext(), true); at onCreate method

YogiHa avatar Feb 21 '22 13:02 YogiHa

Still tab press event not firing on iOS in RTL layout!

PeterWadie avatar May 01 '22 20:05 PeterWadie

Any update on this? It's a critical feature for us for the tabs to work in RTL mode. @satya164

m-deacon avatar May 05 '22 12:05 m-deacon

@satya164 It's a critical issue, can anyone give a temporary fix?

knightmate avatar May 10 '22 10:05 knightmate

up

DimitriSoucanye avatar May 11 '22 20:05 DimitriSoucanye

@satya164, any update on this please? I fail to understand how the widely supported / main recommended tab component for RN doesn't work in RTL and support is just getting ignored on this?

I know it's related to this issue https://github.com/callstack/react-native-pager-view/pull/485 and you responded to me there, but ignore us here.

Does anyone have any other recommended tab libraries that work in RTL that I could try? None of the other components I've found seem to be complete either.

m-deacon avatar Jun 08 '22 16:06 m-deacon

did you find anything @m-deacon ?

syedamirali14 avatar Aug 30 '22 10:08 syedamirali14

Hey @syedamirali14 @m-deacon , issue is coming from rn pager view and fixed it raising this pr https://github.com/callstack/react-native-pager-view/pull/613

sebasg0 avatar Oct 03 '22 22:10 sebasg0

@sebasg0 Thanks for your PR! It has been merged and will be released in the next version of [email protected] 🚀

okwasniewski avatar Oct 04 '22 08:10 okwasniewski