File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change 1- import React from "react" ;
1+ import React , { useContext , useEffect } from "react" ;
22import { StyleSheet , TextInput } from "react-native" ;
33
4- import { FramesConsumer } from "../Frames" ;
4+ import { FramesConsumer , FramesContext } from "../Frames" ;
55import { DEFAULT_CVV_PLACEHOLDER } from "../utils/constants" ;
66import { CVV_CHANGE } from "../utils/actions" ;
77import { FramesFieldProps } from "../types/types" ;
88
99const Cvv : React . SFC < FramesFieldProps > = ( props ) => {
10+ const { dispatch } = useContext ( FramesContext ) ;
11+
12+ useEffect ( ( ) => {
13+ dispatch ( { type : CVV_CHANGE , payload : props . value } ) ;
14+ } , [ props . value ] ) ;
15+
1016 return (
1117 < FramesConsumer >
1218 { ( { state, dispatch } ) => {
Original file line number Diff line number Diff line change 1- import React from "react" ;
1+ import React , { useContext , useEffect } from "react" ;
22import { StyleSheet , TextInput } from "react-native" ;
33
4- import { FramesConsumer } from "../Frames" ;
4+ import { FramesConsumer , FramesContext } from "../Frames" ;
55import { DEFAULT_CARD_EXPIRY_DATE_PLACEHOLDER } from "../utils/constants" ;
66import { DATE_CHANGE } from "../utils/actions" ;
77import { FramesFieldProps } from "../types/types" ;
88
99const ExpiryDate : React . SFC < FramesFieldProps > = ( props ) => {
10+ const { dispatch } = useContext ( FramesContext ) ;
11+
12+ useEffect ( ( ) => {
13+ dispatch ( { type : DATE_CHANGE , payload : props . value } ) ;
14+ } , [ props . value ] ) ;
15+
1016 return (
1117 < FramesConsumer >
1218 { ( { state, dispatch } ) => {
You can’t perform that action at this time.
0 commit comments