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

react native fetch api or axios cause Network request failed

$
0
0

I already checked all the similar problems but none help me and also most of them haven't an accepted answer. also i checked RN docs but no luck.here is my code to fetch data from an api:

  useEffect(() => {    fetch('https://jsonplaceholder.typicode.com/users')      .then((res) => res.json())      .then((data) => { alert(data) })      .catch((err) => console.log(err))  }, []);

also I tried axios , same result.

no matter what link i use, it always throw me [type error: Network request failed] .I want to know what is the cause of this not a hacky way to solve.


How to integrate Google Tag Manager with React Native app?

$
0
0

Recently, the marketing team asked me to add Google Tag Manager in the current company project, this project is written based on React Native and I searched a lot for this. but no success to found good updated documentation.

I found a react-native-gtm but it is for 4 years ago. also, I find some descriptions for the Native side like this, but it's exactly for the Native iOS not for a React Native project.

Also, I found an article with the React Native: Firebase GTM Integration Installation title. but what is it? What is the meaning of Firebase GTM? what does it mean?

Because as I remember these are separated tools for marketing. Firebase is different from GTM. By the way, this current article is not useful for us because it describes installing on the Native sides. it is not a React Native solution.

So: How to integrate Google Tag Manager with React Native app?

We were unable to review your app as it crashed on launch. Expo

$
0
0

Expo app is working fine on iOS real device so I built IPA and submitted to App store. They replied with “We were unable to review your app as it crashed on launch”. I went through the logs that they provided but couldn’t really extract much info about the reason of the crash. Attached is the logfile.

{"app_name":"ComRaziSnsfitness","timestamp":"2020-08-18 09:13:18.00 -0700","app_version":"1.0.0","slice_uuid":"b77b98be-bc0d-36dd-a1ca-ac6b97fd3e4c","adam_id":1527827259,"build_version":"2.0.0","bundleID":"com.razi.snsfitness","share_with_app_devs":0,"is_first_party":0,"bug_type":"109","os_version":"iPhone OS 13.5.1 (17F80)","incident_id":"9EF13627-A0E0-449C-A9AA-53682CA68DFB","name":"ComRaziSnsfitness"}Incident Identifier: 9EF13627-A0E0-449C-A9AA-53682CA68DFBCrashReporter Key:   be5bf217cd77f22a30cac60daf16aa15a9f6d2bcHardware Model:      xxxProcess:             ComRaziSnsfitness [6503]Path:                /private/var/containers/Bundle/Application/BDF3BD1C-C04F-40B9-81A1-008E9847755F/ExpoKitApp.app/ComRaziSnsfitnessIdentifier:          com.razi.snsfitnessVersion:             2.0.0 (1.0.0)AppStoreTools:       11E707Code Type:           ARM-64 (Native)Role:                ForegroundParent Process:      launchd [1]Coalition:           com.razi.snsfitness [2154]Date/Time:           2020-08-18 09:13:18.1344 -0700Launch Time:         2020-08-18 09:13:17.5412 -0700OS Version:          iPhone OS 13.5.1 (17F80)Release Type:        UserBaseband Version:    n/aReport Version:      104Exception Type:  EXC_CRASH (SIGABRT)Exception Codes: 0x0000000000000000, 0x0000000000000000Exception Note:  EXC_CORPSE_NOTIFYTriggered by Thread:  0Last Exception Backtrace:(0x1bda6f794 0x1bd791bcc 0x100fd2084 0x100ff129c 0x1bd735524 0x1bd6e8180 0x1bd735524 0x1bd6e75b4 0x1bd9ed7fc 0x1bd9e86d0 0x1bd9e7ce8 0x1c7b3238c 0x1c1b16444 0x100e09358 0x1bd86f8f0)Thread 0 name:  Dispatch queue: com.apple.main-threadThread 0 Crashed:0   libsystem_kernel.dylib          0x00000001bd864d88 0x1bd83f000 + 1550161   libsystem_pthread.dylib         0x00000001bd77d1e8 0x1bd77b000 + 86802   libsystem_c.dylib               0x00000001bd6d09b0 0x1bd65e000 + 4694243   libsystem_c.dylib               0x00000001bd6d0940 0x1bd65e000 + 4693124   libc++abi.dylib                 0x00000001bd838cc0 0x1bd826000 + 769925   libc++abi.dylib                 0x00000001bd82ae10 0x1bd826000 + 199846   libobjc.A.dylib                 0x00000001bd791e80 0x1bd78c000 + 241927   libc++abi.dylib                 0x00000001bd83814c 0x1bd826000 + 740608   libc++abi.dylib                 0x00000001bd8380e4 0x1bd826000 + 739569   libdispatch.dylib               0x00000001bd735538 0x1bd6da000 + 37407210  libdispatch.dylib               0x00000001bd6e8180 0x1bd6da000 + 5772811  libdispatch.dylib               0x00000001bd735524 0x1bd6da000 + 37405212  libdispatch.dylib               0x00000001bd6e75b4 0x1bd6da000 + 5470813  CoreFoundation                  0x00000001bd9ed7fc 0x1bd945000 + 69017214  CoreFoundation                  0x00000001bd9e86d0 0x1bd945000 + 66939215  CoreFoundation                  0x00000001bd9e7ce8 0x1bd945000 + 66685616  GraphicsServices                0x00000001c7b3238c 0x1c7b2f000 + 1319617  UIKitCore                       0x00000001c1b16444 0x1c10e8000 + 1067526818  ComRaziSnsfitness               0x0000000100e09358 0x100e04000 + 2133619  libdyld.dylib                   0x00000001bd86f8f0 0x1bd86e000 + 6384Thread 1:0   libsystem_pthread.dylib         0x00000001bd789738 0x1bd77b000 + 59192Thread 2:0   libsystem_pthread.dylib         0x00000001bd789738 0x1bd77b000 + 59192Thread 3 name:  Dispatch queue: com.facebook.react.ExceptionsManagerQueueThread 3:0   libsystem_kernel.dylib          0x00000001bd86577c 0x1bd83f000 + 1575641   libdispatch.dylib               0x00000001bd6dc0a8 0x1bd6da000 + 83602   libdispatch.dylib               0x00000001bd6dbe84 0x1bd6da000 + 78123   libdispatch.dylib               0x00000001bd6e834c 0x1bd6da000 + 581884   libdispatch.dylib               0x00000001bd6e7f6c 0x1bd6da000 + 571965   ComRaziSnsfitness               0x0000000101005b98 0x100e04000 + 21042166   ComRaziSnsfitness               0x0000000100ff1070 0x100e04000 + 20194407   ComRaziSnsfitness               0x00000001011cd6d8 0x100e04000 + 39707768   ComRaziSnsfitness               0x000000010125acb8 0x100e04000 + 45498169   ComRaziSnsfitness               0x000000010125b6bc 0x100e04000 + 455238010  CoreFoundation                  0x00000001bda75970 0x1bd945000 + 124760011  CoreFoundation                  0x00000001bd946bb0 0x1bd945000 + 708812  CoreFoundation                  0x00000001bd947788 0x1bd945000 + 1012013  ComRaziSnsfitness               0x0000000101203fe8 0x100e04000 + 419428014  ComRaziSnsfitness               0x00000001012061d4 0x100e04000 + 420296415  ComRaziSnsfitness               0x0000000101205f38 0x100e04000 + 420229616  libdispatch.dylib               0x00000001bd7349a8 0x1bd6da000 + 37111217  libdispatch.dylib               0x00000001bd735524 0x1bd6da000 + 37405218  libdispatch.dylib               0x00000001bd6e18a4 0x1bd6da000 + 3088419  libdispatch.dylib               0x00000001bd6e2294 0x1bd6da000 + 3342820  libdispatch.dylib               0x00000001bd6eb78c 0x1bd6da000 + 7156421  libsystem_pthread.dylib         0x00000001bd786b74 0x1bd77b000 + 4798822  libsystem_pthread.dylib         0x00000001bd789740 0x1bd77b000 + 59200............

I tried running this command inside a folder containing ExpoKitApp.app and crash_report.crash :

atos -arch arm64 -o ExpoKitApp.app/ComRaziSnsfitness 0x1bda6f794

but it just printed out 0x1bda6f794 back to me.

