1- import React from 'react' ;
1+ import React , { useEffect } from 'react' ;
22import PropTypes from 'prop-types' ;
33import classNames from 'classnames' ;
44import webexComponentClasses from '../../helpers' ;
@@ -22,6 +22,7 @@ import Label from '../../inputs/Label/Label';
2222 * @param {number } [props.maxLength] Maximum number of characters allowed
2323 * @param {number } [props.min] Minimum value for the input element
2424 * @param {string } [props.name] Input name
25+ * @param {Function } [props.onBrowserControlRef] Action to perform to take the input ref
2526 * @param {Function } [props.onChange] Action to perform on input change
2627 * @param {string } [props.pattern] Specifies a regular expression that the element's value is checked against
2728 * @param {string } [props.placeholder] Input placeholder
@@ -47,6 +48,7 @@ export default function InputField({
4748 min,
4849 name,
4950 onChange,
51+ onBrowserControlRef,
5052 pattern,
5153 placeholder,
5254 required,
@@ -76,6 +78,10 @@ export default function InputField({
7678
7779 useAutoFocus ( inputRef , autoFocus ) ;
7880
81+ useEffect ( ( ) => {
82+ onBrowserControlRef ( inputRef . current ) ;
83+ } , [ inputRef , onBrowserControlRef ] ) ;
84+
7985 return (
8086 < Label
8187 className = { cssClasses }
@@ -139,6 +145,7 @@ InputField.propTypes = {
139145 min : PropTypes . number ,
140146 name : PropTypes . string ,
141147 onChange : PropTypes . func ,
148+ onBrowserControlRef : PropTypes . func ,
142149 pattern : PropTypes . string ,
143150 placeholder : PropTypes . string ,
144151 required : PropTypes . bool ,
@@ -169,6 +176,7 @@ InputField.defaultProps = {
169176 min : undefined ,
170177 name : undefined ,
171178 onChange : undefined ,
179+ onBrowserControlRef : ( ) => { } ,
172180 pattern : undefined ,
173181 placeholder : undefined ,
174182 required : false ,
0 commit comments