尝试在 React Native 应用程序中创建一个 BottomTabNavigtor。这是我的导航代码。
import { createAppContainer } from "react-navigation";
import { createStackNavigator } from "react-navigation-stack";
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { Platform } from "react-native";
import CategoriesScreen from "../screens/CategoriesScreen";
import CategoryMealScreen from "../screens/CategoryMealScreen";
import MealDetailScreen from "../screens/MealDetailScreen";
import FavoritesScreen from "../screens/FavoritesScreen";
import Colors from "../constants/colors";
const MealsNavigator = createStackNavigator(
{
Categories: {
screen: CategoriesScreen,
navigationOptions: {
title: "Meal Categories"
}
},
CategoryMeals: {
screen: CategoryMealScreen
}, MealDetail: MealDetailScreen
},
{
defaultNavigationOptions: {
headerStyle: {
backgroundColor: Platform.OS === 'android' ? Colors.primaryColor : ''
},
headerTintColor: Platform.OS === 'android' ? 'white' : Colors.primaryColor
},
}
);
const MealsFavTabNavigator = createBottomTabNavigator({
Meals: MealsNavigator,
Favorites: FavoritesScreen
});
export default createAppContainer(MealsFavTabNavigator);
遵循此应用程序的课程。收到此错误:
TypeError: (0, _native.createNavigatorFactory) 不是函数。(在“(0,_native.createNavigatorFactory)(BottomTabNavigator)”中,“(0,_native.createNavigatorFactory)”未定义)
任何帮助,将不胜感激。谢谢。