Skip to content

Commit

Permalink
fix: Screen goes blank when trying to add column of type Object or …
Browse files Browse the repository at this point in the history
…`GeoPoint` (#2384)
  • Loading branch information
Damian Stasik authored Feb 11, 2023
1 parent fef02d7 commit 0886386
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
9 changes: 2 additions & 7 deletions src/components/TextInput/TextInput.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/lib/withForwardedRef.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import React from 'react';

export function withForwardedRef(Component) {
function render(props, ref) {
return <Component {...props} forwardedRef={ref} />;
const innerRef = React.useRef();
React.useImperativeHandle(ref, () => innerRef.current, [props.multiline]);
return <Component {...props} forwardedRef={innerRef} />;
}

const name = Component.displayName || Component.name;
Expand Down

0 comments on commit 0886386

Please sign in to comment.