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

Firebase Dynamic Links is not working for iOS in react-native

$
0
0

I have setup Passwordless authentication for my react-native app, for that it required to setup firebase dynamic links which I did successfully.

And everything was working fine on both Platforms Android and iOS, but after I merged my branch with the master, it stopped working on iOS. Meaning I am receiving the email to SignIn but that link is not opening the iOS app but it is working on Android successfully.

I did the following steps to setup Dynamic Links for iOS:

  1. AppDelegate.m
#import "AppDelegate.h"

#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
@import Firebase;
//Deep Linking RNavigation Docs
#import <React/RCTLinkingManager.h>
//Deep Linking RNavigation Docs

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
 RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
 RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
                                                  moduleName:@"realyze"
                                           initialProperties:nil];

 rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

 self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
 UIViewController *rootViewController = [UIViewController new];
 rootViewController.view = rootView;
 self.window.rootViewController = rootViewController;
 [self.window makeKeyAndVisible];
 [FIRApp configure];
 return YES;
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
 return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
 return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
//Deep Linking RNavigation Docs
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url
           options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
 return [RCTLinkingManager application:app openURL:url options:options];
}
//Deep Linking RNavigation Docs

@end
  1. Added Association Domains Capability In Xcode and in my Apple Developer Account for the particular App

  2. Added TeamID to Firebase Console for the appID prefix.

  3. Added these Firebase Authorized Domains: applinks:realyze.page.link activitycontinuation:realyze.page.link

  4. Also added domains to an entitlements file

6.app-site-associations-file is also setup correctly

This setup worked for me before I merged my branch.

Help would be very much appreciated.

Thank you.


react native firebase push notification issues only on iOS

$
0
0

I have implemented react native firebase push notification on my project, where it works with android properly but not showing on iOS.

  1. iOS project includes GoogleService-info.plist file.
  2. also project capabilities are "on" for push notification and remote notifications in background modes.
  3. I have added APNs authentication key to firebase console.
  4. when app runs on device, it ask for notification permission to user

Expected result: Notification pop-up on both devices android as well as iOS

Actual result: Notification pop-up on android only

Application runs properly, it does not crashes or not throwing any error.

AppDelegate.m file

#import "AppDelegate.h"
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <Firebase.h> //Added This Line
#import "RNFirebaseNotifications.h" //Added This Line
#import "RNFirebaseMessaging.h" //Added This Line
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application      didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [FIRApp configure]; //Added This Line
    [RNFirebaseNotifications configure];  //Added This Line
    RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
    RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"pushnotificationTest" initialProperties:nil];
    rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    UIViewController *rootViewController = [UIViewController new];
 rootViewController.view = rootView;
    self.window.rootViewController = rootViewController;
    [self.window makeKeyAndVisible];
    [[UNUserNotificationCenter currentNotificationCenter] setDelegate:self]; //Added This Line
  return YES;
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
@end

How can I get onKeyPress to give me the last key input with a Braille Display on iOS?

$
0
0

I deleted the previous version of this question because it was all over the place. Sorry about that. I am using React Native. The issue I am having is that when using a Braille Display (Orbit Reader 20) to input letters into a TextInput field on iOS I get a concatenated string of all the character and not the last one I entered. I have tried this on Android as well, but on Android, it works the way I want it to. iOS will behave like Android, but only if I have focus on the onscreen keyboard and not on the actual input field.

Descriptions of the problem (all letters are typed with a braille display): I have focus on the input area, I type in the letter 'b'. In the input area, the letter 'b' appears which is what I want to happen. Next, I type in the letter 'c' which on Android will give me just the letter 'c', but on iOS I get the string "bc" which I get the key using keyPress.nativeEvent.key. It seems like iOS is not respecting the maxLength prop when input comes from the braille device.

What I have tried: I have tried to just cut the last letter off of the key by using keyPress.nativeEvent.key.slice(-1) which does give the single letter, but it messes with VoiceOver and TalkBack (example: 'a' is displayed in the text area then I type 'b' and the phone says "ab"). I have found that if I clear the input area using textInput.current.clear() when onChangeText is triggered it will give me the results I want in that keyPress.nativeEvent.key will give me the last letter, but it will clear out my text immediately and cuts off VoiceOver.

Code Snippet (this is the code for my custom TextInput component and just has some console.log statements so that I can see what is going on.):


import React, { useState, useRef } from 'react';
import { View, StyleSheet, TextInput } from 'react-native';


const BrailleInput = props => {
    const textInput = useRef();
    const [valueLetter, setValueLetter] = useState('');

    const handleInput = input => {
        console.log("onChangeText: " + input);
    };

    const handleClear = keyPress => {
        setValueLetter(keyPress.nativeEvent.key);

        console.log("onKeyPress: " + keyPress.nativeEvent.key);
    };


    return (
        <View style={props.style}>
            <TextInput
                ref={textInput}
                style={styles.textInput}
                maxLength={1}
                autoCorrect={false}
                autoFocus={true}
                onKeyPress={handleClear}
                onChangeText={handleInput}
                value={valueLetter}
                caretHidden={true}
            />
        </View>
    );
};


const styles = StyleSheet.create({
    textInput: {
        height: '50%',
        width: '100%',
        borderColor: '#ffec33',
        justifyContent: 'center',
        alignItems: 'center',
        borderWidth: 4,
        color: '#ffec33',
        textAlign: 'center',
        fontSize: 40
    },
});


export default BrailleInput;

In the end, all I want is to have accessibility focus on the TextInput area, have TalkBack/VoiceOver speak the single letter that I input then be able to type another letter in to replace the previous letter, rinse, repeat. I need an accessible solution to this I have already been able to make a non-accessible solution.

Delete application data on iOS simulator without uninstalling app?

$
0
0

I would like to delete application data like local storage without reinstalling the app.

I am using AsyncStorage in react-native, and have persisted some data. To quickly test storage, I would like to be able to clear AsyncStorage manually through the simulator, without implementing a logout/ clear AsyncStorage button in the app.

It seems like the iOS simulator is rather limited compared to Android Emulator. e.g. An unrelated problem about iOS simulator: Even clearing the store when its empty causes errors.

react-native crossplatform wortk on Android | Ios and web?

$
0
0

i know that react-native allows to code in android and ios at the same time , but does it allow to code the web version ?

Exemple:

My application on android and ios is : test123

My application on a website is : test123.com

So I would like to know if I code in react-native, if there is also a web version to put it on a website?

If yes :

1 - How to configure our react-native application with our website?

2- How to test my application on my website while I code ?

If no:

Is there a solution to quickly code in web version what we did with react-native?

Thank you!

react-native cross platform work on Android | Ios and web?

$
0
0

i know that react-native allows to code in android and ios at the same time , but does it allow to code the web version ?

Exemple:

My application on android and ios is : test123

My application on a website is : test123.com

So I would like to know if I code in react-native, if there is also a web version to put it on a website?

If yes :

1 - How to configure our react-native application with our website?

2- How to test my application on my website while I code ?

If no:

Is there a solution to quickly code in web version what we did with react-native?

Thank you!

react-native link error 'Unknown dependency'

$
0
0

I'm following the example to build a small video chat: https://www.agora.io/en/blog/how-to-build-a-react-native-video-calling-app-using-agora

I created a new project via: npx react-native init AwesomeProject

I added the necessary dependencies:

npm install --save react-native-agora
npm install --save react-native-router-flux
npm install --save react-native-vector-icons

The dependencies can be also seen in the package.json

...
  "dependencies": {
    "react": "16.9.0",
    "react-native": "0.61.5",
    "react-native-agora": "^2.9.1-alpha.2",
    "react-native-router-flux": "^4.0.6",
    "react-native-vector-icons": "^6.6.0"
  },
...

When i start the app via npx react-native run-ios the app will start on my Version 10.2.1 (SimulatorApp-880.5 CoreSimulator-587.35)

I get the following error: Invariant Violation: Native module cannot be null. constructor NativeEventEmitter.js

I tried rebuilding it with npm install and the build was successful.

My guess is that i missed linking react to react-native-agora. I tried to link it with react-native link react-native-agora but i get the following error message:

error Unknown dependency. Make sure that the package you are trying to link is already installed in your "node_modules" and present in your "package.json" dependencies.

Thanks in advance.

How to resolve "Animated: `useNativeDriver` is not supported because the native animated module is missing." in react-navigation?

$
0
0

I am working on expo SDK Version: 36, and on all platforms (ios/android/web)

When installing react-navigation for the first time as described in the documentation and running jest --watch while doing it, and the following warning appeared:

    console.warn node_modules/react-native/Libraries/YellowBox/YellowBox.js:71
      Animated: `useNativeDriver` is not supported because the native animated module is missing. Falling back to JS-based animation. To resolve this, add `RCTAnimation` module to this app, or remove `useNativeDriver`. More info: https://github.com/facebook/react-native/issues/11094#issuecomment-263240420

It also happen in the browser console:

bundle.js:18272 Animated: `useNativeDriver` is not supported because the native animated module is missing. Falling back to JS-based animation. To resolve this, add `RCTAnimation` module to this app, or remove `useNativeDriver`. More info: https://github.com/facebook/react-native/issues/11094#issuecomment-263240420 
    in Card (at CardContainer.tsx:132)
    in CardContainer (at CardStack.tsx:499)
    in CardStack (at StackView.tsx:384)
    in KeyboardManager (at StackView.tsx:382)
    in Context.Consumer (at StackView.tsx:380)
    in StackView (at StackView.tsx:41)
    in StackView (at createStackNavigator.tsx:33)
    in Anonymous (at createNavigator.js:80)
    in Navigator (at createAppContainer.js:351)
    in NavigationContainer (at AppCore.js:15)
    in AppCore (at App.js:14)
    in App (at withExpoRoot.web.js:13)
    in ExpoRootComponent (at registerRootComponent.web.js:6)
    in RootComponent
warn @ bundle.js:18272
r @ backend.js:6
shouldUseNativeDriver @ bundle.js:76326
TimingAnimation @ bundle.js:76894
start @ bundle.js:75709
start @ bundle.js:75715
Card._this.animate @ bundle.js:85843
componentDidMount @ bundle.js:85980
commitLifeCycles @ bundle.js:52243
commitLayoutEffects @ bundle.js:55486
callCallback @ bundle.js:30478
invokeGuardedCallbackDev @ bundle.js:30527
invokeGuardedCallback @ bundle.js:30582
commitRootImpl @ bundle.js:55224
unstable_runWithPriority @ bundle.js:92068
runWithPriority$2 @ bundle.js:42291
commitRoot @ bundle.js:55064
finishSyncRender @ bundle.js:54471
performSyncWorkOnRoot @ bundle.js:54449
(anonymous) @ bundle.js:42341
unstable_runWithPriority @ bundle.js:92068
runWithPriority$2 @ bundle.js:42291
flushSyncCallbackQueueImpl @ bundle.js:42336
flushSyncCallbackQueue @ bundle.js:42324
scheduleUpdateOnFiber @ bundle.js:53851
enqueueSetState @ bundle.js:44136
../../../react/cjs/react.development.js.Component.setState @ bundle.js:88125
_callee2$ @ bundle.js:1353
tryCatch @ bundle.js:90193
invoke @ bundle.js:90419
prototype.<computed> @ bundle.js:90245
tryCatch @ bundle.js:90193
invoke @ bundle.js:90283
(anonymous) @ bundle.js:90293
Promise.then (async)
invoke @ bundle.js:90292
(anonymous) @ bundle.js:90293
Promise.then (async)
invoke @ bundle.js:90292
(anonymous) @ bundle.js:90318
callInvokeWithMethodAndArg @ bundle.js:90317
enqueue @ bundle.js:90340
prototype.<computed> @ bundle.js:90245
../../../regenerator-runtime/runtime.js.exports.async @ bundle.js:90364
_callee2 @ bundle.js:1324
SplashScreen @ bundle.js:1537
constructClassInstance @ bundle.js:44346
updateClassComponent @ bundle.js:48555
beginWork$1 @ bundle.js:50328
beginWork$$1 @ bundle.js:55898
performUnitOfWork @ bundle.js:54837
workLoopSync @ bundle.js:54813
performSyncWorkOnRoot @ bundle.js:54412
(anonymous) @ bundle.js:42341
unstable_runWithPriority @ bundle.js:92068
runWithPriority$2 @ bundle.js:42291
flushSyncCallbackQueueImpl @ bundle.js:42336
flushSyncCallbackQueue @ bundle.js:42324
scheduleUpdateOnFiber @ bundle.js:53851
enqueueSetState @ bundle.js:44136
../../../react/cjs/react.development.js.Component.setState @ bundle.js:88125
onFinish @ bundle.js:1392
_callee$ @ bundle.js:18446
tryCatch @ bundle.js:90193
invoke @ bundle.js:90419
prototype.<computed> @ bundle.js:90245
tryCatch @ bundle.js:90193
invoke @ bundle.js:90283
(anonymous) @ bundle.js:90293
Promise.then (async)
invoke @ bundle.js:90292
(anonymous) @ bundle.js:90318
callInvokeWithMethodAndArg @ bundle.js:90317
enqueue @ bundle.js:90340
prototype.<computed> @ bundle.js:90245
../../../regenerator-runtime/runtime.js.exports.async @ bundle.js:90364
_callee @ bundle.js:18389
componentDidMount @ bundle.js:18470
commitLifeCycles @ bundle.js:52243
commitLayoutEffects @ bundle.js:55486
callCallback @ bundle.js:30478
invokeGuardedCallbackDev @ bundle.js:30527
invokeGuardedCallback @ bundle.js:30582
commitRootImpl @ bundle.js:55224
unstable_runWithPriority @ bundle.js:92068
runWithPriority$2 @ bundle.js:42291
commitRoot @ bundle.js:55064
finishSyncRender @ bundle.js:54471
performSyncWorkOnRoot @ bundle.js:54449
scheduleUpdateOnFiber @ bundle.js:53840
updateContainer @ bundle.js:57245
(anonymous) @ bundle.js:57670
unbatchedUpdates @ bundle.js:54575
legacyRenderSubtreeIntoContainer @ bundle.js:57669
render @ bundle.js:57750
renderApplication @ bundle.js:65334
run @ bundle.js:65227
runApplication @ bundle.js:65266
registerRootComponent @ bundle.js:18777
../../../expo/AppEntry.js @ bundle.js:14474
__webpack_require__ @ bundle.js:727
fn @ index.js:69
0 @ bundle.js:101987
__webpack_require__ @ bundle.js:727
(anonymous) @ bundle.js:794
(anonymous) @ bundle.js:797
Show 40 more frames
[Violation] 'requestAnimationFrame'

Related issues:

The last one offers a solution, but it says to open Xcode, while I am on Linux Debian 10. I do not have Xcode. I can use a Macbook and do the step but I am wondering:

  • Should I care when working on Linux?
  • Should I care when working on Macbook (if it happens)?
  • Should I care for the health of my app while testing? Under which circumstances?

absl/numeric/int128_have_intrinsic.inc' file not found in react native firebase ios

$
0
0

I am getting this error .unable to build .I have tried pod deintegrate and again pod install but issue. still not fix.

Pods/Headers/Public/abseil/absl/numeric/int128.h:726:10: fatal error: 'absl/numeric/int128_have_intrinsic.inc' file not found

here is my pod version

# Required by RNFirebase

  pod 'Firebase/Core', '~> 6.13.0'
  pod 'Firebase/Auth', '~> 6.13.0'
  pod 'Firebase/Database', '~> 6.13.0'
  pod 'Firebase/Functions', '~> 6.13.0'
  pod 'Firebase/DynamicLinks', '~> 6.13.0'
  pod 'Firebase/Firestore', '~> 6.13.0'
  pod 'Firebase/Messaging', '~> 6.13.0'
  pod 'Firebase/RemoteConfig', '~> 6.13.0'
  pod 'Firebase/Storage', '~> 6.13.0'
  pod 'Firebase/Performance', '~> 6.13.0'
  pod 'Fabric', '~> 1.10.2'
  pod 'Crashlytics', '~> 3.14.0'

and

"react-native-firebase": "^5.6.0",
  "react": "16.8.3",
    "react-native": "0.59.8",

let me whats the why its coming

Face Manipulation with react native

$
0
0

We need to integrate a feature in our app that would detect the face of the user and apply makeup on their face.

For ex. We have a particular shade of lipstick that a customer could apply on their lips to see how it looks.

Is this possible through react native? If not then what would you recommend for this?

expo is not working in iphone. init start is not working

$
0
0

I use expo. I install expo-cli and expo init projectName and expo start. but is not working. I logined expo. the wifi is same in my desktop and phone.. please help me..

enter image description here

React-native paytm integration

$
0
0

when i click on button it will call the paynow function, in payNow function one popUp is open and automatically it closed with out showing anything, I don't know how to resolve this issue

How to configure Info.plist file in ejected react-native app uses expo sdk

$
0
0

i created an app using react-native ini projectName and i added a native module package called react-native-facebook-account-kit And i need to change Info.plist in ios folder and add app id and client token info. Also i created a pod file as facebook docs said. It works fine. Then i tried to make exactly same thing in expo. So i used this cli to create a new project create-react-native-app projectName then i run npm run eject and selected second option which is uses both react-native and expo sdk. So it created ios and android folders successfully.

BUT in ios folder there is no Info.plist file. After my search i found this doc. https://docs.expo.io/versions/latest/workflow/configuration#ios And i added some key and values into app.json like doc said.

    {
  "expo": {
    "sdkVersion": "27.0.0",
    "ios": {
      "bundleIdentifier": "com.cecil.foxtail",
      "infoPlist": {
        "FacebookAppID": "myAppId",
        "AccountKitClientToken": "myClientToken",
        "CFBundleURLTypes": [
          // ??? CONFUSED
        ]
      }
    },
    "android": {
      "package": "com.cecil.foxtail"
    }
  }
}

Here is the original Info.plist from the app which is working great.

<key>FacebookAppID</key>
  <string>{app-id}</string>
  <key>AccountKitClientToken</key>
  <string>{client-token}</string>
  <key>CFBundleURLTypes</key>
  <array>
    <dict>
      <key>CFBundleURLSchemes</key>
      <array>
        <string>ak{client-token}</string>
      </array>
    </dict>
  </array>

So how to define these array into app.json ?

How to prevent layout from overlapping with iOS status bar

$
0
0

I am working on tutorial for React Native navigation. I found out that all layout starts loading from top of screen instead of below of the status bar. This causes most layouts to overlap with the status bar. I can fix this by adding a padding to the view when loading them. Is this the actual way to do it? I don' think manually adding padding is an actual way to solve it. Is there a more elegant way to fix this?

import React, { Component } from 'react';
import { View, Text, Navigator } from 'react-native';

export default class MyScene extends Component {
    static get defaultProps() {
            return {
                    title : 'MyScene'    
            };  
    }   
    render() {
            return (
                    <View style={{padding: 20}}> //padding to prevent overlap
                            <Text>Hi! My name is {this.props.title}.</Text>
                    </View> 
            )   
    }    
}

Below shows the screenshots before and after the padding is added. enter image description here

What is difference between RCT_EXPORT_METHOD vs RCT_REMAP_METHOD?

$
0
0

This should be a simple term but in my reading, I did not find anything convincing.

I have seen both are used to bridge native functions to javascript ie react native. But the name tells there is a difference between these two.

Thanks


Keeping logic in js on foreground services in React Native, some downsides?

$
0
0

TLDR;

I'm keeping all (handle logic and store state) in js in my music player app and this works even when app is closed/killed if we registered it properly as a foreground service.

What I was trying to do

I was playing making a music app with the next features:

  • track queue

  • auto play next song

  • play/pause/stop

  • play when app is closed

  • control the app with a persistent notification

What I did

I found a lib that could do the whole work exact as I needed... but it was too buggy. So, should I write all that code in a Java/Swift native module? before giving me up I looked in Android docs about process and services and I found that the app and service code runs in the same main thread, so all I need is a service attached to a notification and my app bounded to that service in order to prevent be killed when app closes. Based on this, we can keep all our logic (skip to next song, etc) and state (track queue) in js and use native code just to play music and handle interactions with the notification calling the js code to handle it. But, before trying that, I wanted to try some native libs to handle the audio player and the notification.

  • react-native-sound

  • react-native-music-control

Results

As react-native-music-control uses startForeground(NOTIFICATION_ID, notification); our app is already safe of system clean up. I tried this and indeed it worked as expected. I tried simulating memory warning and it still working and skipping songs perfectly. I "killed" the app from apps menu and it still works as expected.

But what about iOS? I don't know much about this one but as iOS is "inspired" on unix system too, it just worked as expected. Here it worked as a music foreground service because we have to say that in Info.plist

Questions

  • Is this enough to consider it a good production practice at least in this context (music app)?

  • Am I missing something that could be a problem in the future?

React Native Mobile Apps Documentation Tools

$
0
0

I built a React Native project and trying to make a Documentation of it with some 3rd party tools. Is there any appplication that will help you to make Documentation of React Native project?

I have a few in mind like :

  • Espresso from Android Studio

  • Appium (but I think this is for mobile automation. CMIIW)

I need an app that help me to capture the screen of the mobile apps, list its process (input, output, button click, etc), and export its result as a .txt or whatever format that easy to copy to MS Word for better formatting.

expo is not automatically update when i update code in iso simulator

How to load local svg file with react-native-svg library

$
0
0

I am trying to load a local svg file in react-native with react-native-svg library, i have already installed it but i can't figure out how to do it with local svg files. the file is located in "./assets/bg.svg" and i am using expo. please write the exact code if you know.

React Native - Change text color according to background color

$
0
0

I want to do something like as shown in the image below but I don't have any idea how to achieve that (I googled it, but I found only result for native code Swift, Obj C, ...).

enter image description here

Do I have to play with some layers or something like that?

Thanks for your answers!

Viktor

Viewing all 16562 articles
Browse latest View live


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