Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAWER ENCERRA O APLICATIVO #11908

Closed
4 of 11 tasks
Giebmeyer opened this issue Mar 22, 2024 · 10 comments
Closed
4 of 11 tasks

DRAWER ENCERRA O APLICATIVO #11908

Giebmeyer opened this issue Mar 22, 2024 · 10 comments

Comments

@Giebmeyer
Copy link

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 "<Stack.Screen name="Home" component={DrawerRoutes} />":

`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="CheckConfiguration" component={CheckConfiguration} />
<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 (
<>
<Header.Root>
<Header.Action icon="menu" action={() => navigation.openDrawer()} />
<Header.Title title="vsApp" />

    <Header.Action
      icon="notifications"
      action={() => navigation.navigate('ListNotifications')}
      alignRight={true}
      count={stateNotification.countNotifications}
    />
  </Header.Root>

  <ContainerText>
    <TextUser>Olá, {stateUser.name}!</TextUser>
  </ContainerText>
  <ScrollView showsVerticalScrollIndicator={false}>
    <OptionHome
      screen="ListBudgets"
      icon="document-text"
      title="Orçamentos"
      requiresPermission={true}
      permissionGranted={statePermission.permissions?.budgetsUsar ?? true}
    />
    <OptionHome screen="ListPreSales" icon="cart" title="Pré-vendas" subMessage="premium" />
    <OptionHome
      screen="ListServiceOrders"
      icon="car-sport"
      title="Ordens de serviço"
      // subMessage="premium"
      subMessage="shortly"
    />
    <OptionHome screen="ConsultPrices" icon="pricetags" title="Produtos" />
    <OptionHome screen="ConsultClients" icon="people" title="Clientes" />
    <OptionHome
      screen="ListInventories"
      icon="file-tray-stacked"
      title="Inventários"
      requiresPermission={true}
      permissionGranted={statePermission.permissions?.inventoriesUsar ?? true}
    />
    <OptionHome
      screen="ConsultInvoices"
      icon="receipt"
      title="Conferência de NF-e"
      subMessage="premium"
      requiresPermission={true}
      permissionGranted={statePermission.permissions?.consultInvoicesUsar ?? true}
    />

    <OptionHome screen="ListMaintenances" icon="construct" title="Trocas/Manutenções" />
    <OptionHome
      screen="ListDeliveries"
      library={'MaterialCommunityIcons'}
      icon="truck-delivery"
      title="Entregas"
      subMessage="premium"
    />

    <OptionHome
      screen="Collect"
      library={'MaterialCommunityIcons'}
      icon="clipboard-check-multiple"
      title="Coleta"
      subMessage="premium"
      // subMessage="shortly"
    />

    <OptionHome
      screen="ListDocScannig"
      library={'MaterialCommunityIcons'}
      icon="file-document-edit"
      title="Digitalização"
      subMessage="premium"
      // subMessage="shortly"
    />
    <OptionHome
      screen="ListStockFixes"
      library={'Ionicons'}
      icon="color-wand"
      title="Acerto de estoque"
      subMessage="premium"
      requiresPermission={true}
      permissionGranted={statePermission.permissions?.productsAcertoEstoque ?? true}
    />
    <OptionHome
      screen="Tags"
      library={'MaterialCommunityIcons'}
      icon="tag-text"
      title="Etiquetas"
      subMessage="shortly"
    />
  </ScrollView>
</>

);
};

export default HomeScreen;
`

Reproduction

O projeto é privado.

Platform

  • Android
  • iOS
  • Web
  • Windows
  • MacOS

Packages

  • @react-navigation/bottom-tabs
  • @react-navigation/drawer
  • @react-navigation/material-top-tabs
  • @react-navigation/stack
  • @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"
}
}

Copy link

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:

A snack link is preferred since it's the easiest way to both create and share a repro. If it's not possible to create a repro using a snack, link to a GitHub repo under your username is a good alternative. Don't link to a branch or specific file etc. as it won't be detected.

Try to keep the repro as small as possible by narrowing down the minimal amount of code needed to reproduce the issue. Don't link to your entire project or a project containing code unrelated to the issue. See "How to create a Minimal, Reproducible Example" for more information.

You can edit your original issue to include a link to the repro, or leave it as a comment. The issue will be closed automatically after a while if you don't provide a repro.

Copy link

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

  • @react-navigation/native (found: 6.1.3, latest: 6.1.17)

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

@migueldaipre
Copy link
Member

Please add a minimal reproducer.

@Giebmeyer
Copy link
Author

Giebmeyer commented Mar 25, 2024

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

