Repository navigation
Commit 0655837
[Android] Commit TextInput native state updates synchronously
A multiline TextInput re-flows and repaints its text on the keystroke, but
its frame only changed once the state update sent from the text watcher
was flushed asynchronously (next Choreographer tick, commit and layout on
the JS thread, mount on the following UI frame). Every change that adds
or removes a line therefore drew one frame with the new text and the old
height, which showed up as a content jump.
Dispatch that state update with UpdateMode.unstable_Immediate so the
commit, layout and mount happen inside onTextChanged, before the frame
is drawn, and refresh the cached spannable before notifying the text
watchers so the synchronous measure sees the new text.
Fixes #46813
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>1 parent 5dc1d78 commit 0655837
2 files changed
Lines changed: 11 additions & 3 deletions
File tree
- packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1350 | 1350 | | |
1351 | 1351 | | |
1352 | 1352 | | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
1353 | 1357 | | |
1354 | 1358 | | |
1355 | 1359 | | |
1356 | 1360 | | |
1357 | | - | |
1358 | | - | |
1359 | 1361 | | |
1360 | 1362 | | |
1361 | 1363 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
| |||
52 | 55 | | |
53 | 56 | | |
54 | 57 | | |
55 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
56 | 62 | | |
57 | 63 | | |
58 | 64 | | |
| |||
0 commit comments