Skip to content
Merged
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: 3 additions & 1 deletion src/MarkdownTextInput.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type {
} from 'react-native';
import React, {useEffect, useRef, useCallback, useMemo, useLayoutEffect} from 'react';
import type {CSSProperties, MutableRefObject, ReactEventHandler, FocusEventHandler, MouseEvent, KeyboardEvent, SyntheticEvent, ClipboardEventHandler, TouchEvent} from 'react';
import {StyleSheet} from 'react-native';
import {StyleSheet, TextInput as RNTextInput} from 'react-native';
import {updateInputStructure} from './web/utils/parserUtils';
import InputHistory from './web/InputHistory';
import type {TreeNode} from './web/utils/treeUtils';
Expand Down Expand Up @@ -553,6 +553,7 @@ const MarkdownTextInput = React.forwardRef<MarkdownTextInput, MarkdownTextInputP
(event) => {
hasJustBeenFocused.current = true;
const e = event as unknown as NativeSyntheticEvent<TextInputFocusEventData>;
RNTextInput.State.focusTextInput?.(e.target);
const hostNode = e.target as unknown as HTMLDivElement;
currentlyFocusedField.current = hostNode;
setEventProps(e);
Expand Down Expand Up @@ -600,6 +601,7 @@ const MarkdownTextInput = React.forwardRef<MarkdownTextInput, MarkdownTextInputP
const handleBlur: FocusEventHandler<HTMLDivElement> = useCallback(
(event) => {
const e = event as unknown as NativeSyntheticEvent<TextInputFocusEventData>;
RNTextInput.State.blurTextInput?.(e.target);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, coming from Expensify/App#72458, the input lose focused when switching between tabs, and we have fixed it here #736.

removeSelection();
currentlyFocusedField.current = null;
if (onBlur) {
Expand Down