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

react-native-ble-manager with iOS 13 shows multiple bluetooth pair permission popup

$
0
0

enter image description hereVersion I am using:

  • react-native-ble-manager v 6.7.0
  • react-native v .60
  • iOS/Android iOS 13?

Bluetooth pairing alert appearing multiple time and block UI in iOS 13,

Working fine with the iOS 12

Tell us what happens instead

Steps to reproduce

  1. Integrate Library in react native project
  2. When try to initialise the bluetooth, the pairing alert appear.
  3. Click on pair option.
  4. Again alert appears and it continuously apearing after that.

Tested in iOS 13, but same flow is working fine for iOS 12


WebRTC duplicated Class RTCVideoFrameBuffer with iOS system library of iOS13

$
0
0

objc[339]: Class RTCCVPixelBuffer is implemented in both /System/Library/PrivateFrameworks/WebCore.framework/Frameworks/libwebrtc.dylib (0x1d1862f98) and /private/var/containers/Bundle/Application/A0EA73B4-57EF-409B-B151-7FF7A3EEEB0C/TestApp.app/Frameworks/WebRTC.framework/WebRTC (0x10176fdc0).

One of the two will be used. Which one is undefined.

Firebase Dynamic links (with Invertase Firebase) freezes upon launch on iOS

$
0
0

Problem: When adding "@react-native-firebase/dynamic-links": "^6.0.3", to our react-native app the app loads for about 10seconds before the splash screen. The app was launch through home screen and NOT a link.

Gathered knowledge: The firebase library looks up https://firebasedynamiclinks-ipv6.googleapis.com/v1 which is not resolved and gives an error result. Then in FIRDLDefaultRetrievalProcessV2.m#handleRequestResultsUpdatedresultsThatEncounteredErrors.count > 0 is triggered. The next thing that happens is that openURL is called on the url BUNDLENAME://google/link/?dismiss=1&is_weak_match=1 which seems to cause the UI freeze.

Could someone help find out why by adding the Pod it cause a UI freeze?

