Closed Giebmeyer closed 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 repo under your username
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.
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?
Please add a minimal reproducer.
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
/**
react-native bundle
with the correct arguments during the Android buildapply from: "../../node_modules/react-native/react.gradle"
line.project.ext.react = [ enableHermes: true, // clean and rebuild if changing ]
project.ext.reanimated = [ buildFromSource: true ]
// apply from: '../../node_modules/react-native/react.gradle'
/**
/**
/**
def jscFlavor = 'org.webkit:android-jsc-intl:+'
Date.toLocaleString
and String.localeCompare
that/**
/**
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 {
/**
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;`
Please add a minimal reproducer.
Adicionado no comentário acima.
Please add a minimal reproducer.
Adicionado no comentário acima.
Add a GitHub repo link or expo snack.
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?
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.
Ajustado.
\android\app\build.gradle
project.ext.react = [ enableHermes: false, // changed to 'false' ]
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.
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 ? ( <>
); };
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', ), }} /> )}
); } `
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 ( <>