My app.js is trying to make use of expo push notifications and I believe the error has something to do with that. Attaching my app.js as well.

import AppContainer from “./src/navigations/AppNavigation”;import * as Notifications from “expo-notifications”;import Constants from “expo-constants”;import * as Permissions from “expo-permissions”;import React from “react”;import * as firebase from “firebase”;// Initialize Firebasevar firebaseConfig = {apiKey: “my_key”,authDomain: “domain”,databaseURL: “DB”,projectId: “ID”,storageBucket: “bucket”,messagingSenderId: “id”,appId: “id”,measurementId: “G-JYNKX65MGK”,};if (!firebase.apps.length) {firebase.initializeApp(firebaseConfig);}Notifications.setNotificationHandler({handleNotification: async () => ({shouldShowAlert: true,shouldPlaySound: true,shouldSetBadge: true,}),});const rootRef = firebase.database().ref(“expoTokens/”+ Constants.deviceId);export default class App extends React.Component {componentDidMount() {this.registerForPushNotificationsAsync().then((token) => {  if (typeof token === "undefined" || token == null) return;  try {    rootRef.set(token);  } catch (error) {    alert(error);  }});Notifications.addNotificationReceivedListener(this._handleNotification);Notifications.addNotificationResponseReceivedListener(  this._handleNotificationResponse);}_handleNotification = (notification) => {this.setState({ notification: notification });this.props.navigation.navigate("Notices");};_handleNotificationResponse = (response) => {this.props.navigation.navigate("Notices");};async registerForPushNotificationsAsync() {let token;if (Constants.isDevice) {  const { status: existingStatus } = await Permissions.getAsync(    Permissions.NOTIFICATIONS  );  let finalStatus = existingStatus;  console.log(finalStatus);  if (existingStatus !== "granted") {    const { status } = await Permissions.askAsync(      Permissions.NOTIFICATIONS    );    finalStatus = status;  }  if (finalStatus !== "granted") {    alert("You won't receive any notifications about the SnS Fitness");    return;  }  token = (await Notifications.getExpoPushTokenAsync()).data;} else {  alert("Must use physical device for Push Notifications");}if (Platform.OS === "android") {  Notifications.setNotificationChannelAsync("default", {    name: "default",    importance: Notifications.AndroidImportance.MAX,    vibrationPattern: [0, 250, 250, 250],    lightColor: "#FF231F7C",  });}return token;}render() {return <AppContainer />;}}

How to change the "Bundle Identifier" within React Native?

$
0
0

Starting a new react-native project, the xcode-project gots the bundle-identifier "org.reactjs.native.example.XYZApp". XYZ is the placeholder here for my real project name.

Is there any way to change this bundle identifier on react-native side? Sure, I can change it in XCode. But this is not safe because it can be overriden when react-native will recreate the xcode-project, which could happen at any time, as well es when rebuilding the project.

XCode release schema error - use of undeclared identifier 'Twitter'

$
0
0

I'm using react-native-twitter-signin in my react-native application.

While trying to build a release app, I'm getting an error Use of undeclared identifier 'Twitter'.

Here's my AppDelegate.m

#import "AppDelegate.h"#import <React/RCTBridge.h>#import <React/RCTBundleURLProvider.h>#import <React/RCTRootView.h>#ifdef FB_SONARKIT_ENABLED#import <FlipperKit/FlipperClient.h>#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>#import <TwitterKit/TWTRKit.h>static void InitializeFlipper(UIApplication *application) {  FlipperClient *client = [FlipperClient sharedClient];  SKDescriptorMapper *layoutDescriptorMapper =      [[SKDescriptorMapper alloc] initWithDefaults];  [client addPlugin:[[FlipperKitLayoutPlugin alloc]                            initWithRootNode:application                        withDescriptorMapper:layoutDescriptorMapper]];  [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];  [client addPlugin:[FlipperKitReactPlugin new]];  [client addPlugin:[[FlipperKitNetworkPlugin alloc]                        initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];  [client start];}#endif@implementation AppDelegate- (BOOL)application:(UIApplication *)application    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {#ifdef FB_SONARKIT_ENABLED  InitializeFlipper(application);#endif  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self                                            launchOptions:launchOptions];  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge                                                   moduleName:@"test"                                            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];  return YES;}- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {#ifdef FB_SONARKIT_ENABLED  return      [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"                                                     fallbackResource:nil];#else  return [[NSBundle mainBundle] URLForResource:@"main"                                 withExtension:@"jsbundle"];#endif}- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options {  return [[Twitter sharedInstance] application:app openURL:url options:options];}@end

Installed pods:

pod 'TwitterKit', '~> 3.3.0'

Debug build is working fine. What can be the issue?

React Native iOS "Safari cannot open the page because the address is invalid" after valid login

$
0
0

Getting the following after successful login. The login flow is working as expected on Android, and correctly returns token, refresh, etc...

"Safari cannot open the page because the address is invalid"

Screen Recording of Error

Auth0 Callback Config

Info.plist

...<key>CFBundleIdentifier</key><string>$(PRODUCT_BUNDLE_IDENTIFIER)</string><key>CFBundleURLTypes</key><array><dict><key>CFBundleTypeRole</key><string>None</string><key>CFBundleURLName</key><string>auth0</string><key>CFBundleURLSchemes</key><array><string>$(PRODUCT_BUNDLE_IDENTIFIER)</string></array></dict></array>...

AppDeligate.m

...#import <React/RCTLinkingManager.h>- (BOOL)application:(UIApplication *)application openURL:(NSURL *)urlsourceApplication:(NSString *)sourceApplication annotation:(id)annotation{  return [RCTLinkingManager application:application openURL:url                      sourceApplication:sourceApplication annotation:annotation];}...

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 can I publish to the Apple app store my expo application?

$
0
0

I have finished to write a react-native application written with the help of expo SDK and I want to build my final .apk and .ipa for testing them with real devices.

During the development, I have used one iPhone 6 and one Galaxy S9 real devices using the expo application.

So far, I managed to build from Debian the signed apk but I didn't find a way to get an .ipa from my Debian linux system.

I can't have xcode installed but if needed I can rent a mac online and submit the ipa from there.

I have already followed those guides:

This guy says:

Is it possible…sure. The only thing a Mac is needed for is XCode for actually uploading your IPA to AppStore. I do not own a MAC personally, so I rent an online one via MacInCloud.

What are the steps to build an .ipa on expo?


Error ReactNative AsyncStorage is null iOS

$
0
0

I am developing an app with ReactNative using asyncStorage, on Android it is working fine, I have the problem on iOS, I can't solve the problem:Error: [@ RNC / AsyncStorage]: NativeModule: AsyncStorage is null.

Here is a picture of the error

This is Error Messaje in iPhone X

I've tried all the instructions you put in the error message, and I've looked for the same error and can't find the solution.Let's see if anyone has had the same experience with this error and can help me, thank you very much.

More information:

  • I'm not using expo
  • React Native version 61.5

Network error between Rails and React Native with ios/android devices

$
0
0

I'm having an issue with Rails and React Native. Here's an overview of the structure.

Rails is running at 8080RN is running at 8081React is running at 3000

When I run either ios Simulator or android emulator, there's no issue at all. However, whenever I try to run the app on the actual devices (both ios and android), I never hear back from Rails.

I've verified that

  1. both my local server and devices are under the same network
  2. rails (5.2) is binding 0.0.0.0
  3. I can access 3000, 8080, and 8081 individually from the device browser.

Here's the error I'm getting on React Native console:

 {"message":"ERR: Could not create device","error":{"message":"Network Error","name":"Error","stack":"createError@http://192.168.29.210:8081/index.bundle?platform=ios&dev=true&minify=false:106824:26\nhandleError@http://192.168.29.210:8081/index.bundle?platform=ios&dev=true&minify=false:106726:27\ndispatchEvent@http://192.168.29.210:8081/index.bundle?platform=ios&dev=true&minify=false:34174:31\nsetReadyState@http://192.168.29.210:8081/index.bundle?platform=ios&dev=true&minify=false:33258:33\n__didCompleteResponse@http://192.168.29.210:8081/index.bundle?platform=ios&dev=true&minify=false:33085:29\nemit@http://192.168.29.210:8081/index.bundle?platform=ios&dev=true&minify=false:7038:42\n__callFunction@http://192.168.29.210:8081/index.bundle?platform=ios&dev=true&minify=false:2781:49\nhttp://192.168.29.210:8081/index.bundle?platform=ios&dev=true&minify=false:2503:31\n__guard@http://192.168.29.210:8081/index.bundle?platform=ios&dev=true&minify=false:2735:15\ncallFunctionReturnFlushedQueue@http://192.168.29.210:8081/index.bundle?platform=ios&dev=true&minify=false:2502:21\ncallFunctionReturnFlushedQueue@[native code]","config":{"url":"http://localhost:8080/api/devices","method":"post","data":"{\"uuid\":\"ebd62609-92f4-4745-9c26-0db263e44e76\",\"player_id\":null}","headers":{"Accept":"application/json, text/plain, */*","Content-Type":"application/json;charset=utf-8"},"transformRequest":[null],"transformResponse":[null],"timeout":0,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1}}}
Possible Unhandled Promise Rejection (id: 0):Error: Network ErrorcreateError@http://192.168.29.210:8081/index.bundle?platform=ios&dev=true&minify=false:106824:26handleError@http://192.168.29.210:8081/index.bundle?platform=ios&dev=true&minify=false:106726:27dispatchEvent@http://192.168.29.210:8081/index.bundle?platform=ios&dev=true&minify=false:34174:31setReadyState@http://192.168.29.210:8081/index.bundle?platform=ios&dev=true&minify=false:33258:33__didCompleteResponse@http://192.168.29.210:8081/index.bundle?platform=ios&dev=true&minify=false:33085:29emit@http://192.168.29.210:8081/index.bundle?platform=ios&dev=true&minify=false:7038:42__callFunction@http://192.168.29.210:8081/index.bundle?platform=ios&dev=true&minify=false:2781:49http://192.168.29.210:8081/index.bundle?platform=ios&dev=true&minify=false:2503:31__guard@http://192.168.29.210:8081/index.bundle?platform=ios&dev=true&minify=false:2735:15callFunctionReturnFlushedQueue@http://192.168.29.210:8081/index.bundle?platform=ios&dev=true&minify=false:2502:21callFunctionReturnFlushedQueue@[native code]

Most of the answers found here is solved with 0.0.0.0 binding. Which piece am I missing?

React Native, Element type is invalid expected a string

$
0
0

I am new to React native and I am trying to build a simple tic tac toe app. Everything worked but when I added this code the program would throw an Element type is invalid: expected a string (for-built-in components)

Here is where the problem is

    import React, { Component } from 'react'import { StyleSheet, Text, View,TouchableWithoutFeedback } from 'react-native';import {CENTER_POINTS,AREA} from './gameConstants';import {Cross} from './cross';const styles = StyleSheet.create({    container: {      flex: 1,      backgroundColor: '#fff',        alignItems:"center"    },    player:{        fontSize:30    },    line: {        position: 'absolute',        width: 3,        height: 306,        backgroundColor: '#000',        transform: [          {translateX: 100}        ]      },      board: {        width: 312,        height: 312,        borderWidth: 3,        borderColor: '#000'      }   });export default class Board extends Component{    constructor(){        super()        this.state={            board:[[1,0,0],[0,0,0],[0,0,0]],            result:0,            player:1        };    }    render(){        let {player}=this.state;        let {board}=this.state;        let arr=[]        let key=0;        for(let y=0;y<3;y++){            for(let x=0;x<3;x++){                if(board[y][x]==1){                   arr.push(<Cross key={key} xTranslate={CENTER_POINTS[key].x} yTranslate={CENTER_POINTS[key].y} />)                }                key+=1;            }                   }        return (<View style={styles.container}>                {                    player==1 ?(<Text style={styles.player}>Player 1</Text>                               ):(<Text style={styles.player}>Player 2</Text>                    )                }<TouchableWithoutFeedback><View style={styles.board}><View style={styles.line} /><View                style={[styles.line, {                    width: 3,                    height: 306,                    transform: [                    {translateX: 200}                    ]                }]}            /><View              style={[styles.line, {                width: 306,                height: 3,                transform: [                  {translateY: 100}                ]              }]}            /><View              style={[styles.line, {                width: 306,                height: 3,                transform: [                  {translateY: 200}                ]              }]}            />            { arr }</View></TouchableWithoutFeedback></View>        )    }}

After I added this code it threw the error can anyone help me out?

Here is Cross

    import React, { Component } from 'react'import {  StyleSheet,  Text,  View} from 'react-native'export default class Cross extends Component {  render() {    const { xTranslate, yTranslate, color } = this.props    return (<View style={[styles.container, {        transform: [          {translateX: (xTranslate ? xTranslate : 10) + 35},          {translateY: (yTranslate ? yTranslate : 10) - 12},        ]      }]}><View style={[styles.line, {          transform: [            {rotate: '45deg'},          ],          backgroundColor: color ? color : '#000'        }]} /><View style={[styles.line, {          transform: [            {rotate: '135deg'},          ],          backgroundColor: color ? color : '#000'        }]} /></View>    )  }}const styles = StyleSheet.create({  container: {    position: 'absolute',    width: 80,    height: 80,  },  line: {    position: 'absolute',    width: 8,    height: 105,  },})

Build input file cannot be found: react-native-text-input-mask/ios/Dummy.swift

$
0
0

Cloned my project from the repo. Did an npm install and pod install and tried a project clean and rebuild but am still getting this error even though the Dummy.swift file is present. Is there something I'm missing?

error: Build input file cannot be found: 'app/node_modules/react-native-text-input-mask/ios/Dummy.swift' (in target 'project' from project 'project')

enter image description here

ERROR ITMS-90704: "Missing App Icon." when using "react-native run-ios" to create ipa file for submission

$
0
0

When using "react-native run-ios --device "iPhone" --configuration=release" to build a release app and submit to Apple Store through Transporter and I got the following error. I have drag and drop a 1024 by 1024 pixels image in Images.xcassets/AppIcon on Xcode.

ERROR ITMS-90704: "Missing App Icon. An app icon measuring 1024 by 1024 pixels in PNG format must be included in the Asset Catalog of apps built for iOS, iPadOS, or watchOS. Without this icon, apps cannot be submitted for review. For details, see https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/app-icon/."

How to use "react-native run-ios" to create a release ipa file?

Regards,Yun

How do you change the "Display Name" of a React Native app in XCode?

$
0
0

I have a React Native app that has Display Name theApp:

enter image description here

I want to change it to The App. However, I'm hesitant to just change it in that box in XCode because there are now instances of theApp elsewhere in the autogenerated code, and in the Bundle Identifier etc.

Has anyone changed a Display Name like this before? Do you know how I should approach it?

Back and Forth navigation with data between React Native Screen and iOS Native Screen

$
0
0

We have two screens in our React Native mobile app. Screen 1 in built in RN code(Javascript) whereas other Screen 2 is built in iOS native code(Swift). App has to navigate from Screen 1 to Screen 2 and come back with some contextual data(acquired at Screen 2) to Screen 1. So in other words, RN screen/page navigates to iOS Native screen/page, collects some user inputs there and goes back to RN screen with the collecfted data which makes use of this data to proceed further.

We have done the same in "RN to Android Native back navigation with data" scenario with methods like StartActivityForResult(...), SetResult(...), finish() and some listners in Android Native Module to support this. Having no iOS expertise available with us atm, We are looking for help (reference/blog/GitHub code/gist) to address this "RN to iOS back navigation with data" scenario.Any help is welcome and appreciated.


Why is my React Native app crashing on start without any error?

$
0
0

My React Native app works perfectly fine on the iOS simulator, but does not work when running on my iOS device. It simply shows the splash screen, then crashes without any error.

I have tried:

  1. Deleting and reinstalling node_modules
  2. Deleting iOS build folder
  3. Resetting watchman cache with react-native start --reset-cache

But nothing seems to work.

The version of CocoaPods used to generate the lockfile (1.5.3) is higher than the version of the current executable (1.5.2)

Can't get background tasks to work in React-Native

$
0
0

I need to frequently write into a text file, let's say write a timestamp into a file with react-native in iOS and android. I wrote an app by the help of the following libraries. On android, the app is working perfectly fine, but on iOS not working properly.

I tried to use these libraries:

  1. react-native-background-task
  2. react-native-background-fetch
  3. react-native-background-queue + react-native-background-task

