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

React Native - iOS - error: 'Google/SignIn.h' file not found

$
0
0

i dont have enough experience on iOS and i'm facing this problem. Actually this is a react native Project I tried to do this on my bridging Header.

#import <Google/SignIn.h>

When i try to build the app. It will produce an error like this :

error: 'Google/SignIn.h' file not found

The header file not found. The SignIn.h is available on Pods folder. enter image description here Maybe i just dont know how to actually import that file. Do you guys have a solution for this?


How to translate context menu in react native?

$
0
0

I am working on a project that requires to be translated on multiple languages. I am using Zanata to translate everything and it works except context menu. I can not find anything in official documentation how to translate it. Regardless of language that I set on the phone it will always show english language in context menu(copy, select all, paste..)

Example of untranslated context menu

I thought that it will be done automatically by operating system but it is not. Does anyone has the same problem and is there any solution for this?

Thank you.

React Native - .app file on Xcode Simulator asking for Bundle URL

$
0
0

I want to generate .app or .ipa file for my react native application , so that i can use it for the Automation testing on simulator using Appium. This is the command am using for building the app file for simulator (using Fastlane)

lane :buildForAutomation  do |options|

xcodebuild(scheme: "CavionNovus",
           xcargs: "-configuration 'Debug' -sdk 'iphonesimulator' -destination 'generic/platform=iOS Simulator'"
           )

end

This will generate a .app file . i have installed the same on the simulator using the below command

xcrun simctl install booted ./CavionNovus.app

It will install the app successfully , while launching it will wait for few seconds and show error message on the screen.

enter image description here

Its asking for metro bundle packager . So my Doubts are

Do we need a packager like metro bundler to run the .app file in simulator ? If so how can i add it during the build process ?

React-Native-Navigation library missing iOS & android module

$
0
0

Version

 React Native version :  0.61.5
 React-native-cli: 2.0.1

Create new project with below command

npx react-native init AwesomeProject

Run project with below command and run successfully

npx react-native run-ios

When I am trying to add

npm install --save react-native-navigation

I have followed above command for adding react-native-navigation library in my project but when I opened node module folder inside my project but not able to find iOS or android project inside it

Can you please guide me ,

Please check attached image here.enter image description here

React Native app purely in Swift

$
0
0

I created my first react native app using the following command.

react-native init PropertyFinder

This created a project for ios in Objective-C. The problem is I don't know Objective-C but I work on Swift.

This gist shows how to link react-components to a swift project. But is there a way to directly create the project in Swift language?

react-native netinfo behaving strange in ios

$
0
0

System Environment:

OS: Windows 10 OS 64 bit CPU: Intel core i7-9700k @ 3.60GHz Memory: 550.87 MB / 16.00 GB

Platforms:

Issue related to both Android and IOS

Versions :

Android: 9 iOS: 13.1.3 react-native-netinfo: 5.0.0 react-native: 0.59.8 expo: 36.0.0

Description :

In my expo project i need details like ssid , ipAddress of WiFi to which current phone is connected. i followed below procedure as follows :

first step i did npm install --save @react-native-community/netinfo

second step i imported NetInfo from “@react-native-community/netinfo”;

third step i wrote below code

NetInfo.fetch().then(state => {
                console.log(“Connection type”, state.type);
                console.log(“Isconnected?”, state.isConnected);
                console.log("Details ", state.detail);
                });

following is the output i can see on my terminal

Output in-case of Android

Connection type wifi

Is connected? true
Detail? Object {
    “ipAddress”: “192.168.0.171”,
    “isConnectionExpensive”: false,
    “ssid”: "DM",
    “subnet”: “255.255.255.0”,
}

Output in-case of iOS.

Is connected? true
Detail? Object {
    “ipAddress”: “192.168.0.171”,
    “isConnectionExpensive”: false,
    “ssid”: null,
    “subnet”: “255.255.255.0”,
}

So if you see in output Details i get all the detalis like ssid, subnet for Android but incase of iOS ssid is always null even after giving location permission. As i am newbie to react native i don’t understand where did i do mistake because of which i am not getting wiFi ssid and ipaddress. Please give me a solution for the above mentioned problem. I dont want to eject from Expo.

React-Native: Problems with Axios on iOS

$
0
0

I'm using ReactNative keep getting a network error on every Axios Request on iOS.

Error: Network Error
    at createError (createError.js:16)
    at XMLHttpRequest.handleError (xhr.js:81)
    at XMLHttpRequest.dispatchEvent (event-target-shim.js:818)
    at XMLHttpRequest.setReadyState (XMLHttpRequest.js:574)
    at XMLHttpRequest.__didCompleteResponse (XMLHttpRequest.js:388)
    at XMLHttpRequest.js:501
    at RCTDeviceEventEmitter.emit (EventEmitter.js:189)
    at MessageQueue.__callFunction (MessageQueue.js:436)
    at MessageQueue.js:111
    at MessageQueue.__guard (MessageQueue.js:384)