/**

  • The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
  • and bundleReleaseJsAndAssets).
  • These basically call react-native bundle with the correct arguments during the Android build
  • cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
  • bundle directly from the development server. Below you can see all the possible configurations
  • and their defaults. If you decide to add a configuration block, make sure to add it before the
  • apply from: "../../node_modules/react-native/react.gradle" line.
  • project.ext.react = [
  • // the name of the generated asset file containing your JS bundle
  • bundleAssetName: "index.android.bundle",
  • // the entry file for bundle generation. If none specified and
  • // "index.android.js" exists, it will be used. Otherwise "index.js" is
  • // default. Can be overridden with ENTRY_FILE environment variable.
  • entryFile: "index.android.js",
  • // https://reactnative.dev/docs/performance#enable-the-ram-format
  • bundleCommand: "ram-bundle",
  • // whether to bundle JS and assets in debug mode
  • bundleInDebug: false,
  • // whether to bundle JS and assets in release mode
  • bundleInRelease: true,
  • // whether to bundle JS and assets in another build variant (if configured).
  • // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
  • // The configuration property can be in the following formats
  • // 'bundleIn${productFlavor}${buildType}'
  • // 'bundleIn${buildType}'
  • // bundleInFreeDebug: true,
  • // bundleInPaidRelease: true,
  • // bundleInBeta: true,
  • // whether to disable dev mode in custom build variants (by default only disabled in release)
  • // for example: to disable dev mode in the staging build type (if configured)
  • devDisabledInStaging: true,
  • // The configuration property can be in the following formats
  • // 'devDisabledIn${productFlavor}${buildType}'
  • // 'devDisabledIn${buildType}'
  • // the root of your project, i.e. where "package.json" lives
  • root: "../../",
  • // where to put the JS bundle asset in debug mode
  • jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
  • // where to put the JS bundle asset in release mode
  • jsBundleDirRelease: "$buildDir/intermediates/assets/release",
  • // where to put drawable resources / React Native assets, e.g. the ones you use via
  • // require('./image.png')), in debug mode
  • resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
  • // where to put drawable resources / React Native assets, e.g. the ones you use via
  • // require('./image.png')), in release mode
  • resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
  • // by default the gradle tasks are skipped if none of the JS files or assets change; this means
  • // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
  • // date; if you have any other folders that you want to ignore for performance reasons (gradle
  • // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
  • // for example, you might want to remove it from here.
  • inputExcludes: ["android/", "ios/"],
  • // override which node gets called and with what additional arguments
  • nodeExecutableAndArgs: ["node"],
  • // supply additional arguments to the packager
  • extraPackagerArgs: []
  • ]
    */

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

project.ext.reanimated = [
buildFromSource: true
]

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

/**

  • Set this to true to create two separate APKs instead of one:
    • An APK that only works on ARM devices
    • An APK that only works on x86 devices
  • The advantage is the size of the APK is reduced by about 4MB.
  • Upload all the APKs to the Play Store and people will download
  • the correct one based on the CPU architecture of their device.
    */
    def enableSeparateBuildPerCPUArchitecture = false

/**

  • Run Proguard to shrink the Java bytecode in release builds.
    */
    def enableProguardInReleaseBuilds = true

/**

  • The preferred build flavor of JavaScriptCore.
  • For example, to use the international variant, you can use:
  • def jscFlavor = 'org.webkit:android-jsc-intl:+'
  • The international variant includes ICU i18n library and necessary data
  • allowing to use e.g. Date.toLocaleString and String.localeCompare that
  • give correct results when using with locales other than en-US. Note that
  • this variant is about 6MiB larger per architecture than default.
    */
    def jscFlavor = 'org.webkit:android-jsc:+'

/**

  • Whether to enable the Hermes VM.
  • This should be set on project.ext.react and mirrored here. If it is not set
  • on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
  • and the benefits of using Hermes will therefore be sharply reduced.
    */
    def enableHermes = project.ext.react.get('enableHermes', false)

/**

  • Architectures to build native code for in debug.
    */
    def nativeArchitectures = project.getProperties().get('reactNativeDebugArchitectures')

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 {
/**

  • Returns the name of the main component registered from JavaScript. This is used to schedule
  • rendering of the component.
    */
    @OverRide
    protected String getMainComponentName() {
    return "vsApp";
    }

@OverRide
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(null);
}
}
`

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
Copy link
Author

Please add a minimal reproducer.

Adicionado no comentário acima.

@migueldaipre
Copy link
Member

Please add a minimal reproducer.

Adicionado no comentário acima.

Add a GitHub repo link or expo snack.

@Giebmeyer
Copy link
Author

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
Copy link
Member

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
Copy link
Author

Ajustado.

\android\app\build.gradle

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

Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants