Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/components/TextPicker/TextSelectorModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function TextSelectorModal({
const {shouldUseNarrowLayout} = useResponsiveLayout();

const [currentValue, setValue] = useState(value);
const [isClosing, setIsClosing] = useState(false);

const inputRef = useRef<TextInputType | null>(null);
const inputValueRef = useRef(value);
Expand All @@ -50,6 +51,7 @@ function TextSelectorModal({
};

const hide = useCallback(() => {
setIsClosing(true);
onClose();
if (shouldClearOnClose) {
setValue('');
Expand Down Expand Up @@ -86,6 +88,7 @@ function TextSelectorModal({
return;
}
setValue(value);
setIsClosing(false);
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, [isVisible]);

Expand Down Expand Up @@ -161,6 +164,7 @@ function TextSelectorModal({
addBottomSafeAreaPadding
enterKeyEventListenerPriority={0}
allowHTML={allowHTML}
shouldValidateOnBlur={!isClosing}
>
{!!subtitle && (
<View style={styles.pb4}>
Expand Down
6 changes: 2 additions & 4 deletions src/utils/keyboard/index.android.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Keyboard, Platform} from 'react-native';
import {Keyboard} from 'react-native';
import {KeyboardEvents} from 'react-native-keyboard-controller';

type SimplifiedKeyboardEvent = {
Expand Down Expand Up @@ -39,9 +39,7 @@ const dismiss = (): Promise<void> => {

const dismissKeyboardAndExecute = (cb: () => void): Promise<void> => {
return new Promise((resolve) => {
// This fixes a bug specific to Android < 16 (Platform.Version < 36)
// https://github.com/Expensify/App/issues/70692
if (!isVisible || Number(Platform.Version) >= 36) {
if (!isVisible) {
cb();
resolve();
return;
Expand Down
Loading