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

React Native "An unknown error occurred" by Apple review

$
0
0

I use react-native-iap package (6.0.3)

React native version is 0.64

I get no error when testing iap in ios but Apple Review gets "An unknown error occurred" when they try to call requestPurchase method. I tested in real device and simulator, both of them have no error. I waited a day and submit again but app has been rejected again. What can i do?


React native determine when text is cut off

$
0
0

I am using react-native with a limited number of lines, that are shown as ... using

<Text numberOfLines={4}> {myText} </Text>

Now my issue is, if the text is cut off I would like to show it some special image, to navigate to a new view. I am wondering whether there is a property i can use to test if the text is being cut off?

How to fix yarn ios build error in React Native?

$
0
0

When I run:

yarn ios

it throws this error:

The following build commands failed:        PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/applemacbook/Library/Developer/Xcode/DerivedData/AwesomeProject-dqnlgtsougxpuwdghrmclyntrevj/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBReactNativeSpec.build/Script-1FA6E1255725D37983E4E9DE0E0B6F29.sh(1 failure)info Run CLI with --verbose flag for more details.error Command failed with exit code 1.info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Error Image

react native IAP : Subscription always return status: 21002 a

$
0
0

I am working on auth renewable subscription. But every time i goes for the reciept validation it gives me error 21002

      const validateIOSReceipt = async (receipt) => {    const isTestEnvironment = __DEV__;    const receiptBody = {'receipt-data': receipt,      password: DataConfig.IAP_SHARED_SECRET    };    console.log('receiptBody data',receiptBody)    try {      const validatedReceipt = await validateReceiptIos(        receiptBody,        isTestEnvironment,      );        console.log('receiptBody responce',validatedReceipt)      return validatedReceipt;    } catch (error) {      console.log(error);      return {};    }  };{receipt-data: "MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwGggCSABIIBaDGCAWQwDwIBAAIBAQQHDAVYY29kZTALAgEBAgEBBAMCAQAwFQIBAgIBAQQNDAtjb20ubXRwLmFwcDANAgEDAgEBBAUMAzEuMDAQAgEEA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oLibraryUsageDescription key must be present in Info.plist to use camera roll

$
0
0

Recently I started to get this error:

NSPhotoLibraryUsageDescription key must be present in Info.plist to use camera roll.

I am using React Native to build my app (I am not familiar with ios native development) and I don't know how to add this key to Info.plist

Can you post an example? Thanks

I am using npm package "react-native-camera-roll-picker": "^1.1.7"

enter image description here

React native expo implementing Apple App Tracking Transparency (ATT) for iOS 14.5

$
0
0

What is the best way of implementing the Apple App Transparency Tracker (ATT) feature on react native expo? My app keeps getting rejected by apple even after I add:

app.json file :

"infoPlist": {"NSUserTrackingUsageDescription": "App requires permission...."}

Issue building react native project in Xcode - error: could not find auto linked libraries + undefined symbols etc

$
0
0

I am trying to get a react native app running on my new Mac mini m1.

First time trying to get everything set up. So far it's been quite painful.

The error occurs when building in Xcode. Initially I had some other errors in Xcode which were resolved by editing the flipper version in the Podfile.

Now I have a list of unlinked libraries and undefined symbols in swift

enter image description here

My searches did suggest that adding an empty swift file might help but it hasn't made a difference

enter image description here

Any idea on what I can try next?

How to open default Contact app in react native using Expo?

$
0
0

How to open the default Contact app in react native using Expo?

my requirements are:

  1. Display a button to open the contact book on home screen.
  2. On clicking the button, open the list of contacts in user's phone.
  3. On contact list, each contact item should display the contact's profile picture, full name and the number/type of number(Home/work)
  4. Add a search bar that will allow the user to search contacts by name
  5. Once the user selects a contact, go back to home screen and display the chosen contact's phone number in a text field(not as an alert/toast).
  6. If a contact has multiple phone numbers, allow the user to pick only one phone number.

React native app through Expo, getting firestore permission error:

$
0
0

This is my first post here so please let me know if I'm not posting this correctly.

I keep getting the following error in the debug logs of my react native Expo app on the iOS simulator when I have an authenticated user trying to retrieve a firestore document:

FirebaseError: [code=permission-denied]: Missing or insufficient permissions.

Here is firebase.js config file:

    import "firebase/firestore";    import "firebase/storage";    import * as firebase from 'firebase';    // Initialize Firebase    const firebaseConfig = {        apiKey: ... //removed for this post, but it is correct and validated    };    firebase.initializeApp(firebaseConfig);    const db = firebase.firestore();    const auth = firebase.auth();    export { auth };    export default db;

Here is my App.js:

import React, { useEffect, useState } from 'react';import db, { auth } from './firebase';const getUserData = async(uid) => {    try {    const doc = await db.collection('users').doc(uid).collection('info').doc(uid).get();        if (doc.exists) {            console.log(doc.data());        } else {            // doc.data() will be undefined in this case            console.log("No user info was found for the authenticated user");        }    } catch(err) {        console.log(err);    }};useEffect(() => {    auth.onAuthStateChanged((authUser) => {        if (authUser) {            //user is logged in            getUserData(authUser.uid); //retrieve the user's profile data        } else {            //user is logged out            auth.signOut();        }    });}, []);

My security rules shouldn't be the problem because it works for my web react app with the same logic and user, and the get request is only sent when there is a uid because the user is authenticated. I've printed out the uid after onAuthStateChanged and it is the correct uid.

//Security Rules in Firestorefunction signedInAndSameUser(uid) {    return request.auth != null && request.auth.uid == uid;}

I've seen similar posts that recommended to downgrade to firebase@4.6.2 but I also ran into issues and couldn't get it to work. I'm wondering if firebase still hasn't fixed this issue even after version 8 (In react native app (through Expo) using firestore permissions - request.auth is always null)

This is my current firebase and expo version in my package.json:

//package.json"expo": "~41.0.1","firebase": "8.2.3",

Thank you so much if you can help, I've been stuck on this issue for many hours and can't seem to understand why this works in my react.js web app, but the same logic, user, and security rules won't work in my react native Expo iOS app.

run Expo React Native app on iPhone plugged in

$
0
0

For some reason I need to simulate my app in Expo on my iPhone with USB plugged into my computer... Is there a way to do it? I don't see any detailed instructions from the docs for that. Can anyone help? Thanks!

Share component not recognise device language

$
0
0

In react native Share component always open in english language. Even if I set italian language in system of iOS then also it display in english. Is there any option for set localise in share dialogue.

Here is the code and screenshot

let result = await Share.share(        {          message: text          url: urlShare,          title: abc        },        {          dialogTitle: abc,        },      );

Please help me render react-native code in swift

$
0
0

I've been developing in react-native for a while but the architecture that I've been been using kept breaking down so I decided to create a fresh Xcode project and link it to react-native manually to develop my app. I'm having a bit of trouble actually linking the code together, though, and was wondering if anyone could give me a hand.

Here's my ContentView.swift file that I can't get to render my app.

import SwiftUIimport Reactfunc startButtonPressed() {  NSLog("Hello")    let jsCodeLocation = URL(string: "http://localhost:8081/index.bundle?platform=ios")!  let rootView = RCTRootView(      bundleURL: jsCodeLocation,      moduleName: "App",      initialProperties: nil,      launchOptions: nil  )  let vc = UIViewController()  vc.view = rootView  vc.present(vc, animated: true, completion: nil) # I also tried self.present ... but got an error saying "Can't find self in scope"}struct ContentView: View {    var body: some View {        Button("Start") {            startButtonPressed()        }            .padding()    }}struct ContentView_Previews: PreviewProvider {    static var previews: some View {        ContentView()    }}

Here's the error that's throwing me:Exception NSException * "Application tried to present modal view controller on itself. Presenting controller is <UIViewController: 0x114819b70>." 0x000000028179c4e0.
It also crashes the app on my device.
Any help appreciated and thanks in advance!

React Native: how to change status bar icon colors

$
0
0

I can't seem to find a way to change the colors of the status bar icons to white - at the top of the screen, e.g time & battery.

iPhone 6 screenshot

I've tried adding the following in info.plist

  • Status bar style: UIStatusBarStyleLightContent
  • View controller-based status bar appearance: NO

But only seems to work in previous versions of IOS. Any help much appreciated.

How to center text vertically and horizontally?

$
0
0

I've been trying to make my text in react native appear in the center of a button. Currently, I've used justify-content:'center' to have it align properly vertically. However, my text wont be aligned horizontally. I've tried doing alignItems:'center'& textAlign:'center' to both the textwrapper and the centeredtext, but none have been working. Is there something in my code that could possibly be causing this?

const SLNBOptionButton = (props) => {    let styles = StyleSheet.create({        textWrapper: {            flexWrap: 'wrap',            borderWidth: 1,            borderStyle: 'solid',            borderColor: '#000',            borderWidth: 1,            borderColor: '#F0F0F0',            padding: 12,            marginVertical: 8,            flexGrow: 1,            backgroundColor: props.isActive ? '#6E6CF0' : '#fff',            width: Dimensions.get('window').width - 60,            height: 60,            borderRadius: 10,            justifyContent:'center',            color:'#414141'        },        activeTextColor: {            color: '#fff',            },        inActiveTextColor: {            color:'gray'        },        centeredText:{            //nothing has worked here        }    });

Having difficulty wrapping text at end of button with flexWrap

$
0
0

hi: I'm currently trying to have my text wrap once it reaches the end of a button or the textWrapper in the code. I've been trying a lot of different combinations of flexWrap:'wrap" and flex:1. Below is what I have:

const OptionButton = (props) => {    let styles = StyleSheet.create({        textWrapper: {            flexWrap: 'wrap',            borderWidth: 1,            borderStyle: 'solid',            borderColor: '#000',            borderWidth: 0,            padding: 12,            marginVertical: 8,            backgroundColor: props.isActive ? '#6E6CF0' : '#fff',            width: Dimensions.get('window').width - 40,            height: 60,            justifyContent:'center',            borderRadius: 10,        },        descriptionPadding:{            paddingLeft: 26,        },        inActiveTextColor: {            color:'gray'        },        description:{            flexWrap: 'wrap'        }    });    return (<View><TouchableWithoutFeedback onPress={props.onClick}><View style={[styles.textWrapper, props.style]}><View style={styles.description}><Text style={props.isActive ? [styles.activeTextColor, styles.descriptionPadding] : [styles.normal, styles.descriptionPadding]}>{props.description}</Text></View></View></TouchableWithoutFeedback></View>    )}

Currently, my description is wrapping as I expect it to. Any suggestions would be welcomed!


Why am i getting this error even though I cleaned the pod file in VS Code when running a React-Native project

$
0
0

enter image description here

I used npx react-native run-ios to run the project. This is the first react native project I made and I cant get over this error. Send help pls !111!!1!1!1!

Duplicate Module Name: react-native

$
0
0

I ran Pod Update in my XCode Project and now my project isn't compiling due to duplicate modules being downloaded. Anyone know any solutions?

Looking for JS files in   /Users/.../App/Finalv2 Metro Bundler ready.Loading dependency graph...jest-haste-map: @providesModule naming collision:  Duplicate module name: react-native  Paths: /Users/.../App/Finalv2/node_modules/react-native/package.json collides with /Users/.../App/Finalv2/ios/Pods/React/package.jsonThis warning is caused by a @providesModule declaration with the same name across two different files.Loading dependency graph, done.

UPDATE:I deleted my node_modules folder and package.lock.json and ran npm install but the issue is still there

EDIT:

Adding my Package.json

{"name": "sample-app","version": "0.0.1","private": true,"scripts": {"start": "node node_modules/react-native/local-cli/cli.js start","test": "jest"  },"dependencies": {"@expo/vector-icons": "^6.2.2","art": "^0.10.1","axios": "^0.17.1","expo": "^24.0.2","firebase": "^4.6.0","lodash": "^4.17.4","moment": "^2.19.3","native-base": "^2.3.3","prop-types": "^15.6.0","react": "^16.3.1","react-native": "^0.55.3","react-native-camera": "^0.10.0","react-native-circular-progress": "git+https://github.com/kk1429/react-native-circular-progress.git","react-native-countdown-circle": "^2.0.0","react-native-country-picker-modal": "^0.5.1","react-native-device-info": "^0.13.0","react-native-easy-grid": "^0.1.16","react-native-elements": "^0.18.5","react-native-fcm": "^11.2.0","react-native-fetch-blob": "^0.10.8","react-native-firebase": "^4.1.0","react-native-linear-gradient": "^2.4.0","react-native-linkedin": "^1.2.1","react-native-material-ui": "^1.19.0","react-native-navigation": "^1.1.471","react-native-progress": "^3.4.0","react-native-pull-refresh": "^1.0.0","react-native-rename": "^2.2.2","react-native-svg": "^5.4.2","react-native-svg-animated-linear-gradient": "^0.1.8","react-native-swiper": "^1.5.13","react-native-tag-input": "git+https://github.com/kk1429/react-native-tag-input.git","react-native-thumbnail-video": "0.0.8","react-native-vector-icons": "^4.4.2","react-native-video": "^2.0.0","react-navigation": "^1.0.0-beta.19","react-redux": "^5.0.6","react-save-refs": "^1.0.2","redux": "^3.7.2","redux-devtools-extension": "^2.13.2","redux-persist": "^5.3.4","redux-thunk": "^2.2.0","whatwg-fetch": "^2.0.3"  },"devDependencies": {"babel-jest": "22.1.0","babel-preset-react-native": "4.0.0","jest": "22.1.4","react-test-renderer": "16.2.0"  },"jest": {"preset": "react-native"  },"rnpm": {"assets": ["./assets/fonts/"    ]  }}

UPDATE

Running npm install gives a weird error

> fsevents@1.2.4 install /Users/.../App/Finalv2/node_modules/fsevents> node install[fsevents] Success: "/Users/.../App/Finalv2/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" already installedPass --update-binary to reinstall or --build-from-source to recompile> grpc@1.10.1 install /Users/kaaddevelopers/Documents/Clipme/App/Finalv2/node_modules/grpc> node-pre-gyp install --fallback-to-build --library=static_librarynode-pre-gyp ERR! Tried to download(403): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.10.1/node-v64-darwin-x64-unknown.tar.gznode-pre-gyp ERR! Pre-built binaries not found for grpc@1.10.1 and node@10.1.0 (node-v64 ABI, unknown) (falling back to source compile with node-gyp)

How to fix "RCTStatusBarManager module requires that the UIViewControllerBasedStatusBarAppearance key in the Info.plist is set to NO"

$
0
0

In my app I use React Native (legacy code) and iOS native components.

Recently I implemented preferredStatusBarStyle override in my iOS ViewController.

But preferredStatusBarStyle doesn't work without View controller-based status bar appearance = YES in Info.plist. So I changed this key to YES.

Now I have a React Native error: "RCTStatusBarManager module requires that the UIViewControllerBasedStatusBarAppearance key in the Info.plist is set to NO".

Error screenshot.

Is there any way how to remove error without changing .plist back? I searched all legacy react code and didn't find any use of StatusBar React Component.

How do I extend the current theme to my components in expo react-native?

$
0
0

I'm trying to implement themes (dark | light) in my expo react-native app. I've been reading their documentation on the dark and light themes on the expo page, and that works inside App.js. However, whenever I declare a component and import it in App.js, it won't work. My thought process is trying to "extend" the current theme to my component.

Here's the App.js code:

import { StatusBar } from 'expo-status-bar';import React from 'react';import { StyleSheet, Text, View, useColorScheme } from 'react-native';//import firebase + configimport firebaseConfig from './config'import firebase from 'firebase'//initialize firebase applicationif(!firebase.apps.length){  firebase.initializeApp(firebaseConfig)} else{  firebase.app()}//import screensimport Overview from './screens/Overview'export default function App() {  const colorScheme = useColorScheme();  const themeTextStyle = colorScheme === 'light' ? styles.lightThemeText : styles.darkThemeText;  const themeContainerStyle = colorScheme === 'light' ? styles.lightContainer : styles.darkContainer;    return (<View style={[styles.container, themeContainerStyle]}><Overview /></View>    );}const styles = StyleSheet.create({  container: {    flex: 1,    alignItems: 'center',    justifyContent: 'center',  },  lightContainer: {    backgroundColor: '#fff',  },  darkContainer: {    backgroundColor: '#101010',  },  lightThemeText: {    color: '#000000',  },  darkThemeText: {    color: '#ffffff',  },});

And here's my simple component:

import React from 'react'import {View, Text, useColorScheme} from 'react-native'export default class App extends React.Component{  render(){    return(<View><Text>OverView</Text></View>    )  }}

All I'm trying to do is get that Overview component to follow the theme rules instead of needing to declare the style that's already been declared in App.js.

Now it's not reflected in the code, but I did try a lot of stuff before posting this question.

How open a image in landscape mode in react native

$
0
0

my whole app is in portrait mode but when I double tap on images/thumbnails I want the picture to open in landscape and auto back to portrait when the images are closed in React Native. I would really appreciate some help on this or a reference to a similar solution if posted already.

Viewing all 16907 articles
Browse latest View live