Skip to content

Commit 90ac4ef

Browse files
authored
Merge pull request #39621 from software-mansion-labs/@BartoszGrajdek/cursor-position-when-typing-fast
[Fix] One character jumps "after" cursor when typing fast
2 parents 8614ce4 + f4108c9 commit 90ac4ef

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

ios/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,7 +1363,7 @@ PODS:
13631363
- RNGoogleSignin (10.0.1):
13641364
- GoogleSignIn (~> 7.0)
13651365
- React-Core
1366-
- RNLiveMarkdown (0.1.36):
1366+
- RNLiveMarkdown (0.1.38):
13671367
- glog
13681368
- RCT-Folly (= 2022.05.16.00)
13691369
- React-Core
@@ -1904,7 +1904,7 @@ SPEC CHECKSUMS:
19041904
RNFS: 4ac0f0ea233904cb798630b3c077808c06931688
19051905
RNGestureHandler: 25b969a1ffc806b9f9ad2e170d4a3b049c6af85e
19061906
RNGoogleSignin: ccaa4a81582cf713eea562c5dd9dc1961a715fd0
1907-
RNLiveMarkdown: e6312e556c522dd178728b28e132b16354789cb8
1907+
RNLiveMarkdown: 0f7819903c63a786bbb80fd620baba10d43dfe18
19081908
RNLocalize: d4b8af4e442d4bcca54e68fc687a2129b4d71a81
19091909
rnmapbox-maps: fcf7f1cbdc8bd7569c267d07284e8a5c7bee06ed
19101910
RNPermissions: 9b086c8f05b2e2faa587fdc31f4c5ab4509728aa

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
},
6363
"dependencies": {
6464
"@dotlottie/react-player": "^1.6.3",
65-
"@expensify/react-native-live-markdown": "0.1.36",
65+
"@expensify/react-native-live-markdown": "0.1.38",
6666
"@expo/metro-runtime": "~3.1.1",
6767
"@formatjs/intl-datetimeformat": "^6.10.0",
6868
"@formatjs/intl-listformat": "^7.2.2",

src/components/Composer/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,12 @@ function Composer(
126126
* Adds the cursor position to the selection change event.
127127
*/
128128
const addCursorPositionToSelectionChange = (event: NativeSyntheticEvent<TextInputSelectionChangeEventData>) => {
129+
if (!isRendered) {
130+
return;
131+
}
129132
const webEvent = event as BaseSyntheticEvent<TextInputSelectionChangeEventData>;
130133

131-
if (shouldCalculateCaretPosition && isRendered) {
134+
if (shouldCalculateCaretPosition) {
132135
// we do flushSync to make sure that the valueBeforeCaret is updated before we calculate the caret position to receive a proper position otherwise we will calculate position for the previous state
133136
flushSync(() => {
134137
setValueBeforeCaret(webEvent.target.value.slice(0, webEvent.nativeEvent.selection.start));

0 commit comments

Comments
 (0)