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

iOS xCode - Access network configuration proxy

$
0
0

I'm looking for a way to read the system's network configuration. I want to be able to read their wifi's proxy settings, and check if they are using one or not.

I do not know how to do this, and I can't either find documentation on it.


How to fetch localhost in react native?

$
0
0

I have created a race native project and would like to fetch a php from my localhost (I'm using mamp).

I have tried the following but it doesn't seem to work.

fetch('http://(my_ip):8888/user_registration.php',

I have been trying to run my project using Xcode as my simulator but keep getting the following message.

TypeError: Netword request failed

Below is my full code.

UserRegistrationFunction = () => {
        const { UserName } = this.state;
        const { UserEmail } = this.state;
        const { UserPassword } = this.state; 
        fetch('http://{my-ip}:8888/user_registration.php', {
            method: 'POST',
            headers: {'Accept': 'application/json','Content-Type': 'application/json',
            },
            body: JSON.stringify({

                name: UserName,

                email: UserEmail,

                password: UserPassword
            })

    }).then((response) => response.json())
        .then((responseJson) => {

            Alert.alert(responseJson);   
        }).catch((error) => {
            console.error(error);
        });
}

react-native ios Podfile issue with "use_native_modules!"

$
0
0

In my react-native project (react-native@0.60) in the ios/ dir I run pod install and get this error:

[!] Invalid `Podfile` file: no implicit conversion of nil into String.

 #  from /Users/coryrobinson/projects/hhs2/ios/Podfile:37
 #  -------------------------------------------
 #  
 >    use_native_modules!
 #  end
 #  -------------------------------------------

I haven't added or changed anything in this Podfile - it's all react-native generated. (I'm not experienced in iOS dev so this might be a simple fix, I just don't know what to look for :-|) Thanks for any help!

Here is my Podfile

platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'hhs2' do
  # Pods for hhs2
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/React'
  pod 'React-DevSupport', :path => '../node_modules/react-native/React'
  pod 'React-fishhook', :path => '../node_modules/react-native/Libraries/fishhook'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'
  pod 'RNFS', :path => '../node_modules/react-native-fs'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

  target 'hhs2Tests' do
    inherit! :search_paths
    # Pods for testing
  end

  use_native_modules!
end

target 'hhs2-tvOS' do
  # Pods for hhs2-tvOS

  target 'hhs2-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

Expo app rejected for Invalid Binary for WebView and user-fonts

$
0
0

I tried uploading an app I created with Expo onto the Apple App Store and 30 minutes later I get an email saying my project has Invalid Binary they provided two reasons behind why it was rejected. Problem 1. because Deprecated API Usage - Apple will stop accepting submissions of apps that use UIWebView APIs

However from what I've seen on other forums this doesn't usually result in a rejection for Expo projects with SDK ranging from SDK 28 to 35 (my project is running on 33).

Problem 2 because Invalid entitlement - The com.apple.developer.user-fonts is valid only for apps build with SDK 13 or later.

The solution I've found on other forums say that I should go into the developer console and uncheck the 'fonts' section in the Apple Developer section. Upon doing this the problem still persists

I'm not sure what I can do now, I need help

My project is running on SDK 33

React Native Web crashes with aws-amplify

$
0
0

I'm using aws-amplify in my app for iOS, Android and Web, but when I import aws-amplify

import 'aws-amplify';

Android and iOS work fine but the web app crashes with the error message:

Failed to compile
Can't reexport the named export 'BREAK' from non EcmaScript module (only default export is available)

Does anyone know the solution to this problem?

Can you use ReactNative module class from Native side?

$
0
0

You create native modules for react native to access native functionality.

Once you create native modules, can you use them from native code (java/swift) ?

React Native: iOS Deprecated API Usage Warning UIWebView API [duplicate]

$
0
0

For React Native Folks:-

Just submitted my app to TestFlight and got an email with the error:

ITMS-90809: Deprecated API Usage - Apple will stop accepting submissions of apps that use UIWebView APIs . See https://developer.apple.com/documentation/uikit/uiwebview for more information.

I was wondering if all the code related to UIWebView will have to be removed and only keep WKWebView.

React-native, use fullscreen image on android

$
0
0

I just have started developing a new app and immediately ran into a problem.

Here, ios on the right, the background successfully covers the entire screen, including the top bar and the bottom navigation. However, on android, this does not happen.

comparison

Here is my code:

import React from 'react';
import { ImageBackground, Text, View, SafeAreaView, StyleSheet } from 'react-native';
import Button from "./src/components/Button";

const Explore = ({}) => {
  return (
    <ImageBackground
      style={s.background}
      source={require('./src/assets/images/explore.png')}
    >
      <SafeAreaView style={s.safeArea}>
        <View style={s.wrapper}>
          <View style={s.header}>
            <Text style={s.title}>Explore</Text>
            <Text style={s.subTitle}>new amazing countries</Text>
          </View>

          <View style={s.spacer} />

          <View style={s.controls}>
            <Button
              style={s.button}
              label="Log in"
            />
          </View>
        </View>
      </SafeAreaView>
    </ImageBackground>
  );
};

const s = StyleSheet.create({
  background: {
    width: '100%',
    height: '100%',
  },
  safeArea: {
    flex: 1,
  },
  wrapper: {
    flex: 1,
    padding: 25,
  },
  header: {
    paddingTop: 20,
  },
  title: {
    fontSize: 24,
    fontFamily: 'RobotoSlab-Bold',
    color: '#323B45',
  },
  subTitle: {
    fontSize: 20,
    fontFamily: 'RobotoSlab-Light',
    color: '#323B45',
  },
  spacer: {
    flex: 1,
  },
  controls: {
    flexDirection: 'row'
  },
  button: {
    flex: 1
  },
  gap: {
    width: 25
  }
});

export default Explore;

Does anyone know how I can make the background on android cover the entire screen, jus like on ios?

UPDATE:

We have managed to cover the status bar with the following code:

<StatusBar translucent backgroundColor='transparent' />

React Native Share Extension won't build

$
0
0

I'm trying to add a Share Extension to a React Native app and when I try to build the app I get this linking error:

Undefined symbols for architecture x86_64:
  "_RCTRegisterModule", referenced from:
      _initialize_ShareManager in ShareManager-75b70a88150f3f544e5598c2fcbaaa49e4e22b3f47bce8d9a721bf31763b426d.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

This is the offending code (when I comment this out the rest of the app builds fine):

@interface RCT_EXTERN_MODULE(ShareManager, NSObject)

RCT_EXTERN_METHOD(getURL: (RCTResponseSenderBlock)callback)

@end

Has anyone got any insight into how I can fix this? I've done a lot of googling and tried a hundred different permutations of linking binaries, different linker flags etc. But so far I've got nowhere.

Thanks for any help!

Do i need a local database for my app or a big object

$
0
0

consider a project that user can create auctions and others can make bids, i wonder if i need a DB or a big object can do the job.

let me explain this. this is an online job, user need to be online to see auctions and make a bid. app must fetch data from APIs and show 'em to user. no data must be out of date. so user must see what is exactly available on server side.

now i wonder if i need to have a database in my app and load these data to this DB or just have a big Object (singleton pattern) which has all fields (like auctions - bids - or any other data) and just use this object to my jobs.

in my vision i can't think about any data which i need to store offline, so what gains may DB still give me?

btw in second approach, if all classes are modeled and put in that object, it will exactly look like DB scheme

Pick multiple images in react native Expo with Imagepicker

$
0
0

It seems like Expo only supports imagepicker for selecting one image rather than multiple images. Is there any way to pick multiple images without ejecting expo or starting new react-native-init?

react-Native: background image on iOS has cannot cover all the screen

$
0
0

The background image is not filling the whole screen on iOS devices, despite trying different options in styles. while on Android devices it looks fine and fills all the background space.

I got the same issue on iPhone6 device, also on the iPhone 11 emulator. There appears to be white edges on the left and the right which the background image does not cover, but this does not happen on android devices.

Here is a picture of both emulators of iOS and android side by side, iOS is on the right.

picture of emulators

I tried using the styles property resizeMode , with values such as 'cover', 'stretch', 'contain' etc , but none of them seemed to make a difference.. here is the code :

import React from 'react';
import { Text, View, Platform, ImageBackground } from 'react-native';
import { Button } from 'native-base'

var myBackground = require('./assets/icons/landing.jpg')

export default function App() {
  return (
    <View style={styles.container}>
      <ImageBackground
        source={myBackground}
        style={styles.imageStyle}
        >
        <View style={styles.viewStyle}>
          <Text
            style={styles.titleStyle}
          >Welcome to pokeSearch</Text>
          <Button
            block={true}
            style={styles.buttonStyle}
            onPress={() => { }}
          >
            <Text style={styles.buttonText}>Start Searching</Text>
          </Button>
        </View>
      </ImageBackground>


    </View>
  );
}

const styles = {
  container: {
    flex: 1,
    // marginTop: Platform.OS === "android" ? 20 : 0,
    justifyContent: 'center',
    alignItems: 'center'

  },
  buttonOuterLayout: {
    flex: 1,
    flexDirection: 'column',
    justifyContent: 'center',
    alignItems: 'center',


  },
  buttonLayout: {
    // marginTop: 10,
    // paddingRight: 10,
    // paddingLeft: 10

  },
  viewStyle: {
    flex: 1,
    flexDirection: 'column',
    justifyContent: 'center',
    alignItems: 'center'
  },
  titleStyle: {
    fontSize: 30,
    color: 'blue',
    alignItems: 'center'

  },
  imageStyle: {
    // flex: 1,
    width: null,
    height: null,
    resizeMode: 'contain'

    // justifyContent: 'flex-end',
    // alignItems: 'center'
  },

  buttonStyle: {
    margin: 10

  },
  buttonText: {
    color: 'white'
  }
}

I want the background image to cover the background on iOS like it does on android.

How to add "Set as Wallpaper" option in React Native app

$
0
0

How to enable option "set as wallpaper" ? I'm using expo and I'm not able to find any API to enable that functionality. I only able to download image. I want to trigger set as wallpaper option. I tried to use react-native-wallpaper-manager library but it has not worked for me.

AAB file is too larger than IPA file after production build in React Native

$
0
0

I have been working on React-Native for 3 months. All these days I was building the app only for android platform and the size of AAB file was 36.5 MB, Today I built my app to iOS (IPA File). The size of IPA file is just 5.6 MB.

No code changes, No new library installations,

But why both files have a huge difference in size?

Thank you!

React-Native Healthkit getSleepSamples SleepData

$
0
0

I have been trying to get sleep data from the health app using react native. I have been able to get the step count, but haven't been able to get the sleep data.

here is my code

AppleHealthKit.initHealthKit(options: Object, (err: string, results: Object) => {
  if (err) {
      console.log("error initializing Healthkit: ", err);
      return;
  }   
AppleHealthKit.getSleepSamples(options, (err: Object, results: Array<Object>) => {
  if (err) {
    console.log(err);
    return;
  }
  this.setState({sleep:results.value})
});

debugging exception :

{message: "error getting sleep samples"}

approve/disapprove new users in admin page React Native [closed]

$
0
0

i am a beginner in React Native, and i've been looking for a way to perform a dynamic table (the rows are incremented whenever there's a new record added to the database). To be accurate, it's a table in the admin page displaying the new users data and approve/disapprove them. i'll appreciate any new information. Thanks.

When I integrate notifications in IOS I have this error that appears ld: library not found for -lFirebaseCore

$
0
0

I have this ld: library not found for -lFirebaseCore error that appears when I want to build my project on Xcode

(when I built for Android, this works)

Here is the information that can help you find the solution faster:

$ react-native info
 info 
  React Native Environment Info:
    System:
      OS: macOS 10.14.4
      CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
      Memory: 972.16 MB / 8.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 10.15.0 - /usr/local/bin/node
      Yarn: 1.15.2 - /usr/local/bin/yarn
      npm: 6.9.0 - /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: 21, 22, 24, 25, 26, 27, 28
        Build Tools: 25.0.0, 26.0.0, 26.0.2, 26.0.3, 27.0.1, 27.0.3, 28.0.3
        System Images: android-18 | Google APIs Intel x86 Atom, android-19 | Google APIs Intel x86 Atom, android-22 | Google APIs Intel x86 Atom, android-24 | Google APIs Intel x86 Atom, android-25 | Google APIs ARM EABI v7a, android-25 | Google APIs Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-28 | Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom
    IDEs:
      Android Studio: 3.4 AI-183.5429.30.34.5452501
      Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.3 => 16.8.3 
      react-native: 0.59.5 => 0.59.5 
    npmGlobalPackages:
      react-native-cli: 2.0.1
      react-native-rename: 2.4.1

Pods

# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'

target 'AppXYZ' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for AppXYZ
  # Required by RNFirebase
  pod 'Firebase/Core', '~> 5.15.0'
  pod 'Firebase/Messaging', '~> 5.15.0'

  target 'AppXYZTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

here is a picture of the error:
enter image description here

here are the links binary with libraries and libraries:
the links binary with librarieslibraries

The implementation of notifications I made from the firebase documentation, here are the steps I followed:

Verifying/signing that a request to my API came from my app and was not spoofed (React Native)

$
0
0

Is it possible to verify that an API call to my server came from my app and was not spoofed with another HTTP request client or similar? I'm using React Native with Node on the back-end, and am using a JWT system for authentication.

Context: certain features are only unlocked for users that the app has detected are at a certain location. The only system I can think of for unlocking these is pretty weak - the front-end sends a request to the server with the user's location, and if the location fits then the features are unlocked. Obviously this request can be spoofed easily, unless I can sign them in a certain way that is unique to the app and is difficult to reverse-engineer.

Any other approaches would be appreciated (e.g. detect the user's location from the IP address that the request was sent from?)

Can't show Image in React Native

$
0
0

I'm using react-native 0.28.0

I'm trying to show an image on iPhone simulator according to this tutorial: http://www.appcoda.com/react-native-introduction/

var styles = StyleSheet.create({
image: {
    width: 107,
    height: 165,
    padding: 10
  }
}

var imageURI = 'http://books.google.com/books/content?id=PCDengEACAAJ&printsec=frontcover&img=1&zoom=1&source=gbs_api'

Then in the render() function, I add this:

<Image style={styles.image} source={{uri:imageURI}} />

The space allocated for the image is there, but the image is not shown.

Duplicate symbols between react-native and GVRKit

$
0
0

I'm trying to get 360 Videos working in my iOS react-native app (With VR support)

I attempted using the various react-native npm packages that offer this functionality, they work on Android but not on iOS. (And most haven't been updated for at least 2 years...)

I decided to attempt making my own package to see if I could resolve the problem myself. But it seems react-native iOS and GVRKit just aren't compatible.

I'm getting "7 duplicate symbols for architecture x86_64":

duplicate symbol 'fLB::FLAGS_nolog_prefix' in:

    /Users/beau/Documents/MMT/ModuleTester/ios/Pods/GVRSDK/Libraries/libGVRSDK.a(logging_ddb19c79df368f1c1db7fe052bc2a5d9.o)
    /Users/beau/Library/Developer/Xcode/DerivedData/ModuleTester-eaufazkgozuyyvfhpezutrvzceza/Build/Products/Debug-iphonesimulator/glog/libglog.a(logging.o)
duplicate symbol 'fLB::FLAGS_log_prefix' in:
    /Users/beau/Documents/MMT/ModuleTester/ios/Pods/GVRSDK/Libraries/libGVRSDK.a(logging_ddb19c79df368f1c1db7fe052bc2a5d9.o)
    /Users/beau/Library/Developer/Xcode/DerivedData/ModuleTester-eaufazkgozuyyvfhpezutrvzceza/Build/Products/Debug-iphonesimulator/glog/libglog.a(logging.o)
duplicate symbol 'fLB::FLAGS_nosymbolize_stacktrace' in:
    /Users/beau/Documents/MMT/ModuleTester/ios/Pods/GVRSDK/Libraries/libGVRSDK.a(examine_stack_fca476d0593b9f715e19264b75811e08.o)
    /Users/beau/Library/Developer/Xcode/DerivedData/ModuleTester-eaufazkgozuyyvfhpezutrvzceza/Build/Products/Debug-iphonesimulator/glog/libglog.a(utilities.o)
duplicate symbol 'fLB::FLAGS_symbolize_stacktrace' in:
    /Users/beau/Documents/MMT/ModuleTester/ios/Pods/GVRSDK/Libraries/libGVRSDK.a(examine_stack_fca476d0593b9f715e19264b75811e08.o)
    /Users/beau/Library/Developer/Xcode/DerivedData/ModuleTester-eaufazkgozuyyvfhpezutrvzceza/Build/Products/Debug-iphonesimulator/glog/libglog.a(utilities.o)
duplicate symbol 'fLI::FLAGS_nov' in:
    /Users/beau/Documents/MMT/ModuleTester/ios/Pods/GVRSDK/Libraries/libGVRSDK.a(vlog_is_on_0129e25e84d5880e84b763ce61020e1c.o)
    /Users/beau/Library/Developer/Xcode/DerivedData/ModuleTester-eaufazkgozuyyvfhpezutrvzceza/Build/Products/Debug-iphonesimulator/glog/libglog.a(vlog_is_on.o)
duplicate symbol 'fLI::FLAGS_v' in:
    /Users/beau/Documents/MMT/ModuleTester/ios/Pods/GVRSDK/Libraries/libGVRSDK.a(vlog_is_on_0129e25e84d5880e84b763ce61020e1c.o)
    /Users/beau/Library/Developer/Xcode/DerivedData/ModuleTester-eaufazkgozuyyvfhpezutrvzceza/Build/Products/Debug-iphonesimulator/glog/libglog.a(vlog_is_on.o)
duplicate symbol 'fLS::FLAGS_vmodule' in:
    /Users/beau/Documents/MMT/ModuleTester/ios/Pods/GVRSDK/Libraries/libGVRSDK.a(vlog_is_on_0129e25e84d5880e84b763ce61020e1c.o)
    /Users/beau/Library/Developer/Xcode/DerivedData/ModuleTester-eaufazkgozuyyvfhpezutrvzceza/Build/Products/Debug-iphonesimulator/glog/libglog.a(vlog_is_on.o)
ld: 7 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I can't get GVRKit and react-native to get along, is there anyway to resolve these errors myself?

Any suggestions are welcome! Thanks in advance! Beau

Viewing all 16567 articles
Browse latest View live


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