Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all 29478 articles
Browse latest View live

React Navigation v6 usePreventRemoveContext is undefined error

$
0
0
TypeError: (0, _$$_REQUIRE(_dependencyMap[1], "@react-navigation/native").usePreventRemoveContext) is not a function. (In '(0, _$$_REQUIRE(_dependencyMap[1], "@react-navigation/native").usePreventRemoveContext)()', '(0, _$$_REQUIRE(_dependencyMap[1], "@react-navigation/native").usePreventRemoveContext)' is undefined)This error is located at:    in NativeStackViewInner (at NativeStackView.native.tsx:420)    in RNCSafeAreaProvider (at SafeAreaContext.tsx:87)    in SafeAreaProvider (at SafeAreaProviderCompat.tsx:46)    in SafeAreaProviderCompat (at NativeStackView.native.tsx:419)    in NativeStackView (at createNativeStackNavigator.tsx:72)    in Unknown (at createNativeStackNavigator.tsx:71)    in NativeStackNavigator (at App.js:19)    in EnsureSingleNavigator (at BaseNavigationContainer.tsx:430)    in BaseNavigationContainer (at NavigationContainer.tsx:132)    in ThemeProvider (at NavigationContainer.tsx:131)    in NavigationContainerInner (at App.js:18)    in App (at renderApplication.js:50)    in RCTView (at View.js:32)    in View (at AppContainer.js:92)    in RCTView (at View.js:32)    in View (at AppContainer.js:119)    in AppContainer (at renderApplication.js:43)    in hello_world(RootComponent) (at renderApplication.js:60)

I am brand new to react-native and react navigation. I am trying to use react navigation v6 and am just running the getting started guide. I am getting this error that I have never seen before. I can run a few basic pages just fine. However, whenever I add navigation I get this unusual error. I have followed all of the guides to the best of my ability and created the original folder with the npx react-native init command. Here's a copy of my App.js file which is the only file that I have changed other than MainActivity.java, where I added the prerequiste onCreate function for React navigation v6. This is straight from their website: https://reactnavigation.org/docs/hello-react-navigation/. I genuinely have no idea why this issue is occurring. Feel free to leave feedback if you need more information. All help would be greatly appreciated.

import * as React from 'react';import { View, Text } from 'react-native';import { NavigationContainer } from '@react-navigation/native';import { createNativeStackNavigator } from '@react-navigation/native-stack';function HomeScreen() {  return (<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}><Text>Home Screen</Text></View>  );}const Stack = createNativeStackNavigator();function App() {  return (<NavigationContainer><Stack.Navigator initialRouteName="Home"><Stack.Screen name="Home" component={HomeScreen} /></Stack.Navigator></NavigationContainer>  );}export default App;

Not receiving callback in fragment for camera permission request only when integrated in a React Native app

$
0
0

I have created a Fragment that has a WebView. It receives a permission request via the website for resources (camera access). After checking permission status locally, ActivityResultLauncher’s object is received as a return value from the registerActivitForResult method at the start of the fragment.Its launch method is called and it works well and permission dialog opens but the callback for registerActivityForResult is not getting called when the user "allows" the permission.

The most important part is: that it doesn’t work only when this fragment is added as a React Native Component via createViewManager as defined on React Native docs.What’s weird is it works perfectly fine if it is used natively and is added directly on MainActivity of a native android app.

React native release build apk is not installing in real devices

$
0
0

I have an application which is currently running on react-native-cli.. Today I created a release build to test it in real device and build run successfully and got build from android/app/build/outputs/apk/release/app-release.apk

The issue is when I installed this apk in my mobile its showing app not installed..?

Any idea why this is happening..???

Here is my build.gradle file:

