Skip to content

Commit 927f23e

Browse files
committed
fix(forms): include missing validation properties do FormInput
1 parent 3311df1 commit 927f23e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/forms/FormInput.jsx

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import React, { useContext } from 'react';
1+
import React, { useContext, useRef, useEffect } from 'react';
22
import PropTypes from 'prop-types';
33
import { FormContext, handleInputChange } from './form-helpers';
44

5-
export function FormInput({ id, type, name, required, placeholder }) {
5+
export function FormInput({ id, type, name, placeholder, required, minLength, maxLength, min, max, pattern, step }) {
66
const formState = useContext(FormContext);
77

88
return (
99
<input
10-
{...{ required, name, id, placeholder, type }}
10+
{...{ required, name, id, placeholder, type, minLength, maxLength, min, max, pattern, step }}
1111
className="form-control"
1212
onChange={handleInputChange.bind(null, formState)}
1313
value={formState.getValue(name) || ''}
@@ -25,4 +25,10 @@ FormInput.propTypes = {
2525
name: PropTypes.string.isRequired,
2626
placeholder: PropTypes.string,
2727
required: PropTypes.any,
28+
minLength: PropTypes.string,
29+
maxLength: PropTypes.string,
30+
min: PropTypes.string,
31+
max: PropTypes.string,
32+
pattern: PropTypes.string,
33+
step: PropTypes.string,
2834
};

0 commit comments

Comments
 (0)