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

React-Native Bundle Error error SHA-1 for file is not computed

$
0
0

I am facing this error while creating bundle of react-native app.

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

error SHA-1 for file /usr/local/lib/node_modules/react-native/node_modules/metro/src/lib/polyfills/require.js (/usr/local/lib/node_modules/react-native/node_modules/metro/src/lib/polyfills/require.js) is not computed. Run CLI with --verbose flag for more details.ReferenceError: SHA-1 for file /usr/local/lib/node_modules/react-native/node_modules/metro/src/lib/polyfills/require.js (/usr/local/lib/node_modules/react-native/node_modules/metro/src/lib/polyfills/require.js) is not computed    at DependencyGraph.getSha1 (/usr/local/lib/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph.js:258:13)    at /usr/local/lib/node_modules/react-native/node_modules/metro/src/DeltaBundler/Transformer.js:211:26    at Generator.next (<anonymous>)    at asyncGeneratorStep (/usr/local/lib/node_modules/react-native/node_modules/metro/src/DeltaBundler/Transformer.js:46:24)    at _next (/usr/local/lib/node_modules/react-native/node_modules/metro/src/DeltaBundler/Transformer.js:66:9)    at /usr/local/lib/node_modules/react-native/node_modules/metro/src/DeltaBundler/Transformer.js:71:7    at new Promise (<anonymous>)    at /usr/local/lib/node_modules/react-native/node_modules/metro/src/DeltaBundler/Transformer.js:63:12    at Transformer.transformFile (/usr/local/lib/node_modules/react-native/node_modules/metro/src/DeltaBundler/Transformer.js:236:7)    at /usr/local/lib/node_modules/react-native/node_modules/metro/src/Bundler.js:87:34

react-native info command output

info Fetching system and libraries information...System:    OS: macOS Mojave 10.14.3    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz    Memory: 1.73 GB / 8.00 GB    Shell: 3.2.57 - /bin/bash  Binaries:    Node: 10.16.0 - /usr/local/bin/node    Yarn: 1.19.1 - /usr/local/bin/yarn    npm: 6.13.4 - /usr/local/bin/npm    Watchman: 4.9.0 - /usr/local/bin/watchman  SDKs:    iOS SDK:      Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2    Android SDK:      API Levels: 23, 25, 26, 27, 28, 29      Build Tools: 27.0.3, 28.0.3      System Images: android-29 | Google Play Intel x86 Atom      Android NDK: 20.1.5948944  IDEs:    Android Studio: 3.4 AI-183.6156.11.34.5522156    Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild  npmPackages:    react: 16.9.0 => 16.9.0     react-native: 0.61.5 => 0.61.5   npmGlobalPackages:    create-react-native-app: 2.0.2    react-native-cli: 2.0.1    react-native: 0.61.5

Gallery opens and close automatically in iOS React native! Working fine in android

$
0
0

I'm facing this issue first time. This same code of react native is working fine for android. The issue is when I open gallery to select images, gallery/photos open and closes automatically. I've already added necessary permissions in info.plist file. Also this works very first time but after that it closes every time.

Any kind of help would be really appreciated.

Thankyou

Expo iOS React Native - White screen on iOS on OS prompt

$
0
0

I am developing an app in RN with Expo. It's basically a WebView of the website, that listens to postMessages to switch to the Login and Signup Screens using a ReactNavigation stack.My problem: when I login, iOS offers to save the login details, but the prompt make the app crash : white screen when I go back on the webview screen (I can see the webview's content for half a second). Same thing with the standalone version and with the notification request iOS prompt...For the standalone app I need to reinstall it. When running with Expo Client, cannot reopen project even after rebooting the iPhone, works after reinstall of the Expo Client App.

See attached screenshot video.

Versions:

I have tried to update Expo SDK, react navigation, rebuild the app. Logging with Google or Fb does work. As I do not have a Mac, I have a lot of trouble debugging the WebView.

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.

Error compiling ios react-native app in .xcassets

Notification issue iOS and Firebase Cloud Messaging react-native

