这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@supriyoMondal
Copy link

Description

The useNavigate hook from react navigation by default not coming with any route name suggestions

@frankcalise
Copy link
Contributor

frankcalise commented May 6, 2025

hi @supriyoMondal - you can type it based on the way your navigators are set up, for example:

import { useNavigation } from "@react-navigation/native"
import { NativeStackNavigationProp } from "@react-navigation/native-stack"
import { AppStackParamList } from "../navigators"

export function useAppNavigation() {
  const navigation = useNavigation<NativeStackNavigationProp<AppStackParamList>>()

  return navigation
}

This would be preferred over the global type

@frankcalise frankcalise closed this May 6, 2025
@supriyoMondal
Copy link
Author

Thanks, I started with this , but then thought maybe it would be a good idea to type it by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants