1
- import React , { useContext } from 'react' ;
1
+ import React , { useContext , useRef , useEffect } from 'react' ;
2
2
import PropTypes from 'prop-types' ;
3
3
import { FormContext , handleInputChange } from './form-helpers' ;
4
4
5
- export function FormInput ( { id, type, name, required, placeholder } ) {
5
+ export function FormInput ( { id, type, name, placeholder , required, minLength , maxLength , min , max , pattern , step } ) {
6
6
const formState = useContext ( FormContext ) ;
7
7
8
8
return (
9
9
< input
10
- { ...{ required, name, id, placeholder, type } }
10
+ { ...{ required, name, id, placeholder, type, minLength , maxLength , min , max , pattern , step } }
11
11
className = "form-control"
12
12
onChange = { handleInputChange . bind ( null , formState ) }
13
13
value = { formState . getValue ( name ) || '' }
@@ -25,4 +25,10 @@ FormInput.propTypes = {
25
25
name : PropTypes . string . isRequired ,
26
26
placeholder : PropTypes . string ,
27
27
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 ,
28
34
} ;
0 commit comments