$
0
0

I am trying to send notification from Firebase Cloud Management my iOS Application is not getting notifications and this function is not getting called.

I am getting fcm_registration_id

import firebase from '@react-native-firebase/app';import messaging from '@react-native-firebase/messaging';
messaging().onMessage((message) => {  const {data} = message;  console.log('---Message Received---', message);  if (data.type === 'call') {    if (Utility.isAndroid()) {      NativeModules.Heartbeat.startHeadlessService();      setTimeout(() => {        navigate('CallerScreen', {info: message});      }, 400);    }  }});

How to grant access to react-native-camera after don't allow is pressed first?

$
0
0

At first, when you run the app for the first time and go to the camera it launches the Permission modal on android or ios with the don't allow and allow options.

The package used is react-native-camera. It has a property called notAuthorizedView that you can return any view you want. What I want to do is to enable the camera or grant access to it in the notAuthorizedView which appears when not allowing the camera.

export default class MyCamera extends React.Component {    constructor(props) {        super(props);        this.state = {            uri:''        };    }      render() {        return (<View style={styles.container}><RNCamera          ref={ref => {            this.camera = ref;          }}          style={styles.preview}          type={RNCamera.Constants.Type.back}          flashMode={RNCamera.Constants.FlashMode.on}          notAuthorizedView={<View><Text>YOU ARE NOT AUTHORIZED TO USE THE CAMERA</Text><Button onPress={()=>{Alert.alert('SET CAMERA STATUS TO READY')}}/></View>          }          permissionDialogTitle={'Permission to use camera'}          permissionDialogMessage={'We need your permission to use your camera phone'}          onGoogleVisionBarcodesDetected={({ barcodes }) => {            console.log(barcodes);          }}        /><View style={{ flex: 0, flexDirection: 'row', justifyContent: 'center' }}><TouchableOpacity onPress={this.takePicture.bind(this)} style={styles.capture}><Text style={{ fontSize: 14 }}> SNAP </Text></TouchableOpacity></View></View>        );      }     goToConcern = () => {        this.props.navigation.navigate('Concern', {uriPhoto: this.state.uri})     };  takePicture = async function() {    if (this.camera) {      const options = { quality: 0.5, base64: true };      const data = await this.camera.takePictureAsync(options)      console.log(data.uri);      console.log(data);      this.setState({uri:data.uri})    }  };}

Can I run ios app in windows after eject?

$
0
0

I develop hybrid mobile application using react-native. I want to run ios app on my Iphone 7 in windows laptop. So I use expo and eject my project. In this point, can i run ios application in windows laptop after eject expo? I need bluetooth module but expo not supported. help me plz.


react-native ios icon Image.xcassets - distill failed for unknown reasons in xcode

Xcode 11 unable to CopyPlistFile plist file that was just copied using build phase

$
0
0

I'm trying to follow the instructions here (for iOS) for setting up multiple environments for my React Native project. The idea is that I can make use of Build Phases to copy any plist into GoogleService-Info.plist to enable the use of different Firebase environments for different Xcode schemes.

I've made a user-defined build setting for each of my 4 Xcode configurations called GOOGLE_SERVICE_PLIST_SUFFIX, and I have a build phase (it's the first one that's run before React native Copies and Bundles its required assets) with the following code:

cp -r "GoogleService-Info"$GOOGLE_SERVICE_PLIST_SUFFIX".plist""GoogleService-Info.plist"&wait $!echo "${GOOGLE_SERVICE_PLIST_SUFFIX} Firebase plist copied"

I can tell that the copying is indeed successful, but for some reason the build fails with this error:

The following build commands failed:    CopyPlistFile /Users/andersonaddo/myappname/ios/build/biteup/Build/Products/Prod.Debug-iphonesimulator/Myappname.app/GoogleService-Info.plist /Users/andersonaddo/myappname/ios/GoogleService-Info.plist(1 failure)

Looking at the error trace, this error is explained a bit further:

