-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Text-Input][Android][Fix]-fixes scroll on first render of textinput with default Value #43480
base: main
Are you sure you want to change the base?
Conversation
081a899
to
55bec07
Compare
Base commit: 14a7202 |
This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This PR was closed because it has been stalled for 7 days with no activity. |
@Abbondanzo could you see if this is valuable? and may be reopen it. |
@Abbondanzo has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
55bec07
to
c857a8d
Compare
will fix the lint failure, thanks for re-opening and checking it out! |
@Abbondanzo has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@Abbondanzo let me know where the internal Linter tests failed. |
b6abc9f
to
5efe852
Compare
Reopen #43342
Closed due to mess up with the forked branch!
Summary:
On rendering The
TextInput
withdefaultValue
at a case when the text string is longer than the screen size , a weird behaviour follows on android, where the leftmost text characters gets cut off and hidden, the reason is the cursor which moves to the end.The cause of the same to my understanding is how the text is getting updated inside the
ReactEditText
. it has a range which it replaces with the text provided, if the cursor is in close proximity , the same is moved to the end for the replaced text.the solution that i used is pretty straightforward, we need to make sure our cursor's position should be at the start of the text for the first render, we can just simply use the
setText()
method from theEditText
, while we create the editText for the first time in the render cycle.I have introduced a flag variable of
isFirstRender
initialised totrue
, this would allow us to call theEditText
method and then eventually toggling it to false.Changelog:
[ANDROID] [Fixed] - Fixes The Position of cursor on Overflowing Text on Android Text Input
Test Plan:
All Test Passing
Checked on RN TESTER
Long Text Behaviour section has been added to demonstrate the same
Before
After