react-native-external-keyboard 0.8.5 → 0.9.1

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.
Files changed (159) hide show
  1. package/README.md +149 -67
  2. package/android/src/main/java/com/externalkeyboard/delegates/FocusOrderDelegate.java +81 -75
  3. package/android/src/main/java/com/externalkeyboard/delegates/FocusOrderDelegateHost.java +14 -0
  4. package/android/src/main/java/com/externalkeyboard/helper/Linking/A11yOrderLinking.java +5 -0
  5. package/android/src/main/java/com/externalkeyboard/modules/ExternalKeyboardModule.java +10 -10
  6. package/android/src/main/java/com/externalkeyboard/services/FocusLinkObserver/FocusLinkObserver.java +26 -35
  7. package/android/src/main/java/com/externalkeyboard/views/ExternalKeyboardLockView/ExternalKeyboardLockView.java +5 -0
  8. package/android/src/main/java/com/externalkeyboard/views/ExternalKeyboardLockView/ExternalKeyboardLockViewManager.java +6 -0
  9. package/android/src/main/java/com/externalkeyboard/views/ExternalKeyboardView/ExternalKeyboardView.java +8 -307
  10. package/android/src/main/java/com/externalkeyboard/views/ExternalKeyboardView/ExternalKeyboardViewManager.java +11 -18
  11. package/android/src/main/java/com/externalkeyboard/views/TextInputFocusWrapper/TextInputFocusWrapper.java +208 -101
  12. package/android/src/main/java/com/externalkeyboard/views/TextInputFocusWrapper/TextInputFocusWrapperManager.java +123 -34
  13. package/android/src/main/java/com/externalkeyboard/views/base/FocusHighlightBase.java +38 -0
  14. package/android/src/main/java/com/externalkeyboard/views/base/ViewGroupBase.java +19 -0
  15. package/android/src/main/java/com/externalkeyboard/views/base/ViewOrderGroupBase.java +190 -0
  16. package/android/src/main/java/com/externalkeyboard/views/base/keyboard/ViewFocusChangeBase.java +39 -0
  17. package/android/src/main/java/com/externalkeyboard/views/base/keyboard/ViewFocusRequestBase.java +125 -0
  18. package/android/src/main/java/com/externalkeyboard/views/base/keyboard/ViewKeyHandlerBase.java +40 -0
  19. package/android/src/newarch/TextInputFocusWrapperManagerSpec.java +2 -8
  20. package/android/src/oldarch/ExternalKeyboardLockViewManagerSpec.java +1 -0
  21. package/android/src/oldarch/TextInputFocusWrapperManagerSpec.java +32 -2
  22. package/ios/Delegates/RNCEKVFocusLinkDelegate/RNCEKVFocusLinkDelegate.h +35 -0
  23. package/ios/Delegates/RNCEKVFocusLinkDelegate/RNCEKVFocusLinkDelegate.mm +195 -0
  24. package/ios/Delegates/RNCEKVFocusOrderDelegate/RNCEKVFocusOrderProtocol.h +6 -8
  25. package/ios/Delegates/RNCEKVFocusSequenceDelegate/RNCEKVFocusSequenceDelegate.h +25 -0
  26. package/ios/Delegates/RNCEKVFocusSequenceDelegate/RNCEKVFocusSequenceDelegate.mm +163 -0
  27. package/ios/Delegates/RNCEKVGroupIdentifierDelegate/RNCEKVGroupIdentifierDelegate.h +2 -6
  28. package/ios/Delegates/RNCEKVGroupIdentifierDelegate/RNCEKVGroupIdentifierDelegate.mm +6 -78
  29. package/ios/Delegates/RNCEKVHaloDelegate/RNCEKVHaloDelegate.h +3 -4
  30. package/ios/Delegates/RNCEKVHaloDelegate/RNCEKVHaloDelegate.mm +32 -101
  31. package/ios/Delegates/RNCEKVHaloDelegate/RNCEKVHaloProtocol.h +1 -1
  32. package/ios/Extensions/RCTEnhancedScrollView+RNCEKVExternalKeyboard.mm +1 -1
  33. package/ios/Extensions/RCTTextInputComponentView+RNCEKVExternalKeyboard.mm +15 -0
  34. package/ios/Extensions/RCTViewComponentView+RNCEKVExternalKeyboard.h +9 -6
  35. package/ios/Extensions/RCTViewComponentView+RNCEKVExternalKeyboard.mm +16 -29
  36. package/ios/Extensions/UIViewController+RNCEKVExternalKeyboard.h +1 -0
  37. package/ios/Extensions/UIViewController+RNCEKVExternalKeyboard.mm +8 -0
  38. package/ios/Helpers/RNCEKVNativeProps/RNCEKVNativeProps.h +123 -0
  39. package/ios/Protocols/RNCEKVCustomFocusEffectProtocol.h +15 -0
  40. package/ios/Protocols/RNCEKVCustomGroudIdProtocol.h +15 -0
  41. package/ios/Protocols/RNCEKVKeyboardFocusableProtocol.h +15 -0
  42. package/ios/Services/RNCEKVFocusLinkObserver.mm +2 -3
  43. package/ios/Services/RNCEKVKeyboardOrderManager/RNCEKVOrderRelationship/RNCEKVOrderRelationship.mm +15 -28
  44. package/ios/Services/RNCEKVOrderLinking.mm +43 -51
  45. package/ios/Views/Base/ContextMenu/RNCEKVViewContextMenuBase.h +33 -0
  46. package/ios/Views/Base/ContextMenu/RNCEKVViewContextMenuBase.mm +84 -0
  47. package/ios/Views/Base/FocusChange/RNCEKVViewFocusChangeBase.h +37 -0
  48. package/ios/Views/Base/FocusChange/RNCEKVViewFocusChangeBase.mm +89 -0
  49. package/ios/Views/Base/FocusOrderGroup/RNCEKVViewOrderGroupBase.h +49 -0
  50. package/ios/Views/Base/FocusOrderGroup/RNCEKVViewOrderGroupBase.mm +245 -0
  51. package/ios/Views/Base/FocusRequest/RNCEKVViewFocusRequestBase.h +34 -0
  52. package/ios/Views/Base/FocusRequest/RNCEKVViewFocusRequestBase.mm +112 -0
  53. package/ios/Views/Base/GroupIdentifier/RNCEKVViewGroupIdentifierBase.h +27 -0
  54. package/ios/Views/Base/GroupIdentifier/RNCEKVViewGroupIdentifierBase.mm +69 -0
  55. package/ios/Views/Base/KeyPress/RNCEKVViewKeyPress.h +30 -0
  56. package/ios/Views/Base/KeyPress/RNCEKVViewKeyPress.mm +75 -0
  57. package/ios/Views/Base/KeyboardHallo/RNCEKVExternalKeyboardHalloBase.h +33 -0
  58. package/ios/Views/Base/KeyboardHallo/RNCEKVExternalKeyboardHalloBase.mm +92 -0
  59. package/ios/Views/Base/ViewGroup/RNCEKVViewGroupBase.h +36 -0
  60. package/ios/Views/Base/ViewGroup/RNCEKVViewGroupBase.mm +63 -0
  61. package/ios/Views/RNCEKVExternalKeyboardLockView/RNCEKVExternalKeyboardLockView.h +8 -0
  62. package/ios/Views/RNCEKVExternalKeyboardLockView/RNCEKVExternalKeyboardLockView.mm +105 -2
  63. package/ios/Views/RNCEKVExternalKeyboardLockView/RNCEKVExternalKeyboardLockViewManager.mm +11 -0
  64. package/ios/Views/RNCEKVExternalKeyboardView/RNCEKVExternalKeyboardView.h +7 -82
  65. package/ios/Views/RNCEKVExternalKeyboardView/RNCEKVExternalKeyboardView.mm +23 -493
  66. package/ios/Views/RNCEKVExternalKeyboardView/RNCEKVExternalKeyboardViewManager.mm +5 -7
  67. package/ios/Views/RNCEKVKeyboardFocusGroupView/RNCEKVKeyboardFocusGroup.mm +20 -17
  68. package/ios/Views/RNCEKVTextInputFocusWrapper/RNCEKVTextInputFocusWrapper.h +10 -39
  69. package/ios/Views/RNCEKVTextInputFocusWrapper/RNCEKVTextInputFocusWrapper.mm +40 -73
  70. package/ios/Views/RNCEKVTextInputFocusWrapper/RNCEKVTextInputFocusWrapperManager.mm +76 -8
  71. package/lib/commonjs/components/BaseKeyboardView/BaseKeyboardView.js +35 -7
  72. package/lib/commonjs/components/BaseKeyboardView/BaseKeyboardView.js.map +1 -1
  73. package/lib/commonjs/components/KeyboardExtendedInput/KeyboardExtendedInput.js +79 -1
  74. package/lib/commonjs/components/KeyboardExtendedInput/KeyboardExtendedInput.js.map +1 -1
  75. package/lib/commonjs/components/KeyboardFocusLock/FocusTrap/FocusTrap.js +18 -4
  76. package/lib/commonjs/components/KeyboardFocusLock/FocusTrap/FocusTrap.js.map +1 -1
  77. package/lib/commonjs/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.js +17 -2
  78. package/lib/commonjs/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.js.map +1 -1
  79. package/lib/commonjs/components/KeyboardFocusView/KeyboardFocusView.js +2 -0
  80. package/lib/commonjs/components/KeyboardFocusView/KeyboardFocusView.js.map +1 -1
  81. package/lib/commonjs/nativeSpec/ExternalKeyboardLockViewNativeComponent.ts +1 -0
  82. package/lib/commonjs/nativeSpec/TextInputFocusWrapperNativeComponent.ts +16 -0
  83. package/lib/commonjs/utils/useFocusStyle.js +3 -9
  84. package/lib/commonjs/utils/useFocusStyle.js.map +1 -1
  85. package/lib/commonjs/utils/withKeyboardFocus.js +32 -15
  86. package/lib/commonjs/utils/withKeyboardFocus.js.map +1 -1
  87. package/lib/commonjs/utils/wrapOrderPrefix.js +17 -0
  88. package/lib/commonjs/utils/wrapOrderPrefix.js.map +1 -0
  89. package/lib/module/components/BaseKeyboardView/BaseKeyboardView.js +35 -7
  90. package/lib/module/components/BaseKeyboardView/BaseKeyboardView.js.map +1 -1
  91. package/lib/module/components/KeyboardExtendedInput/KeyboardExtendedInput.js +80 -2
  92. package/lib/module/components/KeyboardExtendedInput/KeyboardExtendedInput.js.map +1 -1
  93. package/lib/module/components/KeyboardFocusLock/FocusTrap/FocusTrap.js +18 -4
  94. package/lib/module/components/KeyboardFocusLock/FocusTrap/FocusTrap.js.map +1 -1
  95. package/lib/module/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.js +16 -2
  96. package/lib/module/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.js.map +1 -1
  97. package/lib/module/components/KeyboardFocusView/KeyboardFocusView.js +2 -0
  98. package/lib/module/components/KeyboardFocusView/KeyboardFocusView.js.map +1 -1
  99. package/lib/module/nativeSpec/ExternalKeyboardLockViewNativeComponent.ts +1 -0
  100. package/lib/module/nativeSpec/TextInputFocusWrapperNativeComponent.ts +16 -0
  101. package/lib/module/utils/useFocusStyle.js +4 -10
  102. package/lib/module/utils/useFocusStyle.js.map +1 -1
  103. package/lib/module/utils/withKeyboardFocus.js +32 -15
  104. package/lib/module/utils/withKeyboardFocus.js.map +1 -1
  105. package/lib/module/utils/wrapOrderPrefix.js +12 -0
  106. package/lib/module/utils/wrapOrderPrefix.js.map +1 -0
  107. package/lib/typescript/src/components/BaseKeyboardView/BaseKeyboardView.d.ts.map +1 -1
  108. package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.d.ts.map +1 -1
  109. package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.types.d.ts +15 -0
  110. package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.types.d.ts.map +1 -1
  111. package/lib/typescript/src/components/KeyboardFocusLock/FocusTrap/FocusTrap.d.ts +1 -1
  112. package/lib/typescript/src/components/KeyboardFocusLock/FocusTrap/FocusTrap.d.ts.map +1 -1
  113. package/lib/typescript/src/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.d.ts +2 -1
  114. package/lib/typescript/src/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.d.ts.map +1 -1
  115. package/lib/typescript/src/components/KeyboardFocusView/KeyboardFocusView.d.ts.map +1 -1
  116. package/lib/typescript/src/index.d.ts +1 -1
  117. package/lib/typescript/src/nativeSpec/ExternalKeyboardLockViewNativeComponent.d.ts +1 -0
  118. package/lib/typescript/src/nativeSpec/ExternalKeyboardLockViewNativeComponent.d.ts.map +1 -1
  119. package/lib/typescript/src/nativeSpec/TextInputFocusWrapperNativeComponent.d.ts +16 -1
  120. package/lib/typescript/src/nativeSpec/TextInputFocusWrapperNativeComponent.d.ts.map +1 -1
  121. package/lib/typescript/src/types/BaseKeyboardView.d.ts +2 -0
  122. package/lib/typescript/src/types/BaseKeyboardView.d.ts.map +1 -1
  123. package/lib/typescript/src/types/KeyboardFocusLock.types.d.ts +1 -0
  124. package/lib/typescript/src/types/KeyboardFocusLock.types.d.ts.map +1 -1
  125. package/lib/typescript/src/types/WithKeyboardFocus.d.ts +11 -2
  126. package/lib/typescript/src/types/WithKeyboardFocus.d.ts.map +1 -1
  127. package/lib/typescript/src/utils/useFocusStyle.d.ts +1 -0
  128. package/lib/typescript/src/utils/useFocusStyle.d.ts.map +1 -1
  129. package/lib/typescript/src/utils/withKeyboardFocus.d.ts.map +1 -1
  130. package/lib/typescript/src/utils/wrapOrderPrefix.d.ts +9 -0
  131. package/lib/typescript/src/utils/wrapOrderPrefix.d.ts.map +1 -0
  132. package/package.json +6 -2
  133. package/src/components/BaseKeyboardView/BaseKeyboardView.tsx +88 -10
  134. package/src/components/KeyboardExtendedInput/KeyboardExtendedInput.tsx +138 -2
  135. package/src/components/KeyboardExtendedInput/KeyboardExtendedInput.types.ts +15 -0
  136. package/src/components/KeyboardFocusLock/FocusTrap/FocusTrap.tsx +21 -4
  137. package/src/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.tsx +20 -3
  138. package/src/components/KeyboardFocusView/KeyboardFocusView.tsx +2 -0
  139. package/src/nativeSpec/ExternalKeyboardLockViewNativeComponent.ts +1 -0
  140. package/src/nativeSpec/TextInputFocusWrapperNativeComponent.ts +16 -0
  141. package/src/types/BaseKeyboardView.ts +2 -0
  142. package/src/types/KeyboardFocusLock.types.ts +1 -0
  143. package/src/types/WithKeyboardFocus.ts +19 -2
  144. package/src/utils/useFocusStyle.tsx +5 -15
  145. package/src/utils/withKeyboardFocus.tsx +44 -15
  146. package/src/utils/wrapOrderPrefix.ts +16 -0
  147. package/ios/Delegates/RNCEKVFocusOrderDelegate/RNCEKVFocusGuideDelegate/RNCEKVFocusGuideDelegate.h +0 -36
  148. package/ios/Delegates/RNCEKVFocusOrderDelegate/RNCEKVFocusGuideDelegate/RNCEKVFocusGuideDelegate.mm +0 -150
  149. package/ios/Delegates/RNCEKVFocusOrderDelegate/RNCEKVFocusOrderDelegate.h +0 -47
  150. package/ios/Delegates/RNCEKVFocusOrderDelegate/RNCEKVFocusOrderDelegate.mm +0 -326
  151. package/ios/Services/RNCEKVKeyboardOrderManager/RNCEKVKeyboardOrderManager.h +0 -17
  152. package/ios/Services/RNCEKVKeyboardOrderManager/RNCEKVKeyboardOrderManager.mm +0 -15
  153. package/lib/commonjs/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.android.js +0 -22
  154. package/lib/commonjs/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.android.js.map +0 -1
  155. package/lib/module/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.android.js +0 -17
  156. package/lib/module/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.android.js.map +0 -1
  157. package/lib/typescript/src/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.android.d.ts +0 -4
  158. package/lib/typescript/src/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.android.d.ts.map +0 -1
  159. package/src/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.android.tsx +0 -16
@@ -6,7 +6,6 @@
6
6
  #import "UIViewController+RNCEKVExternalKeyboard.h"
7
7
  #import <React/RCTViewManager.h>
8
8
  #import <UIKit/UIKit.h>
9
- #import "RNCEKVFocusOrderDelegate.h"
10
9
  #import "RNCEKVOrderLinking.h"
11
10
 
12
11
  #ifdef RCT_NEW_ARCH_ENABLED
@@ -21,6 +20,7 @@
21
20
  #import "RNCEKVFabricEventHelper.h"
22
21
  #import <React/RCTConversions.h>
23
22
  #import <stdlib.h>
23
+ #include "RNCEKVNativeProps.h"
24
24
 
25
25
 
26
26
  using namespace facebook::react;
@@ -31,108 +31,7 @@ using namespace facebook::react;
31
31
 
32
32
  #endif
33
33
 
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
-
34
+ @implementation RNCEKVExternalKeyboardView
136
35
 
137
36
  - (instancetype)initWithFrame:(CGRect)frame {
138
37
  if (self = [super initWithFrame:frame]) {
@@ -141,99 +40,11 @@ using namespace facebook::react;
141
40
  std::make_shared<const ExternalKeyboardViewProps>();
142
41
  _props = defaultProps;
143
42
  #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
43
  }
156
44
 
157
45
  return self;
158
46
  }
159
47
 
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
48
  #ifdef RCT_NEW_ARCH_ENABLED
238
49
  + (ComponentDescriptorProvider)componentDescriptorProvider {
239
50
  return concreteComponentDescriptorProvider<
@@ -261,109 +72,28 @@ using namespace facebook::react;
261
72
  *std::static_pointer_cast<ExternalKeyboardViewProps const>(props);
262
73
  [super updateProps:props oldProps:oldProps];
263
74
 
264
- if (_hasOnFocusChanged != newViewProps.hasOnFocusChanged) {
265
- [self setHasOnFocusChanged:newViewProps.hasOnFocusChanged];
266
- }
267
-
268
- BOOL isLockChanged = [RNCEKVPropHelper isPropChanged:_lockFocus intValue: newViewProps.lockFocus];
269
- if(isLockChanged) {
270
- NSNumber* lockValue = [RNCEKVPropHelper unwrapIntValue: newViewProps.lockFocus];
271
- [self setLockFocus: lockValue];
272
- }
273
-
274
- if (oldViewProps.canBeFocused != newViewProps.canBeFocused) {
275
- [self setCanBeFocused:newViewProps.canBeFocused];
276
- }
277
-
278
- if (oldViewProps.hasKeyUpPress != newViewProps.hasKeyUpPress) {
279
- [self setHasOnPressUp:newViewProps.hasKeyUpPress];
280
- }
281
-
282
- if (oldViewProps.hasKeyDownPress != newViewProps.hasKeyDownPress) {
283
- [self setHasOnPressDown:newViewProps.hasKeyDownPress];
284
- }
285
-
286
- if (oldViewProps.autoFocus != newViewProps.autoFocus) {
287
- BOOL hasAutoFocus = newViewProps.autoFocus;
288
- [self setAutoFocus:hasAutoFocus];
289
- }
290
-
291
-
292
- BOOL isIndexChanged = [RNCEKVPropHelper isPropChanged:_orderPosition intValue: newViewProps.orderIndex];
293
- if(isIndexChanged) {
294
- NSNumber* position = [RNCEKVPropHelper unwrapIntValue: newViewProps.orderIndex];
295
- [self updateOrderPosition: position];
296
- }
297
-
298
- RKNA_PROP_UPDATE(orderGroup, setOrderGroup, newViewProps);
299
- RKNA_PROP_UPDATE(orderId, setOrderId, newViewProps);
300
- RKNA_PROP_UPDATE(orderLeft, setOrderLeft, newViewProps);
301
- RKNA_PROP_UPDATE(orderRight, setOrderRight, newViewProps);
302
- RKNA_PROP_UPDATE(orderUp, setOrderUp, newViewProps);
303
- RKNA_PROP_UPDATE(orderDown, setOrderDown, newViewProps);
304
- RKNA_PROP_UPDATE(orderForward, setOrderForward, newViewProps);
305
- RKNA_PROP_UPDATE(orderBackward, setOrderBackward, newViewProps);
306
- RKNA_PROP_UPDATE(orderLast, setOrderLast, newViewProps);
307
- RKNA_PROP_UPDATE(orderFirst, setOrderFirst, newViewProps);
308
-
309
- if (_enableA11yFocus != newViewProps.enableA11yFocus) {
310
- [self setEnableA11yFocus:newViewProps.enableA11yFocus];
311
- }
312
-
313
- UIColor *newColor = RCTUIColorFromSharedColor(newViewProps.tintColor);
314
- BOOL renewColor = newColor != nil && self.tintColor == nil;
315
- BOOL isColorChanged = oldViewProps.tintColor != newViewProps.tintColor;
316
- if (isColorChanged || renewColor) {
317
- self.tintColor = RCTUIColorFromSharedColor(newViewProps.tintColor);
318
- }
75
+ [self updateKeyPressProps:RNCEKV::KeyPressProps::from(oldViewProps)
76
+ newProps:RNCEKV::KeyPressProps::from(newViewProps)];
77
+
78
+ [self updateContextMenuProps:RNCEKV::ContextMenuProps::from(oldViewProps)
79
+ newProps:RNCEKV::ContextMenuProps::from(newViewProps)];
80
+
81
+ [self updateFocusProps:RNCEKV::FocusProps::from(oldViewProps)
82
+ newProps:RNCEKV::FocusProps::from(newViewProps)];
83
+
84
+ [self updateGroupIdentifierProps:RNCEKV::GroupIdentifierProps::from(oldViewProps)
85
+ newProps:RNCEKV::GroupIdentifierProps::from(newViewProps)];
86
+
87
+ [self updateHaloProps:RNCEKV::HaloProps::from(oldViewProps)
88
+ newProps:RNCEKV::HaloProps::from(newViewProps)];
89
+ [self updateFocusOrderProps:RNCEKV::OrderProps::from(oldViewProps)
90
+ newProps:RNCEKV::OrderProps::from(newViewProps)];
91
+ [self updateFocusRequestProps:RNCEKV::AutoFocusProps::from(oldViewProps)
92
+ newProps:RNCEKV::AutoFocusProps::from(newViewProps)];
319
93
 
320
94
  if (oldViewProps.group != newViewProps.group) {
321
95
  [self setIsGroup:newViewProps.group];
322
96
  }
323
-
324
- BOOL isNewGroup =
325
- oldViewProps.groupIdentifier != newViewProps.groupIdentifier;
326
- BOOL recoverCustomGroup =
327
- !self.customGroupId && !newViewProps.groupIdentifier.empty();
328
- if (isNewGroup || recoverCustomGroup) {
329
- if (newViewProps.groupIdentifier.empty() && self.customGroupId != nil) {
330
- self.customGroupId = nil;
331
- }
332
- if (!newViewProps.groupIdentifier.empty()) {
333
- NSString *newGroupId =
334
- [NSString stringWithUTF8String:newViewProps.groupIdentifier.c_str()];
335
- [self setCustomGroupId:newGroupId];
336
- }
337
- }
338
-
339
- // ToDo RNCEKV-0, refactor, condition for halo effect has side effect, recycle
340
- // is a question. The problem that we have to check the condition, (true means
341
- // we skip, but when it was false we should reset) and recycle (view is reused
342
- // and we need to double check whether a new place for view should be with or
343
- // without halo)
344
- if (self.isHaloActive != nil || newViewProps.haloEffect == false) {
345
- BOOL haloState = newViewProps.haloEffect;
346
- if (![self.isHaloActive isEqual:@(haloState)]) {
347
- [self setIsHaloActive:@(haloState)];
348
- }
349
- }
350
-
351
- if (_haloExpendX != newViewProps.haloExpendX) {
352
- [self setHaloExpendX:newViewProps.haloExpendX];
353
- }
354
-
355
- if (_haloExpendY != newViewProps.haloExpendY) {
356
- [self setHaloExpendY:newViewProps.haloExpendY];
357
- }
358
-
359
- if (_haloCornerRadius != newViewProps.haloCornerRadius) {
360
- [self setHaloCornerRadius:newViewProps.haloCornerRadius];
361
- }
362
-
363
- if (oldViewProps.enableContextMenu != newViewProps.enableContextMenu) {
364
- [self setEnableContextMenu: newViewProps.enableContextMenu];
365
- [self updateContextMenuRegistration];
366
- }
367
97
  }
368
98
 
369
99
 
@@ -373,61 +103,6 @@ Class<RCTComponentViewProtocol> ExternalKeyboardViewCls(void) {
373
103
 
374
104
  #endif
375
105
 
376
- // ToDo RNCEKV-DEPRICATED-0 remove after new system migration
377
- - (NSArray<id<UIFocusEnvironment>> *)preferredFocusEnvironments {
378
- if (self.myPreferredFocusedView == nil) {
379
- return @[];
380
- }
381
- return @[ self.myPreferredFocusedView ];
382
- }
383
-
384
- - (BOOL)canBecomeFocused {
385
- if (!_canBeFocused)
386
- NO;
387
- return [_focusDelegate canBecomeFocused];
388
- }
389
-
390
- - (void)focus {
391
- UIViewController *viewController = self.reactViewController;
392
- [self updateFocus:viewController];
393
- }
394
-
395
- - (UIView *)getFocusTargetView {
396
- return [_focusDelegate getFocusingView];
397
- }
398
-
399
- - (void)updateFocus:(UIViewController *)controller {
400
- UIView *focusingView = self; // [_focusDelegate getFocusingView];
401
-
402
- if (self.superview != nil && controller != nil) {
403
- controller.rncekvCustomFocusView = focusingView;
404
- dispatch_async(dispatch_get_main_queue(), ^{
405
- [controller setNeedsFocusUpdate];
406
- [controller updateFocusIfNeeded];
407
- [self a11yFocus];
408
- });
409
- }
410
- }
411
-
412
- - (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context
413
- withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator {
414
- _isFocused = [_focusDelegate isFocusChanged:context];
415
- [self updateContextMenuRegistration];
416
-
417
- [_focusOrderDelegate setIsFocused: [_isFocused isEqual:@YES]];
418
- if ([self hasOnFocusChanged]) {
419
- if (_isFocused != nil) {
420
- _isAttachedToWindow = YES;
421
- _isAttachedToController = YES;
422
- [self onFocusChangeHandler:[_isFocused isEqual:@YES]];
423
- }
424
-
425
- return;
426
- }
427
-
428
- [super didUpdateFocusInContext:context withAnimationCoordinator:coordinator];
429
- }
430
-
431
106
  #ifdef RCT_NEW_ARCH_ENABLED
432
107
  - (void)onContextMenuPressHandler {
433
108
  [RNCEKVFabricEventHelper onContextMenuPressEventEmmiter:_eventEmitter];
@@ -438,6 +113,7 @@ Class<RCTComponentViewProtocol> ExternalKeyboardViewCls(void) {
438
113
  }
439
114
 
440
115
  - (void)onFocusChangeHandler:(BOOL)isFocused {
116
+ [super onFocusChangeHandler: isFocused];
441
117
  [RNCEKVFabricEventHelper onFocusChangeEventEmmiter:isFocused
442
118
  withEmitter:_eventEmitter];
443
119
  }
@@ -465,8 +141,9 @@ Class<RCTComponentViewProtocol> ExternalKeyboardViewCls(void) {
465
141
  self.onBubbledContextMenuPress(@{});
466
142
  }
467
143
  }
468
-
144
+ //
469
145
  - (void)onFocusChangeHandler:(BOOL)isFocused {
146
+ [super onFocusChangeHandler: isFocused];
470
147
  if (self.onFocusChange) {
471
148
  self.onFocusChange(@{@"isFocused" : @(isFocused)});
472
149
  }
@@ -486,151 +163,4 @@ Class<RCTComponentViewProtocol> ExternalKeyboardViewCls(void) {
486
163
 
487
164
  #endif
488
165
 
489
-
490
- - (void)a11yFocus {
491
- if (!_enableA11yFocus)
492
- return;
493
- UIView *focusView = [self getFocusTargetView];
494
- UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification,
495
- focusView);
496
- }
497
-
498
- - (void)pressesBegan:(NSSet<UIPress *> *)presses
499
- withEvent:(UIPressesEvent *)event {
500
- NSDictionary *eventInfo = [_keyboardKeyPressHandler actionDownHandler:presses
501
- withEvent:event];
502
-
503
- if (self.hasOnPressUp || self.hasOnPressDown) {
504
- [self onKeyDownPressHandler:eventInfo];
505
- }
506
-
507
- [super pressesBegan:presses withEvent:event];
508
- }
509
-
510
- - (void)pressesEnded:(NSSet<UIPress *> *)presses
511
- withEvent:(UIPressesEvent *)event {
512
- NSDictionary *eventInfo = [_keyboardKeyPressHandler actionUpHandler:presses
513
- withEvent:event];
514
-
515
- if (self.hasOnPressUp || self.hasOnPressDown) {
516
- [self onKeyUpPressHandler:eventInfo];
517
- }
518
-
519
- [super pressesEnded:presses withEvent:event];
520
- }
521
-
522
- - (void)setIsHaloActive:(NSNumber *_Nullable)isHaloActive {
523
- _isHaloActive = isHaloActive;
524
- [_haloDelegate displayHalo];
525
- }
526
-
527
- - (void)setHaloCornerRadius:(CGFloat)haloCornerRadius {
528
- _haloCornerRadius = haloCornerRadius;
529
- if (_isAttachedToWindow) {
530
- [_haloDelegate updateHalo];
531
- }
532
- }
533
-
534
- - (void)setHaloExpendX:(CGFloat)haloExpendX {
535
- _haloExpendX = haloExpendX;
536
- if (_isAttachedToWindow) {
537
- [_haloDelegate updateHalo];
538
- }
539
- }
540
-
541
- - (void)setHaloExpendY:(CGFloat)haloExpendY {
542
- _haloExpendY = haloExpendY;
543
- if (_isAttachedToWindow) {
544
- [_haloDelegate updateHalo];
545
- }
546
- }
547
-
548
- - (void)didMoveToWindow {
549
- [super didMoveToWindow];
550
-
551
- if (self.window) {
552
- [self onAttached];
553
- } else {
554
- [self onDetached];
555
- }
556
-
557
- if (self.window && !_isAttachedToWindow) {
558
- [self onViewAttached];
559
- _isAttachedToWindow = YES;
560
- }
561
- }
562
-
563
- - (void)onViewAttached {
564
- [_haloDelegate displayHalo: true];
565
- if (self.autoFocus) {
566
- [self updateFocus:self.reactViewController];
567
- }
568
- }
569
-
570
- // ToDo RNCEKV-8 review and find better place for halo calculation
571
- - (void)layoutSubviews {
572
- [super layoutSubviews];
573
- [_haloDelegate displayHalo];
574
- }
575
-
576
-
577
- - (void) setCustomGroupId:(NSString *)customGroupId {
578
- _customGroupId = customGroupId;
579
- [_gIdDelegate updateGroupIdentifier];
580
- }
581
-
582
- - (void)didAddSubview:(UIView *)subview {
583
- [super didAddSubview: subview];
584
- [_gIdDelegate updateGroupIdentifier];
585
- }
586
-
587
- - (void)willRemoveSubview:(UIView *)subview {
588
- [_gIdDelegate clearSubview: subview];
589
- if (@available(iOS 15.0, *)) {
590
- #ifdef RCT_NEW_ARCH_ENABLED
591
- if([subview isKindOfClass: RCTViewComponentView.class]) {
592
- ((RCTViewComponentView*)subview).rncekvCustomFocusEffect = nil;
593
- } else {
594
- subview.focusEffect = nil;
595
- }
596
- #else
597
- subview.focusEffect = nil;
598
- #endif
599
- }
600
-
601
- [super willRemoveSubview:subview];
602
- }
603
-
604
- - (void)focusOnMount {
605
- UIViewController *viewController = self.reactViewController;
606
- if (self.autoFocus) {
607
- if(!_autoFocusRequested) {
608
- _autoFocusRequested = YES;
609
- dispatch_async(dispatch_get_main_queue(), ^{
610
- dispatch_async(dispatch_get_main_queue(), ^{
611
- UIWindow *window = RCTKeyWindow();
612
- if (window) {
613
- [self updateFocus:window.rootViewController];
614
- } else {
615
- [self updateFocus:viewController];
616
- }
617
- });
618
- });
619
- }
620
- }
621
- }
622
-
623
- - (UIContextMenuConfiguration *)contextMenuInteraction:
624
- (UIContextMenuInteraction *)interaction
625
- configurationForMenuAtLocation:(CGPoint)location
626
- API_AVAILABLE(ios(13.0)) {
627
- if (_isFocused != nil && [_isFocused isEqual:@YES]) {
628
- [self onContextMenuPressHandler];
629
- [self onBubbledContextMenuPressHandler];
630
- }
631
-
632
- return nil;
633
- }
634
-
635
-
636
166
  @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.isHaloActive == nil && !value) {
68
- [view setIsHaloActive: @0];
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) {
@@ -143,7 +140,8 @@ RCT_CUSTOM_VIEW_PROPERTY(orderIndex, NSNumber, RNCEKVExternalKeyboardView)
143
140
  {
144
141
  if(json){
145
142
  NSNumber* value = [RCTConvert NSNumber:json];
146
- [view setOrderPosition: value];
143
+ NSNumber* orderPosition = [value intValue] == -1 ? nil : value;
144
+ [view setOrderPosition: orderPosition];
147
145
  }
148
146
  }
149
147
 
@@ -51,11 +51,14 @@ using namespace facebook::react;
51
51
  withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator {
52
52
 
53
53
  [super didUpdateFocusInContext:context withAnimationCoordinator:coordinator];
54
- NSString* nextFocusGroup = context.nextFocusedView.focusGroupIdentifier;
55
- BOOL isFocused = [nextFocusGroup isEqual: _customGroupId];
56
- if(_isGroupFocused != isFocused){
57
- _isGroupFocused = isFocused;
58
- [self onFocusChangeHandler: isFocused];
54
+ if (@available(iOS 14.0, *)) {
55
+ NSString* nextFocusGroup = context.nextFocusedView.focusGroupIdentifier;
56
+ BOOL isFocused = [nextFocusGroup isEqual: _customGroupId];
57
+
58
+ if(_isGroupFocused != isFocused){
59
+ _isGroupFocused = isFocused;
60
+ [self onFocusChangeHandler: isFocused];
61
+ }
59
62
  }
60
63
  }
61
64
 
@@ -82,20 +85,20 @@ using namespace facebook::react;
82
85
  - (void )setCustomGroupId: (NSString *) customGroupId {
83
86
  if (@available(iOS 14.0, *)) {
84
87
  _customGroupId = customGroupId;
85
- [self updateFocusGroup: customGroupId];
88
+ // [self updateFocusGroup: customGroupId];
86
89
  }
87
90
  }
88
91
 
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
- }
92
+ //
93
+ //- (void )updateFocusGroup: (NSString *) customGroupId {
94
+ // if (@available(iOS 14.0, *)) {
95
+ // #ifdef RCT_NEW_ARCH_ENABLED
96
+ // self.rncekvCustomGroup = _customGroupId;
97
+ // #else
98
+ // self.focusGroupIdentifier = _customGroupId;
99
+ // #endif
100
+ // }
101
+ //}
99
102
 
100
103
 
101
104
 
@@ -110,7 +113,7 @@ using namespace facebook::react;
110
113
  {
111
114
  [super prepareForRecycle];
112
115
  self.tintColor = nil;
113
- [self updateFocusGroup: nil];
116
+ // [self updateFocusGroup: nil];
114
117
  _customGroupId = nil;
115
118
  }
116
119