-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Unable to explicitly type Native Stack Screen options #28975
Comments
You should import it from import { NativeStackNavigationOptions } from '@react-navigation/native-stack';
const screenOptions: NativeStackNavigationOptions = {
headerShown: false,
}; |
As you can see from the repo's package.json there is no Either make |
This comment was marked as duplicate.
This comment was marked as duplicate.
Ye but you can install the same package with the same version, actually you're already installing it inside your deps so it isn't an extra dependency (it'll be included anyway in your final bundle) |
You and I know that cause we've been working with rn for a while to know the history, but that's not clear to a new dev coming directly to expo router. If that's the solution and no improvements is wanted to be taken by expo, then they can close the issue |
This is related to #28251 since the screen options exposed internally by ExpoRouter for screens are wrong as well. |
Minimal reproducible example
https://github.com/itsramiel/expo-router-repro/tree/untyped-options
Which package manager are you using? (Yarn is recommended)
yarn
If the issue is web-related, please select the bundler (
web.bundler
in theapp.json
)metro
Summary
I would like to be able to define a variable and type it with the type of the
options
of theScreen.Stack
to do something like this:The type of
options
isNativeStackNavigationOptions | undefined
. I tried to importNativeStackNavigationOptions
and the only auto import I got was fromreact-native-screens/lib/typescript/native-stack/types
but using that shows an error.A workaround is to use:
I would like to know where can I import the types for options.
Environment
The text was updated successfully, but these errors were encountered: