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

Failed to build a React Native signed release

$
0
0

I'm working on a react-native app and when i try to build a signed release i get this error:

Type com.BV.LinearGradient.BuildConfig is defined multiple times: /node_modules/react-native-linear-gradient/android/build/.transforms/6e76434d493cfffca8afca973b4d3edc/classes/classes.dex, /android/app/build/intermediates/external_libs_dex/release/mergeExtDexRelease/classes.dex

ps:

   minSdkVersion = 21   compileSdkVersion = 28   targetSdkVersion = 28   supportLibVersion = "28.0.0"

React-native google signin gives Developer Error

$
0
0

I am trying Google login using React-native-google-signin plugin but it gives me a Developer_Error.I have done exctly same as mention in its document.here is my code ans steps.

1.Installed react-native-google-signin plugin using npm i react-native-google-signin.2.Then have linked it with react-native link react-native-google-signin3.After that i did setup of build.gradle file as they mention it in the documents.

    ext {        buildToolsVersion = "27.0.3"        minSdkVersion = 16        compileSdkVersion = 27        targetSdkVersion = 26        supportLibVersion = "27.1.1"        googlePlayServicesAuthVersion = "15.0.1"    }    dependencies {        classpath 'com.android.tools.build:gradle:3.1.2'        classpath 'com.google.gms:google-services:3.2.1'    }    allprojects {        repositories {                mavenLocal()                google()                 maven {url "https://maven.google.com"}                jcenter()                maven {                // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm                url "$rootDir/../node_modules/react-native/android"                }                maven {                    url 'https://maven.google.com/'                    name 'Google'                }        }    }

4.Updated android/app/build.gradle,

    dependencies {        implementation 'com.facebook.android:facebook-android-sdk:4.34.0'        implementation project(':react-native-fbsdk')        compile project(':react-native-vector-icons')        compile project(':react-native-fused-location')        compile project(':react-native-fs')        compile project(':react-native-image-resizer')        compile project(':react-native-geocoder')        compile project(':react-native-device-info')        compile project(':react-native-image-picker')        compile fileTree(dir: "libs", include: ["*.jar"])        compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"        compile "com.facebook.react:react-native:+"  // From node_modules        implementation project(":react-native-google-signin")        compile (project(':react-native-maps')){            exclude group: "com.google.android.gms"        }        implementation 'com.google.android.gms:play-services-auth:15.0.1'        implementation 'com.google.android.gms:play-services-maps:15.0.1'        implementation 'com.google.android.gms:play-services-location:15.0.1'        implementation 'com.google.android.gms:play-services-base:15.0.1'    }    task copyDownloadableDepsToLibs(type: Copy) {        from configurations.compile        into 'libs'    }    apply plugin: 'com.google.gms.google-services'

5.Then generate SHA1 key using android studion debug.keystore and generate google-services.json file in firebase.

6.Then setting up login.js page like this.

    async componentDidMount() {        this._configureGoogleSignIn();    }    _configureGoogleSignIn() {        GoogleSignin.configure({            webClientId: '775060548127-5nfj43q15l75va9pfav2jettkha7hm2a.apps.googleusercontent.com',// my clientID            offlineAccess: false        });    }    async GoogleSignin() {    try {        await GoogleSignin.hasPlayServices();        const userInfo = await GoogleSignin.signIn();        // this.setState({ userInfo, error: null });        Alert.alert("success:"+ JSON.stringify(userInfo));    } catch (error) {        if (error.code === statusCodes.SIGN_IN_CANCELLED) {            // sign in was cancelled            Alert.alert('cancelled');        } else if (error.code === statusCodes.IN_PROGRESS) {            // operation in progress already            Alert.alert('in progress');        } else if (error.code === statusCodes.PLAY_SERVICES_NOT_AVAILABLE) {            Alert.alert('play services not available or outdated');        } else {            Alert.alert('Something went wrong', error.toString());            this.setState({                error,            });        }    }}

These are my details so please someone help me on this i cannot find the appropriate solution online.and yes my SHA1 and clientID is correct i have cheked it already.

The Development Server Returned Error Code:500 React Native

$
0
0

Hello I am pretty new to react native.I am facing this error I am currently working on this project it is a Login/Sign Up page for some project that i am working on enter image description here

import React from 'react' import{StyleSheet,Text,View}from 'react-native' import RegForm from '.app/Components/RegForm' export default class App extends React.Component{ render(){ return(<View style={Styles.Container}><RegForm /></View>) } } const styles=StyleSheet.Create({ container:{ flex:1 , justifyContent:'center', backgroundColor:'#36485f' , paddingLeft:60 , paddingRight:60 , }, })

import React from 'react' import{StyleSheet,Text,View,TextInput,TouchableOpacity}from 'react-native' export default class RegForm extends React.Component{ render(){ return(<View style={Styles.RegForm}><Text style={styles.header}>Registration</Text><TextInput style={styles.TextInput} placeholder="Please Enter your Name" /><TextInput style={styles.TextInput} placeholder="Please Enter your Email" /><TextInput style={styles.TextInput} placeholder="Please Enter your Password" secureTextEntry={true} /><TextInput style={styles.TextInput} placeholder="Please Enter your Mobile No" /><TextInput style={styles.TextInput} placeholder="Please Enter your CNIC" /><TouchableOpacity style={styles.button}><Text style={styles.btntext}>Sign Up</Text></TouchableOpacity></View>) } } const styles=StyleSheet.Create({ RegForm:{ alignSelf:'strech' , }, header:{ fontSize:24 , color:'#fff', paddingBottom:10 , marginBottom:40 , borderBottomColor:'#199187', borderBottomWidth:'1', }, TextInput:{ alignSelf:'strech', height:40 , marginBottom:30, color:'#fff' , borderBottomColor:'#f8f8f8', borderBottomWidth:1 , }, button:{ alignSelf:'strech', alignItem:'center', padding:20 , backgroundColor:'#59cbbd', marginTop:30 , }, btntext:{ color:'#fff', fontWeight:'bold', } })

React Native mounting on Android on resume

$
0
0

I have a weird problem using React Native on Android (does not happen on iOS) that only happens on first run.The app keeps mounting on each app resume. When I close the app manually and reopen this doesn't happen anymore.

I created following code (App.js) to demonstrate the problem:

import React, { useState, useEffect } from 'react';import { View, Text } from 'react-native';const App = () => {  console.disableYellowBox = true;  const [initiated, setInitiated] = useState(false);  useEffect(() => {    setTimeout(() => setInitiated(true), 2000);  }, []);  if (!initiated) {    return (<View style={{ backgroundColor: 'white', flex: 1, justifyContent: 'center', alignItems: 'center' }}><Text>initiating...</Text></View>    )  }  return (<View style={{ backgroundColor: 'white', flex: 1, justifyContent: 'center', alignItems: 'center' }}><Text>ready</Text></View>  );};export default App;

Building an APK and running this on a device will show initiating... each time you resume the app. Expected: showing ready instead of mounting again.

This is my index.js

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

react-native synchronous movement of 5 of scrollView

$
0
0

react-native synchronous movement of 5 of scrollView .how do you ı sync.

<ScrollView horizontal ref={scrolListRef}                        onScrollEndDrag={(e) =>                            //ref get xcoordvalue//scrollListRef map into ref xcoord asssigment                         }                        pagingEnabled                        scrollEventThrottle={16}>

onScroll : leads to an endless loop onScrollEndDrag:it creates a delay problem

React native TouchableOpacity onPress not working on Android

$
0
0

TouchabelOpacity works fine on iOS but the onPress method does not work on Android for me.

My react-native version: 0.57.4

My code:

const initDrawer = navigation => (<TouchableOpacity    style={{ left: 16 }}    onPress={() => onPressDrawerButton(navigation)}><Ionicons name="ios-menu" color="white" size={30} /></TouchableOpacity>);

Vue-native RefreshControl pull is not working on Android

$
0
0

I can't get RefreshControl working on android but it works nicely on IOS.It looks like pull dosen't work on Android. ScrollView is nicely scrolling but pull not.

<template><SafeAreaView :style="{flex: 1}"><ScrollView :enabled="true" :style="{flex: 1}"><RefreshControl :enabled="true" :refreshing="refreshing" :onRefresh="onRefresh"/><Text>Lorem ipsum</Text></RefreshControl></ScrollView></SafeAreaView></template><script>import React from 'react';import {  ScrollView,  RefreshControl,  StyleSheet,  Text,  SafeAreaView,} from 'react-native';export default {  props: {    navigation: {      type: Object    },  },    data() {        return {            refresh: false,            refreshing: false,        }    },    methods: {        onRefresh() {            alert(111);        }    },}</script>

How to add strike through on Text in react native?

$
0
0

Hey I want to add Strike Through in $10 amount for showing cut amount. Please check below :

<View style={styles.row}><View style={styles.inputWrapstotal}><Text style={styles.labelcolor}>16.7% Off</Text></View><View style={styles.inputWrapstotal}><Text style={styles.labelamount}>Rs $10</Text><Text style={styles.labelamountchange}> 12 </Text></View></View>

Please add css so that i can align in a line of both text , Thanks in Advance.

Please check the images enter image description here


adyen integration to React Native

$
0
0

Good Day everyone.. Does anyone know how to integrate adyen to React Native which works on both IOS and ANDROID.

Thanks in advance :)

how to store/save data in react native

$
0
0

How to store/save data in react native.Like we use shared-preference in android is there any solution for react native.I am new to react-nactive.

please add sample example

React Native Picker moves back to first item after scrolling and do not select correct value

$
0
0

I'm working with Picker component from React Native and I'm having some issues.

I'm trying to make a product registration page where each product has a catalog, so I'm using a Picker to show all catalogs that have been registered in the application. But, when I scroll the picker, it moves back to first item and when I press the button to registrate a product, I have the catalog field with undefined value. I'm using Formik for it.

Picker component:

<Picker                style={{ height: 10, width: 325 }}                value={this.state.selectedValue}                mode="dropdown"                itemStyle={{                  backgroundColor: '#F6F6F6',                  color: 'black',                  height: 120,                  marginTop: 25,                  fontFamily: 'Ebrima',                  fontSize: 17,                  borderRadius: 5,                  borderColor: '#7e2f89',                }}                             onValueChange={this.optionChanged}>                {this.state.catalogs.map((member, key) => {                  return (<Picker.Item                      label={member.name}                      value={member.name}                      key={key}                    />                  );                })}</Picker>

State and optionChanged:

 state = {    catalogs: [],    selectedValue: '',  };  optionChanged = value => {    console.log(value);    this.setState({ selectedValue: value});  };

Formik with initial values:

<Formik        initialValues={{          name: '',          description: '',          costPrice: '',          salePrice: '',          catalog: '',          amountStock: '',        }} ...

How can I make it work properly?

Thank you in advance!

Could not resolve com.quickblox:quickblox-android-sdk-messages:3.9.1

$
0
0

I am developing react native video Chang app using quickblox.But I install quickblox module and run project, the error occures like following.how can i fix this error?

enter image description here

101 no packager error with React Native toolkit in Visual Studio Code

$
0
0

I am new to React Native and am trying to get my first React application to run on Android Emulator. I am getting the error message when running the debugger: Could not debug. Error while executing command 'c:\Users...\weather4\node_modules.bin\react-native.cmd run-android --no-packager': Error while executing command 'c:\Users...\weather4\node_modules.bin\react-native.cmd run-android --no-packager' (error code 101)

launch.json

{"version": "0.2.0","configurations": [    {"name": "Debug Android","cwd": "${workspaceFolder}","type": "reactnative","request": "launch","platform": "android"    },    {"name": "Attach to packager","cwd": "${workspaceFolder}","type": "reactnative","request": "attach"    },]}

settings.json

{"dart.flutterSdkPath": "C:\\src\\flutter","react-native.packager.port": 19001}

env path variable

C:\Users\...\.vscode\extensions\msjsdiag.vscode-react-native-0.16.0\src\common

Share content on LinkedIn for both android and ios using react native

$
0
0

I have an app built in react-native in which I have to share these data to LinkedIn

const options = {            title: 'Share via',            message: 'some message',            image:'images need to be shared' //may be multiple images            } 

I tried so many ways but not working. How can I do this?

Memory issues when building Android React Native app recently updated to 0.62.2

$
0
0

I've recently updated to RN 0.62.2 but cannot get android to build using gradlew assembleRelease like I did before the update (was previously on RN 0.59.4).

The errors I am getting are usually:

expiring daemon because jvm heap space is exhaustedjava.lang.OutOfMemoryError

I have done exhaustive searching on google which usually leads me to a few different solutions:

  1. Increase javaMaxHeapSize to "4g" in app/build.gradle - Done
  2. Set org.gradle.jvmargs=-Xmx4g in gradle.properties - Done
  3. Along with a bunch of other settings i've tried with no luck like

-XX:MaxPermSize=2048m

org.gradle.daemon=true

Im curious if anyone has any other suggestions, otherwise Im thinking Ill start by commenting out each dependency and building, perhaps one of them is causing the issue....


react-native :app:installDebug FAILED

$
0
0

Install APK debug to my device failed.

jianglinghuadeMacBook-Pro:hello jianglinghua$ react-native run-androidJS server already running.Building and installing the app on the device (cd android && ./gradlew installDebug...WARNING [Project: :app] Current NDK support is deprecated.  Alternative will be provided in the future.:app:preBuild UP-TO-DATE......:app:assembleDebug UP-TO-DATE:app:installDebugInstalling APK 'app-debug.apk' on 'MI NOTE LTE - 6.0.1'Unable to install /Users/jianglinghua/Desktop/hello/android/app/build/outputs/apk/app-debug.apkcom.android.ddmlib.InstallException: Failed to establish session    at com.android.ddmlib.Device.installPackages(Device.java:894)    ........    at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61):app:installDebug FAILEDFAILURE: Build failed with an exception.* What went wrong:Execution failed for task ':app:installDebug'.> com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: Failed to establish session* Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.BUILD FAILEDTotal time: 13.945 secs

Could not install the app on the device, read the error above for details. Make sure you have an Android emulator running or a device connected and have set up your Android development environment:https://facebook.github.io/react-native/docs/android-setup.html

I look at my devices

jianglinghuadeMacBook-Pro:hello jianglinghua$ adb devicesList of devices attached98333978    device

crash app in RTL devices - react native android?

$
0
0

I have a something wired issue with react native reanimated,I have a view and I use transform prop style to customize it,

if you change your mobile language to Arabic you will face this issue

Error

JSApplicationIllegalArgumentExceptionError while updating property 'transform' of a view managed by: RCTViewnullFor input string: "٠"  // that's is **Zero** in Arabic Not **Dot** 

For example in this snippet code check comment //

import Animated from 'react-native-reanimated';const AnimatedView = Animated.View;return (<View style={styles.handlerContainer}><AnimatedView          style={[            styles.handlerBar,            {              left: -7.5,              transform: [                {                  rotate: Animated.concat(                    animatedBar1Rotation([0.5, 0]),// crash here 0.5 it will turned to ٠.٥ in Arabic language so that's the reason of crash 'rad',                  ),                },              ],            },          ]}        /><AnimatedView          style={[            styles.handlerBar,            {              right: -7.5,              transform: [                {                  rotate: Animated.concat(                    // @ts-ignore                    animatedBar1Rotation([-0.5, 0]), // crash here -0.5 it will turned to -٠.٥ in Arabic language so that's the reason of crash 'rad',                  ),                },              ],            },          ]}        /></View>    );

Undefined this.props.navigation when using it in App.js inside Stack Screen component

$
0
0

I need to use navigation when pressing the bag icon in the header. When I press it, I get the following error:

undefined is not an object (evaluating '_this.props.navigation')

The thing is I need to use it inside a Stack.Screen component, but props.navigation always return undefined.

App.js file:

import React, { Component } from 'react';import {  Button,  Text,  TextInput,  View,  StyleSheet,  TouchableOpacity,  Image,} from 'react-native';import { Header } from 'react-navigation-stack';import { NavigationContainer } from '@react-navigation/native';import { createStackNavigator } from '@react-navigation/stack';import TelaInicial from './components/telaInicial';import TelaCarrinho from './components/telaCarrinho';const Stack = createStackNavigator();export default function AppContainer() {  return (<NavigationContainer><Stack.Navigator initialRouteName="Inicial"><Stack.Screen          name="Inicial"          component={TelaInicial}          options={{            title: '',            headerTintColor: 'white',            headerStyle: { backgroundColor: '#6b39b6', height: 100 },            height: Header.height,            headerLeft: null,            headerTitle: (<View><TouchableOpacity                  onPress={() => {                    this.props.navigation.navigate('Carrinho');                  }}><Image                    style={{                      width: 29,                      height: 29,                      marginTop: 0,                      marginLeft: 170,                    }}                    source={require('./assets/shopping bag.png')}                  /></TouchableOpacity></View>            ),          }}        /><Stack.Screen          name="Carrinho"          component={TelaCarrinho}          options={{            title: '',            headerTintColor: 'white',            headerStyle: { backgroundColor: '#6b39b6', height: 100 },            height: Header.height,            headerBackTitle: 'Voltar',            headerTitle: 'Carrinho'.toUpperCase(),            headerTitleStyle: {              fontSize: 17,              fontWeight: 600,            },          }}        /></Stack.Navigator></NavigationContainer>  );}

Do you guys have any idea how I can fix it?

I have a link to Expo: https://snack.expo.io/@rapolasls/eager-crackers

Thank you!

Unexpected node type: EXPR found when expecting type: LABELED_ARG

$
0
0

I am trying to run my code in android device. But i am getting this error :

Build file '/Users/sathish/Documents/WorkSpace/RN/mealMate/android/app/build.gradle' line: 83* What went wrong:Could not compile build file '/Users/sathish/Documents/WorkSpace/RN/mealMate/android/app/build.gradle'.> startup failed:  build file '/Users/sathish/Documents/WorkSpace/RN/mealMate/android/app/build.gradle': 83: Unexpected node type: EXPR found when expecting type: LABELED_ARG at line: 83 column: 5. File: _BuildScript_ @ line 83, column 5.         set('react-native', [         ^  1 error

my build.gradle :

project.ext.react = [    enableHermes: false,  // clean and rebuild if changing    set('react-native', [    versions: [      // Overriding Build/Android SDK Versions      android : [        minSdk    : 16,        targetSdk : 28,        compileSdk: 28,      ],      // Overriding Library SDK Versions      firebase: [        // Override Firebase SDK Version        bom           : "21.1.0",        // Override Crashlytics SDK Version        crashlytics   : "2.10.0",        // Override Crashlytics SDK Version        crashlyticsNdk: "2.1.0"      ],    ],  ])]

Not sure whats wrong with my set('react-native', [.

Any help on this ?

3D Virtual Tour engine for React Native

$
0
0

I'm looking for an engine/framework to accomplish something like this https://www.iteleport.com.br/tour3d/mvituzzo-maranata-planta-soberana-75-m%C2%B2/ , a virtual 3D tour inside an apartment. Something for React Native would be perfect, because I need to implement it for Android and iOS. But it also can be for native apps (one for iOS and another for Android).

I found lots of libraries to show 3D pictures and AR, but nothing for 3D models. Any idea what I use for it?

Viewing all 28469 articles
Browse latest View live


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