react-native-external-keyboard 0.5.6 → 0.6.1-rc
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 +277 -14
- package/android/src/main/java/com/externalkeyboard/delegates/FocusOrderDelegate.java +213 -0
- package/android/src/main/java/com/externalkeyboard/helper/FocusHelper.java +44 -0
- package/android/src/main/java/com/externalkeyboard/helper/Linking/A11yOrderLinking.java +81 -0
- package/android/src/main/java/com/externalkeyboard/helper/Linking/LinkingQueue.java +94 -0
- package/android/src/main/java/com/externalkeyboard/helper/ReactNativeVersionChecker.java +24 -0
- package/android/src/main/java/com/externalkeyboard/services/FocusLinkObserver/FocusLinkObserver.java +131 -0
- package/android/src/main/java/com/externalkeyboard/services/FocusLinkObserver/FocusLinkObserverSingleton.java +20 -0
- package/android/src/main/java/com/externalkeyboard/views/ExternalKeyboardView/ExternalKeyboardView.java +144 -0
- package/android/src/main/java/com/externalkeyboard/views/ExternalKeyboardView/ExternalKeyboardViewManager.java +128 -8
- package/android/src/main/java/com/externalkeyboard/views/KeyboardFocusGroup/KeyboardFocusGroupManager.java +7 -3
- package/android/src/main/java/com/externalkeyboard/views/TextInputFocusWrapper/TextInputFocusWrapper.java +2 -13
- package/android/src/oldarch/ExternalKeyboardViewManagerSpec.java +25 -0
- package/android/src/oldarch/KeyboardFocusGroupManagerSpec.java +8 -1
- package/ios/Delegates/RNCEKVFocusOrderDelegate/RNCEKVFocusOrderDelegate.h +33 -0
- package/ios/Delegates/RNCEKVFocusOrderDelegate/RNCEKVFocusOrderDelegate.mm +577 -0
- package/ios/Delegates/RNCEKVFocusOrderDelegate/RNCEKVFocusOrderProtocol.h +34 -0
- package/ios/Delegates/RNCEKVGroupIdentifierDelegate/RNCEKVGroupIdentifierDelegate.h +1 -0
- package/ios/Delegates/RNCEKVGroupIdentifierDelegate/RNCEKVGroupIdentifierDelegate.mm +9 -0
- package/ios/Helpers/RNCEKVPropHelper/RNCEKVPropHelper.h +22 -0
- package/ios/Helpers/RNCEKVPropHelper/RNCEKVPropHelper.mm +48 -0
- package/ios/Services/RNCEKVFocusLinkObserver.h +27 -0
- package/ios/Services/RNCEKVFocusLinkObserver.mm +101 -0
- package/ios/Services/RNCEKVFocusLinkObserverManager.h +23 -0
- package/ios/Services/RNCEKVFocusLinkObserverManager.mm +30 -0
- package/ios/Services/RNCEKVOrderLinking.h +33 -0
- package/ios/Services/RNCEKVOrderLinking.mm +143 -0
- package/ios/Services/RNCEKVOrderSubscriber.h +24 -0
- package/ios/Services/RNCEKVOrderSubscriber.mm +23 -0
- package/ios/Services/RNCEKVRelashioship.h +28 -0
- package/ios/Services/RNCEKVRelashioship.mm +61 -0
- package/ios/Services/RNCEKVSortedMap.h +22 -0
- package/ios/Services/RNCEKVSortedMap.mm +112 -0
- package/ios/Views/RNCEKVExternalKeyboardView/RNCEKVExternalKeyboardView.h +34 -3
- package/ios/Views/RNCEKVExternalKeyboardView/RNCEKVExternalKeyboardView.mm +214 -54
- package/ios/Views/RNCEKVExternalKeyboardView/RNCEKVExternalKeyboardViewManager.h +9 -0
- package/ios/Views/RNCEKVExternalKeyboardView/RNCEKVExternalKeyboardViewManager.mm +80 -55
- package/ios/Views/RNCEKVKeyboardFocusGroupView/RNCEKVKeyboardFocusGroup.h +2 -0
- package/ios/Views/RNCEKVKeyboardFocusGroupView/RNCEKVKeyboardFocusGroup.mm +161 -3
- package/ios/Views/RNCEKVKeyboardFocusGroupView/RNCEKVKeyboardFocusGroupManager.mm +6 -0
- package/lib/commonjs/components/BaseKeyboardView/BaseKeyboardView.js +56 -3
- package/lib/commonjs/components/BaseKeyboardView/BaseKeyboardView.js.map +1 -1
- package/lib/commonjs/components/KeyboardFocusGroup/KeyboardFocusGroup.android.js +30 -0
- package/lib/commonjs/components/KeyboardFocusGroup/KeyboardFocusGroup.android.js.map +1 -0
- package/lib/commonjs/components/KeyboardFocusGroup/KeyboardFocusGroup.ios.js.map +1 -1
- package/lib/commonjs/components/KeyboardFocusGroup/KeyboardFocusGroup.js.map +1 -1
- package/lib/commonjs/context/OrderFocusContext.js +23 -0
- package/lib/commonjs/context/OrderFocusContext.js.map +1 -0
- package/lib/commonjs/index.js +19 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/nativeSpec/ExternalKeyboardViewNativeComponent.js.map +1 -1
- package/lib/commonjs/nativeSpec/KeyboardFocusGroupNativeComponent.js.map +1 -1
- package/lib/commonjs/types/BaseKeyboardView.js +12 -0
- package/lib/commonjs/types/BaseKeyboardView.js.map +1 -1
- package/lib/commonjs/utils/withKeyboardFocus.js +25 -1
- package/lib/commonjs/utils/withKeyboardFocus.js.map +1 -1
- package/lib/module/components/BaseKeyboardView/BaseKeyboardView.js +55 -2
- package/lib/module/components/BaseKeyboardView/BaseKeyboardView.js.map +1 -1
- package/lib/module/components/KeyboardFocusGroup/KeyboardFocusGroup.android.js +23 -0
- package/lib/module/components/KeyboardFocusGroup/KeyboardFocusGroup.android.js.map +1 -0
- package/lib/module/components/KeyboardFocusGroup/KeyboardFocusGroup.ios.js.map +1 -1
- package/lib/module/components/KeyboardFocusGroup/KeyboardFocusGroup.js.map +1 -1
- package/lib/module/context/OrderFocusContext.js +14 -0
- package/lib/module/context/OrderFocusContext.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/nativeSpec/ExternalKeyboardViewNativeComponent.js.map +1 -1
- package/lib/module/nativeSpec/KeyboardFocusGroupNativeComponent.js.map +1 -1
- package/lib/module/types/BaseKeyboardView.js +11 -1
- package/lib/module/types/BaseKeyboardView.js.map +1 -1
- package/lib/module/utils/withKeyboardFocus.js +25 -1
- package/lib/module/utils/withKeyboardFocus.js.map +1 -1
- package/lib/typescript/src/components/BaseKeyboardView/BaseKeyboardView.d.ts +1 -1
- package/lib/typescript/src/components/BaseKeyboardView/BaseKeyboardView.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardFocusGroup/KeyboardFocusGroup.android.d.ts +24 -0
- package/lib/typescript/src/components/KeyboardFocusGroup/KeyboardFocusGroup.android.d.ts.map +1 -0
- package/lib/typescript/src/components/KeyboardFocusGroup/KeyboardFocusGroup.d.ts +1 -0
- package/lib/typescript/src/components/KeyboardFocusGroup/KeyboardFocusGroup.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardFocusGroup/KeyboardFocusGroup.ios.d.ts +2 -0
- package/lib/typescript/src/components/KeyboardFocusGroup/KeyboardFocusGroup.ios.d.ts.map +1 -1
- package/lib/typescript/src/context/OrderFocusContext.d.ts +10 -0
- package/lib/typescript/src/context/OrderFocusContext.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/nativeSpec/ExternalKeyboardViewNativeComponent.d.ts +12 -0
- package/lib/typescript/src/nativeSpec/ExternalKeyboardViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/nativeSpec/KeyboardFocusGroupNativeComponent.d.ts +1 -0
- package/lib/typescript/src/nativeSpec/KeyboardFocusGroupNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/types/BaseKeyboardView.d.ts +24 -0
- package/lib/typescript/src/types/BaseKeyboardView.d.ts.map +1 -1
- package/lib/typescript/src/utils/withKeyboardFocus.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/BaseKeyboardView/BaseKeyboardView.tsx +77 -4
- package/src/components/KeyboardFocusGroup/KeyboardFocusGroup.android.tsx +39 -0
- package/src/components/KeyboardFocusGroup/KeyboardFocusGroup.ios.tsx +1 -0
- package/src/components/KeyboardFocusGroup/KeyboardFocusGroup.tsx +1 -0
- package/src/context/OrderFocusContext.tsx +25 -0
- package/src/index.tsx +5 -0
- package/src/nativeSpec/ExternalKeyboardViewNativeComponent.ts +12 -0
- package/src/nativeSpec/KeyboardFocusGroupNativeComponent.ts +1 -0
- package/src/types/BaseKeyboardView.ts +26 -0
- package/src/utils/withKeyboardFocus.tsx +24 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNCEKVFocusOrderProtocol.h
|
|
3
|
+
// Pods
|
|
4
|
+
//
|
|
5
|
+
// Created by Artur Kalach on 24/01/2025.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#ifndef RNCEKVFocusOrderProtocol_h
|
|
9
|
+
#define RNCEKVFocusOrderProtocol_h
|
|
10
|
+
|
|
11
|
+
#import <UIKit/UIKit.h>
|
|
12
|
+
|
|
13
|
+
@protocol RNCEKVFocusOrderProtocol <NSObject>
|
|
14
|
+
|
|
15
|
+
@property (nonatomic, strong) NSString* orderGroup;
|
|
16
|
+
@property NSNumber* lockFocus;
|
|
17
|
+
@property NSNumber* orderPosition;
|
|
18
|
+
@property (nonatomic, strong) NSString* orderLeft;
|
|
19
|
+
@property (nonatomic, strong) NSString* orderRight;
|
|
20
|
+
@property (nonatomic, strong) NSString* orderUp;
|
|
21
|
+
@property (nonatomic, strong) NSString* orderDown;
|
|
22
|
+
@property NSString* orderForward;
|
|
23
|
+
@property NSString* orderBackward;
|
|
24
|
+
@property NSString* orderLast;
|
|
25
|
+
@property NSString* orderFirst;
|
|
26
|
+
|
|
27
|
+
@property (nonatomic, strong) NSString* orderId;
|
|
28
|
+
|
|
29
|
+
- (UIViewController *)reactViewController;
|
|
30
|
+
- (UIView *)getFocusTargetView;
|
|
31
|
+
|
|
32
|
+
@end
|
|
33
|
+
|
|
34
|
+
#endif /* RNCEKVFocusOrderProtocol_h */
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNCEKVPropHelper.h
|
|
3
|
+
// Pods
|
|
4
|
+
//
|
|
5
|
+
// Created by Artur Kalach on 14/06/2025.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#ifndef RNCEKVPropHelper_h
|
|
9
|
+
#define RNCEKVPropHelper_h
|
|
10
|
+
|
|
11
|
+
#include <string>
|
|
12
|
+
|
|
13
|
+
@interface RNCEKVPropHelper : NSObject
|
|
14
|
+
|
|
15
|
+
+ (BOOL)isPropChanged:(NSString *)prop stringValue:(std::string)stringValue;
|
|
16
|
+
+ (BOOL)isPropChanged:(NSNumber *)prop intValue:(int)intValue;
|
|
17
|
+
+ (NSString*)unwrapStringValue:(std::string)stringValue;
|
|
18
|
+
+ (NSNumber*)unwrapIntValue:(int)intValue;
|
|
19
|
+
|
|
20
|
+
@end
|
|
21
|
+
|
|
22
|
+
#endif /* RNCEKVPropHelper_h */
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNCEKVPropHelper.m
|
|
3
|
+
// boost-boost_privacy
|
|
4
|
+
//
|
|
5
|
+
// Created by Artur Kalach on 14/06/2025.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
#import "RNCEKVPropHelper.h"
|
|
10
|
+
#include <string>
|
|
11
|
+
|
|
12
|
+
@implementation RNCEKVPropHelper
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
+ (BOOL)isPropChanged:(NSString *)prop stringValue:(std::string)stringValue {
|
|
16
|
+
NSString *value = stringValue.empty() ? @"" : [NSString stringWithUTF8String:stringValue.c_str()];
|
|
17
|
+
|
|
18
|
+
if(prop == nil && value.length == 0) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return (prop == nil || value.length == 0 || ![prop isEqualToString:value]);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
+ (BOOL)isPropChanged:(NSNumber *)prop intValue:(int)intValue {
|
|
26
|
+
if (prop == nil && intValue == -1) {
|
|
27
|
+
return NO;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return (prop == nil || intValue == -1 || prop.intValue != intValue);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
+ (NSString*)unwrapStringValue:(std::string)stringValue {
|
|
36
|
+
NSString *value = stringValue.empty() ? nil : [NSString stringWithUTF8String:stringValue.c_str()];
|
|
37
|
+
return value.length > 0 ? value : nil;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
+ (NSNumber*)unwrapIntValue:(int)intValue {
|
|
41
|
+
NSNumber* value = intValue == -1 ? nil : @(intValue);
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNCEKVFocusLinkObserver.h
|
|
3
|
+
// Pods
|
|
4
|
+
//
|
|
5
|
+
// Created by Artur Kalach on 26/06/2025.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#ifndef RNCEKVFocusLinkObserver_h
|
|
9
|
+
#define RNCEKVFocusLinkObserver_h
|
|
10
|
+
#import "RNCEKVOrderSubscriber.h"
|
|
11
|
+
|
|
12
|
+
@interface RNCEKVFocusLinkObserver : NSObject
|
|
13
|
+
|
|
14
|
+
- (void)emitWithId:(NSString *)identifier link:(UIView *)link;
|
|
15
|
+
- (void)emitRemoveWithId:(NSString *)identifier;
|
|
16
|
+
|
|
17
|
+
- (void)subscribeWithId:(NSString *)identifier
|
|
18
|
+
onLinkUpdated:(LinkUpdatedCallback)onLinkUpdated
|
|
19
|
+
onLinkRemoved:(LinkRemovedCallback)onLinkRemoved;
|
|
20
|
+
|
|
21
|
+
- (void)unsubscribeWithId:(NSString *)identifier
|
|
22
|
+
onLinkUpdated:(LinkUpdatedCallback)onLinkUpdated
|
|
23
|
+
onLinkRemoved:(LinkRemovedCallback)onLinkRemoved;
|
|
24
|
+
|
|
25
|
+
@end
|
|
26
|
+
|
|
27
|
+
#endif /* RNCEKVFocusLinkObserver_h */
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNCEKVFocusLinkObserver.m
|
|
3
|
+
// react-native-external-keyboard
|
|
4
|
+
//
|
|
5
|
+
// Created by Artur Kalach on 26/06/2025.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
#import "RNCEKVFocusLinkObserver.h"
|
|
10
|
+
#import "RNCEKVOrderSubscriber.h"
|
|
11
|
+
|
|
12
|
+
@implementation RNCEKVFocusLinkObserver {
|
|
13
|
+
NSMutableDictionary<NSString *, UIView *> *_links; // To store the links
|
|
14
|
+
NSMutableDictionary<NSString *, NSMutableArray<RNCEKVOrderSubscriber *> *> *_subscribers; // To store the subscribers
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
- (instancetype)init {
|
|
18
|
+
self = [super init];
|
|
19
|
+
if (self) {
|
|
20
|
+
_links = [NSMutableDictionary dictionary];
|
|
21
|
+
_subscribers = [NSMutableDictionary dictionary];
|
|
22
|
+
}
|
|
23
|
+
return self;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
- (void)emitWithId:(NSString *)identifier link:(UIView *)link {
|
|
27
|
+
if (!identifier || !link) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
[_links setObject:link forKey:identifier];
|
|
32
|
+
[self emitLinkUpdatedForId:identifier link:link];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
- (void)emitRemoveWithId:(NSString *)identifier {
|
|
36
|
+
if ([_links objectForKey:identifier]) {
|
|
37
|
+
[_links removeObjectForKey:identifier];
|
|
38
|
+
[self emitLinkRemovedForId:identifier];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
- (void)subscribeWithId:(NSString *)identifier
|
|
43
|
+
onLinkUpdated:(LinkUpdatedCallback)onLinkUpdated
|
|
44
|
+
onLinkRemoved:(LinkRemovedCallback)onLinkRemoved {
|
|
45
|
+
if (!identifier || (!onLinkUpdated && !onLinkRemoved)) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (!_subscribers[identifier]) {
|
|
50
|
+
_subscribers[identifier] = [NSMutableArray array];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
RNCEKVOrderSubscriber *subscriber = [[RNCEKVOrderSubscriber alloc] initWithUpdatedCallback:onLinkUpdated
|
|
54
|
+
removedCallback:onLinkRemoved];
|
|
55
|
+
[_subscribers[identifier] addObject:subscriber];
|
|
56
|
+
|
|
57
|
+
if (onLinkUpdated && _links[identifier]) {
|
|
58
|
+
onLinkUpdated(_links[identifier]);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
- (void)unsubscribeWithId:(NSString *)identifier
|
|
63
|
+
onLinkUpdated:(LinkUpdatedCallback)onLinkUpdated
|
|
64
|
+
onLinkRemoved:(LinkRemovedCallback)onLinkRemoved {
|
|
65
|
+
if (!identifier || (!onLinkUpdated && !onLinkRemoved)) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
NSMutableArray<RNCEKVOrderSubscriber *> *subscriberList = _subscribers[identifier];
|
|
70
|
+
if (subscriberList) {
|
|
71
|
+
[subscriberList filterUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(RNCEKVOrderSubscriber *subscriber, NSDictionary *bindings) {
|
|
72
|
+
return !(subscriber.onLinkUpdated == onLinkUpdated && subscriber.onLinkRemoved == onLinkRemoved);
|
|
73
|
+
}]];
|
|
74
|
+
|
|
75
|
+
if (subscriberList.count == 0) {
|
|
76
|
+
[_subscribers removeObjectForKey:identifier];
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
#pragma mark - Private
|
|
82
|
+
|
|
83
|
+
- (void)emitLinkUpdatedForId:(NSString *)identifier link:(UIView *)link {
|
|
84
|
+
NSArray<RNCEKVOrderSubscriber *> *subscriberList = [_subscribers[identifier] copy];
|
|
85
|
+
for (RNCEKVOrderSubscriber *subscriber in subscriberList) {
|
|
86
|
+
if (subscriber.onLinkUpdated) {
|
|
87
|
+
subscriber.onLinkUpdated(link);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
- (void)emitLinkRemovedForId:(NSString *)identifier {
|
|
93
|
+
NSArray<RNCEKVOrderSubscriber *> *subscriberList = [_subscribers[identifier] copy];
|
|
94
|
+
for (RNCEKVOrderSubscriber *subscriber in subscriberList) {
|
|
95
|
+
if (subscriber.onLinkRemoved) {
|
|
96
|
+
subscriber.onLinkRemoved();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNCEKVFocusLinkObserverManager.h
|
|
3
|
+
// Pods
|
|
4
|
+
//
|
|
5
|
+
// Created by Artur Kalach on 26/06/2025.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#ifndef RNCEKVFocusLinkObserverManager_h
|
|
9
|
+
#define RNCEKVFocusLinkObserverManager_h
|
|
10
|
+
|
|
11
|
+
#import <Foundation/Foundation.h>
|
|
12
|
+
#import "RNCEKVFocusLinkObserver.h"
|
|
13
|
+
|
|
14
|
+
@interface RNCEKVFocusLinkObserverManager : NSObject
|
|
15
|
+
|
|
16
|
+
@property (nonatomic, strong, readonly) RNCEKVFocusLinkObserver *focusLinkObserver;
|
|
17
|
+
|
|
18
|
+
+ (instancetype)sharedManager;
|
|
19
|
+
|
|
20
|
+
@end
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
#endif /* RNCEKVFocusLinkObserverManager_h */
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNCEKVFocusLinkObserverManager.m
|
|
3
|
+
// react-native-external-keyboard
|
|
4
|
+
//
|
|
5
|
+
// Created by Artur Kalach on 26/06/2025.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
#import "RNCEKVFocusLinkObserverManager.h"
|
|
10
|
+
|
|
11
|
+
@implementation RNCEKVFocusLinkObserverManager
|
|
12
|
+
|
|
13
|
+
+ (instancetype)sharedManager {
|
|
14
|
+
static RNCEKVFocusLinkObserverManager *sharedInstance = nil;
|
|
15
|
+
static dispatch_once_t onceToken;
|
|
16
|
+
dispatch_once(&onceToken, ^{
|
|
17
|
+
sharedInstance = [[self alloc] init];
|
|
18
|
+
});
|
|
19
|
+
return sharedInstance;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
- (instancetype)init {
|
|
23
|
+
self = [super init];
|
|
24
|
+
if (self) {
|
|
25
|
+
_focusLinkObserver = [[RNCEKVFocusLinkObserver alloc] init];
|
|
26
|
+
}
|
|
27
|
+
return self;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNCEKVOrderLinking.h
|
|
3
|
+
//
|
|
4
|
+
//
|
|
5
|
+
// Created by Artur Kalach on 13/07/2024.
|
|
6
|
+
// Copyright © 2024 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#ifndef RNCEKVOrderLinking_h
|
|
10
|
+
#define RNCEKVOrderLinking_h
|
|
11
|
+
|
|
12
|
+
#import "RNCEKVRelashioship.h"
|
|
13
|
+
|
|
14
|
+
@interface RNCEKVOrderLinking : NSObject
|
|
15
|
+
|
|
16
|
+
+ (instancetype)sharedInstance;
|
|
17
|
+
|
|
18
|
+
- (void)add:(NSString*)orderKey withEntry:(UIView*)entry;
|
|
19
|
+
- (void)add:(NSString*)orderKey withExit:(UIView*)exit;
|
|
20
|
+
- (void)add:(NSNumber*)position withOrderKey:(NSString*)orderKey withObject:(NSObject*)obj;
|
|
21
|
+
- (void)remove:(NSNumber*)position withOrderKey:(NSString*)orderKey;
|
|
22
|
+
- (void)setContainer:(NSString*)orderKey withView:(UIView*) view;
|
|
23
|
+
- (void)removeContainer:(NSString*)orderKey;
|
|
24
|
+
- (void)update:(NSNumber*)position lastPosition:(NSNumber*)_position withOrderKey:(NSString*)_orderKey withView:(UIView*) view;
|
|
25
|
+
- (void)updateOrderKey:(NSString*)prev next:(NSString*)next position:(NSNumber*)position withView:(UIView*)view;
|
|
26
|
+
- (RNCEKVRelashioship*)getInfo:(NSString*)orderGroup;
|
|
27
|
+
- (void)storeOrderId:(NSString*)orderId withView:(UIView*) view;
|
|
28
|
+
- (UIView*)getOrderView:(NSString*)orderId;
|
|
29
|
+
- (void)cleanOrderId:(NSString*)orderId;
|
|
30
|
+
|
|
31
|
+
@end
|
|
32
|
+
|
|
33
|
+
#endif /* RNCEKVOrderLinking_h */
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNCEKVOrderLinking.m
|
|
3
|
+
// A11yOrder
|
|
4
|
+
//
|
|
5
|
+
// Created by Artur Kalach on 13/07/2024.
|
|
6
|
+
// Copyright © 2024 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import <Foundation/Foundation.h>
|
|
10
|
+
#import "RNCEKVOrderLinking.h"
|
|
11
|
+
#import "RNCEKVRelashioship.h"
|
|
12
|
+
|
|
13
|
+
@implementation RNCEKVOrderLinking {
|
|
14
|
+
NSMutableDictionary *_relationships;
|
|
15
|
+
NSMapTable *_weakMap;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
+ (instancetype)sharedInstance {
|
|
19
|
+
static RNCEKVOrderLinking *sharedInstance = nil;
|
|
20
|
+
static dispatch_once_t onceToken;
|
|
21
|
+
dispatch_once(&onceToken, ^{
|
|
22
|
+
sharedInstance = [[self alloc] init];
|
|
23
|
+
});
|
|
24
|
+
return sharedInstance;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
- (RNCEKVRelashioship*)getInfo:(NSString*)orderGroup {
|
|
28
|
+
RNCEKVRelashioship* relashioship = [_relationships objectForKey: orderGroup];
|
|
29
|
+
return relashioship;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
- (id)init {
|
|
33
|
+
if (self = [super init]) {
|
|
34
|
+
_relationships = [NSMutableDictionary dictionary];
|
|
35
|
+
_weakMap = [NSMapTable strongToWeakObjectsMapTable];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return self;
|
|
39
|
+
}
|
|
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
|
+
- (void)add:(NSNumber*)position withOrderKey:(NSString*)orderKey withObject:(NSObject*)obj {
|
|
56
|
+
RNCEKVRelashioship* relashioship = [_relationships objectForKey: orderKey];
|
|
57
|
+
if(relashioship == nil) {
|
|
58
|
+
relashioship = [[RNCEKVRelashioship alloc] init];
|
|
59
|
+
[_relationships setObject: relashioship forKey:orderKey];
|
|
60
|
+
}
|
|
61
|
+
[relashioship add:position withObject:obj];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
-(void)remove:(NSNumber*)position withOrderKey:(NSString*)orderKey {
|
|
65
|
+
RNCEKVRelashioship* relashioship = [_relationships objectForKey: orderKey];
|
|
66
|
+
if(relashioship != nil) {
|
|
67
|
+
[relashioship remove:position];
|
|
68
|
+
if([relashioship isEmpty]) {
|
|
69
|
+
[relashioship clear];
|
|
70
|
+
[_relationships removeObjectForKey: orderKey];
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
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
|
+
- (void)update:(NSNumber*)position lastPosition:(NSNumber*)lastPosition withOrderKey:(NSString*)orderKey withView:(UIView*) view {
|
|
83
|
+
RNCEKVRelashioship* relashioship = [_relationships objectForKey: orderKey];
|
|
84
|
+
if(relashioship != nil) {
|
|
85
|
+
[relashioship update:lastPosition withPosition:position withObject:view];
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
- (void)updateOrderKey:(NSString*)prev next:(NSString*)next position:(NSNumber*)position withView:(UIView*) view {
|
|
90
|
+
if(prev != nil) {
|
|
91
|
+
RNCEKVRelashioship* relashioship = [_relationships objectForKey: prev];
|
|
92
|
+
if(relashioship != nil) {
|
|
93
|
+
[relashioship remove: position];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if([relashioship isEmpty]) {
|
|
97
|
+
[relashioship clear];
|
|
98
|
+
[_relationships removeObjectForKey: prev];
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if(next != nil) {
|
|
103
|
+
RNCEKVRelashioship* newRelashioship = [_relationships objectForKey: next];
|
|
104
|
+
if(newRelashioship == nil) {
|
|
105
|
+
newRelashioship = [[RNCEKVRelashioship alloc] init];
|
|
106
|
+
[_relationships setObject: newRelashioship forKey:next];
|
|
107
|
+
}
|
|
108
|
+
[newRelashioship add:position withObject:view];
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
- (void)removeContainer:(NSString*)orderKey {
|
|
113
|
+
RNCEKVRelashioship* relashioship = [_relationships objectForKey: orderKey];
|
|
114
|
+
if(relashioship != nil) {
|
|
115
|
+
[_relationships removeObjectForKey:orderKey];
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
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
|
+
- (void)storeOrderId:(NSString*)orderId withView:(UIView*) view {
|
|
129
|
+
[_weakMap setObject:view forKey:orderId];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
- (UIView*)getOrderView:(NSString*)orderId {
|
|
133
|
+
UIView *view = [_weakMap objectForKey:orderId];
|
|
134
|
+
return view;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
- (void)cleanOrderId:(NSString*)orderId {
|
|
138
|
+
[_weakMap removeObjectForKey:orderId];
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
@end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNCEKVOrderSubscriber.h
|
|
3
|
+
// Pods
|
|
4
|
+
//
|
|
5
|
+
// Created by Artur Kalach on 26/06/2025.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#ifndef RNCEKVOrderSubscriber_h
|
|
9
|
+
#define RNCEKVOrderSubscriber_h
|
|
10
|
+
|
|
11
|
+
typedef void (^LinkUpdatedCallback)(UIView *link);
|
|
12
|
+
typedef void (^LinkRemovedCallback)(void);
|
|
13
|
+
|
|
14
|
+
@interface RNCEKVOrderSubscriber : NSObject
|
|
15
|
+
|
|
16
|
+
@property (nonatomic, weak) LinkUpdatedCallback onLinkUpdated;
|
|
17
|
+
@property (nonatomic, weak) LinkRemovedCallback onLinkRemoved;
|
|
18
|
+
|
|
19
|
+
- (instancetype)initWithUpdatedCallback:(LinkUpdatedCallback)onLinkUpdated
|
|
20
|
+
removedCallback:(LinkRemovedCallback)onLinkRemoved;
|
|
21
|
+
|
|
22
|
+
@end
|
|
23
|
+
|
|
24
|
+
#endif /* RNCEKVOrderSubscriber_h */
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNCEKVOrderSubscriber.m
|
|
3
|
+
// react-native-external-keyboard
|
|
4
|
+
//
|
|
5
|
+
// Created by Artur Kalach on 26/06/2025.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
#import "RNCEKVOrderSubscriber.h"
|
|
10
|
+
|
|
11
|
+
@implementation RNCEKVOrderSubscriber
|
|
12
|
+
|
|
13
|
+
- (instancetype)initWithUpdatedCallback:(LinkUpdatedCallback)onLinkUpdated
|
|
14
|
+
removedCallback:(LinkRemovedCallback)onLinkRemoved {
|
|
15
|
+
self = [super init];
|
|
16
|
+
if (self) {
|
|
17
|
+
_onLinkUpdated = onLinkUpdated;
|
|
18
|
+
_onLinkRemoved = onLinkRemoved;
|
|
19
|
+
}
|
|
20
|
+
return self;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNCEKVRelashioship.h
|
|
3
|
+
//
|
|
4
|
+
// Created by Artur Kalach on 13/07/2024.
|
|
5
|
+
// Copyright © 2024 Facebook. All rights reserved.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#ifndef RNCEKVRelashioship_h
|
|
9
|
+
#define RNCEKVRelashioship_h
|
|
10
|
+
|
|
11
|
+
@interface RNCEKVRelashioship : NSObject
|
|
12
|
+
|
|
13
|
+
@property UIView* entry;
|
|
14
|
+
@property UIView* exit;
|
|
15
|
+
|
|
16
|
+
- (void)add:(NSNumber*)position withObject:(NSObject*)obj;
|
|
17
|
+
- (void)remove:(NSNumber*)position;
|
|
18
|
+
- (void)update:(NSNumber*)lastPosition withPosition:(NSNumber*)position withObject:(NSObject*)obj;
|
|
19
|
+
- (void)clear;
|
|
20
|
+
- (void)setContainer:(UIView*)view;
|
|
21
|
+
- (UIView*)getContainer;
|
|
22
|
+
- (NSArray*)getArray;
|
|
23
|
+
-(BOOL)isEmpty;
|
|
24
|
+
|
|
25
|
+
@end
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
#endif /* RNCEKVRelashioship_h */
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNCEKVRelashioship.m
|
|
3
|
+
//
|
|
4
|
+
// Created by Artur Kalach on 13/07/2024.
|
|
5
|
+
// Copyright © 2024 Facebook. All rights reserved.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
#import "RNCEKVRelashioship.h"
|
|
10
|
+
#import "RNCEKVSortedMap.h"
|
|
11
|
+
|
|
12
|
+
@implementation RNCEKVRelashioship {
|
|
13
|
+
UIView *_container;
|
|
14
|
+
RNCEKVSortedMap *_positions;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
- (instancetype)init {
|
|
18
|
+
self = [super init];
|
|
19
|
+
if (self) {
|
|
20
|
+
_positions = [[RNCEKVSortedMap alloc] init];
|
|
21
|
+
_container = nil;
|
|
22
|
+
_entry = nil;
|
|
23
|
+
_exit = nil;
|
|
24
|
+
}
|
|
25
|
+
return self;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
- (void)add:(NSNumber*)position withObject:(NSObject*)obj {
|
|
29
|
+
[_positions put:position withObject:obj];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
-(void)remove:(NSNumber*)position {
|
|
33
|
+
[_positions remove:position];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
-(void)setContainer:(UIView*)view {
|
|
37
|
+
_container = view;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
- (void)update:(NSNumber*)lastPosition withPosition:(NSNumber*)position withObject:(NSObject*)obj {
|
|
41
|
+
[_positions update:lastPosition withPosition:position withObject:obj];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
-(void)clear {
|
|
45
|
+
[_positions clear];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
- (NSArray*)getArray {
|
|
49
|
+
return [_positions getValues];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
-(UIView*)getContainer {
|
|
53
|
+
return _container;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
-(BOOL)isEmpty {
|
|
57
|
+
return [_positions isEmpty];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
@end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNCEKVSortedMap.h
|
|
3
|
+
// A11yOrder
|
|
4
|
+
//
|
|
5
|
+
// Created by Artur Kalach on 13/07/2024.
|
|
6
|
+
// Copyright © 2024 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#ifndef RNCEKVSortedMap_h
|
|
10
|
+
#define RNCEKVSortedMap_h
|
|
11
|
+
|
|
12
|
+
@interface RNCEKVSortedMap : NSObject
|
|
13
|
+
|
|
14
|
+
- (void)put:(NSNumber*)position withObject:(NSObject*)obj;
|
|
15
|
+
- (void)remove:(NSNumber*)position;
|
|
16
|
+
- (void)update:(NSNumber*)position withPosition:(NSNumber*)position withObject:(NSObject*)obj;
|
|
17
|
+
- (void)clear;
|
|
18
|
+
- (NSArray*)getValues;
|
|
19
|
+
- (BOOL)isEmpty;
|
|
20
|
+
@end
|
|
21
|
+
|
|
22
|
+
#endif /* RNCEKVSortedMap_h */
|