[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-orientation Orientation.addOrientationListener callback function does not execute on orientation change

$
0
0

I have a static image I want to resize on an orientation change. I am using react-native-orientation to set a listener for a change in orientation but the listener function never executes on an orientation change. I have added a touchable element to call a function to change the image to match the orientation of the phone and it works. I am running the code in a snack and am testing it with an iphone. Here is the code.

    import React from 'react';
    import Orientation from 'react-native-orientation';
    import { Dimensions, Image, Text, View, Button, TouchableOpacity, StyleSheet} from 'react-native';

    export default class DashboardHeader extends React.Component{
        constructor(props){
          super(props);
          this.state = {
                        showGraph:false,
                        width: Dimensions.get('window').width,
                        };
          this.resetImageWidth= this.resetImageWidth.bind(this); 
          this._orientationDidChange = this._orientationDidChange.bind(this);  
        }

        resetImageWidth(){
          this.setState({width:Dimensions.get('window').width});
        }

        _orientationDidChange(orientation){
          alert("here");
          this.setState({width:Dimensions.get('window').width});
        }

      componentDidMount() {
          Orientation.addOrientationListener(this._orientationDidChange);
        }

      componentWillUnmount() {
        Orientation.removeOrientationListener(this._orientationDidChange);
      }
        render() {
          return (
            <View >
              <TouchableOpacity style={graphHistoryStyles.historyToggleButton} onPress={this.resetImageWidth} >
                <Text style={graphHistoryStyles.historyToggleFont}>"Screen Width " {Dimensions.get('window').width} "State Width " {this.state.width} </Text>
              </TouchableOpacity>
              <View >
                <Image 
                  source={require('./headerBanner.jpg')} 
                  style={{width: this.state.width, height: this.state.width * 148/960}}
                />
              </View>
            </View>
          );
        }
    }

    const graphHistoryStyles = StyleSheet.create({


      historyToggleButton:{
        borderColor:'#ffcc00',
        borderWidth:2,
        backgroundColor:'#fcf8e3',
        borderRadius: 4,
        marginBottom:2,
        justifyContent: 'center',
        alignContent: 'center',
        height:100,
      },
      historyToggleFont:{
        color:"#8a6d3b",
        textAlign:'center',
        paddingBottom: 5,
        paddingTop: 5,
        fontWeight: 'bold',
      },

    });

Cancel all expo local scheduled notifications on iOS

$
0
0

I tried scheduling local notifications using expo (react native) and something very strange is happening.

This is the code I wrote:

const localNotification = {
  title: 'test',
  body: 'test body',
  ios: {
    sound: true
  }
};

let t = new Date();
t.setSeconds(t.getSeconds() + 10);

const schedulingOptions = {
  time: t, // (date or number) — A Date object representing when to fire the notification or a number in Unix epoch time. Example: (new Date()).getTime() + 1000 is one second from now.
  repeat: 'minute'
};

Notifications.scheduleLocalNotificationAsync(localNotification, schedulingOptions);

Then I started to receive the same notification every time the app is in background.

I removed that piece of code to use Notifications.presentLocalNotificationAsync() instead and I expected the previous notification to stop appearing as Notifications.scheduleLocalNotificationAsync() is never called anywhere in the whole app.

On Android I rebooted the phone and the notification doesn't appear anymore, but on iOS even after rebooting and reinstalling expo I keep getting the same scheduled notification.

I tried calling Notifications.cancelAllScheduledNotificationsAsync() with no luck.

Accessing password manager apps in iOS

$
0
0

We're trying to open a modal on password text inputs in our iOS-only React Native app that will open third-party password manager apps. We have seen the same UI component for this in a number of iOS apps, with two examples being Airbnb and Venmo.

Here's an example from the Airbnb app:

Airbnb example

We've been searching high-and-low to figure out what this modal is called and how to access it. Does anyone know how these apps are accomplishing this?

ReactNative TextInput not visible iOS

$
0
0

I have the following stripped down render result:

return (
  <View style={{backgroundColor:'red'}}>
    <TextInput value={'Hello'}/>
  </View>
);

The generated TextInput is not visible in iOS, unless I specify the height, and when using flexDirection:'row' in its container, I need to specify its width as well.

This only happens with iOS, Android seems to work as expected.

Is there a way of displaying a TextInput in iOS without fixed size?

Current dependencies:

"dependencies": {
    "react-native": "=0.18.1",
    "react-native-orientation": "=1.12.2",
    "react-native-vector-icons": "=1.1.0"
  },

iOS:

enter image description here

Android:

enter image description here

Changing the render like this:

return (
  <View style={{backgroundColor:'red'}}>
    <Text>text</Text>
    <TextInput value={'Hello'}/>
  </View>
);

has the following result:

iOS:

enter image description here

Android:

enter image description here


FlatList re-render with Redux

$
0
0

I'm using PureComponent to render items of my FlatList and when I use FlatList and pass a local state to it in data, the rendering works very well, I don't have wasteful re-rendering. However, when I use FlatList with an array from my redux store in data, if I scroll down, each time that onReachEnd is called, re-render work well. But when I don't have anymore data to load and I scroll up, all my items re-render one per one.

Like my whole list is lost.

I'm using exactly the same list with local state in data, and it works perfectly! The issue only appear when I try to make FlatList and Redux work together

<FlatList
   ref={(view) => this.list = view}
   data={this.props.requestsList}
   style={{flex: 1}}
   keyExtractor={(item) => String(item.emitter.id)}
   renderItem={this._renderRequestsItems}
   onEndReachedThreshold={0.5}
   onEndReached={!this.props.lastPage ? this._endReached : null}
   ListFooterComponent={reloadIndicator}
   ListHeaderComponent={this._getHeaderComponent}
   ListEmptyComponent={this._getEmptyComponent}
/>

Fetch data from php url to save to local sqlite in react native

$
0
0

I want to fetch data from url, example from json.php and then store that to local sqlite in React Native. But I can't find any reference or any problem same like me

I tried to find another database to get data from url and store to local database, but it seems I can't find any case like me.

[{
  "username":"****",
  "password":"*****",
  "access":"1",
  "name":"dwi",
  "phone_number":"****",
  "email":"**@***.com",
  "score":null,"status":"0"
 },
 {
  "username":"*****",
  "password":"****",
  "access":"1",
  "name":"******",
  "phone_number":"**********",
  "email":"******@**.com",
  "score":null,
  "status":"0"
 }]

How to create full width image splash screen for react native ios app in xcode

$
0
0

My application require a splash screen with a round logo in the middle , the background has some design overlays, So I need the splash screen as a full screen image. I have referred to several post but could not find out how to create the splash screen to fit different screen resolution.

I have created 3 images as Default.png (414 x 736) Default@2x.png (1080 x 1920) and Default@3x.png (2048 x 2732) And I have used LaunchScreen.xib for implementing my splash screen with an outer UIView and an inner UIImageView with an intention for holding the Default.png image as full screen. In emulator, some of the devices shows blank spaces horizontally and in tab vertically.

I think I need to add more images for different resolutions. Can somebody help me to get rid of this issue of adding full screen splash image

Running react-native apps on iOS emulators

$
0
0

So I am trying to run a simple react-native app on an iPhone 11 - 13.2.2 emulator.

I type npm run ios but I get this back.

** BUILD FAILED **


The following build commands failed:
        CompileC /Users/theodosiostziomakas/Desktop/React-Native/confusion/ios/build/confusion/Build/Intermediates.noindex/confusion.build/Debug-iphonesimulator/confusion.build/Objects-normal/x86_64/AppDelegate.o /Users/theodosiostziomakas/Desktop/React-Native/confusion/ios/confusion/AppDelegate.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
        CompileC /Users/theodosiostziomakas/Desktop/React-Native/confusion/ios/build/confusion/Build/Intermediates.noindex/confusion.build/Debug-iphonesimulator/confusion.build/Objects-normal/x86_64/main.o /Users/theodosiostziomakas/Desktop/React-Native/confusion/ios/confusion/main.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(2 failures)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ ios: `react-native run-ios`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @ ios script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/theodosiostziomakas/.npm/_logs/2019-11-16T12_38_06_754Z-debug.log

I used npm install but still nothing. How to fix that error?

Thanks, Theo.

Createing .ipa file in react native ios ( getting error at the time of archive)

$
0
0

I am getting an error when I create .ipa in react native app

error is: at the time of the archive

ld: warning: directory not found for option '-L/Users/auqualldev/Library/Developer/Xcode/DerivedData/awe-dogizpgvqdudqqewpplkzvqswhki/Build/Intermediates.noindex/ArchiveIntermediates/awe/BuildProductsPath/Release-iphoneos/DoubleConversion'

Please give me solution

Building Expo app for IOS with windows

$
0
0

I was wondering if there was any way for me to build my Expo app with Windows. Whenever I run exp build:ios, I get the following warning:

Does not seem like WSL enabled on this machine. Download from the Windows app store a distribution of Linux, then in an admin powershell, please run:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem->Linux

and run the new Linux installation at least once

What app should I use for this? And even if I do it, will Expo allow me to build for IOS?

Alternatively, can I use a service like Microsoft Appcenter to build it for me?

Schedule local notifications on user selected week days in iOS

$
0
0

The use case is that there is a form where a user can say: I want to get a notification on X days (e.g Monday, Friday and Sunday) at 14:00. The application is in react native but I'm just calling a native swift function to schedule the notification:

import Foundation
import UserNotifications

@objc(Reminders)
class Reminders: NSObject {
  @objc func setReminder(
    _ message: NSString,
    daysV days: NSArray,
    hourV hour: NSInteger,
    minuteV minute: NSInteger
  ) {
    // We'll replace all scheduled notifications entirely
    UNUserNotificationCenter.current().removeAllPendingNotificationRequests()

    // Create a notification for each day that has been passed
    let daysC: [Int] = days.map { $0 as! Int }
    for day in daysC {
      var date = DateComponents()
      date.weekday = day
      date.hour = hour
      date.minute = minute

      let content = UNMutableNotificationContent()
      content.title = "Reminder"
      content.body = message as String

      let userCalendar = Calendar(identifier: .iso8601)
      let dateTime = userCalendar.date(from: date)
      let triggerDate = Calendar.current.dateComponents([.weekday,.hour,.minute], from: dateTime as! Date)
      let trigger = UNCalendarNotificationTrigger(dateMatching: triggerDate, repeats: true)
      let identifier = "TMWTE\(day)"
      let request = UNNotificationRequest(identifier: identifier, content: content, trigger: trigger)
      let center = UNUserNotificationCenter.current()
      center.add(request, withCompletionHandler: { (error) in
        if let error = error {
          print(error);
        }
      })
    }
  }
}

What I'm trying to do is get each of the weekday included in a list sent from JS and schedule a notification for it. So if the user selects Monday and Wednesday the array will be [1,3] and I'll schedule a notification for each day respectively.

What's actually happening however is that I get X notifications at once in the first day. Thus if the user selects all days then in the next triggerDate I'll get 7 notifications.

Being a complete novice in Swift I may be doing something irrational, but I cannot figure it out at the moment. Now I've also tried to set the date.day to be the next Saturday, Sunday etc.. but that causes no notifications to be shown, which makes me think that I'm missing something basic here.

Thanks!


react-native-ffmpeg: Native module cannot be null (ios) and null is not an object (evaluating 'RNFFmpegModule.enableLogEvents') (android)

$
0
0

I have a basic expo project that I've eject as expokit, and proceeded to run expo install react-native-ffmpeg. When then running expo start I was greeted with Native module cannot be null on my iOS device and null is not an object (evaluating 'RNFFmpegModule.enableLogEvents').

After that, I re-read the react-native-ffmpeg documentation and added pod 'react-native-ffmpeg', :podspec => '../node_modules/react-native-ffmpeg/ios/react-native-ffmpeg.podspec' to my ios/Podfile and ran pod install. Still no luck.

After that, I deleted the node_modules folder and yarn.lock file, re-ran yarn, went into the ios directory, deleted the Pods folder and Podfile.lock file and re-ran pod install and still had no luck!

The error is less than helpful. Any ideas where to look?

How do you debug React Native?

$
0
0

How does one debug their React code with React Native while the app is running in app simulator?

react-native run-ios get info "CoreData: annotation: Failed to load optimized model"

$
0
0
react native -- 0.59.8
react -- 16.8.3
XCode -- 11.2.1

When I run the project version>0.60, this problem does not occur。when i run on android ,it does not occur too. That is to say ,it only happens in the project whose react-native version < 0.60 on ios.

When my XCode update to 11.2.1, I init a new react-native project(version 0.59.8) and build with XCode,it stay at XCode build image and never change,and packager does not start.

When I run with command'react-native run-ios',the simulator is started but the packager does not start ,and I get these info:

CoreData: annotation:  Failed to load optimized model at path '/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/Frameworks/InstrumentsPackaging.framework/Versions/A/Resources/XRPackageModel.momd/XRPackageModel 9.0.omo'

info Launching iPhone 11 (iOS 13.2)...
info Building using "xcodebuild -project Project.xcodeproj -configuration Debug -scheme Project -destination id=8D18A14A-5481-474C-BF47-8B78A1D73607 -derivedDataPath build/Project"

info User defaults from command line:

info     IDEDerivedDataPathOverride = /Users/lex/MyRNSpace/Under8/Project/ios/build/Project

info note: Using new build system

info note: Planning build

info note: Constructing build description

info CreateBuildDirectory /Users/lex/MyRNSpace/Under8/Project/ios/build/Project/Build/Products (in target 'cxxreact' from project 'React')
    cd /Users/lex/MyRNSpace/Under8/Project/node_modules/react-native/React
    builtin-create-build-directory /Users/lex/MyRNSpace/Under8/Project/ios/build/Project/Build/Products

info 
CreateBuildDirectory /Users/lex/MyRNSpace/Under8/Project/ios/build/Project/Build/Intermediates.noindex (in target 'cxxreact' from project 'React')
    cd /Users/lex/MyRNSpace/Under8/Project/node_modules/react-native/React
    builtin-create-build-directory /Users/lex/MyRNSpace/Under8/Project/ios/build/Project/Build/Intermediates.noindex

...
...
info PhaseScriptExecution Install\ Third\ Party /Users/lex/MyRNSpace/Under8/Project/ios/build/Project/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/double-conversion.build/Script-190EE32F1E6A43DE00A8543A.sh (in target 'double-conversion' from project 'React')
    cd /Users/lex/MyRNSpace/Under8/Project/node_modules/react-native/React
    export ACTION=build
    export AD_HOC_CODE_SIGNING_ALLOWED=YES
    export ALTERNATE_GROUP=staff
    export ALTERNATE_MODE=u+w,go-w,a+rX
    export ALTERNATE_OWNER=lex
    export ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=NO
    export ALWAYS_SEARCH_USER_PATHS=NO
    export ALWAYS_USE_SEPARATE_HEADERMAPS=NO
    export APPLE_INTERNAL_DEVELOPER_DIR=/AppleInternal/Developer
    export APPLE_INTERNAL_DIR=/AppleInternal
    export APPLE_INTERNAL_DOCUMENTATION_DIR=/AppleInternal/Documentation
    export APPLE_INTERNAL_LIBRARY_DIR=/AppleInternal/Library
    export APPLE_INTERNAL_TOOLS=/AppleInternal/Developer/Tools
    export APPLICATION_EXTENSION_API_ONLY=NO
    export APPLY_RULES_IN_COPY_FILES=NO
    export APPLY_RULES_IN_COPY_HEADERS=NO
    export ARCHS=x86_64

 export ENABLE_ON_DEMAND_RESOURCES=NO
    export ENABLE_PREVIEWS=NO
    export ENABLE_STRICT_OBJC_MSGSEND=YES
    export ENABLE_TESTABILITY=YES
    export ENTITLEMENTS_DESTINATION=__entitlements
    export ENTITLEMENTS_REQUIRED=YES
    export EXCLUDED_INSTALLSRC_SUBDIRECTORY_PATTERNS=".DS_Store .svn .git .hg CVS"
    export EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES="*.nib *.lproj *.framework *.gch *.xcode* *.xcassets (*) .DS_Store CVS .svn .git .hg *.pbproj *.pbxproj"
    export EXECUTABLE_EXTENSION=a
    export EXECUTABLE_NAME=libdouble-conversion.a
    export EXECUTABLE_PATH=libdouble-conversion.a
    export EXECUTABLE_PREFIX=lib
    export EXECUTABLE_SUFFIX=.a
    export FILE_LIST=/Users/lex/MyRNSpace/Under8/Project/ios/build/Project/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/double-conversion.build/Objects/LinkFileList
    export FIXED_FILES_DIR=/Users/lex/MyRNSpace/Under8/Project/ios/build/Project/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/double-conversion.build/FixedFiles
    export FRAMEWORK_FLAG_PREFIX=-framework
    export FRAMEWORK_SEARCH_PATHS="/Users/lex/MyRNSpace/Under8/Project/ios/build/Project/Build/Products/Debug-iphonesimulator "
    export FRAMEWORK_VERSION=A
    export FULL_PRODUCT_NAME=libdouble-conversion.a
    export GCC3_VERSION=3.3
    export GCC_C_LANGUAGE_STANDARD=gnu99
    export GCC_DYNAMIC_NO_PIC=NO
    export GCC_NO_COMMON_BLOCKS=YES
    export GCC_OBJC_LEGACY_DISPATCH=YES
    export GCC_OPTIMIZATION_LEVEL=0
    export GCC_PFE_FILE_C_DIALECTS="c objective-c c++ objective-c++"
    export GCC_PREPROCESSOR_DEFINITIONS="DEBUG=1 RCT_DEBUG=1 RCT_DEV=1 RCT_NSASSERT=1"
...
...
  export variant=normal
    /bin/sh -c /Users/lex/MyRNSpace/Under8/Project/ios/build/Project/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/double-conversion.build/Script-190EE32F1E6A43DE00A8543A.sh

info   % Total    % Received % Xferd  A
info verage Speed   Time    Time     Time  Current

info                   
info         D
info load  Upload
info    Tot
info al   Spent    Left  Spee
info d
  0     0   
info  0     0    
info 0     0      0      0 --:--:-- -
info -:--:-- --:
info --:--     0
  0     0  
info   0     0    0     0      0     
info  0 --:-
info -:-- --:
info --:--
info  --:--:--     0
  0     0    0     0    0     0      0      0
100   609    0   609    0     0    499      0 --:--:--  0:00:0
info 1 -
info -:--:--   
info 499

How do I check the horizontal or vertical image status in React-Native?

$
0
0

I want to use the 'contain' feature when the vertical image comes and the 'stretch' feature when the horizontal image comes in the react-native. How do I check the horizontal or vertical status? For example:

<Image resizeMode={status==horizantal?'contain':'stretch'} />

AppCenter react native ios build fails:"The following build commands failed: CopyPlistFile"

$
0
0

My app is built with react native.
I use Xcode 11 for development, and App Center for build.
I manage to build+archive the app (and run it on my device) when I build it locally on my mac.
However, when I build the app on App Center I get the following error:

The following build commands failed: CopyPlistFile /Users/runner/Library/Developer/Xcode/DerivedData/MyApp-glnwmpshuhlwezeyiaupgnbnizsy/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app/GoogleService-Info.plist /Users/runner/runners/2.160.1/work/1/GoogleService-Info.plist (1 failure) [error]Error: /usr/bin/xcodebuild failed with return code: 65

I made sure that I am using legacy build system on App Center (just like on the local).

Viewing all 16566 articles
Browse latest View live


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