File tree 1 file changed +15
-0
lines changed
client/packages/lowcoder/src/comps/comps/textInputComp
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -169,6 +169,7 @@ export const textInputProps = (props: RecordConstructorToView<typeof textInputCh
169
169
export const useTextInputProps = ( props : RecordConstructorToView < typeof textInputChildren > ) => {
170
170
const [ validateState , setValidateState ] = useState ( { } ) ;
171
171
const changeRef = useRef ( false )
172
+ const touchRef = useRef ( false ) ;
172
173
173
174
const propsRef = useRef < RecordConstructorToView < typeof textInputChildren > > ( props ) ;
174
175
propsRef . current = props ;
@@ -195,9 +196,23 @@ export const useTextInputProps = (props: RecordConstructorToView<typeof textInpu
195
196
changeRef . current = false ;
196
197
} , [ inputValue ] ) ;
197
198
199
+ useEffect ( ( ) => {
200
+ if ( ! touchRef . current ) return ;
201
+
202
+ setValidateState (
203
+ textInputValidate ( {
204
+ ...propsRef . current ,
205
+ value : {
206
+ value : props . value . value ,
207
+ } ,
208
+ } )
209
+ ) ;
210
+ } , [ props . customRule ] )
211
+
198
212
const handleChange = ( e : ChangeEvent < HTMLInputElement > ) => {
199
213
props . value . onChange ( e . target . value ) ;
200
214
changeRef . current = true ;
215
+ touchRef . current = true ;
201
216
} ;
202
217
203
218
return [
You can’t perform that action at this time.
0 commit comments