gpt4 book ai didi

react-native - 在 React Native 中获得右侧的抽屉导航菜单

转载 作者:行者123 更新时间:2023-12-04 05:10:52 25 4
gpt4 key购买 nike

当我添加选定的代码时,它会显示 undefined object (评估“route.routeName”)。
抽屉导航默认在左侧。如何在右侧获得它?

import React, { Component } from "react";
import { Platform, StyleSheet, Text, View } from "react-native";
import { DrawerNavigator } from "react-navigation";
import ScreenFirst from "./src/ScreenFirst";
import ScreenTwo from "./src/ScreenTwo";

const DrawerExample = DrawerNavigator(
{
ScreenFirst: { screen: ScreenFirst },
ScreenTwo: { screen: ScreenTwo }
},
{
drawerPosition: "right",
drawerWidth: 100
}
);
export default DrawerExample;

enter image description here

最佳答案

如果您使用导航 3.x,您将需要导入这些家伙

import {createDrawerNavigator, createAppContainer} from 'react-navigation'

然后试试这个:
const DrawerExample = DrawerNavigator(
{
ScreenFirst: { screen: ScreenFirst },
ScreenTwo: { screen: ScreenTwo }
},
{
drawerPosition: "right",
drawerWidth: 100
}
);

const MyApp = createAppContainer(DrawerExample);
export default MyApp

关于react-native - 在 React Native 中获得右侧的抽屉导航菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47886567/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com