react-navigation / react-navigation

Routing and navigation for your React Native apps
https://reactnavigation.org
23.3k stars 4.97k forks source link

DRAWER ENCERRA O APLICATIVO #11908

Closed Giebmeyer closed 1 month ago

Giebmeyer commented 1 month ago

Current behavior

Todos os pacotes são instalados com sucesso ao rodar o comando "yarn". O aplicativo é contruido com sucesso tambem, entretanto, recebo os erros a seguir quando o aplicativo tenta construir a tela que possui o drawer "":

`import React, { useContext } from 'react'; import { createStackNavigator } from '@react-navigation/stack';

import Authentication from '../pages/Authentication'; import LoginToken from '../pages/LoginToken'; import Login from '../pages/Login'; import Logout from '../pages/Logout'; import AddSalesBudgets from '../pages/AddSalesBudgets'; import AddPreSales from '../pages/AddPreSales'; import AddServiceOrders from '../pages/AddServiceOrders'; import AddDoNotSells from '../pages/AddDoNotSells'; import AddMaintenances from '../pages/AddMaintenances'; import AddStockFixes from '../pages/AddStockFixes'; import AddProductsSalesBudgets from '../pages/AddProductsSalesBudgets'; import AddServicesSalesBudgets from '../pages/AddServicesSalesBudgets'; import AddObjectServiceOrders from '../pages/AddObjectServiceOrders'; import AddProductsPreSales from '../pages/AddProductsPreSales'; import AddProductsInventories from '../pages/AddProductsInventories'; import AddProductsMaintenances from '../pages/AddProductsMaintenances'; import AddProductsStockFixes from '../pages/AddProductsStockFixes'; import SaleBudgetFinalization from '../pages/SaleBudgetFinalization'; import PreSaleFinalization from '../pages/PreSaleFinalization'; import Checklist from '../pages/Checklist'; import SendToApi from '../pages/SendToApi'; import ListClients from '../pages/ListClients'; import ListTablePrices from '../pages/ListTablePrices'; import ListFormPayments from '../pages/ListFormPayments'; import ListModalities from '../pages/ListModalities'; import ListProducts from '../pages/ListProducts'; import ListServices from '../pages/ListServices'; import ListObjects from '../pages/ListObjects'; import ListProductsInInventory from '../pages/ListProductsInInventory'; import ClientDetails from '../pages/ClientDetails'; import CheckConfiguration from '../pages/CheckConfiguration'; import Configurations from '../pages/Configurations'; import Sync from '../pages/Sync'; import DrawerRoutes from './drawerRoutes'; import ListMovementClient from '../pages/ListMovementClient'; import ListNotifications from '../pages/ListNotifications'; import ListDeliveries from '../pages/ListDeliveries'; import ListDeliveryRoutes from '../pages/ListDeliveryRoutes'; import DeliveryRouteCompleted from '../pages/DeliveryRouteCompleted'; import DeliveryRouteNotCompleted from '../pages/DeliveryRouteNotCompleted'; import SignatureDraw from '../pages/SignatureDraw'; import PreSync from '../pages/PreSync'; import ListPendingSlip from '../pages/ListPendingSlip'; import ListDeliveryFees from '../pages/ListDeliveryFees'; import Collect from '../pages/Collect'; import ListDocScannig from '../pages/ListDocScanning'; import PlanDetails from '../pages/PlanDetails'; import GetToApi from '../pages/GetToApi'; import SummarySync from '../pages/SummarySync';

import { Context as AuthContext } from '../context/authContext'; import { Context as SyncContext } from '../context/syncContext';

const Routes = () => { const Stack = createStackNavigator(); const { stateAuth } = useContext(AuthContext); const { stateSync } = useContext(SyncContext);

return ( <Stack.Navigator initialRouteName="CheckConfiguration" screenOptions={{ headerShown: false, gestureEnabled: false }}> {!stateAuth.isConfigured || stateAuth.alterConfiguration ? ( <>

      <Stack.Screen name="Configurations" component={Configurations} />
    </>
  ) : !stateAuth.isAuthenticated ? (
    <>
      <Stack.Screen name="Authentication" component={Authentication} />
    </>
  ) : stateSync.isFirstSync ? (
    <Stack.Screen name="SummarySync" component={SummarySync} />
  ) : !stateAuth.isLogged ? (
    <>
      <Stack.Screen name="LoginToken" component={LoginToken} />
      <Stack.Screen name="Login" component={Login} />
    </>
  ) : !stateAuth.isSynced ? (
    <Stack.Screen name="Sync" component={Sync} />
  ) : (
    <>
      <Stack.Screen name="Home" component={DrawerRoutes} />
      <Stack.Screen name="PreSync" component={PreSync} />
      <Stack.Screen name="AddSalesBudgets" component={AddSalesBudgets} />
      <Stack.Screen name="AddPreSales" component={AddPreSales} />
      <Stack.Screen name="AddServiceOrders" component={AddServiceOrders} />
      <Stack.Screen name="AddDoNotSells" component={AddDoNotSells} />
      <Stack.Screen name="AddMaintenances" component={AddMaintenances} />
      <Stack.Screen name="AddStockFixes" component={AddStockFixes} />
      <Stack.Screen name="AddProductsSalesBudgets" component={AddProductsSalesBudgets} />
      <Stack.Screen name="AddServicesSalesBudgets" component={AddServicesSalesBudgets} />
      <Stack.Screen name="AddObjectServiceOrders" component={AddObjectServiceOrders} />
      <Stack.Screen name="AddProductsPreSales" component={AddProductsPreSales} />
      <Stack.Screen name="AddProductsInventories" component={AddProductsInventories} />
      <Stack.Screen name="AddProductsMaintenances" component={AddProductsMaintenances} />
      <Stack.Screen name="AddProductsStockFixes" component={AddProductsStockFixes} />
      <Stack.Screen name="SaleBudgetFinalization" component={SaleBudgetFinalization} />
      <Stack.Screen name="PreSaleFinalization" component={PreSaleFinalization} />
      <Stack.Screen name="Checklist" component={Checklist} />
      <Stack.Screen name="SendToApi" component={SendToApi} />
      <Stack.Screen name="ListProducts" component={ListProducts} />
      <Stack.Screen name="ListServices" component={ListServices} />
      <Stack.Screen name="ListObjects" component={ListObjects} />
      <Stack.Screen name="ListClients" component={ListClients} />
      <Stack.Screen name="ListTablePrices" component={ListTablePrices} />
      <Stack.Screen name="ListFormPayments" component={ListFormPayments} />
      <Stack.Screen name="ListModalities" component={ListModalities} />
      <Stack.Screen name="ListProductsInInventory" component={ListProductsInInventory} />
      <Stack.Screen name="ClientDetails" component={ClientDetails} />
      <Stack.Screen name="Logout" component={Logout} />
      <Stack.Screen name="ListMovementClient" component={ListMovementClient} />
      <Stack.Screen name="ListNotifications" component={ListNotifications} />
      <Stack.Screen name="ListDeliveries" component={ListDeliveries} />
      <Stack.Screen name="ListDeliveryRoutes" component={ListDeliveryRoutes} />
      <Stack.Screen name="DeliveryRouteCompleted" component={DeliveryRouteCompleted} />
      <Stack.Screen name="DeliveryRouteNotCompleted" component={DeliveryRouteNotCompleted} />
      <Stack.Screen name="SignatureDraw" component={SignatureDraw} />
      <Stack.Screen name="ListPendingSlip" component={ListPendingSlip} />
      <Stack.Screen name="ListDeliveryFees" component={ListDeliveryFees} />
      <Stack.Screen name="Collect" component={Collect} />
      <Stack.Screen name="ListDocScannig" component={ListDocScannig} />
      <Stack.Screen name="PlanDetails" component={PlanDetails} />
      <Stack.Screen name="GetToApi" component={GetToApi} />
      <Stack.Screen name="SummarySync" component={SummarySync} />
    </>
  )}
</Stack.Navigator>

); };

export default () => { return ; }; `

DrawerRoutes:

`import React, { useContext, useState } from 'react'; import { createDrawerNavigator } from '@react-navigation/drawer'; import IonIcon from 'react-native-vector-icons/Ionicons';

import CustomDrawer from '../components/CustomDrawer'; import { customIcon } from '../utils';

import HomeScreen from '../pages/HomeScreen'; import ListBudgets from '../pages/ListBudgets'; import ConsultPrices from '../pages/ConsultPrices'; import ConsultClients from '../pages/ConsultClients'; import ConsultInvoices from '../pages/ConsultInvoices'; import ListInventories from '../pages/ListInventories'; import ListPreSales from '../pages/ListPreSales'; import ListNotifications from '../pages/ListNotifications'; import ListDeliveries from '../pages/ListDeliveries'; import Collect from '../pages/Collect'; import ListMaintenances from '../pages/ListMaintenances'; import ListDocScanning from '../pages/ListDocScanning'; import ListStockFixes from '../pages/ListStockFixes'; import Param from '../pages/Params'; import About from '../pages/About'; import Logout from '../pages/Logout'; import PreSync from '../pages/PreSync';

import { ViewCountNumber, TextCount, ViewNotification } from './styled';

import { Context as ConfigContext } from '../context/configContext'; import { Context as PermissionContext } from '../context/permissionContext';

const Drawer = createDrawerNavigator();

export default function DrawerRoutes() { const { stateConfig } = useContext(ConfigContext); const { statePermission } = useContext(PermissionContext);

const [textButtonSync, setTextButtonSync] = useState('Sincronizar');

return ( <Drawer.Navigator drawerContent={(props) => <CustomDrawer {...props} />} screenOptions={{ headerShown: false, drawerStyle: { backgroundColor: '#FCFCFC', }, drawerActiveBackgroundColor: '#1FCC79', drawerActiveTintColor: '#FFF', drawerInactiveTintColor: '#2E3E5C', drawerLabelStyle: { fontFamily: 'Inter-Medium', fontSize: 16, marginLeft: -8, }, drawerType: 'front', }}> <Drawer.Screen name="HomeScreen" component={HomeScreen} options={{ title: 'Início', drawerIcon: ({ focused }) => ( <IonIcon name={focused ? 'home' : 'home-outline'} size={28} color={focused ? '#FFF' : '#2E3E5C'} /> ), }} /> {(statePermission.permissions?.budgetsUsar ?? true) && ( <Drawer.Screen name="ListBudgets" component={ListBudgets} options={{ unmountOnBlur: true, // DESMONTAR TELA AO SAIR title: 'Orçamentos', drawerIcon: ({ focused }) => ( <IonIcon name={focused ? 'document-text' : 'document-text-outline'} size={28} color={focused ? '#FFF' : '#2E3E5C'} /> ), }} /> )} {stateConfig.configurations.premium && ( <Drawer.Screen name="ListPreSales" component={ListPreSales} options={{ unmountOnBlur: true, // DESMONTAR TELA AO SAIR title: 'Pré-vendas', drawerIcon: ({ focused }) => ( <IonIcon name={focused ? 'cart' : 'cart-outline'} size={28} color={focused ? '#FFF' : '#2E3E5C'} /> ), }} /> )} {/ {stateConfig.configurations.premium && ( <Drawer.Screen name="ListServiceOrders" component={ListServiceOrders} options={{ unmountOnBlur: true, // DESMONTAR TELA AO SAIR title: 'Ordens de serviço', drawerIcon: ({ focused }) => ( <IonIcon name={focused ? 'car-sport' : 'car-sport-outline'} size={28} color={focused ? '#FFF' : '#2E3E5C'} /> ), }} /> )} /} <Drawer.Screen name="ConsultPrices" component={ConsultPrices} options={{ unmountOnBlur: true, // DESMONTAR TELA AO SAIR title: 'Produtos', drawerIcon: ({ focused }) => ( <IonIcon name={focused ? 'pricetags' : 'pricetags-outline'} size={28} color={focused ? '#FFF' : '#2E3E5C'} /> ), }} /> { <Drawer.Screen name="ConsultClients" component={ConsultClients} options={{ unmountOnBlur: true, // DESMONTAR TELA AO SAIR title: 'Clientes', drawerIcon: ({ focused }) => ( <IonIcon name={focused ? 'people' : 'people-outline'} size={28} color={focused ? '#FFF' : '#2E3E5C'} /> ), }} /> } {(statePermission.permissions?.inventoriesUsar ?? true) && ( <Drawer.Screen name="ListInventories" component={ListInventories} options={{ unmountOnBlur: true, // DESMONTAR TELA AO SAIR title: 'Inventários', drawerIcon: ({ focused }) => ( <IonIcon name={focused ? 'file-tray-stacked' : 'file-tray-stacked-outline'} size={28} color={focused ? '#FFF' : '#2E3E5C'} /> ), }} /> )} {stateConfig.configurations.premium && (statePermission.permissions?.consultInvoicesUsar ?? true) && ( <Drawer.Screen name="ConsultInvoices" component={ConsultInvoices} options={{ unmountOnBlur: true, // DESMONTAR TELA AO SAIR title: 'Conf. NF-e', drawerIcon: ({ focused }) => ( <IonIcon name={focused ? 'receipt' : 'receipt-outline'} size={28} color={focused ? '#FFF' : '#2E3E5C'} /> ), }} /> )} {stateConfig.configurations.premium && ( <Drawer.Screen name="ListDocScanning" component={ListDocScanning} options={{ unmountOnBlur: true, // DESMONTAR TELA AO SAIR title: 'Digitalização', drawerIcon: ({ focused }) => customIcon( 'MaterialCommunityIcons', focused ? 'file-document-edit' : 'file-document-edit-outline', 28, focused ? '#FFF' : '#2E3E5C', ), }} /> )} <Drawer.Screen name="ListMaintenances" component={ListMaintenances} options={{ unmountOnBlur: true, // DESMONTAR TELA AO SAIR title: 'Trocas/Manutenções', drawerIcon: ({ focused }) => ( <IonIcon name={focused ? 'construct' : 'construct-outline'} size={28} color={focused ? '#FFF' : '#2E3E5C'} /> ), }} /> {stateConfig.configurations.premium && ( <Drawer.Screen name="ListDeliveries" component={ListDeliveries} options={{ unmountOnBlur: true, // DESMONTAR TELA AO SAIR title: 'Entregas', drawerIcon: ({ focused }) => customIcon( 'MaterialCommunityIcons', focused ? 'truck-delivery' : 'truck-delivery-outline', 28, focused ? '#FFF' : '#2E3E5C', ), }} /> )}

  {stateConfig.configurations.premium && (
    <Drawer.Screen
      name="Collect"
      component={Collect}
      options={{
        unmountOnBlur: true, // DESMONTAR TELA AO SAIR
        title: 'Coleta',
        drawerIcon: ({ focused }) =>
          customIcon(
            'MaterialCommunityIcons',
            focused ? 'clipboard-check-multiple' : 'clipboard-check-multiple-outline',
            28,
            focused ? '#FFF' : '#2E3E5C',
          ),
      }}
    />
  )}

  {stateConfig.configurations.premium &&
    (statePermission.permissions?.productsAcertoEstoque ?? true) && (
      <Drawer.Screen
        name="ListStockFixes"
        component={ListStockFixes}
        options={{
          unmountOnBlur: true, // DESMONTAR TELA AO SAIR
          title: 'Acerto de estoque',
          drawerIcon: ({ focused }) =>
            customIcon(
              'IonIcons',
              focused ? 'color-wand' : 'color-wand-outline',
              28,
              focused ? '#FFF' : '#2E3E5C',
            ),
        }}
      />
    )}
  <Drawer.Screen
    name="ListNotifications"
    component={ListNotifications}
    options={{
      unmountOnBlur: true, // DESMONTAR TELA AO SAIR
      title: 'Notificações',
      drawerIcon: ({ focused }) => (
        <>
          <ViewNotification>
            <IonIcon
              name={focused ? 'notifications' : 'notifications-outline'}
              size={28}
              color={focused ? '#FFF' : '#2E3E5C'}
            />
          </ViewNotification>
        </>
      ),
    }}
  />
  <Drawer.Screen
    name="PreSync"
    component={PreSync}
    options={{
      unmountOnBlur: true, // DESMONTAR TELA AO SAIR
      title: textButtonSync,
      drawerIcon: ({ focused }) => (
        <IonIcon
          name={focused ? 'sync-circle' : 'sync'}
          size={28}
          color={focused ? '#FFF' : '#2E3E5C'}
        />
      ),
    }}
  />
  <Drawer.Screen
    name="Params"
    component={Param}
    options={{
      unmountOnBlur: true, // DESMONTAR TELA AO SAIR
      title: 'Parâmetros',
      drawerIcon: ({ focused }) => (
        <IonIcon
          name={focused ? 'cog' : 'cog-outline'}
          size={28}
          color={focused ? '#FFF' : '#2E3E5C'}
        />
      ),
    }}
  />
  <Drawer.Screen
    name="About"
    component={About}
    options={{
      unmountOnBlur: true, // DESMONTAR TELA AO SAIR
      title: 'Sobre',
      drawerIcon: ({ focused }) => (
        <IonIcon
          name={focused ? 'information-circle' : 'information-circle-outline'}
          size={28}
          color={focused ? '#FFF' : '#2E3E5C'}
        />
      ),
    }}
  />
  <Drawer.Screen
    name="Exit"
    component={Logout}
    options={{
      title: 'Sair',
      drawerIcon: ({ focused }) => (
        <IonIcon
          name={focused ? 'exit' : 'exit-outline'}
          size={28}
          color={focused ? '#FFF' : '#2E3E5C'}
        />
      ),
    }}
  />
</Drawer.Navigator>

); } `

image image image image

Expected behavior

O aplicativo deveria executar e apresentar a tela Home

`import React, { useContext } from 'react'; import { ScrollView } from 'react-native'; import { Header } from '../../components/Header'; import OptionHome from '../../components/OptionHome'; import { useNavigation } from '@react-navigation/native'; import { ContainerText, TextUser } from './styles';

import { Context as UserContext } from '../../context/userContext'; import { Context as PermissionContext } from '../../context/permissionContext'; import { Context as NotificationContext } from '../../context/notificationContext';

const HomeScreen = () => { const { stateUser } = useContext(UserContext);

const { statePermission } = useContext(PermissionContext); const { stateNotification } = useContext(NotificationContext);

const navigation = useNavigation();

return ( <>

navigation.openDrawer()} /> navigation.navigate('ListNotifications')} alignRight={true} count={stateNotification.countNotifications} /> Olá, {stateUser.name}! ); }; export default HomeScreen; ` ### Reproduction O projeto é privado. ### Platform - [X] Android - [ ] iOS - [ ] Web - [ ] Windows - [ ] MacOS ### Packages - [ ] @react-navigation/bottom-tabs - [X] @react-navigation/drawer - [ ] @react-navigation/material-top-tabs - [X] @react-navigation/stack - [X] @react-navigation/native-stack - [ ] react-native-tab-view ### Environment { "scripts": { "android": "react-native run-android", "start": "react-native start", "test": "jest", "lint": "eslint .", }, "dependencies": { "@iconscout/react-unicons": "^2.0.0", "@nozbe/watermelondb": "0.25.5", "@nozbe/with-observables": "^1.4.1", "@react-native-clipboard/clipboard": "^1.11.1", "@react-native-community/art": "^1.2.0", "@react-native-community/hooks": "^2.8.1", "@react-native-community/netinfo": "^9.4.1", "@react-native-community/push-notification-ios": "^1.10.1", "@react-native-masked-view/masked-view": "^0.2.6", "@react-native-ml-kit/text-recognition": "^1.5.1", "@react-navigation/drawer": "^6.6.15", "@react-navigation/native": "^6.1.3", "@react-navigation/stack": "^6.3.29", "@types/react-native": "^0.67.6", "@types/react-native-snap-carousel": "^3.8.5", "@types/styled-components": "^5.1.32", "axios": "^1.5.1", "base-64": "^1.0.0", "cap": "^0.2.1", "crypto-js": "^4.1.1", "dayjs": "^1.11.6", "deprecated-react-native-prop-types": "^2.3.0", "masks-br": "^1.0.1", "npx": "^10.2.2", "pdf-lib": "^1.17.1", "react": "18.2.0", "react-native": "0.72.7", "react-native-app-intro-slider": "^4.0.4", "react-native-background-actions": "^3.0.1", "react-native-barcode-mask": "^1.2.4", "react-native-blob-util": "^0.19.1", "react-native-bouncy-checkbox": "^3.0.2", "react-native-date-picker": "^4.2.5", "react-native-device-info": "^9.0.2", "react-native-dialog-input": "^1.0.8", "react-native-expo-fancy-alerts": "^2.1.1", "react-native-file-viewer": "^2.1.5", "react-native-fs": "^2.20.0", "react-native-gesture-handler": "^2.14.0", "react-native-html-to-pdf": "^0.12.0", "react-native-image-picker": "^4.8.4", "react-native-image-viewing": "^0.2.2", "react-native-keyboard-aware-scroll-view": "^0.9.5", "react-native-modal": "^13.0.1", "react-native-modalize": "^2.1.1", "react-native-orientation-locker": "^1.5.0", "react-native-pdf": "^6.7.1", "react-native-permissions": "^3.6.1", "react-native-progress": "^4.0.2", "react-native-push-notification": "^8.1.1", "react-native-qrcode-svg": "^6.2.0", "react-native-reanimated": "3.8.1", "react-native-safe-area-context": "^4.2.5", "react-native-safe-area-view": "^1.1.1", "react-native-screens": "^3.13.1", "react-native-share": "8.2.1", "react-native-signature-canvas": "^4.5.0", "react-native-snackbar": "^2.4.0", "react-native-snap-carousel": "^3.9.1", "react-native-sound-player": "^0.13.2", "react-native-stopwatch-timer": "^0.0.21", "react-native-super-grid": "^5.0.0", "react-native-svg": "^15.1.0", "react-native-switch-toggles": "^1.0.1", "react-native-vector-icons": "^9.2.0", "react-native-version-check": "^3.4.7", "react-native-vision-camera": "^3.9.0", "react-native-walkthrough-tooltip": "^1.6.0", "react-native-webview": "^12.0.2", "react-native-worklets-core": "^0.3.0", "styled-components": "^5.3.5", "sync": "^0.2.5" }, "peerDependencies": { "react-native-vision-camera": "*", "react-native-worklets-core": "*" }, "devDependencies": { "@babel/core": "^7.20.0", "@babel/plugin-proposal-decorators": "7.21.0", "@babel/preset-env": "^7.20.0", "@babel/runtime": "^7.20.0", "@react-native-community/eslint-config": "^3.0.1", "@react-native/eslint-config": "^0.72.2", "@react-native/metro-config": "^0.72.11", "@testing-library/jest-native": "^5.4.2", "@testing-library/react-native": "^12.0.1", "@tsconfig/react-native": "^3.0.0", "@types/react": "^18.0.24", "@types/react-native-vector-icons": "^6.4.10", "@types/react-test-renderer": "^18.0.0", "babel-jest": "^29.2.1", "eslint": "^8.19.0", "jest": "^29.2.1", "metro-react-native-babel-preset": "0.76.8", "prettier": "^2.4.1", "react-test-renderer": "18.2.0", "typescript": "4.8.4" }, "jest": { "preset": "react-native", "setupFilesAfterEnv": [ "@testing-library/jest-native/extend-expect" ] }, "engines": { "node": ">=16" } }
github-actions[bot] commented 1 month ago

Hey @Giebmeyer! Thanks for opening the issue. It seems that the issue doesn't contain a link to a repro.

The best way to get attention to your issue is to provide an easy way for a developer to reproduce the issue.

You can provide a repro using any of the following:

github-actions[bot] commented 1 month ago

The versions mentioned in the issue for the following packages differ from the latest versions on npm:

Can you verify that the issue still exists after upgrading to the latest versions of these packages?

migueldaipre commented 1 month ago

Please add a minimal reproducer.

Giebmeyer commented 1 month ago

REPRODUTOR MINIMO:

index.js:

import 'react-native-reanimated';
import { AppRegistry } from 'react-native';
import App from './src/App';
import { name as appName } from './app.json';

AppRegistry.registerComponent(appName, () => App);

App.tsx (Já tentei mudar para .js para ver se alterada o resultado, mas sem sucesso):


import * as React from 'react';
import { Button, View } from 'react-native';
import { createDrawerNavigator } from '@react-navigation/drawer';
import { NavigationContainer } from '@react-navigation/native';

function HomeScreen({ navigation }) {
  return (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
      <Button onPress={() => navigation.navigate('Notifications')} title="Go to notifications" />
    </View>
  );
}

function NotificationsScreen({ navigation }) {
  return (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
      <Button onPress={() => navigation.goBack()} title="Go back home" />
    </View>
  );
}

