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

TypeError: undefined is not an object (evaluating '(0,t(r(d[3])).default)().apiUrl' release channel android problem

$
0
0

I got this problem when i expo publish my react native app with or without --release-channel dev flag.I set up a config file environment.js to get different release version like this :

import Constants from "expo-constants";import { Platform } from "react-native";const localhost = Platform.OS === "ios" ? "localhost:8080" : "10.0.2.2:8080";const ENV = {  localhost: {    //apiUrl: localhost,    apiUrl: "http:xxxx",  },  dev: {    apiUrl: "http:xxxx",  },  staging: {    apiUrl: "http:xxxx",    // Add other keys you want here  },  prod: {    apiUrl: "http:xxxx",    // Add other keys you want here  },};const getEnvVars = (env = Constants.manifest.releaseChannel) => {  // What is __DEV__ ?  // This variable is set to true when react-native is running in Dev mode.  // __DEV__ is true when run locally, but false when published.  if (__DEV__ || env === undefined || env === null || env === "") {    return ENV.localhost;  } else if (env.indexOf("dev") !== -1) {    return ENV.dev;  } else if (env.indexOf("staging") !== -1) {    return ENV.staging;  } else if (env.indexOf("prod") !== -1) {    return ENV.prod;  }};export default getEnvVars;

I intercept the config with creation of new intance of axios like this :

import axios from "axios";import { getKey } from "./deviceStorage";import getEnvVars from "../../environment";const { apiUrl } = getEnvVars();const instance = axios.create({  // .. where we make our configurations  baseURL: apiUrl,});instance.interceptors.request.use((config) => {  const token = getKey("id_token");  token.then((value) => {    config.headers.Authorization = value ? `Bearer ${value}` : "";  });  return config;});export default instance;

when i emulate on my device every thing work fine but when i expo publish and scan QR code with my device the app crash after splash screen and i got this error say :

enter image description here

Please any help thanks !!!


How to use Android Emulator on macOS + React Native with as little Android Studio as possible?

$
0
0

I'm using React Native at work on the latest macOS version, allowing me to easily use Simulator for testing and debugging on iOS.

Now I want to debug and test on Android. I have a personal Android device, but it's hard for me to get the app working on it using Expo (don't have a physical cable on me atm, and security at work makes it hard for tunneling service to work over the same network with our staging build).

I'm trying to get an Android emulator running on macOS. I personally hate Android Studio and would rather not use it. I know that there's sdkmanager and the Android Command Line tools that Microsoft provides, but I'm not sure how to get started using with those. I'd be using Genymotion if it was free, but it isn't unfortunately.

What do other React Native developers who test and debug on Android do?

Thanks!

stuck at starting intent main activity react native app

$
0
0

Trying to run the react native app on mobile device connected using react-native run-android. The app build was successful but the app crash on opening and on the command prompt it stucks on Starting: Intent { cpm=com.project.projectname/.MainActivity }

The App installed on the mobile device but always keep stopping. Can someone help me how to debug this and i cant see where the error messages at.

this the whole command prompt output

C:\xampp\htdocs\projectname>react-native run-androidinfo Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.Jetifier found 1109 file(s) to forward-jetify. Using 4 workers...info Starting JS server...'C:\Users\user' 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...Parallel execution with configuration on demand is an incubating feature.> Configure project :appWARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.htmlCould not find google-services.json while looking in [src/nullnull/debug, src/debug/nullnull, src/nullnull, src/debug, src/nullnullDebug]registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)Could not find google-services.json while looking in [src/nullnull/release, src/release/nullnull, src/nullnull, src/release, src/nullnullRelease]registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)> Configure project :react-native-firebasereact-native-firebase: using React Native prebuilt binary from C:\xampp\htdocs\projectname\node_modules\react-native\android> Task :app:processDebugGoogleServicesParsing json file: C:\xampp\htdocs\projectname\android\app\google-services.json> Task :app:processDebugManifestC:\xampp\htdocs\projectname\android\app\src\main\AndroidManifest.xml:24:9-31:50 Warning:        activity#com.google.firebase.auth.internal.FederatedSignInActivity@android:launchMode was tagged at AndroidManifest.xml:24 to replace other declarations but no other declaration present> Task :react-native-camera:compileGeneralDebugJavaWithJavac> Task :react-native-firebase:compileDebugJavaWithJavac> Task :app:transformClassesWithFirebasePerformancePluginForDebugjava.lang.ClassNotFoundException: android.graphics.fonts.Fontjava.lang.ClassNotFoundException: android.graphics.fonts.Fontjava.lang.ClassNotFoundException: android.graphics.fonts.Fontjava.lang.ClassNotFoundException: android.graphics.fonts.Fontjava.lang.ClassNotFoundException: com.google.firebase.dynamiclinks.DynamicLink$Builder> Task :app:installDebug09:26:46 V/ddms: execute: running am get-config09:26:46 V/ddms: execute 'am get-config' on 'R58M55ASZDM' : EOF hit. Read: -109:26:46 V/ddms: execute: returningInstalling APK 'app-debug.apk' on 'SM-A105G - 9' for app:debug09:26:46 D/app-debug.apk: Uploading app-debug.apk onto device 'R58M55ASZDM'09:26:46 D/Device: Uploading file onto device 'R58M55ASZDM'09:26:47 D/ddms: Reading file permision of C:\xampp\htdocs\projectname\android\app\build\outputs\apk\debug\app-debug.apk as: rwx------09:26:47 V/ddms: execute: running pm install -r -t "/data/local/tmp/app-debug.apk"09:27:16 V/ddms: execute 'pm install -r -t "/data/local/tmp/app-debug.apk"' on 'R58M55ASZDM' : EOF hit. Read: -109:27:16 V/ddms: execute: returning09:27:16 V/ddms: execute: running rm "/data/local/tmp/app-debug.apk"09:27:16 V/ddms: execute 'rm "/data/local/tmp/app-debug.apk"' on 'R58M55ASZDM' : EOF hit. Read: -109:27:16 V/ddms: execute: returningInstalled on 1 device.Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.Use '--warning-mode all' to show the individual deprecation warnings.See https://docs.gradle.org/4.10.1/userguide/command_line_interface.html#sec:command_line_warningsBUILD SUCCESSFUL in 20m 38s62 actionable tasks: 59 executed, 3 up-to-dateinfo Connecting to the development server...info Starting the app...Starting: Intent { cmp=com.project.projectname/.MainActivity }

messaging().onNotificationOpenedApp is never triggered, messaging().getInitialNotification() is triggered but remoteMessage is always null

$
0
0

I'm using react-native-firebase v6.4.0. I successfully registered a background handler with setBackgroundMessageHandler and everything works fine. Now I'm trying to handle notification tap when the app is in background/quit and I'm using onNotificationOpenedApp/getInitialNotification. The problem I'm facing is that the first method is never triggered while the second is triggered but remoteMessage parameter is always null. I've also tried to generate a release build but the result is the same.

index.js

// importsmessaging().setBackgroundMessageHandler(async remoteMessage => {  // storing the message with redux});function HeadlessCheck({isHeadless}) {  return isHeadless ? null : <App />;}AppRegistry.registerComponent(appName, () => HeadlessCheck);

App.js

// other importsimport messaging from '@react-native-firebase/messaging';import {store, persistor} from './Store';export default function App() {  useEffect(() => {    (async () => await messaging().registerDeviceForRemoteMessages())();    const unsubscribe = messaging().onMessage(async remoteMessage => {      store.dispatch(storeNews(remoteMessage));    });    messaging().onNotificationOpenedApp(remoteMessage => {      // The below code gets never executed      Alert.alert('here');      console.log('Notification caused app to open from background state:',        remoteMessage,      );    });    messaging()      .getInitialNotification()      .then(remoteMessage => {        console.log(remoteMessage); // always prints null        if (remoteMessage) {          // Never reached          Alert.alert('here');          console.log('Notification caused app to open from quit state:',            remoteMessage,          );        }      });    return unsubscribe;  }, []);  return (<><StatusBar barStyle="dark-content" /><Provider store={store}><PersistGate loading={null} persistor={persistor}><RootNavigator /></PersistGate></Provider></>  );}

react-native info:

System:    OS: Windows 10 10.0.18363    CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz    Memory: 6.90 GB / 15.73 GB  Binaries:    Node: 10.15.3 - C:\Program Files\nodejs\node.EXE    Yarn: 1.9.4 - C:\Users\user\AppData\Roaming\npm\yarn.CMD    npm: 6.14.1 - C:\Program Files\nodejs\npm.CMD  SDKs:    Android SDK:    API Levels: 21, 22, 23, 24, 25, 26, 27, 28    Build Tools: 23.0.1, 25.0.0, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.2, 28.0.3    System Images: Google APIs Intel x86 Atom, android-27Intel x86 Atom  IDEs:    Android Studio: Version  3.5.0.0 AI-191.8026.42.35.6010548  npmPackages:    react: 16.9.0 => 16.9.0    react-native: 0.61.5 => 0.61.5

package.json:

{  ..."@react-native-firebase/app": "^6.4.0","@react-native-firebase/messaging": "^6.4.0",  ...}

I tried to run the code on both a physical Android device and on an Android emulator and I got the same behaviour.

Physical device specs:

Model code: SM-G975F Android version: 10

Emulator specs:

Name: Nexus_5X_API_27_x86Device: Nexus 5X (Google)Path: C:\Users\user\.android\avd\Nexus_5X_API_27_x86.avdBased on: Android API 27 Tag/ABI: google_apis/x86

I appreciate any help. Many thanks in advance.

React-native app is not showing the screens

$
0
0

I am getting these errors.

TypeError:undefined is not an object (evaluating'_reactnative.View.propTypes.style')

Not able to set `ShadowColor` in react-native android

$
0
0

Environment

  • Environment:

    • OS: macOS High Sierra 10.13.1
    • Node: 8.9.1
    • Yarn: 0.17.10
    • npm: 5.6.0
    • Watchman: 4.7.0
    • Xcode: Xcode 9.2 Build version 9C40b
    • Android Studio: 2.3 AI-162.4069837
  • Packages: (installed)

    • react: 16.0.0
    • react-native: 0.51.0

Steps to Reproduce

Run this code

import React, {Component} from 'react';import {View, Text, TouchableOpacity} from 'react-native';class App extends Component {  render() {    return (<View style={styles.container}><View><TouchableOpacity style={[styles.boxShadow, shadow]}><Text style={styles.text}>LOGIN</Text></TouchableOpacity></View></View>);  }}const shadow = {  shadowColor: '#30C1DD',  shadowRadius: 10,  shadowOpacity: 0.6,  elevation: 8,  shadowOffset: {    width: 0,    height: 4  }}const styles = {  container: {    flex: 1,    justifyContent: 'center',    alignItems: 'center'  },  boxShadow: {    width: 200,    height: 50,    borderRadius: 10,    backgroundColor: '#ed7171',    justifyContent: 'center',    alignItems: 'center'  },  text: {    color: '#ffffff'  }};export default App;

Expected Behavior

Is there way to achieve like this Shadow in Android

buttonshadow

as shadow Props of react-native only supports in iOS

  • color need to be changed
  • Tried elevation but can not change default greyed color
  • able to achieve in ios with shadowColor props but not in android as it is only support iOS

Actual Behavior

See sample code and preview.

  • It should be work for android too.
  • Shadow color is always grey, however I tried to change..

Reproducible Demo

This is sample snapshot in which I can only get shadow with elevation with only grey color [default].

screen shot 2017-12-15 at 4 56 54 pm

ViroReact render issue in debug build android

$
0
0

I am using ViroARSampleApp code to demonstrates placing, rotating and dragging objects in AR. Everything is working fine when I run react-native run-android --variant=arDebug but when I detach data cable and run the app then the application is running fine but objects are not rendered.

I tried to make proper APK file and install to the device but facing the same issue. I tried these commands to make build react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/, cd android, ./gradlew assemblearDebug. i also tried ./gradlew bundlearDebugJsAndAssets.

I am new in react native and AR, kindly suggest me the solution for this issue.

React Native Own font doesnt get applied to all elements

$
0
0

I wanted to implement my own font (from google) to use it inside my app. I loaded it and it works because some text gets changed by it. However some text doenst change which doesnt make sense to me.

I guess its a bug somehow maybe somebody has experienced this. Its a simple screen with simple code.

import React, {Component} from 'react';import {View, Text, StyleSheet, Button} from 'react-native';import COLORS from '../assets/COLORS';import {TextInput} from 'react-native-gesture-handler';class BMI extends Component {  render() {const BMI = 20;    return (<View style={styles.container}><Text style={styles.textStyle}> BMI - Calculator </Text><Text style={{color: COLORS.white, fontSize: 20}} >Dein momentaner BMI:  <Text style={{color: COLORS.primary, fontSize: 24}} >{BMI}</Text> </Text><View><View style={styles.InputContainer}><Text style={styles.inputText}>AGE</Text><TextInput style={styles.TextInput} /></View><View style={styles.InputContainer}><Text style={styles.inputText}>HEIGHT</Text><TextInput style={styles.TextInput} /></View><View style={styles.InputContainer}><Text style={styles.inputText}>WEIGHT</Text><TextInput style={styles.TextInput} /></View><View style={{marginTop: 25, marginHorizontal: 15}}><Button onPress={() => alert("Hello")} title="Calculate" color={COLORS.lightB} /></View></View></View>    );  }}const styles = StyleSheet.create({  container: {    flex: 1,    alignItems: 'center',    // justifyContent: "center",    backgroundColor: COLORS.darkBG,  },  textStyle: {    color: COLORS.lightB,    fontSize: 30,    fontWeight: 'bold',    marginVertical: 30,    fontFamily: "Pacifico"  },  InputContainer: {    justifyContent: 'space-around',    flexDirection: 'row',    width: '100%',    marginVertical: 20,  },  inputText: {    color: COLORS.white,    width: '30%',    marginLeft: 15,    fontSize: 18,    fontFamily: "Pacifico"  },  TextInput: {    backgroundColor: COLORS.primary,    width: '60%',    color: COLORS.white,    fontFamily: "Pacifico"  },});export default BMI;

As u can see I load pacifico and it works but only for this text ( see pic below ):

Screenshot


React-navigation drawer content is misaligned

$
0
0

I'm writing a React Native app that uses the react-navigation 5.x library, specifically @react-navigation/drawer. I have four screens in the drawer, each with an icon and a label.

Screenshot

enter image description here

My problem is that the labels for each screen do not line up correctly -- see the 'Device Configuration' item compared to the others. The alignment seems to depend on the size of the icon, with the wider icons pushing the label more to the right.

I've tried hard-coding the size of the icon so that they're all the same, but that didn't work. I'm not sure what else to try. I'd appreciate any ideas!

My code:

function Icon(props) {    return (<Ionicon            name={props.name}            size={props.size}            color={props.color}        />    );}const DrawerNavigator = createDrawerNavigator();function Drawer() {    return (<DrawerNavigator.Navigator            drawerContentOptions={{                activeTintColor: Colors.drawerScreenSelected            }}><DrawerNavigator.Screen                name="Home"                component={Tabs}                options={{                    drawerIcon: ({color, size}) => (<Icon name="md-home" color={color} size={size} />                    )                }}            /><DrawerNavigator.Screen                name="Login"                component={LoginScreen}                options={{                    drawerIcon: ({color, size}) => (<Icon name="md-log-in" color={color} size={size} />                    )                }}            /><DrawerNavigator.Screen                name="Device Configuration"                component={DeviceConfigScreen}                options={{                    drawerIcon: ({color, size}) => (<Icon name="md-bluetooth" color={color} size={size} />                    )                }}            /><DrawerNavigator.Screen                name="Email Data"                component={ExportDataScreen}                options={{                    drawerIcon: ({color, size}) => (<Icon name="md-at" color={color} size={size} />                    )                }}            /></DrawerNavigator.Navigator>    );}export default Drawer;

Downloading Video in an Application in React Native

$
0
0

I'm creating an app in React Native in which I want to download a video in the application, but that video should not appear in Gallary of the device. It should download in the application's folder. How should I do that any idea?

React native camera stay black after component change

$
0
0

I am currently working on a react-native application.I would like to use the camera with the 'expo' package.

I manage to display the camera, but when I switch between my components (main menu component/ settings component) and I return to the camera component, the camera preview is black.

In fact it is the same problem as here: https://github.com/expo/expo/issues/5952

I used the proposed solution but it still doesn't work.

import React, { useState, useEffect } from 'react';import { Text, View, TouchableOpacity, Dimensions } from 'react-native';import { Camera } from 'expo-camera';import { useFocusEffect, useNavigation } from '@react-navigation/native';import { FontAwesome, Ionicons,MaterialCommunityIcons } from '@expo/vector-icons';import { withNavigationFocus } from 'react-navigation';import * as Permissions from 'expo-permissions'import styles from './styles';class CameraPage extends React.Component {  camera = null;  state = {      hasCameraPermission: null,  };  async componentDidMount() {      const camera = await Permissions.askAsync(Permissions.CAMERA);      const hasCameraPermission = (camera.status === 'granted');      this.setState({ hasCameraPermission });  };  render() {      const { hasCameraPermission } = this.state;      if (hasCameraPermission === null) {          return <View />;      } else if (hasCameraPermission === false) {          return <Text>Access to camera has been denied.</Text>;      }      else if (this.props.isFocused)      {        return (<View style={{ flex: 1 }}><Camera style={{ flex: 1 }} type={this.state.cameraType}></Camera><Text> IS FOCUS </Text></View>        )      }  };};export default withNavigationFocus(CameraPage);

The app launches by default in the camera component and the camera preview is displayedAs I have said, when I switch the component and come back to the camera the preview stays black,but the text 'IS FOCUS' is displayed so this.props.isFocused is true.

Therefore the problem comes from the camera itself. But I do not understand.

Any ideas where the problem comes from?

How to close webview after the work is done in react native

$
0
0

I am using following code to render a webview:

const someHTMLFile = require('./somefile.html')render() {  return (<View style={{flex: 1}}><WebView          style={{flex: 1}}          source={someHTMLFile}          ref={( webView ) => this.webView = webView}      />      </View>  );}

In this html file, there is a form which is automatically submitted when the webview loads (with some data sent from reactnative part of code) and in the end, the file is redirected to a specific url, where some processing is done (on the send data), and right now, it returns nothing. So the screen goes blank.

So, at this point, I want to close the webview and take the user back to my reactnative app.. So, how can I do that? any suggestions?

How to handle back button behavior in bottom tabs in React Native?

$
0
0

I have a @react-navigation/bottom-tabs navigator when my app opens whose contents are like:

<Tab.Navigator        tabBarOptions={{            activeTintColor: '#77dd77',            inactiveTintColor: 'gray',        }}        tabBar={props => <MyTabBar {...props} />}        backBehavior={"history"}><Tab.Screen            name="Home"            component={Home}            options={{ title: 'Home' }}        /><Tab.Screen            name="Orders"            component={Orders}            options={{ title: 'Orders' }}        /><Tab.Screen            name="Profile"            component={Profile}            options={{ title: 'Profile' }}        /></Tab.Navigator>

I have a BackHandler in my code that makes the app exit when back button is pressed from the home page. Everything is fine and I have checked that the backhandler gets called when back button is pressed.

But when I switch to any other tab and then return to the homepage and press back to exit the app, backhandler stops working and the app shows error "The action 'GO_BACK'was not handled by any navigator. Is there any screen to go back to?"

This is a development-only warning but in the signed version, the app doesn't show any error and doesn't even exit.

How can I address this 'GO_BACK' action?

Task :react-native-screens:androidJavadoc FAILED

$
0
0

I'm trying to debug my project and to deploy it as APK.I'm using only android. When I debug the project or install the signed release APK it crashes.Now I search the error with ./gradlew build --stacktrace

What I've tried:- jetify- dependencies: implementation(:react-native-screens)and many things more, but I can't tell it all.

It's blocking my work.

The exception for ./gradlew build --stacktrace is:

> Task :react-native-screens:androidJavadoc FAILED/Users/[username]/Documents/[projectfolder]/mobileapp/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderSubview.java:6: error: package com.facebook.react.bridge does not existimport com.facebook.react.bridge.ReactContext;

[...]

FAILURE: Build failed with an exception.* What went wrong:Execution failed for task ':react-native-screens:androidJavadoc'.> Javadoc generation failed. Generated Javadoc options file (useful for troubleshooting): '/Users/[username]/Documents/[projectfolder]/mobileapp/node_modules/react-native-screens/android/build/tmp/androidJavadoc/javadoc.options'* Try:Run with --info or --debug option to get more log output. Run with --scan to get full insights.* Exception is:org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':react-native-screens:androidJavadoc'.        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:205)        at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:263)        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:203)        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:184)        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:114)        at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)        at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:62)        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)        at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41)        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:372)        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:359)        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:352)        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:338)        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)Caused by: org.gradle.api.GradleException: Javadoc generation failed. Generated Javadoc options file (useful for troubleshooting): '/Users/[username]/Documents/[projectfolder]/mobileapp/node_modules/react-native-screens/android/build/tmp/androidJavadoc/javadoc.options'        at org.gradle.api.tasks.javadoc.internal.JavadocGenerator.execute(JavadocGenerator.java:58)        at org.gradle.api.tasks.javadoc.internal.JavadocGenerator.execute(JavadocGenerator.java:31)        at org.gradle.api.tasks.javadoc.Javadoc.executeExternalJavadoc(Javadoc.java:164)        at org.gradle.api.tasks.javadoc.Javadoc.generate(Javadoc.java:152)        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:49)        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:42)        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:727)        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:694)        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.run(ExecuteActionsTaskExecuter.java:568)        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:553)        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:536)        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$300(ExecuteActionsTaskExecuter.java:109)        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.executeWithPreviousOutputFiles(ExecuteActionsTaskExecuter.java:276)        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:265)        at org.gradle.internal.execution.steps.ExecuteStep.lambda$execute$1(ExecuteStep.java:33)        at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:33)        at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:26)        at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:67)        at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:36)        at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:49)        at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:34)        at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:43)        at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:73)        at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:54)        at org.gradle.internal.execution.steps.CatchExceptionStep.execute(CatchExceptionStep.java:34)        at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:44)        at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:54)        at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:38)        at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:49)        at org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:159)        at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:72)        at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:43)        at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:44)        at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:33)        at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:38)        at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:24)        at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:92)        at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:85)        at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:55)        at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:39)        at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:76)        at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:37)        at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:36)        at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:26)        at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:94)        at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:49)        at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:79)        at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:53)        at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:74)        at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute$2(SkipEmptyWorkStep.java:78)        at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:78)        at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:34)        at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:39)        at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:40)        at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:28)        at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:192)        ... 30 moreCaused by: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/Home/bin/javadoc'' finished with non-zero exit value 1        at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:417)        at org.gradle.process.internal.DefaultExecAction.execute(DefaultExecAction.java:38)        at org.gradle.api.tasks.javadoc.internal.JavadocGenerator.execute(JavadocGenerator.java:53)        ... 98 more

