Skip to content

Commit

Permalink
Merge pull request #51453 from bernhardoj/fix/51279-keyboard-doesn't-…
Browse files Browse the repository at this point in the history
…show
  • Loading branch information
cead22 authored Nov 13, 2024
2 parents b1c1a4b + d23fc21 commit 1b9e302
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import useNetwork from '@hooks/useNetwork';
import useStyleUtils from '@hooks/useStyleUtils';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import * as Browser from '@libs/Browser';
import * as ErrorUtils from '@libs/ErrorUtils';
import * as ValidationUtils from '@libs/ValidationUtils';
import * as User from '@userActions/User';
Expand Down Expand Up @@ -120,9 +121,16 @@ function BaseValidateCodeForm({
if (focusTimeoutRef.current) {
clearTimeout(focusTimeoutRef.current);
}
focusTimeoutRef.current = setTimeout(() => {

// Keyboard won't show if we focus the input with a delay, so we need to focus immediately.
if (!Browser.isMobileSafari()) {
focusTimeoutRef.current = setTimeout(() => {
inputValidateCodeRef.current?.focusLastSelected();
}, CONST.ANIMATED_TRANSITION);
} else {
inputValidateCodeRef.current?.focusLastSelected();
}, CONST.ANIMATED_TRANSITION);
}

return () => {
if (!focusTimeoutRef.current) {
return;
Expand Down Expand Up @@ -205,7 +213,7 @@ function BaseValidateCodeForm({
errorText={formError?.validateCode ? translate(formError?.validateCode) : ErrorUtils.getLatestErrorMessage(account ?? {})}
hasError={!isEmptyObject(validateError)}
onFulfill={validateAndSubmitForm}
autoFocus
autoFocus={false}
/>
{shouldShowTimer && (
<Text style={[styles.mt5]}>
Expand Down

0 comments on commit 1b9e302

Please sign in to comment.