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

@ReactProp setter doesn't called

$
0
0

I have tried to implement gradient view via native UI component RN approach (Android only for now). Everything seems fine except one: @ReactProp setters doesn't called and I don't even imagine why :(

Details:

- RN version: 0.60.4


Here is the code (ViewManager, View, RN component):

ViewManager:

package com.bastionpassmobile.splashgradient;import com.facebook.react.uimanager.SimpleViewManager;import com.facebook.react.uimanager.ThemedReactContext;/** * View manager for splash background gradient view. */public class SplashGradientViewManager extends SimpleViewManager<SplashGradientView> {    public static final String REACT_CLASS = "RCTSplashGradientView";    @Override    public String getName() {        return REACT_CLASS;    }    @Override    protected SplashGradientView createViewInstance(ThemedReactContext reactContext) {        return new SplashGradientView(reactContext);    }}

View:

package com.bastionpassmobile.splashgradient;import android.content.Context;import android.graphics.Canvas;import android.graphics.Color;import android.graphics.Paint;import android.graphics.RadialGradient;import android.graphics.Shader;import com.facebook.react.bridge.ReadableArray;import com.facebook.react.uimanager.annotations.ReactProp;import com.facebook.react.views.view.ReactViewGroup;/** * View serves as background gradient for splash screen. */public class SplashGradientView extends ReactViewGroup {    float radius;    int[] colors;    int width;    int height;    public SplashGradientView(Context context) {        super(context);        radius = 0;        colors = new int[0];        width = 0;        height = 0;    }    @Override    protected void onDraw(Canvas canvas) {        super.onDraw(canvas);        if (radius > 0) {            RadialGradient radialGradient = new RadialGradient(width / 2, height / 2, radius, colors, null, Shader.TileMode.CLAMP);            Paint paint = new Paint();            paint.setShader(radialGradient);            canvas.drawPaint(paint);        }    }    @Override    protected void onSizeChanged(int w, int h, int oldw, int oldh) {        super.onSizeChanged(w, h, oldw, oldh);        width = w;        height = h;    }    /**     * Sets gradient radius.     * @param {SplashGradientView} view     * @param {float} value     */    @ReactProp(name = "radius")    public void setRadius(SplashGradientView view, float value) {        radius = value;        view.invalidate();    }    /**     * Sets gradient colors.     * @param {SplashGradientView} view     * @param {ReadableArray} value     */    @ReactProp(name = "colors")    public void setColors(SplashGradientView view, ReadableArray value) {        colors = new int[value.size()];        for (int i = 0; i < value.size(); i++) {            colors[i] = Color.parseColor(value.getString(i));        }        view.invalidate();    }}

RN component:

import * as React from "react";import { requireNativeComponent, StyleProp, ViewStyle } from "react-native";interface CRadialGradientProps {    style?: StyleProp<ViewStyle>;    radius: number;    /**     * Each element of the array should be defined as hex color representation.     */    colors: string[];}const RadialGradientView = requireNativeComponent("RCTSplashGradientView");/** * Represents radial gradient view. */export class CRadialGradient extends React.Component<CRadialGradientProps> {    render() {        return (<RadialGradientView {...this.props}/>        );    }}

And render of course:

render() {<CRadialGradient        radius={600}        colors={["#353946", "#1E212C"]}    />    }

React native Ctrl M or dev tool not showing in my emulator

$
0
0

He thanks in advance,In react native am not able to right click or open dev mode in emulator.

How to change user current location blue dot color or image in react native

$
0
0

enter image description here

I am using below library to show the users current location

Library using : https://github.com/react-community/react-native-maps

Above library is used to show the current location and it's showing the current location on google map. I want to change the current location blue dot icon or want to change the color of the blue dot. Can anyone here help me on how to change the blue dot color or how to change current location image ?

<MapView provider={ PROVIDER_GOOGLE } style={ styles.map } initialRegion={this.state.region} onPress={this.onMapPress} minZoomLevel={15} showsUserLocation={true} ref={ref => { this.mapView = ref } }></MapView>

Cannot use "FrameLayout", error: "Element FrameLayout must be declared" [Android Studio]

$
0
0

I am doing a small bit of Android development on a React Native project and I cannot work out how to "import" FrameLayout. I'm sure it is very simple but after an hour of Googling I am stumped.

Please see the error below:

Thanks,Al

Android/React-Native Issue

$
0
0

So I notice that I had to go to the AVD manager to pop up the emulator in order for run android to work. I thought that run android automatically pops up the emulator. Is there a way for me to cut that extra step of going through AVD? I already added a path.

Why does react-native-rsa-native decryption only work sometimes?

$
0
0

I am writing a chat app with end-to-end encryption and have spent at least a day on this one problem. I am using react-native-rsa native and am having a problem with message decryption that I can't seem to find documented anywhere.

Upon screen load, a useEffect call is used, and this calls a function that registers a callback to the 'child_added' event on the correct Firebase child. The callback in turn runs a function that decrypts messages retrieved from Firebase.

There are two different ways in which this callback is run, as per the Firebase documentation. One way is upon the page load, where the callback is run once for each existing child in the chosen location of the Firebase tree. Then the function runs once each time a new child appears.

What makes this problem so confusing is that the decryptor only fails in the former case. When the screen loads, the initial runs of the function (with all correct data being passed in) causes the RSAKeychain.decrypt(text, keyTag); to throw an IllegalBlockSizeException with no other message provided. I understand that this kind of problem should not even be applicable to RSA encryption.

My code is as follows. First the use of useEffect is in place in the functional component, which causes Fire.get to be run once:

const ConvoScreen = ({route, navigation}) => {  const { recipientId, title } = route.params;  useEffect(() => {    Fire.get(recipientId, message => {      return setMessages((previous) => (GiftedChat.append(previous, message)))    });    return () => {      Fire.off(recipientId);    }  }, []);...

Then, in Fire.get, the on 'child_added' event listener is added:

  get = (fromId, callback) => {    this.getConvo(fromId).on('child_added', async (snapshot) => {      const callbackWith = await this.parse(snapshot);      callback(callbackWith);    });  };

This event triggers the parse function to be run. The catch block here is what's reached ONLY on the initial triggers of 'child_added' that run for the existing children in the tree:

  parse = async message => {    try {      const {key: _id} = message;      const {user, timestamp, text, signature} = message.val();      const createdAt = new Date(timestamp);      // IllegalBlockSizeException thrown from native code on this line      // But only on the initial triggers of 'child_added' and not subsequent triggers      const decryptedText = await RSAKeychain.decrypt(text, keyTag);      return {        _id,        createdAt,        text: decryptedText,        user      };    } catch (err) {      console.log("PARSE ERROR ENCOUNTERED!");      console.log(err.message);      // The message is always "Error not specified."    }  };

When the exact same data gets passed into the snapshot variable, the decryption works. Any help or even suggestions for investigation would be greatly appreciated. I have exhausted my abilities.

Edit: I managed to get out some stack trace info:

 LOG  javax.crypto.IllegalBlockSizeException        at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:519)        at javax.crypto.Cipher.doFinal(Cipher.java:1741)        at com.RNRSA.RSA.decrypt(RSA.java:148)        at com.RNRSA.RSA.decrypt(RSA.java:156)        at com.RNRSA.RNRSAKeychainModule$5.run(RNRSAKeychainModule.java:128)        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)        at java.lang.Thread.run(Thread.java:764)Caused by: android.security.KeyStoreException: Unknown error        at android.security.KeyStore.getKeyStoreException(KeyStore.java:697)        at android.security.keystore.KeyStoreCryptoOperationChunkedStreamer.doFinal(KeyStoreCryptoOperationChunkedStreamer.java:224)        at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:506)        ... 8 more

react native build release from .apk to .aab, how to send the app to the clients?

$
0
0

It's been so long since I develop a mobile app in react native, when I'm developing before, I usually generate a release apk and send it to my clients so that they can test it and have experienced it, but now when I build a release in react native, it returns a .aab instead of .apk, how can I send my application to the clients when I only get .aab format on my project?

How do I specify an environment variable while building an Android App Bundle

$
0
0

It looks like App Bundle is the preferred way of doing things (over APK) so I'd like to try to use it.

I need some way to specify an ENVFILE argument for building my React Native application. This is easily done when generating APKs through assembleRelease but I cannot find an equivalent for App Bundles.

In addition, the Android Studio App Bundle wizard appears to be pretty scant when it comes to specifying options for the build.

Any ideas?


How to stopPropagation TV remote button events

$
0
0

How can I use stopPropagation for any TV remote keys.I want to avoid the long press in case of press and hold of the D-Pad keys.

Thanks in advance

npm ERR! Unexpected end of JSON input while parsing near '...el/plugin-proposal-cl'

$
0
0

I was thinking of trying react-native but stuck on creating my first app with this command:

create-react-app my_react_app

I am getting following error msg on powershell:

PS D:\react_native> create-react-app my_react_appCreating a new React app in D:\react_native\my_react_app.Installing packages. This might take a couple of minutes.Installing react, react-dom, and react-scripts...npm ERR! Unexpected end of JSON input while parsing near '...el/plugin-proposal-cl'npm ERR! A complete log of this run can be found in:npm ERR!     C:\Users\hp\AppData\Roaming\npm-cache\_logs\2020-04-06T06_09_31_075Z-debug.logAborting installation.  npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.Deleting generated file... package.jsonDeleting my_react_app/ from D:\react_nativeDone.

Any help will be appreciated.

React Native mapbox

$
0
0

I’m trying to show user’s location with a pointer in real-time but the problem I have is the documentation isn’t helpful much. I found a way to get users location updated.Please, thank you.

Make Kotlin JVM plugin work together with Kotlin standard library

$
0
0

To reproduce the issue I'm facing I used the react-native example project demo-react-native from `Detox.

After installing the packages with yarn I executed the 2 commands to run the test:

1) cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && cd ..

