From 94c379085808cfcab7b2b9c510b40c0bbc09517d Mon Sep 17 00:00:00 2001 From: truph01 Date: Tue, 20 May 2025 17:51:19 +0700 Subject: [PATCH 1/3] fix: update currentlyFocusedNode on focus --- src/MarkdownTextInput.web.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/MarkdownTextInput.web.tsx b/src/MarkdownTextInput.web.tsx index a93833a8..52ebe5ec 100644 --- a/src/MarkdownTextInput.web.tsx +++ b/src/MarkdownTextInput.web.tsx @@ -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'; @@ -553,6 +553,7 @@ const MarkdownTextInput = React.forwardRef { hasJustBeenFocused.current = true; const e = event as unknown as NativeSyntheticEvent; + RNTextInput.State.focusTextInput?.(e.target); const hostNode = e.target as unknown as HTMLDivElement; currentlyFocusedField.current = hostNode; setEventProps(e); @@ -600,6 +601,7 @@ const MarkdownTextInput = React.forwardRef = useCallback( (event) => { const e = event as unknown as NativeSyntheticEvent; + RNTextInput.State.blurTextInput?.(e.target) removeSelection(); currentlyFocusedField.current = null; if (onBlur) { From a2d2362b264a144342f913b5eb8df550e3af5312 Mon Sep 17 00:00:00 2001 From: Tomasz Zawadzki Date: Tue, 20 May 2025 15:48:16 +0200 Subject: [PATCH 2/3] Update src/MarkdownTextInput.web.tsx --- src/MarkdownTextInput.web.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MarkdownTextInput.web.tsx b/src/MarkdownTextInput.web.tsx index 52ebe5ec..c576ab43 100644 --- a/src/MarkdownTextInput.web.tsx +++ b/src/MarkdownTextInput.web.tsx @@ -601,7 +601,7 @@ const MarkdownTextInput = React.forwardRef = useCallback( (event) => { const e = event as unknown as NativeSyntheticEvent; - RNTextInput.State.blurTextInput?.(e.target) + RNTextInput.State.blurTextInput?.(e.target); removeSelection(); currentlyFocusedField.current = null; if (onBlur) { From 0310269eaf5c0bd26e5f02ed8e90ef05b78a5620 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ska=C5=82ka?= Date: Fri, 23 May 2025 11:24:17 +0200 Subject: [PATCH 3/3] Fix lint errors --- src/MarkdownTextInput.web.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MarkdownTextInput.web.tsx b/src/MarkdownTextInput.web.tsx index c576ab43..1d437c50 100644 --- a/src/MarkdownTextInput.web.tsx +++ b/src/MarkdownTextInput.web.tsx @@ -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, TextInput as RNTextInput } 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';