22 Copyright (c) 2022 Skyflow, Inc.
33*/
44
5- import React , { useRef } from 'react' ;
5+ import React from 'react' ;
66import { Button , StyleSheet , View } from 'react-native' ;
77import {
88 RedactionType ,
@@ -15,8 +15,6 @@ const RevealElements = (props) => {
1515 const revealContainer = useRevealContainer ( ) ;
1616 const skyflowContainer = useSkyflow ( ) ;
1717
18- const revealElementRef = useRef ( null ) ;
19-
2018 const handleReveal = ( ) => {
2119 revealContainer
2220 . reveal ( )
@@ -28,16 +26,6 @@ const RevealElements = (props) => {
2826 } ) ;
2927 } ;
3028
31- const handleSetToken = ( ) => {
32- if ( revealElementRef . current ) {
33- console . log ( 'Updating token via Ref...' ) ;
34- // This calls the setToken method you defined in useImperativeHandle inside the SDK
35- revealElementRef . current . setToken ( '57b28973-9690-4031-88fe-b98650d3ac93' ) ;
36- } else {
37- console . error ( 'Ref is null, cannot set token' ) ;
38- }
39- } ;
40-
4129 const handleGet = ( ) => {
4230 const getRecord1 = {
4331 ids : [
@@ -86,8 +74,7 @@ const RevealElements = (props) => {
8674 return (
8775 < View >
8876 < RevealElement
89- ref = { revealElementRef }
90- token = { 'INVALID_TOKEN' }
77+ token = { props . tokens . card_number }
9178 container = { revealContainer }
9279 label = 'Card Number'
9380 altText = 'XXXX XXXX XXXX XXXX'
@@ -96,7 +83,7 @@ const RevealElements = (props) => {
9683 errorTextStyles = { revealerrorTextStyles }
9784 redaction = { RedactionType . REDACTED }
9885 />
99- { /* <RevealElement
86+ < RevealElement
10087 token = { props . tokens . expiration_date }
10188 container = { revealContainer }
10289 label = 'Expiration Date'
@@ -124,12 +111,20 @@ const RevealElements = (props) => {
124111 inputStyles = { revealInputStyles }
125112 labelStyles = { revealLabelStyles }
126113 errorTextStyles = { revealerrorTextStyles }
127- /> */ }
114+ />
128115 < View style = { buttonStyles . button } >
129116 < Button title = 'Reveal' onPress = { handleReveal } />
130117 </ View >
131118 < View style = { buttonStyles . button } >
132- < Button title = 'Update Token (Set Token)' color = "#841584" onPress = { handleSetToken } />
119+ < Button title = 'Get method' onPress = { handleGet } />
120+ </ View >
121+ < View style = { buttonStyles . button } >
122+ < Button
123+ title = 'GO TO COLLECT'
124+ onPress = { ( ) => {
125+ props . setShowRevealView ( null ) ;
126+ } }
127+ />
133128 </ View >
134129 < View style = { buttonStyles . button } >
135130 < Button
@@ -166,4 +161,4 @@ const buttonStyles = StyleSheet.create({
166161 margin : 10 ,
167162 } ,
168163} ) ;
169- export default RevealElements ;
164+ export default RevealElements ;
0 commit comments