Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
On Android, an
Inputwhose height comes from a signal stops taking text after it shrinks. The usual case is a chat composer: it grows while a message wraps onto a second line, and sending clears the text and sets the height back to one line in the same update. From then on the keys typed go nowhere: the field keeps showing its placeholder.The cause, from reading
Mounter:INPUT_CONTENTturns the content box into the container's padding, and it computes the right and bottom insets from the input's frame at that moment. When the input shrinks, the new content box arrives before the new frame, so the bottom inset is computed against the old, taller frame and leaves theEditTextno room until the next layout. I have not traced how the field then loses the keys; the fix removes the wrong padding that comes first.The fix keeps the content box (origin and size) on the
InputBoxand computes the padding from the size being measured, inonMeasure. The order of the two updates no longer matters. The change is inInputBox.javaandMounter.java(+20 / −9), plus a regression test (examples/gallery/tests/input-shrink.test.tsxand its fixture). No API change, no new dependency.How to Test
The fixture is a composer: a multiline
Inputwhose height followsonContentSizeChange, and a Send button that clears the text and resets the height. The test types text that wraps onto a second line, presses Send, presses the keyaand expects the field to holda:--target android(Android 15 arm64 emulator)expected "" to be "a"CI runs no
--target androidjob, so the Android row is a command for the reviewer to run. The runtime was built withcargo xtask android --release --dev --abi arm64-v8a.Not tested: iOS, which takes a separate path; a physical device; armeabi-v7a and x86_64.
Checklist
cargo test --workspace,cargo +nightly fmt --alland clippy (including the Catalyst and Android runs for platform code). (cargo test --workspaceon dde7f77 with this commit and the four other Android fixes of this series: 3260 passed, 0 failed, 43 ignored.cargo xtask clippy-androidpasses on 686c8a2 (main at 201d780 merged in). The Java is compiled bycargo xtask android, and there is no Rust forfmtto check)tests/compat/(cargo xtask compat). (No API change.)examples/gallerydemos on iOS and Android (if the change is visible or platform-specific). (The test above, on Android.)