diff --git a/src/components/TextInput/TextInput.react.js b/src/components/TextInput/TextInput.react.js
index 3ba85e59af..38149edf12 100644
--- a/src/components/TextInput/TextInput.react.js
+++ b/src/components/TextInput/TextInput.react.js
@@ -11,15 +11,10 @@ import styles from 'components/TextInput/TextInput.scss';
import { withForwardedRef } from 'lib/withForwardedRef';
class TextInput extends React.Component {
- componentWillReceiveProps(props) {
+ componentDidUpdate(props) {
if (props.multiline !== this.props.multiline) {
const node = props.forwardedRef.current;
- // wait a little while for component to re-render
- setTimeout(function() {
- node.focus();
- node.value = '';
- node.value = props.value;
- }.bind(this), 1);
+ node.focus();
}
}
diff --git a/src/lib/withForwardedRef.js b/src/lib/withForwardedRef.js
index 27615efe37..8b76c1333c 100644
--- a/src/lib/withForwardedRef.js
+++ b/src/lib/withForwardedRef.js
@@ -2,7 +2,9 @@ import React from 'react';
export function withForwardedRef(Component) {
function render(props, ref) {
- return ;
+ const innerRef = React.useRef();
+ React.useImperativeHandle(ref, () => innerRef.current, [props.multiline]);
+ return ;
}
const name = Component.displayName || Component.name;