CopyPlistFile /Users/andersonaddo/myappname/ios/build/myappname/Build/Products/Prod.Debug-iphonesimulator/Myappname.app/GoogleService-Info.plist /Users/andersonaddo/myappname/ios/GoogleService-Info.plist (in target 'myappname' from project 'myappname')    cd /Users/andersonaddo/myappname/ios    builtin-copyPlist --convert binary1 --outdir /Users/andersonaddo/myappname/ios/build/myappname/Build/Products/Prod.Debug-iphonesimulator/Biteup.app -- /Users/andersonaddo/myappname/ios/GoogleService-Info.plisterror: Build input file cannot be found: '/Users/andersonaddo/lunchme/ios/GoogleService-Info.plist' (in target 'biteup' from project 'biteup')

Does anyone have any idea why this behaviour may be happening? If i try and build again after the first failure, I don't run into this issue because the copied file remains in the ios directory from the first attempt.

Android key signing on Windows for React Expo app?

$
0
0

I'm currently following this tutorial (https://medium.com/@inaguirre/react-native-login-with-google-quick-guide-fe351e464752) to add "Login with Google." I got the OAuth client ID working for iOS, but for Android, it requires an SHA-1 certificate fingerprint.
enter image description here

I tried:

openssl rand -base64 32 | openssl sha1 -c  

and (I replaced the "path-to-debug-or-production-keystore" with the full file path)

keytool -keystore path-to-debug-or-production-keystore -list -v   

but neither of these work. A lot of advices given online is from the context of using Android Studio, but I'm using VS Code for an Expo app.

I get this error when I run the second, keytool command in the Command Prompt & PowerShell.

keytool error: java.lang.Exception: Keystore file exists, but is empty: C:\Users\User\Desktop\appjava.lang.Exception: Keystore file exists, but is empty: C:\Users\User\Desktop\app        at sun.security.tools.keytool.Main.doCommands(Unknown Source)        at sun.security.tools.keytool.Main.run(Unknown Source)        at sun.security.tools.keytool.Main.main(Unknown Source)

I also tried running

keytool -keystore path-to-debug-or-production-keystore -list -v   

within the folder that contains the keytool.exe file within the Program Files/Java/jre1.8.0_241 folder, but same error.

Any help?
Thanks

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"?

Google Admob ads not showing

$
0
0

I just created an android and ios app and I wanted to integrate ads from my google AdMob account but the Ads do not show up.

However, when I test my app from the developer's guidance as they provided in the sample id's for interstitial ads and app id, the app works fine. When I put my Admob interstitial ads id and app id then the Ads no longer show.

The first time I uploaded my app to the app store and google play the ads were working for approximately one week and then it suddenly stopped working.

Please does anyone have an idea on how to solve this problem?

iTunes look up api for testflight apps [closed]

$
0
0

I am looking for a way to use the lookup API for iOS applications in testflight. I looked into the documentation and was not able to find an equivalent. Any recommendations ?

React Native: Which navigator should I use? [closed]

$
0
0

I have to build a relatively big cross-platform (iOS & Android) application within 3 months.

So far when it comes to React Native I only have experience with NavigatorIOS. Now while I never really ran into any problems with it I never see people recommending its use.

The other options are Navigator, which seems simple enough but maybe doesn't allow much native UI support? and NavigatorExperimental which I know nothing of, and the name alone worries me. I don't want to be having any last minute nightmares.

I plan on spending a month learning React Native thoroughly and then 2 months building the application.

This leads me to my question: If you had to build a cross platform application in React Native, which navigation would you use for each platform, and why?

Any answers or tips greatly appreciated.


React native ios "Native Module cannot be null"

$
0
0

i try to run my react native code in ios simulator, but i keep get this error on my simulator,I already did npx pod-install but this error keep coming

this problem only appear on ios, in android it work fine

error detail:


enter image description here


react native info:


