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

React Native duplicate symbol on XCode when installing react-native-adapter

$
0
0

I am having the error below when I installed the react-native-adapter via npm.

Can someone please show me how to fix this issue?

Error:

duplicate symbol '_OBJC_METACLASS_$_EXReactNativeUserNotificationCenterProxy' inRelease-iphoneos/EXPermissions/libEXPermissions.a(EXReactNativeUserNotificationCenterProxy.o)Release-iphoneos/UMReactNativeAdapter/

React Native IOS simulator Debug menu not opening

$
0
0

This is my first time using react native IOS. I was trying to run my application in ios simulator. But the problem is I need to set debug server host & port for device in dev settings. cmd + d tried but no response debug menu is not opening struck here if anyone has a fix please post here. Its a blocker could not move forward. I am not using useFrameworks. Thanks in advance.

Change Xcode BundleID and project name from ReactNative Project

$
0
0

A while ago I started a React Native project which generated the Xcode project folder/files including an unwanted bundleID, project name and target names etc.

When I try to create an app in AppStoreConnect or APNs Certificate in my Apple Developer account the bundleID of this app does not appear in the list, probably because I did not start the project in Xcode.

I need to change the bundleID and ideally the project name/target name etc, but the existing names are tied-up in the wider repository and cause errors.

This, two questions;

  1. Should I make the changes in Xcode or somewhere in the VScode repo?
  2. How can I get my bundleID to show in my Apple Developer account?

Many many thanks

React Native open iOS App Notifications setting

$
0
0

enter image description here

I am able to open the above screen with Linking.openURL('app-settings:').

Is there a way to go a layer deeper and open the Notifications setting instead (see below)?

I have searched for some answers and tried Linking.openURL('app-settings:2'), Linking.openURL('app-settings:{2}') and Linking.openURL('app-settings:NOTIFICATIONS') without luck.

enter image description here

Disabling scroll of scroll view inside pan gesture handler doesn't trigger pan gesture events in react native

$
0
0

So I have this modal bottom sheet which has a scroll view inside. When scroll y offset is 0 (scroll to top) then scroll should be disabled and pan gesture should trigger. Pan gesture basically translates the modal along y axis. Here's the code,

import React, { useState, useEffect, useRef } from "react"import { View, Text, TouchableOpacity } from "react-native"import { PanGestureHandler, ScrollView } from "react-native-gesture-handler"import Animated, {    useAnimatedGestureHandler,    useAnimatedStyle,    useSharedValue,    withTiming} from "react-native-reanimated"const TestComponent: React.FC = () => {    const panRef = useRef<PanGestureHandler>(null)    const scrollRef = useRef<ScrollView>(null)    const [scrollEnabled, setScrollEnabled] = useState(true)    const y = useSharedValue(400)    const animateY = useAnimatedStyle(() => {        return {            transform: [{ translateY: y.value }]        }    })    const swipe = useAnimatedGestureHandler({        onStart: (e, ctx: { startY: number }) => {            ctx.startY = y.value        },        onActive: (e, ctx) => {            y.value = ctx.startY + e.translationY        }    })    useEffect(() => {        y.value = withTiming(0)    }, [])    return (<View            style={{ paddingVertical: 50, flex: 1, backgroundColor: "black" }}><TouchableOpacity onPress={() => (y.value = 0)}><Text style={{ color: "white" }}>Reset</Text></TouchableOpacity><PanGestureHandler ref={panRef} onGestureEvent={swipe}><Animated.View                    style={[                        {                            position: "absolute",                            bottom: 0,                            backgroundColor: "green",                            height: 400,                            width: "100%"                        },                        animateY                    ]}><ScrollView                        ref={scrollRef}                        scrollEventThrottle={16}                        scrollEnabled={scrollEnabled}                        onScrollBeginDrag={e => {                            const offset = e.nativeEvent.contentOffset                            if (offset.y <= 0) {                                setScrollEnabled(false)                                scrollRef.current?.scrollTo({ x: 0, y: 0 })                            }                        }}                        waitFor={scrollEnabled ? scrollRef : panRef}>                        {new Array(30).fill(1).map((x, i) => {                            return (<View key={i.toString()}><Text>#Item {i.toString()}</Text></View>                            )                        })}</ScrollView></Animated.View></PanGestureHandler></View>    )}export default TestComponent

However even if I disable scroll on first try the pan gesture doesn't trigger. However on second try it works.

How can I display a launch/splash screen in a react-native app without using a package? (iOS specifcally)

$
0
0

I am currently in the process of meeting Apple's updated developer guidelines for a React Native mobile app. The hangup for me has been with using a storyboard for the launch screen.

Overview

The production version of the app is using react-native-splash-screen to handle the splash screen, which is just the company logo. I noticed that the package last had an update published a year ago, so I would like to get away from it and handle the splash screen natively.

Current State

I created a storyboard with Xcode and dropped the package from the repo. I made a few changes to AppDelegate.m, and I was able to display the splash screen for a set period of time. I ultimately don't want to use a timer, I want to hide the splash screen once all of the launch time network calls are finished.

Solution (?)

After combing through articles and posts, I came across what I think is the solution. It was a post on r/reactnative from a couple of years back: https://www.reddit.com/r/reactnative/comments/754y5g/app_flashing_white_after_launch_screen_on_ios_11/

The OP had found a solution and added it in a comment. The idea is to edit the AppDelegate.m provided by RN to replace the white screen with the same .xib as the launch screen.

  • I have a .storyboard and not a .xib

  • Their example has a slightly different AppDelegate.m than the app's.

  • I don't know a lick of Objective-C

So, my search continued and I found the following post from StackOverflow: React-Native iOS - How to show a view controller after Launch screen, before initialising react native bridge (iOS)

I refactored based on this post and was able to get to my current state.

Code

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{  UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"LaunchScreen" bundle:[NSBundle mainBundle]];  UIViewController *backgroundView = [storyboard instantiateViewControllerWithIdentifier:@"LaunchViewController"];  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge                                               moduleName:@"fakeAppName"                                               initialProperties:nil];  rootView.backgroundColor = [UIColor clearColor];// changed color to clearColor  UIViewController *rootViewController = [UIViewController new];  rootViewController.view = rootView;  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];  self.window.rootViewController = backgroundView;  [self.window makeKeyAndVisible];  dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{      self.window.rootViewController = rootViewController;  });  return YES;}

Question

How can I display a splash screen after the launch screen storyboard to cover the time between tapping the app icon and the completion of the loading of the app?

Additionally, I want the splash screen and launch screen to be the same storyboard so that it is a seamless transition from loading to the home screen.

As I said, I don't know Objective-C and have been at a bit of a loss with debugging this. Can anyone offer suggestions or point me to resources that could help me out here?

Self Defense

I used alternating terminology of splash screen and launch screen because Apple identifies them as 2 different things. As I understand it, the launch screen is for OS loading of the app, and the splash screen is for initial in-app loading.

I have also seen quite a few strong opinions on splash screens. The app has initial network calls that require a short loading period, thus I use a splash screen to cover that loading. I am not using it just for the sake of having the logo on your face for longer.

I am familiar with another RN package called react-native-bootsplash. I am trying to avoid using a package altogether, which is why I am pursuing this solution in the first place.

Why carplay and react native app crashes when click on app icon to open in carplay?

$
0
0

I am using react-native-carplay(^2.0.0) library for my react native app..

I made the setup as this library suggests and I run my App in different iOS simulators (iPhone 11, 12 in iOS versions 14.4, 14.2, 13.0).. I also tried to run the example that the library provides..

The problem always is that when I open carplay as an external window, I can see the icon of my app but when I click on it, the app close on iOS and carplay simulator without any errors..Also I saw that "CarPlay.connected" is false even if I can see the app's icon on carplay simulator..

Can anyone help..?Any ideas are welcome...

Xcode build fails with Undefined symbols for architecture arm64:

$
0
0

I got the following warning on Github CI when trying to build an iOS archive:

ld: warning: ignoring file ios/myframework.xcframework/ios-arm64/myframework.framework/myframework, building for iOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x76 0x65 0x72 0x73 0x69 0x6F 0x6E 0x20 0x68 0x74 0x74 0x70 0x73 0x3A 0x2F 0x2F )

then this error followed:

Undefined symbols for architecture arm64:

Now the confusing thing is that this error can happen because of several reasons, in my case, it was neither of any I could find online.


iOS React Native: only "Bundle React Native code and images” when there are RN changes

$
0
0

“Bundle React Native code and images” build phase takes place every time when editing unrelated project files in Xcode.

What way can you configure this build phase to only take place when rebundling the RN code and images would be required?

Is it possible to make a multiplatform mobile app only using Windows?

$
0
0

With my team from the university, we are carrying out the final degree project. We need to create a multiplatform mobile application, each of us has Windows computers.

We are thinking of using react or flutter, if you know any other technology that we can use, we are open to ideas.

The question is the following, to deploy the application in IOS, is it necessary to have a MAC computer?

FBReactNativeSpec, PhaseScriptExecution failed with a nonzero exit code

$
0
0

I have been having issues trying to create an IOS build of a react native application. Originally I made this on windows with an android emulator. Then I tried to build the react native code on mac with xcode but I can't get past this error.

I have tried a couple things like reinstalling node and unsetting the PREFIX variable in the find-node script but I have not gotten any further

When inspecting the error it says:

  • FBReactNativeSpec - Uncategorized - PhaseScriptExecution failed with a nonzero exit code

int he details there is another error that says:

  • bash: mobile/node_modules/react-native/scripts/../Libraries: No such file or directory

React-Native Server Driven ui

$
0
0

I always wonder how apps like Airbnb, Flipkart, and Swiggy update their UI on the fly. Even if I didn’t update the app, Flipkart shows different UIs during festivals, while Swiggy always changes its UI based on the device location.

How I implement this in my react-native-app?

Webview is the solution?

Kindly help me..Thanks

React-Native: Firebase Error: No Firebase App [DEFAULT] has been created - call Firebase App.initializeApp() (app/no-app) site:stackoverflow.com

$
0
0

I getting following error when try to read the data from firebase using redux.

React-Native: Firebase Error: No Firebase App [DEFAULT] has been created - call Firebase App.initializeApp() (app/no-app)

The connections with firebase works fine, cause I can create a new user and add new data to Firestore.

  1. I have added my info.plist file
  2. I have have config firebase in the app delegate
@implementation AppDelegate- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{  if ([FIRApp defaultApp] == nil) {    [FIRApp configure];  }

My redux Actions.js

import firebase from 'firebase/app';import 'firebase/firestore';import { USER_STATE_CHANGE, CLEAR_DATA, } from '../constans/index'//fetch UserInfo from firebaseexport function fetchUser() {  return (dispatch) => {    firebase      .firestore()      .collection("users")      .doc(firebase.auth().currentUser.uid)      .get()      .then((snapshot) => {        if (snapshot.exists) {          dispatch({ type: USER_STATE_CHANGE, currentUser: snapshot.data() });        } else {          console.log('does not exist');        }      });  };}

So do anyone have a clue of what I should do. If I have added the "config" in Xcode, should I also do in App.js?

How to change text Value upon Button press in React Native?

$
0
0

I'm an iOS developer currently working on an experimental React Native app.

I have the following code which shows a button and sample text on the screen.

import React from 'react';import { StyleSheet, Text, View , Button } from 'react-native';export default class App extends React.Component {  constructor() {    super();    this.state = {sampleText: 'Initial Text'};  }  changeTextValue = () => {    this.setState({sampleText: 'Changed Text'});  }  _onPressButton() {<Text onPress = {this.changeTextValue}>      {this.state.sampleText}</Text>  }  render() {    return (<View style={styles.container}><Text onPress = {this.changeTextValue}>          {this.state.sampleText}</Text><View style={styles.buttonContainer}><Button            onPress={this._onPressButton}            title="Change Text!"            color="#00ced1"          /></View></View>    );  }}const styles = StyleSheet.create({  container: {    flex: 1,    backgroundColor: '#f5deb3',    alignItems: 'center',    justifyContent: 'center',  },  buttonContainer: {}});

The above code displays text and a button.

However when I click the button, the app crashes instead of showing the new text which is to be shown.

I'm new to React Native, kindly guide me on how to solve the error.

React Native iOS 14 Unable to login to sandbox tester's account

$
0
0

I've successfully created a sandbox tester in AppStoreConnect. I'm using real device with iOS 14 and the exact emulator to test my inAppPurchases, written in react-native using react-native-iap.

Everything is set up correctly, but how can I login into my sandbox tester's account?

As I see in the tutorials, in earlier versions of iOS it was possible to handle through settings:enter image description here

However, I don't see such menu item. So, what's the right way to connect my sandbox tester to either real device or iOS 14 emulator?

Thanks!


scrollbug on nested navigator screens

$
0
0

I have an issue with scrolling a screen inside a nested navigator on iOS.My scroll bar is in the middle of the screen instead on the side.I assume it has something to do with how I navigate through to the screen within the nested navigators. But I don't know how to fix it.

I attached a video below and a snack which reproduces the issue.

enter image description here

Here is the snack:https://snack.expo.io/uJ8dsGlX3

And that is my code:

import * as React from 'react';import { Text, View, StyleSheet, Button, ScrollView } from 'react-native';import { NavigationContainer } from "@react-navigation/native";import { createStackNavigator } from "@react-navigation/stack";import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";const Stack = createStackNavigator();const Stack2 = createStackNavigator();const Stack3 = createStackNavigator();const Tab = createBottomTabNavigator();export default function App() {  return (<NavigationContainer><StackNavigator/></NavigationContainer>  );}const HomeScreen = () => {  return <Text style={styles.margin}>HomeScreen</Text>}const ProfileScreen = () => {  return  (<ScrollView><View        style={{ height: 2000, width: "100%", backgroundColor: "grey" }}></View></ScrollView>    )}const ChatOverview = ({navigation}) => {  return <><Text style={styles.margin}>ChatOverview</Text><Button onPress={() => navigation.navigate("Tabless") } title="to go tabless"/></>}const HomeNavigator = () => {  return (<Stack2.Navigator><Stack2.Screen name="HomeScreen" options={() => ({headerShown: false})} component={HomeScreen}/><Stack2.Screen name="ProfileScreen" options={() => ({headerShown: false})} component={ProfileScreen}/></Stack2.Navigator>  );}const ChatNavigator = () => {  return (<Stack3.Navigator><Stack3.Screen name="ChatOverview" component={ChatOverview}/></Stack3.Navigator>  )}const HomeTabs = () => {  return  <Tab.Navigator><Tab.Screen name="Home" component={HomeNavigator}/><Tab.Screen name="Chat" component={ChatNavigator}/></Tab.Navigator>}const Tabless = ({navigation}) => {  return <Button style={styles.margin} title="go to profile" onPress={() => navigation.navigate("ProfileScreen")}/>}const StackNavigator = ({navigator}) => {  return(<Stack.Navigator><Stack.Screen name="HomeTabs" options={() => ({headerShown: false})} component={HomeTabs}/><Stack.Screen name="Tabless" component={Tabless}/></Stack.Navigator>   )}const styles = StyleSheet.create({  margin: {    margin: 20,  },});

What should be the architecture to send real-time alerts/locations from a mobile app in every app state to the backend nodejs server?

$
0
0

I want to send real-time locations and some other real-time alerts to the server captured by the mobile app in any state (foreground/background/killed) & show it on the admin portal. For now, I am using sockets.io to send data from app to the server which works fine when the app is in foreground state but the connection breaks after few seconds in android 9 or higher when app is cleared from recent apps or in background state & I am not able to reconnect to that socket connection in that state. I am using mongodb to store the data.

I asked a question previously on how to keep socket connection stable in different app states but no success from that (also provided the code for connection setup, you can check here)

What should be the architecture to send real-time data to the server in every app state(as long as app is receiving location updates & alerts) reliably taking scalability and performance in mind?

I am thinking of using firebase, will it be a better option or there is a better way to do this?

KISSmetrics - React Native iOS

$
0
0

I am using React native to create an iOS app; So my code is in javascript and some objective-c.

Now i wan't to implement KISSmetrics in my project, i have done the proper setup based on kissmetrics documentation, but when it comes to create events and user identifications etc… i have to use data from my javascript code.

Does anyone knows how to do that? for example:the objective-c code to identify the user is this: [[KISSmetricsAPI sharedAPI] identify:@"name@email.com"]; but how can i get the code that gets the identity of the user and replace the name@email.com from my javascript code?

Different of React Native Android and React Native IOS

$
0
0

i'm new in mobile development
I wasn't never using MacOS before, and now i'm trying to build a crossplatform mobile app using React Native
The android mobile app is already built and run normally
But for now i'm trying to develop the app into ios mobile app use MacOS inside VMWare
And i have some question for it

  1. Can i instantly copy my project which was built at windows OS(Android) to MacOS then run it?
  2. Do i need to do extra things if i i can only copy my project from Windows OS to MacOS?
  3. What is cd ios && pod install and what time should i run this script?
  4. Why windows can't be used for developing ios app?
  5. Can i connect my VMWare MacOS directly to my iPhone directly using WiFi?

Sorry i'm still a newbie and please apologize me if i have an unnecessary questions

React native full screen intent notification

$
0
0

I have an app that needs to show a full screen notification even when the phone is locked or the app is closed, something like ubber, when the user orders a driver i want the driver to be able to see a fullscreen notification that shows the details of the order and some action buttons that might reject the order, accept it, or open some activity in the app like checking the users profile or something.

I don't want it to be just a normal notification because the whole buisness kinda depends on it, the driver needs to be instantly informed about the order and react to it, that can be best achived with implementing a full screen notification just like answering a call, it's a time-sensitive message.

Is this possible with react native and some push notification service like OneSignal?

After doing some research i found that this may be achievable with Android using services and full screen notification intent, but in ios it's more complicated since background tasks are very restricted in iOS.

So im just looking for some insight on how to achieve this or at least something similar, is it even possible to achieve something like this? Do i have to write some platform specific code for both iOS and Android?

ANY help at all is very much appreciated, thank you.

Viewing all 17263 articles
Browse latest View live


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