From a90d17b4d5c419769d9e434bd0df648466a26187 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Mon, 21 Aug 2017 12:16:13 -0700 Subject: [PATCH] Fire TextInputClient.updateEditingState on text changes (iOS) For consistency with Android, when the engine receives a TextInput.setEditingState message from the framework, and the text has changed, we now send a TextInputClient.updateEditingState message back to the framework with the updated state from the engine. The framework currently relies on this behaviour to trigger onChanged events in certain scenarios (e.g., on tapping Paste in the selection controls). Note: it may be more desirable for the framework to trigger the onChanged calls without relying on the return message from the engine, but this change ensures consistent behaviour across iOS and Android until we've evaluated the pros/cons of such an approach. --- .../darwin/ios/framework/Source/FlutterTextInputPlugin.mm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm b/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm index 78971c7c0f941..90a9ad57732fd 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm @@ -196,8 +196,12 @@ - (void)setTextInputState:(NSDictionary*)state { [self.inputDelegate selectionDidChange:self]; } - if (textChanged) + if (textChanged) { [self.inputDelegate textDidChange:self]; + + // For consistency with Android behavior, send an update to the framework. + [self updateEditingState]; + } } #pragma mark - UIResponder Overrides