Karthik
Karthik

Reputation: 41

Facing Issue with React Native Credit Card Scanner

I have a code written in react native for scanning credit card info. I followed https://github.com/kayla-tech/react-native-card-io. The scanner is able to read my card number, but fails to read my expiry and cvv. Given Below is the Code.

componentDidMount() {
CardIOUtilities.preload();
}

alertfunction(out){
this.props.navigator.replace({id:'CreditCardPayment'})
console.log(out);
} 

    <View>
      <CardIOView
        style={styles.preview}
        hideCardIOLogo={true}
        allowFreelyRotatingCardGuide={true}
        scanInstructions={'Hold card here. It will scan automatically.'}
        scannedImageDuration={2}
        detectionMode={CardIOView.automatic}
        scanExpiry={true}
        didScanCard={result => this.alertfunction(result)} />                  
    </View>

Any help would be appreciated. Thank you

Upvotes: 0

Views: 2144

Answers (1)

rajaishwary
rajaishwary

Reputation: 5082

Rather than using detection mode :automatic, use detection mode :cardImageAndNumber because automatic mode start as CardIODetectionModeCardImageAndNumber, but fall back to CardIODetectionModeCardImageOnly if scanning has not succeeded within a reasonable time.

the same docs in here what you are using. Check the nice documentation here: https://github.com/Kerumen/react-native-awesome-card-io

Upvotes: 1

Related Questions