mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
Merge pull request #1796 from NativeScript/nsrange-exception
Fix NSRangeException when typing in a TextField with formatted text
This commit is contained in:
@ -82,11 +82,13 @@ class UITextFieldDelegateImpl extends NSObject implements UITextFieldDelegate {
|
||||
owner._onPropertyChangedFromNative(TextBase.textProperty, replacementString);
|
||||
}
|
||||
else {
|
||||
if (range.location <= textField.text.length) {
|
||||
let newText = NSString.alloc().initWithString(textField.text).stringByReplacingCharactersInRangeWithString(range, replacementString);
|
||||
owner._onPropertyChangedFromNative(TextBase.textProperty, newText);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.firstEdit = false;
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user