buildscript {    ext {        buildToolsVersion = "30.0.2"        minSdkVersion = 26        compileSdkVersion = 31        targetSdkVersion = 30        googlePlayServicesAuthVersion = "19.2.0"     }    repositories {        google()        jcenter()    }    dependencies {        classpath("com.android.tools.build:gradle:4.2.1")        // NOTE: Do not place your application dependencies here; they belong        // in the individual module build.gradle files        classpath 'com.google.gms:google-services:4.3.10'    }}allprojects {    repositories {        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()        jcenter()        maven { url 'https://www.jitpack.io' }    }}project.ext {  set('react-native', [    versions: [      // Overriding Build/Android SDK Versions      android : [        minSdk    : 24,        targetSdk : 30,        compileSdk: 31,        buildTools: "30.0.2"      ],      // Overriding Library SDK Versions      firebase: [        // Override Firebase SDK Version        bom           : "26.0.0"      ],    ],  ])}

Here is my app/build.gradle file:

apply plugin: "com.android.application"import com.android.build.OutputFileproject.ext.react = [    bundleInRelease: true,    enableHermes: true,  // clean and rebuild if changing]apply from: "../../node_modules/react-native/react.gradle"def enableSeparateBuildPerCPUArchitecture = falsedef enableProguardInReleaseBuilds = truedef jscFlavor = 'org.webkit:android-jsc:+'def enableHermes = project.ext.react.get("enableHermes", true);android {    compileSdkVersion rootProject.ext.compileSdkVersion    compileOptions {        sourceCompatibility JavaVersion.VERSION_1_8        targetCompatibility JavaVersion.VERSION_1_8    }    defaultConfig {        applicationId "com.alhub_client"        minSdkVersion rootProject.ext.minSdkVersion        targetSdkVersion rootProject.ext.targetSdkVersion        versionCode 28        versionName "1.8.15"        multiDexEnabled true    }    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('UPLOAD_KEY')) {                storeFile file(UPLOAD_KEY)                storePassword UPLOAD_STORE_PASSWORD                keyAlias UPLOAD_KEY_ALIAS                keyPassword UPLOAD_KEY_PASSWORD            }        }    }    buildTypes {        debug {            signingConfig signingConfigs.debug        }        release {            signingConfig signingConfigs.release            shrinkResources true            minifyEnabled enableProguardInReleaseBuilds            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"        }    }    // 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            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 =                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode            }        }    }}dependencies {    implementation fileTree(dir: "libs", include: ["*.jar"])    //noinspection GradleDynamicVersion    implementation "com.facebook.react:react-native:+"  // From node_modules    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {      exclude group:'com.facebook.fbjni'    }    debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {        exclude group:'com.facebook.flipper'        exclude group:'com.squareup.okhttp3', module:'okhttp'    }    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {        exclude group:'com.facebook.flipper'    }    if (enableHermes) {        def hermesPath = "../../node_modules/hermes-engine/android/";        debugImplementation files(hermesPath +"hermes-debug.aar")        releaseImplementation files(hermesPath +"hermes-release.aar")    } 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 usetask copyDownloadableDepsToLibs(type: Copy) {    from configurations.compile    into 'libs'}apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)apply plugin: 'com.google.gms.google-services'

Any suggestions will be helpful.

  • I had tried allowing permission for untrusted apk in mobile
  • Checked the memory space
  • Verified the app is not installed before

Objects are not valid as a React child (found: AxiosError: timeout of 10000ms exceeded)

$
0
0

My React native app crashes with this error (Error: Objects are not valid as a React child (found: AxiosError: timeout of 10000ms exceeded). If you meant to render a collection of children, use an array instead) when there is no internet connection

Receive Camera ACTION_NEW_PICTURE in android app

$
0
0

Aim: I want to develop an android app, which need to process/analyse the images of mobile. As soon as a image is taken directly via camera app or any other app using camera, my app needs to listen to this image event & analyse the image(by fetching the image from device storage). My app should work even if it not opened i.e. in background it should be able to listen the events.

I am new to the android space. From my so far understanding:

  1. One can't create a receiver in android manifest file(implicit broadcast) for events like ACTION_NEW_PICTURE in the latest android version.
  2. Having job scheduler, or dynamic broadcast will either defer when the event processing is going to happen or my app will only be able to listen event when app is opened.

Is there any way to git rid of above constraint?I heard from a friend, that I need to create system admin android app for this use case. Is it even possible via system admin android app? Can anyone point to articles to create dummy system admin app?

Get Marker Open Linking Google Maps React Native

$
0
0

I have this code

openGps() {    var url = 'geo:-8.4526503, 115.2353083';    this.openExternalApp(url)  }  openExternalApp(url) {    Linking.canOpenURL(url).then(supported => {      if (supported) {        Linking.openURL(url);      } else {        Alert.alert('Eror Open Google Maps');      }    });  }

When I click nothing marker appear

enter image description here

I wanna get marker in maps, anyone know URL to call?

How I get marker when call function openGps() in Android ?

Android Studio can't find runner

$
0
0

I cloned a project from git and built it in android studio without any problems but I don't have (Run app) in android studio and also when I run run-android I get this error:

Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`

but I can run my emulator from AVD manager!I did every solutions that I found with search but they didn't work for me

enter image description here

React Native Image doesn't change

$
0
0

when I open the profile tab it loads an image (profile image) from an URL and if a user wants to change his image he can but when he does the image is changed on the Server but on the App it doesn't change but if I refresh the App it does change.

The URL doesn't change when the user logs he has a image on the URL and when he updates the image the URL is the same but the picture is different.

<Image style={{height: 70, width:70,borderRadius: 35}} source={{uri:'http://********************/'+GLOBAL.api_token}} />

How to add values to app.json for android in expo managed workflow?

$
0
0

I need to add those to Android files:

android:usesCleartextTraffic="true" and <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

But I'm using managed workflow and I don't know how to add those lines to app.json file.

React native pan gesture wrapping ScrollView not working as expected on IOS

$
0
0

Goal

I want to wrap a normal ScrollView with a pan gesture from react-native-gesture-handler. The Pan Gesture should track the position of the finger without interfering with the scrolling behaviour of the ScrollView. The Gesture should therefore work simultaneously with ScrollView.

Expected result

The following code works only on android and displays the expected behaviour (tested on Galaxy S9). It shows the current position of the finger and the current state of the Pan Gesture.
While scrolling, the state should be active and the current position of the finger should be visible as seen inthis image

Code

Code can be seen here as an expo snack. It would be nice to share your solution as an expo snack too, so there is no miscommunication:)

Problem

The same code does not work on IOS devices (tested on emulator and iPhone 13). The ScrollView instantly cancels all gestures.

Question

How can I get the same behaviour on IOS?

Hints

Some things the might cause the problem or can lead to a solution

  • I know that the react-native-gesture-handler implements a custom gesture system for android but not for IOS
  • There is an option for native gestures called disallowInterruption which cancels all other gesture handlers when this NativeViewGestureHandler receives an ACTIVE state event (src). This works as expected on android but not on IOS.
  • One can set the activeOffsetXand activeOffsetY to 0 and it will only activate the pan gesture but not the ScrollView (however, when moving the finger fast up or down, it will still activate the ScrollView and not the gesture)
  • react-native-bottom-sheet allows 'special' ScrollViews in their modals. However these do not implement a swipe down gesture on the ScrollView but only on the handle. They do this by enabling and disabling the ScrollView which is not what I want. (Example code)

React Native Post Request via Fetch throws Network Request Failed

$
0
0

I've came across the following error.At the moment I developing an Android App with React Native therefore I'm planning to use fetch for doing a post request for me.

fetch("https://XXreachable-domainXX.de/api/test", {    method: "post",    body: JSON.stringify({      param: 'param',      param1: 'param',    })  })  .then((response) = > response.json())  .then((responseData) = > {    ToastAndroid.show("Response Body -> " + JSON.stringify(responseData.message), ToastAndroid.SHORT    )  })  .catch((error) = > {    console.warn(error);  });

The app now throws an error:

TypeError: Network request failed

When I change the code to a GET-Request it's working fine, in the browser with a window.alert() as a return it's cool and also the Chrome extension Postman returns data correctly.

React native check if tablet or screen in inches

$
0
0

I've established a different render logic for tablets and mobile devices. I was wondering if there is a way to get the screen size in inches or maybe even any module to automatically detect if the device is a tablet or not.

The reason I am not using the dimensions api directly to get the screen resolution is that there are many android tablets with lower resolution than many of their mobile counterparts.

Thanks.

@gorhom/react-native-bottom-sheet doesn't work on Android

$
0
0

I've been using the library to create bottom sheet modals for my react native app, but it's doesn't seem to work on Android, but on iOS it does. I used the same backdrop component and handle component suggested in the docs, and everything is contained is the provider, and SafeAreaViewmy package.json includes

"@gorhom/bottom-sheet": "^3.6.5", "react-native-reanimated": "^2.0.0",

and the code is structured like this:

<BottomSheetModal ref={reference_settings}                            index      = {1}                            enableOverDrag={true}                            onChange   = {(index) => { if(index === 0) { reference_settings.current.dismiss(); } }}                            snapPoints = {[-1, '50%', '70%']}                            backdropComponent={Backdrop}                            handleComponent  ={(props) => (<Belt {...props} />)}                            style            ={styles.sheet}><BottomSheetView style={[styles.content]}><View style={{ width, height: '100%', overflow: 'hidden', backgroundColor: scheme === 'dark' ? '#000' : '#FFF', paddingHorizontal: 10 }}>                              // the functions inside</View></BottomSheetView></BottomSheetModal>

I used the right configuration for babel for react-native-reanimated including the plugin, but it shows up and then I can't drag to close.

How to reduce audio data recorded with ENCODING_PCM_16BIT and sample rate 8000 Hz?

$
0
0

My goal is to reduce the audio data size generated by the react-native-recording.

The expected result:The audio file size should be between 5200 bytes to 5400 bytes per 1 seconds of audio / Opus Voice bit rate 5.17 KiB with sampling rate 8 kHz.

The actual result:The audio file size is 3 times the expected result. For example recording this word A guest for Mr. Jerry / 1.6 seconds of audio will have a data size roughly 28,000 bytes.

Important

I plan to write custom native module to achieve this goal. If you like, feel free to leave a link for me to read.

TL:DR

My end goal is to send the audio data through WebSocket. I deliberately remove the WebSocket.

Steps to reproduce:

  1. Add listener
  let audioInt16: number[] = [];  let listener;  React.useEffect(() => {    // eslint-disable-next-line react-hooks/exhaustive-deps    listener = Recording.addRecordingEventListener((data: number[]) => {      console.log('record', data.length);      // eslint-disable-next-line react-hooks/exhaustive-deps      audioInt16 = audioInt16.concat(data);    });    return () => {      listener.remove();    };  });
  1. Record audio
  const startAsync = async () => {    await PermissionsAndroid.requestMultiple([      PermissionsAndroid.PERMISSIONS.RECORD_AUDIO,    ]);    Recording.init({      bufferSize: 4096,      sampleRate: 8000,      bitsPerChannel: 16,      channelsPerFrame: 1,    });    Recording.start();  };
  1. Save audio
  const saveAudio = async () => {    const promise = await RNSaveAudio.saveWav(path, audioInt16);    console.log('save audio', promise, path);  };
  1. Play audio
  const playAudio = () => {    if (player.canPrepare || player.canPlay) {      player.prepare((err) => {        if (err) {          console.log(err);        }        console.log('play audio', player.duration);        player.play();      });    }  };

Google Play Store Update .apk with new keystore - React Native Expo

$
0
0

I already have an app running in the PlayStore. I built it using Java.Now, I created a different app using React Native Expo, and it is much better. However, when I try to update the old one in the PlayStore I get these error messages:

You uploaded an APK that is not signed with the upload certificate. You must use the same certificate. The upload certificate has fingerprint:SHA1: 53:85:93:54:AC:9D:6C:E1:18:F6:1D:F8:A1:6C:FF:90:1B:05:A3:FBand the certificate used to sign the APK that you uploaded has fingerprint:SHA1: 1F:19:B9:47:1B:EF:7C:AB:FB:A1:27:C4:1D:40:4B:EC:1B:0D:64:34

Version code 2 has already been used. Try another version code.

Your APK or Android App Bundle needs to have the package name moutamadris.ma.

I can fix the version and package name issues; however, I have no idea how to tackle the first problem! I already had a keystore from the first app, uploaded it in expo; and then rebuilt the app and uploaded but it didn't work.

Can anyone please help me on this one?Thanks


HOW TO PASS OTP KEYWORD AS PARAMS AND USE IN ANOTHER PAGE [closed]

$
0
0

can you guys please explain me how can i pass my otp as params and validate my otp

Unexpected token no stack - android emulator expo

$
0
0

I get this weird message in android emulator whilst running expo, any idea whats causing this? There seems to be no real stack trace. If I run in debug mode, it works fine which is odd. There's definitely enough space on the hard disk so don't think that's an issue either.

enter image description here

Package.json

{"name": "project","version": "1.0.0","main": "node_modules/expo/AppEntry.js","scripts": {"start": "expo start","android": "expo start --android","ios": "expo start --ios","web": "expo start --web","eject": "expo eject"  },"dependencies": {"@expo-google-fonts/kanit": "^0.2.2","@expo-google-fonts/oxanium": "^0.2.2","@fortawesome/fontawesome-svg-core": "^6.1.1","@fortawesome/free-solid-svg-icons": "^6.1.1","@fortawesome/react-native-fontawesome": "^0.3.0","@react-navigation/drawer": "^6.4.3","@react-navigation/native": "^6.0.11","@react-navigation/native-stack": "^6.7.0","axios": "^0.27.2","expo": "^46.0.0","expo-status-bar": "~1.4.0","react": "18.0.0","react-dom": "18.0.0","react-native": "0.69.4","react-native-dotenv": "^3.3.1","react-native-reanimated": "~2.9.1","react-native-safe-area-context": "4.3.1","react-native-screens": "~3.15.0","react-native-svg": "12.3.0","react-native-web": "~0.18.7","react-native-webview": "11.23.0","react-native-youtube-iframe": "^2.2.2"  },"devDependencies": {"@babel/core": "^7.18.6","@babel/preset-react": "^7.18.6","eslint": "^8.19.0","eslint-plugin-react": "^7.30.1","eslint-plugin-react-native": "^4.0.0"  },"private": true}

babel.config.js

module.exports = function(api) {  api.cache(true);  return {    presets: ['babel-preset-expo'    ],    plugins: ['react-native-reanimated/plugin','module:react-native-dotenv'    ]  };};

React native reanimated package is giving error on react-navigation/drawer?

$
0
0

React native is drawer is giving me errors,I don't think my code is wrong here because I am following the guidelines from react native official websitelink here

Here is my package json

"@react-native-community/masked-view": "^0.1.10","@react-navigation/drawer": "^5.12.4","@react-navigation/native": "^5.9.3","@react-navigation/stack": "^5.14.3","react": "16.13.1","react-native": "0.63.4","react-native-gesture-handler": "^1.10.3","react-native-paper": "^4.7.2","react-native-reanimated": "^2.0.0","react-native-safe-area-context": "^3.2.0","react-native-screens": "^2.18.1"

As you can see I think react-native-reanimated is upgraded to 2.0 not too long ago.

Here is my code from official website.

import 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();const App = () => {  return (<NavigationContainer><Drawer.Navigator initialRouteName="Home"><Drawer.Screen name="Home" component={HomeScreen} /><Drawer.Screen name="Notifications" component={NotificationsScreen} /></Drawer.Navigator></NavigationContainer>  );};export default App;

Since I am starting a new project there is no other files.

Whenever the app is involve with react native/drawer & and react-native-reanimated

This error log is given

Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'NativeReanimated' could not be found. Verify that a module by this name is registered in the native binary.

Is the package in the wrong here or am I in the wrong here. Can anyone help me verify this error?I already restarted metro server many times

Android assets not included in build; doesnt load css and js

$
0
0

I have added my my static websites into android/app/src/main/assets to use them in a webview in android.This works but only partly. I have tested several dirs for different sites and most of the time only index.html is actually loaded into the android assets.

example 1:

this is what is in /assets

this is what gets loaded

example 2:

this is what is in /assets

this is what gets loaded

Is this normal?How can i fix it?

if i run npx react-native doctor i get

Android✓ JDK✖ Android Studio - Required for building and installing your app on Android✓ Android SDK - Required for building and installing your app on Android✓ ANDROID_HOME

Does it have something to do with the missing android studio? everything else runs normally.

requireNativeComponent: "RNSScreenStackHeaderConfig" was not found in the UIManager when running android app

$
0
0

When running an application on android i get this error. It builds correctly but crashes with exception. I have installed React-native-screens, @React-native/navigation and the dependencies listed on https://reactnavigation.org/docs/getting-started/

com.facebook.react.common.JavascriptException: Invariant Violation: requireNativeComponent: "RNSScreenStackHeaderConfig" was not found in the UIManager.

This error is located at:    in RNSScreenStackHeaderConfig    in Unknown    in RNSScreen    in N    in ForwardRef    in y    in E    in RNSScreenStack    in w    in RNCSafeAreaProvider    in Unknown    in v    in Unknown    in Unknown    in Unknown    in ForwardRef    in Unknown    in ForwardRef    in p    in c    in P    in RCTView    in View    in RCTView    in View    in h, stack:

It builds and runs on iOS fine but when running on android it crashes completely. Is there something I am overlooking here?

This is my Package json.

{"name": "<myprojectname>","version": "0.0.1","private": true,"scripts": {"android": "react-native run-android","ios": "react-native run-ios","start": "react-native start","test": "jest","lint": "eslint .","postinstall": "npx jetify","android:bundle:debug": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/"  },"dependencies": {"@react-native-community/async-storage": "^1.8.1","@react-native-community/masked-view": "^0.1.11","@react-navigation/native": "^6.0.2","@react-navigation/native-stack": "^6.1.0","@react-navigation/stack": "^6.0.7","adbkit": "^2.11.1","moment": "^2.24.0","react": "16.9.0","react-native": "0.63.0","react-native-calendar-strip": "^1.4.1","react-native-calendars": "^1.264.0","react-native-firebase": "^5.6.0","react-native-gesture-handler": "^1.10.3","react-native-reanimated": "^2.2.0","react-native-safe-area-context": "^3.3.1","react-native-screens": "3.1.1","react-native-snap-carousel": "^3.8.4","react-native-vector-icons": "^6.6.0","react-navigation": "^4.4.4","react-navigation-stack": "^2.10.4","react-redux": "^7.2.0","redux": "^4.0.5"  },"devDependencies": {"@babel/core": "^7.15.0","babel-jest": "24.9.0","eslint": "^6.5.1","jest": "24.9.0","jetifier": "^1.6.5","metro-react-native-babel-preset": "^0.66.2","react-test-renderer": "16.9.0"  },"jest": {"preset": "react-native"  }}

I dont really know how to solve this, have tried removing caches, restarting metro, deleting node modules and all "related" errors. This error even happens when I create a fresh project and try installing and using the navigation library.

This is my entrypoint, example copied from React-navigation snack.

import * as React from 'react';import { View, Text } from 'react-native';import { NavigationContainer } from '@react-navigation/native';import { createNativeStackNavigator } from '@react-navigation/native-stack';import { enableScreens } from 'react-native-screens';enableScreens(true);function HomeScreen() {  return (<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}><Text>Home Screen</Text></View>  );}function DetailsScreen() {  return (<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}><Text>Details Screen</Text></View>  );}const Stack = createNativeStackNavigator();function AppTest() {  return (<NavigationContainer><Stack.Navigator       screenOptions={{        headerStyle: {          backgroundColor: '#f4511e',        },        headerTintColor: '#fff',        headerTitleStyle: {          fontWeight: 'bold',        },      }}      initialRouteName="Home"><Stack.Screen  options={{ title: 'My home' }} name="Home" component={HomeScreen} /><Stack.Screen  options={{ title: 'My home' }} name="Details" component={DetailsScreen} /></Stack.Navigator></NavigationContainer>  );}export default AppTest;

Any suggestions?

Viewing all 29478 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>