TSValidatedTextField icon indicating copy to clipboard operation
TSValidatedTextField copied to clipboard

Validation issue with Gboard (and with other 3rd party keyboards)

Open tevelee opened this issue 8 years ago • 0 comments

Summary

If users chose to use a custom 3rd party keyboard for interacting with the input field, the validatedFieldBlock will only get called before the last edit.

Example

In case of abcd input the block will call only for a, ab, and abc. In case of deleting the whole content, the block will call for abcd, abc, ab, a (always missing the last change)

Workaround

Listening to the UIControlEventEditingChanged notification and calling the validate method once again (after the edit) solves the issue manually, as it triggers firing the validatedFieldBlock.

- ... {
    [textField addTarget:self action:@selector(textChanged) forControlEvents:UIControlEventEditingChanged];
}

- (void)textChanged {
    [textField validate];
}

tevelee avatar Jun 30 '17 13:06 tevelee