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

How do i integrate python script in a react-native app targeted for android

$
0
0

Guidance needed. I have a Python script that uses MediaPipe and OpenCV modules to map a 2D image of clothing on the person's body based on the extracted coordinates. This is done in real-time (tested on a webcam). I have a react-native-based app on the other side. I want to integrate this script in the app such that the script is run on the mobile camera and the same functionality is achieved within the app. Considering the real-time nature of this script, I have failed to find a solution yet.

Since, media pipe and OpenCV are Python-specific packages, bringing their functionality to an Android app has been challenging. I have tried using Google's media pipe repo for Android, however, it contains example apps which i have not been able to alter for my use case and opencv remains a challenge.


How to Manage Temporary and Permanent Files in React Native App

$
0
0

I'm developing a React Native app where users can select photos using an image picker. I'm currently storing these photos in a temporary directory on the device's filesystem, but I'm concerned about their persistence across app sessions and device reboots.

  1. What is the best practice for managing temporary files in a React Native app?
  2. How can I ensure that files stored in a temporary directory are reliably deleted when no longer needed?
  3. Is it advisable to copy temporary files to a permanent location for long-term storage, and if so, how can I achieve this in React Native?
  4. What are the potential drawbacks or risks of relying on temporary files for long-term storage in a React Native app?

I'd appreciate any insights or advice on how to effectively manage files in my React Native app to ensure data integrity and reliability across different device configurations and usage scenarios.

How to Implement Drag-and-Drop Functionality for Images in React Native?

$
0
0

I'm working on a React Native app where I need to implement drag-and-drop functionality for images. Specifically, I want users to be able to rearrange the order of images by dragging and dropping them within a container.I've searched for tutorials and libraries, but I haven't found a clear solution for implementing this in a React Native app. Can someone provide guidance on how to achieve drag-and-drop functionality for images in React Native?

Ideally, I'm looking for a solution that:

  1. Allows users to drag and drop images within a container.
  2. Provides smooth and responsive dragging behavior.
  3. Is compatible with React Native components, such as <Image />.

Any advice, code examples, or recommended libraries would be greatly appreciated. Thank you!

Exclude/Include some url paths to open the apps - Deep Linking

$
0
0

I have implemented deep link in my manifest which is working fine with all the URLs.I have a different domain and 2 below URLs from that I need to include and exclude URLs to redirect to the app

exclude:

https://www.example.com/talks/view_all.aspx

include:

https://www.example.com/talks/item1-chat/https://www.example.com/talks/item2-chat/

Manifest intent filter

<intent-filter android:autoVerify="true"><action android:name="android.intent.action.VIEW" /><category android:name="android.intent.category.DEFAULT" /><category android:name="android.intent.category.BROWSABLE" /><data android:scheme="https" /><data android:host="www.example.com" /><data android:pathPattern="/talks/..*" /></intent-filter>

As of now, all the URLs redirect to the application. I want to restrict some of the URLs as I mentioned above.

Thank you!

react-native-webview onShouldStartLoadWithRequest return false but no work

$
0
0

in my react-native project, currently i want to block the some url and then redirect to my app another page.but have the problem egwhen in Screen A the onShouldStartLoadWithRequest block the url "https://www.google.com.hk/imghp", return false and navigate to the Screen B. it can redirect (open the Screen B) but the Screen A still redirect to the url.so, the Screen A and Screen B currently the url is same "https://www.google.com.hk/imghp"

the below is my code.

import React, {useState} from 'react';import WebView, {WebViewNavigation} from 'react-native-webview';import {useNavigation} from '@react-navigation/native';export const WebviewPage = ({}: {}) => {  const navigation = useNavigation();  const [webviewUrl, setWebviewUrl] = useState<string>('https://www.google.com',  );  const onShouldStartLoadWithRequest = (request: WebViewNavigation) => {    if (request.url.includes('mail')) {      navigation.navigate(...(['MyEmailScreen', {}] as never));      return false;    }    return true;  };  return (<><WebView        source={{uri: webviewUrl}}        setSupportMultipleWindows={false}        onShouldStartLoadWithRequest={onShouldStartLoadWithRequest}      /></>  );};

npm package:

  • "react": "18.2.0"
  • "react-native": "0.72.5"
  • "react-native-webview":"^13.6.2"
  • "@react-navigation/native": "^6.1.9"
  • "@react-navigation/native-stack": "^6.9.16"
  • "@react-navigation/stack": "^6.3.20"

