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

Is there a React Native solution for integrating digital persona finger print scanner

$
0
0

I am working on a react-native project for data capturing which requires me to capture finger prints with digital persona finger print scanner. But I couldn't get a solution yet. Help me with this please..


Function Prop works in Web not Android

$
0
0

Just started react-native. So noob here but simple problem

The following idea (but stripped-down version below) works fine in my browser but in Android I get an error about the child function component not recognizing the prop function name. Any ideas on what I should do differently for Android?

Notice the parent has onSquarePress={squarePress} and the child has <TouchableWithoutFeedback onPress={() => props.onSquarePress(props.notation)}>

parent:

import React, { Component, PropTypes } from 'react';import { Text, View, StyleSheet, TouchableWithoutFeedback } from 'react-native';import Square from './square';const squarePress =(notation) => {  console.log(notation)}export default function Board(props) {  return (<View><Square       key={..}      left={xOffset + i * squareSize}       top={yOffset + y * squareSize}      size={squareSize}      notation={notation}      onSquarePress={squarePress}      /></View>  );}

child

mport React, { Component, PropTypes } from 'react';import { Text, View, StyleSheet, TouchableWithoutFeedback } from 'react-native';export default function Square(props) {  return (<TouchableWithoutFeedback        onPress={() => props.onSquarePress(props.notation)}        disabled={false}><View      key={props.notation}></View></TouchableWithoutFeedback>  );}});

Any ideas would be very appreciated!

Not seeing always allow in android location permission

$
0
0

I have been trying to use an react native ble librairie (react-native-ble-manager). In order to use this the user have to allow location permission (as explain in the documentation android.permission.ACCESS_COARSE_LOCATION and android.permission.ACCESS_FINE_LOCATION if android API >= 29.I request the autorisation as their example with:(PermissionsAndroid is from the react-native librairie) :

if (Platform.OS === 'android'&& Platform.Version >= 23) {            PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION).then((result) => {                if (result) {                    console.log("Permission is OK");                } else {                    PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION).then((result) => {                        if (result) {                            console.log("User accept");                        } else {                            console.log("User refuse");                        }                    });                }            });        }

On my device the pop-up ask me for the autorisation with only two choices :

  • Only when the application is running
  • Refuse

But with their example I have 3 choices the two others and "always authorise"

And for some reason I'm not able to scan peripheral if I don't always approve (I have been able to change to always for my application by going in the settings of it).

Part of my android manifest (android/app/src/main) (as you can see I have background_location)

<uses-permission android:name="android.permission.BLUETOOTH"/><uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/><uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/><uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/><uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>

I'm sure I'm missing an obvious thing but I can't see what..In advance thank you :)

React Native TextInput works Great on iOS but feels super buggy on Android

$
0
0

I'm having issues with some erratic behavior on my TextInputs using React Native on Android devices.

The TextInputs work great on iOS. No issues at all, never laggy.

On Android, it's a different story. I've tested on a Google Pixel and Galaxy S7. The TextInputs seem to often fill themselves with characters I am not selecting. The keyboard often lags, highlighting multiple characters I've pressed. When pressing the done button, the keyboard will continue highlighting more characters I've pressed leaving the keyboard expanded for a few seconds after pressing done.

I Initially thought this issue was related to auto fill. I tried turning that off on my TextInput to try and mitigate this issue, but it didn't seem to help much.

I am copying a basic TextInput found in my application. I'm hoping someone can point me to a prop I'm not using or misusing that is causing the Android issues.

  async onChangeText(text) {    const { field, updateParentComponent, validateInput } = this.props;    let isValid = true;    if (validateInput) {      isValid = await validateInput(field, text);    }    this.setState(      {        inputValue: text,        isValid: isValid,      },      () => {        updateParentComponent(field, text, isValid);      }    );  }
const AnimatedTextInput = Animated.createAnimatedComponent(TextInput);<KeyBoardAvoidingView   behavior="height"><AnimatedTextInput    style{... I change style when the input is focused, hence the Animated component}    autocapitlize="none"    importantForAutofill="no"    autoCompleteType="off"    returnKeyType="done"    autoCorrect={false}    returnKeyLabel="Done"    onChangeText=(text) => this.onChangeText(text)    value={this.state.inputValue}  /></KeyBoardAvoidingView>

I am attaching a screen shot of the highlighted keys.

enter image description here

React Native 'Modal' Component Not Covering Entire Screen on Android when using Full Screen Theme

$
0
0

The title says it all. I've edited the styles.xml file (/projectname/android/app/src/res/values/styles.xml) to contain the following:

<resources><!-- Base application theme. --><style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"><item name="windowNoTitle">true</item><item name="windowActionBar">false</item><item name="android:windowFullscreen">true</item><item name="android:windowContentOverlay">@null</item></style></resources>

This code successfully makes the app fullscreen, removing the Android status bar. However, if I launch a React Native 'Modal' component the modal only extends as far to the top as where the edge of the status bar would have been, leaving a gap the size of a status bar. How would I modify the modal to extend all the way to the top?

Here's a screenshot of the open modal with the gap:

Open modal with gap

Is it possible to convert android/iOS app in cross platform app?

$
0
0

Is it possible to convert an android/iOS app in a cross platform app like react native or flutter?

I had an app developed in android and iOS and I want to convert it to, for example, react native so that I can continue developing it myself because I have no skills in android/iOS but I have skills in React Native and Flutter.

Android emulator can't connect localhost API

$
0
0

I developed the app with React native and developed back-end with nodejs when start iOS simulator can connect with localhost API but andriond have error message

Network Error

my localhost API is http://127.0.0.1:3000/api/and I try postman to get localhost API it can work.

In react native I connect with API with axios

I tried a method but I don't know what settings I need to add.I find it weird because iOS can work, but Android doesn't.

How to pass and use data from react native to native android or ios?

$
0
0

I need to pass some data form react native to both native android and ios.

How can I do that?

thank you,


Can't build my app because something is wrong with react-native-reanimated

$
0
0

I made the mistake of building my app using Expo, because I didn't know that I had to do Expo Eject to use some features that Expo doesn't support yet, and I thought it would be easier for me to build an app using React Native and Expo as a React Native beginner.

So, I've been trying for several hours to do the Expo Eject, and it has been painful to me. I can't build my app on Android Studio, I always receive this error message, and I don't know how to fix it.

Build file'C:....\node_modules\react-native-reanimated\android\build.gradle'line: 89

A problem occurred configuring project ':react-native-reanimated'.

Cannot query the value of this provider because it has no value available.

Commands I used:

npm install -g expo-cliexpo ejectreact-native link react-native-ble-plx   react-native link react-native-reanimated

But when I try to run the project on Android Studio, the build fails, the command react-native run-android gives me an error probably because I can't build the project.

Command to run the app in a selected device

$
0
0

is there a command to run a flutter app in a selected device or platform? say, an android and ios emulator were both open. right now, flutter run will just run the app on the most recently opened device.

for example, in react-native cli, you can say react-native run-ios or run-android

"ActivityIndicatorIOS" error when trying to run react-native app on Android emulator

$
0
0

Trying to get a react-native application to run on a new computer. I've installed npm and expo, ran expo update, ran Set-ExecutionPolicy Unrestricted.Ran expo start -c to open the metro bundler on a browser, and got an Android emulator running.Clicked "run on android device/emulator". I'm getting the following error on the android emulator:

The development server returned response error code: 500

And the following error on the VSCode console:

Failed boinding JavaScript bundle.Unable to resolve "ActivityIndicatorIOS" from "node_modules\react-native\Libraries\react-native\react-native.js"

Can't find this error anywhere, how can I solve this?

This application and the service it wants to communicate with must be signed with the same keystore

$
0
0

When I am trying to launch the react-native Android app on emulator or device from a particular system, It is showing such a issue. It is fine with rest all systems. What may be the reason behind it?

Why In React native Android Google MapView.Animated not moving by finger touch?

$
0
0

In react native i have added MapView.Animated under KeyboardAwareScrollView>FormBlock>Fragment>MapView.Animated. When i try to move map by finger touch vertical or horizontal it scrolling whole screen while i need to move only map. This issue is only in android same code is working in IOS.

Execution failed for task ':app:mergeDebugNativeLibs'. in react native

$
0
0

I install react-native-pdf to my project, when I run with "npx react-native run-android" occur failed and show errors like below this

* What went wrong:Execution failed for task ':app:mergeDebugNativeLibs'.> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade> More than one file was found with OS independent path 'lib/x86/libc++_shared.so'

Can anyone help me for can use package react-native-pdf

ive

skip robot verification in firebase phone authorisation using react native [duplicate]

$
0
0

While phone verification in firebase, the app opens a App-Name/auth/handler page and does robot verification and returns to app again and then an OTP is recieved.

I want to skip this middle step of robot verification.

I tried using

 firebase().auth().settings.appVerificationDisabledForTesting = true;

but it seems only for testing purpose and in IOS.


my npx react-native run-android build fails

$
0
0

My colleague recently added react-native-camera to my project. I merged the code and when i run npx react-native run-android my build fails with:

FAILURE: Build failed with an exception.* What went wrong:Could not determine the dependencies of task ':app:preDebugBuild'.> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.> Could not resolve project :react-native-camera.     Required by:         project :app> Cannot choose between the following variants of project :react-native-camera:          - generalDebugRuntimeElements          - mlkitDebugRuntimeElements        All of them match the consumer attributes:          - Variant 'generalDebugRuntimeElements' capability Rombot:react-native-camera:unspecified:              - Unmatched attributes:                  - Found com.android.build.api.attributes.VariantAttr 'generalDebug' but wasn't required.                  - Found react-native-camera 'general' but wasn't required.              - Compatible attributes:                  - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.                  - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.                  - Required org.gradle.usage 'java-runtime' and found compatible value 'java-runtime'.          - Variant 'mlkitDebugRuntimeElements' capability Rombot:react-native-camera:unspecified:              - Unmatched attributes:                  - Found com.android.build.api.attributes.VariantAttr 'mlkitDebug' but wasn't required.                  - Found react-native-camera 'mlkit' but wasn't required.              - Compatible attributes:                  - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.                  - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.                  - Required org.gradle.usage 'java-runtime' and found compatible value 'java-runtime'.

