const navigation = useNavigation();
navigation.navigate('Profile')}
在 .navigate 上出现此错误
No overload matches this call.
Argument of type '[string]' is not assignable to parameter of type 'never'.
Overload 2 of 2, '(options: never): void', gave the following error.
Argument of type 'string' is not assignable to parameter of type 'never'
我们获得 props 的导航道具工作没有任何问题,但我想在不是屏幕的组件中使用它
我的反应导航版本
"@react-navigation/native": "^6.1.8",
"@react-navigation/stack": "^6.3.18",
这是一个正在使用的解决方案。我在导航页面名称后面添加了
as never
标签。这不是最好的解决方案,但错误消失了。
navigation.navigate('Profile' as never)}