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

[iOS] TabView does not switch tabs / snaps back even though index updates

Open hcrnln opened this issue 7 months ago • 6 comments

Environment

  • react-native: 0.77
  • react-native-tab-view: 4.0.5
  • react-native-pager-view: 7.0.2 (also tried 6.9.1)
  • Platform: iOS
  • New Architecture: Enabled

Description

On iOS, tabs do not switch correctly when using react-native-tab-view with react-native-pager-view.

onIndexChange is triggered and the state index updates correctly, but the UI does not stay on the selected tab.

Observed behavior:

  • pressing a tab does not visibly switch to that tab
  • swiping sometimes looks like it changes page briefly, then snaps back to the first tab
  • Android works as expected with the same code

Expected behavior

When a tab is pressed or swiped to, the selected tab should stay active and the scene should update correctly.

Actual behavior

On iOS:

  • tab press triggers onIndexChange
  • state updates
  • but the visible page does not remain on the selected tab
  • sometimes it briefly changes and returns back to the first tab

Notes

  • Android works correctly
  • issue reproduced on iOS
  • New Architecture is enabled
  • upgrading/downgrading app-side code paths did not resolve it
  • side effects inside onIndexChange were removed for testing, but the issue still persisted

Additional notes

  • I also tested the latest react-native-pager-view version.
  • On iOS, that version threw: Unimplemented component <RNCViewPager>.
  • Because of that, I downgraded back to 7.0.2 for testing.
  • The tab switching issue still persists on 7.0.2.

Question

Is this a known iOS/New Architecture regression with react-native-pager-view 7.0.2?

hcrnln avatar Apr 05 '26 15:04 hcrnln

please try with 8.0.0

MrRefactor avatar Apr 06 '26 19:04 MrRefactor

@MrRefactor Thank you for your feedback. I had previously tried version 8.0.0, but I'm getting the following error for iOS:

I also tried it with version 7.x here: https://github.com/callstack/react-native-pager-view/issues/1065 and got the same error. I didn't get the "Unimplemented component: " error in version 6.9.1, but tab transitions don't work in that version either.

Image

hcrnln avatar Apr 07 '26 07:04 hcrnln

Same issue, any solution ?

RN-Nitin avatar Apr 15 '26 08:04 RN-Nitin

@RN-Nitin I couldn't fix this error, so I wrote a custom iOS tabview component.

hcrnln avatar Apr 15 '26 11:04 hcrnln

@RN-Nitin @hcrnln could you verify it with changes from #1077 ? Please make sure you have latest rn-tab-view version as well.

MrRefactor avatar Apr 15 '26 16:04 MrRefactor

Hi @MrRefactor I tested the fix from #1077 by installing the commit b53ce4a, but it didn’t resolve the issue on my side.

I’m using the latest versions of the related packages:

  • react: 18.3.1
  • react-native: 0.77.0
  • react-native-navigation: 8.8.1
  • react-native-tab-view: 4.3.0

Also, I’m running with the New Architecture enabled and Hermes.

This seems related to: https://github.com/wix/react-native-navigation/issues/8271

Let me know if you’d like logs or a minimal reproduction.

hcrnln avatar Apr 16 '26 11:04 hcrnln