-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Closed
Labels
Description
Current behavior
An example here shows an async function being passed to onStateChange.
However, when using TypeScript in a component that wraps NavigationContainer and doing the same thing, I get the following lint error:
95:21 error Promise-returning function provided to attribute where a void return was expected @typescript-eslint/no-misused-promises
Expected behavior
When using TypeScript in a component that wraps NavigationContainer and giving onStateChange an async function, the type for onStateChange allows for a Promise being returned.
Reproduction
https://github.com/eliw00d/react-navigation-issues-repro
Platform
- Android
- 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
- I've removed the packages that I don't use
package | version |
---|---|
@react-navigation/native | 6.0.8 |
node | 16.13.0 |
yarn | 3.0.2 |