Merge pull request #1796 from NativeScript/nsrange-exception

Fix NSRangeException when typing in a TextField with formatted text
This commit is contained in:
Rossen Hristov
2016-03-18 16:24:01 +02:00

View File

@ -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;