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,8 +82,10 @@ class UITextFieldDelegateImpl extends NSObject implements UITextFieldDelegate {
|
||||
owner._onPropertyChangedFromNative(TextBase.textProperty, replacementString);
|
||||
}
|
||||
else {
|
||||
let newText = NSString.alloc().initWithString(textField.text).stringByReplacingCharactersInRangeWithString(range, replacementString);
|
||||
owner._onPropertyChangedFromNative(TextBase.textProperty, newText);
|
||||
if (range.location <= textField.text.length) {
|
||||
let newText = NSString.alloc().initWithString(textField.text).stringByReplacingCharactersInRangeWithString(range, replacementString);
|
||||
owner._onPropertyChangedFromNative(TextBase.textProperty, newText);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user