const Drawer = createDrawerNavigator();

export default function App() {
  return (
    <NavigationContainer>
      <Drawer.Navigator initialRouteName="Home">
        <Drawer.Screen name="Home" component={HomeScreen} />
        <Drawer.Screen name="Notifications" component={NotificationsScreen} />
      </Drawer.Navigator>
    </NavigationContainer>
  );
}

babel.config.js:

module.exports = { presets: ['module:metro-react-native-babel-preset'], plugins: [['react-native-reanimated/plugin'], ['react-native-worklets-core/plugin']], }; build.gradle:

` buildscript { ext { googlePlayServicesVersion = "+" // default: "+" firebaseMessagingVersion = "21.1.0" // default: "21.1.0" buildToolsVersion = '33.0.0' minSdkVersion = 26 compileSdkVersion = 33 targetSdkVersion = 33 ndkVersion = '23.1.7779620' kotlin_version = '1.7.1'

    VisionCameraCodeScanner_targetSdkVersion = 31
    VisionCameraCodeScanner_compileSdkVersion = 31
}
repositories {
    google()
    mavenCentral()
}
dependencies {
    classpath("com.android.tools.build:gradle:7.3.1")
    classpath('org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20')
    classpath("com.facebook.react:react-native-gradle-plugin")
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}

}

allprojects { repositories { mavenCentral() mavenLocal() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url("$rootDir/../node_modules/react-native/android") } maven { // Android JSC is installed from npm url("$rootDir/../node_modules/jsc-android/dist") } google() maven { url 'https://www.jitpack.io' } } }`

build.gralde (app):

`apply plugin: 'com.android.application' apply plugin: "com.facebook.react"

def archiveBuildTypes = ["release", "debug"]; def distFolder = "\\10.1.1.110\Arquivos\Atualizacoes\vsApp" def appName = "vsApp"

import com.android.build.OutputFile

/**

project.ext.react = [ enableHermes: true, // clean and rebuild if changing ]

project.ext.reanimated = [ buildFromSource: true ]

// apply from: '../../node_modules/react-native/react.gradle'

/**

/**

/**

/**

/**

android { ndkVersion rootProject.ext.ndkVersion

compileSdkVersion rootProject.ext.compileSdkVersion

defaultConfig {
    applicationId 'br.inf.visualsoftware.vsapp'
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 231
    versionName '3.3.3.1'
    missingDimensionStrategy 'react-native-camera', 'general'
    missingDimensionStrategy 'react-native-camera', 'mlkit'
}
splits {
    abi {
  reset()
  enable enableSeparateBuildPerCPUArchitecture
  universalApk false  // If true, also generate a universal APK
  include 'armeabi-v7a', 'x86', 'arm64-v8a', 'x86_64'
    }
}
signingConfigs {
    debug {
  storeFile file('debug.keystore')
  storePassword 'android'
  keyAlias 'androiddebugkey'
  keyPassword 'android'
    }
     release {
        if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
            storeFile file(MYAPP_UPLOAD_STORE_FILE)
            storePassword MYAPP_UPLOAD_STORE_PASSWORD
            keyAlias MYAPP_UPLOAD_KEY_ALIAS
            keyPassword MYAPP_UPLOAD_KEY_PASSWORD
        }
    }
}
buildTypes {
    debug {
  signingConfig signingConfigs.debug
  if (nativeArchitectures) {
    ndk {
      abiFilters nativeArchitectures.split(',')
    }
  }
    }
    release {
  // Caution! In production, you need to generate your own keystore file.
  // see https://reactnative.dev/docs/signed-apk-android.
  signingConfig signingConfigs.debug
  minifyEnabled enableProguardInReleaseBuilds
  proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  signingConfig signingConfigs.release
    }
}

applicationVariants.all { variant ->
    variant.outputs.all { output ->
        if (variant.buildType.name in archiveBuildTypes) {
                String name = "vsApp-${defaultConfig.versionName}.apk"
                outputFileName = new File(name)

            def taskSuffix = variant.name.capitalize()
            def assembleTaskName = "assemble${taskSuffix}"

            if (tasks.findByName(assembleTaskName)) {
                def copyAPKFolderTask = tasks.create(name: "archive${taskSuffix}", type: org.gradle.api.tasks.Copy) {
                    def sourceFolder = "$buildDir/outputs/apk/${output.baseName.replace("-", "/")}"
                    def destinationFolder = "$distFolder"

                    print "Copying APK folder from: $sourceFolder into $destinationFolder\n"

                    from(sourceFolder)
                    into destinationFolder
                    eachFile { file ->
                        file.path = file.name 
                    }
                    includeEmptyDirs = false
                }
                tasks[assembleTaskName].finalizedBy = [copyAPKFolderTask]
            }
        }
    }
}

// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
    variant.outputs.each { output ->
  // For each separate APK per architecture, set a unique version code as described here:
  // https://developer.android.com/studio/build/configure-apk-splits.html
  // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
  def versionCodes = ['armeabi-v7a': 1, 'x86': 2, 'arm64-v8a': 3, 'x86_64': 4]
  def abi = output.getFilter(OutputFile.ABI)
  if (abi != null) {  // null for the universal-debug, universal-release variants
    output.versionCodeOverride =
                    defaultConfig.versionCode * 1000 + versionCodes.get(abi)
  }
    }
}
// dexOptions {
// incremental true
// javaMaxHeapSize '4g'
// }

packagingOptions {
    pickFirst 'lib/x86/libc++_shared.so'
    pickFirst 'lib/x86_64/libjsc.so'
    pickFirst 'lib/arm64-v8a/libjsc.so'
    pickFirst 'lib/arm64-v8a/libc++_shared.so'
    pickFirst 'lib/x86_64/libc++_shared.so'
    pickFirst 'lib/armeabi-v7a/libc++_shared.so'
}

}

dependencies { // The version of react-native is set by the React Native Gradle Plugin implementation("com.facebook.react:react-android") implementation 'com.github.mwiede:jsch:0.1.62' implementation project(':watermelondb') implementation "com.facebook.react:react-android" implementation "com.facebook.react:hermes-android" implementation 'com.google.mlkit:barcode-scanning:17.2.0'

debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
    exclude group:'com.squareup.okhttp3', module:'okhttp'
}

debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
if (hermesEnabled.toBoolean()) {
    implementation("com.facebook.react:hermes-android")
} else {
    implementation jscFlavor
}

}

// Run this once to be able to run the application with BUCK // puts all compile dependencies into folder libs for BUCK to use task copyDownloadableDepsToLibs(type: Copy) { from configurations.implementation into 'libs' }

apply from: file('../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle'); applyNativeModulesAppBuildGradle(project) `

MainActivity.java:

`package br.inf.visualsoftware.vsapp;

import com.facebook.react.ReactActivity; import android.os.Bundle;

public class MainActivity extends ReactActivity {
/**

MainApplication.java:

`package br.inf.visualsoftware.vsapp;

import com.facebook.react.bridge.JSIModulePackage; import android.app.Application; import android.content.Context; import com.facebook.react.PackageList; import com.facebook.react.ReactApplication; import com.rnfs.RNFSPackage; import com.dieam.reactnativepushnotification.ReactNativePushNotificationPackage; import com.nozbe.watermelondb.WatermelonDBPackage; import com.zoontek.rnpermissions.RNPermissionsPackage; import com.horcrux.svg.SvgPackage; import com.oblador.vectoricons.VectorIconsPackage; import com.facebook.react.ReactInstanceManager; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.soloader.SoLoader; import java.lang.reflect.InvocationTargetException; import java.util.List;`

Giebmeyer commented 1 month ago

Please add a minimal reproducer.

Adicionado no comentário acima.

migueldaipre commented 1 month ago

Please add a minimal reproducer.

Adicionado no comentário acima.

Add a GitHub repo link or expo snack.

Giebmeyer commented 1 month ago

Please add a minimal reproducer.

Adicionado no comentário acima.

Add a GitHub repo link or expo snack.

The project is private and for-profit.

Furthermore, I can't import it into expo snack because not all dependencies are not compatible with expo.

Is there any other way?

migueldaipre commented 1 month ago

Please add a minimal reproducer.

Adicionado no comentário acima.

Add a GitHub repo link or expo snack.

The project is private and for-profit.

Furthermore, I can't import it into expo snack because not all dependencies are not compatible with expo.

Is there any other way?

Create a new github project with your comment above.

Giebmeyer commented 1 month ago

Ajustado.

\android\app\build.gradle

project.ext.react = [ enableHermes: false, // changed to 'false' ]

github-actions[bot] commented 1 month ago

Hey! This issue is closed and isn't watched by the core team. You are welcome to discuss the issue with others in this thread, but if you think this issue is still valid and needs to be tracked, please open a new issue with a repro.