gpt4 book ai didi

react-native - 在使用抽屉导航响应 native 导航时导航时屏幕卡住

转载 作者:行者123 更新时间:2023-12-04 01:07:46 31 4
gpt4 key购买 nike

我在 React Native Navigation 中遇到抽屉导航问题。
问题似乎很简单。
我有 2 个屏幕,在每个屏幕上我都有一个按钮,可以将用户发送到另一个屏幕。
问题在将用户从屏幕 A 发送到 B 并从 B 发送到 A 之后,按钮不再起作用。
我可以拉抽屉再回到B屏,Button在那里工作,但是A屏中的按钮仍然卡住,基本上是孔屏。

import React from "react";
import { createDrawerNavigator } from "@react-navigation/drawer";

import SettingScreen from "../screens/SettingScreen";
import ProfileScreen from "../screens/ProfileScreen";

const Drawer = createDrawerNavigator();

function MenuNavigation(props) {
return (
<Drawer.Navigator>
<Drawer.Screen name="Setting" component={SettingScreen} />
<Drawer.Screen name="Profile" component={ProfileScreen} />
</Drawer.Navigator>
);
}

export default MenuNavigation;

这是屏幕之一,另一个是相同的,但名称不同

import React from "react";
import { Button, Text, View } from "react-native";

function SettingScreen({ navigation }) {
return (
<View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
<Text>Hello world</Text>
<Button
title="Go to Profile Screen"
onPress={() => navigation.navigate("Profile")}
/>
</View>
);
}

export default SettingScreen;

类似于设置屏幕我有一个配置文件屏幕,我没有包括。

import React from "react";
import { NavigationContainer } from "@react-navigation/native";
import MenuNavigation from "./MenuNavigation";

function MainNavigation(props) {
return (
<NavigationContainer>
<MenuNavigation />
</NavigationContainer>
);
}

export default MainNavigation;

最后,这是我的 package.json 文件,是的,我正在使用 EXPO

{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"@expo-google-fonts/roboto": "^0.1.0",
"@react-native-community/checkbox": "^0.5.7",
"@react-native-community/datetimepicker": "3.0.4",
"@react-native-community/masked-view": "^0.1.10",
"@react-navigation/bottom-tabs": "^5.11.2",
"@react-navigation/drawer": "^5.12.2",
"@react-navigation/native": "^5.8.10",
"@react-navigation/stack": "^5.12.8",
"expo": "~40.0.0",
"expo-checkbox": "~1.0.0",
"expo-font": "~8.4.0",
"expo-status-bar": "~1.0.3",
"moment": "^2.29.1",
"native-base": "^2.15.2",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-hook-form": "^6.14.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz",
"react-native-action-button": "^2.8.5",
"react-native-gesture-handler": "~1.8.0",
"react-native-modals": "^0.22.3",
"react-native-progress": "^4.1.2",
"react-native-reanimated": "^1.13.2",
"react-native-safe-area-context": "^3.1.9",
"react-native-screens": "^2.15.2",
"react-native-web": "~0.13.12",
"react-redux": "^7.2.2",
"redux": "^4.0.5",
"redux-connect": "^10.0.0",
"redux-thunk": "^2.3.0"
},
"devDependencies": {
"@babel/core": "~7.9.0"
},
"private": true
}

没有错误没有什么,根本不起作用。
如果有人需要更多详细信息,请询问我。

最佳答案

关于react-native - 在使用抽屉导航响应 native 导航时导航时屏幕卡住,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65854555/

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