But none of them works fine:

  1. with react-native-background-task: the file is written randomly 5-6times a day or less
  2. with react-native-background-fetch: the file is written randomly 3-4 times a day or less
  3. react-native-background-queue + react-native-background-task: thefile is not written AT ALL!

Would you please tell me if these behaviors are normal, and if not, what am I doing wrong???

Any help would be greatly appreciated.

Here are my codes:

In order to use react-native-background-task:

import React from 'react'import Mytest from './test';import BackgroundTask from 'react-native-background-task'import {    Text,    View,  } from 'react-native';BackgroundTask.define(() => {  console.log('Hello from a background task')  Mytest.writeFiles()  BackgroundTask.finish()})export default class MyApp extends React.Component {  componentDidMount() {    BackgroundTask.schedule()  }  render() {    return(<View><Text>Hello world</Text></View>)  }}

In order to use react-native-background-fetch:

import React, { Component } from 'react';import {    Text,    View,    StyleSheet  } from 'react-native';import BackgroundFetch from "react-native-background-fetch";var RNFS = require('react-native-fs');var path = RNFS.DocumentDirectoryPath +'/fetch.txt';var count = 0export default class App extends Component {  constructor(props) {    super(props);    this.state = {      date: '',    }  }  componentDidMount() {    BackgroundFetch.configure({      stopOnTerminate: false,      startOnBoot: true,      requiredNetworkType: BackgroundFetch.NETWORK_TYPE_NONE,      requiresCharging: false,      // Default      requiresDeviceIdle: false,    // Default      requiresBatteryNotLow: false, // Default      requiresStorageNotLow: false  // Default    }, () => {      console.log("[js] Received background-fetch event");      this.writeFiles()      BackgroundFetch.finish(BackgroundFetch.FETCH_RESULT_NEW_DATA);    }, (error) => {      console.log("[js] RNBackgroundFetch failed to start");    });    BackgroundFetch.status((status) => {      switch(status) {        case BackgroundFetch.STATUS_RESTRICTED:          console.log("BackgroundFetch restricted");          break;        case BackgroundFetch.STATUS_DENIED:          console.log("BackgroundFetch denied");          break;        case BackgroundFetch.STATUS_AVAILABLE:          console.log("BackgroundFetch is enabled");          break;      }    });  }  render() {        return (<View style={styles.container}><Text style={styles.welcome}>              Welcome to React Native!</Text></View>        );      }  getDate() {    var that = this;    var date = new Date().getDate(); //Current Date    var month = new Date().getMonth() + 1; //Current Month    var year = new Date().getFullYear(); //Current Year    var hours = new Date().getHours(); //Current Hours    var min = new Date().getMinutes(); //Current Minutes    var sec = new Date().getSeconds(); //Current Seconds    that.setState({      date:        date +'/'+ month +'/'+ year +''+ hours +':'+ min +':'+ sec,    });  }writeFiles = async () => {  this.getDate()    try {      for(let i = 0; i < 1; i++){        count = count + 1;        console.log(count);        RNFS.appendFile(path, '  \n  '+ count +'  \n  '+ this.state.date , 'utf8')        .then((success) => {        })      }    }catch (err) {      console.warn("error", err);    } }          };

In order to use react-native-background-queue + react-native-background-task:

import React, { Component } from 'react';import Mytest from './test';import BackgroundTask from 'react-native-background-task'import {Platform,...} from 'react-native';import queueFactory from 'react-native-queue';BackgroundTask.define(async () => {  queue = await queueFactory();  queue.addWorker('background-example', async (id, payload) => {  if (payload.name == 'sima') {     Mytest.writeFiles()     console.log('Hello from a background task ')}  });  await queue.start(20000);   BackgroundTask.finish();});export default class App extends Component<{}> {  constructor(props) {    super(props);    this.state = {      queue: null,      data: null,    };    this.init();  }  async init() {    const queue = await queueFactory();    queue.addWorker('background-example', async (id, payload) => {    });    this.setState({      queue    });  }  componentDidMount() {    BackgroundTask.schedule();   }  makeJob(jobName, payload = {}) {    console.log('job is created but will not execute until the above OS background task runs in ~15 min');    this.state.queue.createJob(jobName, payload, {     timeout: 5000    }, false);   }  render() {    let output = 'No data loaded from OS background task yet.';    if (this.state.data) {      output = JSON.stringify(this.state.data);    }    return (<View style={styles.container}><Text style={styles.welcome}>          Welcome to React Native!</Text><Text>Click buttons below to add OS background task jobs.</Text><Text>Then Close App (task will not fire if app is in focus).</Text><Text>Job will exec in ~15 min in OS background.</Text>        {this.state.queue && <Button title={"Press To Queue sima Job"} onPress={ () => { this.makeJob('background-example', { name: 'sima' }) } } /> }        {this.state.queue && <Button title={"Press To Queue another Job"} onPress={ () => { this.makeJob('background-example', { name: 'simsim' }) } } /> }<Text>{output}</Text></View>    );  }}const styles = StyleSheet.create({  container: {    flex: 1,    justifyContent: 'center',    alignItems: 'center',    backgroundColor: '#F5FCFF',  },  welcome: {    fontSize: 20,    textAlign: 'center',    margin: 10,  },});

And here is test.js:

var RNFS = require('react-native-fs');var path = RNFS.DocumentDirectoryPath +'/test.txt';var count = 0;const Mytest = {  writeFiles: () => {    var that = this;    var date = new Date().getDate(); //Current Date    var month = new Date().getMonth() + 1; //Current Month    var year = new Date().getFullYear(); //Current Year    var hours = new Date().getHours(); //Current Hours    var min = new Date().getMinutes(); //Current Minutes    var sec = new Date().getSeconds(); //Current Seconds    var date = date +'/'+ month +'/'+ year +''+ hours +':'+ min +':'+ sec      try {        for(let i = 0; i < 1; i++){          count = count + 1;          console.log(count);          RNFS.appendFile(path, '  \n  '+ count +'  \n  '+ date , 'utf8')          .then((success) => {            console.log('FILE WRITTEN!');          })        }      }catch (err) {        console.warn("error", err);      }   }  }  export default Mytest;

How to fix React Native App not building for iOS

$
0
0

I'm having trouble building my react native app for iOS. For android it builds perfectly fine. For iOS, the project will build but not archive. Here is the error code when attempting to archive my project:

1) Target 'React-Core.common-AccessibilityResources' has create directory command with output '/Users/jacobcarpenter/Library/Developer/Xcode/DerivedData/LFGOPocker-gaqwcsmtamkdjtbdiwhnzcvmexjk/Build/Intermediates.noindex/ArchiveIntermediates/LFGOPocker/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AccessibilityResources.bundle'2) Target 'React-Core.common-CoreModulesHeaders-AccessibilityResources' has create directory command with output '/Users/jacobcarpenter/Library/Developer/Xcode/DerivedData/LFGOPocker-gaqwcsmtamkdjtbdiwhnzcvmexjk/Build/Intermediates.noindex/ArchiveIntermediates/LFGOPocker/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AccessibilityResources.bundle'

Few things to state:Running React-native 0.63,Podfile and deployment targets are all on 11

Edit: when running from the command line I receive this error

'/Users/jacobcarpenter/Library/Developer/Xcode/DerivedData/LFGOPocker-bzowsupbiktzuzaaadvokqxbgvzq/Build/Intermediates.noindex/ArchiveIntermediates/LFGOPocker/BuildProductsPath/Release-iphoneos/YogaKit/YogaKit.modulemap'      not found```

TouchableOpacity only responds with a light touch

$
0
0

I am currently trying to create an app using React native and I have multiple touchable opacity image buttons on different pages. However, whenever I click on any of the touchable opacity image buttons, it will ONLY work with a light tap/touch rather than a normal press on apps. I tried doing hit slop and it still doesn't avoid the issue of a light tap. Can someone please guide me on how to make this work as I have been stuck on this for days.

<TouchableOpacity      onPress={() =>        this.props.navigation.navigate("Track", {          currentDate: this.state.currentDate,        })      }><Image        style={HomeStyles.ovalContainer}        source={require("../../assets/oval.png")}      /></TouchableOpacity>

Thank you

Viewing all 17156 articles
Browse latest View live


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