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

React Native Community Cookies iOS.set Error

$
0
0

I'm trying to set a cookie 🍪 like in the example documentation and I'm getting this error:

My code is this:

CookieManager.set('http://example.com', {          name: 'myCookie',          value: 'myValue',          domain: 'some domain',          path: '/',          version: '1',          expires: '2015-05-30T12:30:00.00-05:00'        }).then(done => {          console.log('CookieManager.set =>', done)        })

Nope, I already have @react-native-community/cookies v3. Tried to unlink it, uninstall it, and install @react-native-community/cookies@^3.0.0, and I'm having the same error.Also, the double quotes are the same as the simple ones. If I write double Visual Code converts them to simple, but on the Red Box error message they are gone for name and value.

I have even created a new project and I'm getting the same error - on a real device, iPhone XS (npx react-native init testCookies)

EDIT:

I have changed the expiration date to 2099 - just in case. I have also changed the domain name to https, a secure one.


Detection face tilt right or left in React native

$
0
0

I want to build a dating app that detects whether the user tilts their head right or left to do swipe right/Left in react native

which of these can work for us?rn-firebase face detectiontensor flow with Posnetor Does rn camera have something built-in?

Can use aem with react native [closed]

$
0
0

Can use aem with react native?Can we use AEM for react-native, if yes than please provide any guide or tutorial link.

Objective-c class exposed via bridging header not visible from swift when archiving release

$
0
0

In my react native project, I try to expose a swift function to the javascript code. It works well in debug mode, but when trying to archiving I get a Use of undeclared type RCTEventEmitter error on my swift file.

The RCTEventEmitter is imported in my RNUtils.m file, and in the bridging header.

So I guess somewhere in the archiving, something fail with the bridging header, but I have no idea where.If I ask for a non existing import, it will tell me that it can't compile the bridging header, so the file is taken into account during the build.

// Utils.m#import "React/RCTBridgeModule.h"#import "React/RCTConvert.h"#import "React/RCTEventEmitter.h"@interface RCT_EXTERN_REMAP_MODULE(RNUtils, RNUtils, RCTEventEmitter)@end
// Utils.swiftimport Foundation@objc(RNUtils)class RNUtils: RCTEventEmitter {  // my native code emitting events}
// MyApp-Bridging-header.h#ifndef MyApp_Bridging_Header_h#define MyApp_Bridging_Header_h#import <React/RCTBridgeModule.h>#import <React/RCTEventEmitter.h>#endif
  • react-native 0.61.5
  • xcode 11.5
  • Swift 5

Yarn ios or react-native run-ios not running react native app

$
0
0

I have created a react-native app using create-react-native-app package. Now running the app using yarn android to run in android emulator works fine. It auto starts the metro builder. But, in case of iOS, using yarn ios does not auto start the metro builder so I have to run it manually and then run yarn ios command to run the app in iOS simulator.

Why is this happening?

Also, in case of android, I have to change the gradle version as well otherwise it gives me error:

Error:Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

But, checking the version using gradle --version shows version 6.5. I need to change gradle-5.6.3-all.zip to gradle-6.3-all.zip or above in file gradle-wrapper.properties. Is there any permanent way to solve this?

Is there a way to force the Android calendar for date selection on iOS as well for the React Native DateTimePicker component?

$
0
0

I'm using the React Native DateTimePicker (https://github.com/react-native-community/datetimepicker) component in an Expo RN project.

Using the component, this is the default date picker for iOS:

enter image description here

And here's the default date picker for Android:

enter image description here

Is there any way to force iOS devices to load the Android calendar as well, as opposed to the rotating picker that's used by default for iOS? Thank you.

Why props is not working with my child component React JS (react native)

$
0
0

So this is in my main class where I am trying to render a modal from a child component.

<NewModal              transparent={true}            show={props.show}></NewModal>

show is initially set as false in the parent constructor and after one of my elements in my flatList is pressed I set show to trueHowever I am not sure why it is not working so well, here is my child class, I have tried lots of varients with the props and nothing seems to be working, the best I can get is the modal showing before I even press on one of my elements in the flat list.

Child component:

 const NewModal = (props) => {   return (<Modal transparent={true} visible={props.show}  ><View style={styles.modalView}><View><Text>Modal Text</Text></View><Button title="Back" onPress={() => visible=false } /></View></Modal>  );

};

 const styles = StyleSheet.create({ modalView: {  marginTop: 100,  height: "70%",  width: "95%",  alignSelf: "center",  borderRadius: 5,  borderWidth: 0.1,  shadowOpacity: 0.7,  backgroundColor: "white", }, });  export default NewModal; 

How to make a Soft Ripple Animation on React Native?


React-native run-ios and xcode don't work

$
0
0

I created an application on Windows that ran and even went up to the Play Store. This is a project for the git repository (bitbucket) and downloaded on the MacBook. The first time, the application ran normally on an iOS simulator, but it was not recognized as fonts that I used and as I'm new to working with Mac and iOS, I was unable to resolve it and ended up deleting the repository and downloading again. From that moment or application no longer runs on the macbook running reat-native run-ios.

I've already followed the guidelines here but I still haven't got anything yet. Here is the error that appears:

The following build commands have failed:Bundle PhaseScriptExecution \ React \ Native \ code \ and \ images /Users/macbook/Library/Developer/Xcode/DerivedData/XXXXXXXXX-chaxzhqkuszomdaeoykspwqsyqbb/Build/Intermediates.noindex/doctorfitStudents.buildXXDebug1XX.

I tried to run in Xcode and I get 3 errors:

ios /../ node_modules / react-native / scripts / .packager.env: permission deniedThe / bin / sh command issued errors, but did not return a non-zero exit code to indicate failure../.node_modules/react-native/scripts/react-native-xcode.sh: this file or directory does not exist"react": "~16.9.0",  "react-native": "~0.61.5",

react native ios create actionable notification

$
0
0

I have checked with many blogs and examples.But I am not getting proper documentation or steps to add actions in iOS push notification.

My application builds using latest versions,

So using this plugin I am able to get normal notification, but in some case I need user action so want create Notification with Accept and Decline button. like below image,

Actionable notification

Also I have tried with react-native-ios-notification-actions plugin. But this plugin is not working with my current PushNotificationIOS plugin.

So my question is,

  1. How I can register action as there is option given in plugin documentation to handle actionable parameter but not sure how to register it before sending the notification?
  2. Is there any other plugin using that anyone achieve this functionality?
  3. Any iOS guy can suggest me steps or way where I can merge native UNNotificationAction class code into it's didReceiveRemoteNotification method.
  4. wix/react-native-notifications gives me error "Error setting up in iOS (lib/dist/index.js doesn't exist)." If Anyone resolve this error or find solution share me your suggestions?

Firebase analytics with Google Tag Manager in react native iOS application

$
0
0

I'm using the React Native firebase library for firebase analytics. I wanted to use Google Tag Manager also in my project for iOS application. Is there a way to integrate it into my project while I'm using react-native-firebase?

This link: https://developers.google.com/tag-manager/ios/v5/ gives me an explanation, but it will not work because react-native-firebase uses v5 of firebase library and Google Tag Manager uses v4 of the same library. I've also tried some third party libraries such as React Native analytics bridge, but no success, because it has poor documentation.

iOS - Update CFBundleURLName and CFBundleURLSchemes

$
0
0

iOS - how we can update CFBundleURLName and CFBundleURLSchemes info.plist value from AppDelegate.m?

how to use print attribute react-native-share

$
0
0

I am using the react-native-share extension for the share and print Pdf document. I am trying to add The 'Print' attribute but it is not working or I couldn't get it rightI follow this document https://react-native-community.github.io/react-native-share/docs/share-open#activitytype

and i used the example here https://react-native-community.github.io/react-native-share/docs/share-open#activityitemsources-ios-onlyAccording to this document, I created an object like

const url = this.props.navigation.state.params.document.url           {            item:{            print : url            }          },

enter image description here

Print: Entry, ":CFBundleIdentifier", Does Not Exist

$
0
0

When I run react-native run-ios the build succeeds but I get the error below. I've checked all over the place but nothing seems to be working. Using sudo in front of the command does not help either. I am using Xcode 7.3, react-native-cli: 0.2.0, react-native: 0.24.1, node v5.11.0.

=== BUILD TARGET mobileTests OF PROJECT mobile WITH CONFIGURATION Release ===Check dependencies** BUILD SUCCEEDED **Installing build/Build/Products/Debug-iphonesimulator/mobile.appAn error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):Failed to install the requested applicationAn application bundle was not found at the provided path.Provide a valid path to the desired application bundle.Print: Entry, ":CFBundleIdentifier", Does Not Exist/Users/astiefel/workspace/bosspayments/mobile/node_modules/promise/lib/done.js:10      throw err;      ^Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/mobile.app/Info.plistPrint: Entry, ":CFBundleIdentifier", Does Not Exist    at checkExecSyncError (child_process.js:470:13)    at Object.execFileSync (child_process.js:490:13)    at _runIOS (runIOS.js:91:34)    at runIOS.js:24:5    at tryCallTwo (/Users/astiefel/workspace/bosspayments/mobile/node_modules/promise/lib/core.js:45:5)    at doResolve (/Users/astiefel/workspace/bosspayments/mobile/node_modules/promise/lib/core.js:200:13)    at new Promise (/Users/astiefel/workspace/bosspayments/mobile/node_modules/promise/lib/core.js:66:3)    at Array.runIOS (runIOS.js:23:10)    at Object.run (/Users/astiefel/workspace/bosspayments/mobile/node_modules/react-native/local-cli/cli.js:86:13)    at Object.<anonymous> (/usr/local/lib/node_modules/react-native-cli/index.js:88:7)

removing specific library from app build in react native

$
0
0

I am using storybook library in my react native application but only for development proposesI would like to delete the bundle completely in production from the build folder

my package.jsonthis is how my devDependencies look like

"devDependencies": {    ....."@storybook/addon-actions": "^5.3.14","@storybook/addon-links": "^5.3.14","@storybook/addons": "^5.3.14","@storybook/react-native": "^5.3.14","@storybook/react-native-server": "^5.3.14",......}

