Skip to content

Commit

Permalink
Fire TextInputClient.updateEditingState on text changes (iOS) (flutte…
Browse files Browse the repository at this point in the history
…r#3995)

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.
  • Loading branch information
cbracken authored Aug 21, 2017
1 parent e40d4a9 commit 600567e
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 600567e

Please sign in to comment.