绑定元素 'navigator' 隐式具有 'any' 类型

Binding element 'navigator' implicitly has an 'any' type

我正在尝试构建一个移动应用程序,但我在使用 react-native navigation v5 时遇到了一些问题,在他们的文档中,我找到了这个示例代码,但这两个代码(我的代码和官方代码)有同样的错误,查看我的代码:

// In App.js in a new project

import * as React from 'react';
import { View, Text } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import { TouchableOpacity } from 'react-native-gesture-handler';

function HomeScreen({ navigator }) {
  return (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
      <Text>Home Screen</Text>
    </View>
  );
}

function DetailsScreen() {
  return (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
      <Text>Details Screen</Text>
    </View>
  );
}

const Stack = createStackNavigator();

function App() {
  return (
    <NavigationContainer>
      <Stack.Navigator initialRouteName="Home">
        <Stack.Screen name="Home" component={HomeScreen} />
        <Stack.Screen name="Details" component={DetailsScreen} />
      </Stack.Navigator>
    </NavigationContainer>
  );
}

export default App;

我有这个错误:Binding element 'navigator' implicitly has an 'any' type.

react-navigation 传递了一个叫做 'navigation' 而不是 'navigator'

的 属性

尝试像下面这样更改代码

function HomeScreen({ navigation }) {
  return (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
      <Text>Home Screen</Text>
    </View>
  );
}