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
@@ -1,326 +0,0 @@
1
- //
2
- // RNCEKVFocusOrderDelegate.mm
3
- // react-native-external-keyboard
4
- //
5
- // Created by Artur Kalach on 25/06/2025.
6
- //
7
-
8
- #import <Foundation/Foundation.h>
9
-
10
-
11
- #import "RNCEKVFocusOrderDelegate.h"
12
- #import "RNCEKVFocusOrderProtocol.h"
13
- #import "RNCEKVFocusEffectUtility.h"
14
- #import "RNCEKVOrderLinking.h"
15
- #import "RNCEKVExternalKeyboardView.h"
16
- #import "UIViewController+RNCEKVExternalKeyboard.h"
17
- #import "RNCEKVOrderSubscriber.h"
18
- #import "RNCEKVFocusLinkObserver.h"
19
- #import "RNCEKVFocusGuideHelper.h"
20
- #import "RNCEKVFocusGuideDelegate.h"
21
-
22
- static NSNumber *const FOCUS_DEFAULT = nil;
23
- static NSNumber *const FOCUS_LOCK = @0;
24
- static NSNumber *const FOCUS_UPDATE = @1;
25
-
26
- @implementation RNCEKVFocusOrderDelegate{
27
- BOOL _isFocused;
28
- UIView<RNCEKVFocusOrderProtocol>* _delegate;
29
- UIView* _entry;
30
- UIView* _exit;
31
- UIView* _lock;
32
-
33
- RNCEKVFocusGuideDelegate *_focusGuideDelegate;
34
- NSMutableDictionary<NSNumber *, id> *_updateLinks;
35
- NSMutableDictionary<NSNumber *, id> *_removeLinks;
36
-
37
- }
38
-
39
- - (instancetype _Nonnull )initWithView:(UIView<RNCEKVFocusOrderProtocol> *_Nonnull)delegate{
40
- self = [super init];
41
- if (self) {
42
- _delegate = delegate;
43
- _focusGuideDelegate = [[RNCEKVFocusGuideDelegate alloc] initWithView:delegate];
44
- _subscribers = [NSMutableDictionary dictionary];
45
- _isFocused = false;
46
- }
47
- return self;
48
- }
49
-
50
- - (void)subscribeToDirection:(RNCEKVFocusGuideDirection)direction
51
- linkId:(NSString *)linkId {
52
- if (!linkId) {
53
- return;
54
- }
55
-
56
- if(_subscribers[@(direction)]) {
57
- [self clearDirection: direction];
58
- }
59
-
60
- __typeof(self) __weak weakSelf = self;
61
- RNCEKVFocusGuideDirection capturedDirection = direction;
62
-
63
- LinkUpdatedCallback onLinkUpdated = ^(UIView *link) {
64
- [self->_focusGuideDelegate setGuideFor:capturedDirection withView: link];
65
- };
66
-
67
- LinkRemovedCallback onLinkRemoved = ^{
68
- [self->_focusGuideDelegate removeGuideFor: capturedDirection];
69
- };
70
-
71
- RNCEKVOrderSubscriber* subscriber = [[RNCEKVFocusLinkObserver sharedManager] subscribe:linkId
72
- onLinkUpdated:onLinkUpdated
73
- onLinkRemoved:onLinkRemoved];
74
- self.subscribers[@(direction)] = subscriber;
75
- }
76
-
77
- - (void)clearDirection:(RNCEKVFocusGuideDirection)direction {
78
- if (!self.subscribers[@(direction)]) {
79
- return;
80
- }
81
-
82
- [[RNCEKVFocusLinkObserver sharedManager] unsubscribe:self.subscribers[@(direction)]];
83
- self.subscribers[@(direction)] = nil;
84
- [_focusGuideDelegate removeGuideFor: direction];
85
- }
86
-
87
- - (void)refreshDirection:(RNCEKVFocusGuideDirection)direction
88
- prevId:(NSString *)prevId
89
- nextId:(NSString *)nextId {
90
- [self clearDirection:direction];
91
- [self subscribeToDirection:direction linkId:nextId];
92
- }
93
-
94
- - (void)keyboardedViewFocus:(UIView *)view {
95
- if ([view isKindOfClass:[RNCEKVExternalKeyboardView class]]) {
96
- [(RNCEKVExternalKeyboardView*)view focus];
97
- }
98
- }
99
-
100
- - (void)defaultViewFocus:(UIView *)view {
101
- UIViewController *controller = _delegate.reactViewController;
102
-
103
- if (controller != nil) {
104
- controller.rncekvCustomFocusView = view;
105
- dispatch_async(dispatch_get_main_queue(), ^{
106
- [controller setNeedsFocusUpdate];
107
- [controller updateFocusIfNeeded];
108
- });
109
- }
110
- }
111
-
112
-
113
- #pragma mark - Next Focus Handling
114
- - (void)handleNextFocus:(UIView *)current currentIndex:(NSInteger)currentIndex {
115
- RNCEKVOrderRelationship* orderRelationship = [[RNCEKVOrderLinking sharedInstance] getInfo: _delegate.orderGroup];
116
- UIView* _entry = orderRelationship.entry;
117
- UIView* _exit = orderRelationship.exit;
118
-
119
- BOOL isEntry = _entry == current;
120
- if (isEntry) {
121
- UIView* firstElement = [orderRelationship getItem: 0];
122
- [self keyboardedViewFocus: firstElement];
123
- }
124
-
125
- BOOL isLast = currentIndex == orderRelationship.count - 1 && _exit;
126
- if (isLast) {
127
- [self defaultViewFocus: _exit];
128
- }
129
-
130
- BOOL inOrderRange = currentIndex >= 0 && currentIndex < orderRelationship.count - 1;
131
- if (inOrderRange) {
132
- UIView* nextElement = [orderRelationship getItem: currentIndex + 1];
133
- [self keyboardedViewFocus: nextElement];
134
- }
135
- }
136
-
137
-
138
- #pragma mark - Prev Focus Handling
139
- - (void)handlePrevFocus:(UIView *)current currentIndex:(NSInteger)currentIndex {
140
- RNCEKVOrderRelationship* orderRelationship = [[RNCEKVOrderLinking sharedInstance] getInfo: _delegate.orderGroup];
141
-
142
- UIView* _exit = orderRelationship.exit;
143
- UIView* _entry = orderRelationship.entry;
144
-
145
- BOOL isExit = _exit == current;
146
- int orderCount = [orderRelationship count];
147
- if (isExit) {
148
- UIView* lastElement = [orderRelationship getItem: orderCount - 1];
149
- [self keyboardedViewFocus: lastElement];
150
- }
151
-
152
- BOOL isFirst = currentIndex == 0 && _entry;
153
- if (isFirst) {
154
- [self defaultViewFocus: _entry];
155
- }
156
-
157
- BOOL inRange = currentIndex > 0 && currentIndex <= orderCount - 1;
158
- if (inRange) {
159
- UIView* prevElement = [orderRelationship getItem: currentIndex - 1];
160
- [self keyboardedViewFocus: prevElement];
161
- }
162
- }
163
-
164
- #pragma mark - Focus Order Handler
165
- - (NSNumber*)shouldUpdateFocusInContext:(UIFocusUpdateContext *)context {
166
- UIFocusHeading movementHint = context.focusHeading;
167
- UIView *next = (UIView *)context.nextFocusedItem;
168
- UIView *current = (UIView *)context.previouslyFocusedItem;
169
- UIView* targetView = [_delegate getFocusTargetView];
170
-
171
- BOOL isTarget = current == targetView;
172
- if (isTarget) {
173
- NSMutableDictionary<NSNumber *, NSString *> *orderMapping = [NSMutableDictionary dictionary]; //Todo create custom structure
174
- if (_delegate.orderLast) {
175
- orderMapping[@(UIFocusHeadingLast)] = _delegate.orderLast;
176
- }
177
- if (_delegate.orderFirst) {
178
- orderMapping[@(UIFocusHeadingFirst)] = _delegate.orderFirst;
179
- }
180
- if (_delegate.orderForward) {
181
- orderMapping[@(UIFocusHeadingNext)] = _delegate.orderForward;
182
- }
183
- if (_delegate.orderBackward) {
184
- orderMapping[@(UIFocusHeadingPrevious)] = _delegate.orderBackward;
185
- }
186
-
187
- NSString *orderKey = orderMapping[@(movementHint)];
188
- if (orderKey) {
189
- UIView *nextView = [[RNCEKVOrderLinking sharedInstance] getOrderView:orderKey];
190
- [self keyboardedViewFocus:nextView];
191
- return FOCUS_LOCK;
192
- }
193
- }
194
-
195
-
196
- if (current == targetView) {
197
- NSUInteger rawFocusLockValue = [_delegate.lockFocus unsignedIntegerValue];
198
-
199
- BOOL isDirectionLock = (rawFocusLockValue & movementHint) != 0;
200
- if (isDirectionLock) {
201
- return FOCUS_LOCK;
202
- }
203
- }
204
-
205
- if(_delegate.orderGroup && _delegate.orderPosition != nil) {
206
- RNCEKVOrderRelationship* orderRelationship = [[RNCEKVOrderLinking sharedInstance] getInfo: _delegate.orderGroup];
207
- NSArray *order = [orderRelationship getArray];
208
- if(order.count == 0) {
209
- return FOCUS_DEFAULT;
210
- }
211
-
212
- UIView* _exit = orderRelationship.exit;
213
- UIView* _entry = orderRelationship.entry;
214
-
215
- int currentIndex = [orderRelationship getItemIndex:current];
216
- int nextIndex = [orderRelationship getItemIndex:next];
217
- // [self findOrderIndex:order element:current];
218
-
219
- // [self findOrderIndex:order element:next];
220
-
221
- BOOL isEntryElement = _entry == nil && currentIndex == -1 && movementHint == UIFocusHeadingNext;
222
-
223
- if(isEntryElement) {
224
- orderRelationship.entry = current;
225
- }
226
-
227
- BOOL isExit = _exit == nil && nextIndex == -1 && movementHint == UIFocusHeadingNext;
228
- if(isExit) {
229
- orderRelationship.exit = next;
230
- }
231
-
232
- if(context.focusHeading == UIFocusHeadingNext) {
233
- [self handleNextFocus:current currentIndex: currentIndex];
234
- return FOCUS_UPDATE;
235
- }
236
-
237
-
238
- if(context.focusHeading == UIFocusHeadingPrevious) {
239
- [self handlePrevFocus:current currentIndex: currentIndex];
240
- return FOCUS_UPDATE;
241
- }
242
- }
243
-
244
- return FOCUS_DEFAULT;
245
- }
246
-
247
- - (void)linkId {
248
- RNCEKVFocusLinkObserver *focusLinkObserver = [RNCEKVFocusLinkObserver sharedManager];
249
-
250
- NSString* orderId = _delegate.orderId;
251
- UIView* view = [_delegate getFocusTargetView];
252
-
253
- if(orderId != nil) {
254
- [focusLinkObserver emitWithId:orderId link:view];
255
- }
256
-
257
- [self subscribeToDirection:RNCEKVFocusGuideDirectionLeft
258
- linkId:_delegate.orderLeft];
259
-
260
- [self subscribeToDirection:RNCEKVFocusGuideDirectionRight
261
- linkId:_delegate.orderRight
262
- ];
263
-
264
- [self subscribeToDirection:RNCEKVFocusGuideDirectionUp
265
- linkId:_delegate.orderUp
266
- ];
267
-
268
- [self subscribeToDirection:RNCEKVFocusGuideDirectionDown
269
- linkId:_delegate.orderDown
270
- ];
271
- }
272
-
273
- - (void)refreshId: (NSString*)prev next:(NSString*)next {
274
- RNCEKVFocusLinkObserver *focusLinkObserver = [RNCEKVFocusLinkObserver sharedManager];
275
- UIView* view = [_delegate getFocusTargetView];
276
-
277
-
278
- if(prev != nil) {
279
- [focusLinkObserver emitRemoveWithId: prev];
280
- [[RNCEKVOrderLinking sharedInstance] cleanOrderId: prev];
281
- }
282
-
283
- if(next != nil && view != nil) {
284
- [[RNCEKVOrderLinking sharedInstance] storeOrderId: next withView:_delegate];
285
- [focusLinkObserver emitWithId:next link:view];
286
- }
287
- };
288
-
289
- - (void)setIsFocused:(BOOL)value {
290
- return [_focusGuideDelegate setIsFocused: value];
291
- }
292
-
293
- - (void)refreshLeft:(NSString*)prev next:(NSString*)next {
294
- [self refreshDirection:RNCEKVFocusGuideDirectionLeft
295
- prevId:prev
296
- nextId:next];
297
- }
298
-
299
- - (void)refreshRight:(NSString*)prev next:(NSString*)next{
300
- [self refreshDirection:RNCEKVFocusGuideDirectionRight
301
- prevId:prev
302
- nextId:next];
303
- }
304
-
305
- - (void)refreshUp:(NSString*)prev next:(NSString*)next{
306
- [self refreshDirection:RNCEKVFocusGuideDirectionUp
307
- prevId:prev
308
- nextId:next];
309
- }
310
-
311
- - (void)refreshDown:(NSString*)prev next:(NSString*)next{
312
- [self refreshDirection:RNCEKVFocusGuideDirectionDown
313
- prevId:prev
314
- nextId:next];
315
- }
316
-
317
- - (void)clear {
318
- [self clearDirection:RNCEKVFocusGuideDirectionLeft];
319
- [self clearDirection:RNCEKVFocusGuideDirectionRight];
320
- [self clearDirection:RNCEKVFocusGuideDirectionUp];
321
- [self clearDirection:RNCEKVFocusGuideDirectionDown];
322
-
323
- [self refreshId: _delegate.orderId next:nil];
324
- }
325
-
326
- @end
@@ -1,17 +0,0 @@
1
- //
2
- // RNCEKVKeyboardOrderManager.h
3
- // Pods
4
- //
5
- // Created by Artur Kalach on 15/07/2025.
6
- //
7
-
8
- #ifndef RNCEKVKeyboardOrderManager_h
9
- #define RNCEKVKeyboardOrderManager_h
10
-
11
- @interface RNCEKVKeyboardOrderManager
12
-
13
-
14
-
15
- @end
16
-
17
- #endif /* RNCEKVKeyboardOrderManager_h */
@@ -1,15 +0,0 @@
1
- //
2
- // RNCEKVKeyboardOrderManager.m
3
- // react-native-external-keyboard
4
- //
5
- // Created by Artur Kalach on 15/07/2025.
6
- //
7
-
8
- #import <Foundation/Foundation.h>
9
-
10
- //Group and orderIndex
11
- //orderId hashmap
12
- //orderId listeners
13
- //singleton
14
-
15
-
@@ -1,22 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.KeyboardFocusLockBase = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _ExternalKeyboardLockViewNativeComponent = _interopRequireDefault(require("../../../nativeSpec/ExternalKeyboardLockViewNativeComponent"));
9
- var _jsxRuntime = require("react/jsx-runtime");
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
- const KeyboardFocusLockBase = exports.KeyboardFocusLockBase = /*#__PURE__*/_react.default.memo(({
12
- lockDisabled = false,
13
- componentType = 0,
14
- ...props
15
- }) => {
16
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExternalKeyboardLockViewNativeComponent.default, {
17
- ...props,
18
- componentType: componentType,
19
- lockDisabled: lockDisabled
20
- });
21
- });
22
- //# sourceMappingURL=KeyboardFocusLockBase.android.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_ExternalKeyboardLockViewNativeComponent","_jsxRuntime","e","__esModule","default","KeyboardFocusLockBase","exports","React","memo","lockDisabled","componentType","props","jsx"],"sourceRoot":"../../../../../src","sources":["components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.android.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,wCAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAmG,IAAAE,WAAA,GAAAF,OAAA;AAAA,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAI5F,MAAMG,qBAAqB,GAAAC,OAAA,CAAAD,qBAAA,gBAAGE,cAAK,CAACC,IAAI,CAC7C,CAAC;EAAEC,YAAY,GAAG,KAAK;EAAEC,aAAa,GAAG,CAAC;EAAE,GAAGC;AAAM,CAAC,KAAK;EACzD,oBACE,IAAAV,WAAA,CAAAW,GAAA,EAACZ,wCAAA,CAAAI,OAAwB;IAAA,GACnBO,KAAK;IACTD,aAAa,EAAEA,aAAc;IAC7BD,YAAY,EAAEA;EAAa,CAC5B,CAAC;AAEN,CACF,CAAC","ignoreList":[]}
@@ -1,17 +0,0 @@
1
- "use strict";
2
-
3
- import React from 'react';
4
- import ExternalKeyboardLockView from '../../../nativeSpec/ExternalKeyboardLockViewNativeComponent';
5
- import { jsx as _jsx } from "react/jsx-runtime";
6
- export const KeyboardFocusLockBase = /*#__PURE__*/React.memo(({
7
- lockDisabled = false,
8
- componentType = 0,
9
- ...props
10
- }) => {
11
- return /*#__PURE__*/_jsx(ExternalKeyboardLockView, {
12
- ...props,
13
- componentType: componentType,
14
- lockDisabled: lockDisabled
15
- });
16
- });
17
- //# sourceMappingURL=KeyboardFocusLockBase.android.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","ExternalKeyboardLockView","jsx","_jsx","KeyboardFocusLockBase","memo","lockDisabled","componentType","props"],"sourceRoot":"../../../../../src","sources":["components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.android.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,wBAAwB,MAAM,6DAA6D;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAInG,OAAO,MAAMC,qBAAqB,gBAAGJ,KAAK,CAACK,IAAI,CAC7C,CAAC;EAAEC,YAAY,GAAG,KAAK;EAAEC,aAAa,GAAG,CAAC;EAAE,GAAGC;AAAM,CAAC,KAAK;EACzD,oBACEL,IAAA,CAACF,wBAAwB;IAAA,GACnBO,KAAK;IACTD,aAAa,EAAEA,aAAc;IAC7BD,YAAY,EAAEA;EAAa,CAC5B,CAAC;AAEN,CACF,CAAC","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import type { KeyboardFocusLockProps } from '../../../types/KeyboardFocusLock.types';
3
- export declare const KeyboardFocusLockBase: React.NamedExoticComponent<KeyboardFocusLockProps>;
4
- //# sourceMappingURL=KeyboardFocusLockBase.android.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"KeyboardFocusLockBase.android.d.ts","sourceRoot":"","sources":["../../../../../../src/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.android.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAErF,eAAO,MAAM,qBAAqB,oDAUjC,CAAC"}
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- import ExternalKeyboardLockView from '../../../nativeSpec/ExternalKeyboardLockViewNativeComponent';
3
-
4
- import type { KeyboardFocusLockProps } from '../../../types/KeyboardFocusLock.types';
5
-
6
- export const KeyboardFocusLockBase = React.memo<KeyboardFocusLockProps>(
7
- ({ lockDisabled = false, componentType = 0, ...props }) => {
8
- return (
9
- <ExternalKeyboardLockView
10
- {...props}
11
- componentType={componentType}
12
- lockDisabled={lockDisabled}
13
- />
14
- );
15
- }
16
- );