and this is in the script

"scripts": {  ...."storybook": "start-storybook -p 7007",....}

any ideas how to do that ?thank you


Recorded AAC audio in Android does not play on iOS devices

$
0
0

AAC audio recorded in Android is not playing on iOS devices. Here is the code example of how we are recording audio in Android devices. When we try to play that audio in an iOS device using react-native-sound, it does not play on iOS device and getting an error as below.

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.

react-native alert error "Attemp to present UIAlertController

$
0
0

In my react-native application i use some alerts to display messages to the user.

On android everything works fine, but in ios i get following error, every time i try to display an alert:

Warning: Attempt to present <UIAlertController: 0x1030fb600> on <RCTModalHostViewController: 0x1021ad720> whose view is not in the window hierarchy!

i call the alert message via:

this.setState({spinner: true}, () => {  eventHandler    .joinEventById(eventCode, qrHash)    .then((response) => {      this.setState({spinner: false}, () => {        Toast.show('Event Registrierung erfolgreich');      });    })    .catch((error) => {      this.setState({spinner: false}, () =>        funcHelper.showAlert('Fehler beim Beitritt', error, null),      );    });});

i found some solutions to fix it but only for native code, not for the react version.

Can someone give me a hint how i cant fix this or whats the reason for this error

React-native Axios status code response 0 (Skipped) when receive the response when the app at the background

$
0
0

I have to send an http request to the server, and the request takes up to 20 seconds, during this time I have to send my app to background and open another app to do something else and then get back to my App, and when I receive the response from the first app when it at the background, and return it to foreground, Axios returns response 0 (Skipped), while it passed from the server and it should be 200.

return Axios.post(url, payLoad)            .then(result => {                return handleSuccessResultCode(result);            }).catch(error => {                console.log("AxiosPost-error", error);                return handleResultCode(error, resolve, reject);            });

Payload Header:

content-type: application/jsonprovider: iosmacaddress: <Device MAC>deviceid: <Device ID>

Console.log prints:

AxiosPost-error Error: Network Error    at createError (createError.js:16)    at EventTarget.handleError (xhr.js:83)    at EventTarget.dispatchEvent (event-target-shim.js:818)    at EventTarget.setReadyState (XMLHttpRequest.js:574)    at EventTarget.__didCompleteResponse (XMLHttpRequest.js:388)    at XMLHttpRequest.js:501    at RCTDeviceEventEmitter.emit (EventEmitter.js:189)    at MessageQueue.__callFunction (MessageQueue.js:395)    at MessageQueue.js:106    at MessageQueue.__guard (MessageQueue.js:343)

Response:response 200 if I received the http response when the app is in foreground.response 0 if I received the http response when the app is in the background.

by the way, this issue happens only on regular devices, and it works correctly if I test it on simulator.

React Native Create Custom Component/Library

$
0
0

In React Native, there are certain third-party components which compile their own libraries that can be included in your main React project. Examples of such third-party libraries are these:

Now, I would very much like to create my own React Native component with a linked library (iOS only, so I only need the Cocoa library that I would link using this method: https://facebook.github.io/react-native/docs/linking-libraries-ios.html), and so far, all I found is this: http://moduscreate.com/react_native_custom_components_ios/

The resulting project does not, however, specify a library target, and is not linkable to a different project.

I have also tried copying the Touch ID repository and try changing that one's code, but alas, I found it to be uncompilable without being referenced from a different project, which in turn would be the one to be compiled.

Where can I find any guides at all regarding how to do that? Thanks!

Missing request token for request

$
0
0

Get all contacts from phonebook and upload to server but got following error.

While append image in request body FormData

enter image description here

Tried code

pass file url contact thumbnailPath

const path = con.thumbnailPathbody.append('image', {     uri: path,     type: 'image/jpeg',     name: 'photo.jpg',     type: 'multipart/form-data'})

Tried code

pass file url contact thumbnailPath without "file://"

const path = con.thumbnailPath.replace('file://', '')body.append('image', {     uri: path,     type: 'image/jpeg',     name: 'photo.jpg',     type: 'multipart/form-data'})

Tried code

check file exist on path or not with using react-native-fs

if (con.thumbnailPath != '') {     let isExist = RNFS.exists(con.thumbnailPath)     if (isExist) {         const path = con.thumbnailPath.replace('file://', '')         console.log("Exist", path)         body.append('image', {             uri: path,             type: 'image/jpeg',             name: 'photo.jpg',             type: 'multipart/form-data'         })     }}

Request

fetch(url, {    method: 'POST',    headers: {'Authorization': token,'token': token    },    body: params }).then((res) => res.json()).then((json) => {    console.log("RESPONSE:- ", json)    if (json.response[0].status == 'false') {        let msg = json.response[0].response_msg        callback(new Error(msg), json.response[0])    }    else {        callback(null, json.response[0])    }}).catch((err) => {    console.log(err)    callback(err, null)})
Viewing all 16566 articles
Browse latest View live


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