react-android

React native picker selected value gives undefined is not an object error

做~自己de王妃 提交于 2020-01-15 12:07:53
问题 I am using below code for picker and to send the value selected from picker to api call, i keep getting this error Possible Unhandled Promise Rejection (id: 1):undefined is not an object (evaluating 'this.state.selected1') what am i doing wrong? 'use strict' import React, { Component } from 'react'; const ReactNative = require('react-native'); const { Picker, AppRegistry, StyleSheet, Navigator, Text, View, TextInput, Button, ScrollView } = ReactNative; const Item = Picker.Item; import {

sorting the items in the flatList

假如想象 提交于 2019-12-14 02:09:38
问题 In my react native application, I am showing services that are offered by my office and the location of those services in a flatlist. I am also showing the miles of the service from the persons current address in that same flatlist. I want those services to be sorted by miles. Below is what my screen data looks like: Services are available in the following locations: 123 Test Drive (313) 231-4560 Miles: 7 __________________________ 234 Test Drive (450) 222-9999 Miles: 3 ______________________

Calling a Android Native UI component method from React native Js code

大兔子大兔子 提交于 2019-12-04 10:29:32
问题 I have created a CustomView SignatureView.java which extends LinearLayout for capturing signature in Android Native. And created SignatureCapturePackage.java and SignatureCaptureViewManager.java public class SignatureCaptureMainView extends LinearLayout { .... public void saveImage(){ //Save image to file } } this the Package class public class SignatureCapturePackage implements ReactPackage { private Activity mCurrentActivity; public RSSignatureCapturePackage(Activity activity) {

Calling a Android Native UI component method from React native Js code

淺唱寂寞╮ 提交于 2019-12-03 06:04:53
I have created a CustomView SignatureView.java which extends LinearLayout for capturing signature in Android Native. And created SignatureCapturePackage.java and SignatureCaptureViewManager.java public class SignatureCaptureMainView extends LinearLayout { .... public void saveImage(){ //Save image to file } } this the Package class public class SignatureCapturePackage implements ReactPackage { private Activity mCurrentActivity; public RSSignatureCapturePackage(Activity activity) { mCurrentActivity = activity; } @Override public List<NativeModule> createNativeModules(ReactApplicationContext

Fetch returns promise instead of actual data even after using 'then' [duplicate]

*爱你&永不变心* 提交于 2019-11-27 18:51:31
问题 This question already has answers here : How do I return the response from an asynchronous call? (36 answers) Closed 3 years ago . I am making a simple fetch call in my component, which looks like this var x = fetch(SOME_URL, SOME_POST_DATA) .then((response) => response.json()) .then((responseJSON) => {return responseJSON}); console.log(x); The call executes successfully but the console prints a promise instead of data. What am I missing here? 回答1: The way promises works mean you'll need to