Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd98d2c5

Browse files
immediately trigger custom validation on input change
1 parent16e8b29 commitd98d2c5

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

‎client/packages/lowcoder/src/comps/comps/textInputComp/textInputConstants.tsx‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import {
3232
requiredPropertyView,
3333
}from"comps/utils/propertyUtils";
3434
import{trans}from"i18n";
35-
import{ChangeEvent,useRef,useState}from"react";
35+
import{ChangeEvent,useEffect,useRef,useState}from"react";
3636
import{refMethods}from"comps/generators/withMethodExposing";
3737
import{InputRef}from"antd/es/input";
3838
import{
@@ -168,17 +168,22 @@ export const useTextInputProps = (props: RecordConstructorToView<typeof textInpu
168168
constpropsRef=useRef<RecordConstructorToView<typeoftextInputChildren>>(props);
169169
propsRef.current=props;
170170

171-
consthandleChange=(e:ChangeEvent<HTMLInputElement>)=>{
172-
props.value.onChange(e.target.value);
173-
propsRef.current.onEvent("change");
171+
constinputValue=props.value.value;
172+
173+
useEffect(()=>{
174174
setValidateState(
175175
textInputValidate({
176176
...propsRef.current,
177177
value:{
178-
value:e.target.value,
178+
value:inputValue,
179179
},
180180
})
181181
);
182+
},[inputValue]);
183+
184+
consthandleChange=(e:ChangeEvent<HTMLInputElement>)=>{
185+
props.value.onChange(e.target.value);
186+
propsRef.current.onEvent("change");
182187
};
183188
return[
184189
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp