-
Notifications
You must be signed in to change notification settings - Fork 24.6k
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
TextInput component fix maxLength property when entering characters at the beginning. #21798
TextInput component fix maxLength property when entering characters at the beginning. #21798
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code analysis results:
eslint
found some issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code analysis results:
eslint
found some issues.flow
found some issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code analysis results:
eslint
found some issues.flow
found some issues.
IntegrationTests/TextInputTest.js
Outdated
throw new Error('TestModule.verifySnapshot not defined.'); | ||
} | ||
|
||
updateText(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no-undef: 'updateText' is not defined.
IntegrationTests/TextInputTest.js
Outdated
throw new Error('TestModule.verifySnapshot not defined.'); | ||
} | ||
|
||
updateText(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot resolve name updateText
.
…acters at the beginning. (#21639) Summary: ---------- - In RCTBaseTextInputView.m the ivar _predictedText is not updated correctly when inserting at the beginning. - The actual fix is to update the value before the checking the text mismatch from `backedTextInputView`. Test Plan: ---------- - When entering 1 character at the beginning of the TextInput, we expect to have only 1 character inserted. However we experience that the character is inserted and the current value is duplicated. - Insert 1 character before the value "123" with: `<TextInput maxLength={5} defaultValue="123" />`. Release Notes: -------------- [IOS] [BUGFIX] [TextInput] - Fix maxLength property when entering characters at the beginning.
@MadeinFrance Thank you! |
Thank you for the feedback, I appreciate that. Lets use the TestCase I described in the description ( What happen when inserting
The bug is that the
if (_predictedText) {
_predictedText = [_predictedText stringByReplacingCharactersInRange:range withString:text];
} |
Fixed in a later commit. Closing. |
Fix TextInput component and the maxLength property when entering characters at the beginning. (#21639).
Improvements: In
TextInputTest.js
We could place the native cursor at the beginning of the input in the functioncomponentDidMount
. Not sure how to do that from the JavaScript.Summary:
backedTextInputView
.Test Plan:
0
character before the value123
with:<TextInput maxLength={5} />
.Release Notes:
[IOS] [BUGFIX] [TextInput] - Fix maxLength property when entering characters at the beginning.
Result: