react-native-external-keyboard 0.8.5-rc → 0.9.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of react-native-external-keyboard might be problematic. Click here for more details.
- package/ios/Delegates/RNCEKVFocusOrderDelegate/RNCEKVFocusGuideDelegate/RNCEKVFocusGuideDelegate.h +1 -1
- package/ios/Delegates/RNCEKVFocusOrderDelegate/RNCEKVFocusOrderDelegate.h +5 -0
- package/ios/Delegates/RNCEKVFocusOrderDelegate/RNCEKVFocusOrderDelegate.mm +82 -46
- package/ios/Delegates/RNCEKVFocusOrderDelegate/RNCEKVFocusOrderProtocol.h +6 -8
- package/ios/Delegates/RNCEKVGroupIdentifierDelegate/RNCEKVGroupIdentifierDelegate.mm +60 -60
- package/ios/Delegates/RNCEKVHaloDelegate/RNCEKVHaloDelegate.h +4 -3
- package/ios/Delegates/RNCEKVHaloDelegate/RNCEKVHaloDelegate.mm +110 -87
- package/ios/Delegates/RNCEKVHaloDelegate/RNCEKVHaloProtocol.h +1 -1
- package/ios/Extensions/RCTEnhancedScrollView+RNCEKVExternalKeyboard.mm +1 -1
- package/ios/Extensions/RCTTextInputComponentView+RNCEKVExternalKeyboard.mm +15 -0
- package/ios/Extensions/RCTViewComponentView+RNCEKVExternalKeyboard.h +1 -1
- package/ios/Extensions/RCTViewComponentView+RNCEKVExternalKeyboard.mm +31 -23
- package/ios/Extensions/UIViewController+RNCEKVExternalKeyboard.h +1 -0
- package/ios/Extensions/UIViewController+RNCEKVExternalKeyboard.mm +8 -0
- package/ios/Helpers/RNCEKVNativeProps/RNCEKVNativeProps.h +123 -0
- package/ios/Protocols/RNCEKVCustomFocusEffectProtocol.h +15 -0
- package/ios/Protocols/RNCEKVCustomGroudIdProtocol.h +15 -0
- package/ios/Views/Base/ContextMenu/RNCEKVViewContextMenuBase.h +33 -0
- package/ios/Views/Base/ContextMenu/RNCEKVViewContextMenuBase.mm +83 -0
- package/ios/Views/Base/FocusChange/RNCEKVViewFocusChangeBase.h +37 -0
- package/ios/Views/Base/FocusChange/RNCEKVViewFocusChangeBase.mm +88 -0
- package/ios/Views/Base/FocusOrderGroup/RNCEKVViewOrderGroupBase.h +49 -0
- package/ios/Views/Base/FocusOrderGroup/RNCEKVViewOrderGroupBase.mm +200 -0
- package/ios/Views/Base/FocusRequest/RNCEKVViewFocusRequestBase.h +34 -0
- package/ios/Views/Base/FocusRequest/RNCEKVViewFocusRequestBase.mm +117 -0
- package/ios/Views/Base/GroupIdentifier/RNCEKVViewGroupIdentifierBase.h +27 -0
- package/ios/Views/Base/GroupIdentifier/RNCEKVViewGroupIdentifierBase.mm +61 -0
- package/ios/Views/Base/KeyPress/RNCEKVViewKeyPress.h +30 -0
- package/ios/Views/Base/KeyPress/RNCEKVViewKeyPress.mm +82 -0
- package/ios/Views/Base/KeyboardHallo/RNCEKVExternalKeyboardHalloBase.h +33 -0
- package/ios/Views/Base/KeyboardHallo/RNCEKVExternalKeyboardHalloBase.mm +102 -0
- package/ios/Views/Base/ViewGroup/RNCEKVViewGroupBase.h +36 -0
- package/ios/Views/Base/ViewGroup/RNCEKVViewGroupBase.mm +63 -0
- package/ios/Views/RNCEKVExternalKeyboardView/RNCEKVExternalKeyboardView.h +75 -74
- package/ios/Views/RNCEKVExternalKeyboardView/RNCEKVExternalKeyboardView.mm +23 -491
- package/ios/Views/RNCEKVExternalKeyboardView/RNCEKVExternalKeyboardViewManager.mm +3 -6
- package/ios/Views/RNCEKVKeyboardFocusGroupView/RNCEKVKeyboardFocusGroup.mm +12 -12
- package/ios/Views/RNCEKVTextInputFocusWrapper/RNCEKVTextInputFocusWrapper.h +24 -22
- package/ios/Views/RNCEKVTextInputFocusWrapper/RNCEKVTextInputFocusWrapper.mm +21 -202
- package/ios/Views/RNCEKVTextInputFocusWrapper/RNCEKVTextInputFocusWrapperManager.mm +7 -7
- package/lib/commonjs/nativeSpec/TextInputFocusWrapperNativeComponent.ts +4 -0
- package/lib/module/nativeSpec/TextInputFocusWrapperNativeComponent.ts +4 -0
- package/lib/typescript/src/nativeSpec/TextInputFocusWrapperNativeComponent.d.ts +4 -1
- package/lib/typescript/src/nativeSpec/TextInputFocusWrapperNativeComponent.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/nativeSpec/TextInputFocusWrapperNativeComponent.ts +4 -0
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
#import "RNCEKVFabricEventHelper.h"
|
|
22
22
|
#import <React/RCTConversions.h>
|
|
23
23
|
#import <stdlib.h>
|
|
24
|
+
#include "RNCEKVNativeProps.h"
|
|
24
25
|
|
|
25
26
|
|
|
26
27
|
using namespace facebook::react;
|
|
@@ -31,108 +32,7 @@ using namespace facebook::react;
|
|
|
31
32
|
|
|
32
33
|
#endif
|
|
33
34
|
|
|
34
|
-
@implementation RNCEKVExternalKeyboardView
|
|
35
|
-
RNCEKVKeyboardKeyPressHandler *_keyboardKeyPressHandler;
|
|
36
|
-
RNCEKVHaloDelegate *_haloDelegate;
|
|
37
|
-
RNCEKVFocusDelegate *_focusDelegate;
|
|
38
|
-
RNCEKVGroupIdentifierDelegate *_gIdDelegate;
|
|
39
|
-
RNCEKVFocusOrderDelegate *_focusOrderDelegate;
|
|
40
|
-
|
|
41
|
-
NSNumber *_isFocused;
|
|
42
|
-
BOOL _isAttachedToWindow;
|
|
43
|
-
BOOL _isAttachedToController;
|
|
44
|
-
BOOL _isLinked;
|
|
45
|
-
BOOL _isIdLinked;
|
|
46
|
-
BOOL _autoFocusRequested;
|
|
47
|
-
UIContextMenuInteraction *_contextMenuInteraction;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
- (void)updateContextMenuRegistration {
|
|
51
|
-
if (@available(iOS 13.0, *)) {
|
|
52
|
-
BOOL shouldRegister = _enableContextMenu &&
|
|
53
|
-
_isFocused != nil &&
|
|
54
|
-
[_isFocused isEqual:@YES];
|
|
55
|
-
|
|
56
|
-
if (shouldRegister && _contextMenuInteraction == nil) {
|
|
57
|
-
_contextMenuInteraction =
|
|
58
|
-
[[UIContextMenuInteraction alloc] initWithDelegate:self];
|
|
59
|
-
[self addInteraction:_contextMenuInteraction];
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (!shouldRegister && _contextMenuInteraction != nil) {
|
|
63
|
-
[self removeInteraction:_contextMenuInteraction];
|
|
64
|
-
_contextMenuInteraction = nil;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
- (void)link:(UIView *)subview {
|
|
70
|
-
if(_orderPosition != nil && _orderGroup != nil && !_isLinked) {
|
|
71
|
-
[[RNCEKVOrderLinking sharedInstance] add: _orderPosition withOrderKey: _orderGroup withObject:self];
|
|
72
|
-
_isLinked = YES;
|
|
73
|
-
}
|
|
74
|
-
if(_orderId != nil) {
|
|
75
|
-
[[RNCEKVOrderLinking sharedInstance] storeOrderId:_orderId withView: self];
|
|
76
|
-
[_focusOrderDelegate linkId];
|
|
77
|
-
_isIdLinked = YES;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
- (void)unlink{
|
|
82
|
-
if(_orderPosition != nil && _orderGroup != nil && _isLinked) {
|
|
83
|
-
[[RNCEKVOrderLinking sharedInstance] remove:_orderPosition withOrderKey: _orderGroup];
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if(_orderId != nil) {
|
|
87
|
-
[[RNCEKVOrderLinking sharedInstance] cleanOrderId:_orderId];
|
|
88
|
-
[_focusOrderDelegate clear];
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
_isLinked = NO;
|
|
92
|
-
_isIdLinked = NO;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
- (void)onAttached
|
|
97
|
-
{
|
|
98
|
-
[_gIdDelegate updateGroupIdentifier];
|
|
99
|
-
[self focusOnMount];
|
|
100
|
-
if(self.subviews.count > 0) {
|
|
101
|
-
[self link: self.subviews[0]];
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
- (void)onDetached
|
|
106
|
-
{
|
|
107
|
-
[self unlink];
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
@synthesize haloCornerRadius = _haloCornerRadius;
|
|
112
|
-
@synthesize haloExpendX = _haloExpendX;
|
|
113
|
-
@synthesize haloExpendY = _haloExpendY;
|
|
114
|
-
|
|
115
|
-
- (void)setOrderLeft:(NSString *)orderLeft {
|
|
116
|
-
[_focusOrderDelegate refreshLeft: _orderLeft next: orderLeft];
|
|
117
|
-
_orderLeft = orderLeft;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
- (void)setOrderRight:(NSString *)orderRight {
|
|
121
|
-
[_focusOrderDelegate refreshRight: _orderRight next: orderRight];
|
|
122
|
-
_orderRight = orderRight;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
- (void)setOrderUp:(NSString *)orderUp {
|
|
127
|
-
[_focusOrderDelegate refreshUp: _orderUp next: orderUp];
|
|
128
|
-
_orderUp = orderUp;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
- (void)setOrderDown:(NSString *)orderDown {
|
|
132
|
-
[_focusOrderDelegate refreshDown: _orderDown next: orderDown];
|
|
133
|
-
_orderDown = orderDown;
|
|
134
|
-
}
|
|
135
|
-
|
|
35
|
+
@implementation RNCEKVExternalKeyboardView
|
|
136
36
|
|
|
137
37
|
- (instancetype)initWithFrame:(CGRect)frame {
|
|
138
38
|
if (self = [super initWithFrame:frame]) {
|
|
@@ -141,99 +41,11 @@ using namespace facebook::react;
|
|
|
141
41
|
std::make_shared<const ExternalKeyboardViewProps>();
|
|
142
42
|
_props = defaultProps;
|
|
143
43
|
#endif
|
|
144
|
-
_enableContextMenu = NO;
|
|
145
|
-
_isAttachedToController = NO;
|
|
146
|
-
_isAttachedToWindow = NO;
|
|
147
|
-
_enableA11yFocus = NO;
|
|
148
|
-
_keyboardKeyPressHandler = [[RNCEKVKeyboardKeyPressHandler alloc] init];
|
|
149
|
-
_haloDelegate = [[RNCEKVHaloDelegate alloc] initWithView:self];
|
|
150
|
-
_focusDelegate = [[RNCEKVFocusDelegate alloc] initWithView:self];
|
|
151
|
-
_gIdDelegate = [[RNCEKVGroupIdentifierDelegate alloc] initWithView:self];
|
|
152
|
-
_focusOrderDelegate = [[RNCEKVFocusOrderDelegate alloc] initWithView: self];
|
|
153
|
-
_autoFocusRequested = NO;
|
|
154
|
-
_contextMenuInteraction = nil;
|
|
155
44
|
}
|
|
156
45
|
|
|
157
46
|
return self;
|
|
158
47
|
}
|
|
159
48
|
|
|
160
|
-
- (void)cleanReferences {
|
|
161
|
-
[_focusOrderDelegate clear];
|
|
162
|
-
[_haloDelegate clear];
|
|
163
|
-
[_gIdDelegate clear];
|
|
164
|
-
_isAttachedToController = NO;
|
|
165
|
-
_isAttachedToWindow = NO;
|
|
166
|
-
_isHaloActive = @2; // ToDo RNCEKV-0
|
|
167
|
-
_haloExpendX = 0;
|
|
168
|
-
_haloExpendY = 0;
|
|
169
|
-
_haloCornerRadius = 0;
|
|
170
|
-
_orderGroup = nil;
|
|
171
|
-
_orderPosition = nil;
|
|
172
|
-
_orderLeft = nil;
|
|
173
|
-
_orderRight = nil;
|
|
174
|
-
_orderUp = nil;
|
|
175
|
-
_orderDown = nil;
|
|
176
|
-
_orderForward = nil;
|
|
177
|
-
_orderBackward = nil;
|
|
178
|
-
_orderLast = nil;
|
|
179
|
-
_orderFirst = nil;
|
|
180
|
-
_orderId = nil;
|
|
181
|
-
_lockFocus = nil;
|
|
182
|
-
_customGroupId = nil;
|
|
183
|
-
_enableA11yFocus = NO;
|
|
184
|
-
_isLinked = NO;
|
|
185
|
-
_autoFocusRequested = NO;
|
|
186
|
-
_enableContextMenu = NO;
|
|
187
|
-
[self updateContextMenuRegistration];
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
- (void)setEnableContextMenu:(BOOL)enableContextMenu {
|
|
191
|
-
_enableContextMenu = enableContextMenu;
|
|
192
|
-
[self updateContextMenuRegistration];
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
- (void)setOrderGroup:(NSString *)orderGroup{
|
|
196
|
-
[self updateOrderGroup:_orderGroup next: orderGroup];
|
|
197
|
-
_orderGroup = orderGroup;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
- (void)updateOrderGroup:(NSString *)prev next:(NSString*)next {
|
|
201
|
-
if(prev != nil && _orderPosition != nil && self.subviews.count > 0) {
|
|
202
|
-
[[RNCEKVOrderLinking sharedInstance] updateOrderKey:(NSString *)prev next:next position:_orderPosition withView: self];
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
- (void)setOrderId:(NSString*) next {
|
|
207
|
-
[_focusOrderDelegate refreshId:_orderId next:next];
|
|
208
|
-
_orderId = next;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
- (BOOL)shouldUpdateFocusInContext:(UIFocusUpdateContext *)context {
|
|
212
|
-
if(!_orderGroup && !_orderPosition && !_lockFocus && !_orderForward && !_orderBackward) {
|
|
213
|
-
return [super shouldUpdateFocusInContext: context];
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
NSNumber* result = [_focusOrderDelegate shouldUpdateFocusInContext: context];
|
|
217
|
-
if(result == nil) {
|
|
218
|
-
return [super shouldUpdateFocusInContext: context];
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
return result.boolValue;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
- (void)updateOrderPosition:(NSNumber *)position {
|
|
225
|
-
if(_orderPosition != nil || _orderPosition != position) {
|
|
226
|
-
if(_orderGroup != nil && self.subviews.count > 0 && _isLinked) {
|
|
227
|
-
[[RNCEKVOrderLinking sharedInstance] update:position lastPosition:_orderPosition withOrderKey: _orderGroup withView: self];
|
|
228
|
-
}
|
|
229
|
-
_orderPosition = position;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
if(_orderPosition == nil && _orderPosition != position) {
|
|
233
|
-
_orderPosition = position;
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
49
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
238
50
|
+ (ComponentDescriptorProvider)componentDescriptorProvider {
|
|
239
51
|
return concreteComponentDescriptorProvider<
|
|
@@ -261,108 +73,28 @@ using namespace facebook::react;
|
|
|
261
73
|
*std::static_pointer_cast<ExternalKeyboardViewProps const>(props);
|
|
262
74
|
[super updateProps:props oldProps:oldProps];
|
|
263
75
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
[self setAutoFocus:hasAutoFocus];
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
BOOL isLockChanged = [RNCEKVPropHelper isPropChanged:_lockFocus intValue: newViewProps.lockFocus];
|
|
286
|
-
if(isLockChanged) {
|
|
287
|
-
NSNumber* lockValue = [RNCEKVPropHelper unwrapIntValue: newViewProps.lockFocus];
|
|
288
|
-
[self setLockFocus: lockValue];
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
BOOL isIndexChanged = [RNCEKVPropHelper isPropChanged:_orderPosition intValue: newViewProps.orderIndex];
|
|
292
|
-
if(isIndexChanged) {
|
|
293
|
-
NSNumber* position = [RNCEKVPropHelper unwrapIntValue: newViewProps.orderIndex];
|
|
294
|
-
[self updateOrderPosition: position];
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
RKNA_PROP_UPDATE(orderGroup, setOrderGroup, newViewProps);
|
|
298
|
-
RKNA_PROP_UPDATE(orderId, setOrderId, newViewProps);
|
|
299
|
-
RKNA_PROP_UPDATE(orderLeft, setOrderLeft, newViewProps);
|
|
300
|
-
RKNA_PROP_UPDATE(orderRight, setOrderRight, newViewProps);
|
|
301
|
-
RKNA_PROP_UPDATE(orderUp, setOrderUp, newViewProps);
|
|
302
|
-
RKNA_PROP_UPDATE(orderDown, setOrderDown, newViewProps);
|
|
303
|
-
RKNA_PROP_UPDATE(orderForward, setOrderForward, newViewProps);
|
|
304
|
-
RKNA_PROP_UPDATE(orderBackward, setOrderBackward, newViewProps);
|
|
305
|
-
RKNA_PROP_UPDATE(orderLast, setOrderLast, newViewProps);
|
|
306
|
-
RKNA_PROP_UPDATE(orderFirst, setOrderFirst, newViewProps);
|
|
307
|
-
|
|
308
|
-
if (_enableA11yFocus != newViewProps.enableA11yFocus) {
|
|
309
|
-
[self setEnableA11yFocus:newViewProps.enableA11yFocus];
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
UIColor *newColor = RCTUIColorFromSharedColor(newViewProps.tintColor);
|
|
313
|
-
BOOL renewColor = newColor != nil && self.tintColor == nil;
|
|
314
|
-
BOOL isColorChanged = oldViewProps.tintColor != newViewProps.tintColor;
|
|
315
|
-
if (isColorChanged || renewColor) {
|
|
316
|
-
self.tintColor = RCTUIColorFromSharedColor(newViewProps.tintColor);
|
|
317
|
-
}
|
|
76
|
+
[self updateKeyPressProps:RNCEKV::KeyPressProps::from(oldViewProps)
|
|
77
|
+
newProps:RNCEKV::KeyPressProps::from(newViewProps)];
|
|
78
|
+
|
|
79
|
+
[self updateContextMenuProps:RNCEKV::ContextMenuProps::from(oldViewProps)
|
|
80
|
+
newProps:RNCEKV::ContextMenuProps::from(newViewProps)];
|
|
81
|
+
|
|
82
|
+
[self updateFocusProps:RNCEKV::FocusProps::from(oldViewProps)
|
|
83
|
+
newProps:RNCEKV::FocusProps::from(newViewProps)];
|
|
84
|
+
|
|
85
|
+
[self updateGroupIdentifierProps:RNCEKV::GroupIdentifierProps::from(oldViewProps)
|
|
86
|
+
newProps:RNCEKV::GroupIdentifierProps::from(newViewProps)];
|
|
87
|
+
|
|
88
|
+
[self updateHaloProps:RNCEKV::HaloProps::from(oldViewProps)
|
|
89
|
+
newProps:RNCEKV::HaloProps::from(newViewProps)];
|
|
90
|
+
[self updateFocusOrderProps:RNCEKV::OrderProps::from(oldViewProps)
|
|
91
|
+
newProps:RNCEKV::OrderProps::from(newViewProps)];
|
|
92
|
+
[self updateFocusRequestProps:RNCEKV::AutoFocusProps::from(oldViewProps)
|
|
93
|
+
newProps:RNCEKV::AutoFocusProps::from(newViewProps)];
|
|
318
94
|
|
|
319
95
|
if (oldViewProps.group != newViewProps.group) {
|
|
320
96
|
[self setIsGroup:newViewProps.group];
|
|
321
97
|
}
|
|
322
|
-
|
|
323
|
-
BOOL isNewGroup =
|
|
324
|
-
oldViewProps.groupIdentifier != newViewProps.groupIdentifier;
|
|
325
|
-
BOOL recoverCustomGroup =
|
|
326
|
-
!self.customGroupId && !newViewProps.groupIdentifier.empty();
|
|
327
|
-
if (isNewGroup || recoverCustomGroup) {
|
|
328
|
-
if (newViewProps.groupIdentifier.empty() && self.customGroupId != nil) {
|
|
329
|
-
self.customGroupId = nil;
|
|
330
|
-
}
|
|
331
|
-
if (!newViewProps.groupIdentifier.empty()) {
|
|
332
|
-
NSString *newGroupId =
|
|
333
|
-
[NSString stringWithUTF8String:newViewProps.groupIdentifier.c_str()];
|
|
334
|
-
[self setCustomGroupId:newGroupId];
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
// ToDo RNCEKV-0, refactor, condition for halo effect has side effect, recycle
|
|
339
|
-
// is a question. The problem that we have to check the condition, (true means
|
|
340
|
-
// we skip, but when it was false we should reset) and recycle (view is reused
|
|
341
|
-
// and we need to double check whether a new place for view should be with or
|
|
342
|
-
// without halo)
|
|
343
|
-
if (self.isHaloActive != nil || newViewProps.haloEffect == false) {
|
|
344
|
-
BOOL haloState = newViewProps.haloEffect;
|
|
345
|
-
if (![self.isHaloActive isEqual:@(haloState)]) {
|
|
346
|
-
[self setIsHaloActive:@(haloState)];
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
if (_haloExpendX != newViewProps.haloExpendX) {
|
|
351
|
-
[self setHaloExpendX:newViewProps.haloExpendX];
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
if (_haloExpendY != newViewProps.haloExpendY) {
|
|
355
|
-
[self setHaloExpendY:newViewProps.haloExpendY];
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
if (_haloCornerRadius != newViewProps.haloCornerRadius) {
|
|
359
|
-
[self setHaloCornerRadius:newViewProps.haloCornerRadius];
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
if (oldViewProps.enableContextMenu != newViewProps.enableContextMenu) {
|
|
363
|
-
[self setEnableContextMenu: newViewProps.enableContextMenu];
|
|
364
|
-
[self updateContextMenuRegistration];
|
|
365
|
-
}
|
|
366
98
|
}
|
|
367
99
|
|
|
368
100
|
|
|
@@ -372,61 +104,6 @@ Class<RCTComponentViewProtocol> ExternalKeyboardViewCls(void) {
|
|
|
372
104
|
|
|
373
105
|
#endif
|
|
374
106
|
|
|
375
|
-
// ToDo RNCEKV-DEPRICATED-0 remove after new system migration
|
|
376
|
-
- (NSArray<id<UIFocusEnvironment>> *)preferredFocusEnvironments {
|
|
377
|
-
if (self.myPreferredFocusedView == nil) {
|
|
378
|
-
return @[];
|
|
379
|
-
}
|
|
380
|
-
return @[ self.myPreferredFocusedView ];
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
- (BOOL)canBecomeFocused {
|
|
384
|
-
if (!_canBeFocused)
|
|
385
|
-
NO;
|
|
386
|
-
return [_focusDelegate canBecomeFocused];
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
- (void)focus {
|
|
390
|
-
UIViewController *viewController = self.reactViewController;
|
|
391
|
-
[self updateFocus:viewController];
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
- (UIView *)getFocusTargetView {
|
|
395
|
-
return [_focusDelegate getFocusingView];
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
- (void)updateFocus:(UIViewController *)controller {
|
|
399
|
-
UIView *focusingView = self; // [_focusDelegate getFocusingView];
|
|
400
|
-
|
|
401
|
-
if (self.superview != nil && controller != nil) {
|
|
402
|
-
controller.rncekvCustomFocusView = focusingView;
|
|
403
|
-
dispatch_async(dispatch_get_main_queue(), ^{
|
|
404
|
-
[controller setNeedsFocusUpdate];
|
|
405
|
-
[controller updateFocusIfNeeded];
|
|
406
|
-
[self a11yFocus];
|
|
407
|
-
});
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
- (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context
|
|
412
|
-
withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator {
|
|
413
|
-
_isFocused = [_focusDelegate isFocusChanged:context];
|
|
414
|
-
[self updateContextMenuRegistration];
|
|
415
|
-
|
|
416
|
-
[_focusOrderDelegate setIsFocused: [_isFocused isEqual:@YES]];
|
|
417
|
-
if ([self hasOnFocusChanged]) {
|
|
418
|
-
if (_isFocused != nil) {
|
|
419
|
-
_isAttachedToWindow = YES;
|
|
420
|
-
_isAttachedToController = YES;
|
|
421
|
-
[self onFocusChangeHandler:[_isFocused isEqual:@YES]];
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
return;
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
[super didUpdateFocusInContext:context withAnimationCoordinator:coordinator];
|
|
428
|
-
}
|
|
429
|
-
|
|
430
107
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
431
108
|
- (void)onContextMenuPressHandler {
|
|
432
109
|
[RNCEKVFabricEventHelper onContextMenuPressEventEmmiter:_eventEmitter];
|
|
@@ -437,6 +114,7 @@ Class<RCTComponentViewProtocol> ExternalKeyboardViewCls(void) {
|
|
|
437
114
|
}
|
|
438
115
|
|
|
439
116
|
- (void)onFocusChangeHandler:(BOOL)isFocused {
|
|
117
|
+
[super onFocusChangeHandler: isFocused];
|
|
440
118
|
[RNCEKVFabricEventHelper onFocusChangeEventEmmiter:isFocused
|
|
441
119
|
withEmitter:_eventEmitter];
|
|
442
120
|
}
|
|
@@ -464,8 +142,9 @@ Class<RCTComponentViewProtocol> ExternalKeyboardViewCls(void) {
|
|
|
464
142
|
self.onBubbledContextMenuPress(@{});
|
|
465
143
|
}
|
|
466
144
|
}
|
|
467
|
-
|
|
145
|
+
//
|
|
468
146
|
- (void)onFocusChangeHandler:(BOOL)isFocused {
|
|
147
|
+
[super onFocusChangeHandler: isFocused];
|
|
469
148
|
if (self.onFocusChange) {
|
|
470
149
|
self.onFocusChange(@{@"isFocused" : @(isFocused)});
|
|
471
150
|
}
|
|
@@ -485,151 +164,4 @@ Class<RCTComponentViewProtocol> ExternalKeyboardViewCls(void) {
|
|
|
485
164
|
|
|
486
165
|
#endif
|
|
487
166
|
|
|
488
|
-
|
|
489
|
-
- (void)a11yFocus {
|
|
490
|
-
if (!_enableA11yFocus)
|
|
491
|
-
return;
|
|
492
|
-
UIView *focusView = [self getFocusTargetView];
|
|
493
|
-
UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification,
|
|
494
|
-
focusView);
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
- (void)pressesBegan:(NSSet<UIPress *> *)presses
|
|
498
|
-
withEvent:(UIPressesEvent *)event {
|
|
499
|
-
NSDictionary *eventInfo = [_keyboardKeyPressHandler actionDownHandler:presses
|
|
500
|
-
withEvent:event];
|
|
501
|
-
|
|
502
|
-
if (self.hasOnPressUp || self.hasOnPressDown) {
|
|
503
|
-
[self onKeyDownPressHandler:eventInfo];
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
[super pressesBegan:presses withEvent:event];
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
- (void)pressesEnded:(NSSet<UIPress *> *)presses
|
|
510
|
-
withEvent:(UIPressesEvent *)event {
|
|
511
|
-
NSDictionary *eventInfo = [_keyboardKeyPressHandler actionUpHandler:presses
|
|
512
|
-
withEvent:event];
|
|
513
|
-
|
|
514
|
-
if (self.hasOnPressUp || self.hasOnPressDown) {
|
|
515
|
-
[self onKeyUpPressHandler:eventInfo];
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
[super pressesEnded:presses withEvent:event];
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
- (void)setIsHaloActive:(NSNumber *_Nullable)isHaloActive {
|
|
522
|
-
_isHaloActive = isHaloActive;
|
|
523
|
-
[_haloDelegate displayHalo];
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
- (void)setHaloCornerRadius:(CGFloat)haloCornerRadius {
|
|
527
|
-
_haloCornerRadius = haloCornerRadius;
|
|
528
|
-
if (_isAttachedToWindow) {
|
|
529
|
-
[_haloDelegate updateHalo];
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
- (void)setHaloExpendX:(CGFloat)haloExpendX {
|
|
534
|
-
_haloExpendX = haloExpendX;
|
|
535
|
-
if (_isAttachedToWindow) {
|
|
536
|
-
[_haloDelegate updateHalo];
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
- (void)setHaloExpendY:(CGFloat)haloExpendY {
|
|
541
|
-
_haloExpendY = haloExpendY;
|
|
542
|
-
if (_isAttachedToWindow) {
|
|
543
|
-
[_haloDelegate updateHalo];
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
- (void)didMoveToWindow {
|
|
548
|
-
[super didMoveToWindow];
|
|
549
|
-
|
|
550
|
-
if (self.window) {
|
|
551
|
-
[self onAttached];
|
|
552
|
-
} else {
|
|
553
|
-
[self onDetached];
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
if (self.window && !_isAttachedToWindow) {
|
|
557
|
-
[self onViewAttached];
|
|
558
|
-
_isAttachedToWindow = YES;
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
- (void)onViewAttached {
|
|
563
|
-
[_haloDelegate displayHalo: true];
|
|
564
|
-
if (self.autoFocus) {
|
|
565
|
-
[self updateFocus:self.reactViewController];
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
// ToDo RNCEKV-8 review and find better place for halo calculation
|
|
570
|
-
- (void)layoutSubviews {
|
|
571
|
-
[super layoutSubviews];
|
|
572
|
-
[_haloDelegate displayHalo];
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
- (void) setCustomGroupId:(NSString *)customGroupId {
|
|
577
|
-
_customGroupId = customGroupId;
|
|
578
|
-
[_gIdDelegate updateGroupIdentifier];
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
- (void)didAddSubview:(UIView *)subview {
|
|
582
|
-
[super didAddSubview: subview];
|
|
583
|
-
[_gIdDelegate updateGroupIdentifier];
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
- (void)willRemoveSubview:(UIView *)subview {
|
|
587
|
-
[_gIdDelegate clearSubview: subview];
|
|
588
|
-
if (@available(iOS 15.0, *)) {
|
|
589
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
590
|
-
if([subview isKindOfClass: RCTViewComponentView.class]) {
|
|
591
|
-
((RCTViewComponentView*)subview).rncekvCustomFocusEffect = nil;
|
|
592
|
-
} else {
|
|
593
|
-
subview.focusEffect = nil;
|
|
594
|
-
}
|
|
595
|
-
#else
|
|
596
|
-
subview.focusEffect = nil;
|
|
597
|
-
#endif
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
[super willRemoveSubview:subview];
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
- (void)focusOnMount {
|
|
604
|
-
UIViewController *viewController = self.reactViewController;
|
|
605
|
-
if (self.autoFocus) {
|
|
606
|
-
if(!_autoFocusRequested) {
|
|
607
|
-
_autoFocusRequested = YES;
|
|
608
|
-
dispatch_async(dispatch_get_main_queue(), ^{
|
|
609
|
-
dispatch_async(dispatch_get_main_queue(), ^{
|
|
610
|
-
UIWindow *window = RCTKeyWindow();
|
|
611
|
-
if (window) {
|
|
612
|
-
[self updateFocus:window.rootViewController];
|
|
613
|
-
} else {
|
|
614
|
-
[self updateFocus:viewController];
|
|
615
|
-
}
|
|
616
|
-
});
|
|
617
|
-
});
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
- (UIContextMenuConfiguration *)contextMenuInteraction:
|
|
623
|
-
(UIContextMenuInteraction *)interaction
|
|
624
|
-
configurationForMenuAtLocation:(CGPoint)location
|
|
625
|
-
API_AVAILABLE(ios(13.0)) {
|
|
626
|
-
if (_isFocused != nil && [_isFocused isEqual:@YES]) {
|
|
627
|
-
[self onContextMenuPressHandler];
|
|
628
|
-
[self onBubbledContextMenuPressHandler];
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
return nil;
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
|
|
635
167
|
@end
|
|
@@ -64,11 +64,8 @@ RCT_CUSTOM_VIEW_PROPERTY(haloEffect, BOOL, RNCEKVExternalKeyboardView)
|
|
|
64
64
|
{
|
|
65
65
|
if(json) {
|
|
66
66
|
BOOL value = [RCTConvert BOOL:json];
|
|
67
|
-
if(view.
|
|
68
|
-
[view
|
|
69
|
-
}
|
|
70
|
-
if(view.isHaloActive != nil) {
|
|
71
|
-
[view setIsHaloActive: @(value)];
|
|
67
|
+
if(view.isHaloHidden == value) {
|
|
68
|
+
[view setIsHaloHidden: !value];
|
|
72
69
|
}
|
|
73
70
|
}
|
|
74
71
|
}
|
|
@@ -90,7 +87,7 @@ RCT_CUSTOM_VIEW_PROPERTY(screenAutoA11yFocusDelay, int, RNCEKVExternalKeyboardVi
|
|
|
90
87
|
{
|
|
91
88
|
//stub
|
|
92
89
|
}
|
|
93
|
-
|
|
90
|
+
//
|
|
94
91
|
RCT_CUSTOM_VIEW_PROPERTY(haloCornerRadius, float, RNCEKVExternalKeyboardView)
|
|
95
92
|
{
|
|
96
93
|
if(json) {
|
|
@@ -82,20 +82,20 @@ using namespace facebook::react;
|
|
|
82
82
|
- (void )setCustomGroupId: (NSString *) customGroupId {
|
|
83
83
|
if (@available(iOS 14.0, *)) {
|
|
84
84
|
_customGroupId = customGroupId;
|
|
85
|
-
[self updateFocusGroup: customGroupId];
|
|
85
|
+
// [self updateFocusGroup: customGroupId];
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (@available(iOS 14.0, *)) {
|
|
92
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
93
|
-
self.rncekvCustomGroup = _customGroupId;
|
|
94
|
-
#else
|
|
95
|
-
self.focusGroupIdentifier = _customGroupId;
|
|
96
|
-
#endif
|
|
97
|
-
}
|
|
98
|
-
}
|
|
89
|
+
//
|
|
90
|
+
//- (void )updateFocusGroup: (NSString *) customGroupId {
|
|
91
|
+
// if (@available(iOS 14.0, *)) {
|
|
92
|
+
// #ifdef RCT_NEW_ARCH_ENABLED
|
|
93
|
+
// self.rncekvCustomGroup = _customGroupId;
|
|
94
|
+
// #else
|
|
95
|
+
// self.focusGroupIdentifier = _customGroupId;
|
|
96
|
+
// #endif
|
|
97
|
+
// }
|
|
98
|
+
//}
|
|
99
99
|
|
|
100
100
|
|
|
101
101
|
|
|
@@ -110,7 +110,7 @@ using namespace facebook::react;
|
|
|
110
110
|
{
|
|
111
111
|
[super prepareForRecycle];
|
|
112
112
|
self.tintColor = nil;
|
|
113
|
-
[self updateFocusGroup: nil];
|
|
113
|
+
// [self updateFocusGroup: nil];
|
|
114
114
|
_customGroupId = nil;
|
|
115
115
|
}
|
|
116
116
|
|