Skip to content

Commit 5cad5c8

Browse files
committed
remove input focus delay from web file.
Signed-off-by: krishna2323 <belivethatkg@gmail.com>
1 parent a3d9d41 commit 5cad5c8

1 file changed

Lines changed: 0 additions & 21 deletions

File tree

  • src/components/TextInput/BaseTextInput/implementation

src/components/TextInput/BaseTextInput/implementation/index.tsx

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import {useFocusEffect} from '@react-navigation/native';
21
import {Str} from 'expensify-common';
32
import type {ForwardedRef, RefObject} from 'react';
43
import React, {forwardRef, useCallback, useEffect, useRef, useState} from 'react';
@@ -81,7 +80,6 @@ function BaseTextInput(
8180
placeholderTextColor,
8281
onClearInput,
8382
iconContainerStyle,
84-
shouldDelayFocus = false,
8583
...inputProps
8684
}: BaseTextInputProps,
8785
ref: ForwardedRef<BaseTextInputRef>,
@@ -96,7 +94,6 @@ function BaseTextInput(
9694
const {hasError = false} = inputProps;
9795
const StyleUtils = useStyleUtils();
9896
const {translate} = useLocalize();
99-
const focusTimeoutRef = useRef<NodeJS.Timeout | null>(null);
10097

10198
// Disabling this line for safeness as nullish coalescing works only if value is undefined or null
10299
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
@@ -289,23 +286,6 @@ function BaseTextInput(
289286
// If we need some other inputMode (eg. 'decimal'), then the autocomplete bar will show, but we can do nothing about it as it's a known Chrome bug.
290287
const inputMode = inputProps.inputMode ?? (isMobileChrome() ? 'search' : undefined);
291288

292-
useFocusEffect(
293-
useCallback(() => {
294-
if (!shouldDelayFocus || !inputProps.autoFocus) {
295-
return;
296-
}
297-
298-
focusTimeoutRef.current = setTimeout(() => {
299-
if (!input.current) {
300-
return;
301-
}
302-
input.current.focus();
303-
}, CONST.ANIMATED_TRANSITION);
304-
305-
return () => focusTimeoutRef.current && clearTimeout(focusTimeoutRef.current);
306-
}, [shouldDelayFocus, inputProps.autoFocus]),
307-
);
308-
309289
return (
310290
<>
311291
<View
@@ -450,7 +430,6 @@ function BaseTextInput(
450430
readOnly={isReadOnly}
451431
defaultValue={defaultValue}
452432
markdownStyle={markdownStyle}
453-
autoFocus={shouldDelayFocus ? false : inputProps.autoFocus}
454433
/>
455434
{!!suffixCharacter && (
456435
<View style={[styles.textInputSuffixWrapper, suffixContainerStyle]}>

0 commit comments

Comments
 (0)