Adding external call to action buttons

To access the call to action feature of the CardView, you can use the useCardView React hook function:

import { CardView, useCardView } from '@card91/react-native-card-view';

export function CardPage() {
	const cardView = useCardView();
  
  return (
  	<View>
    	<CardView ... />
    	<Button onPress={cardView.showNumber} title="Show Card Number" />
    </View>
  );
}

🚧

Important

Please make sure that the CardProvider is placed sufficiently high on the React tree so that both the useCardView hook and the CardView component come under the CardProvider. This works on the React Context design pattern.

The useCardView React hook function provides 5 functions:

FunctionDescription
copyNumberCopy the card number onto the OS clipboard. This may not be supported on some devices, wherein an error message can be listened to using the onCopyError prop.
hideCVVMask the CVV
hideNumberMask the card number
showCVVUn-mask the CVV
showNumberUn-mask the card number