System:    OS: macOS 10.15.3    CPU: (4) x64 Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz    Memory: 438.08 MB / 8.00 GB    Shell: 3.2.57 - /bin/bash  Binaries:    Node: 8.11.3 - /usr/local/bin/node    Yarn: 1.12.3 - /usr/local/bin/yarn    npm: 5.6.0 - /usr/local/bin/npm    Watchman: 4.9.0 - /usr/local/bin/watchman  SDKs:    iOS SDK:      Platforms: iOS 13.5, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2  IDEs:    Android Studio: 3.2 AI-181.5540.7.32.5056338    Xcode: 11.5/11E608c - /usr/bin/xcodebuild  npmPackages:    react: 16.8.6 => 16.8.6     react-native: 0.60.6 => 0.60.6   npmGlobalPackages:    react-native-cli: 2.0.1    react-native-git-upgrade: 0.2.7    react-native-rename: 2.4.1

my package.js:


"dependencies": {"@react-native-community/masked-view": "^0.1.6","@react-native-firebase/app": "^6.4.0","@react-native-firebase/messaging": "^6.4.0","geolib": "^3.2.1","moment": "^2.24.0","native-base": "^2.13.8","react": "16.8.6","react-native": "0.60.6","react-native-base64": "0.0.2","react-native-fast-image": "^8.1.1","react-native-fetch-blob": "^0.10.8","react-native-gesture-handler": "^1.5.6","react-native-htmlview": "^0.15.0","react-native-image-crop-picker": "^0.25.3","react-native-image-view": "^2.1.9","react-native-options-menu": "^2.0.2","react-native-paper": "^3.10.1","react-native-progress": "^4.0.3","react-native-push-notification": "^3.1.9","react-native-reanimated": "^1.7.0","react-native-restart": "0.0.12","react-native-safe-area-context": "^0.7.2","react-native-screens": "^2.0.0-beta.2","react-native-splash-screen": "^3.2.0","react-native-swipe-list-view": "^2.5.0","react-native-swiper": "^1.5.14","react-native-vector-icons": "^6.6.0","react-navigation": "^4.1.1","react-navigation-stack": "^2.1.1","react-navigation-tabs": "^2.7.0"  },

podfile:


enter image description here


any solution for my issue?

[RN][IOS]Is it possible to use react native RCTLinking in conjonction with RNFirebase dynamic links?

$
0
0

I am currently handling ios universal links through the RCTLinking API. For some reasons, I need to work with Firebase dynamic links and I am wondering if it is possible to use both in my app.My issue is that the implementation in :

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation

and

- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler

that seems incompatible as I would need to return both RCTLinkingManager and RNFirebaseLinks

Any solution?

React-native react-native-swipe-up-down-fix plugin does not work properly with tab bar

$
0
0

I want to implement swipe gesture in the app for that I tired react-native swipe-up-down plugin it worked perfectly without footer tab-bar in the app, but when I add tab-bar in the footer then it works fine and swipe-mini is visible when the app/page reload, but once user do swipe-up and then tries to perform swipe down then show-mini is not visible actually it hides below the footer tab bar.

undefined is not an object (evaluating '_reactNative.Stylesheet.create')

$
0
0

I am getting is pesky error 'undefined is not an object (evaluating '_reactNative.Stylesheet.create')' as can be seen in the screenshot as well.

Following is the code I am using;

import React, {Component} from 'react';import {Text, Stylesheet} from 'react-native';import {Content, Container, Body, Title} from 'native-base';import GoogleStaticMap from 'react-native-google-static-map';export default class Contact extends Component {  render() {    return (<GoogleStaticMap      style={styles.map}      latitude={'32.064171'}      longitude={'34.7748068'}      zoom={13}      size={{      width: 300,      height: 550    }}    />);  }}const styles = Stylesheet.create({  map: {    width: 300,    height: 550  }});module.export = Contact;

IOS ( React native) app. Rotate screen when app starting

$
0
0

"react-native": "~0.61.5"

Problem: The first app launch always opens the app in portrait orientation.

Should be: As current iPad orientation (iPad landscape - app landscape, iPad portrait - app portrait).

The video which shows first incorrect rotation when open app first time : YouTube link

In Xcode settings I select all available orientationXcode settings

Viewing all 17481 articles
Browse latest View live


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