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

Cannot load generic password from iOS Keychain (errSecNotAvailable -25291)

$
0
0

I developed a react native iOS app which saves/loads data into/from keychain via https://github.com/mCodex/react-native-sensitive-info/blob/master/ios/RNSensitiveInfo/RNSensitiveInfo.m

My read/write keychain options is below, it never changes and works well since day1

const defaultOptions: RNSensitiveInfoOptions = {  touchID: true,  kSecAccessControl: 'kSecAccessControlBiometryAny',  kSecUseOperationPrompt: 'We will store data securely on your device.',  sharedPreferencesName: 'sensitive',  keychainService: 'sensitive',};

Recently one of my clients complain about the data cannot be retrieved from keychain because of errSecNotAvailable = -25291, /* No keychain is available. You may need to restart your computer. */

I thought there might be something wrong happened to keychain, so I tried set a single key/value item with the same option (so the kSecAttrService and kSecClass are same with business related items): 'foo' ->'bar'. And I can load this value out via the same option.

I did more experiences:

  1. if I read a key doesn't exist, the keychain API will return error errSecItemNotFound -25300

  2. if I read a business related key, the keychain API return error errSecNotAvailable -25291

  3. I jailbreak this iPhone and use https://github.com/ptoomey3/Keychain-Dumper to dump the items but it prompt (although the phone is unlock):

[INFO] No Generic Password Keychain items found.[HINT] You should unlock your device!
  1. I copied Keychain-2.db from device to local computer and using sqlite DB to query the generic password items, looks like they are there (but as they are encrypted, i am not sure 100%):enter image description here

I am expecting someone could suggest:

  1. why this issue could happen?
  2. is there any possibility I can restore the keychain data?

How to add json data to another screen react-native expo

$
0
0

I am using react-native and expo. As in the screenshot you can see that's how my first screen SearchScreen looks as. So when I click on the A (first one) it should redirect me to stock screen(as you can see in bottom of tabs) and add this symbol A. there. Could someone please tell me how to do that?

My code:

import React, { useState, useEffect } from "react";import {  StyleSheet,  View,  TouchableWithoutFeedback,  Keyboard,  FlatList,  TextInput,  Button,  Text,} from "react-native";import { useStocksContext } from "../contexts/StocksContext";import { scaleSize } from "../constants/Layout";import { Ionicons } from "@expo/vector-icons";import { ListItem } from "react-native";export default function SearchScreen({ navigation }) {  const { ServerURL, addToWatchlist } = useStocksContext();  const [state, setState] = useState({    /*  initial state here */    myListData: [],    search: "",  });  const [search, setSearch] = useState("");  useEffect(() => {    renderWithData();    // FixMe: fetch symbol names from the servner and save in local SearchScreen state  }, []);  updateSearch = (event) => {    setState({ search: event.target.value });  };  renderWithData = () => {    return fetch("http://131.181.190.87:3001/all")      .then((res) => res.json())      .then((json) => {        setState({          isLoaded: true,          myListData: json,        });        setTimeout(() => {          console.log(json);        }, 1000);      });  };  let movies = state.myListData.map((val) => {    return (<View key={val.symbol} style={styles.text}><Text style={styles.text}>{val.symbol}</Text><Text style={styles.text}>{val.name}</Text></View>    );  });  return (<TouchableWithoutFeedback onPress={Keyboard.dismiss}><View style={styles.container}><TextInput          style={styles.textinput}          placeholder="Search here"          placeholderTextColor="white"        /><Text>csdn</Text><View style={styles.text}>{movies}</View></View></TouchableWithoutFeedback>  );}const styles = StyleSheet.create({  textinput: {    color: "white",    height: "20",    fontSize: 18,  },  text: {    color: "white",    backgroundColor: "black",  },  flatstuff: {    color: "white",  },  // use scaleSize(x) to adjust sizes for small/large screens});

Below is the image (the link)SearchScreen

Compiling app using Vmware OSX

$
0
0

I am trying to learn react Native for IOS development... I have researched a lot about Swift vs React native and came to this decision. The question is I am poor as hell. But got a good PC. And I can run VMware OSX in my PC. I understand that I can install an run Xcode and all that. But I am getting the question whether I can upload my app to an Iphone or Also Can I upload it to Apple Store using my VMware? There is a word comes up like final compiling can't be done without a Mac and All that. Since I got it using a VM is confusing and difficult and also slow. But still I can't spend on a MAC right now. But I have to learn and upload app into the Apple Store along with testing it on an Iphone. So the question is, Is it a problem using VMware OSX to do these things?please help, I researched a lot but could't get these things :)TIA.

React-Native Image is not displaying after XCode 11.5 Upgrade

$
0
0

I usually display images like this:

<Image source={require('../../assets/images/color/stuff.png')} /><Image source={require('../some-other-path/picture.png')} />

In the past, I could have any arbitrary path I want, in any folder.

Then, when I build for release, I do this before I Build > Run:

react-native bundle --platform ios --dev false --entry-file index.js --bundle-output ./ios/main.jsbundle

Since upgrading to XCode, whenever I do a release build, my images no longer appear. In dev build, the images are visible.

I have tried --assets-dest ./some-folder, but the results are same.

What could cause this change?

react-native auth0 sign in with apple?

$
0
0

How to sign in with apple in react-native using auth0 web form authentication?

Tried following this guide: https://auth0.com/docs/connections/apple-siwa/set-up-apple?_ga=2.267694410.553381554.1591475612-866095660.1584309547

But no luck. Testing the connection gives me: invalid_redirect_uri.

One problem with guide was this part about creating service id:

"After checking Sign In with Apple, click on Configure and define your Web Domain (example.com) and your Return URL. Make sure that your Return URL is your Auth0 domain, such as foo.auth0.com (or your Auth0 custom domain if you have one) and follows this format: https://YOUR_AUTH0_DOMAIN/login/callback. "

Since I use react-native, the callback is not an url that starts with 'https', but a custom uri to return users back to the application. Apple won't allow me to put that custom uri when creating the service-id, but requires the https prefix.

Has anyone succeeded in implementing sign in with apple for react-native applying the auth0 web authentication? Any help is appreciated.

domain = AVFoundationErrorDomain , code = -11828

$
0
0

I am using the streaming url from CloudFront.

Sample URL:https://d14nt81hc5bide.cloudfront.net/qyYj1PcUkYg2ALDfzAdhZAmb

On Android , it is working fine but in iOS it says:domain = AVFoundationErrorDomain , code = -11828

From apple doc the error code 11828 is AVErrorFileFormatNotRecognized.The media could not be opened because it is not in a recognized format.

Can someone suggest how to fix this error?

React Native two drawers on one screen

$
0
0

I have an app that needs to be able to use two drawer navigators, one on the left and on on the right side of the header.

I am at the point where I can get both drawers to open with the slide gesture, however I need to be able to open it programmatically. I have found the navigation.openDrawer() function only works with one of the drawers and not the other because it is only able to use one of the navigation props (whichever comes first) from my drawer navigators.

Below are my rendering functions:

const LeftStack = createStackNavigator(  {    LeftDrawerStack  },  {    navigationOptions: ({navigation}) => ({      headerLeft: (<TouchableOpacity onPress={() => navigation.openDrawer()}><Icon style={{marginLeft: 10}} name='menu'/></TouchableOpacity>      )    })  });const RightStack = createStackNavigator(  {    RightDrawerStack  },  {    navigationOptions: ({navigation}) => ({      headerRight: (<TouchableOpacity onPress={() => navigation.openDrawer()}><Icon style={{marginRight: 10}} name='ios-bulb'/></TouchableOpacity>      )    })  });export const RouteStack = createStackNavigator(  {    screen: LoginScreen,    navigationOptions: ({navigation}) => ({      header: null    }),    LeftStack,    RightStack  });

and here are my drawer routes:

export const LeftDrawerStack = createDrawerNavigator(  {    Dashboard: {      screen: DashboardScreen    },    History: {      screen: HistoryScreen    },    Privacy: {      screen: PrivacyPolicyScreen    },    TermsAndConditions: {      screen: TermsAndConditionsScreen    }  }, {    initialRouteName: 'Dashboard',    contentComponent: LeftDrawerScreen  });export const RightDrawerStack = createDrawerNavigator(  {    LeftDrawerStack,    Settings: {      screen: SettingsScreen    }  }, {    drawerPosition: 'right',    contentComponent: RightDrawerScreen  });

Here is a picture of what I have the navigation looking like so far, however both of the hamburger menus are opening up the same menu on the right instead of one menu on their respective sides.

layout picture

I may be missing some parts but I will be sure to post more info if I forgot any!

How do I update js file/code on App Launch

$
0
0

I want a react-native app, when started on a device to check for some update and download it and use it instead of old js file.I have checked out Codepush but as an alternative I am searching for a simple and clean implementation for a small case usage.

I just want some js code/file to be updated without bundling the app again or updating it through playstore, maybe suggest some other options too.


How to get ios bundle id for Firebase from react-native?

$
0
0

I am trying to connect the Firebase project to my current react-antive app (Windows 10 OS).I am following steps from https://rnfirebase.io/ .

However when i try to add iso app, i need the ios bundle ID of th eproject, but i seem no to find it.

The only thing i find, after 2 hours of research on google, is that the info.plist suppose to have this data but mine got only this:

CFBundleIdentifier$(PRODUCT_BUNDLE_IDENTIFIER)

Does anyone have a solution, coz at this point a feel really stupid that i stuck on this step :(

facebook SDK with react-native: no framework search path

$
0
0

I was playing around with Facebook SDK with react-native generated ios app template. I was following the instructions here: https://developers.facebook.com/docs/ios/getting-started but somehow did not see Framework Search Paths mentioned in step 4.5. the react-native generated ios project seems to only have header search path, as shown below.

I was using latest Xcode version (9.3)enter image description here

Upgrading React Native plugin to support autolinking and React Native versions 0.6>=

$
0
0

I am fairly new to React Native but am helping manage a React Native plugin and would like some guidance for upgrading it so that it is compatible with auto linking and React Native versions 0.60 and up in iOS.

Our plugin currently only works with React Native up to and including 0.59.x through the react-native link command and sometimes involves manually dragging our xcodeproj and .a binary inside Xcode.

When trying to instrument our plugin with a blank hello world React Native app of version 0.60.5, after react-native link and dragging in Xcode, we get an error saying rctbridgemodule.h not found and have to add React.xcodeproj too. This however doesn’t work on some apps we’ve tried. Furthermore the issue is in newer versions of React eg 0.61.4, the React.xcodeproj file is no longer in the React folder in node_modules. 

I’ve had a look at the What do I need to have in my package to make it work? Section in this link: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md

But to me its not very clear how we should be configuring a pod spec in the root of our repo. Our package is scoped also. I’m assuming that there shouldn’t need to be any changes to the actual code of our plugin but rather just some modifications to our pod spec and package configuration. Any guidance in how this works and how to upgrade our plugin to support versions 0.6 and above would be greatly appreciated. Thanks!

Webivew onNavigationStateChange method call multiple time in react native

$
0
0

I am making react native application and one screen I am used webview for that and I want to handle onNavigationStateChange props one time call right now it is calling multiple times so any idea how can I solve this issue. refer below code

<WebView          ref={r => this.webview = r}         style={{width:globals.screenWidth, height:globals.screenHeight}}         bounces={false}         style={{ flex: 1 }}         startInLoadingState         scalesPageToFit         javaScriptEnabledAndroid={true}         javaScriptEnabled={true}         domStorageEnabled = {true}         onNavigationStateChange={data =>            this.handleNavigationStateChange(data)        }         onLoadStart={() => {             console.log("onLoadStart-->");         }}         onLoadEnd={() => {            console.log("onLoadEnd-->");         }}         source={{uri: globals.MYURL}}         onError={(error) => this.onError()}        />handleNavigationStateChange = navState => {    console.log("navState >>>>"+ JSON.stringify(navState));};

When i run above code navState >>>> print 3 times I want to handle it 1 time so how can I solve this issue? Your all suggestions are appreciable.

TypeError: undefined is not an object {evaluating 'this.props.currTimeFocus.startTime.toLocaleTimeString()}

$
0
0

I'm having trouble with redux state as {this.props.currTimeFocus.startTime.toLocaleTimeString()} is undefined. The thing is the app works fine on Android phone and I'm able to render state gotten from my store, but when I try testing it on iPhone, this.props.currTimeFocus seems to have some kind of delay or it can't be accessed. Is there any difference I need to account for in Android and IOS, or am I handling redux state wrongly?

import React from 'react';import { addFriend, updateCurrFocusTime, goForward, goBack } from '../actions/timeline_actions';import { StyleSheet, View, Text, Button, TouchableOpacity } from 'react-native';import { connect } from 'react-redux'import DateTimePicker from '@react-native-community/datetimepicker';import { FontAwesomeIcon } from '@fortawesome/react-native-fontawesome';import { faArrowLeft, faArrowRight } from '@fortawesome/free-solid-svg-icons';/** * This component allows users to input their available timings as well as their friends. The global state will keep track of * the common overlapping intervals of time as the user inputs more and more timings. */class Timeline extends React.Component {  constructor(props) {    super(props);    this.state = {      mode: 'date',      show: false,      modifyingStartTime: false    };  }  onChange = (event, selectedDate) => {    const currentDate = selectedDate || (this.state.modifyingStartTime ? this.props.currTimeFocus.startTime : this.props.currTimeFocus.endTime);    this.setState({ show: Platform.OS === 'ios' });    if (this.state.modifyingStartTime) {      this.setState({        startTime: currentDate,        endTime: this.props.currTimeFocus.endTime      });    } else {      this.setState({        endTime: currentDate,        startTime: this.props.currTimeFocus.startTime      });    }    // Update Redux state    this.props.updateCurrFocusTime(this.props.currFocus,      {        startTime: this.state.startTime,        endTime: this.state.endTime      });  };  showMode = currentMode => {    this.setState({ show: true });    this.setState({ mode: currentMode });  };  showTimepicker = () => {    this.showMode('time');  };  finalize = (values) => {    this.props.navigation.navigate("Genre");  }  modifyStartTime = () => {    this.setState({ modifyingStartTime: true });    this.showTimepicker();  }  modifyEndTime = () => {    this.setState({ modifyingStartTime: false });    this.showTimepicker();  }  addFriend = () => {    // Call Redux action, reset date for next input    this.props.addFriend({      startTime: new Date().toJSON(),      endTime: new Date().toJSON()    });  }  previousFriend = () => {    this.props.goBack()  }  nextFriend = () => {    this.props.goForward()  }  render() {    return (<View style={styles.container} ><View style={styles.header}><Text style={styles.title}>Available timings</Text></View><View style={styles.body}><View style={{ flexDirection: 'row', alignSelf: 'flex-start', flex: 1, marginTop: '30%' }}><Button title="+ Add Friend" onPress={this.addFriend} /></View><View style={{ flexDirection: 'column', flex: 4, justifyContent: 'space-evenly' }}><View style={styles.timeSelection}><Text style={styles.time}>                From:</Text><TouchableOpacity onPress={this.modifyStartTime}><Text style={{ textDecorationLine: 'underline', fontSize: 20 }}>                  {this.props.currTimeFocus.startTime.toLocaleTimeString()}hrs</Text></TouchableOpacity></View><View style={styles.timeSelection}><Text style={styles.time}>                To:</Text><TouchableOpacity onPress={this.modifyEndTime}><Text style={{ textDecorationLine: 'underline', fontSize: 20 }}>                  {this.props.currTimeFocus.endTime.toLocaleTimeString()}hrs</Text></TouchableOpacity></View></View></View><View style={styles.footer}><View style={styles.arrows}><TouchableOpacity onPress={this.previousFriend}><FontAwesomeIcon icon={faArrowLeft} size={30} /></TouchableOpacity><TouchableOpacity onPress={this.nextFriend}><FontAwesomeIcon icon={faArrowRight} size={30} /></TouchableOpacity></View><View style={{ marginTop: 20 }}><Text>              You are adding for friend number {this.props.currFocus + 1}</Text></View></View><View          style={{ alignSelf: 'flex-end', bottom: 0, position: 'absolute' }}><Button title="Finalize"            onPress={() => this.finalize([this.props.values_start, this.props.values_end])} /></View>        {this.state.show && (<DateTimePicker            testID="dateTimePicker"            timeZoneOffsetInMinutes={0}            value={this.state.modifyingStartTime ? new Date(this.props.currTimeFocus.startTime) : new Date(this.props.currTimeFocus.endTime)}            mode={this.state.mode}            is24Hour={true}            display="default"            onChange={this.onChange}          />        )}</View>    );  }}const styles = StyleSheet.create({  container: {    flex: 1,  },  header: {    flex: 1,  },  body: {    flex: 6,    marginRight: 15,    flexDirection: 'row-reverse'  },  footer: {    flex: 2,  },  time: {    fontFamily: 'serif',    fontSize: 15  },  text: {    alignSelf: 'center',    paddingVertical: 20,  },  title: {    fontSize: 30,    fontFamily: 'serif',    marginTop: '10%',    marginLeft: 15  },  arrows: {    marginTop: 20,    flexDirection: 'row',    padding: 20,    justifyContent: 'space-between',  }});const mapDispatchToProps = {  addFriend, goForward, goBack, updateCurrFocusTime}const mapStateToProps = (state) => {  const selectedFriendIndex = state.timeline.currFocus;  const selectedFriendTime = state.timeline.availableTimings[selectedFriendIndex];  return {    currTimeFocus: selectedFriendTime,    currFocus: selectedFriendIndex  }}export default connect(mapStateToProps, mapDispatchToProps)(Timeline)

What is the meaning of 'No bundle URL present' in react-native?

$
0
0

When I run a react-native project, I get a error no bundle URL present , but I don't know what mistakes I do, I was very confused.

enter image description here

Universal DeepLink on iOS doesn't work through web navigator but works for basic click

$
0
0

I've a problem with deeplink on iOS. Here is the case : I've a web page with a classic button using an universal link such as https://my-app/routeA/params.

If the user directly clicked on this link through mail, note, message the deeplink to my mobile app is working. However, if he clicked with the button (on the web page), through safari or chrome, the deeplink doesn't work.

By the way, the deeplink works well on Android when the user click on the button (within the web page).

So it seems to be a problem with web navigator on iOS. Any ideas what's wrong here ?


How to get iOS bundle id for Firebase?

$
0
0

I am trying to connect the Firebase project to my current react-native app (Windows 10 OS).I am following steps from https://rnfirebase.io/.

However when I try to add iso app, I need the iOS bundle ID of the project, but I seem not to find it.

The only thing I find, after 2 hours of research on Google, is that the info.plist suppose to have this data but mine got only this:

<key>CFBundleIdentifier</key><string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>

Does anyone have a solution?

React Native - Setting TextInput cursor position

$
0
0

In my React Native app, I am trying to set the cursor position of a TextInput to a particular position (eg. to the 5th character) but am have trouble doing so as the documentation is lacking a little. I suspect it has something to do with the 'setSelection' property of TextInput but I cannot seem to find out what to do.

Has anyone successfully done so?

Thanks.

React native ios deeplinking with universal URL

$
0
0

I've been facing issue setting up deeplinking with react native for IOS with react navigation 5. When i try the URL scheme of myownapp://homepage/ it opens up the app.

But if i try with url : https://dev.myownapp.com/homepage/ it opens up the safari browser, but it doesnt open up the app.

I've tried with the documentation by adding Appropriate code in AppDelegate.m file and also ive added myownapp.com in the Associated Domains in Xcode.

xcode

Can you guys brief about what configuration is left to be done because the same opens in android. Thanks in Advance

Run react-native application on iOS device directly from command line?

$
0
0

Is it possible to run react-native application on an iOS device directly from the command line like we do on simulator with react-native run ios --simulator "iPhone 5s"?

Should I use Expo for making a small cross paltform app?

$
0
0

After a month o f making an app in react-native vanilla, realisede today, that i wont be able to make the Ios side without an IOS OS.

As i only have Windows and this is just a first try for me of making an an app, i wonder is it worth trying to remake the app using expo-cli. I am just unsure, coz everwhere is said that it is now adviced.

My point is that my app i a simple "chat-room" based application, that only includes transfering data between the client and the abckend ( firebase). Is it okay to ue expo in this case?

Viewing all 16564 articles
Browse latest View live


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