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

React-Native App with a Apple Watch App

$
0
0

I have a react-native based question, we are building a react-native application that will use authentication to call a secured API for data.

This is all built in react-native, however I am wanting to build a Apple Watch app (I know react-native doesn't and won't likely soon support this) So I am planning to go native swift for the Watch App.

My question is, does anyone know if you can use the react-native based authentication and api mapping to supply a json object to the Watch App? I want to simply display a json schedule on the watch from the phone.


onShouldStartLoadWithRequest automatically calling in iOS React Native on loading of any url in WebView, How to control it?

$
0
0

I'm implementing in App WebView for my App. I've to open some info pages and I've to get some data based on the click of any particular place(which contains a different type of data) in webview. But in iOS, while loading any URL onShouldStartLoadWithRequest calling automatically which leads opening different URLs in the HTML content. But it is working as expected in Android.

<WebView
  originWhitelist={["*"]}
  style={style}
  source={source}
  showsVerticalScrollIndicator={showsVerticalScrollIndicator}
  startInLoadingState={startInLoadingState}
  javaScriptEnabled={true}
  onShouldStartLoadWithRequest={request => {
    return onLoadWebViewOnClick(request)
  }}
/>

in this handleUrlNavigation will handle the request of any click action, but it is automatically calling every time. How can I handle this?

React native firebase 6 Failed to install CocoaPods dependencies

$
0
0

im trying to use react native firebase version 6 with react native version 0.61 and i get Failed to install CocoaPods dependencie error when i try to create a new project using this tutorial , and when i use pod instll --repo-update or pod install it doesn't install some files like RNFirebase and Firebase core and etc , this is the error i get when i make a new project :

    apple@Apples-MacBook-Pro ~ % npx @react-native-community/cli init --template=@react-native-firebase/template Fbsix

               ######                ######               
             ###     ####        ####     ###             
            ##          ###    ###          ##            
            ##             ####             ##            
            ##             ####             ##            
            ##           ##    ##           ##            
            ##         ###      ###         ##            
             ##  ########################  ##             
          ######    ###            ###    ######          
      ###     ##    ##              ##    ##     ###      
   ###         ## ###      ####      ### ##         ###   
  ##           ####      ########      ####           ##  
 ##             ###     ##########     ###             ## 
  ##           ####      ########      ####           ##  
   ###         ## ###      ####      ### ##         ###   
      ###     ##    ##              ##    ##     ###      
          ######    ###            ###    ######          
             ##  ########################  ##             
            ##         ###      ###         ##            
            ##           ##    ##           ##            
            ##             ####             ##            
            ##             ####             ##            
            ##          ###    ###          ##            
             ###     ####        ####     ###             
               ######                ######               


                  Welcome to React Native!                
                 Learn once, write anywhere               

✔ Downloading template
✔ Copying template
✔ Processing template
⠙ Installing CocoaPods dependencies (this may take a few minutes)internal/modules/cjs/loader.js:796
    throw err;
    ^

Error: Cannot find module '/Users/apple/Fbsix/ios/undefined'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
    at Function.Module._load (internal/modules/cjs/loader.js:686:27)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
    at internal/main/run_main_module.js:17:11 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

✖ Installing CocoaPods dependencies (this may take a few minutes)
error Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.
Please try again manually: "cd ./Fbsix/ios && pod install".
CocoaPods documentation: https://cocoapods.org/

all helps are appreciated, thank you

A project referencing LottieReactNative fails to compile

$
0
0

I have created a framework project that is a wrapper for React Native app. The set up involves manual linking and it was working fine until we updated lottie-react-native as well as lottie-ios to the latest as well as some of the framework code started importing and using LottieReactnative module.

Now we get the following compilation error

ViewController.swift:10:8: Missing required module 'LottieReactNative'

Additional info on my project

  1. I am using RN 0.60.4
  2. I am using Legacy Build System
  3. LottieReactNative is not referenced anywhere outside the wrapper framework.
  4. Looking at DerivedData, it looks like LottieReactNative is exposed as a module but not included into Lottie.framework or my custom framework

Any insight would be greatly appreciated

iOS: font sizes in a React Native view do not match iOS native font sizes

$
0
0

I have two views: a React Native view and an iOS native view. They both contain labels. Labels has font size 14. But on iPhone 6 font sizes are different: the iOS native view has bigger letters than a React Native view. I need to make the fonts the same. Could you help me, please?

react-native-video - multiple videos causing app crash

$
0
0

I have a feed which displays multiple videos in a <FlatList/>. Each video is hosted offsite on a uri. Each video in the feed is muted and paused and I am triggering the ones in viewport to play (usually no more than 3 at a time).

On iOS I started seeing the app crash with the error Message from debugger: Terminated due to memory issue in Xcode. I see memory spike slightly (it goes from ~120MB to ~150MB, holds for a few seconds then the app crashes). Because of this I tried keeping the videos all paused but the same thing happens. When I switch out the <Video/> for a <FastImage/> preview the crash stops.

Example of a video component:

<Video
  source={{ uri: props.uri }} 
  repeat={true}
  muted={true}
  volume={0.0}
  paused={props.paused}
  posterResizeMode="cover"
  resizeMode="cover"
  poster={props.thumbnail}
  style={props.style}
  ref={ref => {
    this.player = ref;
  }}
/>

Has anyone else experienced this error message/crash with react-native-video? Is there a way to get more info out of Xcode as to why this is happening?

Android seems to handle things for a little longer but also results in an eventual crash.

Some info:

  • RN 0.59.10
  • React 16.8.6
  • react-native-video 5.1.0-alpha1 (this is so I can fix the pause video bug in earlier versions)

use_framework vs use_native_modules

$
0
0

I do not use use_frameworks and use_native_modules in my podfile. It runs as usual when I enable use_native_modules, but build fail when I use use_frameworks.

I've read to understand what use_frameworks for but I'm not aware of the differences between this two.

platform :ios, '8.0'
use_frameworks!

target "CityWhether" do
    pod 'Alamofire'
    pod 'SwiftyJSON'
use_native_modules!
end

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


Building iOS app using Xcode works, but building the same app with xcodebuild command fails

$
0
0

Both new flutter and new react-native projects fail to build because the xcodebuild tool fails. They, however, succeed when I build the projects manually inside Xcode.

Apparently, the reason is because xcodebuild adds additional flag during the build, that, is:

export OTHER_CPLUSPLUSFLAGS=" -fmodule-map-file="/Users/aa/code/WW2/ios/Pods/Headers/Public/SSZipArchive/SSZipArchive.modulemap""

The result is that the build is failing because it cannot find the said module map, with the following error:

<unknown>:0: error: module map file '/Users/aa/code/WW2/ios/Pods/Headers/Public/SSZipArchive/SSZipArchive.modulemap' not found

The said module map is from a previous project (called WW2) which I moved. But the problem is that even newly-created projects are affected.

I wasted two days to solve this, even reading through the documentation about xcode build settings, but to no avail. What I'm trying to do is to find the source of this additional flag or configuration. I even used grep to find a file containing the particular flag, but it's not yet finished scanning my system.

react native crash RCTFatalException

$
0
0

So through crashlytics i'm getting reports of the following crash

Fatal Exception: RCTFatalException: Unhandled JS Exception: TypeError: undefined is not an object (evaluating 'y.default[l].logo') This error is located at: in P in Unknown in RCTView in RCTView in h

the thing is, this only seems to be happening specifically on the Iphone 7

I have dug through my code and I cannot find anything referring to y.default[l].logo i only have 2 instances of .logo and that is an attribute to an object in a static file.

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

using React-native init, a new iOS app can't build in Xcode, build error 'ld: library not found for -lDoubleConversion

$
0
0

steps to reproduce:

react-native init FirstProjectcd FirstProjectopen ios/FirstProject.xcodeproj

... Xcode opens the project:

enter image description here

I select build target iOS Simulator -> Iphone XR

A terminal window opens in the background:

enter image description here

However, Xcode returns a build error:

ld: library not found for -lDoubleConversion
clang: error: linker command failed with exit code 1 (use -v to see invocation)

shown with warnings here https://gist.github.com/jasonfb/7b51a260df419590c6fadda93fb49348

enter image description here

react-native init is able to build and run, but app crashes with No Bundle URL present

$
0
0

after running react-native init, my app is able to build and run however it crashes upon launch with

Make sure you're running a package server or have included a .jsbundle file in your application bundle.

enter image description here

Updated app not working, user has to remove and reinstall

$
0
0

In my latest app release there was a change in the base URL of the backend. When user upgrade the app in app store, it seems like the base URL was not updated. But the app started to working when user remove the app and reinstall. Have you run into this kind of issue before? What could be the cause?

Fastlane match not found in available list of options

$
0
0

I'm working in a forked React Native app and it has fastlane already setup with Matchfile, Fastfile& Appfile but upon editing the Matchfile to match my repo and username, and ran fastlane match appstore, it doesn't work and gives me Matchfile data found and an error:

+--------------+--------------------------------------------+
|        Detected Values from './fastlane/Matchfile'        |
+--------------+--------------------------------------------+
| git_url      | https://gitlab.com/project/certificates |
| storage_mode | git                                        |
| type         | development                                |
| username     | myGitlabUserName                                 |
| readonly     | true                                       |
+--------------+--------------------------------------------+

[!] Could not find option 'match' in the list of available options: 'OPTIONS HERE'

Ironically, this command runs just fine: fastlane match --help.

I would go and file for an issue on Github but wanted to try my luck here first.


Video is uploaded as an image from iOS device, how to upload properly

$
0
0

I have an app that gets the images/videos from the mobile gallery, then uploads one of them to a server, here are the steps i take, which works fine on Android:

1-get data from mobile storage:

MediaLibrary.getAssetsAsync({
  first: 20,
  mediaType: [MediaLibrary.MediaType.video, MediaLibrary.MediaType.photo]
})

2-upload to server:

formData.append('images[]', {
    uri: localUri,  
    name: isVideo ? 'untitled.mp4'  : 'untitled',//for testing
    type: isVideo ? 'video/mp4' : 'image/jpeg'
})

axios.post(`url`, formData, {headers: headers,timeout:999999})

The problem is videos are uploaded as an image (only the first frame of the video), while it gets uploaded successfully on Android, the problem is only present on iOS.

The uri of the retrieved files is as follows: assets-library://asset/asset.MP4?id=xxx&ext=MP4

Quick notes:

1 - the video is played fine locally using the <Video> component from Expo

2 - i tried using the CameraRoll API, but it gives the same results, and is a little buggy

any help would be appreciated

How to use react-native-permissions

$
0
0

What i want to do I want to issue an alert with react native and instruct the other party to allow location information Bluetooth,

Problem I decided to use the article below. However, looking at the examples, I can't figure out how to use them.

https://github.com/react-native-community/react-native-permissions

Q

How can I use raect-native-permission to alert me of what I want to use?

How do you use the status and settings below?

import {requestNotifications} from 'react-native-permissions';

requestNotifications(['alert', 'sound']).then(({status, settings}) => {
  // …
}

On IOS audio is not playing second time without user interaction

$
0
0

I am using react-player package to play audio.

The situation is, there is a button, clicking on that button going to play an audio then there is a 5 seconds delay(setTimeout). After 5 seconds I am changing the src of the audio.

So the expected behavior is It will play sound one. Then 5 seconds later it will play second sound.

But on ISO(Both Chrome & Safari) the first sound starts playing when clicking the button then after 5 seconds delay, I need to manually interact with the UI(click on the play/pause button) to play the second sound. It doesn't start playing automatically.

How I can overcome this situation?

NB: It's working on Desktop(Chrome, Safari), Android. The only issue with IOS.

react-native-table-component freeze first column & first row in scrollable table

$
0
0

Desired State

I'm using react-native-table-component, a basic component to render tables in React Native. I need to freeze the first column and first row in the table so they remain in view when scrolling. Specifically, I need the first column to remain fixed when scrolling horizontally and scroll with the rest of the data in the row when scrolling vertically.

I need the first row to function the same way. Remain fixed when scrolling vertically and when scrolling horizontally, I should scroll with the corresponding column.

Issue

I can get to my desired state for the first row but I can't do the same for the first column in the same table.

Code

render(){
    return(

    <View style={styles.tableContainer}>
    <ScrollView horizontal={true}>
     <View>
       <Table style={styles.tableHead}>

         <Row
          style={styles.header}
          textStyle={styles.text}
          data={this.props.tableHead}
          widthArr={this.props.columnWidth}
        />

       </Table>
       <ScrollView style={styles.dataWrapper}>

        <TableWrapper style={styles.tableBody}>
          <Col 
            style={styles.title} 
            textStyle={styles.text}
            data={this.props.tableTitle} 
            heightArr={[28,28]}  
        />
          <Rows 
            style={styles.row} 
            textStyle={styles.text}
            data={this.dataFormat()} 
            widthArr={this.props.columnWidth} 

            />
        </TableWrapper>
       </ScrollView>
     </View>
   </ScrollView>
  </View>
    )
}

Additional Information I don't need to use react-native-table-component but I'd like to if possible since I've already done a lot of work to style it and format the data I've inserted.

Thanks in advance for your help!

Third-party cookies being blocked inside iFrame in iOS WKWebview

$
0
0

I have a website that is developed in React, in which we have implemented logging in to a third party via an iFrame. This works as expected in all browsers we have to support, except for WKWebview on iOS, which refuses to set cookies on another domain in the iFrame. We have a React Native app that shows the webpage in this webview, so we kinda have to support it.. From a lot of googling around I've found various workarounds that no longer work, and ended up at Webkits bug page: https://bugs.webkit.org/show_bug.cgi?id=204109 and this from SalesForce: https://help.salesforce.com/articleView?id=000351155&language=en_US&type=1&mode=1 It is unclear though whether or not this is actually fixed or if it has been reintroduced (seems like it has, as it's not working on iOS 13.3 devices). Has anyone had similar experiences, and even better, a potential workaround?

Thanks in advance

Viewing all 16571 articles
Browse latest View live


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