react-native-android

Run react-native on android emulator

╄→гoц情女王★ 提交于 2019-12-03 06:42:14
问题 I try to run react-native app on genymotion android emulator on my mac. When I write react-native run-android It gets Running /usr/local/opt/android-sdk/platform-tools/adb reverse tcp:8081 tcp:8081 error: closed Could not run adb reverse: Command failed: /usr/local/opt/android-sdk/platform-tools/adb reverse tcp:8081 tcp:8081 Building and installing the app on the device (cd android && ./gradlew installDebug... Could not install the app on the device, read the error above for details. Make

React native: Cannot add a child that doesn't have a YogaNode or parent node

青春壹個敷衍的年華 提交于 2019-12-03 06:34:17
问题 Just started learning react-native, I have created one separate file flexdemo.js and created component as below: import React, { Component } from 'react'; import { View } from 'react-native'; export default class FlexibleViews extends Component { render() { return ( <View style={{ flex: 1 }}> <View style={{ flex: 1, backgroundColor: "powderblue" }}> </View> <View style={{ flex: 2, backgroundColor: "skyblue" }}> </View> <View style={{ flex: 3, backgroundColor: "steelblue" }}> </View> </View> )

How to provide Picker a default “Please select…” option?

China☆狼群 提交于 2019-12-03 06:01:46
I'd like to make my Picker to show a "default option" on startup. That means: something like "Please select an option". I've tried to add a option manually with this phrase, but, this way the "default option" can be re-selected after selecting other options, like it was one of the real options. There is some way to do this? <View style={Styles.row}> <Picker selectedValue={this.state.initialOption} onValueChange={this.handleChangeOption} prompt='Options'} > <Picker.Item label='Please select an option...' value='0' /> <Picker.Item label='option 1' value='1' /> <Picker.Item label='option 2' value

React Native : Error: Duplicate resources - Android

落爺英雄遲暮 提交于 2019-12-03 05:21:29
问题 I was trying to create a release apk file from Android but when I create a release apk with PNG image I'm getting Duplicate Resource error. Initially I thought this is happening because I made a mistake in the existing project but when I created a new project with a single Image component itself I'm getting the Duplicate Resource error. Here are the steps I followed Create a app - react-native init demo Create a assets folder in the project root folder. Add a PNG image inside the assets

Is React Native's LayoutAnimation supported on Android?

六眼飞鱼酱① 提交于 2019-12-03 04:55:38
I do not see anything in the documentation referring to lack of support for Android. I'm using a simple preset animation: LayoutAnimation.configureNext(LayoutAnimation.Presets.spring); It works in iOS, but in Android it makes the transition without any spring animation. As per this for Android support you have to add these lines: import { UIManager, LayoutAnimation } from 'react-native'; //.. UIManager.setLayoutAnimationEnabledExperimental && UIManager.setLayoutAnimationEnabledExperimental(true); First import the following: import { UIManager, LayoutAnimation, Platform } from 'raect-native';

Running React Native Android on device

笑着哭i 提交于 2019-12-03 03:23:30
I followed this official help page and also consulted this previous SO question . But I still don't know what is wrong here. Let's take step by step: Ensure the package server is running. From the screenshot, you can see the command I typed "react-native run-android" and the reponse "Starting JS server..." Ensure your device is connected... Yes, Vysor sees my device. Wee see Vysor showing the app running in the screenshot. ... USB enabled Yes, the app is running, that's why we see the red error screen, but it's the app running nevertheless. Run "adb reverse tcp:8081 tcp:8081" Yes, the

React Native Android Release Build Failing - Gradle

送分小仙女□ 提交于 2019-12-03 02:59:32
I've got a rather complicated project some of which is older code from the past year or so which in React Native time is forever. The regular debug build is working fine but the release build has errors. I've cobbled together answers from other places to make it as far as I have but I don't know how to get past this last bit. I keep getting a bundling error where aapt will fail because it doesn't bundle the resources properly. Example of error code: > Task :app:bundleReleaseJsAndAssets Scanning folders for symlinks in /media/user/1546c7ef-f386-4baa-90d5-cbd87092d3e31/home/user/Code/React

React Native: View onPress does not work

狂风中的少年 提交于 2019-12-03 02:49:40
问题 I'm facing a weird problem. In my react native app, if I set onPress event to View it is not triggered but if I set the same to Text inside View , it fires. What am I missing here? <View style={{backgroundColor: "red", padding: 20}}> <Text onPress={()=> { console.log('works'); } }>X</Text> </View> <View style={{backgroundColor: "red", padding: 20}} onPress={()=> { console.log('does not work'); } }> <Text>X</Text> </View> Why is this so? Is this an issue with React Native? I'm using version 0

react-native run-android builds an old version of the code onto device

我的梦境 提交于 2019-12-03 02:15:48
This occurs in both production and dev builds. I can connect to the dev server, reload, and the new code is built and runs on the device. Step-by-step of what I have tried: Modify code. Re-bundle: 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 ./gradlew clean react-native run-android - Builds old version react-native run-android --variant=release - Builds old version Is there any way to completely wipe the android build and build from scratch? My gut tells me that

React native — call phone number with extension

痴心易碎 提交于 2019-12-03 01:53:07
I am trying to open phone number with extension. Linking works with just phone number Tried with few options Linking.openURL('tel:XXXXXXXXX,XXX'); Linking.openURL('tel:'+ encodeURIComponent('XXXXXXXXX,XXX')); Dialer only dials primary number and doesnt include extension I could write a native code and expose the method, but that would be my last option I know it is late, but you can try this component: react-native-communications . It works well both on iOS and Android. You have to import it in the file you need: import Communications from 'react-native-communications'; and then use it as you