react-native-external-keyboard 0.6.5 → 0.6.6
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.
- package/ios/Delegates/RNCEKVHaloDelegate/RNCEKVHaloDelegate.mm +20 -5
- package/ios/Extensions/RCTViewComponentView+RNCEKVExternalKeyboard.h +1 -0
- package/ios/Extensions/RCTViewComponentView+RNCEKVExternalKeyboard.mm +19 -0
- package/ios/Views/RNCEKVExternalKeyboardView/RNCEKVExternalKeyboardView.mm +21 -5
- package/ios/Views/RNCEKVTextInputFocusWrapper/RNCEKVTextInputFocusWrapper.mm +11 -2
- package/package.json +1 -1
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
#import "RNCEKVFocusEffectUtility.h"
|
|
11
11
|
#import "RNCEKVHaloDelegate.h"
|
|
12
12
|
|
|
13
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
14
|
+
#import "RCTViewComponentView+RNCEKVExternalKeyboard.h"
|
|
15
|
+
#endif
|
|
16
|
+
|
|
13
17
|
@implementation RNCEKVHaloDelegate {
|
|
14
18
|
UIView<RNCEKVHaloProtocol> *_delegate;
|
|
15
19
|
UIFocusEffect *_focusEffect;
|
|
@@ -84,7 +88,7 @@
|
|
|
84
88
|
if ((_focusEffect == nil && _recycled) || (_focusEffect != nil && prevEffect != _focusEffect &&
|
|
85
89
|
focusingView.focusEffect != _focusEffect)) {
|
|
86
90
|
_recycled = false;
|
|
87
|
-
|
|
91
|
+
[self setFocusEffect: _focusEffect];
|
|
88
92
|
}
|
|
89
93
|
}
|
|
90
94
|
}
|
|
@@ -104,16 +108,27 @@
|
|
|
104
108
|
withExpandedX:_delegate.haloExpendX
|
|
105
109
|
withExpandedY:_delegate.haloExpendY
|
|
106
110
|
withCornerRadius:_delegate.haloCornerRadius];
|
|
107
|
-
|
|
108
|
-
focusingView.focusEffect = focusEffect;
|
|
111
|
+
[self setFocusEffect: focusEffect];
|
|
109
112
|
}
|
|
110
113
|
}
|
|
111
114
|
|
|
112
|
-
- (void)
|
|
115
|
+
- (void)setFocusEffect: (UIFocusEffect*) focusEffect {
|
|
113
116
|
UIView *focusingView = [_delegate getFocusTargetView];
|
|
114
117
|
if (@available(iOS 15.0, *)) {
|
|
115
|
-
|
|
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
|
|
116
127
|
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
- (void) clear {
|
|
131
|
+
[self setFocusEffect: nil];
|
|
117
132
|
_focusEffect = nil;
|
|
118
133
|
_recycled = true;
|
|
119
134
|
_prevBounds = CGRect();
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
#import <objc/runtime.h>
|
|
15
15
|
static const void *RNCEKVCustomGroupKey = &RNCEKVCustomGroupKey;
|
|
16
|
+
static const void *RNCEKVCustomFocusEffect = &RNCEKVCustomFocusEffect;
|
|
16
17
|
|
|
17
18
|
@implementation RCTViewComponentView (RNCEKVExternalKeyboard)
|
|
18
19
|
|
|
@@ -24,6 +25,14 @@ static const void *RNCEKVCustomGroupKey = &RNCEKVCustomGroupKey;
|
|
|
24
25
|
objc_setAssociatedObject(self, RNCEKVCustomGroupKey, rncekvCustomGroup, OBJC_ASSOCIATION_COPY_NONATOMIC);
|
|
25
26
|
}
|
|
26
27
|
|
|
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
|
+
|
|
27
36
|
- (NSString *)focusGroupIdentifier {
|
|
28
37
|
NSString* rncekv = [self rncekvCustomGroup];
|
|
29
38
|
if(rncekv) {
|
|
@@ -32,6 +41,16 @@ static const void *RNCEKVCustomGroupKey = &RNCEKVCustomGroupKey;
|
|
|
32
41
|
return [super focusGroupIdentifier];
|
|
33
42
|
}
|
|
34
43
|
|
|
44
|
+
|
|
45
|
+
- (UIFocusEffect*)focusEffect {
|
|
46
|
+
UIFocusEffect* rncekv = [self rncekvCustomFocusEffect];
|
|
47
|
+
if(rncekv) {
|
|
48
|
+
return rncekv;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return [super focusEffect];
|
|
52
|
+
}
|
|
53
|
+
|
|
35
54
|
@end
|
|
36
55
|
|
|
37
56
|
#endif
|
|
@@ -563,17 +563,33 @@ Class<RCTComponentViewProtocol> ExternalKeyboardViewCls(void) {
|
|
|
563
563
|
- (void)willRemoveSubview:(UIView *)subview {
|
|
564
564
|
[_gIdDelegate clearSubview: subview];
|
|
565
565
|
if (@available(iOS 15.0, *)) {
|
|
566
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
567
|
+
if([subview isKindOfClass: RCTViewComponentView.class]) {
|
|
568
|
+
((RCTViewComponentView*)subview).rncekvCustomFocusEffect = nil;
|
|
569
|
+
} else {
|
|
570
|
+
subview.focusEffect = nil;
|
|
571
|
+
}
|
|
572
|
+
#else
|
|
566
573
|
subview.focusEffect = nil;
|
|
574
|
+
#endif
|
|
567
575
|
}
|
|
568
|
-
|
|
576
|
+
|
|
569
577
|
[super willRemoveSubview:subview];
|
|
570
578
|
}
|
|
571
579
|
|
|
572
580
|
- (void)viewControllerChanged:(NSNotification *)notification {
|
|
573
|
-
UIViewController *viewController =
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
581
|
+
UIViewController *viewController = self.reactViewController;
|
|
582
|
+
UIViewController *shownController = notification.object;
|
|
583
|
+
if(viewController != shownController) return;
|
|
584
|
+
if (self.autoFocus) {
|
|
585
|
+
if(!_isAttachedToController) {
|
|
586
|
+
UIWindow *window = RCTKeyWindow();
|
|
587
|
+
if (window) {
|
|
588
|
+
[self updateFocus:window.rootViewController];
|
|
589
|
+
} else {
|
|
590
|
+
[self updateFocus:viewController];
|
|
591
|
+
}
|
|
592
|
+
}
|
|
577
593
|
}
|
|
578
594
|
}
|
|
579
595
|
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
#import <React/RCTConversions.h>
|
|
26
26
|
|
|
27
|
+
#import "RCTViewComponentView+RNCEKVExternalKeyboard.h"
|
|
27
28
|
#import "RCTFabricComponentsPlugins.h"
|
|
28
29
|
|
|
29
30
|
using namespace facebook::react;
|
|
@@ -264,12 +265,20 @@ Class<RCTComponentViewProtocol> TextInputFocusWrapperCls(void)
|
|
|
264
265
|
if (@available(iOS 15.0, *)) {
|
|
265
266
|
BOOL isTextInput = [self getIsTextInputView: view];
|
|
266
267
|
if(isTextInput) {
|
|
267
|
-
|
|
268
|
+
UIFocusEffect* focusEffect = [self isHaloHidden] ? [RNCEKVFocusEffectUtility emptyFocusEffect] : nil;
|
|
269
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
270
|
+
if([view.subviews[0] isKindOfClass: RCTViewComponentView.class]) {
|
|
271
|
+
((RCTViewComponentView*)view.subviews[0]).rncekvCustomFocusEffect = focusEffect;
|
|
272
|
+
} else {
|
|
273
|
+
view.subviews[0].focusEffect = focusEffect;
|
|
274
|
+
}
|
|
275
|
+
#else
|
|
276
|
+
view.subviews[0].focusEffect = focusEffect;
|
|
277
|
+
#endif
|
|
268
278
|
}
|
|
269
279
|
}
|
|
270
280
|
}
|
|
271
281
|
|
|
272
|
-
|
|
273
282
|
- (void)pressesBegan:(NSSet<UIPress *> *)presses
|
|
274
283
|
withEvent:(UIPressesEvent *)event {
|
|
275
284
|
if (@available(iOS 13.4, *)) {
|