package.json

{"name": "HumanHelps","version": "0.0.1","private": true,"scripts": {"android": "react-native run-android","ios": "react-native run-ios","start": "react-native start","test": "jest","lint": "eslint ."  },"dependencies": {"@eva-design/eva": "^1.4.0","@react-native-community/masked-view": "^0.1.8","@react-native-firebase/app": "6.4.0","@react-native-firebase/auth": "6.4.0","@react-native-firebase/firestore": "6.4.0","@react-navigation/native": "^5.1.5","@react-navigation/stack": "^5.2.10","@ui-kitten/components": "^4.4.1","@ui-kitten/eva-icons": "^5.0.0-alpha.1","jetifier": "^1.6.5","react": "16.11.0","react-native": "0.62.0","react-native-gesture-handler": "^1.6.1","react-native-keyboard-aware-scroll-view": "^0.9.1","react-native-safe-area-context": "^0.7.3","react-native-screens": "^2.5.0","react-native-simple-toast": "^1.1.0","react-native-svg": "^12.1.0"  },"devDependencies": {"@babel/core": "^7.9.0","@babel/runtime": "^7.9.2","@react-native-community/eslint-config": "^1.0.0","babel-jest": "^25.2.4","eslint": "^6.8.0","jest": "^25.2.4","metro-react-native-babel-preset": "^0.59.0","react-test-renderer": "16.11.0"  },"jest": {"preset": "react-native"  }}

