NavigationContainer onStateChange not called
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 |
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.
NavigationContainer's onStateChange() is never called for web, also.
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
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.