react-native-external-keyboard 0.6.3 → 0.6.5
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/Extensions/RCTCustomScrollView+RNCEKVExternalKeyboard.mm +34 -0
- package/ios/Extensions/RCTEnhancedScrollView+RNCEKVExternalKeyboard.mm +19 -0
- package/ios/Extensions/RCTViewComponentView+RNCEKVExternalKeyboard.h +3 -0
- package/ios/Extensions/RCTViewComponentView+RNCEKVExternalKeyboard.mm +4 -1
- package/ios/Extensions/UIViewController+RNCEKVExternalKeyboard.mm +3 -23
- package/ios/Helpers/RNCEKVSwizzleInstanceMethod/RNCEKVSwizzleInstanceMethod.h +16 -0
- package/ios/Helpers/RNCEKVSwizzleInstanceMethod/RNCEKVSwizzleInstanceMethod.mm +26 -0
- package/package.json +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RCTCustomScrollView+RNCEKVExternalKeyboard.m
|
|
3
|
+
// react-native-external-keyboard
|
|
4
|
+
//
|
|
5
|
+
// Created by Artur Kalach on 12/08/2025.
|
|
6
|
+
//
|
|
7
|
+
#ifndef RCT_NEW_ARCH_ENABLED
|
|
8
|
+
|
|
9
|
+
#import "RCTScrollView.h"
|
|
10
|
+
#import "RNCEKVSwizzleInstanceMethod.h"
|
|
11
|
+
|
|
12
|
+
@implementation RCTScrollView (RNCEKVExternalKeyboard)
|
|
13
|
+
|
|
14
|
+
+ (void)load {
|
|
15
|
+
static dispatch_once_t onceToken;
|
|
16
|
+
dispatch_once(&onceToken, ^{
|
|
17
|
+
RNCEKVSwizzleInstanceMethod([self class], @selector(initWithEventDispatcher:), @selector(rncekvInitWithEventDispatcher:));
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
- (instancetype)rncekvInitWithEventDispatcher:(CGRect)frame {
|
|
22
|
+
RCTScrollView *rctView = [self rncekvInitWithEventDispatcher:frame];
|
|
23
|
+
|
|
24
|
+
if (@available(iOS 17.0, *)) {
|
|
25
|
+
rctView.scrollView.allowsKeyboardScrolling = YES;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return rctView;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@end
|
|
33
|
+
|
|
34
|
+
#endif
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
10
10
|
|
|
11
11
|
#import "RCTEnhancedScrollView.h"
|
|
12
|
+
#import "RNCEKVSwizzleInstanceMethod.h"
|
|
12
13
|
|
|
13
14
|
@implementation RCTEnhancedScrollView (RNCEKVExternalKeyboard)
|
|
14
15
|
|
|
@@ -19,6 +20,24 @@
|
|
|
19
20
|
return [super preferredFocusEnvironments];
|
|
20
21
|
}
|
|
21
22
|
|
|
23
|
+
+ (void)load {
|
|
24
|
+
static dispatch_once_t onceToken;
|
|
25
|
+
dispatch_once(&onceToken, ^{
|
|
26
|
+
RNCEKVSwizzleInstanceMethod([self class], @selector(initWithFrame:), @selector(rncekvInitWithFrame:));
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
- (instancetype)rncekvInitWithFrame:(CGRect)frame {
|
|
31
|
+
RCTEnhancedScrollView *scrollView = [self rncekvInitWithFrame:frame];
|
|
32
|
+
|
|
33
|
+
if (@available(iOS 17.0, *)) {
|
|
34
|
+
scrollView.allowsKeyboardScrolling = YES;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return scrollView;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
22
41
|
@end
|
|
23
42
|
|
|
24
43
|
#endif
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
#ifndef UIView_RNCEKVExternalKeyboard_h
|
|
9
9
|
#define UIView_RNCEKVExternalKeyboard_h
|
|
10
10
|
|
|
11
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
12
|
+
|
|
11
13
|
#import <React/RCTViewComponentView.h>
|
|
12
14
|
|
|
13
15
|
@interface RCTViewComponentView (RNCEKVExternalKeyboard)
|
|
@@ -16,5 +18,6 @@
|
|
|
16
18
|
|
|
17
19
|
@end
|
|
18
20
|
|
|
21
|
+
#endif
|
|
19
22
|
|
|
20
23
|
#endif /* UIView_RNCEKVExternalKeyboard_h */
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
// Created by Artur Kalach on 12/08/2025.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
9
|
+
|
|
8
10
|
#import <Foundation/Foundation.h>
|
|
9
11
|
|
|
10
12
|
#import "RCTViewComponentView+RNCEKVExternalKeyboard.h"
|
|
@@ -18,7 +20,6 @@ static const void *RNCEKVCustomGroupKey = &RNCEKVCustomGroupKey;
|
|
|
18
20
|
return objc_getAssociatedObject(self, RNCEKVCustomGroupKey);
|
|
19
21
|
}
|
|
20
22
|
|
|
21
|
-
// Setter for `rctekvCustomGroup`
|
|
22
23
|
- (void)setRncekvCustomGroup:(NSString *)rncekvCustomGroup {
|
|
23
24
|
objc_setAssociatedObject(self, RNCEKVCustomGroupKey, rncekvCustomGroup, OBJC_ASSOCIATION_COPY_NONATOMIC);
|
|
24
25
|
}
|
|
@@ -32,3 +33,5 @@ static const void *RNCEKVCustomGroupKey = &RNCEKVCustomGroupKey;
|
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
@end
|
|
36
|
+
|
|
37
|
+
#endif
|
|
@@ -8,27 +8,11 @@
|
|
|
8
8
|
#import <Foundation/Foundation.h>
|
|
9
9
|
|
|
10
10
|
#import "UIViewController+RNCEKVExternalKeyboard.h"
|
|
11
|
+
#import "RNCEKVSwizzleInstanceMethod.h"
|
|
11
12
|
#import <objc/runtime.h>
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
|
|
15
|
-
void SwizzleInstanceMethod(Class swizzleClass, SEL originalSelector, SEL swizzledSelector) {
|
|
16
|
-
Method originalMethod = class_getInstanceMethod(swizzleClass, originalSelector);
|
|
17
|
-
Method swizzledMethod = class_getInstanceMethod(swizzleClass, swizzledSelector);
|
|
18
|
-
BOOL didAddMethod = class_addMethod(swizzleClass,
|
|
19
|
-
originalSelector,
|
|
20
|
-
method_getImplementation(swizzledMethod),
|
|
21
|
-
method_getTypeEncoding(swizzledMethod));
|
|
22
|
-
|
|
23
|
-
if (didAddMethod) {
|
|
24
|
-
class_replaceMethod(swizzleClass,
|
|
25
|
-
swizzledSelector,
|
|
26
|
-
method_getImplementation(originalMethod),
|
|
27
|
-
method_getTypeEncoding(originalMethod));
|
|
28
|
-
} else {
|
|
29
|
-
method_exchangeImplementations(originalMethod, swizzledMethod);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
16
|
|
|
33
17
|
static char kCustomFocusViewKey;
|
|
34
18
|
|
|
@@ -47,12 +31,8 @@ static char kCustomFocusViewKey;
|
|
|
47
31
|
static dispatch_once_t once_token;
|
|
48
32
|
|
|
49
33
|
dispatch_once(&once_token, ^{
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
method_exchangeImplementations(
|
|
53
|
-
class_getInstanceMethod(self, @selector(preferredFocusEnvironments)),
|
|
54
|
-
class_getInstanceMethod(self, @selector(keyboardedPreferredFocusEnvironments))
|
|
55
|
-
);
|
|
34
|
+
RNCEKVSwizzleInstanceMethod([self class], @selector(viewDidAppear:), @selector(keyboardedViewDidAppear:));
|
|
35
|
+
RNCEKVSwizzleInstanceMethod([self class], @selector(preferredFocusEnvironments), @selector(keyboardedPreferredFocusEnvironments));
|
|
56
36
|
});
|
|
57
37
|
}
|
|
58
38
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNCEKVSwizzleInstanceMethod.h
|
|
3
|
+
// Pods
|
|
4
|
+
//
|
|
5
|
+
// Created by Artur Kalach on 12/08/2025.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#ifndef RNCEKVSwizzleInstanceMethod_h
|
|
9
|
+
#define RNCEKVSwizzleInstanceMethod_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 /* RNCEKVSwizzleInstanceMethod_h */
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNCEKVSwizzleInstanceMethod.m
|
|
3
|
+
// react-native-external-keyboard
|
|
4
|
+
//
|
|
5
|
+
// Created by Artur Kalach on 12/08/2025.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import "RNCEKVSwizzleInstanceMethod.h"
|
|
9
|
+
|
|
10
|
+
void RNCEKVSwizzleInstanceMethod(Class swizzleClass, SEL originalSelector, SEL swizzledSelector) {
|
|
11
|
+
Method originalMethod = class_getInstanceMethod(swizzleClass, originalSelector);
|
|
12
|
+
Method swizzledMethod = class_getInstanceMethod(swizzleClass, swizzledSelector);
|
|
13
|
+
BOOL didAddMethod = class_addMethod(swizzleClass,
|
|
14
|
+
originalSelector,
|
|
15
|
+
method_getImplementation(swizzledMethod),
|
|
16
|
+
method_getTypeEncoding(swizzledMethod));
|
|
17
|
+
|
|
18
|
+
if (didAddMethod) {
|
|
19
|
+
class_replaceMethod(swizzleClass,
|
|
20
|
+
swizzledSelector,
|
|
21
|
+
method_getImplementation(originalMethod),
|
|
22
|
+
method_getTypeEncoding(originalMethod));
|
|
23
|
+
} else {
|
|
24
|
+
method_exchangeImplementations(originalMethod, swizzledMethod);
|
|
25
|
+
}
|
|
26
|
+
}
|