1.0.1 • Published 5 years ago
react-native-scanner-credit-card v1.0.1
react-native-react-native-scanner-credit-card
Getting started
$ npm install react-native-scanner-credit-card --save
Mostly automatic installation
$ react-native link react-native-scanner-credit-card
Usage
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>
);
}
}