File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ import { Button, paraGraphDefaultStyle } from './styled';
44
55type  Props  =  { 
66  formState : any ; 
7+   readFormStateRef : React . MutableRefObject < { 
8+     isValid : boolean ; 
9+   } > ; 
710  showFormState : boolean ; 
811  setShowFormState : ( payload : boolean )  =>  void ; 
912} ; 
@@ -12,6 +15,7 @@ const FormStateTable = ({
1215  formState, 
1316  showFormState, 
1417  setShowFormState, 
18+   readFormStateRef, 
1519} : Props )  =>  ( 
1620  < div 
1721    style = { { 
@@ -34,11 +38,16 @@ const FormStateTable = ({
3438            </ td > 
3539            < td 
3640              style = { { 
37-                 color : formState . isValid  ? colors . green  : colors . lightPink , 
41+                 color :
42+                   readFormStateRef . current . isValid  &&  formState . isValid 
43+                     ? colors . green 
44+                     : colors . lightPink , 
3845                ...paraGraphDefaultStyle , 
3946              } } 
4047            > 
41-               { formState . isValid  ? 'true'  : 'false' } 
48+               { readFormStateRef . current . isValid  &&  formState . isValid 
49+                 ? 'true' 
50+                 : 'false' } 
4251            </ td > 
4352          </ tr > 
4453          < tr > 
@@ -105,7 +114,10 @@ const FormStateTable = ({
105114      < span 
106115        style = { { 
107116          transition : '0.5s all' , 
108-           color : formState . isValid  ? colors . green  : colors . lightPink , 
117+           color :
118+             readFormStateRef . current . isValid  &&  formState . isValid 
119+               ? colors . green 
120+               : colors . lightPink , 
109121        } } 
110122      > 
111123        ■
Original file line number Diff line number Diff line change @@ -146,6 +146,7 @@ export default ({
146146      </ div > 
147147
148148      < FormStateTable 
149+         readFormStateRef = { readFormStateRef } 
149150        formState = { formState } 
150151        showFormState = { showFormState } 
151152        setShowFormState = { setShowFormState } 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments