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

How to create view A closed then view B needs to show using react native?

$
0
0

In my scenario, I am creating single page two views. View A and View B, Here, I am maintaining two views A and B in a function call with separate render. View A having close button once its clickable enabled then View A needs to hide and View B needs to render. How to achieve this?

Main RenderRenderMain() {      return (<View>………….</View>        {this.renderViewA()} // Here rendering view A on main view)}View A Function renderViewA() {      return (<Overlay>…………. // Here rendering View A close click to hide View A and show View B</Overlay>)}View B FunctionrenderViewB() {      return (<Overlay>………….</Overlay>)}

React Native 0.62.2 crashes on Android api 19

$
0
0

I created a react native project and tried to run it on emulator with android 4.4 (api 19) but it builds successfully but not able to open app.

can't run the appThis is my package.json libs:

"dependencies": {"react": "16.11.0","react-native": "0.62.2"  },"devDependencies": {"@babel/core": "^7.6.2","@babel/runtime": "^7.6.2","@react-native-community/eslint-config": "^0.0.5","babel-jest": "^24.9.0","eslint": "^6.5.1","jest": "^24.9.0","metro-react-native-babel-preset": "^0.58.0","react-test-renderer": "16.11.0"  },

and as the build.gradle looks like it should work:

buildToolsVersion = "28.0.3"minSdkVersion = 16compileSdkVersion = 28targetSdkVersion = 28

React Native Error: Unable to resolve module `./index` from `` - multiple issues

$
0
0

I use this boilerplate. I nearly got React Native working on my Android device. But somehow it fails in the last step because it does not find an index.js file. But that file is located in my project.

project structure

So when I now run this in src/

yarn react-native run-android

this is the Node CLI window:

node cli window

So my issue is:

Error: Unable to resolve module `./index` from ``:None of these files exist:  * index(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)

From the console itself I cannot see any issue:

terminal command

So somehow it does not find the index.js file for some reason.

I already tried yarn react-native start -- --reset-cache but it did not change anything.

Edit #1:

When I add a fake empty index.js file on root folder, the error is gone and in the emulator I get this one:

enter image description here

Edit #2:

I'm getting nearer to a solution. I just added this to the fake index.js in the root:

import {AppRegistry} from 'react-native';import App from './src/components/App';import {name as appName} from './src/app.json';AppRegistry.registerComponent(appName, () => App);

and there I got:

enter image description here

Edit #3:

Now it helped me to overwrite the app.json with the following:

{"name": "test","displayName": "test"}

and new error is:

enter image description here

segFault error on release apk logs for react native app

$
0
0

Release apk is failing with the segFault error when I try to access cameraview using react native nodemediaclient.

import { NodeCameraView } from "react-native-nodemediaclient";    render() {        return (<View style={styles.container}>                {          cameraPermission == 'authorized'&& microphonePermission == 'authorized'&&<NodeCameraView              style={styles.videoStream}              ref={vb => {                this.vb = vb;              }}              outputUrl={                `rtmp://api-mux/app/${params.key}`              }              camera={{cameraId: 1, cameraFrontMirror: true}}              audio={{bitrate: 32000, profile: 1, samplerate: 44100}}              video={{                preset: 4,                bitrate: 400000,                profile: 1,                fps: 15,                videoFrontMirror: false,              }}              autopreview={true}              smoothSkinLevel = {1}            />

TextInput flexDirection:row not working in React-Native

$
0
0

I am currently using React-Native for an Android Project. I have been trying to make a TextInput field with an icon beside the field. However, for some reasons, I notice that the flexDirection: 'row' is not working if the TextInput is one of its child component. The whole view of the one that I apply the style will automatically disappear. This is a snippet of how my code looks like:

<View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}><View style={{flexDirection: 'row'}}><Image            style={{height: 30, width: 30}}            source={require('./images/email-white.png')}        /><TextInput             style={{height: 40}}            underlineColorAndroid={'transparent'}            placeholder={'E-mail'}            placeholderTextColor={'white'}            onChangeText={(data) => this.setState({ username: data })} /></View></View>

I also tried to wrap both component inside each individual view, but the problem still persists. Is there anyone who knows how to solve this? or anyone can confirm that this is a bug?

Execution failed for task ':app:processDebugGoogleServices'. Failed to delete: \google-services\debug

$
0
0

I am keep getting below error:

Execution failed for task ':app:processDebugGoogleServices'. > Failed to delete: D:\Program\ReactNative\MobileSC_New\android\app\build\generated\res\google-services\debugthis is my app level gradle file

apply plugin: "com.android.application"apply plugin: "io.fabric"// Need to set this when we have variant setup//project.ext.envConfigFiles = [//        debug: ".env.dev",//        release: ".env",//        staging: ".env",//]apply from: project(':react-native-config').projectDir.getPath() +"/dotenv.gradle"import com.android.build.OutputFileproject.ext.react = [    entryFile: "index.js",    enableHermes: false,  // clean and rebuild if changing]apply from: "../../node_modules/react-native/react.gradle"def enableSeparateBuildPerCPUArchitecture = falsedef enableProguardInReleaseBuilds = falsedef jscFlavor = 'org.webkit:android-jsc:+'def enableHermes = project.ext.react.get("enableHermes", false);android {    compileSdkVersion rootProject.ext.compileSdkVersion    compileOptions {        sourceCompatibility JavaVersion.VERSION_1_8        targetCompatibility JavaVersion.VERSION_1_8    }    defaultConfig {        applicationId "com.mobilesc"        minSdkVersion rootProject.ext.minSdkVersion        targetSdkVersion rootProject.ext.targetSdkVersion        versionCode project.env.get("APP_VERSION_CODE").toInteger()        versionName project.env.get("APP_VERSION_NUMBER")        multiDexEnabled true//        manifestPlaceholders = [//                FABRIC_API_KEY:project.env.get("FABRIC_API_KEY"),//                GOOGLE_MAPS_ANDROID_API_KEY:project.env.get("GOOGLE_MAPS_ANDROID_API_KEY")//        ]        resValue "string", "build_config_package", "com.mobilesc"    }    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            manifestPlaceholders = [enableCrashReporting:"false"]        }        release {            // Caution! In production, you need to generate your own keystore file.            // see https://facebook.github.io/react-native/docs/signed-apk-android.            signingConfig signingConfigs.release            minifyEnabled enableProguardInReleaseBuilds            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"            manifestPlaceholders = [enableCrashReporting:"true"]        }    }    // 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            }        }    }    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 {    implementation fileTree(dir: "libs", include: ["*.jar"])    implementation "com.facebook.react:react-native:+"  // From node_modules    if (enableHermes) {        def hermesPath = "../../node_modules/hermes-engine/android/";        debugImplementation files(hermesPath +"hermes-debug.aar")        releaseImplementation files(hermesPath +"hermes-release.aar")    } else {        implementation jscFlavor    }    implementation "com.google.firebase:firebase-messaging:18.0.0"    implementation 'com.google.firebase:firebase-analytics:17.2.1'    implementation 'me.leolin:ShortcutBadger:1.1.21@aar' // <-- Add this line if you wish to use badge on Android    implementation('com.crashlytics.sdk.android:crashlytics:2.9.9@aar') {        transitive = true    }}apply plugin: 'com.google.gms.google-services'// CRASH ISSUE: https://github.com/invertase/react-native-firebase/issues/2411// WORKAROUND for com.google.gms:google-services:4.2.0: https://github.com/invertase/react-native-firebase/issues/1676#issuecomment-441243419//googleServices.disableVersionCheck = truecom.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = truetask copyDownloadableDepsToLibs(type: Copy) {    from configurations.compile    into 'libs'}apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

this is my project level gradle file

// Top-level build file where you can add configuration options common to all sub-projects/modules.buildscript {    ext {        buildToolsVersion = "28.0.3"        minSdkVersion = 21        compileSdkVersion = 28        targetSdkVersion = 28        supportLibVersion = "28.0.0"    }    repositories {        google()        jcenter()        mavenCentral()        maven { url "https://maven.google.com" }        maven { url "https://jitpack.io" }        maven { url 'https://maven.fabric.io/public' }    }    dependencies {        classpath 'com.android.tools.build:gradle:3.4.2'        classpath 'com.google.gms:google-services:4.2.0'        classpath 'io.fabric.tools:gradle:1.28.1'        // NOTE: Do not place your application dependencies here; they belong        // in the individual module build.gradle files    }}allprojects {    repositories {        mavenLocal()        google()        jcenter()        mavenCentral()        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")        }//        maven {//            url 'https://maven.google.com/'//            name 'Google'//        }        maven { url 'https://jitpack.io' }    }//    subprojects {//        afterEvaluate {project ->//            if (project.hasProperty("android")) {//                android {//                    compileSdkVersion rootProject.ext.compileSdkVersion//                    buildToolsVersion rootProject.ext.buildToolsVersion//                }//            }//        }//    }}

i've try to follow this topic but none of them workGradle Error:Execution failed for task ':app:processDebugGoogleServices'

adb.exe: error: closed when i run the react native app

$
0
0

I'm a new in react native so first thing I made is to install react native by running npm install -g react-native-cliand after running react-native infoI get this

C:\Users\husam\WebstormProjects\calculator>react-native infoinfo Fetching system and libraries information...System:    OS: Windows 10 10.0.18363    CPU: (4) x64 Intel(R) Core(TM) i3-7020U CPU @ 2.30GHz    Memory: 815.06 MB / 3.92 GB  Binaries:    Node: 12.16.1 - C:\Program Files\nodejs\node.EXE    Yarn: 1.22.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD    npm: 6.14.4 - C:\Program Files\nodejs\npm.CMD    Watchman: Not Found  SDKs:    Android SDK:      API Levels: 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 7, 8, 9      Build Tools: 19.1.0, 28.0.3, 29.0.3      System Images: android-19 | Intel x86 Atom, android-29 | Google Play Intel x86 Atom      Android NDK: Not Found  IDEs:    Android Studio: Version  3.6.0.0 AI-192.7142.36.36.6308749  Languages:    Java: 1.8.0_231    Python: 3.7.6  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

after that I create a new project with webstorm from here[https://www.jetbrains.com/help/webstorm/react-native.html]after that I launch the emulator with 19 API leveland then I run the App.js file and I get this

"C:\Program Files\nodejs\node.exe" C:\Users\husam\AppData\Roaming\npm\node_modules\react-native-cli run-androidinfo Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.Jetifier found 960 file(s) to forward-jetify. Using 4 workers...info JS server already running.info Installing the app...> Task :app:generatePackageList> Task :app:preBuild> Task :app:preDebugBuild> Task :app:compileDebugAidl NO-SOURCE> Task :app:checkDebugManifest UP-TO-DATE> Task :app:compileDebugRenderscript NO-SOURCE> Task :app:generateDebugBuildConfig UP-TO-DATE> Task :app:javaPreCompileDebug UP-TO-DATE> Task :app:mainApkListPersistenceDebug UP-TO-DATE> Task :app:bundleDebugJsAndAssets SKIPPED> Task :app:generateDebugResValues UP-TO-DATE> Task :app:generateDebugResources UP-TO-DATE> Task :app:mergeDebugResources UP-TO-DATE> Task :app:createDebugCompatibleScreenManifests UP-TO-DATE> Task :app:processDebugManifest UP-TO-DATE> Task :app:processDebugResources UP-TO-DATE> Task :app:compileDebugJavaWithJavac UP-TO-DATE> Task :app:mergeDebugShaders UP-TO-DATE> Task :app:compileDebugShaders UP-TO-DATE> Task :app:generateDebugAssets UP-TO-DATE> Task :app:mergeDebugAssets UP-TO-DATE> Task :app:copyDebugBundledJs SKIPPED> Task :app:processDebugJavaRes NO-SOURCE> Task :app:mergeDebugJavaResource UP-TO-DATE> Task :app:checkDebugDuplicateClasses UP-TO-DATE> Task :app:desugarDebugFileDependencies UP-TO-DATE> Task :app:transformClassesWithDexBuilderForDebug UP-TO-DATE> Task :app:validateSigningDebug UP-TO-DATE> Task :app:signingConfigWriterDebug UP-TO-DATE> Task :app:mergeExtDexDebug UP-TO-DATE> Task :app:mergeDexDebug UP-TO-DATE> Task :app:mergeDebugJniLibFolders UP-TO-DATE> Task :app:mergeDebugNativeLibs UP-TO-DATE> Task :app:stripDebugDebugSymbols UP-TO-DATE> Task :app:packageDebug UP-TO-DATE> Task :app:installDebug10:21:40 V/ddms: execute: running am get-config10:21:45 V/ddms: execute 'am get-config' on 'emulator-5554' : EOF hit. Read: -110:21:45 V/ddms: execute: returningInstalling APK 'app-debug.apk' on 'MY_phone(AVD) - 4.4.2' for app:debug10:21:45 D/app-debug.apk: Uploading app-debug.apk onto device 'emulator-5554'10:21:45 D/Device: Uploading file onto device 'emulator-5554'10:21:45 D/ddms: Reading file permision of C:\Users\husam\WebstormProjects\calculator\android\app\build\outputs\apk\debug\app-debug.apk as: rwx------10:21:49 V/ddms: execute: running pm install -r -t "/data/local/tmp/app-debug.apk"10:22:25 V/ddms: execute 'pm install -r -t "/data/local/tmp/app-debug.apk"' on 'emulator-5554' : EOF hit. Read: -110:22:25 V/ddms: execute: returning10:22:25 V/ddms: execute: running rm "/data/local/tmp/app-debug.apk"10:22:26 V/ddms: execute 'rm "/data/local/tmp/app-debug.apk"' on 'emulator-5554' : EOF hit. Read: -110:22:26 V/ddms: execute: returningInstalled on 1 device.Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.Use '--warning-mode all' to show the individual deprecation warnings.See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warningsBUILD SUCCESSFUL in 4m 49s27 actionable tasks: 2 executed, 25 up-to-dateinfo Connecting to the development server...adb.exe: error: closedinfo Starting the app on "emulator-5554"...warn Failed to connect to development server using "adb reverse": Command failed: C:\Users\husam\AppData\Local\Android\Sdk/platform-tools/adb -s emulator-5554 reverse tcp:8081 tcp:8081WARNING: linker: libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.Starting: Intent { cmp=com.calculator/.MainActivity }

the error as showing in the log Is about the adb but I can use the adb command to install and get logcat in both the emulator and the real devices without any error

after searching on the internet I tried to run this two commandsadb reconnectadb reverse tcp:8081 tcp:8081 but I get the same error as following

C:\Users\husam\WebstormProjects\calculator>adb reconnectreconnecting 4203605bb24a3200 [device]C:\Users\husam\WebstormProjects\calculator>adb reverse tcp:8081 tcp:8081adb.exe: error: closed

the code that I run is the default one that is created by react nativealso the app is installed successfully on my emulator but when I run it I get an error tells me the app will stopalso I noted when I launch the emulator it's gives me this error

error

(React native) How to use SafeAreaView for Android notch devices?

$
0
0

I'm actually developing an app with react native and i'm testing with my one plus 6 and it has a notch. The SafeAreaView is a solution for the iPhone X but for Android, it seems there is no solution.

Did someone heard about anything to solve this kinf of issue ?


React native app build success, but nothing displayed

$
0
0

I successfully run the react-native app and emulator also opended.

![enter image description here

I'm also getting emulator loading message too

enter image description here

However After that it crashes and nothing display

And I'm getting an error when reload the bundle as below

enter image description here

I'm unable to figure out the issue since I'm a react-native beginner.

Appreciate your suggestions

React-native and it dont work, accusing some error "Task 'installRelease' not found in project ':app'"

$
0
0

I have this problem and did a lot of research but none of answer worked for me.SO: Windows 10Android Studio version: latest versionReact-native version: 4.6.3

ERROR: info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.Jetifier found 960 file(s) to forward-jetify. Using 4 workers...info Starting JS server...'C:\Users\username\AppData\Local\Android\Sdk' is not recognized as an internal or external command,operable program or batch file.info Launching emulator...error Failed to launch emulator. Reason: No emulators found as an output of emulator -list-avds.warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.info Installing the app...

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.Use '--warning-mode all' to show the individual deprecation warnings.See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings

FAILURE: Build failed with an exception.

  • What went wrong:Task 'installDebug' not found in project ':app'.

  • Try:Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 2s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

  • What went wrong:Task 'installDebug' not found in project ':app'.

  • Try:Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 2s

How can I generate an apk that can run without server with react-native?

$
0
0

I've built my app, I can run it on my local emulator (and also on my android device within the same network by changing debug server).

However, I want to build an APK that I can send to someone without access to the development server and I want them to be able to test application.

I see there is a section Using offline bundle on iOS section of the documentation. But I couldn't figure out how to accomplish the same for android. Is this possible? If so, how?

UPDATE: On the answer to this question (Android failed to load JS bundle) it is said that offline bundle can be downloaded from development server. But when I obtain the bundle from development server the image files can't be loaded.

Is it possible to find distance between 2 mobile devices ? Using react-native Framework?

$
0
0

I want to develop an app which alarms the mobile users if they are close to another mobile user by less than 1 meter. Basically finding the distance between 2 mobile devices, if the distance is less than 1 meter, the user should be alarmed.

Where shall I start?


Attempt:

I tried connecting devices via Bluetooth

React Native: Active state in AppState listener getting triggered when component mounts

$
0
0

I have set up a listener for AppState in React Native to know when my app switches from background to foreground so I can show a splash screen.

useEffect(() => {AppState.addEventListener('change', handleAppStateChange);},[])const handleAppStateChange = newState => {    if (newState === 'active') {      RNBootSplash.show();    }  };

The problem is, and this only happens when I compile a release APK, for some reason it works fine in debug, the splash screen is showing each time the component mounts, while it should only trigger when the app is switched into the active state from background. Any help?

Using React Native 61.5

Android app crashes on installing @react-native-firebase/messaging (v6)

$
0
0

Note :Console shows success build, so not able to track the error of crash.PS: @react-native-firebase/app already installedGoogle services have been added in to build.gradle and app/build.gradle , google-services.json has been added.Attached my android/build.gradleenter image description here

Show notification on foreground react native firebase v6

$
0
0

I am using the latest react native version 0.62 and latest version of react-native-firebase i.e. v6. I am able to get the notification and it working fine on the background but its not displaying on foreground.

Here is the screenshot:enter image description here

And here is my code:

checkPermission = async () => {    const enabled = await messaging().hasPermission();    console.log('enabled ******* ',enabled)    if (enabled) {      this.getFcmToken();    } else {      this.requestPermission();    }  };  getFcmToken = async () => {    const fcmToken = await messaging().getToken();    if (fcmToken) {      console.log('Your Firebase Token is:', fcmToken);      // this.showAlert('Your Firebase Token is:', fcmToken);    } else {      console.log('Failed', 'No token received');    }  };  requestPermission = async () => {    try {      await messaging().requestPermission();      // User has authorised    } catch (error) {      // User has rejected permissions    }  };  messageListener = async () => {    console.log('inside message listener ****** ')    messaging().onMessage(async remoteMessage => {      Alert.alert('A new FCM message arrived!', JSON.stringify(remoteMessage));  };  showAlert = (title, message) => {    Alert.alert(      title,      message,      [{ text: 'OK', onPress: () => console.log('OK Pressed') }],      { cancelable: false },    );  };  componentDidMount() {    this.checkPermission();    this.messageListener();  }

Java or Kotlin for React Native bridge module?

$
0
0

My React Native app needs some native android functionality. Should I write the native code in Java or Kotlin? My concern is whether Kotlin will increase my package size. Some dependencies are added if Kotlin support is enabled in an app.

dependencies {    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"}

React Navigation default background color

$
0
0

I'm using react-navigation and stack-navigator to manage my screens.

Platforms I'm using:

  • Android
  • React Native: 0.47.1
  • React Navigation: 1.0.0-beta.11
  • Emulator and Device

I have a screen, which acts as a modal form but it is really a full screen. Why is it important the part of "acts as a modal form"? That's because it is kind of modal menu with some options and WITH A TRANSPARENT BACKGROUND COLOR.

This is what I expect:

enter image description here

But what I'm getting is this:

enter image description here

As you can see, in the second example the background color is completely replaced or the components previously loaded is unmounted so the effect I want to acchieve is lost.The idea is to be able to navigate to this screen like any other screen.

If it is not posible to accomplish using react-navigation, what other way can I take to do so?

This component executes actions (redux) since is a cross app component and encapsulates lot of mechanisms and logic inside, that's why I can't use it as a PureComponent relaying on the component which makes use of this one. At least, making this Component as PureComponent would force me to replicate many mechanisms and logic in many other components.

For the sake of the question, and to avoid making the question enormous, both screens have exactly the same style, but the one pushed through StackNavigation replaces the backgroundColor, or unmounts the previus screen.

This is what I've have so far:

//PlaylistSelector.jsrender() {  //Just a full size empty screen to check and avoid bugs  //Using red instead of transparent, works  return (<View style={{ flex: 1, backgroundColor: 'transparent' }}></View>  );}//Navigator.jsimport { StackNavigator } from 'react-navigation';import Album from './Album'; //This is the screen I expect to keep at the backgroundimport PlaylistSelector from './PlaylistSelector';const AppNavigator = StackNavigator(    {        ...moreScreens,        Album: { screen: Album },        PlaylistSelector: {            screen: PlaylistSelector,            navigationOptions: {                style: { backgroundColor: 'red' } //Does not work, red is just to ilustrate, should be transparent,                cardStyle: { //Does not work,                    backgroundColor: 'transparent',                },                bodyStyle: { //Does not work,                    backgroundColor: 'transparent',                },            }        }    },    {        initialRouteName: 'Splash',        headerMode: 'none',        cardStyle: { //Does not work            backgroundColor: 'transparent',        },        transitionConfig: (): Object => ({ //Does not work            containerStyle: {                backgroundColor: 'transparent',            },        }),    });export default AppNavigator;

ADB can't connect to Nox

$
0
0

i have a problem which i trying to solve for about 3 days and i can't find any working solution. The problem is i can't connect my nox player to adb when i trying to connect with localhost and port 62001. Everything i did is:

-nox_adb.exe

nox_adb.exe connect 127.0.0.1:62001 -> unable to connect to 127.0.0.1:62001.

nox_adb.exe connect 127.0.0.1:5037 -> connected to 127.0.0.1:5037 (but when i trying to run react native project with this deviceId, it returns "No Android devices connected")

-adb.exe (from Android SDK)

adb.exe connect 127.0.0.1:62001 -> unable to connect to 127.0.0.1:62001.

adb.exe connect 127.0.0.1:5037 -> failed to connect to 127.0.0.1:5037.

I have installed whole android studio with (i think) needed libraries, Google USB Driver, sdk platforms, etc.Platform: Windows 7 x64Nox: 6.2.0.0

i have read:

Could someone tell me what I'm doing wrong?

I got Could not find com.android.tools.build:gradle:3.5.0. when run react-native run-android

$
0
0

I install react native 0.62 and the run npx react-native run-android on fresh installation (just after installation) but I got this error:

    FAILURE: Build failed with an exception.     What went wrong:    A problem occurred configuring root project 'myApp'.> Could not resolve all artifacts for configuration ':classpath'.        Could not find com.android.tools.build:gradle:3.5.2.

And this is my build.gradle file in android directory:

buildscript {    ext {        buildToolsVersion = "28.0.3"        minSdkVersion = 16        compileSdkVersion = 28        targetSdkVersion = 28    }    repositories {        google()        jcenter()    }    dependencies {        classpath("com.android.tools.build:gradle:3.5.2")    }}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' }    }}

how to implement side drawer and stack navigator together

$
0
0

I have two navigation types, stack and drawer navigation. I have implemented both navigation types in different files and have gone through the react-navigation v5 docs to make it work without success.

This is the drawer navigator

import 'react-native-gesture-handler';import React from 'react';import {NavigationContainer} from '@react-navigation/native';import {createDrawerNavigator} from '@react-navigation/drawer';import About from '../screens/about';import More from '../screens/more';import Gallery from '../screens/gallery';import Excos from '../screens/excos';import AbuladWebsite from '../screens/abuladwebsite';import LifeInAbu from '../screens/lifeinabu';const Drawer = createDrawerNavigator();function sideStack() {  return (<NavigationContainer><Drawer.Navigator initialRouteName="Home"><Drawer.Screen name="Gallery" component={Gallery} /><Drawer.Screen name="Life in ABU" component={LifeInAbu} /><Drawer.Screen name="Buy and Sell" component={AbuladWebsite} /><Drawer.Screen name="About" component={About} /><Drawer.Screen name="Excos" component={Excos} /><Drawer.Screen name="More" component={More} /></Drawer.Navigator></NavigationContainer>  );}export default sideStack;

This is the stack navigator

import 'react-native-gesture-handler';import React from 'react';import {NavigationContainer} from '@react-navigation/native';import {createStackNavigator} from '@react-navigation/stack';import Login from '../login/login';import Register from '../register/register';import Welcome from '../welcome/welcome';import ResetPWD from '../register/resetpwd';import RegisterLogin from '../register/registerlogin';import {Icon} from 'react-native-elements';import SideStack from '../routes/sideStack';const Stack = createStackNavigator();function homeStack({navigation}) {  return (<NavigationContainer><Stack.Navigator><Stack.Screen          name="Login"          component={Login}          options={{headerShown: false}}        /><Stack.Screen          name="Register"          component={Register}          options={{headerShown: false}}        /><Stack.Screen          name="ResetPWD"          component={ResetPWD}          options={{headerShown: false}}        /><Stack.Screen          name="RegisterLogin"          component={RegisterLogin}          options={{headerShown: false}}        /><Stack.Screen          name="Welcome"          component={Welcome}          options={{            title: 'Abulad',            headerLeft: () => (<Icon                name="comment"                onPress={() => navigation.openDrawer()}                title="Info"                color="#000"              />            ),          }}        /></Stack.Navigator></NavigationContainer>  );}export default homeStack;

App.js

import React, {Component} from 'react';import SplashScreen from 'react-native-splash-screen';import HomeStack from './src/components/routes/homeStack';import SideStack from './src/components/routes/sideStack';class App extends Component {  componentDidMount() {    SplashScreen.hide();  }  render() {    return <HomeStack />;  }}export default App;

On executing the onPress method attached to the icon supposed to slide the drawer out, I get this error: navigation error image

Viewing all 28479 articles
Browse latest View live


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