On Android,
navigationKey
The behaviour on iOS is expected,
Same as the steps in Current behavior
https://github.com/CKS1998/NativeKeyProblemDemo
| package | version | | -------------------------------------- | ------- | | @react-navigation/native |6.1.2 | @react-navigation/material-top-tabs |6.5.2 | react-native-tab-view |3.3.4 | react-native-pager-view |6.1.2 | react-native |0.68.2 | npm |8.19.2
The versions mentioned in the issue for the following packages differ from the latest versions on npm:
@react-navigation/native
(found: 6.1.1
, latest: 6.1.2
)@react-navigation/material-top-tabs
(found: 6.5.1
, latest: 6.5.2
)Can you verify that the issue still exists after upgrading to the latest versions of these packages?
Yes, the problem still exists for
| package | version | | -------------------------------------- | ------- | | @react-navigation/native |6.1.2 | @react-navigation/material-top-tabs |6.5.2
Hey @CKS1998,
Just checked your reproduction code, please avoid creating components inside another components. This is what causes bug in this situation.
So please move the Tab1Content
and Tab2Content
outside of App
function scope and let me know if that fixes the issue.
Hi @okwasniewski ,
Thanks for your reply,
I moved the Tab1Content
and Tab2Content
to another file and pass the button press count via initialParams
.
However, the problem still exists.
The reproduction code is updated. Thanks for your help.
Hey, @CKS1998
It seems like the issue is on the underlying native component on android (coming from react-native-pager-view). So could you please create an issue in pager-view repository so the team can take a look at it?
Also if you want to solve the issue, you can create a context which would pass the state down the component tree. Or you could try this: https://reactnavigation.org/docs/hello-react-navigation/#passing-additional-props
Let me know if this fixes your issue 😄