mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-30 02:56:20 -05:00
formik-input can set ref to its inner input
This commit is contained in:
parent
e55d2f27d8
commit
b438eed70d
1 changed files with 4 additions and 1 deletions
|
@ -11,6 +11,7 @@ require('./formik-input.scss');
|
||||||
const FormikInput = ({
|
const FormikInput = ({
|
||||||
className,
|
className,
|
||||||
error,
|
error,
|
||||||
|
setRef,
|
||||||
toolTip,
|
toolTip,
|
||||||
validationClassName,
|
validationClassName,
|
||||||
wrapperClassName,
|
wrapperClassName,
|
||||||
|
@ -30,6 +31,8 @@ const FormikInput = ({
|
||||||
{fail: error},
|
{fail: error},
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
|
/* formik uses "innerRef" to return the actual input element */
|
||||||
|
innerRef={setRef}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
{error ? (
|
{error ? (
|
||||||
|
@ -48,10 +51,10 @@ const FormikInput = ({
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
FormikInput.propTypes = {
|
FormikInput.propTypes = {
|
||||||
className: PropTypes.string,
|
className: PropTypes.string,
|
||||||
error: PropTypes.string,
|
error: PropTypes.string,
|
||||||
|
setRef: PropTypes.func,
|
||||||
toolTip: PropTypes.string,
|
toolTip: PropTypes.string,
|
||||||
type: PropTypes.string,
|
type: PropTypes.string,
|
||||||
validationClassName: PropTypes.string,
|
validationClassName: PropTypes.string,
|
||||||
|
|
Loading…
Reference in a new issue