Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onPageSelected is triggering with e.nativeEvent.position==0 after leaving tabview #895

Open
phazei opened this issue Oct 31, 2024 · 3 comments
Assignees
Labels

Comments

@phazei
Copy link

phazei commented Oct 31, 2024

Environment

Android V15 only, iOS not affected

React Native 0.74.5
"react-native-pager-view": "~6.4.1",
"react-native-tab-view": "~3.5.2",
"@react-navigation/stack": "~6.4.1",
"@react-navigation/material-top-tabs": "~6.6.14",

Description

I'm using @react-navigation/material-top-tabs. When I navigate to a view that's not part of the tab navigator, but still in a stack, it triggers a _onPageSelected originating from react-native-pager-view that causes the navigation to navigate away from the current view and to the first tab of the pager.
Note, it might be triggering _onPageScrollStateChanged also? The RN debugger is finicky and sometimes it was one or the other.

A detailed description is provided here with some debugging.

Reproducible Demo

https://snack.expo.dev/@phazei/react-native-material-tab-bug?platform=android

On android, click the second tab, then click the link on the second tab and you can see it blink to the hello screen, and then be forced back to tab 1.

This was the minimal example, but in production, it actually lets it get to the hello screen, but then clicking another navigation link that's a sibling to hello, forces it back to tab 1. It's caused by the same _onPageSelected or _onPageScrollStateChanged.

@Denys-Kozak-Paidy
Copy link

Hi! I am also looking for a fix or a workaround to this problem, but for the react-native-pager-view v7.0.0-rc.0.

@MrRefactor
Copy link
Collaborator

Hey, looking into that.

Hi! I am also looking for a fix or a workaround to this problem, but for the react-native-pager-view v7.0.0-rc.0.

We wont support version 7 anymore.

@toutiii
Copy link

toutiii commented Dec 24, 2024

Hi, any news on this issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants