@@ -60,12 +60,12 @@ export default function useFieldState({
6060 } , [ isValid ] ) ;
6161
6262 const validateField = useCallback ( ( valueToValidate = value ) => {
63- const [ _isValid , _failingValidatorIndex ] = Presenter . validate ( valueToValidate , validate , validationMessage ) ;
63+ const [ _isValid , _failingValidatorIndex ] = Presenter . validate ( valueToValidate , validate ) ;
6464
6565 setIsValid ( _isValid ) ;
6666 setFailingValidatorIndex ( _failingValidatorIndex ) ;
6767 } ,
68- [ value , validate , validationMessage ] ) ;
68+ [ value , validate ] ) ;
6969
7070 const onFocus = useCallback ( ( ...args : any ) => {
7171 setIsFocused ( true ) ;
@@ -95,8 +95,14 @@ export default function useFieldState({
9595 [ props . onChangeText , validateOnChange , validateField ] ) ;
9696
9797 const fieldState = useMemo ( ( ) => {
98- return { value, hasValue : ! _ . isEmpty ( value ) , isValid, isFocused, failingValidatorIndex} ;
99- } , [ value , isFocused , isValid , failingValidatorIndex ] ) ;
98+ return {
99+ value,
100+ hasValue : ! _ . isEmpty ( value ) ,
101+ isValid : validationMessage && ! validate ? false : isValid ,
102+ isFocused,
103+ failingValidatorIndex
104+ } ;
105+ } , [ value , isFocused , isValid , failingValidatorIndex , validationMessage , validate ] ) ;
100106
101107 return {
102108 onFocus,
0 commit comments