小编sat*_*164的帖子

react-navigation 5.0 中的多个抽屉

我写了下面的代码来制作多个侧边菜单,但发生错误

另一个导航器已为此容器注册。您可能在一个“NavigationContainer”或“Screen”下有多个导航器。确保每个导航器都位于单独的“屏幕”容器下。

然而,我试图找到多个抽屉的容器,但没有运气。

我该怎么办?

提前致谢。

import React from 'react';
import { AppLoading } from 'expo';
import * as Font from 'expo-font';
import { Ionicons } from '@expo/vector-icons';
import { createDrawerNavigator } from '@react-navigation/drawer';
import { NavigationNativeContainer } from '@react-navigation/native';
import { Container, Text, Button } from 'native-base';
import 'react-native-gesture-handler'

function BlankScreen({ navigation }) {
  return (
    <Text>Blank</Text>
);
}

function HomeScreen({ navigation }) {
  return (
    <Container style={{ flex: 1, flexDirection: 'column-reverse' }}>
      <Button onPress={() => navigation.navigate('Menu')}>
        <Text>Go to Menu</Text> …
Run Code Online (Sandbox Code Playgroud)

react-navigation

5
推荐指数
1
解决办法
7841
查看次数

标签 统计

react-navigation ×1