react-native-android

Call Android activity from React-Native code

家住魔仙堡 提交于 2019-12-02 23:17:27
I am using REACT-NATIVE to build android app. I want to call android activity from React-Native code. (say when I clicked the button in my react native code, it should call android activity) I have 4 class files MainActivity.java (created by react-native when opened in android studio) MainApplication.java (created by react-native) Login.java (android activity file) Example.java (android activity file) Want to achieve following flow: Login.java -> React-Native js -> Example.java I already went through following links, but unable to understand https://stackoverflow.com/a/32825290/4849554 Similar

Refresh previous screen on goBack()

Deadly 提交于 2019-12-02 23:12:52
I am new to React Native. How can we refresh/reload previous screen when returning to it by calling goBack() ? Lets say we have 3 screens A, B, C: A -> B -> C When we run goBack() from screen C it goes back to screen B but with old state/data. How can we refresh it? The constructor doesn't get called 2nd time. Yes, constructor is called only for the first time and you can't call it twice. First : But you can separate the data getter/setter from the constructor and put it in a function, this way you can pass the function down to the next Scene and whenever you're going back you may simply

react-native-camera video capturing shows error on preview after it gets captured?

喜欢而已 提交于 2019-12-02 21:18:04
问题 I am using react-native-camera for video capture. I am building something kind of snapchat stories where moment you capture video next to that it takes you to the preview screen of video where you can edit. On press of start button while videoCapturing screen it returns path of the video but on press of stop button it returns an error at the same time making video to get stored to my device storgae. I have posted both videocapturing screen as well error I am getting on press of stop button

React Native : Error: Duplicate resources - Android

寵の児 提交于 2019-12-02 21:03:52
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 folder. Now implement the Image component with the above PNG image. Now bundle it using the cmd react-native

Run react-native on android emulator

偶尔善良 提交于 2019-12-02 20:19:33
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 sure you have an Android emulator running or a device connected and have set up your Android development

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

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-02 20:12: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> ); } } and App.js file is as below: import React, { Component } from 'react'; import { AppRegistry,

What is the best way to schedule a task in react native?

这一生的挚爱 提交于 2019-12-02 19:09:25
There are different ways to run tasks in the background in Android and iOS respectively. I have found What is the best way to schedule task in android? as well on stack overflow. I am wondering which is the best way using react-native only. Would it be good enough to use setInterval or setTimeout for tasks that have to run daily or every few hours? Would not those tasks be killed by the OS? Any ideas or suggestions? jsdario I will answer my own question to see if this information can be of used by anyone looking for it. Since the different mobile OSs tend to kill background jobs, or stall them

Does React Native compile JavaScript into Java for Android?

守給你的承諾、 提交于 2019-12-02 18:43:36
When I develop hybrid apps with React Native. Does the JavaScript code I write transform into Java-Code or Java-Bytecode for the Dalvik/ART Runtime when I create an Android-App from my React Native code? Or are just the UI components compiled into native UI components? Or does a library like the Fetch API compile the JavaScript code into Java-Code or Java-Bytecode? Basically, you write Javascript. The Javascript communicates with native components (Java on Android, Objective C on iOS, C# on Windows). The communication occurs through the so-called "bridge". If at any time you feel that this

Problem when use dynamic value with image component react native

蹲街弑〆低调 提交于 2019-12-02 18:29:53
问题 I get data from DB and put it into source image, it will be error, but if i put only string it will run ok Run ok: <Image source={require('./src/image/honda-accord.png')} /> Run fail: <Image source={require("./src/image/" + carOfPerson[0]["cars"][i]["picture"] + "")} /> Value of carOfPerson[0]["cars"][i]["picture"] is honda-accord.png Image error was taked screen snapshot in android emulator: And console log in log cat: Body: {"type":"TransformError","lineNumber":0,"errors":[{"description":

How to disable landscape mode in React Native Android dev mode?

感情迁移 提交于 2019-12-02 17:49:18
I am new to android environment. I know iOS can be done in Xcode to disable device orientation. How can I disable landscape mode or any orientation mode in React Native Android? Thanks. Gem Ubaldo Add android:screenOrientation="portrait" to the activity section in android/app/src/main/AndroidManifest.xml file, so that it end up looking like this: <activity android:name=".Activity" android:label="Activity" android:screenOrientation="portrait" android:configChanges="keyboardHidden|orientation|screenSize"> </activity> There are several different values for the android:screenOrientation property;