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

How to update the react native UI based on the swift delegate function?

$
0
0

I am new to the react native and I am integrating the iOS framework. I want update the UI based on the call back in Swift file.

LoginContoller:

func validateLogin(userName: String, pswd: String)  {    HKSDKController.init(withuserName: userName, password: pswd, delegate: self)}Delegate function:func recieveMessage(result: Bool, withError message: String) {// result = true}

Input.js:

 loginWithLogin = (userName, pswd) => { if (userName == '') { alert("Please enter the userName"); } else if (pswd == '') { alert("Please enter the pswd"); }else { NativeModules.LoginContoller.validateLogin(userName,pswd); } }

I saw there is a call function to update the js:

  @objc func callbackMethod(callback: RCTResponseSenderBlock) -> Void {  }

My question is i want to update the UI based on the “recieveMessage” callback function. I called the "validateLogin" function in input.js file. How to handle it and pass the result to the input js.

If the result is true in the "recieveMessage" delegate function, how to notify the js file.


Using native iOS static library in React Native

$
0
0

I have native iOS static library writtern in objective-c and built and I want to use the library into React native project. Please guide me if there are possible ways. How can I consume native static library into react native project.

Detox - Android / iOS - Cannot run the same test on android

$
0
0

I had been trying to find information about this error that I will post below, I did all the configurations and made research, I am using the latest version of everything.But since I am new to Detox, I was assuming that the test written for iOS works for Android, if so please ignore and please provide details on how to adapt.Basically the error I am getting is this:

detox[40905] INFO:  [test.js] configuration="android.emu.debug" reportSpecs=true readOnlyEmu=false useCustomLogger=true forceAdbInstall=false DETOX_START_TIMESTAMP=1588961953280 node_modules/.bin/jest --config e2e/config.json '--testNamePattern=^((?!:ios:).)*$' --maxWorkers 1 "e2e"detox[40909] INFO:  [DetoxServer.js] server listening on localhost:49577...detox[40909] ERROR: [DetoxExportWrapper.js/DETOX_INIT_ERROR] DetoxRuntimeError: Failed to run application on the deviceHINT: Most likely, your tests have timed out and called detox.cleanup() while it was waiting for "ready" message (over WebSocket) from the instrumentation process.    at EmulatorDriver._getInstrumentationCrashError (/Users/brunosoko/Documents/appExam/node_modules/detox/src/devices/drivers/android/AndroidDriver.js:165:12)    at EmulatorDriver.instrumentationCloseListener (/Users/brunosoko/Documents/appExam/node_modules/detox/src/devices/drivers/android/AndroidDriver.js:128:67)    at EmulatorDriver._terminateInstrumentation (/Users/brunosoko/Documents/appExam/node_modules/detox/src/devices/drivers/android/AndroidDriver.js:156:12)    at processTicksAndRejections (internal/process/task_queues.js:97:5)    at ChildProcess.<anonymous> (/Users/brunosoko/Documents/appExam/node_modules/detox/src/devices/drivers/android/AndroidDriver.js:274:7) {  name: 'DetoxRuntimeError'}detox[40909] INFO:  Example: should show login screen after tap on Sign in button

I do not know if it's a bug or something that I am doing wrong.Here's my package.json

"detox": {"specs": "","configurations": {"ios.sim.debug": {"binaryPath": "/Users/brunosoko/Library/Developer/Xcode/DerivedData/AppExam-cwpqhbjlywwwihfaazprzmynvoym/Build/Products/Debug-iphonesimulator/appExam.app","type": "ios.simulator","name": "iPhone 11"      },"android.emu.debug": {"binaryPath": "/Users/brunosoko/Documents/AppExam/android/app/build/outputs/apk/debug/app-debug.apk","type": "android.emulator","name": "Pixel_3_API_R_2"      }    },"test-runner": "jest"  },

Please HELP!

Can't launch my ''app with "react-native run-ios"

$
0
0

My app doesn't launch when i run react-native run-ios.

It just keep loadind like that :

info Building (using "xcodebuild -workspace eve.xcworkspace -configuration Debug -scheme eve -destination id=8FB38EEC-0E9F-4F50-8976-04C59E173058")(node:3020) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency(Use `node --trace-warnings ...` to show where the warning was created)

I updated my xcode version, pod install in ios folder and changed the build to Legacy in workplace setting in xcode.

Nothing changed...

Thanks in advance !

Firebase iOS stuck at 'Run your app to verify installation'

$
0
0

React Native Firebase installation for iOS gets held up at the "Run your app to verify installation" screen.

React Native Firebase has worked on Android for me before.

I followed these instructions.

https://rnfirebase.io/docs/v5.x.x/installation/ioshttps://firebase.google.com/docs/ios/setup#add_the_sdk

Here are what I've done so far.

-Set up a project within Firebase.google.com page.

-Create an iOS app there.

-Install react-native-firebase via npm.

-Add GoogleService-Info.plist file to the project within XCode.

-Make changes to ios/[YOUR APP NAME]/AppDelegate.m file.

-Creat a new Podfile (Cocoa pod) and updated it by "pod update" command.

-Add and edited lines to the Podfile per the instruction.

-Run "pod install"

-Run "react-native link react-native-firebase" from the project root.

-Click "Next" button within Firebase console and move on to "Run your app to verify installation" section.

-Run the iOS app on simulator by running "react-native run-ios" command.

The app boots up and functions as normal in the simulator.

Nothing happens in the Firebase page.

This is the first couple of lines of my Podfile.

# Uncomment the next line to define a global platform for your projectplatform :ios, '9.0'# Required by RNFirebasepod 'Firebase/Core', '~> 5.20.1'target 'My_App_Name' do

React Native Expo : Listen to Video Sound When app is annactive but it’s still working on background

$
0
0

Could i Listen to Video Sound When app is innactive but it’s still working on background ? this feature exist for audio using staysActiveInBackground property but not for Video.

SDK Version:

expo 37.0.3

Platforms

android/ios

Thank’s

redirection is not working properly in react native ios

$
0
0

I am using univeral link to use shopify API in react native and it works well on ios and android.When I login at first time, redirect from safari to app after oauth is complete. But if user try to login again, that is, if user try again oauth then no redirect to app. It looks safari save cookie and so user don't input username and password anymore, but no redirect to app. But on android, it working. Only not working on ios.

So I clear the safari cache and then try to do oauth then shows login form and redirected to the app after oauth complete.But on android, working well even though don't clear cache.I will appreciate if anyone helpe

Is there anyway to send sms in background for both Android & IOS?

$
0
0

I wanna make an app that its main functionality depends on sending SMS. before i was developing android(native) but now im using React-Native to make it for both IOS and Android.

in android it's possible to send sms in background if you get user permission. but after searching through net i couldn't find a way to do it in react-native. i read that Apple doesn't let apps to do so.i'm wondering if there is anyway to send SMS in background for both Android and IOS.

the libraries i've already seen, open phone sms interface(filled with number and smsBody) and then user must push send button(i wanna remove this step. i mean app sends sms automatically).

after all, is there anyway( library, ...) that can sends sms in background without opening sms interface for both android and ios?


I want to do badge increment on main app icon while receiving notification in inactive mode of app

$
0
0

I am working on a chat app in react-native iOS. I want to do badge increment on main app icon when notification is received when the app is killed or force quit by user. It works well when the app is in background mode. But didReceiveRemoteNotification method is not called when the app is inactive. Any idea on this? I added code inside didReceiveRemoteNotification method of AppDelegate.

Added the following code set in AppDelegate file

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {      [RNNotifications didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];    }- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {      [RNNotifications didFailToRegisterForRemoteNotificationsWithError:error];    }- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {    NSLog(@"APPDELEGATE: didReceiveRemoteNotification:fetchCompletionHandler %@", userInfo);  int badge = (int) application.applicationIconBadgeNumber;  if ( application.applicationState == UIApplicationStateInactive ) {    [[UIApplication sharedApplication] setApplicationIconBadgeNumber:badge+1];  }  else if(application.applicationState == UIApplicationStateBackground) {    [[UIApplication sharedApplication] setApplicationIconBadgeNumber:badge+1];  }  else if(application.applicationState == UIApplicationStateActive) {    [[UIApplication sharedApplication] setApplicationIconBadgeNumber:badge+1];  }  completionHandler(UIBackgroundFetchResultNewData);}

RN 0.62 - 18 duplicate symbols for architecture armv7

$
0
0

I have recently upgraded the react-native app from 0.60.4 to 0.62.0 and I have solved tons of problems already, though I don't know how far I am from success but I feel close, here is how my pod file looks -

platform :ios, '10.0'require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'use_native_modules!target 'MyProject' do    pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"    pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"    pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"    pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"    pod 'React', :path => '../node_modules/react-native/'    pod 'React-Core', :path => '../node_modules/react-native/'    pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'    pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'    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-Core/RCTWebSocket', :path => '../node_modules/react-native/'    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 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon"    pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"    pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga', :modular_headers => true    pod 'RNCharts', :path => '../node_modules/react-native-charts-wrapper'    pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'endpost_install do |installer|    installer.pods_project.targets.each do |target|        target.build_configurations.each do |config|            config.build_settings['SWIFT_VERSION'] = '4.2'        end    endend

Now I also have a bridging header which looks something like this -

////  Use this file to import your target's public headers that you would like to expose to Swift.//#import "React/RCTBridge.h"#import "React/RCTViewManager.h"#import "React/RCTUIManager.h"#import "React/UIView+React.h"#import "React/RCTBridgeModule.h"#import "React/RCTEventDispatcher.h"#import "React/RCTEventEmitter.h"#import "React/RCTFont.h"

I am facing below errors -

ld: 18 duplicate symbols for architecture armv7clang: error: linker command failed with exit code 1 (use -v to see invocation)

And apparently this indicate below 18 duplicated files -

RNBarChartManager.oRNBarChartManager.oRNBubbleChartManager.oRNBubbleChartManager.oRNCandleStickChartManager.oRNCandleStickChartManager.oRNCombinedChartManager.oRNCombinedChartManager.oRNHorizontalBarChartManager.oRNHorizontalBarChartManager.oRNLineChartManager.oRNLineChartManager.oRNPieChartManager.oRNPieChartManager.oRNRadarChartManager.oRNRadarChartManager.oRNScatterChartManager.oRNScatterChartManager.o

Most of it belongs to react-native-charts-wrapper pakage. I do not know from where and how should i remove these duplicates.

How to set zoom level in google map according to miles in react native?

$
0
0

I have react native application using react-native-maps,in which there is a feature to display near by users based on radius chosen by user that works fine using geocode. but I am facing problem to set zoom level of Map based on user radius? if user selects maximum meter of radius then map should display whole world? How can I achieve this? to set zoom level dynamically based on radius chosen by user?

to set radius used react-native-slider, How can set zoom level on slide of slider?

Failed authentication in Apple Developer Portal when execute expo build:ios

$
0
0

I'm trying to config automatically build iOS apps using Expo through Gitlab-CI.This are the commands that I am using:

expo login -u expo_user -p expo_passexpo build:ios --non-interactive --apple-id my_id@domain.com --clear-dist-cert --clear-provisioning-profile --dist-p12-path "path_to_file.p12" --provisioning-profile-path "path_to_file.mobileprovision"

I am already passing the respective values of this env vars:

EXPO_APPLE_PASSWORDEXPO_IOS_DIST_P12_PASSWORD

During the 2nd command execution it launch this logs:

[14:24:23] Trying to authenticate with Apple Developer Portal...[14:24:25] Authentication with Apple Developer Portal failed![14:24:25] Error: Reason: Unknown reason, raw: "<html>\r\n<head><title>502 Bad Gateway</title></head>\r\n<body>\r\n<center><h1>502 Bad Gateway</h1></center>\r\n<hr><center>Apple</center>\r\n</body>\r\n</html>\r\n\n"    at runAction (/expo-cli@3.13.1/src/appleApi/fastlane.ts:28:17)    at processTicksAndRejections (internal/process/task_queues.js:97:5)    at Object.authenticate (/expo-cli@3.13.1/src/appleApi/authenticate.ts:46:40)    at IOSBuilder.getAppleCtx (/expo-cli@3.13.1/src/commands/build/ios/IOSBuilder.js:47:23)    at IOSBuilder.produceMissingCredentials (/expo-cli@3.13.1/src/commands/build/ios/IOSBuilder.js:123:22)    at IOSBuilder.prepareCredentials (/expo-cli@3.13.1/src/commands/build/ios/IOSBuilder.js:65:7)    at IOSBuilder.run (/expo-cli@3.13.1/src/commands/build/ios/IOSBuilder.js:19:7)    at IOSBuilder.command (/expo-cli@3.13.1/src/commands/build/BaseBuilder.js:55:7)    at Command.<anonymous> (/expo-cli@3.13.1/src/exp.ts:81:7)

The Apple Developer account that I am using have configured the Two Factor Authentication (2FA).

Is this the reason why the expo build:ios command is failing the auth against Apple Portal?What am I missing in this commands?

PS: These commands on my laptop works fine!

Xcode crash on opening .xcodeproj file

$
0
0

I am running my React-Native iOS project with Xcode but I don't know which change effects it and my I notices that my Xcode is crashed then I try to open it inside Xcode but it crashes every time then I deleted derived data and also xcuserdata from .xcodeproj file but no success I also tried to use this command "defaults delete com.apple.dt.Xcode" but again no luck I have also looked into .xcodeproj file for conflicts but there is no conflicts I try to run my project with command line but again got this message.

"error Failed to build iOS project. We ran `xcodebuild` command but it exited with error code null. To debug build logs further, consider building your app with Xcode.app, by opening `.xcodeproj`

Can anyone please suggest me a solution for this ?

Delete derived data of xcode and also of project.react-native run-ios

"error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code null. To debug build logs further, consider building your app with Xcode.app, by opening Raydan.xcodeproj"

How do I register permission handlers without using Cocoapods?

$
0
0

Im trying to register permission handlers in a react native app that is using v59. All of the instructions im coming across provide steps for using Cocoapods, which im currently not using.

I came across a post here providing steps on how to manually copy the handler files into the project, but its still not being detected.

The error im getting is "No permission handler detected".

enter image description here

enter image description here

enter image description here

Using environment variable in react-native swift

$
0
0

I am working on React-Native App and want to configure env variables which I can share with iOS app and Android.

The documentation requires me to add this line in AppDelegate.m

[GMSServices provideAPIKey:@"Azzz8"];`

Here Azzz8 would be my api key. Now I want to pass this to be in an environment file and pass it from there (to ios and android). Any idea how I can do it?

This is how my code for AppDelegate.m kinda looks like

/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */#import "AppDelegate.h"#import <Firebase.h>#import <React/RCTBridge.h>#import <React/RCTBundleURLProvider.h>#import <React/RCTRootView.h>#import <React/RCTLinkingManager.h>#import <UMCore/UMModuleRegistry.h>#import <UMReactNativeAdapter/UMNativeModulesProxy.h>#import <UMReactNativeAdapter/UMModuleRegistryAdapter.h>#import <GoogleMaps/GoogleMaps.h>@implementation AppDelegate- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{  /* Firebasee App Config */  [FIRApp configure];  [GMSServices provideAPIKey:@"1234"];

How do I enable touch on multiple buttons simultaneously in react native?

$
0
0

I need that when I am touching and holding one button then I should also be able to touch on the button 1.

<View><View   onStartShouldSetResponder={()=>this.console("Button 2 Clicked")}><Text>BUTTON 2</Text></View><TouchableOpacity   onPressIn={()=>this.console('Button 1 pressed')}  onPressOut={()=>this.console('Button 1 released')}><View><Text>BUTTON 1</Text></View></TouchableOpacity></View>

Basically, I have a screen where I can record a video by tapping and holding the record button(Button 1). On the same screen, I have a flip camera button (Button 2). I want that I should be able to click on the flip camera button while I am recording the video.

Is there no way to have transparent status bar on iOS in React Native > 0.60

$
0
0

Before I switched to RN 0.62 from RN 0.47 it's been pretty simple to support transparent status bar on both iOS and Android by just replacing Stack Navigation header with the StatusBar. Just specifying bar style was enough, it was transparent by default. I tried the same approach after the RN update, and now it does not seem to work.

<Stack.Screen        name="WelcomeScreen"        component={WelcomeScreen}         options={{          header: props =>  <StatusBar barStyle="dark-content" translucent={true} backgroundColor="transparent"/>, //<Header barStyle='dark-content' />,          gestureEnabled: false        }}

The piece above demonstrates what I attempted to do. The replacement itself does not yield any errors, changing 'barStyle' does affect the content color, but the background is static white, and can't figure out the way to change it. From StatusBar component documentation I found out that 'translucent' and 'backgroundColor' properties are only supported on Android. So, is it true that there is absolutely no way to accomplish this without going deep into native code ? I'd be glad to know for sure whether there is a workaround or not, since in worst case I'll just make customer swallow the fact that this kind of microadjustments of UI are too costly, but I have to be sure.

In App Purchase in React Native which is dynamic where user can set the price

$
0
0

How can we implement Dynamic In-App Purchase in React Native? Let's say we have some features to be unlocked after some payment.

Let's consider a case: When a user wants to visit some corporate page, they have to pay some amount of money where they can subscribe for some certain amount of time. The amount is dynamic: the corporate can set any amount of money so that same should reflect there in apple purchase and apple wants In-app purchase to be implemented for that.

How can we implement dynamic In-app purchases where the amount can be set by the user of the app and that amount can be shown in the In-app purchase, which can also be changed in future.

Please help

upgrading my project to react navigation v5

$
0
0

Am working on my first react native project and after I put in many hours building my react navigation (version 4) setup and working on the different screens and components I came across a material design library called react native paper which offers some really cool looking components that will make my app look better so I started by trying to add the bottom nav bar, but it didn't work so I looked around only to find out that it goes along with the react native navigation v5 so is there a way to use react native bottom nav bar component from react paper with the version 4 of react navigation?if not how can i convert all the code to the version 5 syntax ?

here is my app.js file :

import React from "react";import { StyleSheet, Text, View } from "react-native";import { createAppContainer, createSwitchNavigator } from "react-navigation";import { createStackNavigator } from "react-navigation-stack";import { createBottomTabNavigator } from "react-navigation-tabs";import AccountScreen from "./src/screens/AccountScreen";import SigninScreen from "./src/screens/SigninScreen";import SignupScreen from "./src/screens/SignupScreen";import TrackCreateScreen from "./src/screens/TrackCreateScreen";import MainScreen from "./src/screens/MainScreen";import ResultShowScreen from "./src/screens/ResultsShowScreen";import { Provider as AuthProvider } from "./src/context/AuthContext";import { setNavigator } from "./src/navigationRef";import ResolveAuthScreen from "./src/screens/ResolveAuthScreen";const switchNavigator = createSwitchNavigator({  ResolveAuth: ResolveAuthScreen,  loginFlow: createStackNavigator({    Signup: SignupScreen,    Signin: SigninScreen,  }),  mainFlow: createBottomTabNavigator({    trackListFlow: createStackNavigator({      Main: MainScreen, //  TrackList: TrackListScreen      ResultsShow: ResultShowScreen, // TrackDetail: TrackDetailScreen    }),    TrackCreate: TrackCreateScreen, // we dont need this one    Account: AccountScreen,  }),});const App = createAppContainer(switchNavigator);export default () => {  return (<AuthProvider><App        ref={(navigator) => {          setNavigator(navigator);        }}      /></AuthProvider>  );};

here is an expo link to the full app : https://expo.io/@souhaildq/enews_app

Appium automation on React native iOS apps

$
0
0

Does appium supports automation of react native ios apps? If yes, please share the links or details. Thank you.

Viewing all 16558 articles
Browse latest View live


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