2) npx detox test -l error --configuration android.emu.release

So far everything works as expected but as soon I add the dependency of the Kotlin standard library in the android/app/build.gradle file like that

dependencies {  ...  androidTestImplementation('com.wix:detox:+')  implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.71" // <-- line added}

and run the 2 steps again I get the following error

04-05 20:21:06.709 16552 16615 E AndroidRuntime: FATAL EXCEPTION: com.wix.detox.manager04-05 20:21:06.709 16552 16615 E AndroidRuntime: Process: com.test.app, PID: 1655204-05 20:21:06.709 16552 16615 E AndroidRuntime: java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/functions/Function1;04-05 20:21:06.709 16552 16615 E AndroidRuntime:    at com.wix.detox.Detox$1.run(Detox.java:134)04-05 20:21:06.709 16552 16615 E AndroidRuntime:    at java.lang.Thread.run(Thread.java:764)04-05 20:21:06.709 16552 16615 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "kotlin.jvm.functions.Function1" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/data/app/com.test.app.test-xbA2GW9WwS_BxzRNPa2waQ==/base.apk", zip file "/data/app/com.test.app-g_-tD026mxddTh82TmdYGg==/base.apk"],nativeLibraryDirectories=[/data/app/com.test.app.test-xbA2GW9WwS_BxzRNPa2waQ==/lib/x86, /data/app/com.test.app-g_-tD026mxddTh82TmdYGg==/lib/x86, /data/app/com.test.app.test-xbA2GW9WwS_BxzRNPa2waQ==/base.apk!/lib/x86, /data/app/com.test.app-g_-tD026mxddTh82TmdYGg==/base.apk!/lib/x86, /system/lib]]04-05 20:21:06.709 16552 16615 E AndroidRuntime:    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)04-05 20:21:06.709 16552 16615 E AndroidRuntime:    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)04-05 20:21:06.709 16552 16615 E AndroidRuntime:    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)

I have tried to load the JVM plugin in the android/build.gradle file as described here but it doesn't help.

What else can I do to make org.jetbrains.kotlin.jvm work in that project?

Thank you in advance.

React-Native: Module AppRegistry is not a registered callable module

$
0
0

I'm currently trying to get the ES6 react-native-webpack-server runningon an Android emulator. The difference is I've upgraded my package.json and build.grade to use react 0.18.0, and am getting this error on boot. As far as I'm aware AppRegistry is imported correctly. Even if I were to comment out the code this error still comes up. This does work on iOS without issue.

What am I doing wrong?

EDIT: After trying other boilerplates that do support 0.18.0, I'm still coming across the same issue.

enter image description here

React Native build: Error while merging dex archives

$
0
0

I want to build my react native app on genymotion, but I've got:

Execution failed for task 'app:transformDexArchiveWithExtenalLibsDexMergerForDebug'.com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives

There are files>

Project build.gradle file -> I've added google() and also google-services:3.2.1

// Top-level build file where you can add configuration options common to all sub-projects/modules.buildscript {    repositories {        jcenter()        google()    }    dependencies {        classpath 'com.google.gms:google-services:3.2.1'        classpath 'com.android.tools.build:gradle:3.1.1'        // NOTE: Do not place your application dependencies here; they belong        // in the individual module build.gradle files    }}allprojects {    repositories {        mavenLocal()        jcenter()        maven {            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm            url "$rootDir/../node_modules/react-native/android"        }    google()    }}

Also, there is app level build.gradle file:

apply plugin: "com.android.application"import com.android.build.OutputFile/** * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets * and bundleReleaseJsAndAssets). * These basically call `react-native bundle` with the correct arguments during the Android build * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the * bundle directly from the development server. Below you can see all the possible configurations * and their defaults. If you decide to add a configuration block, make sure to add it before the * `apply from: "../../node_modules/react-native/react.gradle"` line. * * project.ext.react = [ *   // the name of the generated asset file containing your JS bundle *   bundleAssetName: "index.android.bundle", * *   // the entry file for bundle generation *   entryFile: "index.android.js", * *   // whether to bundle JS and assets in debug mode *   bundleInDebug: false, * *   // whether to bundle JS and assets in release mode *   bundleInRelease: true, * *   // whether to bundle JS and assets in another build variant (if configured). *   // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants *   // The configuration property can be in the following formats *   //         'bundleIn${productFlavor}${buildType}' *   //         'bundleIn${buildType}' *   // bundleInFreeDebug: true, *   // bundleInPaidRelease: true, *   // bundleInBeta: true, * *   // whether to disable dev mode in custom build variants (by default only disabled in release) *   // for example: to disable dev mode in the staging build type (if configured) *   devDisabledInStaging: true, *   // The configuration property can be in the following formats *   //         'devDisabledIn${productFlavor}${buildType}' *   //         'devDisabledIn${buildType}' * *   // the root of your project, i.e. where "package.json" lives *   root: "../../", * *   // where to put the JS bundle asset in debug mode *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug", * *   // where to put the JS bundle asset in release mode *   jsBundleDirRelease: "$buildDir/intermediates/assets/release", * *   // where to put drawable resources / React Native assets, e.g. the ones you use via *   // require('./image.png')), in debug mode *   resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", * *   // where to put drawable resources / React Native assets, e.g. the ones you use via *   // require('./image.png')), in release mode *   resourcesDirRelease: "$buildDir/intermediates/res/merged/release", * *   // by default the gradle tasks are skipped if none of the JS files or assets change; this means *   // that we don't look at files in android/ or ios/ to determine whether the tasks are up to *   // date; if you have any other folders that you want to ignore for performance reasons (gradle *   // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ *   // for example, you might want to remove it from here. *   inputExcludes: ["android/**", "ios/**"], * *   // override which node gets called and with what additional arguments *   nodeExecutableAndArgs: ["node"], * *   // supply additional arguments to the packager *   extraPackagerArgs: [] * ] */project.ext.react = [    entryFile: "index.js"]apply from: "../../node_modules/react-native/react.gradle"/** * Set this to true to create two separate APKs instead of one: *   - An APK that only works on ARM devices *   - An APK that only works on x86 devices * The advantage is the size of the APK is reduced by about 4MB. * Upload all the APKs to the Play Store and people will download * the correct one based on the CPU architecture of their device. */def enableSeparateBuildPerCPUArchitecture = false/** * Run Proguard to shrink the Java bytecode in release builds. */def enableProguardInReleaseBuilds = falseandroid {    compileSdkVersion 23    buildToolsVersion "23.0.1"    defaultConfig {        applicationId "com.herbamarket.herbamarket"        minSdkVersion 21        targetSdkVersion 22        versionCode 1        versionName "1.0"multiDexEnabled true        ndk {            abiFilters "armeabi-v7a", "x86"        }    }    splits {        abi {            reset()            enable enableSeparateBuildPerCPUArchitecture            universalApk false  // If true, also generate a universal APK            include "armeabi-v7a", "x86"        }    }    buildTypes {        release {            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:            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits            def versionCodes = ["armeabi-v7a":1, "x86":2]            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 {    compile fileTree(dir: "libs", include: ["*.jar"])    compile "com.android.support:appcompat-v7:23.0.1"    compile "com.facebook.react:react-native:+"  // From node_modules    // Add to dependencies  compile(project(':react-native-firebase')) {    transitive = false  }  compile "com.google.firebase:firebase-core:12.0.1"  // If you are receiving Google Play API availability issues, add the following dependency  compile("com.google.android.gms:play-services-base:11.4.2"){    force = true    }}// 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 plugin: 'com.google.gms.google-services'

First problem I had was: Unable to set main dex list, but I resolved that by adding multiDex true. Problematic task is after that one.

If you need more files, just me know.Thanks in advance for all suggestions.

Detox - DetoxManager can not find kotlin/jvm/functions/Function1 at runtime

$
0
0

To reproduce the issue I'm facing I used the react-native example project demo-react-native from `Detox.

After installing the packages with yarn I executed the 2 commands to run the test:

1) cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && cd ..

2) npx detox test -l error --configuration android.emu.release

So far everything works as expected but as soon I add the dependency of the Kotlin standard library in the android/app/build.gradle file like that

dependencies {  ...  androidTestImplementation('com.wix:detox:+')  implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.71" // <-- line added}

and run the 2 steps again I get the following error

04-05 20:21:06.709 16552 16615 E AndroidRuntime: FATAL EXCEPTION: com.wix.detox.manager04-05 20:21:06.709 16552 16615 E AndroidRuntime: Process: com.test.app, PID: 1655204-05 20:21:06.709 16552 16615 E AndroidRuntime: java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/functions/Function1;04-05 20:21:06.709 16552 16615 E AndroidRuntime:    at com.wix.detox.Detox$1.run(Detox.java:134)04-05 20:21:06.709 16552 16615 E AndroidRuntime:    at java.lang.Thread.run(Thread.java:764)04-05 20:21:06.709 16552 16615 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "kotlin.jvm.functions.Function1" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/data/app/com.test.app.test-xbA2GW9WwS_BxzRNPa2waQ==/base.apk", zip file "/data/app/com.test.app-g_-tD026mxddTh82TmdYGg==/base.apk"],nativeLibraryDirectories=[/data/app/com.test.app.test-xbA2GW9WwS_BxzRNPa2waQ==/lib/x86, /data/app/com.test.app-g_-tD026mxddTh82TmdYGg==/lib/x86, /data/app/com.test.app.test-xbA2GW9WwS_BxzRNPa2waQ==/base.apk!/lib/x86, /data/app/com.test.app-g_-tD026mxddTh82TmdYGg==/base.apk!/lib/x86, /system/lib]]04-05 20:21:06.709 16552 16615 E AndroidRuntime:    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)04-05 20:21:06.709 16552 16615 E AndroidRuntime:    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)04-05 20:21:06.709 16552 16615 E AndroidRuntime:    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)

I have tried to load the JVM plugin in the android/build.gradle file as described here but it doesn't help.

What else can I do to make org.jetbrains.kotlin.jvm work in that project?

Thank you in advance.

Edit 1

I added kotlin.jvm.functions.Function1 to the MainApplication.java to test whether the Kotlin JVM is actually accessible by the project by adding the following code

...import kotlin.jvm.functions.Function0;import kotlin.jvm.functions.Function1;public class MainApplication extends Application implements ReactApplication {    private Function1<Throwable, String> errorParseFn = new Function1<Throwable, String>() {        @Override        public String invoke(Throwable t) {            return Log.getStackTraceString(t);        }    };    ...    @Override    public void onCreate() {        super.onCreate();        SoLoader.init(this, /* native exopackage */ false);        Log.d("@@@@@@", "onCreate");        Log.d("@@@@@@", errorParseFn.invoke(new Exception("Test Exception message")));    }}

after I ran npx detox test -l error --configuration android.emu.release once again I could see the logs in the console.

04-06 21:24:06.715 23836 23836 D @@@@@@  : onCreate04-06 21:24:06.716 23836 23836 D @@@@@@  : java.lang.Exception: Test Exception message 

That means that the app itself has access to the kotlin.jvm, which means the gradle setup is correct.

Has anyone an idea how DetoxManager.java can access the Kotlin JVM at runtime?


How to create a seperate navigation Drawer for different users : React Native

$
0
0

I have an application in which I have 3 drawer items in a custom drawer function. I have a login page as the main component. What I'm trying to do is to display a specific drawer for admin users and a specific drawer for normal users. I have searched In a number of blogs and documentation and couldn't find anything very useful.

AdminDrawer: Account, Dashboard etcUserDrawer: Profile, Contact etc

I have tried to achieve this using many methods. I have firebase login and I'm checking user based on TextInput and sending them to corresponding pages. I'm trying to hide some items for normal users.

Here is my

DrawerNavigator.js
const DrawerContent = (props) => (<Container><Header style={styles.header}><Body><Image                    style={styles.head_image}                    source={require('../assets/logo.png')}                /></Body></Header><Content><DrawerItems {...props} /></Content></Container>)const DrawerNavigator = createDrawerNavigator(    {    Admin: {        screen: Admin,        navigationOptions: {            drawerLabel: "Account",            drawerIcon: () => (<Ionicons name="md-home" style={styles.icon} size={20} />            )        }    },    Register: {        screen: Register,        navigationOptions: {            drawerLabel: "Register a user",            drawerIcon: ({ tintColor }) => (<Ionicons name="md-person-add" style={styles.icon} size={20} />            )        }    },    UserPage: {        screen: User,        navigationOptions: {            drawerLabel: "User",            drawerIcon: ({ tintColor }) => (<Ionicons name="md-person-add" style={styles.icon} size={20} />            )        }    }},    {        initialRouteName: 'Admin',        drawerPosition: 'left',        contentComponent: DrawerContent,        drawerOpenRoute: 'DrawerOpen',    });

And here is my

AppNavigator.js
export default createAppContainer(    createSwitchNavigator({        Auth: Login,        Main:DrawerNavigator,    }));

And in the

Login.js

I'm doing the login authentication something like,

handleLogin = () => {      const { email , password } = this.state;      firebase.auth()          .signInWithEmailAndPassword(email, password)          .then(() => {          })          .catch(error => alert(error))    }

I would like to hide some drawer items from the normal user or show separate drawer for admin and normal user

Release APK Not Updating With JavaScript Code

$
0
0

My Android APK is running off the JavaScript present when I generated the first signed APK. I've tried cleaning/rebuilding the project in Android Studio, I've tried ./gradlew clean in the android subfolder. Any ideas as to why the code isn't updating? I've seen this issue, without any success for myself.

'installDebug' not found in root project 'android' React Native

$
0
0

I am trying to run my project on the android simulator. When I run react-native run-android I am getting the following:

FAILURE: Build failed with an exception.* What went wrong: Task 'installDebug' not found in root project 'android'.* 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.BUILD FAILED

If I run ./gradlew tasks I get:

Build Setup tasks-----------------init - Initializes a new Gradle build. [incubating]wrapper - Generates Gradle wrapper files. [incubating]Help tasks----------buildEnvironment - Displays all buildscript dependencies declared in root project 'android'.components - Displays the components produced by root project 'android'. [incubating]dependencies - Displays all dependencies declared in root project 'android'.dependencyInsight - Displays the insight into a specific dependency in root project 'android'.help - Displays a help message.model - Displays the configuration model of root project 'android'. [incubating]projects - Displays the sub-projects of root project 'android'.properties - Displays the properties of root project 'android'.tasks - Displays the tasks runnable from root project 'android'.

Any idea why I don't have a installDebug task in my project? How do I get it back?

Launching react-native-navigation screen from Android

$
0
0

Is there a way to launch a specific react-native-navigation screen from Android side for example with an intent?

Something like :

Intent intent = new Intent(this, RNNScreen.class);

read ECONNRESET using expo build

$
0
0

I am building an apk for my application which is built by react native using expoI use expo build:android command in the terminal and after this I got a prompt to choose from:

? Would you like to upload a keystore or have us generate one for you?If you don't know what this means, let us handle it! :)

so i choosed that expo will handle it and I got the following steps

Publishing to channel 'default'...Building iOS bundleBuilding Android bundleAnalyzing assetsUploading assetsUploading \assets\alert.mp3Uploading \assets\images\splash.pngUploading \assets\images\icon.png

and then I got the follwing error

read ECONNRESETSet EXPO_DEBUG=true in your env to view the stack trace.

I also updated expo-cli to the latest version!and here is my app.json if it helps

 {"expo": {"name": "app name","slug": "app-name","platforms": ["android"    ],"version": "1.0.0","orientation": "portrait","icon": "./assets/images/icon.png","scheme": "myapp","splash": {"image": "./assets/images/splash.png","resizeMode": "contain","backgroundColor": "#ffffff"    },"updates": {"fallbackToCacheTimeout": 0    },"android": {"package": "com.el3ameed.appname","versionCode": 1,"adaptiveIcon": {"foregroundImage": "./assets/images/icon.png","backgroundColor": "#171717"      }    },"assetBundlePatterns": ["**/*"    ],"ios": {"bundleIdentifier": "com.el3ameed.appname","buildNumber": "1.0.0"    },"description": ""  }}
Viewing all 29519 articles
Browse latest View live


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