Git Product home page Git Product logo

react-native-awesome-card-io's Introduction

⚠️ Both iOS and Android SDKs have been archived

As this wrapper depends on them, there is not much I can do to support new OS versions or fix bugs.. I tried to reach out people there to have an explanation on the deprecation but I'm yet to receive a response. In the meantime, please be comprehensive and do not open issues not related to the wrapper. Thanks!

A complete and cross-platform card.io component for React Native.

Getting started

$ npm install react-native-awesome-card-io --save
$ cd ios && pod install && cd ..

iOS

You should add the key NSCameraUsageDescription to your app's Info.plist and set the value to be a string describing why your app needs to use the camera (e.g. "To scan credit cards."). This string will be displayed when the app initially requests permission to access the camera.

Usage

This component provides an abstraction of the card.io entry points for iOS and Android.

Javascript iOS Android Description
CardIOModule CardIOPaymentViewController CardIOActivity A module to launch the card.io view controller which handles everything.
CardIOView CardIOView N / A Create a CardIOView to do card scanning only and manage everything else yourself.

CardIOView (iOS only)

This component is iOS-only as the card.io Android SDK does not offer this functionality.

import React, { Component } from 'react'
import { View } from 'react-native'
import { CardIOView, CardIOUtilities } from 'react-native-awesome-card-io'

export default class CardIOExample extends Component {
  componentWillMount() {
    CardIOUtilities.preload()
  }

  didScanCard = card => {
    // the scanned card
  }

  render() {
    return (
      <View>
        <CardIOView didScanCard={this.didScanCard} style={{ flex: 1 }} />
      </View>
    )
  }
}

Props

didScanCard function Required - This function will be called when the CardIOView completes its work and returns a CreditCard. (Docs)

languageOrLocale string - The preferred language for all strings appearing in the user interface. (Docs)

guideColor string - Alter the card guide (bracket) color. Opaque colors recommended. (Docs)

useCardIOLogo boolean false - Set to true to show the card.io logo over the camera instead of the PayPal logo. (Docs)

hideCardIOLogo boolean false - Hide the PayPal or card.io logo in the scan view. (Docs)

allowFreelyRotatingCardGuide boolean true - By default, in camera view the card guide and the buttons always rotate to match the device's orientation. (Docs)

scanInstructions string - Set the scan instruction text. (Docs)

scanExpiry string true - Set to false if you don't want the camera to try to scan the card expiration. (Docs)

scannedImageDuration number 1.0 - How long the CardIOView will display an image of the card with the computed card number superimposed after a successful scan. (Docs)

detectionMode CardIODetectionMode CardIODetectionModeCardImageAndNumber - Set the detection mode. (Docs)

CardIOModule

This module abstracts the CardIOPaymentViewController on iOS and the CardIOActivity on Android.

import React, { Component } from 'react'
import { View, TouchableOpacity, Text, Platform } from 'react-native'
import { CardIOModule, CardIOUtilities } from 'react-native-awesome-card-io'

export default class CardIOExample extends Component {
  componentWillMount() {
    if (Platform.OS === 'ios') {
      CardIOUtilities.preload()
    }
  }

  scanCard() {
    CardIOModule.scanCard()
      .then(card => {
        // the scanned card
      })
      .catch(() => {
        // the user cancelled
      })
  }

  render() {
    return (
      <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
        <TouchableOpacity onPress={this.scanCard.bind(this)}>
          <Text>Scan card!</Text>
        </TouchableOpacity>
      </View>
    )
  }
}

Methods

scanCard([config]) -> Promise - Launch the card.io controller to manage the card scanning and get the CreditCard result in the resolved promise.

  • config On object with the following available keys:

    • languageOrLocale string - The preferred language for all strings appearing in the user interface. (iOS / Android)

    • guideColor string - Alter the card guide (bracket) color. Opaque colors recommended. (iOS / Android)

    • useCardIOLogo boolean false - Set to true to show the card.io logo over the camera view instead of the PayPal logo. (iOS / Android)

    • hideCardIOLogo boolean false - Hide the PayPal or card.io logo in the scan view. (iOS / Android)

    • scanInstructions string - Set the scan instruction text. If nil, use the default text. (iOS / Android)

    • suppressManualEntry boolean false - Set to true to prevent card.io from showing its "Enter Manually" button. (iOS / Android)

    • suppressConfirmation boolean false - If true, don't have the user confirm the scanned card, just return the results immediately. (iOS / Android)

    • requireExpiry boolean true - Set to false if you don't need to collect the card expiration. (iOS / Android)

    • requireCVV boolean true - Set to false if you don't need to collect the CVV from the user. (iOS / Android)

    • requirePostalCode boolean false - Set to false if you need to collect the billing postal code. (iOS / Android)

    • restrictPostalCodeToNumericOnly boolean false - Set to true if the postal code should only collect numeric input. (iOS / Android)

    • requireCardholderName boolean false - Set to true if you need to collect the cardholder name. (iOS / Android)

    • scanExpiry boolean true - Set to false if you don't want the camera to try to scan the card expiration. (iOS / Android)

    • disableBlurWhenBackgrounding boolean false (iOS only) - Disable the blur of the screen when the app is backgrounded. (iOS)

    • keepStatusBarStyle boolean false (iOS only) - If true, the status bar's style will be kept as whatever your app has set it to. (iOS)

    • detectionMode CardIODetectionMode false (iOS only) - Set the detection mode. (iOS)

    • suppressScannedCardImage boolean false (iOS only) - If true, instead of displaying the image of the scanned card, present the manual entry screen with the scanned card number prefilled. (iOS)

    • scannedImageDuration number 0.1 (iOS only) - How long card.io will display an image of the card with the computed card number superimposed after a successful scan. (iOS)

    • allowFreelyRotatingCardGuide boolean true (iOS only) - By default, in camera view the card guide and the buttons always rotate to match the device's orientation. (iOS)

    • noCamera boolean false (Android only) - If set, the card will not be scanned with the camera. (Android)

    • unblurDigits number -1 (Android only) - Privacy feature. How many of the Card number digits NOT to blur on the resulting image. Setting it to 4 will blur all digits except the last four. (Android)

    • usePaypalActionbarIcon boolean false (Android only) - Use the PayPal icon in the ActionBar. (Android)

CreditCard

An object with the following keys:

  • cardType string - Localized card type.
  • cardNumber string - Card number.
  • redactedCardNumber string - Card number with all but the last four digits obfuscated.
  • expiryMonth number - Expiry month with january as 1 (may be 0 if expiry information was not requested).
  • expiryYear number - Expiry year (may be 0 if expiry information was not requested).
  • cvv string - Security code.
  • postalCode string - Postal code. Format is country dependent.
  • scanned boolean - Was the card number scanned (as opposed to entered manually)?
  • cardholderName string - Card holder name.

CardIOUtilities

Methods

canReadCardWithCamera() -> Boolean - Determine whether this device supports camera-based card scanning. (iOS / Android)

preload -> void (iOS only) - The preload method prepares card.io to launch faster. (iOS)

Constants

DETECTION_MODE: String

  • IMAGE_AND_NUMBER (CardIODetectionModeCardImageAndNumber) - the scanner must successfully identify the card number.
  • IMAGE (CardIODetectionModeCardImageOnly) - don't scan the card, just detect a credit-card-shaped card.
  • AUTOMATIC (CardIODetectionModeAutomatic) - start as CardIODetectionModeCardImageAndNumber, but fall back to CardIODetectionModeCardImageOnly if scanning has not succeeded within a reasonable time.

License

MIT

react-native-awesome-card-io's People

Contributors

andrewgierens avatar andreybutenko avatar anton-patrushev avatar d-moreira avatar dependabot[bot] avatar dishantwalia avatar franjbeltran avatar isnifer avatar kerumen avatar lyubo avatar mickamy avatar mo-solnet avatar peacechen avatar pedro-victor avatar rudolph-miller avatar sbycrosz avatar slorber avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-awesome-card-io's Issues

performance on android

Has anyone noticed a performance difference between Android and iOS? The iOS version seems a lot faster to capture the card details than the Android version.

Implicit declaration of function 'RCTPresentedViewController' is invalid in C99

I'm having some trouble building my iOS project with the react-native-awesome-card-io files included. I followed the installation instructions but I'm getting the following build error in on line 116 of RCTCardIOModule.m.

RCTCardIOModule.m:116:44: Implicit declaration of function 'RCTPresentedViewController' is invalid in C99

UIViewController *rootViewController = RCTPresentedViewController();

Any ideas on how I can solve this? I am not very failure with Objective C so I apologize if this is a trivial issue.

undefined is not an object (evaluating 'CardIOUtilities.DETECTION_MODE')

[error][tid:com.facebook.react.JavaScript] undefined is not an object (evaluating 'CardIOUtilities.DETECTION_MODE')
[tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: undefined is not an object (evaluating 'CardIOUtilities.DETECTION_MODE')

react-native-cli: 2.0.1
react-native: 0.41.2

in package.json
"react-native-awesome-card-io": "^0.6.1"

Exception thrown on android

On Android platform the following exception is thrown:

04-07 14:56:53.898  3185  4686 E unknown:React: java.lang.IllegalArgumentException: Can only use lower 16 bits for requestCode
04-07 14:56:53.898  3185  4686 E unknown:React: 	at android.support.v4.app.BaseFragmentActivityGingerbread.checkForValidRequestCode(BaseFragmentActivityGingerbread.java:88)
04-07 14:56:53.898  3185  4686 E unknown:React: 	at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:856)
04-07 14:56:53.898  3185  4686 E unknown:React: 	at com.cardio.RNCardIOModule.scanCard(RNCardIOModule.java:44)

This is due to the following constant:
public static final int CARD_IO_SCAN = 49463195;
used here:
activity.startActivityForResult(scanIntent, CARD_IO_SCAN);
It should be set to something less than 0xFFFF. According to card-io documentation this is an arbitrary value. Setting this constant to 1 works fine.

preload() is undefined

image

I can't run the 'CardIOModule' because I ever receive undefined. I has linked, I reinstall, I has excluded the 'node_modules'.

How can I use the lilbrary?

Scanning cardholder name

Does this support scanning the name? Or just allows a field for the user to input the cardholder name. Thanks

Camera doesn't show up in iOS

Initially we were ablke to scan the card after few days when i checked the same scan feature camera does't show up. I have tested in iphone 5:IOS 10.3.2, Iphone 7:IOS 10.3.3

iOS Camera doesn't show up

I'm using this module via react-native-checkout

When I first installed the app, I had no problems using the camera to scan a card. However, at some point, whenever a user tries to scan a card, the camera view does not appear. I am not sure if this is a regression introduced in a new version of iOS.

The link above includes the coded implementation of this module. It is fairly straightforward. I have added a privacy usage description for the camera, but after the user accepts the prompt, no camera is shown.

Android implementation doesn't close module after scan completes

When implementing CardIOModule in Android, the scanner doesn't return a value to the consuming component until the user taps the back-arrow softkey.

When calling:

CardIOModule
        .scanCard({
          hideCardIOLogo: true,
          useCardIOLogo: false,
          languageOrLocale: 'en_AU',
          allowFreelyRotatingCardGuide: true,
          scanInstructions: 'Hold card here. It will scan automatically.',
          scanExpiry: true,
          scannedImageDuration: 1,
          requireCVV: false,
        })
        .then((result) => { this._didScan(result) })
        .catch((result) => { this._didScan(result) });

this._didScan doesn't fire until the user taps the back arrow.

Is this expected behavior? Or is there a config option that we can pass to requesting the module to close?

[ANDROID] Unable to pause activity error

I've been getting errors when I build for my Android simulator.
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.test, PID: 2994
java.lang.RuntimeException: Unable to pause activity {com.test/com.test.MainActivity}: android.os.NetworkOnMainThreadException
at android.app.ActivityThread.performPauseActivityIfNeeded(ActivityThread.java:3722)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3688)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3662)
at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:3636)
at android.app.ActivityThread.-wrap16(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1472)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: android.os.NetworkOnMainThreadException
at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1303)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111)
at java.net.SocketOutputStream.write(SocketOutputStream.java:157)
at okio.Okio$1.write(Okio.java:78)
at okio.AsyncTimeout$1.write(AsyncTimeout.java:180)
at okio.RealBufferedSink.emit(RealBufferedSink.java:178)
at okhttp3.internal.ws.WebSocketWriter.writeControlFrameSynchronized(WebSocketWriter.java:152)
at okhttp3.internal.ws.WebSocketWriter.writeClose(WebSocketWriter.java:111)
at okhttp3.internal.ws.RealWebSocket.close(RealWebSocket.java:168)
at com.facebook.react.devsupport.JSPackagerWebSocketClient.closeWebSocketQuietly(JSPackagerWebSocketClient.java:104)
at com.facebook.react.devsupport.JSPackagerWebSocketClient.closeQuietly(JSPackagerWebSocketClient.java:98)
at com.facebook.react.devsupport.DevServerHelper.closePackagerConnection(DevServerHelper.java:129)
at com.facebook.react.devsupport.DevSupportManagerImpl.reload(DevSupportManagerImpl.java:846)
at com.facebook.react.devsupport.DevSupportManagerImpl.setDevSupportEnabled(DevSupportManagerImpl.java:481)
at com.facebook.react.XReactInstanceManagerImpl.onHostPause(XReactInstanceManagerImpl.java:490)
at com.facebook.react.XReactInstanceManagerImpl.onHostPause(XReactInstanceManagerImpl.java:504)
at com.facebook.react.ReactActivityDelegate.onPause(ReactActivityDelegate.java:110)
at com.facebook.react.ReactActivity.onPause(ReactActivity.java:60)
at android.app.Activity.performPause(Activity.java:6804)
at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1322)
at android.app.ActivityThread.performPauseActivityIfNeeded(ActivityThread.java:3711)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3688) 
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3662) 
at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:3636) 
at android.app.ActivityThread.-wrap16(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1472) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6077) 
at java.lang.reflect.Method.invoke(Native Method) 

