react-native-keyboard-controller 1.21.0-beta.2 → 1.21.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 +1 -0
- package/android/src/base/java/com/reactnativekeyboardcontroller/KeyboardControllerPackage.kt +1 -0
- package/android/src/fabric/java/com/reactnativekeyboardcontroller/ClippingScrollViewDecoratorViewManager.kt +14 -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 +33 -1
- 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 +16 -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/animations/KeyboardAnimation.swift +2 -2
- package/ios/animations/SpringAnimation.swift +1 -1
- package/ios/animations/TimingAnimation.swift +1 -3
- package/ios/delegates/KCTextInputCompositeDelegate.swift +2 -2
- package/ios/extensions/CGFloat.swift +1 -3
- package/ios/extensions/UIApplication.swift +1 -1
- package/ios/interactive/KeyboardAreaExtender.swift +2 -1
- package/ios/observers/FocusedInputObserver.swift +6 -3
- package/ios/observers/movement/KeyboardTrackingView.swift +4 -1
- package/ios/observers/movement/observer/KeyboardMovementObserver+Interactive.swift +2 -0
- package/ios/observers/movement/observer/KeyboardMovementObserver+Listeners.swift +30 -7
- package/ios/observers/movement/observer/KeyboardMovementObserver.swift +2 -48
- package/ios/protocols/TextInput.swift +1 -1
- package/ios/swizzling/UIResponderSwizzle.swift +2 -4
- package/ios/traversal/FocusedInputHolder.swift +3 -3
- package/ios/traversal/KeyboardView.swift +1 -1
- package/ios/traversal/ViewHierarchyNavigator.swift +51 -5
- package/ios/views/ClippingScrollViewDecoratorViewManager.h +26 -0
- package/ios/views/ClippingScrollViewDecoratorViewManager.mm +231 -0
- package/ios/views/KeyboardControllerViewManager.swift +5 -5
- package/ios/views/KeyboardToolbarGroupViewManager.h +28 -0
- package/ios/views/KeyboardToolbarGroupViewManager.mm +88 -0
- package/jest/index.js +12 -4
- 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 +55 -14
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
- package/lib/commonjs/components/{ChatKit → KeyboardChatScrollView}/hooks.js.map +1 -1
- package/lib/commonjs/components/KeyboardChatScrollView/index.js +111 -0
- package/lib/commonjs/components/KeyboardChatScrollView/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardChatScrollView/types.js.map +1 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/helpers.js +221 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/helpers.js.map +1 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js +149 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js.map +1 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.js +240 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/types.js +6 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/types.js.map +1 -0
- 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/KeyboardStickyView/index.js +3 -1
- package/lib/commonjs/components/KeyboardStickyView/index.js.map +1 -1
- 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 +36 -15
- package/lib/commonjs/components/ScrollViewWithBottomPadding/index.js.map +1 -1
- package/lib/commonjs/components/hooks/useScrollState.js +20 -1
- package/lib/commonjs/components/hooks/useScrollState.js.map +1 -1
- package/lib/commonjs/components/index.js +7 -7
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/index.js +7 -7
- package/lib/commonjs/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 +55 -14
- package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -1
- package/lib/module/components/{ChatKit → KeyboardChatScrollView}/hooks.js.map +1 -1
- package/lib/module/components/KeyboardChatScrollView/index.js +104 -0
- package/lib/module/components/KeyboardChatScrollView/index.js.map +1 -0
- package/lib/module/components/KeyboardChatScrollView/types.js.map +1 -0
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/helpers.js +207 -0
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/helpers.js.map +1 -0
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js +143 -0
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js.map +1 -0
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.js +234 -0
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.js.map +1 -0
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/types.js +2 -0
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/types.js.map +1 -0
- 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/KeyboardStickyView/index.js +3 -1
- package/lib/module/components/KeyboardStickyView/index.js.map +1 -1
- 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 +38 -17
- package/lib/module/components/ScrollViewWithBottomPadding/index.js.map +1 -1
- package/lib/module/components/hooks/useScrollState.js +21 -2
- package/lib/module/components/hooks/useScrollState.js.map +1 -1
- package/lib/module/components/index.js +1 -1
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/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/hooks.d.ts +2 -0
- package/lib/typescript/components/KeyboardChatScrollView/index.d.ts +15 -0
- package/lib/typescript/components/{ChatKit → KeyboardChatScrollView}/types.d.ts +46 -6
- package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/helpers.d.ts +132 -0
- package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/index.d.ts +18 -0
- package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/index.ios.d.ts +21 -0
- package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/types.d.ts +37 -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 +5 -4
- package/lib/typescript/components/hooks/useScrollState.d.ts +3 -0
- package/lib/typescript/components/index.d.ts +2 -2
- package/lib/typescript/index.d.ts +2 -2
- package/lib/typescript/specs/ClippingScrollViewDecoratorViewNativeComponent.d.ts +2 -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 +4 -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 +68 -13
- package/src/components/KeyboardChatScrollView/hooks.ts +2 -0
- package/src/components/KeyboardChatScrollView/index.tsx +150 -0
- package/src/components/{ChatKit → KeyboardChatScrollView}/types.ts +46 -6
- package/src/components/KeyboardChatScrollView/useChatKeyboard/helpers.ts +268 -0
- package/src/components/KeyboardChatScrollView/useChatKeyboard/index.ios.ts +260 -0
- package/src/components/KeyboardChatScrollView/useChatKeyboard/index.ts +376 -0
- package/src/components/KeyboardChatScrollView/useChatKeyboard/types.ts +39 -0
- package/src/components/KeyboardChatScrollView/useExtraContentPadding/index.ts +123 -0
- package/src/components/KeyboardStickyView/index.tsx +4 -3
- package/src/components/KeyboardToolbar/index.tsx +6 -1
- package/src/components/ScrollViewWithBottomPadding/index.tsx +53 -29
- package/src/components/hooks/useScrollState.ts +24 -2
- package/src/components/index.ts +2 -2
- package/src/index.ts +2 -2
- package/src/specs/ClippingScrollViewDecoratorViewNativeComponent.ts +2 -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 +4 -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
- package/lib/commonjs/components/ChatKit/TODO.md +0 -20
- package/lib/commonjs/components/ChatKit/index.js +0 -55
- package/lib/commonjs/components/ChatKit/index.js.map +0 -1
- package/lib/commonjs/components/ChatKit/types.js.map +0 -1
- package/lib/commonjs/components/ChatKit/useChatKeyboard/helpers.js +0 -101
- package/lib/commonjs/components/ChatKit/useChatKeyboard/helpers.js.map +0 -1
- package/lib/commonjs/components/ChatKit/useChatKeyboard/index.js +0 -147
- package/lib/commonjs/components/ChatKit/useChatKeyboard/index.js.map +0 -1
- package/lib/module/components/ChatKit/TODO.md +0 -20
- package/lib/module/components/ChatKit/index.js +0 -48
- package/lib/module/components/ChatKit/index.js.map +0 -1
- package/lib/module/components/ChatKit/types.js.map +0 -1
- package/lib/module/components/ChatKit/useChatKeyboard/helpers.js +0 -92
- package/lib/module/components/ChatKit/useChatKeyboard/helpers.js.map +0 -1
- package/lib/module/components/ChatKit/useChatKeyboard/index.js +0 -141
- package/lib/module/components/ChatKit/useChatKeyboard/index.js.map +0 -1
- package/lib/typescript/components/ChatKit/hooks.d.ts +0 -2
- package/lib/typescript/components/ChatKit/index.d.ts +0 -14
- package/lib/typescript/components/ChatKit/useChatKeyboard/helpers.d.ts +0 -57
- package/lib/typescript/components/ChatKit/useChatKeyboard/index.d.ts +0 -36
- package/src/components/ChatKit/TODO.md +0 -20
- package/src/components/ChatKit/hooks.ts +0 -2
- package/src/components/ChatKit/index.tsx +0 -63
- package/src/components/ChatKit/useChatKeyboard/helpers.ts +0 -118
- package/src/components/ChatKit/useChatKeyboard/index.ts +0 -228
- /package/lib/commonjs/components/{ChatKit → KeyboardChatScrollView}/hooks.js +0 -0
- /package/lib/commonjs/components/{ChatKit → KeyboardChatScrollView}/types.js +0 -0
- /package/lib/module/components/{ChatKit → KeyboardChatScrollView}/hooks.js +0 -0
- /package/lib/module/components/{ChatKit → KeyboardChatScrollView}/types.js +0 -0
|
@@ -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_ENABLE
|
|
225
|
+
Class<RCTComponentViewProtocol> ClippingScrollViewDecoratorViewCls(void)
|
|
226
|
+
{
|
|
227
|
+
return ClippingScrollViewDecoratorView.class;
|
|
228
|
+
}
|
|
229
|
+
#endif
|
|
230
|
+
|
|
231
|
+
@end
|
|
@@ -27,7 +27,7 @@ class KeyboardControllerView: UIView {
|
|
|
27
27
|
var inputObserver: FocusedInputObserver?
|
|
28
28
|
private var eventDispatcher: RCTEventDispatcherProtocol
|
|
29
29
|
private var bridge: RCTBridge
|
|
30
|
-
|
|
30
|
+
/// internal state
|
|
31
31
|
private var lastScreenSize: CGSize = .zero
|
|
32
32
|
// react callbacks
|
|
33
33
|
/// keyboard
|
|
@@ -39,7 +39,7 @@ class KeyboardControllerView: UIView {
|
|
|
39
39
|
@objc var onFocusedInputLayoutChanged: RCTDirectEventBlock?
|
|
40
40
|
@objc var onFocusedInputTextChanged: RCTDirectEventBlock?
|
|
41
41
|
@objc var onFocusedInputSelectionChanged: RCTDirectEventBlock?
|
|
42
|
-
|
|
42
|
+
/// react props
|
|
43
43
|
@objc var enabled: ObjCBool = true {
|
|
44
44
|
didSet {
|
|
45
45
|
if enabled.boolValue {
|
|
@@ -83,9 +83,9 @@ class KeyboardControllerView: UIView {
|
|
|
83
83
|
fatalError("init(coder:) has not been implemented")
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
/// for mounting/unmounting observers for lifecycle events we're using willMove(toSuperview) method
|
|
87
|
+
/// not willMove(toWindow)
|
|
88
|
+
/// see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/271
|
|
89
89
|
override func willMove(toSuperview newSuperview: UIView?) {
|
|
90
90
|
super.willMove(toSuperview: newSuperview)
|
|
91
91
|
|
|
@@ -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,10 +122,15 @@ const mock = {
|
|
|
119
122
|
KeyboardStickyView: View,
|
|
120
123
|
KeyboardAvoidingView: View,
|
|
121
124
|
KeyboardAwareScrollView: ScrollView,
|
|
122
|
-
KeyboardToolbar: View,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
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
|
+
}),
|
|
133
|
+
KeyboardChatScrollView: ScrollView,
|
|
126
134
|
// themes
|
|
127
135
|
DefaultKeyboardToolbarTheme,
|
|
128
136
|
};
|
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":[]}
|
|
@@ -7,8 +7,12 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
|
|
10
|
+
var _bindings = require("../../bindings");
|
|
10
11
|
var _hooks = require("../../hooks");
|
|
12
|
+
var _findNodeHandle = require("../../utils/findNodeHandle");
|
|
13
|
+
var _useCombinedRef = _interopRequireDefault(require("../hooks/useCombinedRef"));
|
|
11
14
|
var _hooks2 = require("./hooks");
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
16
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
17
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
14
18
|
const defaultLayout = {
|
|
@@ -37,11 +41,13 @@ const KeyboardAvoidingView = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
37
41
|
contentContainerStyle,
|
|
38
42
|
enabled = true,
|
|
39
43
|
keyboardVerticalOffset = 0,
|
|
44
|
+
automaticOffset = false,
|
|
40
45
|
style,
|
|
41
46
|
onLayout: onLayoutProps,
|
|
42
47
|
...props
|
|
43
48
|
}, ref) => {
|
|
44
49
|
const initialFrame = (0, _reactNativeReanimated.useSharedValue)(null);
|
|
50
|
+
const internalRef = _react.default.useRef(null);
|
|
45
51
|
const frame = (0, _reactNativeReanimated.useDerivedValue)(() => initialFrame.value || defaultLayout);
|
|
46
52
|
const {
|
|
47
53
|
translate,
|
|
@@ -71,9 +77,28 @@ const KeyboardAvoidingView = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
71
77
|
}
|
|
72
78
|
}, [behavior]);
|
|
73
79
|
const onLayout = (0, _react.useCallback)(e => {
|
|
74
|
-
(0, _reactNativeReanimated.runOnUI)(onLayoutWorklet)(e.nativeEvent.layout);
|
|
75
80
|
onLayoutProps === null || onLayoutProps === void 0 || onLayoutProps(e);
|
|
76
|
-
|
|
81
|
+
const layout = e.nativeEvent.layout;
|
|
82
|
+
if (automaticOffset) {
|
|
83
|
+
const tag = (0, _findNodeHandle.findNodeHandle)(internalRef.current);
|
|
84
|
+
if (tag !== null) {
|
|
85
|
+
// Use native `viewPositionInWindow` to get true screen-absolute coordinates.
|
|
86
|
+
// This fixes current RN bugs:
|
|
87
|
+
// - https://github.com/facebook/react-native/pull/56062
|
|
88
|
+
// - https://github.com/facebook/react-native/pull/56056
|
|
89
|
+
return _bindings.KeyboardControllerNative.viewPositionInWindow(tag).then(position => {
|
|
90
|
+
(0, _reactNativeReanimated.runOnUI)(onLayoutWorklet)({
|
|
91
|
+
...layout,
|
|
92
|
+
x: position.x,
|
|
93
|
+
y: position.y
|
|
94
|
+
});
|
|
95
|
+
}).catch(() => {
|
|
96
|
+
(0, _reactNativeReanimated.runOnUI)(onLayoutWorklet)(layout);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return (0, _reactNativeReanimated.runOnUI)(onLayoutWorklet)(layout);
|
|
101
|
+
}, [onLayoutProps, automaticOffset]);
|
|
77
102
|
const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
|
|
78
103
|
if (!enabled) {
|
|
79
104
|
return {};
|
|
@@ -110,12 +135,13 @@ const KeyboardAvoidingView = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
110
135
|
return {};
|
|
111
136
|
}
|
|
112
137
|
}, [behavior, enabled, interpolateToRelativeKeyboardHeight]);
|
|
138
|
+
const combinedRef = (0, _useCombinedRef.default)(internalRef, ref);
|
|
113
139
|
const isPositionBehavior = behavior === "position";
|
|
114
140
|
const containerStyle = isPositionBehavior ? contentContainerStyle : style;
|
|
115
141
|
const combinedStyles = (0, _react.useMemo)(() => [containerStyle, animatedStyle], [containerStyle, animatedStyle]);
|
|
116
142
|
if (isPositionBehavior) {
|
|
117
143
|
return /*#__PURE__*/_react.default.createElement(_reactNative.View, _extends({
|
|
118
|
-
ref:
|
|
144
|
+
ref: combinedRef,
|
|
119
145
|
style: style,
|
|
120
146
|
onLayout: onLayout
|
|
121
147
|
}, props), /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
|
|
@@ -123,7 +149,7 @@ const KeyboardAvoidingView = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
123
149
|
}, children));
|
|
124
150
|
}
|
|
125
151
|
return /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, _extends({
|
|
126
|
-
ref:
|
|
152
|
+
ref: combinedRef,
|
|
127
153
|
style: combinedStyles,
|
|
128
154
|
onLayout: onLayout
|
|
129
155
|
}, props), children);
|