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
@@ -16,125 +16,56 @@
16
16
 
17
17
  @implementation RNCEKVHaloDelegate {
18
18
  UIView<RNCEKVHaloProtocol> *_delegate;
19
- UIFocusEffect *_focusEffect;
20
- CGFloat _prevHaloExpendX;
21
- CGFloat _prevHaloExpendY;
22
- CGFloat _prevHaloCornerRadius;
19
+ UIFocusEffect *_currentEffect;
20
+ BOOL _isDirty;
23
21
  CGRect _prevBounds;
24
- BOOL _recycled;
25
22
  }
26
23
 
27
- - (instancetype _Nonnull)initWithView:
28
- (UIView<RNCEKVHaloProtocol> *_Nonnull)delegate {
24
+ - (instancetype _Nonnull)initWithView:(UIView<RNCEKVHaloProtocol> *_Nonnull)delegate {
29
25
  self = [super init];
30
26
  if (self) {
31
27
  _delegate = delegate;
32
- _focusEffect = nil;
33
- _prevBounds = CGRect();
34
- _prevHaloExpendX = 0;
35
- _prevHaloExpendY = 0;
36
- _prevHaloCornerRadius = 0;
37
- _recycled = true;
28
+ _currentEffect = nil;
29
+ _isDirty = YES;
30
+ _prevBounds = CGRectZero;
38
31
  }
39
32
  return self;
40
33
  }
41
34
 
42
- - (BOOL)isHaloHidden {
43
- NSNumber *isHaloActive = [_delegate isHaloActive];
44
- return [isHaloActive isEqual:@NO];
45
- }
46
-
47
- - (void)displayHalo:(BOOL)force {
48
- _focusEffect = nil;
49
- _recycled = true;
50
-
51
- [self displayHalo];
52
- }
53
-
54
- - (void)displayHalo {
55
- if (@available(iOS 15.0, *)) {
56
- UIView *focusingView = [_delegate getFocusTargetView];
57
- UIFocusEffect *prevEffect = _focusEffect;
58
-
59
- BOOL isHidden = [self isHaloHidden];
60
-
61
- if (isHidden) {
62
- _focusEffect = [RNCEKVFocusEffectUtility emptyFocusEffect];
63
- }
64
-
65
- BOOL hasHaloSettings = _delegate.haloExpendX || _delegate.haloExpendY ||
66
- _delegate.haloCornerRadius;
67
- BOOL isDifferentBounds =
68
- !CGRectEqualToRect(_prevBounds, focusingView.bounds);
69
- BOOL isDifferent = _prevHaloExpendX != _delegate.haloExpendX ||
70
- _prevHaloExpendY != _delegate.haloExpendY ||
71
- _prevHaloCornerRadius != _delegate.haloCornerRadius ||
72
- isDifferentBounds;
73
-
74
- // ToDo refactor for better halo setup RNCEKV-7, RNCEKV-8
75
- if (!isHidden && hasHaloSettings && isDifferent) {
76
- _prevHaloExpendX = _delegate.haloExpendX;
77
- _prevHaloExpendY = _delegate.haloExpendY;
78
- _prevHaloCornerRadius = _delegate.haloCornerRadius;
79
- _prevBounds = focusingView.bounds;
80
-
81
- _focusEffect =
82
- [RNCEKVFocusEffectUtility getFocusEffect:focusingView
83
- withExpandedX:_delegate.haloExpendX
84
- withExpandedY:_delegate.haloExpendY
85
- withCornerRadius:_delegate.haloCornerRadius];
86
- }
87
-
88
- if ((_focusEffect == nil && _recycled) || (_focusEffect != nil && prevEffect != _focusEffect &&
89
- focusingView.focusEffect != _focusEffect)) {
90
- _recycled = false;
91
- [self setFocusEffect: _focusEffect];
92
- }
35
+ - (UIFocusEffect *)focusEffect {
36
+ if (_delegate.isHaloHidden) {
37
+ return [RNCEKVFocusEffectUtility emptyFocusEffect];
93
38
  }
94
- }
95
39
 
96
- - (void)updateHalo {
97
- if ([self isHaloHidden])
98
- return;
99
- if (@available(iOS 15.0, *)) {
100
- BOOL shouldUpdate = _delegate.haloExpendX || _delegate.haloExpendY ||
101
- _delegate.haloCornerRadius;
102
- if (!shouldUpdate)
103
- return;
104
-
105
- UIView *focusingView = [_delegate getFocusTargetView];
106
- UIFocusEffect *focusEffect =
107
- [RNCEKVFocusEffectUtility getFocusEffect:focusingView
108
- withExpandedX:_delegate.haloExpendX
109
- withExpandedY:_delegate.haloExpendY
110
- withCornerRadius:_delegate.haloCornerRadius];
111
- [self setFocusEffect: focusEffect];
40
+ BOOL hasCustomSettings = _delegate.haloExpendX || _delegate.haloExpendY || _delegate.haloCornerRadius;
41
+ if (!hasCustomSettings) {
42
+ return nil;
112
43
  }
113
- }
114
44
 
115
- - (void)setFocusEffect: (UIFocusEffect*) focusEffect {
116
45
  UIView *focusingView = [_delegate getFocusTargetView];
117
- if (@available(iOS 15.0, *)) {
118
- #ifdef RCT_NEW_ARCH_ENABLED
119
- if([focusingView isKindOfClass: RCTViewComponentView.class]) {
120
- ((RCTViewComponentView*)focusingView).rncekvCustomFocusEffect = focusEffect;
121
- } else {
122
- focusingView.focusEffect = focusEffect;
123
- }
124
- #else
125
- focusingView.focusEffect = focusEffect;
126
- #endif
46
+ BOOL boundsChanged = !CGRectEqualToRect(_prevBounds, focusingView.bounds);
47
+
48
+ if (_isDirty || boundsChanged) {
49
+ _isDirty = NO;
50
+ _prevBounds = focusingView.bounds;
51
+
52
+ _currentEffect = [RNCEKVFocusEffectUtility getFocusEffect:focusingView
53
+ withExpandedX:_delegate.haloExpendX
54
+ withExpandedY:_delegate.haloExpendY
55
+ withCornerRadius:_delegate.haloCornerRadius];
127
56
  }
57
+
58
+ return _currentEffect;
59
+ }
60
+
61
+ - (void)invalidate {
62
+ _isDirty = YES;
128
63
  }
129
64
 
130
- - (void) clear {
131
- [self setFocusEffect: nil];
132
- _focusEffect = nil;
133
- _recycled = true;
134
- _prevBounds = CGRect();
135
- _prevHaloExpendX = 0;
136
- _prevHaloExpendY = 0;
137
- _prevHaloCornerRadius = 0;
65
+ - (void)clear {
66
+ _currentEffect = nil;
67
+ _isDirty = YES;
68
+ _prevBounds = CGRectZero;
138
69
  }
139
70
 
140
71
  @end
@@ -10,7 +10,7 @@
10
10
 
11
11
  @protocol RNCEKVHaloProtocol <NSObject>
12
12
 
13
- - (NSNumber *)isHaloActive;
13
+ - (BOOL)isHaloHidden;
14
14
  - (CGFloat) haloCornerRadius;
15
15
  - (CGFloat) haloExpendX;
16
16
  - (CGFloat) haloExpendY;
@@ -47,7 +47,7 @@
47
47
  return scrollView;
48
48
  }
49
49
 
50
-
51
50
  @end
52
51
 
52
+
53
53
  #endif
@@ -8,6 +8,9 @@
8
8
  #import "RCTTextInputComponentView+RNCEKVExternalKeyboard.h"
9
9
  #import <React/RCTBackedTextInputViewProtocol.h>
10
10
  #import <objc/runtime.h>
11
+ #import "RNCEKVCustomFocusEffectProtocol.h"
12
+ #import "RCTUITextField.h"
13
+ #import "RCTUITextView.h"
11
14
 
12
15
  @implementation RCTTextInputComponentView (RNCEKVExternalKeyboard)
13
16
 
@@ -26,5 +29,17 @@
26
29
 
27
30
  @end
28
31
 
32
+ @implementation RCTUITextField (RNCEKVExternalKeyboard)
33
+ - (UIFocusEffect*)focusEffect {
34
+ id superParent = self.superview.superview;
35
+ if (superParent != nil && [superParent conformsToProtocol:@protocol(RNCEKVCustomFocusEffectProtocol)]) {
36
+ id<RNCEKVCustomFocusEffectProtocol> parent = (id<RNCEKVCustomFocusEffectProtocol>)superParent;
37
+ return [parent customFocusEffect];
38
+ }
39
+
40
+ return [super focusEffect];
41
+ }
42
+ @end
43
+
29
44
  #endif
30
45
 
@@ -8,17 +8,20 @@
8
8
  #ifndef UIView_RNCEKVExternalKeyboard_h
9
9
  #define UIView_RNCEKVExternalKeyboard_h
10
10
 
11
- #ifdef RCT_NEW_ARCH_ENABLED
12
-
13
11
  #import <React/RCTViewComponentView.h>
14
12
 
15
- @interface RCTViewComponentView (RNCEKVExternalKeyboard)
13
+ #ifdef RCT_NEW_ARCH_ENABLED
14
+ #import <React/RCTViewComponentView.h>
15
+ #define RNCEKVViewClass RCTViewComponentView
16
+ #else
17
+ #import <React/RCTView.h>
18
+ #define RNCEKVViewClass RCTView
19
+ #endif
20
+
16
21
 
17
- @property (nonatomic, copy, nullable) NSString *rncekvCustomGroup;
18
- @property (nonatomic, copy, nullable) UIFocusEffect *rncekvCustomFocusEffect;
22
+ @interface RNCEKVViewClass (RNCEKVExternalKeyboard)
19
23
 
20
24
  @end
21
25
 
22
- #endif
23
26
 
24
27
  #endif /* UIView_RNCEKVExternalKeyboard_h */
@@ -5,47 +5,35 @@
5
5
  // Created by Artur Kalach on 12/08/2025.
6
6
  //
7
7
 
8
- #ifdef RCT_NEW_ARCH_ENABLED
9
8
 
10
9
  #import <Foundation/Foundation.h>
11
-
10
+ #import "RNCEKVCustomFocusEffectProtocol.h"
12
11
  #import "RCTViewComponentView+RNCEKVExternalKeyboard.h"
12
+ #import "RNCEKVCustomGroudIdProtocol.h"
13
13
 
14
- #import <objc/runtime.h>
15
- static const void *RNCEKVCustomGroupKey = &RNCEKVCustomGroupKey;
16
- static const void *RNCEKVCustomFocusEffect = &RNCEKVCustomFocusEffect;
17
-
18
- @implementation RCTViewComponentView (RNCEKVExternalKeyboard)
19
-
20
- - (NSString *)rncekvCustomGroup {
21
- return objc_getAssociatedObject(self, RNCEKVCustomGroupKey);
22
- }
23
-
24
- - (void)setRncekvCustomGroup:(NSString *)rncekvCustomGroup {
25
- objc_setAssociatedObject(self, RNCEKVCustomGroupKey, rncekvCustomGroup, OBJC_ASSOCIATION_COPY_NONATOMIC);
26
- }
14
+ @implementation RNCEKVViewClass (RNCEKVExternalKeyboard)
27
15
 
28
- - (NSString *)rncekvCustomFocusEffect {
29
- return objc_getAssociatedObject(self, RNCEKVCustomFocusEffect);
30
- }
31
-
32
- - (void)setRncekvCustomFocusEffect:(NSString *)rncekvCustomFocusEffect {
33
- objc_setAssociatedObject(self, RNCEKVCustomFocusEffect, rncekvCustomFocusEffect, OBJC_ASSOCIATION_COPY_NONATOMIC);
34
- }
35
16
 
36
17
  - (NSString *)focusGroupIdentifier {
37
- NSString* rncekv = [self rncekvCustomGroup];
38
- if(rncekv) {
39
- return rncekv;
18
+ if ([self.superview conformsToProtocol:@protocol(RNCEKVCustomGroudIdProtocol)]) {
19
+ id<RNCEKVCustomGroudIdProtocol> parent = (id<RNCEKVCustomGroudIdProtocol>)self.superview;
20
+ NSString* groupId = [parent customGroupIdentifier];
21
+ if(groupId != nil) {
22
+ return groupId;
23
+ }
40
24
  }
25
+
41
26
  return [super focusGroupIdentifier];
42
27
  }
43
28
 
44
29
 
45
30
  - (UIFocusEffect*)focusEffect {
46
- UIFocusEffect* rncekv = [self rncekvCustomFocusEffect];
47
- if(rncekv) {
48
- return rncekv;
31
+ if ([self.superview conformsToProtocol:@protocol(RNCEKVCustomFocusEffectProtocol)]) {
32
+ id<RNCEKVCustomFocusEffectProtocol> parent = (id<RNCEKVCustomFocusEffectProtocol>)self.superview;
33
+ UIFocusEffect* effect = [parent customFocusEffect];
34
+ if(effect != nil) {
35
+ return effect;
36
+ }
49
37
  }
50
38
 
51
39
  return [super focusEffect];
@@ -53,4 +41,3 @@ static const void *RNCEKVCustomFocusEffect = &RNCEKVCustomFocusEffect;
53
41
 
54
42
  @end
55
43
 
56
- #endif
@@ -12,6 +12,7 @@
12
12
 
13
13
  @interface UIViewController (RNCEKVExternalKeyboard)
14
14
  @property (nonatomic, strong) UIView *rncekvCustomFocusView;
15
+ - (void)rncekvFocusView:(UIView *)view;
15
16
  @end
16
17
 
17
18
  #endif /* UIViewController_RNCEKVExternalKeyboard_h */
@@ -41,6 +41,14 @@ static char kCustomFocusViewKey;
41
41
  [[NSNotificationCenter defaultCenter] postNotificationName:@"ViewControllerChangedNotification" object:self];
42
42
  }
43
43
 
44
+ - (void)rncekvFocusView:(UIView *)view {
45
+ self.rncekvCustomFocusView = view;
46
+ dispatch_async(dispatch_get_main_queue(), ^{
47
+ [self setNeedsFocusUpdate];
48
+ [self updateFocusIfNeeded];
49
+ });
50
+ }
51
+
44
52
  - (NSArray<id<UIFocusEnvironment>> *)keyboardedPreferredFocusEnvironments {
45
53
  NSArray<id<UIFocusEnvironment>> *originalEnvironments = [self keyboardedPreferredFocusEnvironments];
46
54
 
@@ -0,0 +1,123 @@
1
+ #pragma once
2
+
3
+ #include <string>
4
+
5
+ namespace RNCEKV {
6
+
7
+ struct OrderProps {
8
+ std::string orderGroup{};
9
+ int orderIndex{0};
10
+ int lockFocus{0};
11
+ std::string orderId{};
12
+ std::string orderLeft{};
13
+ std::string orderRight{};
14
+ std::string orderUp{};
15
+ std::string orderDown{};
16
+ std::string orderForward{};
17
+ std::string orderBackward{};
18
+ std::string orderFirst{};
19
+ std::string orderLast{};
20
+
21
+ template <typename T>
22
+ static OrderProps from(const T &props) {
23
+ return OrderProps{
24
+ props.orderGroup,
25
+ props.orderIndex,
26
+ props.lockFocus,
27
+ props.orderId,
28
+ props.orderLeft,
29
+ props.orderRight,
30
+ props.orderUp,
31
+ props.orderDown,
32
+ props.orderForward,
33
+ props.orderBackward,
34
+ props.orderFirst,
35
+ props.orderLast,
36
+ };
37
+ }
38
+ };
39
+
40
+
41
+
42
+ struct HaloProps {
43
+ bool haloEffect{true};
44
+ double haloExpendX{0};
45
+ double haloExpendY{0};
46
+ double haloCornerRadius{0};
47
+ facebook::react::SharedColor tintColor{};
48
+
49
+ template <typename T>
50
+ static HaloProps from(const T &props) {
51
+ return HaloProps{
52
+ props.haloEffect,
53
+ props.haloExpendX,
54
+ props.haloExpendY,
55
+ props.haloCornerRadius,
56
+ props.tintColor,
57
+ };
58
+ }
59
+ };
60
+
61
+ struct GroupIdentifierProps {
62
+ std::string groupIdentifier{};
63
+
64
+ template <typename T>
65
+ static GroupIdentifierProps from(const T &props) {
66
+ return GroupIdentifierProps{
67
+ props.groupIdentifier,
68
+ };
69
+ }
70
+ };
71
+
72
+ struct FocusProps {
73
+ bool canBeFocused{false};
74
+ bool hasOnFocusChanged{false};
75
+
76
+ template <typename T>
77
+ static FocusProps from(const T &props) {
78
+ return FocusProps{
79
+ props.canBeFocused,
80
+ props.hasOnFocusChanged
81
+ };
82
+ }
83
+ };
84
+
85
+
86
+ struct ContextMenuProps {
87
+ bool enableContextMenu{false};
88
+
89
+ template <typename T>
90
+ static ContextMenuProps from(const T &props) {
91
+ return ContextMenuProps{
92
+ props.enableContextMenu,
93
+ };
94
+ }
95
+ };
96
+
97
+ struct AutoFocusProps {
98
+ bool autoFocus{false};
99
+ bool enableA11yFocus{false};
100
+
101
+ template <typename T>
102
+ static AutoFocusProps from(const T &props) {
103
+ return AutoFocusProps{
104
+ props.autoFocus,
105
+ props.enableA11yFocus,
106
+ };
107
+ }
108
+ };
109
+
110
+ struct KeyPressProps {
111
+ bool hasKeyDownPress{false};
112
+ bool hasKeyUpPress{false};
113
+
114
+ template <typename T>
115
+ static KeyPressProps from(const T &props) {
116
+ return KeyPressProps{
117
+ props.hasKeyDownPress,
118
+ props.hasKeyUpPress,
119
+ };
120
+ }
121
+ };
122
+
123
+ } // namespace RNCEKV
@@ -0,0 +1,15 @@
1
+ //
2
+ // RNCEKVCustomFocusEffectProtocol.h
3
+ // Pods
4
+ //
5
+ // Created by Artur Kalach on 08/04/2026.
6
+ //
7
+
8
+ #ifndef RNCEKVCustomFocusEffectProtocol_h
9
+ #define RNCEKVCustomFocusEffectProtocol_h
10
+
11
+ @protocol RNCEKVCustomFocusEffectProtocol <NSObject>
12
+ - (UIFocusEffect*)customFocusEffect;
13
+ @end
14
+
15
+ #endif /* RNCEKVCustomFocusEffectProtocol_h */
@@ -0,0 +1,15 @@
1
+ //
2
+ // RNCEKVCustomGroudIdProtocol.h
3
+ // Pods
4
+ //
5
+ // Created by Artur Kalach on 09/04/2026.
6
+ //
7
+
8
+ #ifndef RNCEKVCustomGroudIdProtocol_h
9
+ #define RNCEKVCustomGroudIdProtocol_h
10
+
11
+ @protocol RNCEKVCustomGroudIdProtocol <NSObject>
12
+ - (NSString*)customGroupIdentifier;
13
+ @end
14
+
15
+ #endif /* RNCEKVCustomGroudIdProtocol_h */
@@ -0,0 +1,15 @@
1
+ //
2
+ // RNCEKVKeyboardFocusableProtocol.h
3
+ // react-native-external-keyboard
4
+ //
5
+
6
+ #ifndef RNCEKVKeyboardFocusableProtocol_h
7
+ #define RNCEKVKeyboardFocusableProtocol_h
8
+
9
+ #import <UIKit/UIKit.h>
10
+
11
+ @protocol RNCEKVKeyboardFocusableProtocol <NSObject>
12
+ - (void)focus;
13
+ @end
14
+
15
+ #endif /* RNCEKVKeyboardFocusableProtocol_h */
@@ -36,13 +36,12 @@
36
36
  if (!identifier || !link) {
37
37
  return;
38
38
  }
39
-
40
- [_links setObject:link forKey:identifier];
39
+ _links[identifier] = link;
41
40
  [self emitLinkUpdatedForId:identifier link:link];
42
41
  }
43
42
 
44
43
  - (void)emitRemoveWithId:(NSString *)identifier {
45
- if ([_links objectForKey:identifier]) {
44
+ if (_links[identifier]) {
46
45
  [_links removeObjectForKey:identifier];
47
46
  [self emitLinkRemovedForId:identifier];
48
47
  }
@@ -17,8 +17,6 @@
17
17
  self = [super init];
18
18
  if (self) {
19
19
  _positions = [[RNCEKVSortedMap alloc] init];
20
- _entry = nil;
21
- _exit = nil;
22
20
  }
23
21
  return self;
24
22
  }
@@ -39,45 +37,34 @@
39
37
  [_positions clear];
40
38
  }
41
39
 
42
- -(int)getItemIndex:(UIView*)element {
43
- int resultIndex = -1;
44
- if([self isEmpty]) {
45
- return resultIndex;
46
- }
47
-
48
- NSArray* order = [_positions getValues];
49
- for (int i = 0; i < order.count; i++) {
40
+ - (int)getItemIndex:(UIView *)element {
41
+ if (element == nil || ![element isKindOfClass:[UIView class]]) return -1;
42
+ NSArray *order = [_positions getValues];
43
+ for (int i = 0; i < (int)order.count; i++) {
50
44
  UIView *orderElement = order[i];
51
- if (orderElement.subviews[0] == element) { //ToDo focus element
52
- resultIndex = i;
53
- break;
45
+ if ([element isDescendantOfView:orderElement]) {
46
+ return i;
54
47
  }
55
48
  }
56
-
57
- return resultIndex;
49
+ return -1;
58
50
  }
59
51
 
60
- -(UIView*)getItem:(int)index {
61
- if([self isEmpty]) return nil;
62
-
63
- NSArray* order = [_positions getValues];
64
- BOOL inOrderRange = index >= 0 && index < order.count;
65
- if(!inOrderRange) return nil;
66
-
52
+ - (UIView *)getItem:(int)index {
53
+ NSArray *order = [_positions getValues];
54
+ if (index < 0 || index >= (int)order.count) return nil;
67
55
  return order[index];
68
- };
56
+ }
69
57
 
70
- - (NSArray*)getArray {
58
+ - (NSArray *)getArray {
71
59
  return [_positions getValues];
72
60
  }
73
61
 
74
- -(BOOL)isEmpty {
62
+ - (BOOL)isEmpty {
75
63
  return [_positions isEmpty];
76
64
  }
77
65
 
78
- -(int)count {
79
- NSArray* order = [_positions getValues];
80
- return order.count;
66
+ - (int)count {
67
+ return (int)[_positions getValues].count;
81
68
  }
82
69
 
83
70