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
@@ -11,8 +11,8 @@
11
11
  #import "RNCEKVOrderRelationship.h"
12
12
 
13
13
  @implementation RNCEKVOrderLinking {
14
- NSMutableDictionary *_relationships;
15
- NSMapTable *_weakMap;
14
+ NSMutableDictionary<NSString *, RNCEKVOrderRelationship *> *_relationships;
15
+ NSMapTable<NSString *, UIView *> *_weakMap;
16
16
  }
17
17
 
18
18
  + (instancetype)sharedInstance {
@@ -24,82 +24,74 @@
24
24
  return sharedInstance;
25
25
  }
26
26
 
27
- - (RNCEKVOrderRelationship*)getInfo:(NSString*)orderGroup {
28
- RNCEKVOrderRelationship* relationship = [_relationships objectForKey: orderGroup];
29
- return relationship;
30
- }
31
-
32
27
  - (id)init {
33
28
  if (self = [super init]) {
34
29
  _relationships = [NSMutableDictionary dictionary];
35
30
  _weakMap = [NSMapTable strongToWeakObjectsMapTable];
36
31
  }
37
-
38
32
  return self;
39
33
  }
40
34
 
41
- - (void)add:(NSNumber*)position withOrderKey:(NSString*)orderKey withObject:(NSObject*)obj {
42
- RNCEKVOrderRelationship* relationship = [_relationships objectForKey: orderKey];
43
- if(relationship == nil) {
35
+ - (RNCEKVOrderRelationship *)getInfo:(NSString *)orderGroup {
36
+ return _relationships[orderGroup];
37
+ }
38
+
39
+ - (RNCEKVOrderRelationship *)relationshipForKey:(NSString *)orderKey {
40
+ RNCEKVOrderRelationship *relationship = _relationships[orderKey];
41
+ if (relationship == nil) {
44
42
  relationship = [[RNCEKVOrderRelationship alloc] init];
45
- [_relationships setObject: relationship forKey:orderKey];
43
+ _relationships[orderKey] = relationship;
46
44
  }
47
- [relationship add:position withObject:obj];
45
+ return relationship;
48
46
  }
49
47
 
50
- -(void)remove:(NSNumber*)position withOrderKey:(NSString*)orderKey {
51
- RNCEKVOrderRelationship* relationship = [_relationships objectForKey: orderKey];
52
- if(relationship != nil) {
53
- [relationship remove:position];
54
- if([relationship isEmpty]) {
55
- [relationship clear];
56
- [_relationships removeObjectForKey: orderKey];
57
- }
48
+ - (void)removeRelationshipIfEmpty:(RNCEKVOrderRelationship *)relationship forKey:(NSString *)orderKey {
49
+ if ([relationship isEmpty]) {
50
+ [relationship clear];
51
+ [_relationships removeObjectForKey:orderKey];
58
52
  }
59
53
  }
60
54
 
61
- - (void)update:(NSNumber*)position lastPosition:(NSNumber*)lastPosition withOrderKey:(NSString*)orderKey withView:(UIView*) view {
62
- RNCEKVOrderRelationship* relationship = [_relationships objectForKey: orderKey];
63
- if(relationship != nil) {
64
- [relationship update:lastPosition withPosition:position withObject:view];
65
- }
55
+ - (void)add:(NSNumber *)position withOrderKey:(NSString *)orderKey withObject:(NSObject *)obj {
56
+ [[self relationshipForKey:orderKey] add:position withObject:obj];
66
57
  }
67
58
 
68
- - (void)updateOrderKey:(NSString*)prev next:(NSString*)next position:(NSNumber*)position withView:(UIView*) view {
69
- if(prev != nil) {
70
- RNCEKVOrderRelationship* relationship = [_relationships objectForKey: prev];
71
- if(relationship != nil) {
72
- [relationship remove: position];
73
- }
74
-
75
- if([relationship isEmpty]) {
76
- [relationship clear];
77
- [_relationships removeObjectForKey: prev];
59
+ - (void)remove:(NSNumber *)position withOrderKey:(NSString *)orderKey {
60
+ RNCEKVOrderRelationship *relationship = _relationships[orderKey];
61
+ if (relationship == nil) return;
62
+ [relationship remove:position];
63
+ [self removeRelationshipIfEmpty:relationship forKey:orderKey];
64
+ }
65
+
66
+ - (void)update:(NSNumber *)position lastPosition:(NSNumber *)lastPosition withOrderKey:(NSString *)orderKey withView:(UIView *)view {
67
+ [_relationships[orderKey] update:lastPosition withPosition:position withObject:view];
68
+ }
69
+
70
+ - (void)updateOrderKey:(NSString *)prev next:(NSString *)next position:(NSNumber *)position withView:(UIView *)view {
71
+ if (prev != nil) {
72
+ RNCEKVOrderRelationship *relationship = _relationships[prev];
73
+ if (relationship != nil) {
74
+ [relationship remove:position];
75
+ [self removeRelationshipIfEmpty:relationship forKey:prev];
78
76
  }
79
77
  }
80
-
81
- if(next != nil) {
82
- RNCEKVOrderRelationship* newRelationship = [_relationships objectForKey: next];
83
- if(newRelationship == nil) {
84
- newRelationship = [[RNCEKVOrderRelationship alloc] init];
85
- [_relationships setObject: newRelationship forKey:next];
86
- }
87
- [newRelationship add:position withObject:view];
78
+
79
+ if (next != nil) {
80
+ [[self relationshipForKey:next] add:position withObject:view];
88
81
  }
89
82
  }
90
83
 
91
- - (void)storeOrderId:(NSString*)orderId withView:(UIView*) view {
84
+ - (void)storeOrderId:(NSString *)orderId withView:(UIView *)view {
92
85
  [_weakMap setObject:view forKey:orderId];
93
86
  }
94
87
 
95
- - (UIView*)getOrderView:(NSString*)orderId {
96
- UIView *view = [_weakMap objectForKey:orderId];
97
- return view;
98
- };
88
+ - (UIView *)getOrderView:(NSString *)orderId {
89
+ return [_weakMap objectForKey:orderId];
90
+ }
99
91
 
100
- - (void)cleanOrderId:(NSString*)orderId {
92
+ - (void)cleanOrderId:(NSString *)orderId {
101
93
  [_weakMap removeObjectForKey:orderId];
102
- };
94
+ }
103
95
 
104
96
 
105
97
 
@@ -0,0 +1,33 @@
1
+ //
2
+ // RNCEKVViewContextMenuBase.h
3
+ // Pods
4
+ //
5
+ // Created by Artur Kalach on 09/04/2026.
6
+ //
7
+
8
+ #ifndef RNCEKVViewContextMenuBase_h
9
+ #define RNCEKVViewContextMenuBase_h
10
+
11
+
12
+ #import "RNCEKVViewFocusChangeBase.h"
13
+
14
+ #ifdef RCT_NEW_ARCH_ENABLED
15
+ #import "RNCEKVNativeProps.h"
16
+ #endif
17
+
18
+ @interface RNCEKVViewContextMenuBase : RNCEKVViewFocusChangeBase<UIContextMenuInteractionDelegate>
19
+
20
+ @property (nonatomic, assign) BOOL enableContextMenu;
21
+
22
+ #ifdef RCT_NEW_ARCH_ENABLED
23
+ - (void)updateContextMenuProps:(const RNCEKV::ContextMenuProps &)oldProps
24
+ newProps:(const RNCEKV::ContextMenuProps &)newProps;
25
+ #endif
26
+
27
+ - (void)onContextMenuPressHandler;
28
+ - (void)onBubbledContextMenuPressHandler;
29
+
30
+ @end
31
+
32
+
33
+ #endif /* RNCEKVViewContextMenuBase_h */
@@ -0,0 +1,84 @@
1
+ //
2
+ // RNCEKVViewContextMenuBase.m
3
+ // react-native-external-keyboard
4
+ //
5
+ // Created by Artur Kalach on 09/04/2026.
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+
10
+
11
+
12
+ #import "RNCEKVViewContextMenuBase.h"
13
+
14
+ #ifdef RCT_NEW_ARCH_ENABLED
15
+ #import "RNCEKVNativeProps.h"
16
+ #import "RNCEKVFabricEventHelper.h"
17
+ #endif
18
+
19
+ @implementation RNCEKVViewContextMenuBase {
20
+ UIContextMenuInteraction *_contextMenuInteraction;
21
+ }
22
+
23
+ - (void)cleanReferences {
24
+ [super cleanReferences];
25
+ _enableContextMenu = false;
26
+ [self updateContextMenuRegistration];
27
+ }
28
+
29
+ - (void)setEnableContextMenu:(BOOL)enableContextMenu {
30
+ _enableContextMenu = enableContextMenu;
31
+ [self updateContextMenuRegistration];
32
+ }
33
+
34
+ - (void)updateContextMenuRegistration {
35
+ if (@available(iOS 13.0, *)) {
36
+ BOOL shouldRegister = _enableContextMenu &&
37
+ self.isKeyboardFocused;
38
+
39
+ if (shouldRegister && _contextMenuInteraction == nil) {
40
+ _contextMenuInteraction =
41
+ [[UIContextMenuInteraction alloc] initWithDelegate:self];
42
+ [self addInteraction:_contextMenuInteraction];
43
+ }
44
+
45
+ if (!shouldRegister && _contextMenuInteraction != nil) {
46
+ [self removeInteraction:_contextMenuInteraction];
47
+ _contextMenuInteraction = nil;
48
+ }
49
+ }
50
+ }
51
+
52
+ - (void)onFocusChangeHandler:(BOOL)isFocused {
53
+ [super onFocusChangeHandler: isFocused];
54
+ [self updateContextMenuRegistration];
55
+ }
56
+
57
+ - (UIContextMenuConfiguration *)contextMenuInteraction:
58
+ (UIContextMenuInteraction *)interaction
59
+ configurationForMenuAtLocation:(CGPoint)location
60
+ API_AVAILABLE(ios(13.0)) {
61
+ if (self.isKeyboardFocused) {
62
+ [self onContextMenuPressHandler];
63
+ [self onBubbledContextMenuPressHandler];
64
+ }
65
+
66
+ return nil;
67
+ }
68
+
69
+ - (void)onContextMenuPressHandler {}
70
+ - (void)onBubbledContextMenuPressHandler {}
71
+
72
+ #ifdef RCT_NEW_ARCH_ENABLED
73
+ - (void)updateContextMenuProps:(const RNCEKV::ContextMenuProps &)oldProps
74
+ newProps:(const RNCEKV::ContextMenuProps &)newProps {
75
+ if (oldProps.enableContextMenu != newProps.enableContextMenu) {
76
+ [self setEnableContextMenu: newProps.enableContextMenu];
77
+ [self updateContextMenuRegistration];
78
+ }
79
+ }
80
+
81
+ #endif
82
+
83
+
84
+ @end
@@ -0,0 +1,37 @@
1
+ //
2
+ // RNCEKVViewFocusChangeBase.h
3
+ // Pods
4
+ //
5
+ // Created by Artur Kalach on 09/04/2026.
6
+ //
7
+
8
+ #ifndef RNCEKVViewFocusChangeBase_h
9
+ #define RNCEKVViewFocusChangeBase_h
10
+
11
+ #import "RNCEKVViewGroupIdentifierBase.h"
12
+ #import "RNCEKVFocusDelegate.h"
13
+
14
+ #ifdef RCT_NEW_ARCH_ENABLED
15
+ #import "RNCEKVNativeProps.h"
16
+ #endif
17
+
18
+ @interface RNCEKVViewFocusChangeBase : RNCEKVViewGroupIdentifierBase<RNCEKVFocusProtocol>
19
+
20
+ @property BOOL canBeFocused;
21
+ @property BOOL hasOnFocusChanged;
22
+ @property (nonatomic, assign, readonly) BOOL isKeyboardFocused;
23
+
24
+
25
+ @property (nonatomic, strong, readonly) RNCEKVFocusDelegate* focusDelegate;
26
+
27
+ #ifdef RCT_NEW_ARCH_ENABLED
28
+ - (void)updateFocusProps:(const RNCEKV::FocusProps &)oldProps
29
+ newProps:(const RNCEKV::FocusProps &)newProps;
30
+ #endif
31
+
32
+ - (void)onFocusChangeHandler:(BOOL)isFocused;
33
+
34
+ @end
35
+
36
+
37
+ #endif /* RNCEKVViewFocusChangeBase_h */
@@ -0,0 +1,89 @@
1
+ //
2
+ // RNCEKVViewFocusChangeBase.m
3
+ // react-native-external-keyboard
4
+ //
5
+ // Created by Artur Kalach on 09/04/2026.
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+
10
+
11
+ #import "RNCEKVViewFocusChangeBase.h"
12
+
13
+ #ifdef RCT_NEW_ARCH_ENABLED
14
+ #import "RNCEKVNativeProps.h"
15
+ #import "RNCEKVFabricEventHelper.h"
16
+ #endif
17
+ //#import "RNCEKVFocusDelegate.h"
18
+
19
+ @implementation RNCEKVViewFocusChangeBase {
20
+ NSNumber* _isFocused;
21
+ }
22
+
23
+ - (BOOL)isGroup {
24
+ return false;
25
+ }
26
+
27
+ - (BOOL)isKeyboardFocused {
28
+ return [_isFocused isEqual:@YES];
29
+ }
30
+
31
+ - (instancetype)initWithFrame:(CGRect)frame {
32
+ if (self = [super initWithFrame:frame]) {
33
+ _focusDelegate = [[RNCEKVFocusDelegate alloc] initWithView:self];
34
+ _isFocused = nil;
35
+ }
36
+
37
+ return self;
38
+ }
39
+
40
+ - (void)cleanReferences {
41
+ [super cleanReferences];
42
+ _isFocused = nil;
43
+ _canBeFocused = false;
44
+ _hasOnFocusChanged = false;
45
+ }
46
+
47
+ - (UIView *)getFocusTargetView {
48
+ return [_focusDelegate getFocusingView];
49
+ }
50
+
51
+
52
+ - (BOOL)canBecomeFocused {
53
+ if (!_canBeFocused)
54
+ NO;
55
+ return [_focusDelegate canBecomeFocused];
56
+ }
57
+
58
+
59
+ - (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context
60
+ withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator {
61
+ _isFocused = [_focusDelegate isFocusChanged:context];
62
+
63
+ if ([self hasOnFocusChanged]) {
64
+ if (_isFocused != nil) {
65
+ [self onFocusChangeHandler:[_isFocused isEqual:@YES]];
66
+ }
67
+ }
68
+
69
+ [super didUpdateFocusInContext:context withAnimationCoordinator:coordinator];
70
+ }
71
+
72
+
73
+ #ifdef RCT_NEW_ARCH_ENABLED
74
+ - (void)updateFocusProps:(const RNCEKV::FocusProps &)oldProps
75
+ newProps:(const RNCEKV::FocusProps &)newProps {
76
+ if (_canBeFocused != newProps.canBeFocused) {
77
+ [self setCanBeFocused:newProps.canBeFocused];
78
+ }
79
+
80
+ if (_hasOnFocusChanged != newProps.hasOnFocusChanged) {
81
+ [self setHasOnFocusChanged:newProps.hasOnFocusChanged];
82
+ }
83
+ }
84
+
85
+ #endif
86
+
87
+ - (void)onFocusChangeHandler:(BOOL)isFocused {}
88
+
89
+ @end
@@ -0,0 +1,49 @@
1
+ //
2
+ // RNCEKVViewOrderGroupBase.h
3
+ // Pods
4
+ //
5
+ // Created by Artur Kalach on 07/04/2026.
6
+ //
7
+
8
+ #ifndef RNCEKVViewOrderGroupBase_h
9
+ #define RNCEKVViewOrderGroupBase_h
10
+
11
+ #import <UIKit/UIKit.h>
12
+ #import "RNCEKVViewGroupBase.h"
13
+ #import "RNCEKVFocusOrderProtocol.h"
14
+ #import "RNCEKVFocusSequenceDelegate.h"
15
+ #import "RNCEKVFocusLinkDelegate.h"
16
+ #import "RNCEKVKeyboardFocusableProtocol.h"
17
+
18
+ #ifdef RCT_NEW_ARCH_ENABLED
19
+ #include "RNCEKVNativeProps.h"
20
+ #endif
21
+
22
+ @interface RNCEKVViewOrderGroupBase : RNCEKVViewGroupBase <RNCEKVFocusOrderProtocol, RNCEKVKeyboardFocusableProtocol>
23
+
24
+ - (void)cleanReferences;
25
+
26
+ @property (nonatomic, strong) NSString* orderGroup;
27
+ @property (nonatomic, strong) NSNumber* lockFocus;
28
+ @property (nonatomic, strong) NSNumber* orderPosition;
29
+ @property (nonatomic, strong) NSString* orderLeft;
30
+ @property (nonatomic, strong) NSString* orderRight;
31
+ @property (nonatomic, strong) NSString* orderUp;
32
+ @property (nonatomic, strong) NSString* orderDown;
33
+ @property (nonatomic, strong) NSString* orderForward;
34
+ @property (nonatomic, strong) NSString* orderBackward;
35
+ @property (nonatomic, strong) NSString* orderLast;
36
+ @property (nonatomic, strong) NSString* orderFirst;
37
+ @property (nonatomic, strong) NSString* orderId;
38
+
39
+ @property (nonatomic, strong, readonly) RNCEKVFocusSequenceDelegate* sequenceDelegate;
40
+ @property (nonatomic, strong, readonly) RNCEKVFocusLinkDelegate* linkDelegate;
41
+
42
+ #ifdef RCT_NEW_ARCH_ENABLED
43
+ - (void)updateFocusOrderProps:(const RNCEKV::OrderProps &)oldProps
44
+ newProps:(const RNCEKV::OrderProps &)newProps;
45
+ #endif
46
+
47
+ @end
48
+
49
+ #endif /* RNCEKVViewOrderGroupBase_h */
@@ -0,0 +1,245 @@
1
+ //
2
+ // RNCEKVViewOrderGroupBase.m
3
+ // react-native-external-keyboard
4
+ //
5
+ // Created by Artur Kalach on 07/04/2026.
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+ #import "RNCEKVViewOrderGroupBase.h"
10
+ #import "RNCEKVOrderLinking.h"
11
+ #import "UIViewController+RNCEKVExternalKeyboard.h"
12
+ #import "UIView+React.h"
13
+ #import "RNCEKVPropHelper.h"
14
+
15
+ #ifdef RCT_NEW_ARCH_ENABLED
16
+ #include "RNCEKVNativeProps.h"
17
+ #import "RNCEKVPropHelper.h"
18
+ #endif
19
+
20
+ @interface RNCEKVViewOrderGroupBase ()
21
+ @property (nonatomic, strong, readwrite) RNCEKVFocusSequenceDelegate* sequenceDelegate;
22
+ @property (nonatomic, strong, readwrite) RNCEKVFocusLinkDelegate* linkDelegate;
23
+ @end
24
+
25
+ @implementation RNCEKVViewOrderGroupBase
26
+
27
+ - (instancetype)initWithFrame:(CGRect)frame
28
+ {
29
+ if (self = [super initWithFrame:frame]) {
30
+ _sequenceDelegate = [[RNCEKVFocusSequenceDelegate alloc] initWithView:self];
31
+ _linkDelegate = [[RNCEKVFocusLinkDelegate alloc] initWithView:self];
32
+ }
33
+ return self;
34
+ }
35
+
36
+ - (BOOL)getIsViewFocused:(UIFocusUpdateContext *)context {
37
+ return context.nextFocusedView == [self getStoredView];
38
+ }
39
+
40
+ - (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context
41
+ withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator {
42
+ [_linkDelegate setIsFocused:[self getIsViewFocused:context]];
43
+ [super didUpdateFocusInContext:context withAnimationCoordinator:coordinator];
44
+ }
45
+
46
+ - (void)focus {
47
+ UIViewController *controller = self.reactViewController;
48
+ BOOL isAttached = self.superview != nil && controller != nil;
49
+
50
+ if (isAttached) {
51
+ [controller rncekvFocusView:[self getStoredView]];
52
+ }
53
+ }
54
+
55
+ - (void)cleanReferences {
56
+ [super cleanReferences];
57
+ [_sequenceDelegate unlink];
58
+ [_linkDelegate unlink];
59
+
60
+ _orderGroup = nil;
61
+ _orderPosition = nil;
62
+ _orderLeft = nil;
63
+ _orderRight = nil;
64
+ _orderUp = nil;
65
+ _orderDown = nil;
66
+ _orderForward = nil;
67
+ _orderBackward = nil;
68
+ _orderLast = nil;
69
+ _orderFirst = nil;
70
+ _orderId = nil;
71
+ _lockFocus = nil;
72
+ }
73
+
74
+ - (UIView *)getFocusTargetView {
75
+ return [self getStoredView];
76
+ }
77
+
78
+ - (void)didMoveToWindow {
79
+ [super didMoveToWindow];
80
+ if (self.window) {
81
+ [_sequenceDelegate link];
82
+ [_linkDelegate link];
83
+ } else {
84
+ [_sequenceDelegate unlink];
85
+ [_linkDelegate unlink];
86
+ }
87
+ }
88
+
89
+ - (BOOL)shouldUpdateFocusInContext:(UIFocusUpdateContext *)context {
90
+ BOOL hasLinkConfig = _lockFocus != nil
91
+ || _orderId != nil
92
+ || _orderLeft != nil || _orderRight != nil
93
+ || _orderUp != nil || _orderDown != nil
94
+ || _orderForward != nil || _orderBackward != nil
95
+ || _orderFirst != nil || _orderLast != nil;
96
+
97
+ if (hasLinkConfig) {
98
+ NSNumber *linkResult = [_linkDelegate shouldUpdateFocusInContext:context];
99
+ if (linkResult != nil) return linkResult.boolValue;
100
+ }
101
+
102
+ BOOL hasSequenceConfig = _orderGroup != nil && _orderPosition != nil;
103
+
104
+ if (hasSequenceConfig) {
105
+ NSNumber *sequenceResult = [_sequenceDelegate shouldUpdateFocusInContext:context];
106
+ if (sequenceResult != nil) return sequenceResult.boolValue;
107
+ }
108
+
109
+ return [super shouldUpdateFocusInContext:context];
110
+ }
111
+
112
+ #ifdef RCT_NEW_ARCH_ENABLED
113
+ - (void)updateFocusOrderProps:(const RNCEKV::OrderProps &)oldViewProps
114
+ newProps:(const RNCEKV::OrderProps &)newViewProps {
115
+ NSNumber* lockFocus = [RNCEKVPropHelper unwrapIntValue: newViewProps.lockFocus];
116
+ if (![_lockFocus isEqual: lockFocus]) {
117
+ [self setLockFocus: lockFocus];
118
+ }
119
+
120
+ NSNumber* position = [RNCEKVPropHelper unwrapIntValue: newViewProps.orderIndex];
121
+ if (![_orderPosition isEqual: position]) {
122
+ [self setOrderPosition: position];
123
+ }
124
+
125
+ NSString* orderGroup = [RNCEKVPropHelper unwrapStringValue: newViewProps.orderGroup];
126
+ if (![_orderGroup isEqual: orderGroup]) {
127
+ [self setOrderGroup: orderGroup];
128
+ }
129
+
130
+ NSString* orderId = [RNCEKVPropHelper unwrapStringValue: newViewProps.orderId];
131
+ if (![_orderId isEqual: orderId]) {
132
+ [self setOrderId: orderId];
133
+ }
134
+
135
+ NSString* orderLeft = [RNCEKVPropHelper unwrapStringValue: newViewProps.orderLeft];
136
+ if (![_orderLeft isEqual: orderLeft]) {
137
+ [self setOrderLeft: orderLeft];
138
+ }
139
+
140
+ NSString* orderRight = [RNCEKVPropHelper unwrapStringValue: newViewProps.orderRight];
141
+ if (![_orderRight isEqual: orderRight]) {
142
+ [self setOrderRight: orderRight];
143
+ }
144
+
145
+ NSString* orderUp = [RNCEKVPropHelper unwrapStringValue: newViewProps.orderUp];
146
+ if (![_orderUp isEqual: orderUp]) {
147
+ [self setOrderUp: orderUp];
148
+ }
149
+
150
+ NSString* orderDown = [RNCEKVPropHelper unwrapStringValue: newViewProps.orderDown];
151
+ if (![_orderDown isEqual: orderDown]) {
152
+ [self setOrderDown: orderDown];
153
+ }
154
+
155
+ NSString* orderForward = [RNCEKVPropHelper unwrapStringValue: newViewProps.orderForward];
156
+ if (![_orderForward isEqual: orderForward]) {
157
+ [self setOrderForward: orderForward];
158
+ }
159
+
160
+ NSString* orderBackward = [RNCEKVPropHelper unwrapStringValue: newViewProps.orderBackward];
161
+ if (![_orderBackward isEqual: orderBackward]) {
162
+ [self setOrderBackward: orderBackward];
163
+ }
164
+
165
+ NSString* orderLast = [RNCEKVPropHelper unwrapStringValue: newViewProps.orderLast];
166
+ if (![_orderLast isEqual: orderLast]) {
167
+ [self setOrderLast: orderLast];
168
+ }
169
+
170
+ NSString* orderFirst = [RNCEKVPropHelper unwrapStringValue: newViewProps.orderFirst];
171
+ if (![_orderFirst isEqual: orderFirst]) {
172
+ [self setOrderFirst: orderFirst];
173
+ }
174
+ }
175
+ #endif
176
+
177
+ - (void)setLockFocus:(NSNumber *)lockFocus {
178
+ if ([_lockFocus isEqual:lockFocus]) return;
179
+ _lockFocus = lockFocus;
180
+ }
181
+
182
+ - (void)setOrderGroup:(NSString *)orderGroup {
183
+ if ([_orderGroup isEqual:orderGroup]) return;
184
+ [_sequenceDelegate updateOrderGroup:orderGroup];
185
+ _orderGroup = orderGroup;
186
+ }
187
+
188
+ - (void)setOrderPosition:(NSNumber *)position {
189
+ NSNumber *newPosition = [position intValue] == -1 ? nil : position;
190
+ if ([_orderPosition isEqual:newPosition]) return;
191
+ [_sequenceDelegate updatePosition:newPosition];
192
+ _orderPosition = newPosition;
193
+ }
194
+
195
+ - (void)setOrderId:(NSString *)orderId {
196
+ if ([_orderId isEqual:orderId]) return;
197
+ [_linkDelegate refreshId:_orderId next:orderId];
198
+ _orderId = orderId;
199
+ }
200
+
201
+ - (void)setOrderLeft:(NSString *)orderLeft {
202
+ if ([_orderLeft isEqual:orderLeft]) return;
203
+ [_linkDelegate refreshLeft:orderLeft];
204
+ _orderLeft = orderLeft;
205
+ }
206
+
207
+ - (void)setOrderRight:(NSString *)orderRight {
208
+ if ([_orderRight isEqual:orderRight]) return;
209
+ [_linkDelegate refreshRight:orderRight];
210
+ _orderRight = orderRight;
211
+ }
212
+
213
+ - (void)setOrderUp:(NSString *)orderUp {
214
+ if ([_orderUp isEqual:orderUp]) return;
215
+ [_linkDelegate refreshUp:orderUp];
216
+ _orderUp = orderUp;
217
+ }
218
+
219
+ - (void)setOrderDown:(NSString *)orderDown {
220
+ if ([_orderDown isEqual:orderDown]) return;
221
+ [_linkDelegate refreshDown:orderDown];
222
+ _orderDown = orderDown;
223
+ }
224
+
225
+ - (void)setOrderForward:(NSString *)orderForward {
226
+ if ([_orderForward isEqual:orderForward]) return;
227
+ _orderForward = orderForward;
228
+ }
229
+
230
+ - (void)setOrderBackward:(NSString *)orderBackward {
231
+ if ([_orderBackward isEqual:orderBackward]) return;
232
+ _orderBackward = orderBackward;
233
+ }
234
+
235
+ - (void)setOrderFirst:(NSString *)orderFirst {
236
+ if ([_orderFirst isEqual:orderFirst]) return;
237
+ _orderFirst = orderFirst;
238
+ }
239
+
240
+ - (void)setOrderLast:(NSString *)orderLast {
241
+ if ([_orderLast isEqual:orderLast]) return;
242
+ _orderLast = orderLast;
243
+ }
244
+
245
+ @end