Apparently, iOS doesn't allow APIs that don't use HTTPS to run, but as per my research, updating Info.plist should have done the trick. Here's how I have updated it:

enter image description here

The android version of this application works perfectly fine. Any suggestions?

basic react native app not showing any text only white screen with app name on simulator

$
0
0

i am trying to run simple react native app. just text 'Hello World!', it's supposed to be my first app in react native. below is my simple app.js file

    /**
 * Sample React Native App
 * https://github.com/facebook/react-native
 *
 * @format
 * @flow
 */

import React from 'react';
import {
  SafeAreaView,
  StyleSheet,
  ScrollView,
  View,
  Text,
  StatusBar,
} from 'react-native';

import {
  Header,
  LearnMoreLinks,
  Colors,
  DebugInstructions,
  ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';

const App: () => React$Node = () => {
  return (
    <>
      <StatusBar barStyle="dark-content" />
      <SafeAreaView>
        <ScrollView
          contentInsetAdjustmentBehavior="automatic"
          style={styles.scrollView}>
          <Header />
          {global.HermesInternal == null ? null : (
            <View style={styles.engine}>
              <Text style={styles.footer}>Engine: Hermes</Text>
            </View>
          )}
          <View style={styles.body}>
            <View style={styles.sectionContainer}>
              <Text style={styles.sectionTitle}>Step One</Text>
              <Text style={styles.sectionDescription}>
                Edit <Text style={styles.highlight}>App.js</Text> to change this
                screen and then come back to see your edits.
              </Text>
            </View>
            <View style={styles.sectionContainer}>
              <Text style={styles.sectionTitle}>See Your Changes</Text>
              <Text style={styles.sectionDescription}>
                <ReloadInstructions />
              </Text>
            </View>
            <View style={styles.sectionContainer}>
              <Text style={styles.sectionTitle}>Debug</Text>
              <Text style={styles.sectionDescription}>
                <DebugInstructions />
              </Text>
            </View>
            <View style={styles.sectionContainer}>
              <Text style={styles.sectionTitle}>Learn More</Text>
              <Text style={styles.sectionDescription}>
                Read the docs to discover what to do next:
              </Text>
            </View>
            <LearnMoreLinks />
          </View>
        </ScrollView>
      </SafeAreaView>
    </>
  );
};

const styles = StyleSheet.create({
  scrollView: {
    backgroundColor: Colors.lighter,
  },
  engine: {
    position: 'absolute',
    right: 0,
  },
  body: {
    backgroundColor: Colors.white,
  },
  sectionContainer: {
    marginTop: 32,
    paddingHorizontal: 24,
  },
  sectionTitle: {
    fontSize: 24,
    fontWeight: '600',
    color: Colors.black,
  },
  sectionDescription: {
    marginTop: 8,
    fontSize: 18,
    fontWeight: '400',
    color: Colors.dark,
  },
  highlight: {
    fontWeight: '700',
  },
  footer: {
    color: Colors.dark,
    fontSize: 12,
    fontWeight: '600',
    padding: 4,
    paddingRight: 12,
    textAlign: 'right',
  },
});

export default App;

i started with react-native cli, https://facebook.github.io/react-native/docs/getting-started (React-Native CLI Quickstart) trying to run app on simulator with npx react-native run-ios but i can see only blank screen with app name on it..

enter image description here

..this happened with other basic apps i had created... what wrong or i am missing...


Deploying a react native project using fastlane

$
0
0

I don't usually deploy projects myself, but here I am in this situation where I need to deploy a project built in react native using fastlane.

I am having issue with the line below, any idea what's the --username $DELIVER_USERNAME" should be? is it my appleID or I need to create a fastlane account?

fastlane deliver --verbose --ipa "app.ipa" --skip_screenshots --skip_metadata --username $DELIVER_USERNAME"

How can I regenerate ios folder in React Native project?

$
0
0

So a while ago I deleted the /ios directory in my react native app (let's call it X). I've been developing and testing using the android emulator but now I'd like to make sure it works on ios with xcode simulator etc.

So my current idea is to create a new react native bare project (let's call it Y) with ios folder, then follow these steps to rename Y so that it has the name of X and then moving the /ios directory from Y into X and trying to run-ios.

I'll update here how that goes, but I wondered if there is a better way and has nobody been in this situation before?

I've googled lots of things 'regenerate ios folder''deleted ios folder''add ios folder to existing..' and nothing helpful. Maybe my googlefu isn't good enough but if anyone has any suggestions, much appreciated.

Step 2 will be making sure it compiles because of dependencies and stuff but for now my goal is to just get the /ios folder back in the project and for React Native to be aware of it's existence (it has all the necessary config).

Thanks

iOS push notification to remove delivered notification

$
0
0

I'm working on a app project that uses react-native and FCM Push Notification (rnfirebase 5.6.x). I send a notification when the user receives some message and I need to remove that delivered notification if the user reads that message on another source (like our web app).

With the app open or in background, I can send another push with some userInfo to let me know what I need to remove.

Everything is working perfect... Except when the user kill the app. Then I have no control on the received notification...

I tried the use the tag prop on the notification data, but according with firebase, it is for Android only.

Any ideas on how to do that?

React Native: The Magic: RCTRootView

$
0
0

I followed the example in https://facebook.github.io/react-native/docs/integration-with-existing-apps. Everything is fine until section The Magic: RCTRootView.
1. I created a "High Score" button from Xcode.
2. I linked the button to an action with the name (IBAction)highScoreButtonPressed:(id)sender
3. Ran "npm start"
4. Ran npx react-native run-ios --simulator="iPhone 8 Plus"
5. Clicked the "High Score" button"
6. Got an error 'PlatformConstants' could not be found in the Simulator.

What is my problem here and how to solve it?

enter image description here

React Native iOS starts the development server but never connects and then just crashes

$
0
0

So I run my react-native iOS app from Xcode or react-native run-ios like normal. The the server starts and says "Loading dependency graph, done." as normal. The app boots up on the simulator and then stays on the splash screen for around 20 seconds then crashes. It never seems to be able to find the development server and it doesn't print any error in the console.

I haven't been able to solve this issue for the life of me today. I've tried every solution I can find. If someone has any insight, please let me know. Thanks!

Lexical or Preprocessor Issue Group with Xcode 11.2.1, React-native 0.61.5

$
0
0

After upgrading to Xcode 11.2.1 and React-native 0.61.5 and React 16.9.0 not able to build project and it's give me error like 'YGValue.h' file not found.

enter image description here

Linking to TestFlight from an app using react-natvie [closed]

$
0
0

I want to notify users to update the app and when they click an update button, it opens TestFlight. How can I link to TestFlight? https://beta.itunes.apple.com/v1/app/xxx does not work.


my react native project does not contained any app.xcworkspace file in iOS

$
0
0

I want to run my react native app. when I run it by Xcode it shows something linker error and solution of that finds running by xcworkspace file.

something happens when I run this by react-native run-ios command

And in my project this file is not there in iOS folder.

react-native version: 0.60.4

React Native iOS app different code on simulator vs ad hoc/App Store

$
0
0

I have been working on a React Native app for several weeks. I recently pushed a version to TestFlight. When I started getting feedback from users I noticed that their screenshots were different than the latest changes I made. They were from older revisions.

I ran the app in the iOS Simulator. I get the correct version of the code.

I ran the app on a device connected to my Mac. I get the correct version of the code.

I ran the app distributed ad hoc and I get an older version of the app.

I haven't seen anything like this before and baffled as to what could cause the problem.

React native - When i lock the screen while API call loading, App process stopped

$
0
0

I am trying to show a large list in react native - Expo. When i lock the screen while data loading via API. App State changed from "Active" to "Inactive". When i return to active state, no data has been loaded. The App processes are stopped. ListEmptyComponent renders the ActivityIndicator. It is loading indefinitely. It occurs only in android build.

I tried to recall the API by AppState.

  const handleAppStateChange = nextAppState => {
    console.log(nextAppState);   
    if (nextAppState === 'active') {
      console.log(JSON.stringify(Store.apiCall));
      // "Store.apiCall" has data about last API Call and its status.
      if (Store.apiCall.status === codes.PENDING || Store.apiCall.status === codes.ERROR) {
        api(Store.apiCall.payload);
      }
    }
    setAppState(nextAppState);
  };

Still it doesn't works..

Xcode 11.0 build get error - Unknown argument type '__attribute__' in method -[RCTAppState getCurrentAppState:error:]

$
0
0

On every build in Xcode i get this error. How can i fix it?

I found this commit https://github.com/facebook/react-native/pull/25146/commits/61b8b9e69d8609fecaaaa7d2c9e32808bc5e98cb which should fix it but nothing happened.

static BOOL RCTParseUnused(const char **input)
{
 return RCTReadString(input, "__unused") ||
     RCTReadString(input, "__attribute__((__unused__))") ||
     RCTReadString(input, "__attribute__((unused))");
}

I have still this error

enter image description here

Can you help me fix it please?


I looked in node_modules and i already have this line

static BOOL RCTParseUnused(const char **input)
{
  return RCTReadString(input, "__unused") ||
         RCTReadString(input, "__attribute__((__unused__))") ||
         RCTReadString(input, "__attribute__((unused))");
}

Do you have another advice please?

How to have two views in a row that take 50/50 and have different background colors?

$
0
0

I am trying to create a small indicator(view) that changes background colour according to its severity. Imagine a square that takes 50/50, where one has red colour and the other a white colour.

I have done this currently.

This is what i have done ^|. Now imagine that the green colour is white, and i just need to show the red colour which is basically changing the background colour according to a prop (severity level).

What i don't want

What happens is that if i set the the other colour to white it doesn't work on android but iOS works just fine/ Also this only happens when the parent container's opacity is set to anything less than 1. As you see in the image above it gets blueish..

Viewing all 16564 articles
Browse latest View live


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