android/build.gradle

// 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    }    repositories {        google()        jcenter()    }    dependencies {        classpath("com.android.tools.build:gradle:3.5.2")        classpath('com.google.gms:google-services:4.2.0')        // NOTE: Do not place your application dependencies here; they belong        // in the individual module build.gradle files    }}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' }    }}

android/app/build.gradle

apply plugin: "com.android.application"import com.android.build.OutputFileproject.ext.react = [    enableHermes: false,  // clean and rebuild if changing]apply from: "../../node_modules/react-native/react.gradle"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 "de.neufeldstudios.humanhelps"        minSdkVersion rootProject.ext.minSdkVersion        targetSdkVersion rootProject.ext.targetSdkVersion        versionCode 1        versionName "1.0"        multiDexEnabled true    }    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        }        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.debug            minifyEnabled enableProguardInReleaseBuilds            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"            signingConfig signingConfigs.release        }    }    packagingOptions {        pickFirst "lib/armeabi-v7a/libc++_shared.so"        pickFirst "lib/arm64-v8a/libc++_shared.so"        pickFirst "lib/x86/libc++_shared.so"        pickFirst "lib/x86_64/libc++_shared.so"    }    // 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            }        }    }}dependencies {    implementation project(':react-native-screens')    implementation fileTree(dir: "libs", include: ["*.jar"])    //noinspection GradleDynamicVersion    implementation "com.facebook.react:react-native:+"  // From node_modules    implementation 'androidx.multidex:multidex:2.0.1'    implementation 'androidx.appcompat:appcompat:1.1.0-rc01'    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02"    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {      exclude group:'com.facebook.fbjni'    }    debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {        exclude group:'com.facebook.flipper'    }    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {        exclude group:'com.facebook.flipper'    }    if (enableHermes) {        def hermesPath = "../../node_modules/hermes-engine/android/";        debugImplementation files(hermesPath +"hermes-debug.aar")        releaseImplementation files(hermesPath +"hermes-release.aar")    } else {        implementation jscFlavor    }}// 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 from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)apply plugin: 'com.google.gms.google-services'

node-modules/react-native-screens/android/build.gradle

buildscript {    repositories {        google()        jcenter()    }    dependencies {       classpath 'com.android.tools.build:gradle:3.3.1'    }}apply plugin: 'com.android.library'apply plugin: 'maven'def safeExtGet(prop, fallback) {    rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback}android {    compileSdkVersion safeExtGet('compileSdkVersion', 28)    buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')    defaultConfig {        minSdkVersion safeExtGet('minSdkVersion', 21)        targetSdkVersion safeExtGet('targetSdkVersion', 28)        versionCode 1        versionName "1.0"    }    lintOptions {        abortOnError false    }}repositories {    maven {        // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm        // Matches the RN Hello World template        // https://github.com/facebook/react-native/blob/1e8f3b11027fe0a7514b4fc97d0798d3c64bc895/local-cli/templates/HelloWorld/android/build.gradle#L21        url "$projectDir/../node_modules/react-native/android"    }    mavenCentral()    mavenLocal()    google()    jcenter()}dependencies {    implementation 'com.facebook.react:react-native:+'    implementation 'androidx.appcompat:appcompat:1.1.0'    implementation 'androidx.fragment:fragment:1.2.1'    implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'    implementation 'com.google.android.material:material:1.1.0'}def configureReactNativePom(def pom) {    def packageJson = new groovy.json.JsonSlurper().parseText(file('../package.json').text)    pom.project {        name packageJson.title        artifactId packageJson.name        version = packageJson.version        group = "com.swmansion.rnscreens"        description packageJson.description        url packageJson.repository.baseUrl        licenses {            license {                name packageJson.license                url packageJson.repository.baseUrl +'/blob/master/'+ packageJson.licenseFilename                distribution 'repo'            }        }        developers {            developer {                id packageJson.author.username                name packageJson.author.name            }        }    }}afterEvaluate { project ->    task androidJavadoc(type: Javadoc) {        source = android.sourceSets.main.java.srcDirs        classpath += files(android.bootClasspath)        classpath += files(project.getConfigurations().getByName('compile').asList())        include '**/*.java'    }    task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {        classifier = 'javadoc'        from androidJavadoc.destinationDir    }    task androidSourcesJar(type: Jar) {        classifier = 'sources'        from android.sourceSets.main.java.srcDirs        include '**/*.java'    }    android.libraryVariants.all { variant ->        def name = variant.name.capitalize()        task "jar${name}"(type: Jar, dependsOn: variant.javaCompileProvider.get()) {            from variant.javaCompileProvider.get().destinationDir        }    }    artifacts {        archives androidSourcesJar        archives androidJavadocJar    }    task installArchives(type: Upload) {        configuration = configurations.archives        repositories.mavenDeployer {            // Deploy to react-native-event-bridge/maven, ready to publish to npm            repository url: "file://${projectDir}/../android/maven"            configureReactNativePom pom        }    }}

In follow you see, that is all in androidx.

node-modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/Lifecyclepackage com.swmansion.rnscreens;

import android.view.View;import android.view.ViewParent;import androidx.fragment.app.Fragment;import androidx.lifecycle.Lifecycle;import androidx.lifecycle.LifecycleObserver;import java.util.HashMap;import java.util.Map;import javax.annotation.Nullable;

How to set backgroundColor of tabbar when the borderRadius is given to it?

$
0
0

Image Preview

I want to set my tabBar of borderRadius 30 and set the backgroundColor of the tabBar, but the problem is that there is white color background in the tabBar even if I have set the backgroundColor to other color! How to resolve this?

tabBarOptions: {  showIcon: true,  showLabel: false,  activeTintColor: '#333645',  inactiveTintColor: 'grey',  style: {    backgroundColor: '#FEB6B9',    height: 50,    borderRadius: 30,    marginBottom: 10  }}

React Native - StatusBar color iOS and Android

$
0
0

I can't set the color of the status bar on iOS and Android on React Native with Expo.I just managed to hide it.

Code :

import * as React from 'react';import { WebView } from 'react-native-webview';import { StatusBar } from 'react-native'export default class App extends React.Component {   render() {      return <><StatusBar hidden={true} /><WebView source={{ uri: 'https://foo.co' }} style={{ marginTop: 33 }} /></>   }}

I already tried :

<StatusBar hidden={false} barStyle="light-content" />

and :

<StatusBar barStyle = "dark-content" hidden = {true} backgroundColor = "#00BCD4" translucent = {true}/>

I am really confused about how this StatusBar works.

Thank you in advance!

"npx react-native init client" fails on Android while executing. React Native 0.62.2

$
0
0

System: Windows 10NodeJS: v13.8.0React Native: 0.62.2React: "16.11.0"

It also happens with typescript template

After I run npm run android, I have these logs:

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier"flag.Jetifier found 967 file(s) to forward-jetify. Using 4 workers...info Starting JS server...info Launching emulator...info Successfully launched emulator.info Installing the app...> 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.0.1/userguide/command_line_interface.html#sec:command_line_warnings14 actionable tasks: 6 executed, 8 up-to-dateerror Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/getting-started.html#android-development-environment. Run CLI with -- verbose flag for more details.Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081FAILURE: Build failed with an exception.

BUILD FAILED in 1m 17s

at makeError (C:\Users\Vasyl\Desktop\rn_chat\client\node_modules\execa\index.js:174:9)at C:\Users\Vasyl\Desktop\rn_chat\client\node_modules\execa\index.js:278:16at processTicksAndRejections (internal/process/task_queues.js:97:5)at async runOnAllDevices (C:\Users\Vasyl\Desktop\rn_chat\client\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)at async Command.handleAction (C:\Users\Vasyl\Desktop\rn_chat\client\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:186:9)npm ERR! code ELIFECYCLEnpm ERR! errno 1npm ERR! client@0.0.1 android: `react-native run-android`npm ERR! Exit status 1npm ERR!npm ERR! Failed at the client@0.0.1 android script.npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm ERR! A complete log of this run can be found in:npm ERR!     C:\Users\Vasyl\AppData\Roaming\npm-cache\_logs\2020-04-17T13_46_13_246Z-debug.log

How to register a new fingerprint in the device?

$
0
0

I am using this library in RN to implement fingerprint scanning react-native-fingerprint-scanner and its working fine with scanning but I would like to implement a function that registers a new fingerprint for this app. I was absolutely not able to find it anything on the internet related to this.

Here is the code that I have implemented so far:

import React, { Component } from 'react';import {    Alert,    Image,    Text,    TouchableOpacity,    View,    ViewPropTypes} from 'react-native';import FingerprintScanner from 'react-native-fingerprint-scanner';import PropTypes from 'prop-types';import ShakingText from './ShakingText.component';import styles from './FingerprintPopup.component.styles';class FingerprintPopup extends Component {    constructor(props) {        super(props);        this.state = { errorMessage: undefined };    }    componentDidMount() {        FingerprintScanner            .authenticate({ onAttempt: this.handleAuthenticationAttempted })            .then(() => {                this.props.handlePopupDismissed();                Alert.alert('Fingerprint Authentication', 'Authenticated successfully');            })            .catch((error) => {                this.setState({ errorMessage: error.message });                this.description.shake();            });    }    componentWillUnmount() {        FingerprintScanner.release();    }    handleAuthenticationAttempted = (error) => {        this.setState({ errorMessage: error.message });        this.description.shake();    };    render() {        const { errorMessage } = this.state;        const { style, handlePopupDismissed } = this.props;        return (<View style={styles.container}><View style={[styles.contentContainer, style]}><Image                        style={styles.logo}                        source={require('../pictures/finger_print.png')}                    /><Text style={styles.heading}>                        Fingerprint{'\n'}Authentication</Text><ShakingText                        ref={(instance) => { this.description = instance; }}                        style={styles.description(!!errorMessage)}>                        {errorMessage || 'Scan your fingerprint on the\ndevice scanner to continue'}</ShakingText><TouchableOpacity                        style={styles.buttonContainer}                        onPress={handlePopupDismissed}><Text style={styles.buttonText}>                            BACK TO MAIN</Text></TouchableOpacity></View></View>        );    }}FingerprintPopup.propTypes = {    style: ViewPropTypes.style,    handlePopupDismissed: PropTypes.func.isRequired,};export default FingerprintPopup;

EDIT: Or at least I would like to prompt the user to set Fingerprint if they already don't have any finger enrolled in the phone.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6

$
0
0

I try to get Apk in react-native however it doesn't give me anything. release file which is in Apk file is empty and after Gradlew bundle release is finished, it says

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

I couldn't find how to solve this issue

    react-native run-androidinfo Starting JS server...info Building and installing the app on the device (cd android && ./gradlew app:installDebug)...Starting a Gradle Daemon, 2 incompatible and 1 stopped Daemons could not be reused, use --status for details> Task :app:transformClassesWithDexBuilderForDebug FAILEDFAILURE: Build failed with an exception.* What went wrong:Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.> java.nio.file.AccessDeniedException: /home/kourosh/Projects/FitnessApp/android/app/build/intermediates/transforms/dexBuilder/debug/45/androidx/versionedparcelable/R.dex* 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.orgDeprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.Use '--warning-mode all' to show the individual deprecation warnings.See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warningsBUILD FAILED in 1m 15s19 actionable tasks: 1 executed, 18 up-to-dateerror 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 haveset up your Android development environment:https://facebook.github.io/react-native/docs/getting-started.htmlerror Command failed: ./gradlew app:installDebug. Run CLI with --verbose flag for more details.

java version "12.0.1" 2019-04-16node -v v10.16.0npm -v 6.9.0

Export enum or constants from Android bridge to ReactNative

$
0
0

I've the next error on my Test React Native project.I've a native library on android that I expose to ReactNative.based on the ToastModule sample of Facebook/ReactNative, i'm trying to export Constants but always I get "undefined".

RNMySDKModule.java

   private static final String ENVCONFIG_PROD = "PROD";   private static final String ENVCONFIG_STA = "STA";@Overridepublic Map<String, Object> getConstants() {    final Map<String, Object> constants = new HashMap<>();    constants.put(ENVCONFIG_PROD, "prod");    constants.put(ENVCONFIG_STA, "sta");    return constants;}

App.js

console.log(RNMySDK.PROD)

log: undefined

Viewing all 29478 articles
Browse latest View live


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