react-navigation icon indicating copy to clipboard operation
react-navigation copied to clipboard

NavigationContainer onStateChange not called

Open Willham12 opened this issue 3 years ago • 1 comments

Current behavior

<NavigationContainer					
linking={linking}					
onStateChange={async () => {
/// not called with deeplink
}}>
...
</NavigationContainer>

Expected behavior

onStateChange called if deep link provided

Reproduction

https://snack.expo.dev/BKpQjP9u8

Platform

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

Packages

  • [ ] @react-navigation/​bottom-tabs
  • [ ] @react-navigation/​drawer
  • [ ] @react-navigation/​material-bottom-tabs
  • [ ] @react-navigation/​material-top-tabs
  • [ ] @react-navigation/​stack
  • [ ] @react-navigation/​native-stack

Environment

  • [x] I've removed the packages that I don't use
package version
@react-navigation/native 6.0.11
@react-navigation/native-stack 6.7.0
react-native-safe-area-context 4.3.1
react-native-reanimated 2.9.1
react-native 0.67.3
node 16
npm or yarn yarn

Willham12 avatar Jul 21 '22 16:07 Willham12

Hey! Thanks for opening the issue. The issue doesn't seem to contain a link to a repro (a snack.expo.dev link, a www.typescriptlang.org/play link or link to a GitHub repo under your username).

Can you provide a minimal repro which demonstrates the issue? Please try to keep the repro as small as possible and make sure that we can run it without additional setup.

A repro will help us debug the issue. The issue will be closed automatically after a while if you don't provide a repro.

github-actions[bot] avatar Jul 21 '22 16:07 github-actions[bot]

NavigationContainer's onStateChange() is never called for web, also.

uztbt avatar Jun 01 '23 09:06 uztbt

There's no state change when app opens with a deep link. The state is used as initial state. If you need to get the state on initial launch then call navigation.getRootState() in onReady

satya164 avatar Jun 01 '23 10:06 satya164

Hey! This issue is closed and isn't watched by the core team. You are welcome to discuss the issue with others in this thread, but if you think this issue is still valid and needs to be tracked, please open a new issue with a repro.

github-actions[bot] avatar Jun 01 '23 10:06 github-actions[bot]