ant-design / ant-design/pro-components

🐛 [BUG] ProFormText onMetaChange is not trigger

Open
#9,176 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
4.8k
Forks
1.4k
Avg merge
10h 44m
Merged PRs (30d)
3

Description

No matter how I test, onMetaChange is untrigerable in a ProFormText.

```
export type TelFieldProps = {
onValidate: (value: string, validated: boolean) => void;
};

const TelField: React.FC = (props: TelFieldProps) => {
const {onValidate} = props;
const intl = useIntl();
const handleMetaChange = (meta: MetaEvent) => {
console.log(meta)
}
return (
,
autoComplete: 'on',
}}
name="tel"
placeholder={intl.formatMessage({
id: 'pages.login.phoneNumber.placeholder',
defaultMessage: 'Phone Number',
})}
rules={[
{
required: true,
message: (

),
},
{
validator: async (_: any, value: any) => {
if (!value) {
return Promise.resolve()
} else if (TelRegPattern.test(value)) {
return Promise.resolve()
} else {
return Promise.reject(new Error("FS"))
}
},
message: (

),
},
]}
onMetaChange={handleMetaChange}
/>
);
};
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the provided ProFormText example and tracing the onMetaChange callback from the ProFormText component entry point. Compare the callback behavior with the validation rules in the example; done means onMetaChange is invoked when the field metadata changes and the regression is covered by an appropriate test.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.