-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
How to use react-input-mask with Input? #783
Comments
Can you make an example on stackblitz? You can use https://stackblitz.com/edit/reactstrap-v5a4-starter as a base |
Example on codesandbox https://codesandbox.io/s/pxyo9y36q |
With all of the tag manipulation going on within Input, it doesn't seem to honor the tag passed in. |
Give it a try with the latest release ( |
It is possible to use with react-input-mask and react-hook-form? https://stackblitz.com/edit/reactstrap-v5beta-input-mask-yu6zii?file=Example.js |
Using the latest version of those libs, it is possible to use them together. import React from "react";
import { Input } from "reactstrap";
import useForm from "react-hook-form";
import InputMask from "react-input-mask";
const Example = () => {
const { register, handleSubmit, errors } = useForm();
const onSubmit = data => console.log(data);
console.log(errors);
return (
<div>
<form onSubmit={handleSubmit(onSubmit)}>
<label>react-hook-form</label>
<Input
type="text"
name="input-1"
invalid={errors["input-1"]}
innerRef={register({ required: true })}
/>
<br />
<label>react-input-mask</label>
<Input
type="tel"
mask="+4\9 99 999 99"
maskChar=" "
name="masked"
invalid={errors["masked"]}
inputRef={register({ required: true })}
tag={InputMask}
/>
<br />
<input type="submit" />
</form>
</div>
);
};
export default Example; |
This sample doesn't work. How to apply mask to Input component?
The text was updated successfully, but these errors were encountered: