Skip to content

Commit ead1df3

Browse files
truph01tomekzawSkalakid
authored
fix: update currentlyFocusedNode on focus (#680)
Co-authored-by: Tomasz Zawadzki <tomekzawadzki98@gmail.com> Co-authored-by: Michał Skałka <michal.skalka@swmansion.com>
1 parent 940b28b commit ead1df3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/MarkdownTextInput.web.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import type {
1313
} from 'react-native';
1414
import React, {useEffect, useRef, useCallback, useMemo, useLayoutEffect} from 'react';
1515
import type {CSSProperties, MutableRefObject, ReactEventHandler, FocusEventHandler, MouseEvent, KeyboardEvent, SyntheticEvent, ClipboardEventHandler, TouchEvent} from 'react';
16-
import {StyleSheet} from 'react-native';
16+
import {StyleSheet, TextInput as RNTextInput} from 'react-native';
1717
import {updateInputStructure} from './web/utils/parserUtils';
1818
import InputHistory from './web/InputHistory';
1919
import type {TreeNode} from './web/utils/treeUtils';
@@ -553,6 +553,7 @@ const MarkdownTextInput = React.forwardRef<MarkdownTextInput, MarkdownTextInputP
553553
(event) => {
554554
hasJustBeenFocused.current = true;
555555
const e = event as unknown as NativeSyntheticEvent<TextInputFocusEventData>;
556+
RNTextInput.State.focusTextInput?.(e.target);
556557
const hostNode = e.target as unknown as HTMLDivElement;
557558
currentlyFocusedField.current = hostNode;
558559
setEventProps(e);
@@ -600,6 +601,7 @@ const MarkdownTextInput = React.forwardRef<MarkdownTextInput, MarkdownTextInputP
600601
const handleBlur: FocusEventHandler<HTMLDivElement> = useCallback(
601602
(event) => {
602603
const e = event as unknown as NativeSyntheticEvent<TextInputFocusEventData>;
604+
RNTextInput.State.blurTextInput?.(e.target);
603605
removeSelection();
604606
currentlyFocusedField.current = null;
605607
if (onBlur) {

0 commit comments

Comments
 (0)