Skip to content

fix: replace autofill string in textfield - #9555

Merged
NathanWalker merged 2 commits into
NativeScript:masterfrom
janoshrubos:fix/ios-autofill-model-update
Sep 21, 2021
Merged

NathanWalker merged 2 commits into
NativeScript:masterfrom
janoshrubos:fix/ios-autofill-model-update

Conversation

@janoshrubos

Copy link
Copy Markdown
Contributor

PR Checklist

What is the current behavior?

On iOS if we type a few character and use the auto-fill function it will concat the strings instead of replacing to the suggested one.
Video example in the issue: #9486

What is the new behavior?

After typing the the start of an e-mail and tap on auto-fill, it will replace the text.

Note:
The solution is based on the string's delta, which means if we copy and paste a text to a textfield, it will behave like we used auto-fill and replace the text in the view model.

Fixes #9486

@20051231

Copy link
Copy Markdown

seems this pull request breaks emoji keyboard input since emoji characters are longer than 1 in js
if user input multiple emojis in a row, only one emoji is kept since the whole string is replaced every time.

The below line is not enough to detect autofill or keyboard

const shouldReplaceString = (textField.secureTextEntry && this.firstEdit) || delta > 1;

@farfromrefug

Copy link
Copy Markdown
Collaborator

@20051231 good catch. could you open an issue so we can follow this issue ?

@vetter99

vetter99 commented Mar 9, 2022

Copy link
Copy Markdown

opened an issue since i didnt see one: #9816

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS] wrong form data value when using autocomplete (playground demo included)

5 participants