(cherry picked from commit 16583c2a3b)
Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
This commit is contained in:
parent
992adad5a1
commit
9cfae7ab3e
1 changed files with 18 additions and 4 deletions
|
|
@ -146,15 +146,29 @@ NSString* const NOTIFICATION_UPDATE_BADGE_ACTION = @"update_badge";
|
|||
*/
|
||||
RNHWKeyboardEvent *hwKeyEvent = nil;
|
||||
- (NSMutableArray<UIKeyCommand *> *)keyCommands {
|
||||
NSMutableArray *keys = [NSMutableArray new];
|
||||
if (hwKeyEvent == nil) {
|
||||
hwKeyEvent = [[RNHWKeyboardEvent alloc] init];
|
||||
}
|
||||
|
||||
NSMutableArray *commands = [NSMutableArray new];
|
||||
|
||||
if ([hwKeyEvent isListening]) {
|
||||
[keys addObject: [UIKeyCommand keyCommandWithInput:@"\r" modifierFlags:0 action:@selector(sendEnter:)]];
|
||||
[keys addObject: [UIKeyCommand keyCommandWithInput:@"\r" modifierFlags:UIKeyModifierShift action:@selector(sendShiftEnter:)]];
|
||||
UIKeyCommand *enter = [UIKeyCommand keyCommandWithInput:@"\r" modifierFlags:0 action:@selector(sendEnter:)];
|
||||
UIKeyCommand *shiftEnter = [UIKeyCommand keyCommandWithInput:@"\r" modifierFlags:UIKeyModifierShift action:@selector(sendShiftEnter:)];
|
||||
if (@available(iOS 13.0, *)) {
|
||||
[enter setTitle:@"Send message"];
|
||||
[shiftEnter setTitle:@"Add new line"];
|
||||
}
|
||||
if (@available(iOS 15.0, *)) {
|
||||
[enter setWantsPriorityOverSystemBehavior:YES];
|
||||
[shiftEnter setWantsPriorityOverSystemBehavior:YES];
|
||||
}
|
||||
|
||||
[commands addObject: enter];
|
||||
[commands addObject: shiftEnter];
|
||||
}
|
||||
return keys;
|
||||
|
||||
return commands;
|
||||
}
|
||||
|
||||
- (void)sendEnter:(UIKeyCommand *)sender {
|
||||
|
|
|
|||
Loading…
Reference in a new issue