try

  • in andorid not work, ios no this problem
  • if i set the timeout for the navigate, it work, Screen A keep in original url, Screen B is navigate and the url is "https://www.google.com.hk/imghp"

eg.

  const onShouldStartLoadWithRequest = (request: WebViewNavigation) => {    if (request.url.includes('mail')) {      setTimeout(()=> {         navigation.navigate(...(['MyEmailScreen', {}] as never));      }, 500);      return false;    }    return true;  };

Could not find androidx.tonyodev.fetch2:xfetch2:3.1.4

$
0
0

Started getting this error today (without any changes in the project).

Could not find androidx.tonyodev.fetch2:xfetch2:3.1.4

It seems this package is no longer available in Jcenter.

Updating to 3.1.5 or 3.1.6 doesn't fix the issue.

This package is part of react-native-background-downloader

How do I detect if the app uses React Native, given APK file?

$
0
0

I downloaded APK file from Google Play, and want to know if the develop of the application have used React Native library. What's a quick and stable way to do that? (Would be even better if it's something I can potentially automate later - but such automation itself is out of scope of this question.)

Could not find com.google.vr:sdk-base:1.180.0

$
0
0

I am trying to render panaroma image on my react-native application. Tried few packages, but most of the devs suggesting this https://github.com/lightbasenl/react-native-panorama-view.

Since, I have made some changes on build.gradlew for the package. I couldn't able to build the app. Is there anyway to fix this issue

build.gradle (app)

