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

Detox - iOS - launchApp timeout

$
0
0

I have a basic app that can be run and works on an iOS simulator but, when I try to run Detox tests, launchingApp seems not to be working. The app is a basic calculator that I can use and perform any manual test. All of the manual tests are working fine, but this is failing:

System (I know there are newer version, but I have to work with this ones if possible)

  • Detox: 12.11.3
  • react-native-cli: 2.0.1
  • react-native: 0.31.0
  • Node: 12.16.3
  • Device: iOS Simulator (iPhone 8,iOS 13.4)
  • Xcode: 11.4.1
  • iOS: 13.4
  • macOS: 10.15.4

init.js

const detox = require('detox');const config = require('../package.json').detox;before(async () => {  console.log("before init");  await detox.init(config, { launchApp: false });  console.log("after init");});after(async () => {  await detox.cleanup();});

sampleTest.spec.js

describe('Basic test', function () {  beforeEach(async () => {    console.log("before app launched");    await device.launchApp({      newInstance: true,      launchArgs: { 'detoxPrintBusyIdleResources': 'YES' }    });    console.log("After app launched");  });  it('2 + 2 = 4', async () => {    console.error("Test case running");    await element(by.id('input-button-2')).tap();    await element(by.id('input-button-+')).tap();    await element(by.id('input-button-2')).tap();    await element(by.id('input-button-=')).tap();    await expect(element(by.id('display-text'))).toHaveText('4');  })});

package.json

{"name": "ReactCalculator","version": "0.0.1","private": true,"scripts": {"start": "node node_modules/react-native/local-cli/cli.js start","postinstall": "make postinstall"  },"dependencies": {"react": "15.2.1","react-native": "0.31.0","detox": "^12.11.0","mocha": "^6.1.4"  },"detox": {"configurations": {"ios.sim.debug": {"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/ReactCalculator.app","build": "xcodebuild -project ios/ReactCalculator.xcodeproj -scheme ReactCalculator -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build","type": "ios.simulator","name": "iPhone 8,iOS 13.4"      }    },"test-runner": "mocha","runner-config": "./mocha.opts","specs": ""  }}

Log I see in the console

detox testdetox[4407] INFO:  [test.js] node_modules/.bin/mocha --opts ./mocha.opts --configuration ios.sim.debug --grep :android: --invert --artifacts-location "artifacts/ios.sim.debug.2020-05-02 16-48-45Z""e2e"before initdetox[4408] INFO:  [DetoxServer.js] server listening on localhost:53253...after init  Basic testbefore app launcheddetox[4408] INFO:  [AppleSimUtils.js] org.reactjs.native.example.ReactCalculator launched. To watch simulator logs, run:        /usr/bin/xcrun simctl spawn 410A2B91-5C4B-4DA8-97C9-F16E4EE2A3FB log stream --level debug --style compact --predicate 'processImagePath beginsWith "/Users/myuser/Library/Developer/CoreSimulator/Devices/410A2B91-5C4B-4DA8-97C9-F16E4EE2A3FB/data/Containers/Bundle/Application/FF32A1C3-F0C5-4847-AD0A-B559FCC4D78E/ReactCalculator.app"'    1) "before each" hook for "2 + 2 = 4"  0 passing (2m)  1 failing  1) Basic test"before each" hook for "2 + 2 = 4":     Error: Timeout of 120000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/myuser/Desktop/ReactCalculator 2/e2e/sampleTest.spec.js)      at listOnTimeout (internal/timers.js:549:17)      at processTimers (internal/timers.js:492:7)detox[4407] ERROR: [cli.js] Error: Command failed: node_modules/.bin/mocha --opts ./mocha.opts --configuration ios.sim.debug --grep :android: --invert --artifacts-location "artifacts/ios.sim.debug.2020-05-02 16-48-45Z""e2e"

I have followed step-by-step this tutorial to install it: Detox getting started

Do someone have a clue of what is going on? I know I am not using the last versions of many dependencies but it is supposed to work like that.


react-native-webview not support mathemetical tags in Android

$
0
0

Below html tag not showing properly in android but in iOS its work fine.

"<p><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><mn>6</mn><msqrt><mn>79</mn></msqrt><mo>&#160;</mo><mo>+</mo><msup><mn>88</mn><mn>87</mn></msup><mo>&#160;</mo><mo>=</mo><mo>?</mo></math></p>\r\n\r\n<p>Testing</p>\r\n"

My Source Code:

const htmlText = "<p><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><mn>6</mn><msqrt><mn>79</mn></msqrt><mo>&#160;</mo><mo>+</mo><msup><mn>88</mn><mn>87</mn></msup><mo>&#160;</mo><mo>=</mo><mo>?</mo></math></p>\r\n\r\n<p>Testing</p>\r\n"<WebView          style={{            width: Dimensions.get('window').width,          }}          scrollEnabled={false}          scalesPageToFit={true}          source={html: htmlText}          viewportContent={"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"}      />

Expected Result :enter image description here

How to let the user import a file from local device in react native?

$
0
0

I am building a react native project and I need to give the user the option to import a .csv file from their local device, and that file will be sent to the server, how can I do that?

net::ERR_CACHE_MISS on Android 5.0, 5.1

$
0
0

I use Android Version 5.0.2

In my React Native, I use the bellow code

import React, { Component } from 'react';import { WebView } from 'react-native-webview';class google extends Component {   render() {      return (<WebView            source={{uri: 'https://www.google.com/'}}            style={{marginTop: 20}}             ref={ref => { this.webView = ref; }}             // onError={ ()=>{ this.webView.reload(); } }          />      );   }}export default google;

when I run on iOS, the output is perfect but in Android device it gives error:

enter image description here

Guys kindly fix this error so that I can run my app on every device

Detox - iOS - launchApp never launches the app

$
0
0

I have a basic app that can be run and works on an iOS simulator but, when I try to run Detox tests, launchingApp seems not to be working. The app is a basic calculator that I can use and perform any manual test. All of the manual tests are working fine, but this is failing:

System (I know there are newer version, but I have to work with this ones if possible)

  • Detox: 12.11.3
  • react-native-cli: 2.0.1
  • react-native: 0.31.0
  • Node: 12.16.3
  • Device: iOS Simulator (iPhone 8,iOS 13.4)
  • Xcode: 11.4.1
  • iOS: 13.4
  • macOS: 10.15.4

init.js

const detox = require('detox');const config = require('../package.json').detox;before(async () => {  console.log("before init");  await detox.init(config, { launchApp: false });  console.log("after init");});after(async () => {  await detox.cleanup();});

sampleTest.spec.js

describe('Basic test', function () {  beforeEach(async () => {    console.log("before app launched");    await device.launchApp({      newInstance: true,      launchArgs: { 'detoxPrintBusyIdleResources': 'YES' }    });    console.log("After app launched");  });  it('2 + 2 = 4', async () => {    console.error("Test case running");    await element(by.id('input-button-2')).tap();    await element(by.id('input-button-+')).tap();    await element(by.id('input-button-2')).tap();    await element(by.id('input-button-=')).tap();    await expect(element(by.id('display-text'))).toHaveText('4');  })});

package.json

{"name": "ReactCalculator","version": "0.0.1","private": true,"scripts": {"start": "node node_modules/react-native/local-cli/cli.js start","postinstall": "make postinstall"  },"dependencies": {"react": "15.2.1","react-native": "0.31.0","detox": "^12.11.0","mocha": "^6.1.4"  },"detox": {"configurations": {"ios.sim.debug": {"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/ReactCalculator.app","build": "xcodebuild -project ios/ReactCalculator.xcodeproj -scheme ReactCalculator -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build","type": "ios.simulator","name": "iPhone 8,iOS 13.4"      }    },"test-runner": "mocha","runner-config": "./mocha.opts","specs": ""  }}

Log I see in the console

detox testdetox[4407] INFO:  [test.js] node_modules/.bin/mocha --opts ./mocha.opts --configuration ios.sim.debug --grep :android: --invert --artifacts-location "artifacts/ios.sim.debug.2020-05-02 16-48-45Z""e2e"before initdetox[4408] INFO:  [DetoxServer.js] server listening on localhost:53253...after init  Basic testbefore app launcheddetox[4408] INFO:  [AppleSimUtils.js] org.reactjs.native.example.ReactCalculator launched. To watch simulator logs, run:        /usr/bin/xcrun simctl spawn 410A2B91-5C4B-4DA8-97C9-F16E4EE2A3FB log stream --level debug --style compact --predicate 'processImagePath beginsWith "/Users/myuser/Library/Developer/CoreSimulator/Devices/410A2B91-5C4B-4DA8-97C9-F16E4EE2A3FB/data/Containers/Bundle/Application/FF32A1C3-F0C5-4847-AD0A-B559FCC4D78E/ReactCalculator.app"'    1) "before each" hook for "2 + 2 = 4"  0 passing (2m)  1 failing  1) Basic test"before each" hook for "2 + 2 = 4":     Error: Timeout of 120000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/myuser/Desktop/ReactCalculator 2/e2e/sampleTest.spec.js)      at listOnTimeout (internal/timers.js:549:17)      at processTimers (internal/timers.js:492:7)detox[4407] ERROR: [cli.js] Error: Command failed: node_modules/.bin/mocha --opts ./mocha.opts --configuration ios.sim.debug --grep :android: --invert --artifacts-location "artifacts/ios.sim.debug.2020-05-02 16-48-45Z""e2e"

I have followed step-by-step this tutorial to install it: Detox getting started

Do someone have a clue of what is going on? I know I am not using the last versions of many dependencies but it is supposed to work like that.

Open react native project in xcode

$
0
0

I'm sure I'm missing something simple. I have a React Native project working and I'm attempting to get it on the app stores. Following those instructions, after I have created my provisioning profile in the Apple Developer Dashboard, it says to double click the developer provisioning profile to launch xcode. It's these instructions exactly:

Now find the files you just downloaded on your computer, and double-click each of them in turn, causing Xcode to launch. Verify the profiles are there by opening a project or starting a new one for this test.

So I double-click my file, and xcode does launch but no windows open up. I do not have an xcode project for my react native app so I have nothing to open. There is no menus for 'build settings' or 'general' so I'm not sure how to proceed.

For reference, here is my react native directory structure:

my_project/    .expo/    assets/    node_modules/    src/    .bablerc    .gitignore    App.js    app.json    package-lock.json    package.json    README.md

Did I miss a step somewhere? How do I get an xcode project from this?

React native animation loop hooks

$
0
0

I have to make the loops spin.

So I have degree = 0 which must gradually reach degree = 360, and then start from 0 and return to 360 and so on.

I tried this way but it's not working, where am I doing wrong?

 const grado = React.useRef(new Animated.Value(0)).current;  React.useEffect(() => {    /*Animated.loop(      Animated.timing(grado, {        toValue: 1,        duration: 300,        easing: Easing.linear,      })    ).start();*/    Animated.loop(      Animated.spring(grado, {        toValue: 1,        friction: 1,      }),      { iterations: 1000 }    ).start();  }, []);  const spinT = grado.interpolate({    inputRange: [0, 1],    outputRange: [0, 360],  });

Link: snack

import React, { useState } from 'react';import { StyleSheet, View, Animated, Text, Easing } from 'react-native';import Svg, { Circle, G } from 'react-native-svg';const AnimatedCircle = Animated.createAnimatedComponent(Circle);export default ({  image,  width,  height,  innerCircle = false,  innerCircleRadius = 13,  innerCircleFillPercentage = 25,  innerCircleStroke = '#143c5b',  innerCircleStrokeAnimated = '#02ac8a',  outerCircle = false,  outerCircleRadius = 18,  outerCircleFillPercentage = 50,  outerCircleStroke = '#1f4a42',  outerCircleStrokeAnimated = '#028cfe',  degree,}) => {  const innerCirclePerimeter = 2 * Math.PI * innerCircleRadius;  const innerCircleStrokeDashOffset =    innerCirclePerimeter -    (innerCirclePerimeter * innerCircleFillPercentage) / 100;  const outerCirclePerimeter = 2 * Math.PI * outerCircleRadius;  const outerCircleStrokeDashOffset =    outerCirclePerimeter -    (outerCirclePerimeter * outerCircleFillPercentage) / 100;  const [springValue] = useState(new Animated.Value(1.3));  const [innerCircleInitialFill] = useState(    new Animated.Value(innerCirclePerimeter)  );  const [outerCircleInitialFill] = useState(    new Animated.Value(outerCirclePerimeter)  );  React.useEffect(() => {    Animated.parallel([      Animated.timing(innerCircleInitialFill, {        toValue: innerCircleStrokeDashOffset,        duration: 1000,      }),      Animated.timing(outerCircleInitialFill, {        toValue: outerCircleStrokeDashOffset,        duration: 2000,      }),      Animated.spring(springValue, {        toValue: 1,        friction: 1,      }),    ]).start();  }, [    innerCircleInitialFill,    outerCircleInitialFill,    springValue,    innerCircleStrokeDashOffset,    outerCircleStrokeDashOffset,  ]);  const outer = () => {    return (      outerCircle && (<><Circle            cx="25"            cy="25"            r={outerCircleRadius}            fill="transparent"            stroke={outerCircleStroke}            strokeDasharray="10, 1"            strokeDashoffset="30"            strokeWidth={0.5}          /><AnimatedCircle            cx="25"            cy="25"            r={outerCircleRadius}            fill="transparent"            stroke={innerCircleStrokeAnimated}            strokeDasharray={outerCirclePerimeter}            strokeDashoffset={outerCircleInitialFill}            strokeLinecap={'round'}          /></>      )    );  };  const inner = () => {    return (      innerCircle && (<><Circle            cx="25"            cy="25"            r={innerCircleRadius}            fill="transparent"            stroke={innerCircleStroke}            strokeDasharray="1"            strokeWidth={0.5}          /><AnimatedCircle            cx="25"            cy="25"            r={innerCircleRadius}            fill="transparent"            stroke={outerCircleStrokeAnimated}            strokeDasharray={innerCirclePerimeter}            strokeDashoffset={innerCircleInitialFill}            strokeLinecap={'round'}          /></>      )    );  };  const Image = () => (<View      style={{        position: 'absolute',        justifyContent: 'center',        alignItems: 'center',        top: 0,        left: 0,        right: 0,        bottom: 0,      }}><Animated.Image        source={image}        style={[          styles.image,          {            width,            height,            borderRadius: width * 0.5,            transform: [{ scale: springValue }],          },        ]}      /></View>  );  //console.log(degree, height * Math.cos(degree), width * Math.sin(degree));  const grado = React.useRef(new Animated.Value(0)).current;  React.useEffect(() => {    /*Animated.loop(      Animated.timing(grado, {        toValue: 1,        duration: 300,        easing: Easing.linear,      })    ).start();*/    Animated.loop(      Animated.spring(grado, {        toValue: 1,        friction: 1,      }),      { iterations: 1000 }    ).start();  }, []);  const spinT = grado.interpolate({    inputRange: [0, 1],    outputRange: [0, 360],  });  console.log('c', grado, spinT);  const spin = 45;  return (<View      style={[        styles.container,        {          //width: width * 1.5,          //height: height * 1.5,          //borderRadius: 2 * Math.PI * outerCircleRadius,          backgroundColor: '#cccccca1',        },      ]}><View><Svg          viewBox={`0 0 50 50`}          width={width * 2.5}          height={height * 2.5}          style={{            transform: [{ rotateZ: '-90deg' }],          }}><G>            {outer()}            {inner()}</G></Svg>        {Image()}<Text          style={{            fontSize: width * 0.12,            fontWeight: 'bold',            color: '#ffffff',            position: 'absolute',            justifyContent: 'center',            alignItems: 'center',            textAlign: 'center',            display: 'flex',            top:              height -              height * Math.cos((spinT * Math.PI) / 180) +              (height * 0.2) / 2,            left:              width +              width * Math.sin((spinT * Math.PI) / 180) +              (width * 0.2) / 2,            backgroundColor: '#1393DB',            borderRadius: 10,            width: width * 0.2,            height: height * 0.2,            shadowColor: '#000',            shadowOffset: {              width: 0,              height: 2,            },            shadowOpacity: 0.25,            shadowRadius: 3.84,            elevation: 5,          }}>          21</Text></View></View>  );};const styles = StyleSheet.create({  container: {    justifyContent: 'center',    alignItems: 'center',    //backgroundColor: 'rgba(168, 152, 50, 0.5)',  },});

Detect if picture of picture taken in mobile app

$
0
0

I am working on a face recognition app where the picture is taken and sent to server for recognition.

I have to add a validation that user should capture picture of real person and of another picture. I have tried a feature of eye blink and in which the camera waits for eye blink and captures as soon as eye is blinked, but that is not working out because it detects as eye blink if mobile is shaken during capture.

Would like to ask for help here, is there any way that we can detect if user is capturing picture of another picture. Any ideas would help.

I am using react native to build both Android and iOS apps.

Thanks in advance.


Is there any way to run a foreground service in react native?

react-native-webview commands failed to compile, how to fix?

$
0
0

someone has fixed or saw this issue?

I'm using last version of (react-native) and also macOS Catalina.I did install react-native-webview by yarn and after into the (./ios) folder I had install the pods.

So build failed, after react-native run-ios.

    The following build commands failed:            CompileC /Users/mymac/Library/Developer/Xcode/DerivedData/Project-cnketoyhxyitfqbbcdkdvhpuajey/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/react-native-webview.build/Objects-normal/x86_64/RNCWebView.o /Users/mymac/Desktop/React/project/node_modules/react-native-webview/apple/RNCWebView.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler    (1 failure)

How to play react-native-webview audio while the iPhone is muted?

$
0
0

I'm currently running an Expo project with react-native-webview 9.4.0 installed, and I'm trying to use the WebView to play audio from a local .html file with a custom JS script using the Web Audio API. The audio works fine on the iOS simulator and on an iPhone when not on Silent Mode, but once I turn on Silent Mode it's impossible to get any audio to play.

There seems to have been a couple attempts to fix this issue over the past couple months (https://github.com/react-native-community/react-native-webview/pull/1218) and (https://github.com/react-native-community/react-native-webview/issues/1140), but even with the most recent version of react-native-webview I still can't get the Web Audio to play with the iPhone muted. I've tried various workarounds from StackOverflow without any success either. Does anyone else have this issue or have a workaround to suggest?

Started React Native With Swift Instead Of Objective C

$
0
0

So I started a react native app using create-react-native-app and it created a lot of boilerplate code. Android is in Java which I am fine with. But the IOS is in Objective C and I am more familiar with Swift. Is there anything I can do about that? I know most of my code is going to be in Javascript anyways, but just wondering anyways.

How to show moving direction React Native

$
0
0

I'm using this package for location tracking and using Firebase. then how to show moving direction on map like if moving west my location turns into looking west. I didn't find anything like this. It's so new thing for me.

BackgroundGeolocation.configure({        desiredAccuracy: BackgroundGeolocation.LOW_ACCURACY,        stationaryRadius: 120,        distanceFilter: 120,        notificationTitle: 'Background tracking',        notificationText: 'enabled',        debug: true,        startOnBoot: false,        stopOnTerminate: true,        locationProvider: BackgroundGeolocation.DISTANCE_FILTER_PROVIDER,        interval: 30000,        fastestInterval: 30000,        activitiesInterval: 30000,        stopOnStillActivity: true,        url: 'URL!',        httpHeaders: {'X-FOO': 'bar',        },        postTemplate: {            lat: '@latitude',            lon: '@longitude',        }    })

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 in background mode

$
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 in background mode. I added code inside didReceiveRemoteNotification method of AppDelegate. But this method is not called regularly. It called occasionally. Any idea on this?

React Native libc++abi.dylib: terminating with uncaught exception of type NSException

$
0
0

I'm trying to create my first react native iOS app.Currently I'm following Facebook React Native Docs to get started but unfortunately I've stumbled upon a problem on my first react-native run-ios. I can't run inital app properly for some reason.

I'm working on Macbook Air with OSX El Capitan (Version 10.11.5) and latest Xcode (Version 8.0 (8A218a)).

Screenshot and Error message:

Here you can see Window Screenshot

2016-09-28 11:06:00.065533 HelloWorld[1589:92816] bundleid: org.reactjs.native.example.HelloWorld, enable_level: 0, persist_level: 0, propagate_with_activity: 02016-09-28 11:06:00.068463 HelloWorld[1589:92816] subsystem: com.apple.siri, category: Intents, enable_level: 1, persist_level: 1, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0, enable_private_data: 02016-09-28 11:06:00.131054 HelloWorld[1589:93235] subsystem: com.apple.UIKit, category: HIDEventFiltered, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 02016-09-28 11:06:00.132294 HelloWorld[1589:93235] subsystem: com.apple.UIKit, category: HIDEventIncoming, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 02016-09-28 11:06:00.171878 HelloWorld[1589:93231] subsystem: com.apple.BaseBoard, category: MachPort, enable_level: 1, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0, enable_private_data: 02016-09-28 11:06:00.222728 HelloWorld[1589:92816] subsystem: com.apple.UIKit, category: StatusBar, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 02016-09-28 11:06:00.281 HelloWorld[1589:92816] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/alen/Library/Developer/CoreSimulator/Devices/95895E4B-4F37-4E4B-BE5E-CD9C38966986/data/Containers/Bundle/Application/F09DF533-2E7A-411F-9698-DCBE1560C2DD/HelloWorld.app> (loaded)' with name 'Main''*** First throw call stack:(    0   CoreFoundation                      0x000000010fdab34b __exceptionPreprocess + 171    1   libobjc.A.dylib                     0x000000010ecbb21e objc_exception_throw + 48    2   CoreFoundation                      0x000000010fe14265 +[NSException raise:format:] + 197    3   UIKit                               0x000000011273401a -[UINib instantiateWithOwner:options:] + 507    4   UIKit                               0x0000000112736803 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 223    5   UIKit                               0x000000011232761c -[UIApplication _loadMainNibFileNamed:bundle:] + 75    6   UIKit                               0x0000000112327c13 -[UIApplication _loadMainInterfaceFile] + 260    7   UIKit                               0x0000000112326274 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1406    8   UIKit                               0x0000000112323539 -[UIApplication workspaceDidEndTransaction:] + 188    9   FrontBoardServices                  0x00000001157b276b __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24    10  FrontBoardServices                  0x00000001157b25e4 -[FBSSerialQueue _performNext] + 189    11  FrontBoardServices                  0x00000001157b296d -[FBSSerialQueue _performNextFromRunLoopSource] + 45    12  CoreFoundation                      0x000000010fd50311 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17    13  CoreFoundation                      0x000000010fd3559c __CFRunLoopDoSources0 + 556    14  CoreFoundation                      0x000000010fd34a86 __CFRunLoopRun + 918    15  CoreFoundation                      0x000000010fd34494 CFRunLoopRunSpecific + 420    16  UIKit                               0x0000000112321db6 -[UIApplication _run] + 434    17  UIKit                               0x0000000112327f34 UIApplicationMain + 159    18  HelloWorld                          0x000000010e3697ff main + 111    19  libdyld.dylib                       0x0000000113cfc68d start + 1)libc++abi.dylib: terminating with uncaught exception of type NSException

Hope someone will help me with this so I can write some code, thanks in advance!


How to explore NSBundle contents?

$
0
0

I've got NSBundle file named main.jsbundle packaged by react-native bundle, which tool I can use to explore it's contents? I can see that it got the minified js code inside, and also some sort of index at the beginning of file. I need to extract the js code in order to debug an issue.

How to align text input correctly in react native?

$
0
0

The Text input is center aligned, how to fix this text input so that it takes input from top left corner

The Text input is center aligned, how to fix this text input so that it takes input from top left corner

Here is my css for text input

/* The Text input is center aligned, how to fix this text input so that it takes input from top left corner */input: {  flex: 1, padding: 4, marginRight: 1, marginTop: 5, fontSize: 18, borderWidth: 1, borderRadius: 4, borderColor: '#E6E5ED', backgroundColor: '#F8F8F9', justifyContent: 'flex-start', height: 150}

Cropping multiple images in react native

$
0
0

What would be the right approach to crop several images at ones in React Native? I'm working on an app where user selects many photos but before uploading them to the server, each photo should have the right aspect ratio - 1:1, 2:3, etc.

I'm using react-native-image-crop-picker to allow user to select multiple photos at ones. Initially I used to same library to allow users to crop one photo at a time but it was a bad user experience as people upload 10-20 photos at a time. So I thought of auto-cropping images behind the scene using ImageEditor.cropImage()

Now I get the cropped image but it almost freezes the app until the images are cropped, leading to bad ux. Any leads on how this should be tackled?

react-native send image form data success with emu but error 422 on real device

$
0
0

so this is my problem :my code just returning error 422 when send data from real devices, but doing good on emulator here is my form data code :

const data = new FormData();data.append('approval_store_code', this.state.selectedApotik.store_code);data.append('delivery_method_id', 1);data.append('recipe_document_images[]', {  name: 'recipePhotos1',  type: 'image/jpeg',  uri:    Platform.OS === 'android'      ? this.state.imageResep[0].uri      : this.state.imageResep[0].uri.replace('file://', ''),});

and this is the code when i send to server

      this.setState({spinner: true});      const response = await REQ.createRecipe(this.state.accessToken, data);      console.log(response);      if (response.status == 200) {        console.log(response);        this.setState({spinner: false});        this.props.navigation.navigate('SuccessFormPharmacy');      } else {        alert('error');        this.setState({spinner: false});      }    } catch (error) {      this.setState({spinner: false});      console.log('error send data : ', error);      alert('error send Data!');      return null;    }

the axios code :

return axios({    method: 'POST',    url: `${API.BASE_URL}/v1/pharmacy/order`,    headers: {'Content-Type': 'application/x-www-form-urlencoded',      Authorization: `Bearer ${accessToken}`,    },    body: formData,  });

the weird thing is, i have try using fetch instead of axios, didn't work for real device, but doing good on emulatori have try save the image first to devices, it saved but didn't success sent to server

on real device returning Error 422

iOS Video Caching - Manual cache deletion

$
0
0

I have a React Native application which uses React Native Video with iOS caching. I have been working on a method inside RCTVideoCache.m which would manually delete the data of a particular cache key. According to the documentation of SPTPersistentCache, which the video library uses for caching, data can be deleted either by locking/unlocking a file and invoking a wipe or after inspecting the source code of SPTPersistentCache.h with a method named removeDataForKeys.

I have tried both ways, however, unsuccessfully.

In my first try, I am using wipeLockedFiles. I have created a deleteFromCache() method inside RCTVideoCache.m. Since all my video files are unlocked by default, in this method I am trying to lock the file corresponding to my cacheKey and invoke a wipe on all locked files (which would consist of only my target cacheKey file) as it is demonstrated in the documentation. This method looks like:

- (void)deleteFromCache:(NSString *)cacheKey withCallback:(void(^)(BOOL))handler;{  [self.videoCache lockDataForKeys:@[cacheKey] callback:nil queue:nil];  [self.videoCache wipeLockedFiles];  NSLog(@"Size = %@", @(self.videoCache.totalUsedSizeInBytes));  handler(YES);}

The following results in two errors during compilation:

/Users/.../MyApp/node_modules/react-native-video/ios/VideoCaching/RCTVideoCache.m:79:20: error: no visible @interface for 'SPTPersistentCache' declares the selector 'lockDataForKeys:callback:queue:'  [self.videoCache lockDataForKeys:@[cacheKey] callback:nil queue:nil];   ~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/Users/.../MyApp/node_modules/react-native-video/ios/VideoCaching/RCTVideoCache.m:80:20: error: no visible @interface for 'SPTPersistentCache' declares the selector 'wipeLockedFiles'  [self.videoCache wipeLockedFiles];   ~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~

I really have no idea why these selectors are not visible from SPTPersistentCache.

In my second try, I am using removeDataForKeys(). Again, I have created a deleteFromCache() method inside RCTVideoCache.m which looks like this:

- (void)deleteFromCache:(NSString *)cacheKey withCallback:(void(^)(BOOL))handler;{  [self.videoCache removeDataForKeys:@[cacheKey] callback:^(SPTPersistentCacheResponse * _Nonnull response) {    NSLog(@"Result output: %@", response.output);    NSLog(@"Error output: %@", [response.error localizedDescription]);   } onQueue:dispatch_get_main_queue()];  NSLog(@"Size = %@", @(self.videoCache.totalUsedSizeInBytes));  handler(YES);}

In this second way, there are no errors, however, the data of the key is never deleted. Also, both NSLogs for the response output null inside the terminal.

I am 100% sure that the cacheKey I am providing to my deleteFromCache() method is correct and data corresponding to it exists. However, in both methods NSLog(@"Size = %@", @(self.videoCache.totalUsedSizeInBytes)); does not change and I can also manually verify that the file has not been deleted.

I am really stuck and do not know what is wrong with the code I've written in both cases and why neither of them works. I would appreciate any help on this!

Viewing all 16554 articles
Browse latest View live


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