Skip to content

Error on alpha version 3.0.0-alpha.12 #319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
nordiws opened this issue Oct 25, 2023 · 2 comments
Open

Error on alpha version 3.0.0-alpha.12 #319

nordiws opened this issue Oct 25, 2023 · 2 comments

Comments

@nordiws
Copy link

nordiws commented Oct 25, 2023

Error stack:
Unhandled Runtime Error
TypeError: Cannot read properties of undefined (reading 'disabled')

Call Stack
eval
node_modules\react-input-mask-next\lib\react-input-mask.development.js (340:0)
Array.filter

validateChildren
node_modules\react-input-mask-next\lib\react-input-mask.development.js (339:0)
InputMask
node_modules\react-input-mask-next\lib\react-input-mask.development.js (1004:0)

And im not even using the disabled prop

@mclbdn
Copy link

mclbdn commented Dec 12, 2023

Same issue here.

@VGontier-cmd
Copy link

VGontier-cmd commented Jun 21, 2024

I had the same issue and was able to resolve it. If you're using the Chakra-UI Input component, use the as prop to change the rendered element and combine InputMask and Chakra-UI Input props instead of directly putting the Input component as a child of InputMask.

Example :

<Input
  as={InputMask}
  mask={withTime ? '**/**/**** **:**' : '**/**/****'}
  width="full"
  disabled={isDisabled}
  name={name || 'date-input'}
  type="text"
  variant={variant}
  placeholder={placeholder || defaultDateFormat}
  value={dateValue}
  onChange={(e) => {
    const newValue = e.currentTarget.value
      .replace(/[^0-9 /:]/g, '')
      .slice(0, withTime ? 16 : 10); // Sanitize the input
    setDateValue(newValue);
    handleInputChange(newValue);
  }}
  {...inputProps}
/>

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

No branches or pull requests

3 participants