buildscript {    ext {        buildToolsVersion = "34.0.0"        minSdkVersion = 23        compileSdkVersion = 34        targetSdkVersion = 34        ndkVersion = "26.1.10909125"        kotlinVersion = "1.9.22"    }    repositories {        flatDir {            dirs 'libs'        }        google()        mavenCentral()    }    dependencies {        classpath("com.android.tools.build:gradle")        classpath("com.facebook.react:react-native-gradle-plugin")        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")    }}subprojects { subproject ->    if(project['name'] == 'lightbase_react-native-panorama-view'){        project.configurations { compile { } }    }}apply plugin: "com.facebook.react.rootproject"

build.gradle (react-native-panorama-view)

buildscript {    repositories {        google()        mavenCentral()    }    dependencies {        // Matches recent template from React Native (0.59)        // https://github.com/facebook/react-native/blob/0.59-stable/template/android/build.gradle#L16        classpath 'com.android.tools.build:gradle:3.3.2'    }}apply plugin: 'com.android.library'apply plugin: 'maven-publish'def safeExtGet(prop, fallback) {    rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback}// Matches values in recent template from React Native (0.59)// https://github.com/facebook/react-native/blob/0.59-stable/template/android/build.gradle#L5-L9def DEFAULT_COMPILE_SDK_VERSION = 28def DEFAULT_BUILD_TOOLS_VERSION = "28.0.3"def DEFAULT_MIN_SDK_VERSION = 19def DEFAULT_TARGET_SDK_VERSION = 28android {  compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)  buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)  defaultConfig {    minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION)    targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)    versionCode 1    versionName "1.0"  }  lintOptions {    abortOnError false  }}repositories {    maven {        // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm        // Matches recent template from React Native (0.59)        // https://github.com/facebook/react-native/blob/0.59-stable/template/android/build.gradle#L30        url "$projectDir/../node_modules/react-native/android"    }    mavenCentral()}dependencies {    implementation 'com.facebook.react:react-native:+'    // Panorama    implementation "androidx.annotation:annotation:1.1.0"    implementation 'com.google.vr:sdk-base:1.180.0'    implementation 'com.google.vr:sdk-common:1.180.0'    implementation 'com.google.vr:sdk-commonwidget:1.180.0'    implementation 'com.google.vr:sdk-panowidget:1.180.0'    implementation 'commons-io:commons-io:2.5'}def configureReactNativePom(def pom) {    def packageJson = new groovy.json.JsonSlurper().parseText(file('../package.json').text)    pom.project {        name packageJson.title        artifactId packageJson.name        version = packageJson.version        group = "nl.lightbase"        description packageJson.description        url packageJson.repository.baseUrl        licenses {            license {                name packageJson.license                url packageJson.repository.baseUrl +'/blob/master/'+ packageJson.licenseFilename                distribution 'repo'            }        }        developers {            developer {                id packageJson.author.username                name packageJson.author.name            }        }    }}afterEvaluate { project ->    // some Gradle build hooks ref:    // https://www.oreilly.com/library/view/gradle-beyond-the/9781449373801/ch03.html    task androidJavadoc(type: Javadoc) {        source = android.sourceSets.main.java.srcDirs        classpath += files(android.bootClasspath)        classpath += files(project.getConfigurations().getByName('compile').asList())        include '**/*.java'    }    task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {        archiveClassifier  = 'javadoc'        from androidJavadoc.destinationDir    }    task androidSourcesJar(type: Jar) {        archiveClassifier  = 'sources'        from android.sourceSets.main.java.srcDirs        include '**/*.java'    }    android.libraryVariants.all { variant ->        def name = variant.name.capitalize()        def javaCompileTask = variant.javaCompileProvider.get()        task "jar${name}"(type: Jar, dependsOn: javaCompileTask) {            from javaCompileTask.destinationDir        }    }    artifacts {        archives androidSourcesJar        archives androidJavadocJar    }    task installArchives(type: Upload) {        configuration = configurations.archives        repositories{            mavenDeployer {                repository url: "file://${projectDir}/../android/maven"                configureReactNativePom pom            }}    }}

Having api call data rendering issue on React native 0.64.4

$
0
0

I have an issue on API call using axios or fetch method in react native version 0.64.4 here I'm using redux-sage and yield method to load the data on screen.

Need to render & show the data within 2 seconds but it takes more than 10 seconds, this is my issue.

Android Emulator is not connecting To Internet (No Internet Connection)

$
0
0

Android Emulator is not connecting to Internet. Wifi inside emulator says No Internet. Tried all possible solutions from all links, websites, and even from youtube. Still no solution. Please help

Tried installing new android studio, new emulator, google dns etc etc

What is the use of "style" prop in material top tab navigator in react navigation (react native)?

$
0
0

So, I am new to react native. While developing a mini project, I faced a styling problem in material top tab navigator. It has a style prop, but when I am adding style, there is not change in top navigator. But I can change the styling of top navigator using

screenOption={{ topBarStyle: { CSS styling} }

So my doubt is basically what's the use/purpose of style prop in material top tab navigator?style prop in material top tab navigator

I tried to search the issue on internet and GPT but failed to get a clear explanation. Also GPT is suggestion to use tapBarOption which I cannot find in docs.

React Native Build Issue - Build Failed

$
0
0

I have a project in expo which i move to react native cli but after installing all dependencies it is causing issues and I am not able to build the project in debug mode either. Issues showing in logs are:

1:> Task :app:compileDebugJavaWithJavac FAILED    w: Detected multiple Kotlin daemon sessions at build\kotlin\sessions

2:

android\app\src\main\java\com\meetkor\MainActivity.java:33: error: cannot find symbol    return new ReactActivityDelegateWrapper(this, BuildConfig.IS_NEW_ARCHITECTURE_ENABLED, DefaultReactActivityDelegate(this, getMainComponentName(), DefaultNewArchitectureEntryPoint.getFabricEnabled()));                                                                                           ^  symbol:   method DefaultReactActivityDelegate(MainActivity,String,boolean)  location: class MainActivity

I tried different solutions like deleting node_modules and reinstalling them. Rebuilding the project as well by invaliding caches and restart in android studio but no luck.

android/build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.buildscript {    ext {        buildToolsVersion = "33.0.0"        minSdkVersion = 21        compileSdkVersion = 33        targetSdkVersion = 33        // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.        ndkVersion = "23.1.7779620"    }    repositories {        google()        mavenCentral()    }    dependencies {        classpath("com.android.tools.build:gradle")        classpath("com.facebook.react:react-native-gradle-plugin")    }}

android/app/build.gradle

apply plugin: "com.android.application"apply plugin: "com.facebook.react"/** * This is the configuration block to customize your React Native Android app. * By default you don't need to apply any configuration, just uncomment the lines you need. */react {    /* Folders */    //   The root of your project, i.e. where "package.json" lives. Default is '..'    // root = file("../")    //   The folder where the react-native NPM package is. Default is ../node_modules/react-native    // reactNativeDir = file("../node_modules/react-native")    //   The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen    // codegenDir = file("../node_modules/@react-native/codegen")    //   The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js    // cliFile = file("../node_modules/react-native/cli.js")    /* Variants */    //   The list of variants to that are debuggable. For those we're going to    //   skip the bundling of the JS bundle and the assets. By default is just 'debug'.    //   If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.    // debuggableVariants = ["liteDebug", "prodDebug"]    /* Bundling */    //   A list containing the node command and its flags. Default is just 'node'.    // nodeExecutableAndArgs = ["node"]    //    //   The command to run when bundling. By default is 'bundle'    // bundleCommand = "ram-bundle"    //    //   The path to the CLI configuration file. Default is empty.    // bundleConfig = file(../rn-cli.config.js)    //    //   The name of the generated asset file containing your JS bundle    // bundleAssetName = "MyApplication.android.bundle"    //    //   The entry file for bundle generation. Default is 'index.android.js' or 'index.js'    // entryFile = file("../js/MyApplication.android.js")    //    //   A list of extra flags to pass to the 'bundle' commands.    //   See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle    // extraPackagerArgs = []    /* Hermes Commands */    //   The hermes compiler command to run. By default it is 'hermesc'    // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"    //    //   The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"    // hermesFlags = ["-O", "-output-source-map"]    //    // Added by install-expo-modules    entryFile = file(["node", "-e", "require('expo/scripts/resolveAppEntry')", rootDir.getAbsoluteFile().getParentFile().getAbsolutePath(), "android", "absolute"].execute(null, rootDir).text.trim())    cliFile = new File(["node", "--print", "require.resolve('@expo/cli')"].execute(null, rootDir).text.trim())    bundleCommand = "export:embed"}/** * Set this to true to Run Proguard on Release builds to minify the Java bytecode. */def enableProguardInReleaseBuilds = false/** * The preferred build flavor of JavaScriptCore (JSC) * * 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:+'def isNewArchitectureEnabled() {    // To opt-in for the New Architecture, you can either:    // - Set `newArchEnabled` to true inside the `gradle.properties` file    // - Invoke gradle with `-newArchEnabled=true`    // - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`    return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"}android {    ndkVersion rootProject.ext.ndkVersion    compileSdkVersion rootProject.ext.compileSdkVersion    namespace "com.meetkor"    defaultConfig {        applicationId "com.meetkor"        minSdkVersion rootProject.ext.minSdkVersion        targetSdkVersion rootProject.ext.targetSdkVersion        versionCode 1        versionName "1.0"        buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()    }    signingConfigs {        debug {            storeFile file('debug.keystore')            storePassword 'android'            keyAlias 'androiddebugkey'            keyPassword 'android'        }    }    buildTypes {        debug {            signingConfig signingConfigs.debug        }        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"        }    }}dependencies {    // The version of react-native is set by the React Native Gradle Plugin    implementation("com.facebook.react:react-android")    // implementation("com.facebook.react.react-native:0.72.3")    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    }}apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

How to setup debugging in Visual Studio Code for React Native?

$
0
0

I searched but I can't find any external sources except for Visual Studio Code docs, and just following those docs doesn't allow me to debug React Native apps both in iOS and Android.

I keep getting the error message (this one for Android, for iOS, is similar:

[vscode-react-native] [Warning] Couldn't import script athttp://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false.Debugging won't work: Try reloading the JS from inside the app, orReconnect the VS Code debugger: path must be a string

My launch.json file as:

{"version": "0.2.0","configurations": [        {"name": "Debug Android","program": "${workspaceRoot}/.vscode/launchReactNative.js","type": "reactnative","request": "launch","platform": "android","internalDebuggerPort": 9090,"sourceMaps": true,"outDir": "${workspaceRoot}/.vscode/.react"        },        {"name": "Debug iOS","program": "${workspaceRoot}/.vscode/launchReactNative.js","type": "reactnative","request": "launch","platform": "ios","target": "iPhone 6s","internalDebuggerPort": 9090,"sourceMaps": true,"outDir": "${workspaceRoot}/.vscode/.react"        },        {"name": "Attach to packager","program": "${workspaceRoot}/.vscode/launchReactNative.js","type": "reactnative","request": "attach","internalDebuggerPort": 9090,"sourceMaps": true,"outDir": "${workspaceRoot}/.vscode/.react"        },        {"name": "Debug in Exponent","program": "${workspaceRoot}/.vscode/launchReactNative.js","type": "reactnative","request": "launch","platform": "exponent","internalDebuggerPort": 9090,"sourceMaps": true,"outDir": "${workspaceRoot}/.vscode/.react"        }    ]}

I'm trying to debug both in the iOS simulator and in an Android device but the process never attaches to the external JS debugger.

I cannot find any good no code app builders , would u like to suggest [closed]

$
0
0

I am looking for a no code app builder to build my own app which is going to help content creators . I have about 3-4 months of experience in react native .

just some helpful no code app builders which will really help me .

React Native - How to show scrollbar in TextInput on Android

$
0
0

I have a text input on android and I'd like for it to show the scroll indicator, however it never does, even when scrolling. I've seen people ask about this on ScrollView's but not on TextInput's

This functionality is not mentioned here https://reactnative.dev/docs/textinput

<TextInput          ref={ref}          textAlignVertical="top"          margin={5}          flex={1}          minHeight={60}          autoFocus={false}          multiline={true}          padding={2}          maxLength={100}          value={noteText}          onChangeText={setNoteText}          placeholder={`Input text here`}        />

ReactNative can't locate Android SDK

$
0
0

I've followed the installation instructions for ReactNative on the official site but can't get my project to build and install on any device. The issue seems to be that ReactNative can't seem to locate my Android SDK.

If I open the Android specific part of the project in Android Studio I can start the app, so the SDK is properly installed. Maybe related is also that I'm working on a Flutter app simultaneously and Flutter has no problems locating the Android SDK.

Running nix react-native doctor gives me the following:

Common✓ Node.js✓ yarn✓ Watchman - Used for watching changes in the filesystem when in development modeAndroid✓ JDK✓ Android Studio - Required for building and installing your app on Android✖ Android SDK - Required for building and installing your app on Android   - Versions found: N/A   - Version supported: 29.0.2✓ ANDROID_HOMEiOS✓ Xcode - Required for building and installing your app on iOS✓ CocoaPods - Required for installing iOS dependencies✓ ios-deploy - Required for installing your app on a physical device with the CLIErrors:   1Warnings: 0Attempting to fix 1 issue...Android✖ Android SDK   Read more about how to download Android SDK at https://reactnative.dev/docs/getting-started

However trying to "fix" the issue just takes me to the getting started page, and as I mentioned before I've done the installation exactly as described. I even tried removing everything related to Android from my computer and reinstalling everything from scratch.

Runnit nix react-native info gives me the following:

info Fetching system and libraries information...System:    OS: macOS 10.15.4    CPU: (8) x64 Intel(R) Core(TM) i7-3720QM CPU @ 2.60GHz    Memory: 1.97 GB / 16.00 GB    Shell: 5.7.1 - /bin/zsh  Binaries:    Node: 12.16.3 - /usr/local/bin/node    Yarn: 1.22.4 - /usr/local/bin/yarn    npm: 6.14.4 - /usr/local/bin/npm    Watchman: 4.9.0 - /usr/local/bin/watchman  Managers:    CocoaPods: 1.9.3 - /usr/local/bin/pod  SDKs:    iOS SDK:      Platforms: iOS 13.5, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2    Android SDK: Not Found  IDEs:    Android Studio: 4.0 AI-193.6911.18.40.6514223    Xcode: 11.5/11E608c - /usr/bin/xcodebuild  Languages:    Java: 14.0.1 - /usr/bin/javac    Python: 2.7.16 - /usr/bin/python  npmPackages:    @react-native-community/cli: Not Found    react: 16.11.0 => 16.11.0    react-native: 0.62.2 => 0.62.2  npmGlobalPackages:    *react-native*: Not Found

Which just further "proves" that ReactNative can't find the Android SDK.

What I've tried so far:

Adding a local.properties with the content:

sdk.dir=/Users/[username]/Library/Android/sdk

(And yes the folder exists and is correct, it's the same one set in Android Studio)

Updating the .zshrc with:

export ANDROID_HOME=$HOME/Library/Android/sdkexport ANDROID_SDK_ROOT=$HOME/Library/Android/sdkexport PATH=$PATH:$ANDROID_HOME/emulatorexport PATH=$PATH:$ANDROID_HOME/toolsexport PATH=$PATH:$ANDROID_HOME/tools/binexport PATH=$PATH:$ANDROID_HOME/platform-tools

And in that sdk-folder (in platforms) I have android-28, android-29 and android-30.I've also (of course) looked at a number of posts here from people with the same issue, but one of these two fixes almost always seems to solve the issue, however it doesn't work for me. What else is there to test?

UPDATE:I can also add that when running npx react-native run-android and tget the error: Task 'installDebug' not found in project ':app'.. But this problem should also be solved with the properties.local, which doesn't work for me.

Internet/Wifi/MobileData not working on android emulator (MacOS M1)

$
0
0

When running android emulator on MacOS with M1 chip, neither emulator wifi or mobile data seems to work.Connection says No internet on the dropdown.

I have to keep react-app-env.d.ts file Open in VS Code in order for my component to not say Cannot find module '../../assets/icon.png'

$
0
0

I have a react-app-env.d.ts file with a bunch of declarations to handle different image extension types. But as soon as I close this tab (in VS Code), my component where I am importing an icon, it complains that Cannot find module... so it seems that I need to leave the react-app-env.d.ts file open to avoid the Lint or VS Code error. This is so strange, im sure someone knows why

I thought **app-env.d.ts file would be sufficient for "Cannot find module..." error when importing icons

Issue while uploading file to server android react native

$
0
0
async function startRecording() {    try {      if (permissionResponse?.status !== 'granted') {        console.log('Requesting permission..');        await requestPermission();      }      await Audio.setAudioModeAsync({        allowsRecordingIOS: true,        playsInSilentModeIOS: true,      });      console.log('Starting recording..');      const { recording } = await Audio.Recording.createAsync(        Audio.RecordingOptionsPresets.HIGH_QUALITY      );      setRecording(recording);      setIsRecording(true);      console.log('Recording started');    } catch (err) {      console.error('Failed to start recording', err);    }  }  async function stopRecording() {    console.log('Stopping recording..');    setIsRecording(false);    setRecording(undefined);    await recording.stopAndUnloadAsync();    await Audio.setAudioModeAsync({      allowsRecordingIOS: false,    });    const uri = recording.getURI();    setUri(uri);    setTimer(0);    console.log('Recording stopped and stored at', uri);  }  const handleSubmit = () => {    let convertedUri = uri;    // if (Platform.OS === 'android') {    //   convertedUri = uri.replace('file://', '');    // }    const formData = new FormData();    formData.append('session_name', textInputValue);    formData.append('session_audio', {      uri: convertedUri,      type: 'audio/m4a',      name: 'test.m4a',    } as any);    mutate({ assets: formData });    setUri('');    setModalVisible(false);    setTextInputValue('');  };

`Recording audio in my Expo app works fine, and the file is saved locally. However, when I try to send it to the server, I'm getting an error saying it's not an audio file. Any ideas why this might be happening?

server accepts m4a file since both android and ios are creating m4a mime types files and in ios the code is working but for android the server responding as this is not an audio file`

how to recover space from Xcode and Android Studio on Mac

$
0
0

I'm taking a beginner's course on iOS/Android development using React Native. My system is a 2018 Macbook Pro running Ventura 13.6.6. After installing the required developer tools I had over 110 GB of available space on the internal SSD.

I'm working with a simple "Hello World!" app. Each time I launch the Simulators, I see roughly 10 GB of available space disappear, as reported by the status bar of an open Finder window. When I close the simulators the space isn’t immediately recovered. On occasion, when I restart my machine I see some of it recovered, but there is a cumulative loss over just a few sessions. I have roughly 58 GB remaining. I've lost over 52 GB so far — all for one tiny, useless project! Where did it go? My progress will be cut short if I don't find the cause and solution soon.

I have already deleted the Xcode cache. It was only reporting about 3.5 GB and deleting it didn’t save me any space. (It did solve a problem where the OS was reporting "unable to build simulator" for whatever reason.)

My steps are to:

  • launch the iOS and Android Simulators
  • run npx react-native run-ios to load the app into the iOS simulator
  • press a to open the app in the Android.

It’s the most reliable way I’ve found to get the apps to display in both without errors.

Viewing all 29644 articles
Browse latest View live


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