Skip to content

Commit

Permalink
Remove requestAnimationFrame when focusing input on mount
Browse files Browse the repository at this point in the history
  • Loading branch information
janicduplessis committed Nov 19, 2019
1 parent 48cb808 commit 7dcec7d
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions Libraries/Components/TextInput/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,6 @@ class InternalTextInput extends React.Component<Props> {
_focusSubscription: ?Function = undefined;
_lastNativeText: ?Stringish = null;
_lastNativeSelection: ?Selection = null;
_rafId: ?AnimationFrameID = null;

componentDidMount() {
this._lastNativeText = this.props.value;
Expand All @@ -825,12 +824,8 @@ class InternalTextInput extends React.Component<Props> {
TextInputState.registerInput(tag);
}

if (this.props.autoFocus) {
this._rafId = requestAnimationFrame(() => {
if (this._inputRef) {
this._inputRef.focus();
}
});
if (this.props.autoFocus && this._inputRef) {
this._inputRef.focus();
}
}

Expand Down Expand Up @@ -877,9 +872,6 @@ class InternalTextInput extends React.Component<Props> {
if (tag != null) {
TextInputState.unregisterInput(tag);
}
if (this._rafId != null) {
cancelAnimationFrame(this._rafId);
}
}

/**
Expand Down

0 comments on commit 7dcec7d

Please sign in to comment.