You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React Native Drawer导航点击事件在部分设备失效问题

抽屉导航点击事件在部分设备上偶发失效问题

打开抽屉后,导航点击事件在部分设备上失效,部分设备(如小米Poco F1、小米Poco X4 GT)上该事件有时正常有时异常。该问题在某款小米设备上完全失效,但在小米Poco F1和小米Poco X4 GT上可正常运行(偶发异常)。我已生成debug APK并分发,用于在多设备上测试该问题。

相关代码

App.js

import {StyleSheet} from "react-native";
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import Login from '../screens/Login';
import { SideBar } from "../navigation/NavBar";
import { Notification } from "../data/Notification";

const Stack = createStackNavigator();
Notification();

function App(): JSX.Element {

  return (
    <NavigationContainer>
      <Stack.Navigator
        initialRouteName="Login">
        <Stack.Screen
          name="Login"
          component={Login}
          options={{
            headerLeft: () => null,
            headerShown: false,
          }} />
        <Stack.Screen
          name="Balance"
          component={SideBar}
          options={{
            headerLeft: () => null,
            headerShown: false,
          }} />
      </Stack.Navigator>
    </NavigationContainer>
  );
}

export default App;
import { DrawerActions, NavigationContainer } from "@react-navigation/native";
import { Image, Pressable, SafeAreaView, ScrollView, StyleSheet, Text, Touchable, TouchableOpacity, TouchableWithoutFeedback, View } from "react-native";
import FontAwesome5 from "react-native-vector-icons/FontAwesome5";
import SubirFactura from "../screens/SubirFactura";
import Balance from "../screens/Balance";
import Login from "../screens/Login";
import Redirect from "../navigation/Redirect";
import Impuestos from "../screens/Impuestos";
import { createDrawerNavigator } from "@react-navigation/drawer";
import React, { useEffect, useState } from "react";
import { StackNavigationProp } from "@react-navigation/stack";
import { FlatList } from "react-native-gesture-handler";
import { getCuentas } from "../data/Posts";
import { setUserData, getUserData } from "../data/GlobalData";
//import { Navigation } from "react-native-navigation";
import SideMenu from 'react-native-side-menu';

const Drawer = createDrawerNavigator();

export const SideBar = () => {
  return (
    <NavigationContainer theme={stylesSidebar} independent={true}>
      <Drawer.Navigator>
        <Drawer.Screen
          name="Balance"
          component={Balance}
          options={{
            title: 'Balance',
            drawerIcon: () => (
              <FontAwesome5 name={'chart-line'} size={20} color={'white'} />
            ),
            headerShown: false,
            unmountOnBlur: true,
          }} />
        <Drawer.Screen
          name="Impuestos"
          component={Impuestos}
          options={{
            title: 'Impuestos',
            drawerIcon: () => (
              <FontAwesome5 name={'euro-sign'} size={20} color={'white'} />
            ),
            headerShown: false,
            unmountOnBlur: true,
            headerTitleAlign: 'center',
            headerStyle: {
            },
          }} />
        <Drawer.Screen
          name="SubirFactura"
          component={SubirFactura}
          options={{
            title: 'Subir Factura',
            drawerIcon: () => (
              <FontAwesome5 name={'file-upload'} size={20} color={'white'} />
            ),
            headerShown: false,
            unmountOnBlur: true,
            headerTitleAlign: 'center',
            headerStyle: {
            },
          }} />
        <Drawer.Screen
          name="Redirect"
          component={Redirect}
          options={{
            headerShown: false,
            unmountOnBlur: true,
            headerTitleAlign: 'center',
            drawerItemStyle: { display: 'none' },
            headerStyle: {
            },
          }} />
        <Drawer.Screen
          name="Login"
          component={Login}
          options={{
            title: 'Cerrar sesión',
            drawerIcon: () => (
              <FontAwesome5 name={'sign-out-alt'} size={20} color={'white'} />
            ),
            headerShown: false,
            swipeEnabled: false,
            unmountOnBlur: true,
          }}
        />
      </Drawer.Navigator>
    </NavigationContainer>
  );
}

内容的提问来源于stack exchange,提问作者Jono

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.05 21:37:12