Integration
Last updated
npx expo prebuild
npx expo run:ios
npx expo run:androidimport * as React from "react";
import { Button, SafeAreaView, Text, View } from "react-native";
import {
VGSShow,
VGSShowError,
VGSShowImage,
VGSShowLabel,
VGSShowPdf
} from "@vgs/show-react-native";const showRef = React.useRef<VGSShow | null>(null);
if (showRef.current === null) {
showRef.current = new VGSShow({
id: config.vaultId,
environment: "sandbox"
});
}
const vgsShow = showRef.current;const sandboxEuShow = new VGSShow({
id: config.vaultId,
environment: "sandbox",
dataRegion: "eu-1"
});
const liveEuShow = new VGSShow({
id: config.vaultId,
environment: "live-eu1"
});<VGSShowLabel
vgsShow={vgsShow}
contentPath="json.card_number"
placeholder="**** **** **** ****"
isSecureText={true}
/>
<VGSShowImage
vgsShow={vgsShow}
contentPath="json.card_art"
contentMode="scaleAspectFit"
/>
<VGSShowPdf
vgsShow={vgsShow}
contentPath="json.statement_pdf"
style={{ width: "100%", height: 360 }}
/>async function reveal(): Promise<void> {
try {
const result = await vgsShow.request({
path: "/post",
method: "POST",
payload: {
recordAlias: form.recordAlias
}
});
setStatus(`Reveal completed with HTTP ${result.code}.`);
} catch (error) {
if (error instanceof VGSShowError) {
setStatus(`Reveal failed (${error.code}).`);
return;
}
setStatus("Reveal failed.");
}
}npx skills add https://github.com/verygoodsecurity/vgs-show-react-native --skill vgs-show-react-native-guide