'Jetpack Compose TextField/OutlinedTextField Strange Behavior in Some Devices With Lower Versions
After using some special characters in Jetpack compose Textfield component. It makes some different behaviours. For example:
When I write xyz@a. It is OK, but after clicking "b". Text turns as "xyz@ a" (expected: xyz@ab).
When I write xyz@p. It is OK, but after clicking "r". Text turns as "xyz@rp" (expected: xyz@pr).
When I write xyz@a. It is OK, but after remove, text turns as "xyza" (expected: xyz@).
These types of error occurs everytime after clicking the special characters. Only if I set keyboard type as KeyboardType.Password it works correctly. After look logs I see that those weird results are got as parameter of onValueChange function.
Some tested devices:
No errors on devices that have Android version equals or higher than 9.0 that I tested.
No errors on any version/device at Android Emulator that I tested.
I confront this error Samsung Note 3 (Android Version: 5.0) and Samsung Grand Prime (Android Version: 6.0).
Any idea?
Solution 1:[1]
You should use rememberSaveable rather than remember
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
