Skip to content
This repository has been archived by the owner on Aug 17, 2023. It is now read-only.

Field blinks masked and then unmasked #72

Open
paulorsbrito opened this issue Mar 19, 2023 · 3 comments
Open

Field blinks masked and then unmasked #72

paulorsbrito opened this issue Mar 19, 2023 · 3 comments

Comments

@paulorsbrito
Copy link

paulorsbrito commented Mar 19, 2023

  • I'm submitting a ...
    [X] bug report

  • Summary
    All the MaskedInput fields in a edit resource show it's values initially masked and then, less than a second later, turns into unmasked values. If I focus the field, it shows masked again and stays.
    This happens only after the second time I edit the record.

  • Other information

The code is as simple as this:

<Edit saveButtonProps={saveButtonProps}>
  <Form {...formProps}>
    <Form.Item
      label="Phone Number"
      name={["phoneNumber"]}
    >
      <MaskedInput mask="(00) 0 0000-0000" />
    </Form.Item>
 </Form>
</Edit>

I'm using @pankod/[email protected], @refinedev/[email protected], @refinedev/[email protected], [email protected], [email protected]

@paulorsbrito
Copy link
Author

I managed to solve this by passing down an already formatted value, usind getValueProps. I don't think that's the ideal solution but... it is what it is.

@pferreirafabricio
Copy link

Same problem here...

@pferreirafabricio
Copy link

pferreirafabricio commented Jun 20, 2023

I managed to solve this by passing down an already formatted value, usind getValueProps. I don't think that's the ideal solution but... it is what it is.

For me the solution was that as well, I did something like this using a ref to the <Form>:

formRef.current?.resetFields();
formRef.current?.setFieldValue('maskValueNameInForm', maskFunction(myValueWithoutMask))

And my form look like this:

<Form
    ref={ref}
    ...
  >
    <Form.Item
      label='Value with mask'
      name='maskValueNameInForm'
    >
      <MaskedInput
        mask='your-mask'
      />
    </Form.Item>
</Form>

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants