Skip to content
This repository was archived by the owner on Apr 29, 2021. It is now read-only.

Commit 91d5d4b

Browse files
committed
fix text field crash (merged from ConnectApp)
1 parent cd9e1d2 commit 91d5d4b

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

Runtime/Plugins/platform/ios/UIWidgetsTextInputPlugin.mm

100644100755
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,11 @@ - (void)setTextInputState:(NSDictionary*)state {
211211
[self.inputDelegate textWillChange:self];
212212
[self.text setString:newText];
213213
}
214+
215+
NSInteger composingBase = [state[@"composingBase"] intValue];
216+
NSInteger composingExtent = [state[@"composingExtent"] intValue];
217+
NSRange composingRange = [self clampSelection:NSMakeRange(MIN(composingBase, composingExtent), ABS(composingBase - composingExtent)) forText:self.text];
218+
self.markedTextRange = composingRange.length > 0 ? [UIWidgetsTextRange rangeWithNSRange:composingRange] : nil;
214219

215220
NSInteger selectionBase = [state[@"selectionBase"] intValue];
216221
NSInteger selectionExtent = [state[@"selectionExtent"] intValue];
@@ -229,14 +234,6 @@ - (void)setTextInputState:(NSDictionary*)state {
229234
[self.inputDelegate selectionDidChange:self];
230235
}
231236

232-
NSInteger composingBase = [state[@"composingBase"] intValue];
233-
NSInteger composingExtent = [state[@"composingExtent"] intValue];
234-
NSRange composingRange = [self clampSelection:NSMakeRange(MIN(composingBase, composingExtent),
235-
ABS(composingBase - composingExtent))
236-
forText:self.text];
237-
self.markedTextRange =
238-
composingRange.length > 0 ? [UIWidgetsTextRange rangeWithNSRange:composingRange] : nil;
239-
240237
if (textChanged) {
241238
[self.inputDelegate textDidChange:self];
242239

0 commit comments

Comments
 (0)