Additional Information

React Native version: 0.34
Platform(s) (iOS, Android, or both?): Android
Operating System (macOS, Linux, or Windows?): MacOS

Android says "keyboard"

The option on the card scanner for ios says "Enter Manually", but android version says "Keyboard...". Is there a way to change the verbiage for android so the user knows where they will be redirected to? Can not seem to find the text for these in the code.

Cannot read property 'DETECTION_MODE' of undefined

Hi Yann,
@Kerumen
I am trying to use this cool component in my react native app. I basically copy pasted the code for CardIOModule, and then got this error.

My react native version is 0.35.0. Do you know what's happening?

Thanks.
Shundan

image

Cannot build Android for outdated React Native version

I am trying to build Android and am getting the following

:react-native-awesome-card-io:preBuild UP-TO-DATE
:react-native-awesome-card-io:preReleaseBuild UP-TO-DATE
:react-native-awesome-card-io:compileReleaseNdk UP-TO-DATE
:react-native-awesome-card-io:compileLint
:react-native-awesome-card-io:copyReleaseLint UP-TO-DATE
:react-native-awesome-card-io:checkReleaseManifest
:react-native-awesome-card-io:preDebugAndroidTestBuild UP-TO-DATE
:react-native-awesome-card-io:preDebugBuild UP-TO-DATE
:react-native-awesome-card-io:preDebugUnitTestBuild UP-TO-DATE
:react-native-awesome-card-io:preReleaseUnitTestBuild UP-TO-DATE
> Building 6% > :react-native-awesome-card-io:prepareComAndroidSupportAppcompat:react-native-awesome-card-io:prepareComAndroidSupportAppcompatV72301Library
> Building 6%:react-native-awesome-card-io:prepareComAndroidSupportRecyclerviewV72301Library
> Building 6% > :react-native-awesome-card-io:prepareComAndroidSupportSupportV4:react-native-awesome-card-io:prepareComAndroidSupportSupportV42321Library
:react-native-awesome-card-io:prepareComFacebookFrescoDrawee0110Library
:react-native-awesome-card-io:prepareComFacebookFrescoFbcore0110Library
:react-native-awesome-card-io:prepareComFacebookFrescoFresco0110Library
:react-native-awesome-card-io:prepareComFacebookFrescoImagepipeline0110Library
> Building 6% > :react-native-awesome-card-io:prepareComFacebookFrescoImagepipe:react-native-awesome-card-io:prepareComFacebookFrescoImagepipelineBase0110Library
:react-native-awesome-card-io:prepareComFacebookFrescoImagepipelineOkhttp30110Library
> Building 7% > :react-native-awesome-card-io:prepareComFacebookReactReactNativ:react-native-awesome-card-io:prepareComFacebookReactReactNative0321Library
:react-native-awesome-card-io:prepareComFacebookSoloaderSoloader010Library
> Building 7% > :react-native-awesome-card-io:prepareIoCardAndroidSdk540Library:react-native-awesome-card-io:prepareIoCardAndroidSdk540Library
> Building 7%> Building 7% > :react-native-awesome-card-io:prepareOrgWebkitAndroidJscR174650:react-native-awesome-card-io:prepareOrgWebkitAndroidJscR174650Library
> Building 7%:react-native-awesome-card-io:prepareReleaseDependencies
:react-native-awesome-card-io:compileReleaseAidl
:react-native-awesome-card-io:compileReleaseRenderscript
:react-native-awesome-card-io:generateReleaseBuildConfig
:react-native-awesome-card-io:mergeReleaseShaders
:react-native-awesome-card-io:compileReleaseShaders
:react-native-awesome-card-io:generateReleaseAssets
:react-native-awesome-card-io:mergeReleaseAssets
:react-native-awesome-card-io:generateReleaseResValues
:react-native-awesome-card-io:generateReleaseResources
> Building 8% > :react-native-awesome-card-io:mergeReleaseResources:react-native-awesome-card-io:mergeReleaseResources
> Building 8%:react-native-awesome-card-io:processReleaseManifest
> Building 8% > :react-native-awesome-card-io:processReleaseResources:react-native-awesome-card-io:processReleaseResources
> Building 8%:react-native-awesome-card-io:generateReleaseSources
:react-native-awesome-card-io:incrementalReleaseJavaCompilationSafeguard
:react-native-awesome-card-io:compileReleaseJavaWithJavac
:react-native-awesome-card-io:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
> Building 8% > :react-native-awesome-card-io:compileReleaseJavaWithJavac/home/ubuntu/bosspayments/mobile/node_modules/react-native-awesome-card-io/android/src/main/java/com/cardio/RNCardIOModule.java:18: error: RNCardIOModule is not abstract and does not override abstract method onActivityResult(int,int,Intent) in ActivityEventListener
> Building 8% > :react-native-awesome-card-io:compileReleaseJavaWithJavacpublic class RNCardIOModule extends ReactContextBaseJavaModule implements ActivityEventListener {
       ^
> Building 8% > :react-native-awesome-card-io:compileReleaseJavaWithJavac/home/ubuntu/bosspayments/mobile/node_modules/react-native-awesome-card-io/android/src/main/java/com/cardio/RNCardIOModule.java:101: error: method does not override or implement a method from a supertype
  @Override
  ^
> Building 8% > :react-native-awesome-card-io:compileReleaseJavaWithJavac2 errors
> Building 8% > :react-native-awesome-card-io:compileReleaseJavaWithJavac:react-native-awesome-card-io:compileReleaseJavaWithJavac FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-awesome-card-io:compileReleaseJavaWithJavac'.

This occurred after bumping to version 0.3.0

Linker command failed with exit code 1

Getting the following error when trying to build the app:

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_RCTReconnectingWebSocket", referenced from:
      objc-class-ref in libReact.a(RCTPackagerConnection.o)
  "_vImageBoxConvolve_ARGB8888", referenced from:
      -[UIImage(ImageEffects) applyBlurWithRadius:tintColor:saturationDeltaFactor:maskImage:] in libRNCardIO.a(UIImage+ImageEffects.o)
  "_vImageMatrixMultiply_ARGB8888", referenced from:
      -[UIImage(ImageEffects) applyBlurWithRadius:tintColor:saturationDeltaFactor:maskImage:] in libRNCardIO.a(UIImage+ImageEffects.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Running on RN 0.45.1 & RN-awesome-card-io 0.6.4

What could be causing this?

Request Number of Scans

Is it possible for the component to receive a number of scans? For android purposes, because what I intend with the component is for the user to be able to read more than one card and at the moment after the first successful read, it doesn't let the user to read again

Android not building after react-native link

Haven't even been able to run the example. I'm getting this error before running react-native link:
screenshot_2017-08-06-21-59-49

after react-native link (can't even build it):
screen shot 2017-08-06 at 22 05 57

class CardIOExample extends Component {
  scanCard = () => {
    CardIOModule
      .scanCard({
      })
      .then(card => {
        console.log('card : ', card);
      })
      .catch(err => logger.error(`Failed to scan digital card. Error message: ${err}`));
  }

  render() {
    return (
      <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
        <TouchableOpacity onPress={() => this.scanCard()}>
          <Text>Scan card!</Text>
        </TouchableOpacity>
      </View>
    );
  }
}

my package.json:
"react": "16.0.0-alpha.12",
"react-native": "0.47.1",
"react-native-awesome-card-io": "^0.6.4"

I appreciate any help

CardIOUtilities.canReadCardWithCamera Usage

Hi @Kerumen,
Thanks for the great library!

The current version requires a callback

CardIOUtilities.canReadCardWithCamera(canReadWithCamera => {
    // show or hide the scan button
});

Should we expose them as native constant since they're unlikely to change while the app is running?

Cheers,
Sam

[ Android ] React Native 0.47 breaking change

Error occurs when I run react-native run-android
full error:

\node_modules\react-native-awesome-card-io\android\src\main\java\com\cardio\RNCardIOPackage.java:23: error: method does not override or implement a method from a supertype
@OverRide
^
1 error
:react-native-awesome-card-io:compileReleaseJavaWithJavac FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':react-native-awesome-card-io:compileReleaseJavaWithJavac'.

Compilation failed; see the compiler error output for details.

I believe that issue cause by React Native 0.47 breaking change.

Remove unused createJSModules calls (https://github.com/facebook/react-native/releases/tag/v0.47.0)

Cannot build Android

Hi, I am trying to build on Android and it keeps failing with

file or directory '.../mobile/node_modules/react-native-awesome-card-io/android/src/release/java', not found
Executing task ':react-native-awesome-card-io:compileReleaseJavaWithJavac' (up-to-date check took 0.012 secs) due to:
  No history is available.
All input files are considered out-of-date for incremental task ':react-native-awesome-card-io:compileReleaseJavaWithJavac'.
Compiling with source level 1.7 and target level 1.7.
:react-native-awesome-card-io:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
file or directory '.../mobile/node_modules/react-native-awesome-card-io/android/src/release/java', not found
Compiling with JDK Java compiler API.
.../mobile/node_modules/react-native-awesome-card-io/android/src/main/java/com/cardio/RNCardIOModule.java:124: error: method does not override or implement a method from a supertype
  @Override
  ^
1 error
:react-native-awesome-card-io:compileReleaseJavaWithJavac FAILED
:react-native-awesome-card-io:compileReleaseJavaWithJavac (Thread[main,5,main]) completed. Took 2.131 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-awesome-card-io:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

BUILD FAILED

Total time: 27.727 secs
Stopped 0 compiler daemon(s).

RN0.42 white screen

/**
 * Created by hesk on 16/3/2017.
 */
import React, {Component} from 'react';
import {View} from 'react-native';
import {CardIOView, CardIOUtilities} from 'react-native-awesome-card-io';
import Toolbar from '../../components/Toolbar'
import EmptyView from '../../components/ListCom/EmptyView'
const Permissions = require('react-native-permissions');
//response is one of: 'authorized', 'denied', 'restricted', or 'undetermined'
import  {Actions, colors, IconMatCom, IconSize, Language} from '../../provider/constants';
import CallAction from '../../components/Buttons/CallAction';
export default class CardIOExample extends Component {
    state = {hasCamera: false};

    constructor(props) {
        super(props);
        this.didScanCard = this.didScanCard.bind(this);
    }

    componentWillMount() {
        CardIOUtilities.preload();
    }

    componentDidMount() {
        /*  Permissions.checkMultiplePermissions(['photo', 'camera'])
         .then(response => {

         this.setState({

         cameraPermission: response.camera,
         photoPermission: response.photo,
         hasCamera: CardIOUtilities.CAN_READ_CARD_WITH_CAMERA

         });

         console.log("isMount", CardIOUtilities.CAN_READ_CARD_WITH_CAMERA);
         });*/

    }

    didScanCard(card) {
        // the scanned card
        console.log("info", card);
    }

    _actionAddCard() {
        Actions.writecard();
    }

    render() {
        const controlStyle = {
            alignSelf: 'center',
            color: colors.colorAccent2,
            marginBottom: 30
        };
        const displaycontent = CardIOUtilities.CAN_READ_CARD_WITH_CAMERA ?
            (  <CardIOView
                    didScanCard={this.didScanCard}
                    style={{flex: 1}}
                />
            ) : (
                <View>
                    <EmptyView
                        iconawesome="camera"
                        displayText={"no camera is detected."}
                        color={colors.colorAccent2}
                        customIconDisplayJSX={(
                            <IconMatCom
                            style={controlStyle}
                            name="camera-off"
                            size={150}/>
                        )}
                    />
                    <CallAction
                        iconName="ios-card"
                        onPress={(ref)=>{this._actionAddCard();}}/>
                </View>
            );


        return (
            <View>
                <Toolbar barType={Toolbar.EMTPY_BACKONLY}/>
                {displaycontent}
            </View>
        );
    }
}

The above is my code for the IOView implementation. As the result I have got the white screen only and the iphone turned its flash light. I got a white screen. @Kerumen would u please help me out?

Add access to this.* in didScanCard method

You can't use this in didScanCard from your example (for example you need it for routing).

Please update example

<CardIOView
     didScanCard={this.didScanCard.bind(this)}
     style={{ flex: 1 }}
/>

Not working on Android, works on IOS

I can't seem to get this library to work on Android. I was able to build the project successfully but any attempt to use it ( CardIOModule.scanCard()) gives the following error:

undefined is not a function (evaluating '_reactNativeAwesomeCardIo.CardIOUtilities.preload()')
componentWillMount
scanCard.js:77:4

ReactNativeStack-dev.js:1652:19
measureLifeCyclePerf
ReactNativeStack-dev.js:1610:15
mountComponent
ReactNativeStack-dev.js:1651:57
mountComponent
ReactNativeStack-dev.js:1327:53
performInitialMount
ReactNativeStack-dev.js:1703:54
mountComponent
ReactNativeStack-dev.js:1655:184
mountComponent
ReactNativeStack-dev.js:1327:53
mountChildren
ReactNativeStack-dev.js:2871:62
initializeChildren
ReactNativeStack-dev.js:2940:45
mountComponent
.
.
.
The remaining part removed for brevity.

React native version is 0.47.2

Any ideas?

Android Build Failure

Module works perfectly on iOS, but on android I'm getting the following build errors:

Error:(19, 8) error: RNCardIOModule is not abstract and does not override abstract method onActivityResult(int,int,Intent) in ActivityEventListener
Error:(102, 3) error: method does not override or implement a method from a supertype
Error:(124, 3) error: method does not override or implement a method from a supertype
Error:Execution failed for task ':react-native-awesome-card-io:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

This is using react-native-awesome-card-io ^0.6.4, and react-native ^0.45.1.

Hangs on loadRequestedDeos

npm info it worked if it ends with ok
npm verb cli [ '/usr/local/Cellar/node/7.9.0/bin/node',
npm verb cli '/usr/local/bin/npm',
npm verb cli 'install',
npm verb cli 'react-native-awesome-card-io',
npm verb cli '--save',
npm verb cli '--verbose' ]
npm info using [email protected]
npm info using [email protected]
npm verb request uri https://registry.npmjs.org/react-native-awesome-card-io
npm verb request no auth needed
npm info attempt registry request try #1 at 4:50:41 pm
npm verb request id e9ab3ef35a347917
npm verb etag W/"588befde-80ad"
npm verb lastModified Sat, 28 Jan 2017 01:11:58 GMT
npm http request GET https://registry.npmjs.org/react-native-awesome-card-io
npm http 304 https://registry.npmjs.org/react-native-awesome-card-io
npm verb headers { date: 'Mon, 24 Apr 2017 06:50:42 GMT',
npm verb headers via: '1.1 varnish',
npm verb headers 'cache-control': 'max-age=300',
npm verb headers etag: 'W/"588befde-80ad"',
npm verb headers age: '118',
npm verb headers connection: 'keep-alive',
npm verb headers 'x-served-by': 'cache-syd1625-SYD',
npm verb headers 'x-cache': 'HIT',
npm verb headers 'x-cache-hits': '1',
npm verb headers 'x-timer': 'S1493016642.106106,VS0,VE0',
npm verb headers vary: 'Accept-Encoding' }
npm verb etag https://registry.npmjs.org/react-native-awesome-card-io from cache
npm verb get saving react-native-awesome-card-io to /Users/piotrsuwara/.npm/registry.npmjs.org/react-native-awesome-card-io/.cache.json
npm verb correctMkdir /Users/piotrsuwara/.npm correctMkdir not in flight; initializing
npm verb cache add spec react-native-awesome-card-io
npm verb addNamed "latest" is being treated as a dist-tag for react-native-awesome-card-io
npm info addNameTag [ 'react-native-awesome-card-io', 'latest' ]
npm verb addNameTag registry:https://registry.npmjs.org/react-native-awesome-card-io not in flight; fetching
npm verb get https://registry.npmjs.org/react-native-awesome-card-io not expired, no request
npm verb addNamed "0.6.1" is a plain semver version for react-native-awesome-card-io
npm verb addRemoteTarball https://registry.npmjs.org/react-native-awesome-card-io/-/react-native-awesome-card-io-0.6.1.tgz not in flight; adding
npm verb addRemoteTarball [ 'https://registry.npmjs.org/react-native-awesome-card-io/-/react-native-awesome-card-io-0.6.1.tgz',
npm verb addRemoteTarball '2e1a3f8a186ba560f87e19497bdf36a24a421079' ]
npm info retry fetch attempt 1 at 4:50:42 pm
npm info attempt registry request try #1 at 4:50:42 pm
npm http fetch GET https://registry.npmjs.org/react-native-awesome-card-io/-/react-native-awesome-card-io-0.6.1.tgz
npm http fetch 200 https://registry.npmjs.org/react-native-awesome-card-io/-/react-native-awesome-card-io-0.6.1.tgz
⸨ ░░░░░░░░░░░░░░⸩ ⠧ loadRequestedDeps: http fetch 200 https://registry.npmjs.org/react-native-awesome-card-io/-/react-native-awesome-card-io-0.6.1.tgz

No progress after this point.

Does not build on Android with buildToolsVersion 25

The latest Android Studio and Gradle require buildToolsVersion 25 and this library does not build with this version.

Scenario: A project is using this library as a dependency. The project updates to latest RN (0.47.2) as well as Android Studio 2.2.3. This library will prevent building the project because the buildToolsVersion is too low.

Header support for both RN < 0.40 and >= 0.40

To better support the breaking header path change in React Native 0.40, the imports should be conditional in order to support both pre-0.40 and 0.40+ releases. I'll submit a PR for this. How quickly are PR's considered for merge?

Cardholder name isn't returned properly

If you use CardIOModule.scanCard({requireCardholderName: true}), the data returned should contain the text from the cardholder name field, but it looks like that was left out of the result.

I just created a pull request to fix this.

App crashes / Can't run

I'm trying the basic CardIOView example from the readme, but it's not working.
The xcode aborts with an exception when I get to open the page that has the cardio component.

libsystem_kernel.dylib`__abort_with_payload:
    0x18e390d6c <+0>:  movz   x16, #0x209
    0x18e390d70 <+4>:  svc    #0x80
->  0x18e390d74 <+8>:  b.lo   0x18e390d8c               ; <+32>
    0x18e390d78 <+12>: stp    x29, x30, [sp, #-16]!
    0x18e390d7c <+16>: mov    x29, sp
    0x18e390d80 <+20>: bl     0x18e3757b4               ; cerror_nocancel
    0x18e390d84 <+24>: mov    sp, x29
    0x18e390d88 <+28>: ldp    x29, x30, [sp], #16
    0x18e390d8c <+32>: ret    

What React Native version does it support exactly?
I currently have to use RN 0.32.1.


"react": "15.3.0"
"react-native": "^0.32.1"
"react-native-awesome-card-io": "^0.4.0
iOS 10 (device)

not working for RN 0.44 ?

it just crashed on iOS , did not test on Android

"react-native": "0.44.0",
"react-native-app-intro": "^1.1.5",
"react-native-awesome-card-io": "^0.6.4",
"react-native-checkout": "0.0.5",

[Android] Hide captured image from users

On iOS, setting scannedImageDuration: false makes the captured image disappear really quickly.

The reason I set up like this, because I think users will feel like their credit cards were captured somewhere and it feel unsafe if they see the captured image. However, this setting is only on iOS, so I am curious about Android if it can hide the captured image from users's eyes and return immediately like iOS does ? by the way, right now I don't have time to test yet on Android, sorry if it has already been able to do this.

Thank you.

Card having name, not getting scanned

Hi,
My react native version is - 0.41.0
react native awesome card io version is- 0.6.2

I am using CardIOModule-

CardIOModule
        .scanCard()
        .then((card: any) => {
          // the scanned card
          console.log("card", card);
          this.setCardValuesInState(card);
        })
        .catch((err: any) => {
          // the user cancelled
          console.log("error is", err);
        });

Its working fine with cards not having name in it, but not able to scan cards having name in it.

guideColor expects an integer (for android)

Hi There,

Thanks for this library, saved me a lot of time.

I noticed (on Android) that guideColor needs to be an int rather than a string when using CardIOModule. Do you know I how I do this conversion?

Thanks,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.