Skip to content

Commit 0886386

Browse files
author
Damian Stasik
authored
fix: Screen goes blank when trying to add column of type Object or GeoPoint (#2384)
1 parent fef02d7 commit 0886386

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/components/TextInput/TextInput.react.js

+2-7
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,10 @@ import styles from 'components/TextInput/TextInput.scss';
1111
import { withForwardedRef } from 'lib/withForwardedRef';
1212

1313
class TextInput extends React.Component {
14-
componentWillReceiveProps(props) {
14+
componentDidUpdate(props) {
1515
if (props.multiline !== this.props.multiline) {
1616
const node = props.forwardedRef.current;
17-
// wait a little while for component to re-render
18-
setTimeout(function() {
19-
node.focus();
20-
node.value = '';
21-
node.value = props.value;
22-
}.bind(this), 1);
17+
node.focus();
2318
}
2419
}
2520

src/lib/withForwardedRef.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ import React from 'react';
22

33
export function withForwardedRef(Component) {
44
function render(props, ref) {
5-
return <Component {...props} forwardedRef={ref} />;
5+
const innerRef = React.useRef();
6+
React.useImperativeHandle(ref, () => innerRef.current, [props.multiline]);
7+
return <Component {...props} forwardedRef={innerRef} />;
68
}
79

810
const name = Component.displayName || Component.name;

0 commit comments

Comments
 (0)