当我在单独的文件上定义NavigationContainer
时,出现以下错误:
'NavigationContainer' refers to a value, but is being used as a type here. Did you mean 'typeof NavigationContainer'?
但是当我在App.tsx
中定义它时,就可以了。
import React from 'react'
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
const Stack = createStackNavigator();
function AppNavigator() {
return (
<NavigationContainer>
<Stack.Screen
name={Routes.SPLASH}
component={SplashScreen}
options={{
headerShown: false,
}}
/>
</NavigationContainer>
)
}
export default AppNavigator
我怎么了?
答案 0 :(得分:0)
我将文件扩展名更改为tsx
,但错误消失了。