Uh oh!
There was an error while loading. Please reload this page.
[iOS] Fix TextInput maxLength when insert characters at begin - #23472
[iOS] Fix TextInput maxLength when insert characters at begin#23472zhongwuzw wants to merge 3 commits into
Conversation
shergin
commented
Feb 15, 2019
@rigdern Adam, what do you think? |
rigdern
commented
Feb 15, 2019
@shergin I'm not familiar with this code. I read over the PR but it's unclear to me what flaw in the code is causing the symptom and why this delta fixes it. |
zhongwuzw
commented
Feb 16, 2019
zhongwuzw
commented
Feb 28, 2019
ejanzer
commented
Mar 5, 2019
@zhongwuzw Can you share that the issue is you're seeing and how to repro it? Like @rigdern said, it's not clear to me what the issue is and how this fixes it - if you're seeing an inconsistency here, then it seems like predictedText already got out of sync with the backing textinput view. I think this change may make sense regardless, but I just want to take a look and see where things are going wrong. |
zhongwuzw
commented
Mar 6, 2019
@ejanzer Hi, I borrowed the repro from #21639 :
|
zhongwuzw
commented
Mar 6, 2019
Based on repro example, when we insert |
ejanzer
commented
Mar 6, 2019
Oh I see, the problem is if you set an initial value from JS then @zhongwuzw would you mind also cleaning up the other places in this file where we set |
ejanzer
left a comment
There was a problem hiding this comment.
See comment about previousText - also please clean up the other places where we set _predictedText if they're no longer needed:
and
| @@ -338,11 +338,7 @@ - (BOOL)textInputShouldChangeTextInRange:(NSRange)range replacementText:(NSStrin | |||
| NSString *previousText = [_predictedText substringWithRange:range] ?: @""; | |||
There was a problem hiding this comment.
We should probably move this above here so that previousText is set correctly.
zhongwuzw
commented
Mar 7, 2019
@ejanzer Hey, I clean up the code, please continue to review it. |
facebook-github-bot
left a comment
There was a problem hiding this comment.
@ejanzer has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
facebook-github-bot
left a comment
There was a problem hiding this comment.
@ejanzer has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
react-native-bot
commented
Mar 12, 2019
This pull request was successfully merged by @zhongwuzw in 1741593. When will my fix make it into a release? | Upcoming Releases |
Summary: Fixes#21639 , seems we tried to fix this before, please see related `PR` like [D10392176](36507e4), #18627, but they don't solve it totally. [iOS] [Fixed] - Fix TextInput maxLength when insert characters at begin Pull Request resolved: #23472 Reviewed By: mmmulani Differential Revision: D14366406 Pulled By: ejanzer fbshipit-source-id: fc983810703997b48824f84f2f9198984afba9cd

Summary
Fixes#21639 , seems we tried to fix this before, please see related
PRlike D10392176, #18627, but they don't solve it totally.Changelog
[iOS] [Fixed] - Fix TextInput maxLength when insert characters at begin
Test Plan
From the git log, we faced some issues, like Backspace event, we need to ensure no regression happened, issues like #21639#18627 should be fixed.