Skip to content

Commit

Permalink
Revert js changes
Browse files Browse the repository at this point in the history
  • Loading branch information
janicduplessis committed Jan 31, 2020
1 parent 52af952 commit f2ed867
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Libraries/Components/TextInput/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -695,11 +695,6 @@ function useFocusOnMount(
const initialAutoFocusValue = useRef<?boolean>(initialAutoFocus);

useEffect(() => {
// On iOS autoFocus is handled natively.
if (Platform.OS === 'ios') {
return;
}

// We only want to autofocus on initial mount.
// Since initialAutoFocusValue and inputRef will never change
// this should match the expected behavior
Expand All @@ -710,9 +705,14 @@ function useFocusOnMount(
}
};

// On Android this needs to be executed in a rAF callback
// otherwise the keyboard opens then closes immediately.
const rafId = requestAnimationFrame(focus);
let rafId;
if (Platform.OS === 'android') {
// On Android this needs to be executed in a rAF callback
// otherwise the keyboard opens then closes immediately.
rafId = requestAnimationFrame(focus);
} else {
focus();
}

return () => {
if (rafId != null) {
Expand Down

0 comments on commit f2ed867

Please sign in to comment.