From 0265ee199b364d5501d969dd389753d20f01c8d5 Mon Sep 17 00:00:00 2001 From: Ramanpreet Nara Date: Wed, 9 Jan 2019 15:19:16 -0800 Subject: [PATCH] Fix autoFocus Summary: In D13408886, I landed a PR that broke the `autoFocus` prop. This diff fixes this prop by partially reveting some of the changes in that diff. Reviewed By: TheSavior Differential Revision: D13611258 fbshipit-source-id: 225b9b59b2500cfac092f13c273685aaeb599ab0 --- Libraries/Components/TextInput/TextInput.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Libraries/Components/TextInput/TextInput.js b/Libraries/Components/TextInput/TextInput.js index 523c25751..a6780fabd 100644 --- a/Libraries/Components/TextInput/TextInput.js +++ b/Libraries/Components/TextInput/TextInput.js @@ -891,6 +891,10 @@ const TextInput = createReactClass({ // tag is null only in unit tests TextInputState.registerInput(tag); } + + if (this.props.autoFocus) { + this._rafId = requestAnimationFrame(this.focus); + } }, componentWillUnmount: function() {