【发布时间】:2021-08-03 16:53:35
【问题描述】:
我正在尝试创建BottomTabNavigator,但出现以下错误
警告:React.createElement:类型无效 - 应为字符串(对于内置组件)或类/函数(对于复合组件),但得到:未定义。您可能忘记从定义组件的文件中导出组件,或者您可能混淆了默认导入和命名导入。
检查BottomTabNavigator的渲染方法。
在 BottomTabNavigator 中(在 AppRoot.js:76)
这是我的代码
const Stack = createStackNavigator();
const Drawer = createDrawerNavigator();
const Tab = createBottomTabNavigator();
// stacks
const StackApp = () => {
return (
<Stack.Navigator initialRouteName="SplashScreen">
<Stack.Screen
name="Log_In"
component={Log_In}
options={{ headerShown: false }}
/>
<Stack.Screen
name="Sign_Up"
component={Sign_Up}
options={{
title: "Create Account",
headerStyle: { backgroundColor: "#fcf5f3" },
headerTitleStyle: {
fontWeight: "bold",
},
}}
/>
<Stack.Screen
name="HomeScreen"
component={HomeScreen}
options={{ headerShown: false }}
/>
<Stack.Screen
name="SplashScreen"
component={SplashScreen}
options={{ headerShown: false }}
/>
<Stack.Screen name="UserResetPassword" component={UserResetPassword} />
<Stack.Screen name="UserProfileScreen" component={UserProfileScreen} />
<Stack.Screen name="EditeProfileScreen" component={EditeProfileScreen} />
</Stack.Navigator>
);
};
export default function AppTabs() {
return (
<NavigationContainer>
<Tab.Navigator>
<Tab.Screen name="Home" component={StackApp} />
</Tab.Navigator>
</NavigationContainer>
);
}
【问题讨论】:
-
这是完整的代码吗,在寻求帮助之前,您应该先尝试使用错误消息解决您的问题。
-
我试了很多次。但我什么也没做
标签: javascript reactjs react-native-android react-native-flatlist react-native-navigation