diff --git a/Examples/UIExplorer/js/TextInputExample.ios.js b/Examples/UIExplorer/js/TextInputExample.ios.js
index 6c166b39105..a65d55393a1 100644
--- a/Examples/UIExplorer/js/TextInputExample.ios.js
+++ b/Examples/UIExplorer/js/TextInputExample.ios.js
@@ -679,6 +679,12 @@ exports.examples = [
keyboardType="url"
style={[styles.multiline, styles.multilineWithFontStyles]}
/>
+
allowedLength) {
+ // If we typed/pasted more than one character, limit the text inputted
if (text.length > 1) {
// Truncate the input string so the result is exactly maxLength
NSString *limitedString = [text substringToIndex:allowedLength];
NSMutableString *newString = textView.text.mutableCopy;
[newString replaceCharactersInRange:range withString:limitedString];
textView.text = newString;
+ _predictedText = newString;
+
// Collapse selection at end of insert to match normal paste behavior
UITextPosition *insertEnd = [textView positionFromPosition:textView.beginningOfDocument
offset:(range.location + allowedLength)];
textView.selectedTextRange = [textView textRangeFromPosition:insertEnd toPosition:insertEnd];
+
[self textViewDidChange:textView];
}
return NO;