React Native β
Installation
$ npm i @cardscan.ai/insurance-cardscan-react-native
$ yarn add @cardscan.ai/insurance-cardscan-react-nativeUsage
import { CardScanView } from "@cardscan.ai/insurance-cardscan-react-native";Basic Example
import React from 'react';
import { SafeAreaView, StyleSheet } from 'react-native';
import { CardScanView } from '@cardscan.ai/insurance-cardscan-react-native';
function onSuccess(card: any) {
console.log('new card: ', card);
}
function onError(error) {
console.error('Error occurred: ', error);
}
// See Authentication on where to get this sessionToken.
const sessionToken = 'JWT_TOKEN';
export default function App() {
return (
<SafeAreaView style={styles.container}>
<CardScanView
live={false}
sessionToken={sessionToken}
onSuccess={onSuccess}
onError={onError}
/>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
});
Available Props
Main Props
Prop
Required
Type
Description
UI/UX Customization Props
Prop
Type
Description
onSuccess Callback
Usage
onError Callback
Usage
onCancel Callback
Usage
onRetry Callback
Usage
Last updated
Was this helpful?