antoniopresto / antd-mask-input

MIT License
88 stars 38 forks source link

Update code to support setFieldsValue from Form object. #46

Closed JoaoZanetti closed 2 years ago

JoaoZanetti commented 2 years ago
antoniopresto commented 2 years ago

Can't reproduce. This example is working:

   const [form] = Form.useForm();

  React.useEffect(() => {
    const interval = setInterval(() => {
      form.setFieldsValue({phone: `${Math.random()*1000}`})
    }, 700);

    return () => clearInterval(interval)
  }, [])

  return <Form form={form}>
    <Form.Item
      label="Phone"
      name="phone"
      initialValue={'11'}
    >
      <DynamicPhone />
    </Form.Item>
  </Form>

I would recommend you to check your antd version or log Object.keys(newObj)

The version 2.0.0 Requires antd >= 4.19.0 - for previous versions use the version 0.1.15