react-native-external-keyboard 0.6.8 → 0.7.0
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/README.md +37 -129
- package/android/src/main/java/com/externalkeyboard/ExternalKeyboardViewPackage.java +2 -0
- package/android/src/main/java/com/externalkeyboard/helper/FocusHelper.java +70 -0
- package/android/src/main/java/com/externalkeyboard/views/ExternalKeyboardLockView/ExternalKeyboardLockView.java +115 -0
- package/android/src/main/java/com/externalkeyboard/views/ExternalKeyboardLockView/ExternalKeyboardLockViewManager.java +32 -0
- package/android/src/main/java/com/externalkeyboard/views/ExternalKeyboardLockView/LockService.java +44 -0
- package/android/src/newarch/ExternalKeyboardLockViewManagerSpec.java +8 -0
- package/android/src/oldarch/ExternalKeyboardLockViewManagerSpec.java +12 -0
- package/ios/Delegates/RNCEKVFocusOrderDelegate/RNCEKVFocusGuideDelegate/RNCEKVFocusGuideDelegate.h +36 -0
- package/ios/Delegates/RNCEKVFocusOrderDelegate/RNCEKVFocusGuideDelegate/RNCEKVFocusGuideDelegate.mm +150 -0
- package/ios/Delegates/RNCEKVFocusOrderDelegate/RNCEKVFocusOrderDelegate.h +14 -0
- package/ios/Delegates/RNCEKVFocusOrderDelegate/RNCEKVFocusOrderDelegate.mm +98 -349
- package/ios/Extensions/RCTTextInputComponentView+RNCEKVExternalKeyboard.h +1 -1
- package/ios/Extensions/RCTTextInputComponentView+RNCEKVExternalKeyboard.mm +11 -3
- package/ios/Extensions/UIViewController+RNCEKVExternalKeyboard.h +1 -1
- package/ios/Extensions/UIViewController+RNCEKVExternalKeyboard.mm +17 -17
- package/ios/Helpers/RNCEKVFocusGuideHelper/RNCEKVFocusGuideHelper.h +32 -0
- package/ios/Helpers/RNCEKVFocusGuideHelper/RNCEKVFocusGuideHelper.mm +81 -0
- package/ios/Helpers/RNCEKVSwizzlingHelper/RNCEKVSwizzlingHelper.h +16 -0
- package/ios/Helpers/RNCEKVSwizzlingHelper/RNCEKVSwizzlingHelper.mm +27 -0
- package/ios/Modules/RNCEKVExternalKeyboardModule.mm +3 -3
- package/ios/Services/RNCEKVFocusLinkObserver.h +7 -1
- package/ios/Services/RNCEKVFocusLinkObserver.mm +31 -6
- package/ios/Services/RNCEKVKeyboardOrderManager/RNCEKVKeyboardOrderManager.h +17 -0
- package/ios/Services/RNCEKVKeyboardOrderManager/RNCEKVKeyboardOrderManager.mm +15 -0
- package/ios/Services/{RNCEKVRelashioship.h → RNCEKVKeyboardOrderManager/RNCEKVOrderRelationship/RNCEKVOrderRelationship.h} +8 -7
- package/ios/Services/{RNCEKVRelashioship.mm → RNCEKVKeyboardOrderManager/RNCEKVOrderRelationship/RNCEKVOrderRelationship.mm} +36 -13
- package/ios/Services/RNCEKVOrderLinking.h +2 -7
- package/ios/Services/RNCEKVOrderLinking.mm +27 -64
- package/ios/Services/RNCEKVOrderSubscriber.h +4 -3
- package/ios/Services/RNCEKVOrderSubscriber.mm +2 -1
- package/ios/Views/RNCEKVExternalKeyboardLockView/RNCEKVExternalKeyboardLockView.h +38 -0
- package/ios/Views/RNCEKVExternalKeyboardLockView/RNCEKVExternalKeyboardLockView.mm +62 -0
- package/ios/Views/RNCEKVExternalKeyboardLockView/RNCEKVExternalKeyboardLockViewManager.h +14 -0
- package/ios/Views/RNCEKVExternalKeyboardLockView/RNCEKVExternalKeyboardLockViewManager.mm +25 -0
- package/ios/Views/RNCEKVExternalKeyboardView/RNCEKVExternalKeyboardView.mm +2 -2
- package/ios/Views/RNCEKVKeyboardFocusGroupView/RNCEKVKeyboardFocusGroup.mm +0 -1
- package/ios/Views/RNCEKVTextInputFocusWrapper/RNCEKVTextInputFocusWrapper.mm +1 -15
- package/lib/commonjs/components/KeyboardFocusLock/FocusFrame/FocusFrame.android.js +21 -0
- package/lib/commonjs/components/KeyboardFocusLock/FocusFrame/FocusFrame.android.js.map +1 -0
- package/lib/commonjs/components/KeyboardFocusLock/FocusFrame/FocusFrame.js +11 -0
- package/lib/commonjs/components/KeyboardFocusLock/FocusFrame/FocusFrame.js.map +1 -0
- package/lib/commonjs/components/KeyboardFocusLock/FocusTrap/FocusTrap.android.js +19 -0
- package/lib/commonjs/components/KeyboardFocusLock/FocusTrap/FocusTrap.android.js.map +1 -0
- package/lib/commonjs/components/KeyboardFocusLock/FocusTrap/FocusTrap.js +15 -0
- package/lib/commonjs/components/KeyboardFocusLock/FocusTrap/FocusTrap.js.map +1 -0
- package/lib/commonjs/components/KeyboardFocusLock/FocusTrap/FocusTrapMountWrapper.js +46 -0
- package/lib/commonjs/components/KeyboardFocusLock/FocusTrap/FocusTrapMountWrapper.js.map +1 -0
- package/lib/commonjs/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.android.js +21 -0
- package/lib/commonjs/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.android.js.map +1 -0
- package/lib/commonjs/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.js +9 -0
- package/lib/commonjs/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.js.map +1 -0
- package/lib/commonjs/context/FocusFrameProviderContext.js +28 -0
- package/lib/commonjs/context/FocusFrameProviderContext.js.map +1 -0
- package/lib/commonjs/index.js +7 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/nativeSpec/ExternalKeyboardLockViewNativeComponent.js +10 -0
- package/lib/commonjs/nativeSpec/ExternalKeyboardLockViewNativeComponent.js.map +1 -0
- package/lib/commonjs/types/KeyboardFocusLock.types.js +6 -0
- package/lib/commonjs/types/KeyboardFocusLock.types.js.map +1 -0
- package/lib/module/components/KeyboardFocusLock/FocusFrame/FocusFrame.android.js +14 -0
- package/lib/module/components/KeyboardFocusLock/FocusFrame/FocusFrame.android.js.map +1 -0
- package/lib/module/components/KeyboardFocusLock/FocusFrame/FocusFrame.js +4 -0
- package/lib/module/components/KeyboardFocusLock/FocusFrame/FocusFrame.js.map +1 -0
- package/lib/module/components/KeyboardFocusLock/FocusTrap/FocusTrap.android.js +12 -0
- package/lib/module/components/KeyboardFocusLock/FocusTrap/FocusTrap.android.js.map +1 -0
- package/lib/module/components/KeyboardFocusLock/FocusTrap/FocusTrap.js +8 -0
- package/lib/module/components/KeyboardFocusLock/FocusTrap/FocusTrap.js.map +1 -0
- package/lib/module/components/KeyboardFocusLock/FocusTrap/FocusTrapMountWrapper.js +39 -0
- package/lib/module/components/KeyboardFocusLock/FocusTrap/FocusTrapMountWrapper.js.map +1 -0
- package/lib/module/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.android.js +14 -0
- package/lib/module/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.android.js.map +1 -0
- package/lib/module/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.js +3 -0
- package/lib/module/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.js.map +1 -0
- package/lib/module/context/FocusFrameProviderContext.js +20 -0
- package/lib/module/context/FocusFrameProviderContext.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/nativeSpec/ExternalKeyboardLockViewNativeComponent.js +3 -0
- package/lib/module/nativeSpec/ExternalKeyboardLockViewNativeComponent.js.map +1 -0
- package/lib/module/types/KeyboardFocusLock.types.js +2 -0
- package/lib/module/types/KeyboardFocusLock.types.js.map +1 -0
- package/lib/typescript/src/components/KeyboardFocusLock/FocusFrame/FocusFrame.android.d.ts +4 -0
- package/lib/typescript/src/components/KeyboardFocusLock/FocusFrame/FocusFrame.android.d.ts.map +1 -0
- package/lib/typescript/src/components/KeyboardFocusLock/FocusFrame/FocusFrame.d.ts +3 -0
- package/lib/typescript/src/components/KeyboardFocusLock/FocusFrame/FocusFrame.d.ts.map +1 -0
- package/lib/typescript/src/components/KeyboardFocusLock/FocusTrap/FocusTrap.android.d.ts +4 -0
- package/lib/typescript/src/components/KeyboardFocusLock/FocusTrap/FocusTrap.android.d.ts.map +1 -0
- package/lib/typescript/src/components/KeyboardFocusLock/FocusTrap/FocusTrap.d.ts +3 -0
- package/lib/typescript/src/components/KeyboardFocusLock/FocusTrap/FocusTrap.d.ts.map +1 -0
- package/lib/typescript/src/components/KeyboardFocusLock/FocusTrap/FocusTrapMountWrapper.d.ts +3 -0
- package/lib/typescript/src/components/KeyboardFocusLock/FocusTrap/FocusTrapMountWrapper.d.ts.map +1 -0
- package/lib/typescript/src/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.android.d.ts +4 -0
- package/lib/typescript/src/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.android.d.ts.map +1 -0
- package/lib/typescript/src/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.d.ts +3 -0
- package/lib/typescript/src/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.d.ts.map +1 -0
- package/lib/typescript/src/components/Touchable/Pressable.d.ts +1 -1
- package/lib/typescript/src/context/FocusFrameProviderContext.d.ts +12 -0
- package/lib/typescript/src/context/FocusFrameProviderContext.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/nativeSpec/ExternalKeyboardLockViewNativeComponent.d.ts +9 -0
- package/lib/typescript/src/nativeSpec/ExternalKeyboardLockViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/types/KeyboardFocusLock.types.d.ts +6 -0
- package/lib/typescript/src/types/KeyboardFocusLock.types.d.ts.map +1 -0
- package/lib/typescript/src/utils/withKeyboardFocus.d.ts +1 -1
- package/package.json +4 -3
- package/src/components/KeyboardFocusLock/FocusFrame/FocusFrame.android.tsx +18 -0
- package/src/components/KeyboardFocusLock/FocusFrame/FocusFrame.tsx +8 -0
- package/src/components/KeyboardFocusLock/FocusTrap/FocusTrap.android.tsx +17 -0
- package/src/components/KeyboardFocusLock/FocusTrap/FocusTrap.tsx +9 -0
- package/src/components/KeyboardFocusLock/FocusTrap/FocusTrapMountWrapper.ts +40 -0
- package/src/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.android.tsx +16 -0
- package/src/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.tsx +5 -0
- package/src/context/FocusFrameProviderContext.tsx +36 -0
- package/src/index.tsx +8 -0
- package/src/nativeSpec/ExternalKeyboardLockViewNativeComponent.ts +13 -0
- package/src/types/KeyboardFocusLock.types.ts +6 -0
- package/ios/Services/RNCEKVFocusLinkObserverManager.h +0 -23
- package/ios/Services/RNCEKVFocusLinkObserverManager.mm +0 -30
- /package/ios/Services/{RNCEKVSortedMap.h → RNCEKVKeyboardOrderManager/RNCEKVOrderRelationship/RNCEKVSortedMap/RNCEKVSortedMap.h} +0 -0
- /package/ios/Services/{RNCEKVSortedMap.mm → RNCEKVKeyboardOrderManager/RNCEKVOrderRelationship/RNCEKVSortedMap/RNCEKVSortedMap.mm} +0 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNCEKVFocusGuideHelper.h
|
|
3
|
+
// Pods
|
|
4
|
+
//
|
|
5
|
+
// Created by Artur Kalach on 16/07/2025.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#ifndef RNCEKVFocusGuideHelper_h
|
|
9
|
+
#define RNCEKVFocusGuideHelper_h
|
|
10
|
+
|
|
11
|
+
#import <UIKit/UIKit.h>
|
|
12
|
+
typedef NS_ENUM(NSUInteger, RNCEKVFocusGuideDirection) {
|
|
13
|
+
RNCEKVFocusGuideDirectionLeft,
|
|
14
|
+
RNCEKVFocusGuideDirectionRight,
|
|
15
|
+
RNCEKVFocusGuideDirectionUp,
|
|
16
|
+
RNCEKVFocusGuideDirectionDown,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
@interface RNCEKVFocusGuideHelper : NSObject
|
|
20
|
+
|
|
21
|
+
+ (UIFocusGuide *)createGuideWithView:(UIView *)containerView
|
|
22
|
+
focusView:(UIView *)focusView
|
|
23
|
+
enabled:(BOOL)enabled;
|
|
24
|
+
|
|
25
|
+
+ (UIFocusGuide *)setGuideForDirection:(RNCEKVFocusGuideDirection)direction
|
|
26
|
+
inView:(UIView *)containerView
|
|
27
|
+
focusView:(UIView *)focusView
|
|
28
|
+
enabled:(BOOL)enabled;
|
|
29
|
+
|
|
30
|
+
@end
|
|
31
|
+
|
|
32
|
+
#endif /* RNCEKVFocusGuideHelper_h */
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNCEKVFocusGuideHelper.m
|
|
3
|
+
// react-native-external-keyboard
|
|
4
|
+
//
|
|
5
|
+
// Created by Artur Kalach on 16/07/2025.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
#import "RNCEKVFocusGuideHelper.h"
|
|
10
|
+
#import "RNCEKVFocusGuideHelper.h"
|
|
11
|
+
|
|
12
|
+
@implementation RNCEKVFocusGuideHelper
|
|
13
|
+
|
|
14
|
+
+ (UIFocusGuide *)createGuideWithView:(UIView *)containerView focusView:(UIView *)focusView enabled:(BOOL)enabled {
|
|
15
|
+
if (!containerView || !focusView) {
|
|
16
|
+
return nil;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
UIFocusGuide *guide = [[UIFocusGuide alloc] init];
|
|
20
|
+
[containerView addLayoutGuide:guide];
|
|
21
|
+
guide.preferredFocusEnvironments = @[focusView];
|
|
22
|
+
guide.enabled = enabled;
|
|
23
|
+
|
|
24
|
+
return guide;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
+ (UIFocusGuide *)setGuideForDirection:(RNCEKVFocusGuideDirection)direction
|
|
28
|
+
inView:(UIView *)containerView
|
|
29
|
+
focusView:(UIView *)focusView
|
|
30
|
+
enabled:(BOOL)enabled {
|
|
31
|
+
UIFocusGuide *guide = [self createGuideWithView:containerView focusView:focusView enabled:enabled];
|
|
32
|
+
if (!guide) {
|
|
33
|
+
return nil;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
NSArray<NSLayoutConstraint *> *constraints = nil;
|
|
37
|
+
switch (direction) {
|
|
38
|
+
case RNCEKVFocusGuideDirectionLeft:
|
|
39
|
+
constraints = @[
|
|
40
|
+
[guide.topAnchor constraintEqualToAnchor:containerView.topAnchor],
|
|
41
|
+
[guide.bottomAnchor constraintEqualToAnchor:containerView.bottomAnchor],
|
|
42
|
+
[guide.rightAnchor constraintEqualToAnchor:containerView.leftAnchor],
|
|
43
|
+
[guide.widthAnchor constraintEqualToConstant:1]
|
|
44
|
+
];
|
|
45
|
+
break;
|
|
46
|
+
case RNCEKVFocusGuideDirectionRight:
|
|
47
|
+
constraints = @[
|
|
48
|
+
[guide.topAnchor constraintEqualToAnchor:containerView.topAnchor],
|
|
49
|
+
[guide.bottomAnchor constraintEqualToAnchor:containerView.bottomAnchor],
|
|
50
|
+
[guide.leftAnchor constraintEqualToAnchor:containerView.rightAnchor],
|
|
51
|
+
[guide.widthAnchor constraintEqualToConstant:1]
|
|
52
|
+
];
|
|
53
|
+
break;
|
|
54
|
+
case RNCEKVFocusGuideDirectionUp:
|
|
55
|
+
constraints = @[
|
|
56
|
+
[guide.leftAnchor constraintEqualToAnchor:containerView.leftAnchor],
|
|
57
|
+
[guide.rightAnchor constraintEqualToAnchor:containerView.rightAnchor],
|
|
58
|
+
[guide.bottomAnchor constraintEqualToAnchor:containerView.topAnchor],
|
|
59
|
+
[guide.heightAnchor constraintEqualToConstant:1]
|
|
60
|
+
];
|
|
61
|
+
break;
|
|
62
|
+
case RNCEKVFocusGuideDirectionDown:
|
|
63
|
+
constraints = @[
|
|
64
|
+
[guide.leftAnchor constraintEqualToAnchor:containerView.leftAnchor],
|
|
65
|
+
[guide.rightAnchor constraintEqualToAnchor:containerView.rightAnchor],
|
|
66
|
+
[guide.topAnchor constraintEqualToAnchor:containerView.bottomAnchor],
|
|
67
|
+
[guide.heightAnchor constraintEqualToConstant:1]
|
|
68
|
+
];
|
|
69
|
+
break;
|
|
70
|
+
default:
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (constraints) {
|
|
75
|
+
[NSLayoutConstraint activateConstraints:constraints];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return guide;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNCEKVSwizzlingHelper.h
|
|
3
|
+
// Pods
|
|
4
|
+
//
|
|
5
|
+
// Created by Artur Kalach on 15/07/2025.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#ifndef RNCEKVSwizzlingHelper_h
|
|
9
|
+
#define RNCEKVSwizzlingHelper_h
|
|
10
|
+
|
|
11
|
+
#import <Foundation/Foundation.h>
|
|
12
|
+
#import <objc/runtime.h>
|
|
13
|
+
|
|
14
|
+
void RNCEKVSwizzleInstanceMethod(Class swizzleClass, SEL originalSelector, SEL swizzledSelector);
|
|
15
|
+
|
|
16
|
+
#endif /* RNCEKVSwizzlingHelper_h */
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNCEKVSwizzlingHelper.mm
|
|
3
|
+
// react-native-external-keyboard
|
|
4
|
+
//
|
|
5
|
+
// Created by Artur Kalach on 15/07/2025.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import <objc/runtime.h>
|
|
9
|
+
#import "RNCEKVSwizzlingHelper.h"
|
|
10
|
+
|
|
11
|
+
void RNCEKVSwizzleInstanceMethod(Class swizzleClass, SEL originalSelector, SEL swizzledSelector) {
|
|
12
|
+
Method originalMethod = class_getInstanceMethod(swizzleClass, originalSelector);
|
|
13
|
+
Method swizzledMethod = class_getInstanceMethod(swizzleClass, swizzledSelector);
|
|
14
|
+
BOOL didAddMethod = class_addMethod(swizzleClass,
|
|
15
|
+
originalSelector,
|
|
16
|
+
method_getImplementation(swizzledMethod),
|
|
17
|
+
method_getTypeEncoding(swizzledMethod));
|
|
18
|
+
|
|
19
|
+
if (didAddMethod) {
|
|
20
|
+
class_replaceMethod(swizzleClass,
|
|
21
|
+
swizzledSelector,
|
|
22
|
+
method_getImplementation(originalMethod),
|
|
23
|
+
method_getTypeEncoding(originalMethod));
|
|
24
|
+
} else {
|
|
25
|
+
method_exchangeImplementations(originalMethod, swizzledMethod);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -19,21 +19,21 @@ using namespace facebook::react;
|
|
|
19
19
|
|
|
20
20
|
+ (BOOL)requiresMainQueueSetup
|
|
21
21
|
{
|
|
22
|
-
|
|
22
|
+
return YES;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
RCT_EXPORT_MODULE(ExternalKeyboardModule);
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
RCT_EXPORT_METHOD(dismissKeyboard) {
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
33
33
|
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
34
34
|
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
35
35
|
{
|
|
36
|
-
|
|
36
|
+
return std::make_shared<facebook::react::NativeExternalKeyboardModuleSpecJSI>(params);
|
|
37
37
|
}
|
|
38
38
|
#endif
|
|
39
39
|
@end
|
|
@@ -11,10 +11,14 @@
|
|
|
11
11
|
|
|
12
12
|
@interface RNCEKVFocusLinkObserver : NSObject
|
|
13
13
|
|
|
14
|
+
@property (nonatomic, strong, readonly) RNCEKVFocusLinkObserver *focusLinkObserver;
|
|
15
|
+
|
|
16
|
+
+ (instancetype)sharedManager;
|
|
17
|
+
|
|
14
18
|
- (void)emitWithId:(NSString *)identifier link:(UIView *)link;
|
|
15
19
|
- (void)emitRemoveWithId:(NSString *)identifier;
|
|
16
20
|
|
|
17
|
-
- (
|
|
21
|
+
- (RNCEKVOrderSubscriber*)subscribe:(NSString *)identifier
|
|
18
22
|
onLinkUpdated:(LinkUpdatedCallback)onLinkUpdated
|
|
19
23
|
onLinkRemoved:(LinkRemovedCallback)onLinkRemoved;
|
|
20
24
|
|
|
@@ -22,6 +26,8 @@
|
|
|
22
26
|
onLinkUpdated:(LinkUpdatedCallback)onLinkUpdated
|
|
23
27
|
onLinkRemoved:(LinkRemovedCallback)onLinkRemoved;
|
|
24
28
|
|
|
29
|
+
- (void)unsubscribe:(RNCEKVOrderSubscriber *)subscriber;
|
|
30
|
+
|
|
25
31
|
@end
|
|
26
32
|
|
|
27
33
|
#endif /* RNCEKVFocusLinkObserver_h */
|
|
@@ -10,8 +10,17 @@
|
|
|
10
10
|
#import "RNCEKVOrderSubscriber.h"
|
|
11
11
|
|
|
12
12
|
@implementation RNCEKVFocusLinkObserver {
|
|
13
|
-
NSMutableDictionary<NSString *, UIView *> *_links;
|
|
14
|
-
NSMutableDictionary<NSString *, NSMutableArray<RNCEKVOrderSubscriber *> *> *_subscribers;
|
|
13
|
+
NSMutableDictionary<NSString *, UIView *> *_links;
|
|
14
|
+
NSMutableDictionary<NSString *, NSMutableArray<RNCEKVOrderSubscriber *> *> *_subscribers;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
+ (instancetype)sharedManager {
|
|
18
|
+
static RNCEKVFocusLinkObserver *sharedInstance = nil;
|
|
19
|
+
static dispatch_once_t onceToken;
|
|
20
|
+
dispatch_once(&onceToken, ^{
|
|
21
|
+
sharedInstance = [[self alloc] init];
|
|
22
|
+
});
|
|
23
|
+
return sharedInstance;
|
|
15
24
|
}
|
|
16
25
|
|
|
17
26
|
- (instancetype)init {
|
|
@@ -39,24 +48,26 @@
|
|
|
39
48
|
}
|
|
40
49
|
}
|
|
41
50
|
|
|
42
|
-
- (
|
|
51
|
+
- (RNCEKVOrderSubscriber* )subscribe:(NSString *)identifier
|
|
43
52
|
onLinkUpdated:(LinkUpdatedCallback)onLinkUpdated
|
|
44
53
|
onLinkRemoved:(LinkRemovedCallback)onLinkRemoved {
|
|
45
54
|
if (!identifier || (!onLinkUpdated && !onLinkRemoved)) {
|
|
46
|
-
return;
|
|
55
|
+
return nil;
|
|
47
56
|
}
|
|
48
57
|
|
|
49
58
|
if (!_subscribers[identifier]) {
|
|
50
59
|
_subscribers[identifier] = [NSMutableArray array];
|
|
51
60
|
}
|
|
52
61
|
|
|
53
|
-
RNCEKVOrderSubscriber *subscriber = [[RNCEKVOrderSubscriber alloc]
|
|
54
|
-
|
|
62
|
+
RNCEKVOrderSubscriber *subscriber = [[RNCEKVOrderSubscriber alloc] initWithId: identifier updatedCallback:onLinkUpdated
|
|
63
|
+
removedCallback:onLinkRemoved];
|
|
55
64
|
[_subscribers[identifier] addObject:subscriber];
|
|
56
65
|
|
|
57
66
|
if (onLinkUpdated && _links[identifier]) {
|
|
58
67
|
onLinkUpdated(_links[identifier]);
|
|
59
68
|
}
|
|
69
|
+
|
|
70
|
+
return subscriber;
|
|
60
71
|
}
|
|
61
72
|
|
|
62
73
|
- (void)unsubscribeWithId:(NSString *)identifier
|
|
@@ -78,6 +89,20 @@
|
|
|
78
89
|
}
|
|
79
90
|
}
|
|
80
91
|
|
|
92
|
+
- (void)unsubscribe:(RNCEKVOrderSubscriber *)subscriber {
|
|
93
|
+
if (!subscriber || !subscriber.identifier) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
NSMutableArray<RNCEKVOrderSubscriber *> *subscriberList = _subscribers[subscriber.identifier];
|
|
98
|
+
if (subscriberList) {
|
|
99
|
+
[subscriberList removeObject: subscriber];
|
|
100
|
+
if (subscriberList.count == 0) {
|
|
101
|
+
[_subscribers removeObjectForKey: subscriber.identifier];
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
81
106
|
#pragma mark - Private
|
|
82
107
|
|
|
83
108
|
- (void)emitLinkUpdatedForId:(NSString *)identifier link:(UIView *)link {
|
|
@@ -0,0 +1,17 @@
|
|
|
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 */
|
|
@@ -0,0 +1,15 @@
|
|
|
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,14 +1,14 @@
|
|
|
1
1
|
//
|
|
2
|
-
//
|
|
2
|
+
// RNCEKVOrderRelationship.h
|
|
3
3
|
//
|
|
4
4
|
// Created by Artur Kalach on 13/07/2024.
|
|
5
5
|
// Copyright © 2024 Facebook. All rights reserved.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
#ifndef
|
|
9
|
-
#define
|
|
8
|
+
#ifndef RNCEKVOrderRelationship_h
|
|
9
|
+
#define RNCEKVOrderRelationship_h
|
|
10
10
|
|
|
11
|
-
@interface
|
|
11
|
+
@interface RNCEKVOrderRelationship : NSObject
|
|
12
12
|
|
|
13
13
|
@property UIView* entry;
|
|
14
14
|
@property UIView* exit;
|
|
@@ -17,12 +17,13 @@
|
|
|
17
17
|
- (void)remove:(NSNumber*)position;
|
|
18
18
|
- (void)update:(NSNumber*)lastPosition withPosition:(NSNumber*)position withObject:(NSObject*)obj;
|
|
19
19
|
- (void)clear;
|
|
20
|
-
- (void)setContainer:(UIView*)view;
|
|
21
|
-
- (UIView*)getContainer;
|
|
22
20
|
- (NSArray*)getArray;
|
|
21
|
+
-(int)getItemIndex:(UIView*)element;
|
|
22
|
+
-(UIView*)getItem:(int)index;
|
|
23
23
|
-(BOOL)isEmpty;
|
|
24
|
+
-(int)count;
|
|
24
25
|
|
|
25
26
|
@end
|
|
26
27
|
|
|
27
28
|
|
|
28
|
-
#endif /*
|
|
29
|
+
#endif /* RNCEKVOrderRelationship_h */
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
//
|
|
2
|
-
//
|
|
2
|
+
// RNCEKVOrderRelationship.m
|
|
3
3
|
//
|
|
4
4
|
// Created by Artur Kalach on 13/07/2024.
|
|
5
5
|
// Copyright © 2024 Facebook. All rights reserved.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
8
|
#import <Foundation/Foundation.h>
|
|
9
|
-
#import "
|
|
9
|
+
#import "RNCEKVOrderRelationship.h"
|
|
10
10
|
#import "RNCEKVSortedMap.h"
|
|
11
11
|
|
|
12
|
-
@implementation
|
|
13
|
-
UIView *_container;
|
|
12
|
+
@implementation RNCEKVOrderRelationship {
|
|
14
13
|
RNCEKVSortedMap *_positions;
|
|
15
14
|
}
|
|
16
15
|
|
|
@@ -18,7 +17,6 @@
|
|
|
18
17
|
self = [super init];
|
|
19
18
|
if (self) {
|
|
20
19
|
_positions = [[RNCEKVSortedMap alloc] init];
|
|
21
|
-
_container = nil;
|
|
22
20
|
_entry = nil;
|
|
23
21
|
_exit = nil;
|
|
24
22
|
}
|
|
@@ -33,10 +31,6 @@
|
|
|
33
31
|
[_positions remove:position];
|
|
34
32
|
}
|
|
35
33
|
|
|
36
|
-
-(void)setContainer:(UIView*)view {
|
|
37
|
-
_container = view;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
34
|
- (void)update:(NSNumber*)lastPosition withPosition:(NSNumber*)position withObject:(NSObject*)obj {
|
|
41
35
|
[_positions update:lastPosition withPosition:position withObject:obj];
|
|
42
36
|
}
|
|
@@ -45,17 +39,46 @@
|
|
|
45
39
|
[_positions clear];
|
|
46
40
|
}
|
|
47
41
|
|
|
48
|
-
-
|
|
49
|
-
|
|
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++) {
|
|
50
|
+
UIView *orderElement = order[i];
|
|
51
|
+
if (orderElement.subviews[0] == element) { //ToDo focus element
|
|
52
|
+
resultIndex = i;
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return resultIndex;
|
|
50
58
|
}
|
|
51
59
|
|
|
52
|
-
-(UIView*)
|
|
53
|
-
return
|
|
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
|
+
|
|
67
|
+
return order[index];
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
- (NSArray*)getArray {
|
|
71
|
+
return [_positions getValues];
|
|
54
72
|
}
|
|
55
73
|
|
|
56
74
|
-(BOOL)isEmpty {
|
|
57
75
|
return [_positions isEmpty];
|
|
58
76
|
}
|
|
59
77
|
|
|
78
|
+
-(int)count {
|
|
79
|
+
NSArray* order = [_positions getValues];
|
|
80
|
+
return order.count;
|
|
81
|
+
}
|
|
82
|
+
|
|
60
83
|
|
|
61
84
|
@end
|
|
@@ -8,22 +8,17 @@
|
|
|
8
8
|
|
|
9
9
|
#ifndef RNCEKVOrderLinking_h
|
|
10
10
|
#define RNCEKVOrderLinking_h
|
|
11
|
-
|
|
12
|
-
#import "RNCEKVRelashioship.h"
|
|
11
|
+
#import "RNCEKVOrderRelationship.h"
|
|
13
12
|
|
|
14
13
|
@interface RNCEKVOrderLinking : NSObject
|
|
15
14
|
|
|
16
15
|
+ (instancetype)sharedInstance;
|
|
17
16
|
|
|
18
|
-
- (void)add:(NSString*)orderKey withEntry:(UIView*)entry;
|
|
19
|
-
- (void)add:(NSString*)orderKey withExit:(UIView*)exit;
|
|
20
17
|
- (void)add:(NSNumber*)position withOrderKey:(NSString*)orderKey withObject:(NSObject*)obj;
|
|
21
18
|
- (void)remove:(NSNumber*)position withOrderKey:(NSString*)orderKey;
|
|
22
|
-
- (void)setContainer:(NSString*)orderKey withView:(UIView*) view;
|
|
23
|
-
- (void)removeContainer:(NSString*)orderKey;
|
|
24
19
|
- (void)update:(NSNumber*)position lastPosition:(NSNumber*)_position withOrderKey:(NSString*)_orderKey withView:(UIView*) view;
|
|
25
20
|
- (void)updateOrderKey:(NSString*)prev next:(NSString*)next position:(NSNumber*)position withView:(UIView*)view;
|
|
26
|
-
- (
|
|
21
|
+
- (RNCEKVOrderRelationship*)getInfo:(NSString*)orderGroup;
|
|
27
22
|
- (void)storeOrderId:(NSString*)orderId withView:(UIView*) view;
|
|
28
23
|
- (UIView*)getOrderView:(NSString*)orderId;
|
|
29
24
|
- (void)cleanOrderId:(NSString*)orderId;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
#import <Foundation/Foundation.h>
|
|
10
10
|
#import "RNCEKVOrderLinking.h"
|
|
11
|
-
#import "
|
|
11
|
+
#import "RNCEKVOrderRelationship.h"
|
|
12
12
|
|
|
13
13
|
@implementation RNCEKVOrderLinking {
|
|
14
14
|
NSMutableDictionary *_relationships;
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
return sharedInstance;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
- (
|
|
28
|
-
|
|
29
|
-
return
|
|
27
|
+
- (RNCEKVOrderRelationship*)getInfo:(NSString*)orderGroup {
|
|
28
|
+
RNCEKVOrderRelationship* relationship = [_relationships objectForKey: orderGroup];
|
|
29
|
+
return relationship;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
- (id)init {
|
|
@@ -38,93 +38,56 @@
|
|
|
38
38
|
return self;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
- (void)add:(NSString*)orderKey withEntry:(UIView*)entry {
|
|
42
|
-
RNCEKVRelashioship* relashioship = [_relationships objectForKey: orderKey];
|
|
43
|
-
if(relashioship != nil) {
|
|
44
|
-
relashioship.entry = entry;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
- (void)add:(NSString*)orderKey withExit:(UIView*)exit {
|
|
49
|
-
RNCEKVRelashioship* relashioship = [_relationships objectForKey: orderKey];
|
|
50
|
-
if(relashioship != nil) {
|
|
51
|
-
relashioship.exit = exit;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
41
|
- (void)add:(NSNumber*)position withOrderKey:(NSString*)orderKey withObject:(NSObject*)obj {
|
|
56
|
-
|
|
57
|
-
if(
|
|
58
|
-
|
|
59
|
-
[_relationships setObject:
|
|
42
|
+
RNCEKVOrderRelationship* relationship = [_relationships objectForKey: orderKey];
|
|
43
|
+
if(relationship == nil) {
|
|
44
|
+
relationship = [[RNCEKVOrderRelationship alloc] init];
|
|
45
|
+
[_relationships setObject: relationship forKey:orderKey];
|
|
60
46
|
}
|
|
61
|
-
[
|
|
47
|
+
[relationship add:position withObject:obj];
|
|
62
48
|
}
|
|
63
49
|
|
|
64
50
|
-(void)remove:(NSNumber*)position withOrderKey:(NSString*)orderKey {
|
|
65
|
-
|
|
66
|
-
if(
|
|
67
|
-
[
|
|
68
|
-
if([
|
|
69
|
-
[
|
|
51
|
+
RNCEKVOrderRelationship* relationship = [_relationships objectForKey: orderKey];
|
|
52
|
+
if(relationship != nil) {
|
|
53
|
+
[relationship remove:position];
|
|
54
|
+
if([relationship isEmpty]) {
|
|
55
|
+
[relationship clear];
|
|
70
56
|
[_relationships removeObjectForKey: orderKey];
|
|
71
57
|
}
|
|
72
58
|
}
|
|
73
59
|
}
|
|
74
60
|
|
|
75
|
-
-(void)setContainer:(NSString*)orderKey withView:(UIView*) view {
|
|
76
|
-
RNCEKVRelashioship* relashioship = [_relationships objectForKey: orderKey];
|
|
77
|
-
if(relashioship != nil) {
|
|
78
|
-
[relashioship setContainer:view];
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
61
|
- (void)update:(NSNumber*)position lastPosition:(NSNumber*)lastPosition withOrderKey:(NSString*)orderKey withView:(UIView*) view {
|
|
83
|
-
|
|
84
|
-
if(
|
|
85
|
-
[
|
|
62
|
+
RNCEKVOrderRelationship* relationship = [_relationships objectForKey: orderKey];
|
|
63
|
+
if(relationship != nil) {
|
|
64
|
+
[relationship update:lastPosition withPosition:position withObject:view];
|
|
86
65
|
}
|
|
87
66
|
}
|
|
88
67
|
|
|
89
68
|
- (void)updateOrderKey:(NSString*)prev next:(NSString*)next position:(NSNumber*)position withView:(UIView*) view {
|
|
90
69
|
if(prev != nil) {
|
|
91
|
-
|
|
92
|
-
if(
|
|
93
|
-
[
|
|
70
|
+
RNCEKVOrderRelationship* relationship = [_relationships objectForKey: prev];
|
|
71
|
+
if(relationship != nil) {
|
|
72
|
+
[relationship remove: position];
|
|
94
73
|
}
|
|
95
74
|
|
|
96
|
-
if([
|
|
97
|
-
[
|
|
75
|
+
if([relationship isEmpty]) {
|
|
76
|
+
[relationship clear];
|
|
98
77
|
[_relationships removeObjectForKey: prev];
|
|
99
78
|
}
|
|
100
79
|
}
|
|
101
80
|
|
|
102
81
|
if(next != nil) {
|
|
103
|
-
|
|
104
|
-
if(
|
|
105
|
-
|
|
106
|
-
[_relationships setObject:
|
|
82
|
+
RNCEKVOrderRelationship* newRelationship = [_relationships objectForKey: next];
|
|
83
|
+
if(newRelationship == nil) {
|
|
84
|
+
newRelationship = [[RNCEKVOrderRelationship alloc] init];
|
|
85
|
+
[_relationships setObject: newRelationship forKey:next];
|
|
107
86
|
}
|
|
108
|
-
[
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
- (void)removeContainer:(NSString*)orderKey {
|
|
113
|
-
RNCEKVRelashioship* relashioship = [_relationships objectForKey: orderKey];
|
|
114
|
-
if(relashioship != nil) {
|
|
115
|
-
[_relationships removeObjectForKey:orderKey];
|
|
87
|
+
[newRelationship add:position withObject:view];
|
|
116
88
|
}
|
|
117
89
|
}
|
|
118
90
|
|
|
119
|
-
-(UIView*)getContainer:(NSString*)orderKey withView:(UIView*) view {
|
|
120
|
-
RNCEKVRelashioship* relashioship = [_relationships objectForKey: orderKey];
|
|
121
|
-
if(relashioship != nil) {
|
|
122
|
-
return [relashioship getContainer];
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return nil;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
91
|
- (void)storeOrderId:(NSString*)orderId withView:(UIView*) view {
|
|
129
92
|
[_weakMap setObject:view forKey:orderId];
|
|
130
93
|
}
|
|
@@ -13,10 +13,11 @@ typedef void (^LinkRemovedCallback)(void);
|
|
|
13
13
|
|
|
14
14
|
@interface RNCEKVOrderSubscriber : NSObject
|
|
15
15
|
|
|
16
|
-
@property (nonatomic, weak)
|
|
17
|
-
@property (nonatomic,
|
|
16
|
+
@property (nonatomic, weak) NSString* identifier;
|
|
17
|
+
@property (nonatomic, strong) LinkUpdatedCallback onLinkUpdated;
|
|
18
|
+
@property (nonatomic, strong) LinkRemovedCallback onLinkRemoved;
|
|
18
19
|
|
|
19
|
-
- (instancetype)
|
|
20
|
+
- (instancetype)initWithId:(NSString*)identifier updatedCallback:(LinkUpdatedCallback)onLinkUpdated
|
|
20
21
|
removedCallback:(LinkRemovedCallback)onLinkRemoved;
|
|
21
22
|
|
|
22
23
|
@end
|
|
@@ -10,10 +10,11 @@
|
|
|
10
10
|
|
|
11
11
|
@implementation RNCEKVOrderSubscriber
|
|
12
12
|
|
|
13
|
-
- (instancetype)
|
|
13
|
+
- (instancetype)initWithId:(NSString*)identifier updatedCallback:(LinkUpdatedCallback)onLinkUpdated
|
|
14
14
|
removedCallback:(LinkRemovedCallback)onLinkRemoved {
|
|
15
15
|
self = [super init];
|
|
16
16
|
if (self) {
|
|
17
|
+
_identifier = identifier;
|
|
17
18
|
_onLinkUpdated = onLinkUpdated;
|
|
18
19
|
_onLinkRemoved = onLinkRemoved;
|
|
19
20
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNCEKVExternalKeyboardLockView.h
|
|
3
|
+
// Pods
|
|
4
|
+
//
|
|
5
|
+
// Created by Artur Kalach on 27/01/2026.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#ifndef RNCEKVExternalKeyboardLockView_h
|
|
9
|
+
#define RNCEKVExternalKeyboardLockView_h
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
#import <UIKit/UIKit.h>
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
17
|
+
#import <React/RCTViewComponentView.h>
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
21
|
+
|
|
22
|
+
@interface RNCEKVExternalKeyboardLockView : RCTViewComponentView
|
|
23
|
+
@end
|
|
24
|
+
|
|
25
|
+
NS_ASSUME_NONNULL_END
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
#else /* RCT_NEW_ARCH_ENABLED */
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
#import <React/RCTView.h>
|
|
32
|
+
@interface RNCEKVExternalKeyboardLockView : RCTView
|
|
33
|
+
@end
|
|
34
|
+
|
|
35
|
+
#endif
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
#endif /* RNCEKVExternalKeyboardLockView_h */
|