From 8504e9ba6227ebe2a1c80500f88102aafdba40ec Mon Sep 17 00:00:00 2001 From: Bartosz Grajdek Date: Wed, 6 Mar 2024 17:50:34 +0100 Subject: [PATCH 1/2] Diacritics fix --- src/MarkdownTextInput.web.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/MarkdownTextInput.web.tsx b/src/MarkdownTextInput.web.tsx index 142281ce..314889a5 100644 --- a/src/MarkdownTextInput.web.tsx +++ b/src/MarkdownTextInput.web.tsx @@ -156,6 +156,7 @@ const MarkdownTextInput = React.forwardRef( }, ref, ) => { + const compositionRef = useRef(false); const divRef = useRef(null); const currentlyFocusedField = useRef(null); const contentSelection = useRef(null); @@ -269,6 +270,12 @@ const MarkdownTextInput = React.forwardRef( return; } + if (compositionRef.current) { + updateTextColor(divRef.current, e.target.innerText); + compositionRef.current = false; + return; + } + let text = ''; const nativeEvent = e.nativeEvent as MarkdownNativeEvent; switch (nativeEvent.inputType) { @@ -514,6 +521,10 @@ const MarkdownTextInput = React.forwardRef( divRef.current.focus(); }, []); + const startComposition = useCallback(() => { + compositionRef.current = true; + }, []); + return ( // eslint-disable-next-line jsx-a11y/no-static-element-interactions
( autoCapitalize={autoCapitalize} className={className} onKeyDown={handleKeyPress} + onCompositionStart={startComposition} onKeyUp={updateSelection} onInput={handleOnChangeText} onSelect={handleSelectionChange} From 899a12dfd91d00f6aa96c3300d907aa4b9648dd2 Mon Sep 17 00:00:00 2001 From: OSBotify <76178356+OSBotify@users.noreply.github.com> Date: Thu, 7 Mar 2024 03:52:08 +1100 Subject: [PATCH 2/2] Update version to 0.1.17 (#212) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9e6e16c5..fed5fc20 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@expensify/react-native-live-markdown", - "version": "0.1.16", + "version": "0.1.17", "description": "Drop-in replacement for React Native's TextInput component with Markdown formatting.", "main": "lib/commonjs/index", "module": "lib/module/index",