react-native-keyboard-controller 1.21.0-beta.3 → 1.21.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.
- package/README.md +1 -0
- package/android/src/base/java/com/reactnativekeyboardcontroller/KeyboardControllerPackage.kt +1 -0
- package/android/src/fabric/java/com/reactnativekeyboardcontroller/ClippingScrollViewDecoratorViewManager.kt +7 -0
- package/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardControllerModule.kt +8 -0
- package/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardToolbarGroupViewManager.kt +23 -0
- package/android/src/main/java/com/reactnativekeyboardcontroller/extensions/ReactContext.kt +12 -0
- package/android/src/main/java/com/reactnativekeyboardcontroller/listeners/FocusedInputObserver.kt +2 -1
- package/android/src/main/java/com/reactnativekeyboardcontroller/listeners/WindowDimensionListener.kt +5 -1
- package/android/src/main/java/com/reactnativekeyboardcontroller/managers/KeyboardToolbarGroupViewManagerImpl.kt +13 -0
- package/android/src/main/java/com/reactnativekeyboardcontroller/modal/ModalAttachedWatcher.kt +4 -6
- package/android/src/main/java/com/reactnativekeyboardcontroller/modules/KeyboardControllerModuleImpl.kt +26 -0
- package/android/src/main/java/com/reactnativekeyboardcontroller/traversal/ViewHierarchyNavigator.kt +31 -4
- package/android/src/main/java/com/reactnativekeyboardcontroller/views/ClippingScrollViewDecoratorView.kt +5 -0
- package/android/src/main/java/com/reactnativekeyboardcontroller/views/KeyboardToolbarGroupReactViewGroup.kt +13 -0
- package/android/src/main/jni/RNKC.h +2 -0
- package/android/src/paper/java/com/reactnativekeyboardcontroller/ClippingScrollViewDecoratorViewManager.kt +8 -0
- package/android/src/paper/java/com/reactnativekeyboardcontroller/KeyboardControllerModule.kt +9 -0
- package/android/src/paper/java/com/reactnativekeyboardcontroller/KeyboardToolbarGroupViewManager.kt +15 -0
- package/android/src/turbo/java/com/reactnativekeyboardcontroller/KeyboardControllerPackage.kt +2 -0
- package/common/cpp/react/renderer/components/RNKC/RNKCClippingScrollViewDecoratorViewComponentDescriptor.h +27 -0
- package/common/cpp/react/renderer/components/RNKC/RNKCClippingScrollViewDecoratorViewShadowNode.cpp +14 -0
- package/common/cpp/react/renderer/components/RNKC/RNKCClippingScrollViewDecoratorViewShadowNode.h +30 -0
- package/common/cpp/react/renderer/components/RNKC/RNKCClippingScrollViewDecoratorViewState.h +28 -0
- package/common/cpp/react/renderer/components/RNKC/RNKCKeyboardToolbarGroupViewComponentDescriptor.h +20 -0
- package/common/cpp/react/renderer/components/RNKC/RNKCKeyboardToolbarGroupViewShadowNode.cpp +7 -0
- package/common/cpp/react/renderer/components/RNKC/RNKCKeyboardToolbarGroupViewShadowNode.h +23 -0
- package/common/cpp/react/renderer/components/RNKC/RNKCKeyboardToolbarGroupViewState.h +21 -0
- package/ios/KeyboardControllerModule.mm +36 -0
- package/ios/extensions/UIApplication.swift +1 -1
- package/ios/observers/FocusedInputObserver.swift +2 -1
- package/ios/traversal/ViewHierarchyNavigator.swift +49 -3
- package/ios/views/ClippingScrollViewDecoratorViewManager.h +26 -0
- package/ios/views/ClippingScrollViewDecoratorViewManager.mm +231 -0
- package/ios/views/KeyboardToolbarGroupViewManager.h +28 -0
- package/ios/views/KeyboardToolbarGroupViewManager.mm +88 -0
- package/jest/index.js +11 -1
- package/lib/commonjs/bindings.js +18 -2
- package/lib/commonjs/bindings.js.map +1 -1
- package/lib/commonjs/bindings.native.js +3 -4
- package/lib/commonjs/bindings.native.js.map +1 -1
- package/lib/commonjs/components/KeyboardAvoidingView/index.js +30 -4
- package/lib/commonjs/components/KeyboardAvoidingView/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js +17 -4
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardChatScrollView/index.js +33 -2
- package/lib/commonjs/components/KeyboardChatScrollView/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardChatScrollView/types.js.map +1 -1
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/helpers.js +107 -21
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/helpers.js.map +1 -1
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js +45 -17
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js.map +1 -1
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.js +61 -26
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/types.js.map +1 -1
- package/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js +72 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/index.js +1 -0
- package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -1
- package/lib/commonjs/components/ScrollViewWithBottomPadding/index.js +18 -6
- package/lib/commonjs/components/ScrollViewWithBottomPadding/index.js.map +1 -1
- package/lib/commonjs/specs/ClippingScrollViewDecoratorViewNativeComponent.js +1 -2
- package/lib/commonjs/specs/ClippingScrollViewDecoratorViewNativeComponent.js.map +1 -1
- package/lib/commonjs/specs/KeyboardToolbarGroupViewNativeComponent.js +12 -0
- package/lib/commonjs/specs/KeyboardToolbarGroupViewNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/NativeKeyboardController.js.map +1 -1
- package/lib/commonjs/types/module.js.map +1 -1
- package/lib/commonjs/types/views.js.map +1 -1
- package/lib/module/bindings.js +17 -1
- package/lib/module/bindings.js.map +1 -1
- package/lib/module/bindings.native.js +2 -3
- package/lib/module/bindings.native.js.map +1 -1
- package/lib/module/components/KeyboardAvoidingView/index.js +29 -4
- package/lib/module/components/KeyboardAvoidingView/index.js.map +1 -1
- package/lib/module/components/KeyboardAwareScrollView/index.js +17 -4
- package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -1
- package/lib/module/components/KeyboardChatScrollView/index.js +34 -3
- package/lib/module/components/KeyboardChatScrollView/index.js.map +1 -1
- package/lib/module/components/KeyboardChatScrollView/types.js.map +1 -1
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/helpers.js +98 -16
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/helpers.js.map +1 -1
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js +46 -18
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js.map +1 -1
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.js +62 -27
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.js.map +1 -1
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/types.js.map +1 -1
- package/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js +67 -0
- package/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/index.js +2 -1
- package/lib/module/components/KeyboardToolbar/index.js.map +1 -1
- package/lib/module/components/ScrollViewWithBottomPadding/index.js +19 -7
- package/lib/module/components/ScrollViewWithBottomPadding/index.js.map +1 -1
- package/lib/module/specs/ClippingScrollViewDecoratorViewNativeComponent.js +1 -2
- package/lib/module/specs/ClippingScrollViewDecoratorViewNativeComponent.js.map +1 -1
- package/lib/module/specs/KeyboardToolbarGroupViewNativeComponent.js +5 -0
- package/lib/module/specs/KeyboardToolbarGroupViewNativeComponent.js.map +1 -0
- package/lib/module/specs/NativeKeyboardController.js.map +1 -1
- package/lib/module/types/module.js.map +1 -1
- package/lib/module/types/views.js.map +1 -1
- package/lib/typescript/bindings.d.ts +12 -2
- package/lib/typescript/bindings.native.d.ts +2 -1
- package/lib/typescript/components/KeyboardAvoidingView/index.d.ts +44 -13
- package/lib/typescript/components/KeyboardChatScrollView/index.d.ts +3 -0
- package/lib/typescript/components/KeyboardChatScrollView/types.d.ts +41 -0
- package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/helpers.d.ts +63 -8
- package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/index.d.ts +1 -4
- package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/types.d.ts +15 -0
- package/lib/typescript/components/KeyboardChatScrollView/useExtraContentPadding/index.d.ts +43 -0
- package/lib/typescript/components/KeyboardToolbar/index.d.ts +2 -0
- package/lib/typescript/components/ScrollViewWithBottomPadding/index.d.ts +3 -0
- package/lib/typescript/specs/ClippingScrollViewDecoratorViewNativeComponent.d.ts +1 -0
- package/lib/typescript/specs/KeyboardToolbarGroupViewNativeComponent.d.ts +6 -0
- package/lib/typescript/specs/NativeKeyboardController.d.ts +1 -0
- package/lib/typescript/types/module.d.ts +7 -0
- package/lib/typescript/types/views.d.ts +2 -0
- package/package.json +6 -2
- package/react-native.config.js +2 -0
- package/src/bindings.native.ts +4 -4
- package/src/bindings.ts +15 -1
- package/src/components/KeyboardAvoidingView/index.tsx +56 -29
- package/src/components/KeyboardAwareScrollView/index.tsx +20 -5
- package/src/components/KeyboardChatScrollView/index.tsx +47 -3
- package/src/components/KeyboardChatScrollView/types.ts +41 -0
- package/src/components/KeyboardChatScrollView/useChatKeyboard/helpers.ts +126 -21
- package/src/components/KeyboardChatScrollView/useChatKeyboard/index.ios.ts +101 -21
- package/src/components/KeyboardChatScrollView/useChatKeyboard/index.ts +116 -40
- package/src/components/KeyboardChatScrollView/useChatKeyboard/types.ts +9 -0
- package/src/components/KeyboardChatScrollView/useExtraContentPadding/index.ts +123 -0
- package/src/components/KeyboardToolbar/index.tsx +6 -1
- package/src/components/ScrollViewWithBottomPadding/index.tsx +31 -4
- package/src/specs/ClippingScrollViewDecoratorViewNativeComponent.ts +1 -1
- package/src/specs/KeyboardToolbarGroupViewNativeComponent.ts +10 -0
- package/src/specs/NativeKeyboardController.ts +1 -0
- package/src/types/module.ts +9 -0
- package/src/types/views.ts +2 -0
- package/android/.settings/org.eclipse.buildship.core.prefs +0 -2
- package/ios/KeyboardController.xcodeproj/xcuserdata/kirylziusko.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
- package/ios/Tests/Tests.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/ios/Tests/Tests.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/Tests/Tests.xcodeproj/project.xcworkspace/xcuserdata/kirylziusko.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/Tests/Tests.xcodeproj/xcuserdata/kirylziusko.xcuserdatad/xcschemes/xcschememanagement.plist +0 -32
|
@@ -11,6 +11,8 @@ import UIKit
|
|
|
11
11
|
|
|
12
12
|
@objc(ViewHierarchyNavigator)
|
|
13
13
|
public class ViewHierarchyNavigator: NSObject {
|
|
14
|
+
private static let groupViewTypeName = "KeyboardToolbarGroupView"
|
|
15
|
+
|
|
14
16
|
@objc public static func setFocusTo(direction: String) {
|
|
15
17
|
DispatchQueue.main.async {
|
|
16
18
|
if direction == "current" {
|
|
@@ -30,30 +32,67 @@ public class ViewHierarchyNavigator: NSObject {
|
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
public static func getAllInputFields() -> [TextInput] {
|
|
35
|
+
return getAllInputFields(root: nil)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public static func getAllInputFields(root: UIView?) -> [TextInput] {
|
|
33
39
|
var textInputs = [TextInput]()
|
|
34
40
|
|
|
35
|
-
|
|
41
|
+
let rootView: UIView?
|
|
42
|
+
if let root = root {
|
|
43
|
+
rootView = root
|
|
44
|
+
} else {
|
|
45
|
+
rootView = UIApplication.topViewController()?.view
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
guard let rootView = rootView else {
|
|
36
49
|
return []
|
|
37
50
|
}
|
|
38
51
|
|
|
52
|
+
let isGroupRoot = isGroupView(rootView)
|
|
53
|
+
|
|
39
54
|
/// Helper function to recursively search for TextInput views
|
|
40
55
|
func findTextInputs(in view: UIView?) {
|
|
41
56
|
guard let view = view else { return }
|
|
42
57
|
|
|
43
58
|
if let textInput = isValidTextInput(view) {
|
|
44
59
|
textInputs.append(textInput)
|
|
45
|
-
} else {
|
|
60
|
+
} else if !isGroupView(view) {
|
|
46
61
|
for subview in view.subviews {
|
|
47
62
|
findTextInputs(in: subview)
|
|
48
63
|
}
|
|
49
64
|
}
|
|
50
65
|
}
|
|
51
66
|
|
|
52
|
-
|
|
67
|
+
if isGroupRoot {
|
|
68
|
+
// When root is a group, search its children directly
|
|
69
|
+
for subview in rootView.subviews {
|
|
70
|
+
findTextInputs(in: subview)
|
|
71
|
+
}
|
|
72
|
+
} else {
|
|
73
|
+
findTextInputs(in: rootView)
|
|
74
|
+
}
|
|
53
75
|
|
|
54
76
|
return textInputs
|
|
55
77
|
}
|
|
56
78
|
|
|
79
|
+
/// Finds the closest KeyboardToolbarGroupView ancestor of the given view.
|
|
80
|
+
/// Returns nil if the view is not inside any group.
|
|
81
|
+
public static func findGroupAncestor(_ view: UIView?) -> UIView? {
|
|
82
|
+
var current = view?.superview
|
|
83
|
+
while let parent = current {
|
|
84
|
+
if isGroupView(parent) {
|
|
85
|
+
return parent
|
|
86
|
+
}
|
|
87
|
+
current = parent.superview
|
|
88
|
+
}
|
|
89
|
+
return nil
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
private static func isGroupView(_ view: UIView) -> Bool {
|
|
93
|
+
return String(describing: type(of: view)) == groupViewTypeName
|
|
94
|
+
}
|
|
95
|
+
|
|
57
96
|
private static func findTextInputInDirection(currentFocus: UIView, direction: String) -> TextInput? {
|
|
58
97
|
// Find the parent view group
|
|
59
98
|
guard let parentViewGroup = currentFocus.superview else {
|
|
@@ -81,6 +120,11 @@ public class ViewHierarchyNavigator: NSObject {
|
|
|
81
120
|
}
|
|
82
121
|
}
|
|
83
122
|
|
|
123
|
+
// Don't navigate outside the group boundary
|
|
124
|
+
if isGroupView(parentViewGroup) {
|
|
125
|
+
return nil
|
|
126
|
+
}
|
|
127
|
+
|
|
84
128
|
// If no next or previous sibling was found in the parent, recurse to the parent's parent
|
|
85
129
|
return findTextInputInDirection(currentFocus: parentViewGroup, direction: direction)
|
|
86
130
|
}
|
|
@@ -91,6 +135,8 @@ public class ViewHierarchyNavigator: NSObject {
|
|
|
91
135
|
return validTextInput
|
|
92
136
|
}
|
|
93
137
|
|
|
138
|
+
guard !isGroupView(view) else { return nil }
|
|
139
|
+
|
|
94
140
|
// Determine the iteration order based on the direction
|
|
95
141
|
let subviews = direction == "next" ? view.subviews : view.subviews.reversed()
|
|
96
142
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//
|
|
2
|
+
// ClippingScrollViewDecoratorViewManager.h
|
|
3
|
+
// Pods
|
|
4
|
+
//
|
|
5
|
+
// Created by Kiryl Ziusko on 03/03/2025.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
9
|
+
#import <React/RCTViewComponentView.h>
|
|
10
|
+
#else
|
|
11
|
+
#import <React/RCTView.h>
|
|
12
|
+
#endif
|
|
13
|
+
#import <React/RCTViewManager.h>
|
|
14
|
+
#import <UIKit/UIKit.h>
|
|
15
|
+
|
|
16
|
+
@interface ClippingScrollViewDecoratorViewManager : RCTViewManager
|
|
17
|
+
@end
|
|
18
|
+
|
|
19
|
+
@interface ClippingScrollViewDecoratorView :
|
|
20
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
21
|
+
RCTViewComponentView
|
|
22
|
+
#else
|
|
23
|
+
UIView
|
|
24
|
+
#endif
|
|
25
|
+
@property (nonatomic, assign) BOOL applyWorkaroundForContentInsetHitTestBug;
|
|
26
|
+
@end
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
//
|
|
2
|
+
// ClippingScrollViewDecoratorViewManager.mm
|
|
3
|
+
// Pods
|
|
4
|
+
//
|
|
5
|
+
// Created by Kiryl Ziusko on 03/03/2025.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import "ClippingScrollViewDecoratorViewManager.h"
|
|
9
|
+
|
|
10
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
11
|
+
#import <react/renderer/components/RNKC/EventEmitters.h>
|
|
12
|
+
#import <react/renderer/components/RNKC/Props.h>
|
|
13
|
+
#import <react/renderer/components/RNKC/RCTComponentViewHelpers.h>
|
|
14
|
+
#import <react/renderer/components/RNKC/RNKCClippingScrollViewDecoratorViewComponentDescriptor.h>
|
|
15
|
+
|
|
16
|
+
#import "RCTFabricComponentsPlugins.h"
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
#import <UIKit/UIKit.h>
|
|
20
|
+
#import <objc/runtime.h>
|
|
21
|
+
|
|
22
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
23
|
+
using namespace facebook::react;
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
#pragma mark - Helpers
|
|
27
|
+
|
|
28
|
+
static UIScrollView *KCFindFirstScrollView(UIView *view)
|
|
29
|
+
{
|
|
30
|
+
for (UIView *subview in view.subviews) {
|
|
31
|
+
if ([subview isKindOfClass:[UIScrollView class]] &&
|
|
32
|
+
![subview isKindOfClass:[UITextView class]]) {
|
|
33
|
+
return (UIScrollView *)subview;
|
|
34
|
+
}
|
|
35
|
+
UIScrollView *found = KCFindFirstScrollView(subview);
|
|
36
|
+
if (found) {
|
|
37
|
+
return found;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return nil;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
static void KCApplyNoopScrollRectToVisible(UIScrollView *scrollView)
|
|
44
|
+
{
|
|
45
|
+
if (!scrollView) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
Class originalClass = object_getClass(scrollView);
|
|
50
|
+
NSString *originalClassName = NSStringFromClass(originalClass);
|
|
51
|
+
|
|
52
|
+
// Already patched — nothing to do
|
|
53
|
+
if ([originalClassName hasPrefix:@"KC_NoScrollRect_"]) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
NSString *subclassName = [@"KC_NoScrollRect_" stringByAppendingString:originalClassName];
|
|
58
|
+
Class subclass = NSClassFromString(subclassName);
|
|
59
|
+
|
|
60
|
+
if (!subclass) {
|
|
61
|
+
subclass = objc_allocateClassPair(originalClass, subclassName.UTF8String, 0);
|
|
62
|
+
if (!subclass) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
Method original =
|
|
67
|
+
class_getInstanceMethod(originalClass, @selector(scrollRectToVisible:animated:));
|
|
68
|
+
if (original) {
|
|
69
|
+
IMP noopImp = imp_implementationWithBlock(
|
|
70
|
+
^(__unused UIScrollView *self, __unused CGRect rect, __unused BOOL animated){
|
|
71
|
+
// no-op
|
|
72
|
+
});
|
|
73
|
+
class_addMethod(
|
|
74
|
+
subclass,
|
|
75
|
+
@selector(scrollRectToVisible:animated:),
|
|
76
|
+
noopImp,
|
|
77
|
+
method_getTypeEncoding(original));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
objc_registerClassPair(subclass);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
object_setClass(scrollView, subclass);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Workaround for https://github.com/facebook/react-native/issues/54123
|
|
87
|
+
// RN 0.81+ ScrollView contentInset area doesn't respond to touch events.
|
|
88
|
+
// Can be removed once the upstream fix lands.
|
|
89
|
+
static void KCApplyFixedHitTest(UIScrollView *scrollView)
|
|
90
|
+
{
|
|
91
|
+
if (!scrollView || !scrollView.superview) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
UIView *container = scrollView.superview;
|
|
96
|
+
Class originalClass = object_getClass(container);
|
|
97
|
+
NSString *originalClassName = NSStringFromClass(originalClass);
|
|
98
|
+
|
|
99
|
+
// Already patched — nothing to do
|
|
100
|
+
if ([originalClassName hasPrefix:@"KC_FixedHitTest_"]) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
NSString *subclassName = [@"KC_FixedHitTest_" stringByAppendingString:originalClassName];
|
|
105
|
+
Class subclass = NSClassFromString(subclassName);
|
|
106
|
+
|
|
107
|
+
if (!subclass) {
|
|
108
|
+
subclass = objc_allocateClassPair(originalClass, subclassName.UTF8String, 0);
|
|
109
|
+
if (!subclass) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
Method original = class_getInstanceMethod(originalClass, @selector(hitTest:withEvent:));
|
|
114
|
+
if (original) {
|
|
115
|
+
// Get the original implementation to call it
|
|
116
|
+
IMP originalImp = method_getImplementation(original);
|
|
117
|
+
UIView *(*originalHitTest)(id, SEL, CGPoint, UIEvent *) =
|
|
118
|
+
(UIView * (*)(id, SEL, CGPoint, UIEvent *)) originalImp;
|
|
119
|
+
|
|
120
|
+
IMP fixedHitTestImp = imp_implementationWithBlock(
|
|
121
|
+
^UIView *(__unsafe_unretained UIView *self, CGPoint point, UIEvent *event) {
|
|
122
|
+
// Call the original implementation
|
|
123
|
+
UIView *result = originalHitTest(self, @selector(hitTest:withEvent:), point, event);
|
|
124
|
+
|
|
125
|
+
// This is the fix: when RN's betterHitTest returns self (the container),
|
|
126
|
+
// return the scrollView instead so touches can reach it
|
|
127
|
+
if (result == self) {
|
|
128
|
+
// Dynamically find the scrollView at hit-test time to handle RN refreshes
|
|
129
|
+
// where the scrollView instance is recreated but the swizzled class persists
|
|
130
|
+
for (UIView *subview in self.subviews) {
|
|
131
|
+
if ([subview isKindOfClass:[UIScrollView class]] &&
|
|
132
|
+
![subview isKindOfClass:[UITextView class]]) {
|
|
133
|
+
return subview;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return result;
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
class_addMethod(
|
|
142
|
+
subclass,
|
|
143
|
+
@selector(hitTest:withEvent:),
|
|
144
|
+
fixedHitTestImp,
|
|
145
|
+
method_getTypeEncoding(original));
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
objc_registerClassPair(subclass);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
object_setClass(container, subclass);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
#pragma mark - Manager
|
|
155
|
+
|
|
156
|
+
@implementation ClippingScrollViewDecoratorViewManager
|
|
157
|
+
|
|
158
|
+
RCT_EXPORT_MODULE(ClippingScrollViewDecoratorViewManager)
|
|
159
|
+
|
|
160
|
+
RCT_EXPORT_VIEW_PROPERTY(applyWorkaroundForContentInsetHitTestBug, BOOL)
|
|
161
|
+
|
|
162
|
+
+ (BOOL)requiresMainQueueSetup
|
|
163
|
+
{
|
|
164
|
+
return NO;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
#ifndef RCT_NEW_ARCH_ENABLED
|
|
168
|
+
- (UIView *)view
|
|
169
|
+
{
|
|
170
|
+
return [[ClippingScrollViewDecoratorView alloc] init];
|
|
171
|
+
}
|
|
172
|
+
#endif
|
|
173
|
+
|
|
174
|
+
@end
|
|
175
|
+
|
|
176
|
+
#pragma mark - View
|
|
177
|
+
|
|
178
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
179
|
+
@interface ClippingScrollViewDecoratorView () <RCTClippingScrollViewDecoratorViewViewProtocol>
|
|
180
|
+
#else
|
|
181
|
+
@interface ClippingScrollViewDecoratorView ()
|
|
182
|
+
#endif
|
|
183
|
+
@end
|
|
184
|
+
|
|
185
|
+
@implementation ClippingScrollViewDecoratorView
|
|
186
|
+
|
|
187
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
188
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
189
|
+
{
|
|
190
|
+
return concreteComponentDescriptorProvider<ClippingScrollViewDecoratorViewComponentDescriptor>();
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
- (void)updateProps:(const facebook::react::Props::Shared &)props
|
|
194
|
+
oldProps:(const facebook::react::Props::Shared &)oldProps
|
|
195
|
+
{
|
|
196
|
+
const auto &newViewProps =
|
|
197
|
+
*std::static_pointer_cast<const ClippingScrollViewDecoratorViewProps>(props);
|
|
198
|
+
|
|
199
|
+
self.applyWorkaroundForContentInsetHitTestBug =
|
|
200
|
+
newViewProps.applyWorkaroundForContentInsetHitTestBug;
|
|
201
|
+
|
|
202
|
+
[super updateProps:props oldProps:oldProps];
|
|
203
|
+
}
|
|
204
|
+
#endif
|
|
205
|
+
|
|
206
|
+
// Needed because of this: https://github.com/facebook/react-native/pull/37274
|
|
207
|
+
+ (void)load
|
|
208
|
+
{
|
|
209
|
+
[super load];
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
- (void)didMoveToWindow
|
|
213
|
+
{
|
|
214
|
+
[super didMoveToWindow];
|
|
215
|
+
if (self.window) {
|
|
216
|
+
UIScrollView *scrollView = KCFindFirstScrollView(self);
|
|
217
|
+
KCApplyNoopScrollRectToVisible(scrollView);
|
|
218
|
+
if (self.applyWorkaroundForContentInsetHitTestBug) {
|
|
219
|
+
KCApplyFixedHitTest(scrollView);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
225
|
+
Class<RCTComponentViewProtocol> ClippingScrollViewDecoratorViewCls(void)
|
|
226
|
+
{
|
|
227
|
+
return ClippingScrollViewDecoratorView.class;
|
|
228
|
+
}
|
|
229
|
+
#endif
|
|
230
|
+
|
|
231
|
+
@end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//
|
|
2
|
+
// KeyboardToolbarGroupViewManager.h
|
|
3
|
+
// KeyboardController
|
|
4
|
+
//
|
|
5
|
+
// Created by Kiryl Ziusko on 26/12/2024.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
9
|
+
#import <React/RCTViewComponentView.h>
|
|
10
|
+
#else
|
|
11
|
+
#import <React/RCTBridge.h>
|
|
12
|
+
#endif
|
|
13
|
+
#import <React/RCTViewManager.h>
|
|
14
|
+
#import <UIKit/UIKit.h>
|
|
15
|
+
|
|
16
|
+
@interface KeyboardToolbarGroupViewManager : RCTViewManager
|
|
17
|
+
@end
|
|
18
|
+
|
|
19
|
+
@interface KeyboardToolbarGroupView :
|
|
20
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
21
|
+
RCTViewComponentView
|
|
22
|
+
#else
|
|
23
|
+
UIView
|
|
24
|
+
|
|
25
|
+
- (instancetype)initWithBridge:(RCTBridge *)bridge;
|
|
26
|
+
|
|
27
|
+
#endif
|
|
28
|
+
@end
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
//
|
|
2
|
+
// KeyboardToolbarGroupViewManager.mm
|
|
3
|
+
// react-native-keyboard-controller
|
|
4
|
+
//
|
|
5
|
+
// Created by Kiryl Ziusko on 26/12/2024.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import "KeyboardToolbarGroupViewManager.h"
|
|
9
|
+
|
|
10
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
11
|
+
#import <react/renderer/components/RNKC/EventEmitters.h>
|
|
12
|
+
#import <react/renderer/components/RNKC/Props.h>
|
|
13
|
+
#import <react/renderer/components/RNKC/RCTComponentViewHelpers.h>
|
|
14
|
+
#import <react/renderer/components/RNKC/RNKCKeyboardToolbarGroupViewComponentDescriptor.h>
|
|
15
|
+
|
|
16
|
+
#import "RCTFabricComponentsPlugins.h"
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
#import <UIKit/UIKit.h>
|
|
20
|
+
|
|
21
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
22
|
+
using namespace facebook::react;
|
|
23
|
+
#endif
|
|
24
|
+
|
|
25
|
+
// MARK: Manager
|
|
26
|
+
@implementation KeyboardToolbarGroupViewManager
|
|
27
|
+
|
|
28
|
+
RCT_EXPORT_MODULE(KeyboardToolbarGroupViewManager)
|
|
29
|
+
|
|
30
|
+
+ (BOOL)requiresMainQueueSetup
|
|
31
|
+
{
|
|
32
|
+
return NO;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
#ifndef RCT_NEW_ARCH_ENABLED
|
|
36
|
+
- (UIView *)view
|
|
37
|
+
{
|
|
38
|
+
return [[KeyboardToolbarGroupView alloc] initWithBridge:self.bridge];
|
|
39
|
+
}
|
|
40
|
+
#endif
|
|
41
|
+
|
|
42
|
+
@end
|
|
43
|
+
|
|
44
|
+
// MARK: View
|
|
45
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
46
|
+
@interface KeyboardToolbarGroupView () <RCTKeyboardToolbarGroupViewViewProtocol>
|
|
47
|
+
@end
|
|
48
|
+
#endif
|
|
49
|
+
|
|
50
|
+
@implementation KeyboardToolbarGroupView {
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
54
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
55
|
+
{
|
|
56
|
+
return concreteComponentDescriptorProvider<KeyboardToolbarGroupViewComponentDescriptor>();
|
|
57
|
+
}
|
|
58
|
+
#endif
|
|
59
|
+
|
|
60
|
+
// Needed because of this: https://github.com/facebook/react-native/pull/37274
|
|
61
|
+
+ (void)load
|
|
62
|
+
{
|
|
63
|
+
[super load];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// MARK: Constructor
|
|
67
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
68
|
+
- (instancetype)init
|
|
69
|
+
{
|
|
70
|
+
self = [super init];
|
|
71
|
+
return self;
|
|
72
|
+
}
|
|
73
|
+
#else
|
|
74
|
+
- (instancetype)initWithBridge:(RCTBridge *)bridge
|
|
75
|
+
{
|
|
76
|
+
self = [super init];
|
|
77
|
+
return self;
|
|
78
|
+
}
|
|
79
|
+
#endif
|
|
80
|
+
|
|
81
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
82
|
+
Class<RCTComponentViewProtocol> KeyboardToolbarGroupViewCls(void)
|
|
83
|
+
{
|
|
84
|
+
return KeyboardToolbarGroupView.class;
|
|
85
|
+
}
|
|
86
|
+
#endif
|
|
87
|
+
|
|
88
|
+
@end
|
package/jest/index.js
CHANGED
|
@@ -87,6 +87,9 @@ const mock = {
|
|
|
87
87
|
setFocusTo: jest.fn(),
|
|
88
88
|
isVisible: jest.fn().mockReturnValue(false),
|
|
89
89
|
state: jest.fn().mockReturnValue(lastKeyboardEvent),
|
|
90
|
+
viewPositionInWindow: jest
|
|
91
|
+
.fn()
|
|
92
|
+
.mockReturnValue(Promise.resolve({ x: 0, y: 0, width: 0, height: 0 })),
|
|
90
93
|
},
|
|
91
94
|
AndroidSoftInputModes: {
|
|
92
95
|
SOFT_INPUT_ADJUST_NOTHING: 48,
|
|
@@ -119,7 +122,14 @@ const mock = {
|
|
|
119
122
|
KeyboardStickyView: View,
|
|
120
123
|
KeyboardAvoidingView: View,
|
|
121
124
|
KeyboardAwareScrollView: ScrollView,
|
|
122
|
-
KeyboardToolbar: View,
|
|
125
|
+
KeyboardToolbar: Object.assign(View, {
|
|
126
|
+
Background: "KeyboardToolbar.Background",
|
|
127
|
+
Content: "KeyboardToolbar.Content",
|
|
128
|
+
Prev: "KeyboardToolbar.Prev",
|
|
129
|
+
Next: "KeyboardToolbar.Next",
|
|
130
|
+
Done: "KeyboardToolbar.Done",
|
|
131
|
+
Group: "KeyboardToolbar.Group",
|
|
132
|
+
}),
|
|
123
133
|
KeyboardChatScrollView: ScrollView,
|
|
124
134
|
// themes
|
|
125
135
|
DefaultKeyboardToolbarTheme,
|
package/lib/commonjs/bindings.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.WindowDimensionsEvents = exports.RCTOverKeyboardView = exports.RCTKeyboardExtender = exports.KeyboardGestureArea = exports.KeyboardEvents = exports.KeyboardControllerViewCommands = exports.KeyboardControllerView = exports.KeyboardControllerNative = exports.KeyboardBackgroundView = exports.FocusedInputEvents = exports.ClippingScrollView = void 0;
|
|
6
|
+
exports.WindowDimensionsEvents = exports.RCTOverKeyboardView = exports.RCTKeyboardToolbarGroupView = exports.RCTKeyboardExtender = exports.KeyboardGestureArea = exports.KeyboardEvents = exports.KeyboardControllerViewCommands = exports.KeyboardControllerView = exports.KeyboardControllerNative = exports.KeyboardBackgroundView = exports.FocusedInputEvents = exports.ClippingScrollView = void 0;
|
|
7
7
|
var _reactNative = require("react-native");
|
|
8
8
|
const NOOP = () => {};
|
|
9
9
|
const KeyboardControllerNative = exports.KeyboardControllerNative = {
|
|
@@ -12,6 +12,12 @@ const KeyboardControllerNative = exports.KeyboardControllerNative = {
|
|
|
12
12
|
preload: NOOP,
|
|
13
13
|
dismiss: NOOP,
|
|
14
14
|
setFocusTo: NOOP,
|
|
15
|
+
viewPositionInWindow: () => Promise.resolve({
|
|
16
|
+
x: 0,
|
|
17
|
+
y: 0,
|
|
18
|
+
width: 0,
|
|
19
|
+
height: 0
|
|
20
|
+
}),
|
|
15
21
|
addListener: NOOP,
|
|
16
22
|
removeListeners: NOOP
|
|
17
23
|
};
|
|
@@ -73,9 +79,19 @@ const KeyboardBackgroundView = exports.KeyboardBackgroundView = _reactNative.Vie
|
|
|
73
79
|
*/
|
|
74
80
|
const RCTKeyboardExtender = exports.RCTKeyboardExtender = _reactNative.View;
|
|
75
81
|
/**
|
|
76
|
-
* A decorator that will clip the content of the `ScrollView`. It helps to simulate `contentInset` behavior on Android
|
|
82
|
+
* A decorator that will clip the content of the `ScrollView`. It helps to simulate `contentInset` behavior on Android
|
|
77
83
|
* Supports only `bottom` property (`paddingBottom` is not supported property of `ScrollView.style`).
|
|
78
84
|
* Using this component we can modify bottom inset without having a fake view.
|
|
85
|
+
*
|
|
86
|
+
* On iOS we use swizzling to apply runtime patches to fix some broken internal methods.
|
|
87
|
+
* Ideally this component shouldn't exist and all its fixes/polyfills must be added directly to react-native and
|
|
88
|
+
* we will port features/fixes back to upstream, but at the moment we use this view to
|
|
89
|
+
* deliver desired functionality regardless of react-native version used.
|
|
79
90
|
*/
|
|
80
91
|
const ClippingScrollView = exports.ClippingScrollView = _reactNative.View;
|
|
92
|
+
/**
|
|
93
|
+
* A View that defines a group of `TextInput`s.
|
|
94
|
+
* Used in toolbar navigation to assure that you can navigate only between inputs withing the same group.
|
|
95
|
+
*/
|
|
96
|
+
const RCTKeyboardToolbarGroupView = exports.RCTKeyboardToolbarGroupView = _reactNative.View;
|
|
81
97
|
//# sourceMappingURL=bindings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","NOOP","KeyboardControllerNative","exports","setDefaultMode","setInputMode","preload","dismiss","setFocusTo","addListener","removeListeners","KeyboardEvents","remove","FocusedInputEvents","WindowDimensionsEvents","KeyboardControllerView","View","KeyboardControllerViewCommands","synchronizeFocusedInputLayout","_ref","KeyboardGestureArea","RCTOverKeyboardView","KeyboardBackgroundView","RCTKeyboardExtender","ClippingScrollView"],"sources":["bindings.ts"],"sourcesContent":["import { View } from \"react-native\";\n\nimport type {\n ClippingScrollViewProps,\n FocusedInputEventsModule,\n KeyboardBackgroundViewProps,\n KeyboardControllerNativeModule,\n KeyboardControllerProps,\n KeyboardEventsModule,\n KeyboardExtenderProps,\n KeyboardGestureAreaProps,\n OverKeyboardViewProps,\n WindowDimensionsEventsModule,\n} from \"./types\";\nimport type { EmitterSubscription } from \"react-native\";\n\nconst NOOP = () => {};\n\nexport const KeyboardControllerNative: KeyboardControllerNativeModule = {\n setDefaultMode: NOOP,\n setInputMode: NOOP,\n preload: NOOP,\n dismiss: NOOP,\n setFocusTo: NOOP,\n addListener: NOOP,\n removeListeners: NOOP,\n};\n/**\n * An event emitter that provides a way to subscribe to next keyboard events:\n * - `keyboardWillShow`;\n * - `keyboardDidShow`;\n * - `keyboardWillHide`;\n * - `keyboardDidHide`.\n *\n * Use `addListener` function to add your event listener for a specific keyboard event.\n */\nexport const KeyboardEvents: KeyboardEventsModule = {\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\n};\n/**\n * This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.\n * Use it with cautious.\n */\nexport const FocusedInputEvents: FocusedInputEventsModule = {\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\n};\nexport const WindowDimensionsEvents: WindowDimensionsEventsModule = {\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\n};\n/**\n * A view that sends events whenever keyboard or focused events are happening.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller-view|Documentation} page for more details.\n */\nexport const KeyboardControllerView =\n View as unknown as React.FC<KeyboardControllerProps>;\nexport const KeyboardControllerViewCommands = {\n synchronizeFocusedInputLayout: (\n _ref: React.Component<KeyboardControllerProps> | null,\n ) => {},\n};\n/**\n * A view that defines a region on the screen, where gestures will control the keyboard position.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-gesture-area|Documentation} page for more details.\n */\nexport const KeyboardGestureArea =\n View as unknown as React.FC<KeyboardGestureAreaProps>;\nexport const RCTOverKeyboardView =\n View as unknown as React.FC<OverKeyboardViewProps>;\n/**\n * A view that matches keyboard background.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-background-view|Documentation} page for more details.\n */\nexport const KeyboardBackgroundView =\n View as unknown as React.FC<KeyboardBackgroundViewProps>;\n/**\n * A container that will embed its children into the keyboard\n * and will always show them above the keyboard.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-extender|Documentation} page for more details.\n */\nexport const RCTKeyboardExtender =\n View as unknown as React.FC<KeyboardExtenderProps>;\n/**\n * A decorator that will clip the content of the `ScrollView`. It helps to simulate `contentInset` behavior on Android
|
|
1
|
+
{"version":3,"names":["_reactNative","require","NOOP","KeyboardControllerNative","exports","setDefaultMode","setInputMode","preload","dismiss","setFocusTo","viewPositionInWindow","Promise","resolve","x","y","width","height","addListener","removeListeners","KeyboardEvents","remove","FocusedInputEvents","WindowDimensionsEvents","KeyboardControllerView","View","KeyboardControllerViewCommands","synchronizeFocusedInputLayout","_ref","KeyboardGestureArea","RCTOverKeyboardView","KeyboardBackgroundView","RCTKeyboardExtender","ClippingScrollView","RCTKeyboardToolbarGroupView"],"sources":["bindings.ts"],"sourcesContent":["import { View } from \"react-native\";\n\nimport type {\n ClippingScrollViewProps,\n FocusedInputEventsModule,\n KeyboardBackgroundViewProps,\n KeyboardControllerNativeModule,\n KeyboardControllerProps,\n KeyboardEventsModule,\n KeyboardExtenderProps,\n KeyboardGestureAreaProps,\n KeyboardToolbarGroupViewProps,\n OverKeyboardViewProps,\n WindowDimensionsEventsModule,\n} from \"./types\";\nimport type { EmitterSubscription } from \"react-native\";\n\nconst NOOP = () => {};\n\nexport const KeyboardControllerNative: KeyboardControllerNativeModule = {\n setDefaultMode: NOOP,\n setInputMode: NOOP,\n preload: NOOP,\n dismiss: NOOP,\n setFocusTo: NOOP,\n viewPositionInWindow: () =>\n Promise.resolve({ x: 0, y: 0, width: 0, height: 0 }),\n addListener: NOOP,\n removeListeners: NOOP,\n};\n/**\n * An event emitter that provides a way to subscribe to next keyboard events:\n * - `keyboardWillShow`;\n * - `keyboardDidShow`;\n * - `keyboardWillHide`;\n * - `keyboardDidHide`.\n *\n * Use `addListener` function to add your event listener for a specific keyboard event.\n */\nexport const KeyboardEvents: KeyboardEventsModule = {\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\n};\n/**\n * This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.\n * Use it with cautious.\n */\nexport const FocusedInputEvents: FocusedInputEventsModule = {\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\n};\nexport const WindowDimensionsEvents: WindowDimensionsEventsModule = {\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\n};\n/**\n * A view that sends events whenever keyboard or focused events are happening.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller-view|Documentation} page for more details.\n */\nexport const KeyboardControllerView =\n View as unknown as React.FC<KeyboardControllerProps>;\nexport const KeyboardControllerViewCommands = {\n synchronizeFocusedInputLayout: (\n _ref: React.Component<KeyboardControllerProps> | null,\n ) => {},\n};\n/**\n * A view that defines a region on the screen, where gestures will control the keyboard position.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-gesture-area|Documentation} page for more details.\n */\nexport const KeyboardGestureArea =\n View as unknown as React.FC<KeyboardGestureAreaProps>;\nexport const RCTOverKeyboardView =\n View as unknown as React.FC<OverKeyboardViewProps>;\n/**\n * A view that matches keyboard background.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-background-view|Documentation} page for more details.\n */\nexport const KeyboardBackgroundView =\n View as unknown as React.FC<KeyboardBackgroundViewProps>;\n/**\n * A container that will embed its children into the keyboard\n * and will always show them above the keyboard.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-extender|Documentation} page for more details.\n */\nexport const RCTKeyboardExtender =\n View as unknown as React.FC<KeyboardExtenderProps>;\n/**\n * A decorator that will clip the content of the `ScrollView`. It helps to simulate `contentInset` behavior on Android\n * Supports only `bottom` property (`paddingBottom` is not supported property of `ScrollView.style`).\n * Using this component we can modify bottom inset without having a fake view.\n *\n * On iOS we use swizzling to apply runtime patches to fix some broken internal methods.\n * Ideally this component shouldn't exist and all its fixes/polyfills must be added directly to react-native and\n * we will port features/fixes back to upstream, but at the moment we use this view to\n * deliver desired functionality regardless of react-native version used.\n */\nexport const ClippingScrollView =\n View as unknown as React.FC<ClippingScrollViewProps>;\n/**\n * A View that defines a group of `TextInput`s.\n * Used in toolbar navigation to assure that you can navigate only between inputs withing the same group.\n */\nexport const RCTKeyboardToolbarGroupView =\n View as unknown as React.FC<KeyboardToolbarGroupViewProps>;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAiBA,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAEd,MAAMC,wBAAwD,GAAAC,OAAA,CAAAD,wBAAA,GAAG;EACtEE,cAAc,EAAEH,IAAI;EACpBI,YAAY,EAAEJ,IAAI;EAClBK,OAAO,EAAEL,IAAI;EACbM,OAAO,EAAEN,IAAI;EACbO,UAAU,EAAEP,IAAI;EAChBQ,oBAAoB,EAAEA,CAAA,KACpBC,OAAO,CAACC,OAAO,CAAC;IAAEC,CAAC,EAAE,CAAC;IAAEC,CAAC,EAAE,CAAC;IAAEC,KAAK,EAAE,CAAC;IAAEC,MAAM,EAAE;EAAE,CAAC,CAAC;EACtDC,WAAW,EAAEf,IAAI;EACjBgB,eAAe,EAAEhB;AACnB,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMiB,cAAoC,GAAAf,OAAA,CAAAe,cAAA,GAAG;EAClDF,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAElB;EAAK,CAAC;AACtC,CAAC;AACD;AACA;AACA;AACA;AACO,MAAMmB,kBAA4C,GAAAjB,OAAA,CAAAiB,kBAAA,GAAG;EAC1DJ,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAElB;EAAK,CAAC;AACtC,CAAC;AACM,MAAMoB,sBAAoD,GAAAlB,OAAA,CAAAkB,sBAAA,GAAG;EAClEL,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAElB;EAAK,CAAC;AACtC,CAAC;AACD;AACA;AACA;AACA;AACA;AACO,MAAMqB,sBAAsB,GAAAnB,OAAA,CAAAmB,sBAAA,GACjCC,iBAAoD;AAC/C,MAAMC,8BAA8B,GAAArB,OAAA,CAAAqB,8BAAA,GAAG;EAC5CC,6BAA6B,EAC3BC,IAAqD,IAClD,CAAC;AACR,CAAC;AACD;AACA;AACA;AACA;AACA;AACO,MAAMC,mBAAmB,GAAAxB,OAAA,CAAAwB,mBAAA,GAC9BJ,iBAAqD;AAChD,MAAMK,mBAAmB,GAAAzB,OAAA,CAAAyB,mBAAA,GAC9BL,iBAAkD;AACpD;AACA;AACA;AACA;AACA;AACO,MAAMM,sBAAsB,GAAA1B,OAAA,CAAA0B,sBAAA,GACjCN,iBAAwD;AAC1D;AACA;AACA;AACA;AACA;AACA;AACO,MAAMO,mBAAmB,GAAA3B,OAAA,CAAA2B,mBAAA,GAC9BP,iBAAkD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMQ,kBAAkB,GAAA5B,OAAA,CAAA4B,kBAAA,GAC7BR,iBAAoD;AACtD;AACA;AACA;AACA;AACO,MAAMS,2BAA2B,GAAA7B,OAAA,CAAA6B,2BAAA,GACtCT,iBAA0D","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.WindowDimensionsEvents = exports.RCTOverKeyboardView = exports.RCTKeyboardExtender = exports.KeyboardGestureArea = exports.KeyboardEvents = exports.KeyboardControllerViewCommands = exports.KeyboardControllerView = exports.KeyboardControllerNative = exports.KeyboardBackgroundView = exports.FocusedInputEvents = exports.ClippingScrollView = void 0;
|
|
6
|
+
exports.WindowDimensionsEvents = exports.RCTOverKeyboardView = exports.RCTKeyboardToolbarGroupView = exports.RCTKeyboardExtender = exports.KeyboardGestureArea = exports.KeyboardEvents = exports.KeyboardControllerViewCommands = exports.KeyboardControllerView = exports.KeyboardControllerNative = exports.KeyboardBackgroundView = exports.FocusedInputEvents = exports.ClippingScrollView = void 0;
|
|
7
7
|
var _reactNative = require("react-native");
|
|
8
8
|
const LINKING_ERROR = `The package 'react-native-keyboard-controller' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
9
9
|
ios: "- You have run 'pod install'\n",
|
|
@@ -42,7 +42,6 @@ const KeyboardBackgroundView = exports.KeyboardBackgroundView = require("./specs
|
|
|
42
42
|
const RCTKeyboardExtender = exports.RCTKeyboardExtender = _reactNative.Platform.OS === "ios" ? require("./specs/KeyboardExtenderNativeComponent").default : ({
|
|
43
43
|
children
|
|
44
44
|
}) => children;
|
|
45
|
-
const ClippingScrollView = exports.ClippingScrollView =
|
|
46
|
-
|
|
47
|
-
}) => children;
|
|
45
|
+
const ClippingScrollView = exports.ClippingScrollView = require("./specs/ClippingScrollViewDecoratorViewNativeComponent").default;
|
|
46
|
+
const RCTKeyboardToolbarGroupView = exports.RCTKeyboardToolbarGroupView = require("./specs/KeyboardToolbarGroupViewNativeComponent").default;
|
|
48
47
|
//# sourceMappingURL=bindings.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","KeyboardControllerViewNativeComponentModule","RCTKeyboardController","KeyboardControllerNative","exports","Proxy","get","Error","KEYBOARD_CONTROLLER_NAMESPACE","eventEmitter","NativeEventEmitter","KeyboardEvents","addListener","name","cb","FocusedInputEvents","WindowDimensionsEvents","KeyboardControllerView","KeyboardControllerViewCommands","Commands","KeyboardGestureArea","OS","Version","children","RCTOverKeyboardView","KeyboardBackgroundView","RCTKeyboardExtender","ClippingScrollView"],"sources":["bindings.native.ts"],"sourcesContent":["import { NativeEventEmitter, Platform } from \"react-native\";\n\nimport type {\n
|
|
1
|
+
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","KeyboardControllerViewNativeComponentModule","RCTKeyboardController","KeyboardControllerNative","exports","Proxy","get","Error","KEYBOARD_CONTROLLER_NAMESPACE","eventEmitter","NativeEventEmitter","KeyboardEvents","addListener","name","cb","FocusedInputEvents","WindowDimensionsEvents","KeyboardControllerView","KeyboardControllerViewCommands","Commands","KeyboardGestureArea","OS","Version","children","RCTOverKeyboardView","KeyboardBackgroundView","RCTKeyboardExtender","ClippingScrollView","RCTKeyboardToolbarGroupView"],"sources":["bindings.native.ts"],"sourcesContent":["import { NativeEventEmitter, Platform } from \"react-native\";\n\nimport type {\n FocusedInputEventsModule,\n KeyboardBackgroundViewProps,\n KeyboardControllerNativeModule,\n KeyboardControllerProps,\n KeyboardEventsModule,\n KeyboardExtenderProps,\n KeyboardGestureAreaProps,\n KeyboardToolbarGroupViewProps,\n OverKeyboardViewProps,\n WindowDimensionsEventsModule,\n} from \"./types\";\n\nconst LINKING_ERROR =\n `The package 'react-native-keyboard-controller' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: \"\" }) +\n \"- You rebuilt the app after installing the package\\n\" +\n \"- You are not using Expo Go\\n\";\n\nconst KeyboardControllerViewNativeComponentModule = require(\"./specs/KeyboardControllerViewNativeComponent\");\nconst RCTKeyboardController =\n require(\"./specs/NativeKeyboardController\").default;\n\nexport const KeyboardControllerNative = (\n RCTKeyboardController\n ? RCTKeyboardController\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n },\n )\n) as KeyboardControllerNativeModule;\n\nconst KEYBOARD_CONTROLLER_NAMESPACE = \"KeyboardController::\";\nconst eventEmitter = new NativeEventEmitter(KeyboardControllerNative);\n\nexport const KeyboardEvents: KeyboardEventsModule = {\n addListener: (name, cb) =>\n eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),\n};\n\n/**\n * This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.\n * Use it with cautious.\n */\nexport const FocusedInputEvents: FocusedInputEventsModule = {\n addListener: (name, cb) =>\n eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),\n};\nexport const WindowDimensionsEvents: WindowDimensionsEventsModule = {\n addListener: (name, cb) =>\n eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),\n};\nexport const KeyboardControllerView: React.FC<KeyboardControllerProps> =\n KeyboardControllerViewNativeComponentModule.default;\nexport const KeyboardControllerViewCommands =\n KeyboardControllerViewNativeComponentModule.Commands;\nexport const KeyboardGestureArea: React.FC<KeyboardGestureAreaProps> =\n (Platform.OS === \"android\" && Platform.Version >= 30) || Platform.OS === \"ios\"\n ? require(\"./specs/KeyboardGestureAreaNativeComponent\").default\n : ({ children }: KeyboardGestureAreaProps) => children;\nexport const RCTOverKeyboardView: React.FC<OverKeyboardViewProps> =\n require(\"./specs/OverKeyboardViewNativeComponent\").default;\nexport const KeyboardBackgroundView: React.FC<KeyboardBackgroundViewProps> =\n require(\"./specs/KeyboardBackgroundViewNativeComponent\").default;\nexport const RCTKeyboardExtender: React.FC<KeyboardExtenderProps> =\n Platform.OS === \"ios\"\n ? require(\"./specs/KeyboardExtenderNativeComponent\").default\n : ({ children }: KeyboardExtenderProps) => children;\nexport const ClippingScrollView: React.FC<KeyboardBackgroundViewProps> =\n require(\"./specs/ClippingScrollViewDecoratorViewNativeComponent\").default;\nexport const RCTKeyboardToolbarGroupView: React.FC<KeyboardToolbarGroupViewProps> =\n require(\"./specs/KeyboardToolbarGroupViewNativeComponent\").default;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAeA,MAAMC,aAAa,GACjB,2FAA2F,GAC3FC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,2CAA2C,GAAGN,OAAO,CAAC,+CAA+C,CAAC;AAC5G,MAAMO,qBAAqB,GACzBP,OAAO,CAAC,kCAAkC,CAAC,CAACK,OAAO;AAE9C,MAAMG,wBAAwB,GAAAC,OAAA,CAAAD,wBAAA,GACnCD,qBAAqB,GACjBA,qBAAqB,GACrB,IAAIG,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACX,aAAa,CAAC;EAChC;AACF,CACF,CAC6B;AAEnC,MAAMY,6BAA6B,GAAG,sBAAsB;AAC5D,MAAMC,YAAY,GAAG,IAAIC,+BAAkB,CAACP,wBAAwB,CAAC;AAE9D,MAAMQ,cAAoC,GAAAP,OAAA,CAAAO,cAAA,GAAG;EAClDC,WAAW,EAAEA,CAACC,IAAI,EAAEC,EAAE,KACpBL,YAAY,CAACG,WAAW,CAACJ,6BAA6B,GAAGK,IAAI,EAAEC,EAAE;AACrE,CAAC;;AAED;AACA;AACA;AACA;AACO,MAAMC,kBAA4C,GAAAX,OAAA,CAAAW,kBAAA,GAAG;EAC1DH,WAAW,EAAEA,CAACC,IAAI,EAAEC,EAAE,KACpBL,YAAY,CAACG,WAAW,CAACJ,6BAA6B,GAAGK,IAAI,EAAEC,EAAE;AACrE,CAAC;AACM,MAAME,sBAAoD,GAAAZ,OAAA,CAAAY,sBAAA,GAAG;EAClEJ,WAAW,EAAEA,CAACC,IAAI,EAAEC,EAAE,KACpBL,YAAY,CAACG,WAAW,CAACJ,6BAA6B,GAAGK,IAAI,EAAEC,EAAE;AACrE,CAAC;AACM,MAAMG,sBAAyD,GAAAb,OAAA,CAAAa,sBAAA,GACpEhB,2CAA2C,CAACD,OAAO;AAC9C,MAAMkB,8BAA8B,GAAAd,OAAA,CAAAc,8BAAA,GACzCjB,2CAA2C,CAACkB,QAAQ;AAC/C,MAAMC,mBAAuD,GAAAhB,OAAA,CAAAgB,mBAAA,GACjEvB,qBAAQ,CAACwB,EAAE,KAAK,SAAS,IAAIxB,qBAAQ,CAACyB,OAAO,IAAI,EAAE,IAAKzB,qBAAQ,CAACwB,EAAE,KAAK,KAAK,GAC1E1B,OAAO,CAAC,4CAA4C,CAAC,CAACK,OAAO,GAC7D,CAAC;EAAEuB;AAAmC,CAAC,KAAKA,QAAQ;AACnD,MAAMC,mBAAoD,GAAApB,OAAA,CAAAoB,mBAAA,GAC/D7B,OAAO,CAAC,yCAAyC,CAAC,CAACK,OAAO;AACrD,MAAMyB,sBAA6D,GAAArB,OAAA,CAAAqB,sBAAA,GACxE9B,OAAO,CAAC,+CAA+C,CAAC,CAACK,OAAO;AAC3D,MAAM0B,mBAAoD,GAAAtB,OAAA,CAAAsB,mBAAA,GAC/D7B,qBAAQ,CAACwB,EAAE,KAAK,KAAK,GACjB1B,OAAO,CAAC,yCAAyC,CAAC,CAACK,OAAO,GAC1D,CAAC;EAAEuB;AAAgC,CAAC,KAAKA,QAAQ;AAChD,MAAMI,kBAAyD,GAAAvB,OAAA,CAAAuB,kBAAA,GACpEhC,OAAO,CAAC,wDAAwD,CAAC,CAACK,OAAO;AACpE,MAAM4B,2BAAoE,GAAAxB,OAAA,CAAAwB,2BAAA,GAC/EjC,OAAO,CAAC,iDAAiD,CAAC,CAACK,OAAO","ignoreList":[]}
|