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

React-Native run-android command issue

$
0
0

When starting android project with React-Native it is giving this error:

React-Native Command run-android unrecognized.Did you mean to run this inside a react-native project?


how to send notification and pined this on android Which cannot be closed?

$
0
0

how to send notification and pined this on android Which cannot be closed.and i would type code on this block for run in background.

PushNotification.localNotificationSchedule({

//... You can use all the options from localNotifications message: "My Notification Message", // (required) date: new Date(Date.now() + 60 * 1000), // in 60 secs});

Backing up Android keystore using Expo - Do we need to save the associated passwords?

$
0
0

When you run expo fetch:android:keystore it shows the follow:

Configuring credentials for myApp in project myAppKeystore credentials  Keystore password: 1234567890abcdef1234567890abcdef  Key alias:         1234567890abcdef1234567890abcd==  Key password:      1234567890abcdef1234567890abcdef  Path to Keystore:  C:\projects\myApp\myApp.jks

My question is, do we need to separately store the passwords and alias, or only the .jks file?

This is not made clear in the relevant Expo documentation.

React-native screen does not appear on the iOS simulator using react-native

$
0
0

I am now trying to develop an application with react-native, but the first project does not work well.

Environment

  • cocoapods-1.9.3
  • node v10.16.2
  • watchman 4.9.0
  • Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)Target: x86_64-apple-darwin19.4.0

What I've tried

I did environment setup according to the official cite.

$ npx react-native init AwesomeProject$ cd AwesomeProject$ npx react-native run-ios

And I see the iOS screen, but there is no statement like "Welcome to react-native", which should be appeard on the screen.What I can see on the simulator is this.

When I execute the command

$ npx react-native start

I can see the react-native logo like this,

               ######                ######                            ###     ####        ####     ###                         ##          ###    ###          ##                        ##             ####             ##                        ##             ####             ##                        ##           ##    ##           ##                        ##         ###      ###         ##                         ##  ########################  ##                       ######    ###            ###    ######                ###     ##    ##              ##    ##     ###         ###         ## ###      ####      ### ##         ###     ##           ####      ########      ####           ##   ##             ###     ##########     ###             ##   ##           ####      ########      ####           ##     ###         ## ###      ####      ### ##         ###         ###     ##    ##              ##    ##     ###                ######    ###            ###    ######                       ##  ########################  ##                         ##         ###      ###         ##                        ##           ##    ##           ##                        ##             ####             ##                        ##             ####             ##                        ##          ###    ###          ##                         ###     ####        ####     ###                            ######                ######                                Welcome to React Native!                Learn once, write anywhereTo reload the app press "r"To open developer menu press "d"

but under there is a warning statement.

warn No apps connected. Sending "reload" to all React Native apps failed. Make sure your app is running in the simulator or on a phone connected via USB.info Reloading app...

How can I get the simulator screen like this picture which is shown as a success result?

React Native App: Include Images or Graphics into Camera Stream in Real Time and Broadcast to Facebook Live

$
0
0

I want to build a React Native app for iOS and Android (preferably using Expo managed workflow). The app lets the user to use the phone camera to live into their Facebook Live. In addition, I want to have a feature which allows my app user to add some texts (e.g. their company name), some count down timer, some graphics or images (e.g. their company's Logo) onto their live stream in real time. So the audiences of their Facebook Live will see those texts, graphics or images. Something similar to what Switcher Studio (https://www.switcherstudio.com/) has in offer.

I found some articles which explain how to add a layer (on top of the Video stream) and render something on this layer. But, this way the Audiences will not see this effect.

My question is how can I do that?

Here's what I have found:1). I will need NodeMediaClient to encode my the stream from my camera into RTMP (something like this guy has here https://www.syntx.io/react-native/video-live-streaming-with-react-native/).2). Then I can feed this RTMP stream into Facebook Live API. Something similar to this post: https://developers.facebook.com/docs/live-video-api/getting-started.

But, I don't know how can I add any texts, images or graphics onto this Camera stream in real time before encoding it to RTMP.

Please correct me if what I've found is incorrect? and please help me out on how to add texts, images or graphics onto Camera stream in real time.

How to solve error "Unable to find valid certification path to requested target while executing command react-native run-android"

$
0
0

I'm totally new to React Native I have created first project in React Native with the following commands:

  1. react-native init Hello
  2. cd Hello
  3. npm start
  4. react-native run-android

But while executing "react-native run-android" I'm getting this error-

Error message screenshot

Please help me out.

After more efforts this error was resolved but now getting another errorSolutions which I have tried was:Solution 1:1. Open your project in Android Studio i.e. android folder of your react native project 2. Sync your project so that gradle.zip will download properly3. Then run your project.Solution 2:1. Open your React native project2. Navigate to android folder within it3. Go to gradle folder inside it 4. Open gradle-wrapper.properties5. And modify your distributionUrl from "https" to "http"6. Run your projectBut at the end another error was occurred which was mentioned below.>react-native run-androidinfo Starting JS server...info Building and installing the app on the device (cd android && gradlew.bat app:installDebug)...Picked up _JAVA_OPTIONS: -Xmx1024MFAILURE: Build failed with an exception.* What went wrong:A problem occurred configuring root project 'FirstApp'.> Could not resolve all artifacts for configuration ':classpath'.> Could not resolve org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.21.     Required by:         project : > com.android.tools.build:gradle:3.3.2         project : > com.android.tools.build:gradle:3.3.2 > com.android.tools.build:builder:3.3.2         project : > com.android.tools.build:gradle:3.3.2 > com.android.tools.analytics-library:shared:26.3.2         project : > com.android.tools.build:gradle:3.3.2 > com.android.tools.lint:lint-gradle-api:26.3.2         project : > com.android.tools.build:gradle:3.3.2 > com.android.tools.build:gradle-api:3.3.2         project : > com.android.tools.build:gradle:3.3.2 > androidx.databinding:databinding-compiler-common:3.3.2         project : > com.android.tools.build:gradle:3.3.2 > com.android.tools.build:builder:3.3.2 > com.android.tools:sdk-common:26.3.2         project : > com.android.tools.build:gradle:3.3.2 > com.android.tools.build:builder:3.3.2 > com.android.tools:common:26.3.2         project : > com.android.tools.build:gradle:3.3.2 > com.android.tools.build:builder:3.3.2 > com.android.tools.build:manifest-merger:26.3.2         project : > com.android.tools.build:gradle:3.3.2 > com.android.tools.build:builder:3.3.2 > com.android.tools.analytics-library:tracker:26.3.2         project : > com.android.tools.build:gradle:3.3.2 > com.android.tools.build:builder:3.3.2 > com.android.tools:sdklib:26.3.2 > com.android.tools:repository:26.3.2> Could not resolve org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.21.> Could not get resource 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.21/kotlin-stdlib-jdk8-1.3.21.pom'.> Could not GET 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.21/kotlin-stdlib-jdk8-1.3.21.pom'.> sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target> Could not resolve org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.21.> Could not get resource 'https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.21/kotlin-stdlib-jdk8-1.3.21.pom'.> Could not GET 'https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.21/kotlin-stdlib-jdk8-1.3.21.pom'.> sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target* Try:Run with --stacktrace option to get the stack trace. Run with --info or --debugoption to get more log output. Run with --scan to get full insights.* Get more help at https://help.gradle.orgBUILD FAILED in 13serror 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.bat app:installDebug

I'm executing my project in my phone I have checked that my device is properly connected or not with the command "adb devices". My device name was displayed.

So I'm not understand what to do next.


I was trying to solve this error and got a solution which i have implemented 1. Open your react native project in android studio2. File -> Settings -> Remote Jar Repositories -> Click on Add Button 3. Add maven Repository URL given below: https://mvnrepository.com/artifact/com.android.tools/sdklib4. Sync your project Many error was gone. 

And just want help to solve these below mentioned errors:

* What went wrong:A problem occurred configuring root project 'FirstApp'.> Could not resolve all artifacts for configuration ':classpath'.> Could not download bcpkix-jdk15on.jar (org.bouncycastle:bcpkix-jdk15on:1.56)> Could not get resource 'https://jcenter.bintray.com/org/bouncycastle/bcpkix-jdk15on/1.56/bcpkix-jdk15on-1.56.jar'.> Could not HEAD 'https://jcenter.bintray.com/org/bouncycastle/bcpkix-jdk15on/1.56/bcpkix-jdk15on-1.56.jar'.> sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Thanks in advance!

React-Native Pedometer values issue (Android)

$
0
0

I'm using rn-universal-pedometer to get steps count and distance data in an app. This is working all great in iOS app. But in Android app there are some issues. If I check live steps and distance and stop the listener, and query back the past data, it shows the same data that I got in live steps and distance for all the given time periods in queryPedometerDataBetweenDates. All the values are same and never changes when the time period changes. But this is working perfectly fine in iOS. Is there anything I am missing? I have tried many pedometer libraries. Same issue is there. In some libraries, I got startDate and endDate as negative values.

Unresolved reference: PackageList on native module, React Native 0.61.4

$
0
0

I'm trying to incorporate a native-module to my react app.

Following the "How to update" guide, I have to import "PackageList" on my MainApplication file. However, just this one import, fails.

This is my build.grandle for the project

allprojects {    repositories {        mavenLocal()        jcenter()        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()    }}

And these are my dependencies

dependencies {    implementation fileTree(dir: 'libs', include: ['*.jar'])    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"    implementation 'androidx.appcompat:appcompat:1.1.0'    implementation 'androidx.core:core-ktx:1.3.0'    testImplementation 'junit:junit:4.12'    androidTestImplementation 'androidx.test.ext:junit:1.1.1'    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'    implementation 'com.facebook.react:react-native:0.61.4'    implementation 'com.google.android.material:material:1.1.0'    implementation 'androidx.navigation:navigation-fragment-ktx:2.2.2'    implementation 'androidx.navigation:navigation-ui-ktx:2.2.2'    implementation 'com.opencsv:opencsv:4.6'}apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

It's just the package list the one that cant find the reference, every other import works perfectly. Do I have to add anything else besides com.facebook.react:react-native:0.61.4


Is it possible to combine a GUI made with react native with utility methods from native code (kotlin)?

$
0
0

I have an app which was made entirely using react native. It's pretty much a todo list, this is the structure:

<SafeAreaView style={styles.container}><Text style={styles.title} >Registro de pacientes</Text>        {loading && (<ActivityIndicator            style={styles.loading}            size="large"            color="#0066ff"          />        )}        {!loading && (<ListaPacientes              pacientes={pacientes}             onUpdate={this.handleUpdate}          />        )}</SafeAreaView>

And here is the list:

<SectionList    sections={      pacientes && pacientes.length ?       [        {title: "Pacientes sin registrar", data: pacientes.filter(paciente => !paciente.done)},        {title: "Pacientes registrados", data: pacientes.filter(paciente => paciente.done)}      ] : []    }    keyExtractor={paciente => paciente.id}    renderItem={({item}) => renderItem(item)}    renderSectionHeader={renderSectionHeader}    style={styles.container}    ItemSeparatorComponent={renderSeparator}    ListEmptyComponent={renderEmptyComponent}    stickySectionHeadersEnabled={true}  />

This takes a list of clients and displays their names. Upon being clicked on, they are removed from the list. Very simple.

The thing is, the list of clients must be read from a csv file and, after being clicked, update the csv. I already have a piece of code that does that. However, it's written in kotlin (It was coded for another project).

Instead of having to do the whole fetching/reading/treating/updating of the data again in react native, can I somehow use the kotlin code I already have? If so, care to provide an example on how it would be done?

EDIT: To clarify, I have a kotlin method that returns an ArrayList of strings with the names I want to store on the list. How can I call that method from the javascript, obtain the arraylist, and use it as data source for my SectionList ?.

Thank you.

Recorded AAC audio in Android, won't play in iOS devices

$
0
0

AAC audio recorded in Android is not playing in iOS devices. Here is the code example how we are recording the audio in Android device. When we try to play that audio in iOS device using react-native-sound, It won't play and shows error like this.

Failed to load the soundand iOS exception read as below.

Objectcode: "ENSOSSTATUSERRORDOMAIN1937337955"domain:"NSOSStatusErrorDomain"message: "The operation couldn't be completed. (OSStatus error 1937337955.)"nativeStackIOS: Array[17]userInfo: Object__proto__: Object

AudioRecorder.prepareRecordingAtPath('/path/to/audio/test.aac', {        SampleRate: 22050,        Channels: 1,        AudioQuality: "Low",        AudioEncoding: "aac",        AudioEncodingBitRate: 32000});

We are using RN 0.41 and react-native-audio 3.2.1

DId anyone face similar issue? let me know if there is any misconfiguration.

Trying to make the index direct admin to a diffrent page after grabbing data from firebase, react-native

$
0
0

When a new user trying to register my app, the register page saves in firebase real-time his UID, mail, display name and boolean "Admin = false". (if I want a user to become an admin, I'm changing it manualy in firebase).

My problem: when a user is logging in, I want to check if his admin is true, if so, direct him to HomePageAdmin (admin home page..). right now my index only direct a user to HomePageUser when his logging status is true.

my index:

    state = {loggedIn: false}    componentWillMount() {        firebase.auth().onAuthStateChanged((user) => {            if(user) {                this.setState({loggedIn: true})            }            else {                this.setState({loggedIn: false})            }        })    }    renderContent() {        if(!this.state.loggedIn) {            return (<MainLogin/>)        }        else return <HomePageUser/>    }    render () {        return (            this.renderContent()        )    }}AppRegistry.registerComponent(appName, () => loginHelper);

my method for grabbing the admin status from firebase:

function adminCheck() {     db.ref('Users/'+uid+'/Admin').once('value', function (snapshot) {         const exist = (snapshot.val() !== null);         if (exist) {            Admin = snapshot.val();            alert(Admin);            console.log("user data loaded");         }     });    }

I've been tring to add conditions to renderContent(), but it just wont work. The data loaded in advance before grabbing the data from firebase.How can I make it work?

React Native app.json Duplicate Resources

$
0
0

I am just creating a react native project with

react-native init somename

Then creating folder with

mkdir android/app/src/main/assets

Then creating 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

After all that I look for drawable folder but can't find any in

\android\app\src\main\res

Then I open the project with Android Studioand try to generate signed apk, creating key and click yes then it gives eror

"\android\app\build\generated\res\react\release\raw\app.json: Error: Duplicate resources"  

It show erors with 2 files

\app\src\main\res\raw\app.json{"name": "somename","displayName": "somename"}
[raw/app] \android\app\src\main\res\raw\app.json    [raw/app] \android\app\build\generated\res\react\release\raw\app.json: Error: Duplicate resources{"name": "somename","displayName": "somename"}

I searched but I can not find any solution. Can anyone please help me .

react native slow close camera after barcode scanned

$
0
0

I just learned about react native. I use the react-native-camera-kit library and there are obstacles when I finish scanning a barcode. The barcode was scanned successfully but the camera took a while to close. I load data from the API, if only a small amount of data is loaded then the camera will close quickly but if the data is loaded a lot then the camera will close slowly. And this is my code.

import React, {Component} from 'react';import {View, PermissionsAndroid} from 'react-native';import {  Container,  Content,  Card,  CardItem,  Body,  Text,  Button,  Icon,  Left,  Footer,  Thumbnail,  Spinner,  Root,} from 'native-base';import {CameraKitCameraScreen} from 'react-native-camera-kit';export default class App extends Component {  constructor() {    super();    this.state = {      movies: [],      isLoading: true,      opneScanner: false,    };  }  async getMoviesFromApiAsync() {    try {      const response = await fetch('https://pokeapi.co/api/v2/pokemon?limit=100&offset=200',      );      const json = await response.json();      this.setState({        movies: json.results,        isLoading: false,      });    } catch (error) {      console.error(error);    }  }  onBarcodeScan(qrvalue) {    //called after te successful scanning of QRCode/Barcode    console.log(qrvalue);    this.setState({opneScanner: false});    // this.scan(qrvalue); // other method  }  onOpneScanner() {    var that = this;    //To Start Scanning    if (Platform.OS === 'android') {      async function requestCameraPermission() {        try {          const granted = await PermissionsAndroid.request(            PermissionsAndroid.PERMISSIONS.CAMERA,            {              title: 'CameraExample App Camera Permission',              message: 'CameraExample App needs access to your camera ',            },          );          if (granted === PermissionsAndroid.RESULTS.GRANTED) {            //If CAMERA Permission is granted            that.setState({opneScanner: true});          } else {            alert('CAMERA permission denied');          }        } catch (err) {          alert('Camera permission err', err);          console.warn(err);        }      }      //Calling the camera permission function      requestCameraPermission();    } else {      that.setState({opneScanner: true});    }  }  componentDidMount() {    this.getMoviesFromApiAsync();  }  render() {    const {isLoading, opneScanner} = this.state;    if (!opneScanner) {      return (<Container><Content padder>              {isLoading ? (<Spinner />              ) : (                this.state.movies.map((movie, index) => (<Card key={index}><CardItem><Left><Thumbnail                          source={{                            uri:'https://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/React-icon.svg/220px-React-icon.svg.png',                          }}                        /><Body><Text> {movie.name}</Text><Text note> {movie.url}</Text></Body></Left></CardItem></Card>                ))              )}</Content><Footer><Button                onPress={() => {                  this.onOpneScanner();                }}                vertical                success                style={{                  width: '100%',                }}><Icon name="camera" /><Text>Scan</Text></Button></Footer></Container>      );    }    return (<View style={{flex: 1}}><CameraKitCameraScreen          showFrame={true}          //Show/hide scan frame          scanBarcode={true}          //Can restrict for the QR Code only          laserColor={'blue'}          //Color can be of your choice          frameColor={'yellow'}          //If frame is visible then frame color          colorForScannerFrame={'black'}          //Scanner Frame color          onReadCode={(event) => {            this.onBarcodeScan(event.nativeEvent.codeStringValue);          }}        /></View>    );  }}

please help me.....

React Native build failed in android, @react-native-community/cli-platform-android /native_modules.gradle' line: 130

$
0
0

I've upgraded my ReactNative project from 0.59 to 0.61.2 iOS is building fine but in android i'm facing the issue in @react-native-community/cli-platform-android module.

My settings.gradle file

apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)

My build.gradle file

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

I get the following error while building the app.

> Task :app:generatePackageList FAILEDFAILURE: Build failed with an exception.* Where:Script '/Users/yashwanth_c/Documents/projects/MobileApp/node_modules/@react-native-community/cli-platform-android/native_modules.gradle' line: 130* What went wrong:Execution failed for task ':app:generatePackageList'.> ReactNativeModules$_generatePackagesFile_closure3* 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.5/userguide/command_line_interface.html#sec:command_line_warningsBUILD FAILED in 5m 21s4 actionable tasks: 4 executed

As always i've cleaned the cache and deleted the node_module folder, tried many times but no luck. Also googled for more than a week but still not able to find a fix, any advice is appreciated.

Is it possible to use the built in device application camera in react native?

$
0
0

Currently we are using expo camera, we have to use our own buttons to take picture. I already saw android applications that were using my built in camera application. Is it possible to achieve that in react native with expo ?


How does admob banner count impressions on React Native?

$
0
0

I'm developing a React Native app and was wondering wether it makes difference if I use a single component to display the banner (e.g. on the router) or a different component for each module/page of the application.

Does Admob count as different impressions if there are many instances? Or is it session-based?

How to set up an existing React-Native project from a new computer for the first time?

$
0
0

So I recently started working with my friend on his app project and I've had trouble building his react-native based project. It's both ios and android.

On android, I can get as far as building, but when I run the app shuts down instantly or shows a red screen with some firebase error.

On ios, I get a build error.

My question is: what do I need to install when I first pull the repo from github? I run '''yarn install''' straight away and run '''pod install''' from the ios folder but that isn't enough. Anything I should run for android more than the yarn install command I had already used?

Thanks!

React Native Fetch throwing error while uploading doc

$
0
0

I am trying to upload the file using the react-native-document-picker in react native. While uploading I am getting error "Possible Unhandled Promise Rejection (id: 0):TypeError: Network request failed".

When I tried to use fetch to post the data in the table it's working fine. The data getting posted without any error or warnings.

Complete Code

import React, { useState } from 'react';import { StyleSheet, Text, View, TouchableOpacity } from 'react-native';import DocumentPicker from 'react-native-document-picker';import { TextInput } from 'react-native-gesture-handler';const FormScreen = () => {let [singleFile, setSingleFile] = useState(null);let [singleFile1, setSingleFile1] = useState(null);let [singleFile2, setSingleFile2] = useState(null);const [intialForm, setForm] = useState("");let uploadImage = async () => {//Check if any file is selected or notif (singleFile != null) {  console.log('Submitted');  //If file selected then create FormData  const fileToUpload = singleFile;  let data = new FormData();  data.append('name', 'Image Upload');  data.append('type', 'image/jpeg');  data.append('file_attachment', fileToUpload);  //Please change file upload URL  let res = await fetch('https://acc.nwlz.com/inc/upload.php', //sample url    {      method: 'post',      body: data,      headers: {'Content-Type': 'multipart/form-data; ',      },    }  );  let responseJson = await res.json();  if (responseJson.status == 1) {    alert('Upload Successful');  }  } else {  //if no file selected the show alert  alert('Please Select File first');  }  };  let selectFile = async () => {  //Opening Document Picker to select one file  try {  const res = await DocumentPicker.pick({    //Provide which type of file you want user to pick    type: [DocumentPicker.types.allFiles],    //There can me more options as well    // DocumentPicker.types.allFiles    // DocumentPicker.types.images    // DocumentPicker.types.plainText    // DocumentPicker.types.audio    // DocumentPicker.types.pdf  });  //Printing the log realted to the file  console.log('res : '+ JSON.stringify(res));  //Setting the state to show single file attributes  setSingleFile(res);} catch (err) {  setSingleFile(null);  //Handling any exception (If any)  if (DocumentPicker.isCancel(err)) {    //If user canceled the document selection    alert('Canceled from single doc picker');  } else {    //For Unknown Error    alert('Unknown Error: '+ JSON.stringify(err));    throw err;  }  }  };   return (<View style={styles.mainBody}><View style={{ alignItems: 'center' }}><Text style={{ fontSize: 30, textAlign: 'center' }}>      Submit Forms</Text><TextInput          style={{backgroundColor:'#d2d2d2', marginBottom:10, width:300,    color:'#fff'}}          placeholder="Enter Form Type Ex. 1.12"          value = {intialForm}          onChangeText = { (newtype) => setForm(newtype) }          /></View>  {/*Showing the data of selected Single file*/}  {singleFile != null ? (<Text style={styles.textStyle}>      File Name: {singleFile.name ? singleFile.name : ''}      {'\n'}</Text>  ) : null}  {singleFile1 != null ? (<Text style={styles.textStyle}>      File Name: {singleFile1.name ? singleFile1.name : ''}      {'\n'}</Text>  ) : null}  {singleFile2 != null ? (<Text style={styles.textStyle}>      File Name: {singleFile2.name ? singleFile2.name : ''}      {'\n'}</Text>  ) : null}<TouchableOpacity    style={styles.buttonStyle}    activeOpacity={0.5}    onPress={selectFile}><Text style={styles.buttonTextStyle}>Select File 1</Text></TouchableOpacity><TouchableOpacity    style={styles.buttonStyle}    activeOpacity={0.5}    onPress={uploadImage}><Text style={styles.buttonTextStyle}>Upload File</Text></TouchableOpacity></View>  );  };  const styles = StyleSheet.create({  mainBody: {  flex: 1,  justifyContent: 'center',  padding: 20,  },  buttonStyle: {  backgroundColor: '#307ecc',  borderWidth: 0,  color: '#FFFFFF',  borderColor: '#307ecc',  height: 40,  alignItems: 'center',  borderRadius: 30,  marginLeft: 35,  marginRight: 35,  marginTop: 15,  },  buttonTextStyle: {color: '#FFFFFF',paddingVertical: 10,fontSize: 16,},textStyle: {backgroundColor: '#fff',fontSize: 15,marginTop: 16,marginLeft: 35,marginRight: 35,textAlign: 'center',},});export default FormScreen;

The error message which I am getting is

Possible Unhandled Promise Rejection (id: 11):TypeError: Network request failedonerror@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:28005:31dispatchEvent@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:34133:31setReadyState@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:33217:33__didCompleteResponse@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:33044:29emit@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:3420:42__callFunction@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2748:49http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2470:31__guard@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2702:15callFunctionReturnFlushedQueue@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2469:21callFunctionReturnFlushedQueue@[native code]

I want to upload the image to my server.

How can I create a drawer where I can change the text according to user settings like language in react native?

$
0
0

I used the Galio framework to start building an App and it creates a drawer with the following function imported by App.js:

const GalioApp = createDrawerNavigator(screens, options);

I want to for example be able to load the language the user is using from the memory and change the drawerLabels accordingly. Like options is in a constant object then how to I get the language from async storage and render it accordingly.

Use external library inside React Native module

$
0
0

I'm trying to develop a React Native module using Bob, which consists of some Javascript code that uses react-native-rsa-native as a dependency (my library doesn't contain platform-specific code). But after publishing the module and installing it on a test project, I get this error when using it:

TypeError: Cannot read property 'encrypt' of undefined

encrypt is a function provided by react-native-rsa-native that is called within an exported function in my module.

I don't think that are errors on my library code because it works when pasting into a React Native project, so I'm probably missing some step related to linking or something like this, but since I never did that I have no idea what to do.

Viewing all 28480 articles
Browse latest View live


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