I have tried to remove my node modules and then do a npm install but i still get the same error. Any help would be great. Thanks in advance.

How solve (Could not initialize class org.codehaus.groovy.reflection.ReflectionCache) issue in react native

$
0
0

$ npx react-native run-androidinfo Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.Jetifier found 864 file(s) to forward-jetify. Using 4 workers...info Starting JS server...info Launching emulator...error Failed to launch the emulator. Reason: Could not start an emulator within 30 seconds.warn Please launch an emulator manually or connect a device. Otherwise, the app may fail to launch.info Installing the app...

FAILURE: Build failed with an exception.

  • What went wrong:Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

  • Try: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 1m 23s

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. 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:Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

  • Try: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 1m 23s

at checkExecSyncError (child_process.js:629:11)at execFileSync (child_process.js:647:13)at runOnAllDevices (E:\work\react-native\AwesomeProject1\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)

app:compileDebugJavaWithJavac'. > Could not find tools.jar Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`

$
0
0

when I use this command in the terminal:

PS C:\web dev\practice-projects\react-native\myproject> react-native run-android --no-jetifier

I get this whole error:

info JS server already running.'adb' 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...Starting a Gradle Daemon, 1 stopped Daemon could not be reused, use --status for details> Task :app:compileDebugJavaWithJavac FAILEDDeprecated 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.2/userguide/command_line_interface.html#sec:command_line_warning 14 actionable tasks: 2 executed, 12 up-to-dateFAILURE: Build failed with an exception.* What went wrong:Execution failed for task ':app:compileDebugJavaWithJavac'.> Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_271 contains a valid JDK installation.* Try: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.orgBUILD FAILED in 39serror 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

My emulator isn't being launched and I have tried multiple fixes. I am getting started in react-native and don't understand the warnings or answers on similar questions. Please help.

React Native Google Map Experience, compared to using native languages such as Swift for IOS and Kotlin for Android [closed]

$
0
0

I have been wondering between choosing native languages or React Native for mobile app development. I understand that React Native is similar to React JS and due to having a web dev background in React JS, i have been thinking that React Native would fit me. However, my app requires a map, which i feel may not be really good when using React Native as opposed to native languages. This is due to the comparison i made of the google maps scrolling effect, where it looks smoother on the google maps app rather than the google maps website on the browser.

Thus, it would be great to have someone who have done mobile app development using either React Native or native languages with google maps to advise me. Thank you in advance!

react-native switch crashes on Android

$
0
0

I am trying to use a switch in react-native (0.63.4).

 const trackColor = { false: defaultSwitchOffColor, true: TuColor.Primary };...<Switch value={isTeamComparisonAllowed}    trackColor={trackColor}    onValueChange={() => this.setState({ isTeamComparisonAllowed: !isTeamComparisonAllowed })}/>

On iOS it runs without problems, but on Android I get an error when I call the component that contains the switch:

2021-01-09 16:02:27.750 27964-27964/team.trainyour.trainurteam E/unknown:ReactNative: Exception in native call    com.facebook.react.bridge.JSApplicationIllegalArgumentException: Error while updating property 'trackTintColor' of a view managed by: AndroidSwitch        at com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateViewProp(ViewManagersPropertyCache.java:102)        at com.facebook.react.uimanager.ViewManagerPropertyUpdater$FallbackViewManagerSetter.setProperty(ViewManagerPropertyUpdater.java:136)        at com.facebook.react.uimanager.ViewManagerPropertyUpdater.updateProps(ViewManagerPropertyUpdater.java:56)        at com.facebook.react.uimanager.ViewManager.updateProperties(ViewManager.java:49)        at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:270)        at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:186)        at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.dispatchPendingNonBatchedOperations(UIViewOperationQueue.java:1112)        at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1083)        at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29)        at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:175)        at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:85)        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:947)        at android.view.Choreographer.doCallbacks(Choreographer.java:761)        at android.view.Choreographer.doFrame(Choreographer.java:693)        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:935)        at android.os.Handler.handleCallback(Handler.java:873)        at android.os.Handler.dispatchMessage(Handler.java:99)        at android.os.Looper.loop(Looper.java:193)        at android.app.ActivityThread.main(ActivityThread.java:6669)        at java.lang.reflect.Method.invoke(Native Method)        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Viewing all 29568 articles
Browse latest View live


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