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.
Files changed (214) hide show
  1. package/README.md +1 -0
  2. package/android/src/base/java/com/reactnativekeyboardcontroller/KeyboardControllerPackage.kt +1 -0
  3. package/android/src/fabric/java/com/reactnativekeyboardcontroller/ClippingScrollViewDecoratorViewManager.kt +14 -0
  4. package/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardControllerModule.kt +8 -0
  5. package/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardToolbarGroupViewManager.kt +23 -0
  6. package/android/src/main/java/com/reactnativekeyboardcontroller/extensions/ReactContext.kt +12 -0
  7. package/android/src/main/java/com/reactnativekeyboardcontroller/listeners/FocusedInputObserver.kt +2 -1
  8. package/android/src/main/java/com/reactnativekeyboardcontroller/listeners/WindowDimensionListener.kt +5 -1
  9. package/android/src/main/java/com/reactnativekeyboardcontroller/managers/KeyboardToolbarGroupViewManagerImpl.kt +13 -0
  10. package/android/src/main/java/com/reactnativekeyboardcontroller/modal/ModalAttachedWatcher.kt +4 -6
  11. package/android/src/main/java/com/reactnativekeyboardcontroller/modules/KeyboardControllerModuleImpl.kt +26 -0
  12. package/android/src/main/java/com/reactnativekeyboardcontroller/traversal/ViewHierarchyNavigator.kt +31 -4
  13. package/android/src/main/java/com/reactnativekeyboardcontroller/views/ClippingScrollViewDecoratorView.kt +33 -1
  14. package/android/src/main/java/com/reactnativekeyboardcontroller/views/KeyboardToolbarGroupReactViewGroup.kt +13 -0
  15. package/android/src/main/jni/RNKC.h +2 -0
  16. package/android/src/paper/java/com/reactnativekeyboardcontroller/ClippingScrollViewDecoratorViewManager.kt +16 -0
  17. package/android/src/paper/java/com/reactnativekeyboardcontroller/KeyboardControllerModule.kt +9 -0
  18. package/android/src/paper/java/com/reactnativekeyboardcontroller/KeyboardToolbarGroupViewManager.kt +15 -0
  19. package/android/src/turbo/java/com/reactnativekeyboardcontroller/KeyboardControllerPackage.kt +2 -0
  20. package/common/cpp/react/renderer/components/RNKC/RNKCClippingScrollViewDecoratorViewComponentDescriptor.h +27 -0
  21. package/common/cpp/react/renderer/components/RNKC/RNKCClippingScrollViewDecoratorViewShadowNode.cpp +14 -0
  22. package/common/cpp/react/renderer/components/RNKC/RNKCClippingScrollViewDecoratorViewShadowNode.h +30 -0
  23. package/common/cpp/react/renderer/components/RNKC/RNKCClippingScrollViewDecoratorViewState.h +28 -0
  24. package/common/cpp/react/renderer/components/RNKC/RNKCKeyboardToolbarGroupViewComponentDescriptor.h +20 -0
  25. package/common/cpp/react/renderer/components/RNKC/RNKCKeyboardToolbarGroupViewShadowNode.cpp +7 -0
  26. package/common/cpp/react/renderer/components/RNKC/RNKCKeyboardToolbarGroupViewShadowNode.h +23 -0
  27. package/common/cpp/react/renderer/components/RNKC/RNKCKeyboardToolbarGroupViewState.h +21 -0
  28. package/ios/KeyboardControllerModule.mm +36 -0
  29. package/ios/animations/KeyboardAnimation.swift +2 -2
  30. package/ios/animations/SpringAnimation.swift +1 -1
  31. package/ios/animations/TimingAnimation.swift +1 -3
  32. package/ios/delegates/KCTextInputCompositeDelegate.swift +2 -2
  33. package/ios/extensions/CGFloat.swift +1 -3
  34. package/ios/extensions/UIApplication.swift +1 -1
  35. package/ios/interactive/KeyboardAreaExtender.swift +2 -1
  36. package/ios/observers/FocusedInputObserver.swift +6 -3
  37. package/ios/observers/movement/KeyboardTrackingView.swift +4 -1
  38. package/ios/observers/movement/observer/KeyboardMovementObserver+Interactive.swift +2 -0
  39. package/ios/observers/movement/observer/KeyboardMovementObserver+Listeners.swift +30 -7
  40. package/ios/observers/movement/observer/KeyboardMovementObserver.swift +2 -48
  41. package/ios/protocols/TextInput.swift +1 -1
  42. package/ios/swizzling/UIResponderSwizzle.swift +2 -4
  43. package/ios/traversal/FocusedInputHolder.swift +3 -3
  44. package/ios/traversal/KeyboardView.swift +1 -1
  45. package/ios/traversal/ViewHierarchyNavigator.swift +51 -5
  46. package/ios/views/ClippingScrollViewDecoratorViewManager.h +26 -0
  47. package/ios/views/ClippingScrollViewDecoratorViewManager.mm +231 -0
  48. package/ios/views/KeyboardControllerViewManager.swift +5 -5
  49. package/ios/views/KeyboardToolbarGroupViewManager.h +28 -0
  50. package/ios/views/KeyboardToolbarGroupViewManager.mm +88 -0
  51. package/jest/index.js +12 -4
  52. package/lib/commonjs/bindings.js +18 -2
  53. package/lib/commonjs/bindings.js.map +1 -1
  54. package/lib/commonjs/bindings.native.js +3 -4
  55. package/lib/commonjs/bindings.native.js.map +1 -1
  56. package/lib/commonjs/components/KeyboardAvoidingView/index.js +30 -4
  57. package/lib/commonjs/components/KeyboardAvoidingView/index.js.map +1 -1
  58. package/lib/commonjs/components/KeyboardAwareScrollView/index.js +55 -14
  59. package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
  60. package/lib/commonjs/components/{ChatKit → KeyboardChatScrollView}/hooks.js.map +1 -1
  61. package/lib/commonjs/components/KeyboardChatScrollView/index.js +111 -0
  62. package/lib/commonjs/components/KeyboardChatScrollView/index.js.map +1 -0
  63. package/lib/commonjs/components/KeyboardChatScrollView/types.js.map +1 -0
  64. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/helpers.js +221 -0
  65. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/helpers.js.map +1 -0
  66. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js +149 -0
  67. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js.map +1 -0
  68. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.js +240 -0
  69. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.js.map +1 -0
  70. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/types.js +6 -0
  71. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/types.js.map +1 -0
  72. package/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js +72 -0
  73. package/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js.map +1 -0
  74. package/lib/commonjs/components/KeyboardStickyView/index.js +3 -1
  75. package/lib/commonjs/components/KeyboardStickyView/index.js.map +1 -1
  76. package/lib/commonjs/components/KeyboardToolbar/index.js +1 -0
  77. package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -1
  78. package/lib/commonjs/components/ScrollViewWithBottomPadding/index.js +36 -15
  79. package/lib/commonjs/components/ScrollViewWithBottomPadding/index.js.map +1 -1
  80. package/lib/commonjs/components/hooks/useScrollState.js +20 -1
  81. package/lib/commonjs/components/hooks/useScrollState.js.map +1 -1
  82. package/lib/commonjs/components/index.js +7 -7
  83. package/lib/commonjs/components/index.js.map +1 -1
  84. package/lib/commonjs/index.js +7 -7
  85. package/lib/commonjs/index.js.map +1 -1
  86. package/lib/commonjs/specs/ClippingScrollViewDecoratorViewNativeComponent.js +1 -2
  87. package/lib/commonjs/specs/ClippingScrollViewDecoratorViewNativeComponent.js.map +1 -1
  88. package/lib/commonjs/specs/KeyboardToolbarGroupViewNativeComponent.js +12 -0
  89. package/lib/commonjs/specs/KeyboardToolbarGroupViewNativeComponent.js.map +1 -0
  90. package/lib/commonjs/specs/NativeKeyboardController.js.map +1 -1
  91. package/lib/commonjs/types/module.js.map +1 -1
  92. package/lib/commonjs/types/views.js.map +1 -1
  93. package/lib/module/bindings.js +17 -1
  94. package/lib/module/bindings.js.map +1 -1
  95. package/lib/module/bindings.native.js +2 -3
  96. package/lib/module/bindings.native.js.map +1 -1
  97. package/lib/module/components/KeyboardAvoidingView/index.js +29 -4
  98. package/lib/module/components/KeyboardAvoidingView/index.js.map +1 -1
  99. package/lib/module/components/KeyboardAwareScrollView/index.js +55 -14
  100. package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -1
  101. package/lib/module/components/{ChatKit → KeyboardChatScrollView}/hooks.js.map +1 -1
  102. package/lib/module/components/KeyboardChatScrollView/index.js +104 -0
  103. package/lib/module/components/KeyboardChatScrollView/index.js.map +1 -0
  104. package/lib/module/components/KeyboardChatScrollView/types.js.map +1 -0
  105. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/helpers.js +207 -0
  106. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/helpers.js.map +1 -0
  107. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js +143 -0
  108. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js.map +1 -0
  109. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.js +234 -0
  110. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.js.map +1 -0
  111. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/types.js +2 -0
  112. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/types.js.map +1 -0
  113. package/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js +67 -0
  114. package/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js.map +1 -0
  115. package/lib/module/components/KeyboardStickyView/index.js +3 -1
  116. package/lib/module/components/KeyboardStickyView/index.js.map +1 -1
  117. package/lib/module/components/KeyboardToolbar/index.js +2 -1
  118. package/lib/module/components/KeyboardToolbar/index.js.map +1 -1
  119. package/lib/module/components/ScrollViewWithBottomPadding/index.js +38 -17
  120. package/lib/module/components/ScrollViewWithBottomPadding/index.js.map +1 -1
  121. package/lib/module/components/hooks/useScrollState.js +21 -2
  122. package/lib/module/components/hooks/useScrollState.js.map +1 -1
  123. package/lib/module/components/index.js +1 -1
  124. package/lib/module/components/index.js.map +1 -1
  125. package/lib/module/index.js +1 -1
  126. package/lib/module/index.js.map +1 -1
  127. package/lib/module/specs/ClippingScrollViewDecoratorViewNativeComponent.js +1 -2
  128. package/lib/module/specs/ClippingScrollViewDecoratorViewNativeComponent.js.map +1 -1
  129. package/lib/module/specs/KeyboardToolbarGroupViewNativeComponent.js +5 -0
  130. package/lib/module/specs/KeyboardToolbarGroupViewNativeComponent.js.map +1 -0
  131. package/lib/module/specs/NativeKeyboardController.js.map +1 -1
  132. package/lib/module/types/module.js.map +1 -1
  133. package/lib/module/types/views.js.map +1 -1
  134. package/lib/typescript/bindings.d.ts +12 -2
  135. package/lib/typescript/bindings.native.d.ts +2 -1
  136. package/lib/typescript/components/KeyboardAvoidingView/index.d.ts +44 -13
  137. package/lib/typescript/components/KeyboardChatScrollView/hooks.d.ts +2 -0
  138. package/lib/typescript/components/KeyboardChatScrollView/index.d.ts +15 -0
  139. package/lib/typescript/components/{ChatKit → KeyboardChatScrollView}/types.d.ts +46 -6
  140. package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/helpers.d.ts +132 -0
  141. package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/index.d.ts +18 -0
  142. package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/index.ios.d.ts +21 -0
  143. package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/types.d.ts +37 -0
  144. package/lib/typescript/components/KeyboardChatScrollView/useExtraContentPadding/index.d.ts +43 -0
  145. package/lib/typescript/components/KeyboardToolbar/index.d.ts +2 -0
  146. package/lib/typescript/components/ScrollViewWithBottomPadding/index.d.ts +5 -4
  147. package/lib/typescript/components/hooks/useScrollState.d.ts +3 -0
  148. package/lib/typescript/components/index.d.ts +2 -2
  149. package/lib/typescript/index.d.ts +2 -2
  150. package/lib/typescript/specs/ClippingScrollViewDecoratorViewNativeComponent.d.ts +2 -0
  151. package/lib/typescript/specs/KeyboardToolbarGroupViewNativeComponent.d.ts +6 -0
  152. package/lib/typescript/specs/NativeKeyboardController.d.ts +1 -0
  153. package/lib/typescript/types/module.d.ts +7 -0
  154. package/lib/typescript/types/views.d.ts +4 -0
  155. package/package.json +6 -2
  156. package/react-native.config.js +2 -0
  157. package/src/bindings.native.ts +4 -4
  158. package/src/bindings.ts +15 -1
  159. package/src/components/KeyboardAvoidingView/index.tsx +56 -29
  160. package/src/components/KeyboardAwareScrollView/index.tsx +68 -13
  161. package/src/components/KeyboardChatScrollView/hooks.ts +2 -0
  162. package/src/components/KeyboardChatScrollView/index.tsx +150 -0
  163. package/src/components/{ChatKit → KeyboardChatScrollView}/types.ts +46 -6
  164. package/src/components/KeyboardChatScrollView/useChatKeyboard/helpers.ts +268 -0
  165. package/src/components/KeyboardChatScrollView/useChatKeyboard/index.ios.ts +260 -0
  166. package/src/components/KeyboardChatScrollView/useChatKeyboard/index.ts +376 -0
  167. package/src/components/KeyboardChatScrollView/useChatKeyboard/types.ts +39 -0
  168. package/src/components/KeyboardChatScrollView/useExtraContentPadding/index.ts +123 -0
  169. package/src/components/KeyboardStickyView/index.tsx +4 -3
  170. package/src/components/KeyboardToolbar/index.tsx +6 -1
  171. package/src/components/ScrollViewWithBottomPadding/index.tsx +53 -29
  172. package/src/components/hooks/useScrollState.ts +24 -2
  173. package/src/components/index.ts +2 -2
  174. package/src/index.ts +2 -2
  175. package/src/specs/ClippingScrollViewDecoratorViewNativeComponent.ts +2 -1
  176. package/src/specs/KeyboardToolbarGroupViewNativeComponent.ts +10 -0
  177. package/src/specs/NativeKeyboardController.ts +1 -0
  178. package/src/types/module.ts +9 -0
  179. package/src/types/views.ts +4 -0
  180. package/android/.settings/org.eclipse.buildship.core.prefs +0 -2
  181. package/ios/KeyboardController.xcodeproj/xcuserdata/kirylziusko.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
  182. package/ios/Tests/Tests.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  183. package/ios/Tests/Tests.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  184. package/ios/Tests/Tests.xcodeproj/project.xcworkspace/xcuserdata/kirylziusko.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  185. package/ios/Tests/Tests.xcodeproj/xcuserdata/kirylziusko.xcuserdatad/xcschemes/xcschememanagement.plist +0 -32
  186. package/lib/commonjs/components/ChatKit/TODO.md +0 -20
  187. package/lib/commonjs/components/ChatKit/index.js +0 -55
  188. package/lib/commonjs/components/ChatKit/index.js.map +0 -1
  189. package/lib/commonjs/components/ChatKit/types.js.map +0 -1
  190. package/lib/commonjs/components/ChatKit/useChatKeyboard/helpers.js +0 -101
  191. package/lib/commonjs/components/ChatKit/useChatKeyboard/helpers.js.map +0 -1
  192. package/lib/commonjs/components/ChatKit/useChatKeyboard/index.js +0 -147
  193. package/lib/commonjs/components/ChatKit/useChatKeyboard/index.js.map +0 -1
  194. package/lib/module/components/ChatKit/TODO.md +0 -20
  195. package/lib/module/components/ChatKit/index.js +0 -48
  196. package/lib/module/components/ChatKit/index.js.map +0 -1
  197. package/lib/module/components/ChatKit/types.js.map +0 -1
  198. package/lib/module/components/ChatKit/useChatKeyboard/helpers.js +0 -92
  199. package/lib/module/components/ChatKit/useChatKeyboard/helpers.js.map +0 -1
  200. package/lib/module/components/ChatKit/useChatKeyboard/index.js +0 -141
  201. package/lib/module/components/ChatKit/useChatKeyboard/index.js.map +0 -1
  202. package/lib/typescript/components/ChatKit/hooks.d.ts +0 -2
  203. package/lib/typescript/components/ChatKit/index.d.ts +0 -14
  204. package/lib/typescript/components/ChatKit/useChatKeyboard/helpers.d.ts +0 -57
  205. package/lib/typescript/components/ChatKit/useChatKeyboard/index.d.ts +0 -36
  206. package/src/components/ChatKit/TODO.md +0 -20
  207. package/src/components/ChatKit/hooks.ts +0 -2
  208. package/src/components/ChatKit/index.tsx +0 -63
  209. package/src/components/ChatKit/useChatKeyboard/helpers.ts +0 -118
  210. package/src/components/ChatKit/useChatKeyboard/index.ts +0 -228
  211. /package/lib/commonjs/components/{ChatKit → KeyboardChatScrollView}/hooks.js +0 -0
  212. /package/lib/commonjs/components/{ChatKit → KeyboardChatScrollView}/types.js +0 -0
  213. /package/lib/module/components/{ChatKit → KeyboardChatScrollView}/hooks.js +0 -0
  214. /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
- // internal state
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
- // react props
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
- // 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
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
- ChatKit: {
124
- ScrollView: ScrollView,
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
  };
@@ -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.\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 */\nexport const ClippingScrollView =\n View as unknown as React.FC<ClippingScrollViewProps>;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAgBA,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,WAAW,EAAER,IAAI;EACjBS,eAAe,EAAET;AACnB,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMU,cAAoC,GAAAR,OAAA,CAAAQ,cAAA,GAAG;EAClDF,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAEX;EAAK,CAAC;AACtC,CAAC;AACD;AACA;AACA;AACA;AACO,MAAMY,kBAA4C,GAAAV,OAAA,CAAAU,kBAAA,GAAG;EAC1DJ,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAEX;EAAK,CAAC;AACtC,CAAC;AACM,MAAMa,sBAAoD,GAAAX,OAAA,CAAAW,sBAAA,GAAG;EAClEL,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAEX;EAAK,CAAC;AACtC,CAAC;AACD;AACA;AACA;AACA;AACA;AACO,MAAMc,sBAAsB,GAAAZ,OAAA,CAAAY,sBAAA,GACjCC,iBAAoD;AAC/C,MAAMC,8BAA8B,GAAAd,OAAA,CAAAc,8BAAA,GAAG;EAC5CC,6BAA6B,EAC3BC,IAAqD,IAClD,CAAC;AACR,CAAC;AACD;AACA;AACA;AACA;AACA;AACO,MAAMC,mBAAmB,GAAAjB,OAAA,CAAAiB,mBAAA,GAC9BJ,iBAAqD;AAChD,MAAMK,mBAAmB,GAAAlB,OAAA,CAAAkB,mBAAA,GAC9BL,iBAAkD;AACpD;AACA;AACA;AACA;AACA;AACO,MAAMM,sBAAsB,GAAAnB,OAAA,CAAAmB,sBAAA,GACjCN,iBAAwD;AAC1D;AACA;AACA;AACA;AACA;AACA;AACO,MAAMO,mBAAmB,GAAApB,OAAA,CAAAoB,mBAAA,GAC9BP,iBAAkD;AACpD;AACA;AACA;AACA;AACA;AACO,MAAMQ,kBAAkB,GAAArB,OAAA,CAAAqB,kBAAA,GAC7BR,iBAAoD","ignoreList":[]}
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 = _reactNative.Platform.OS === "android" ? require("./specs/ClippingScrollViewDecoratorViewNativeComponent").default : ({
46
- children
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 ClippingScrollViewProps,\n FocusedInputEventsModule,\n KeyboardBackgroundViewProps,\n KeyboardControllerNativeModule,\n KeyboardControllerProps,\n KeyboardEventsModule,\n KeyboardExtenderProps,\n KeyboardGestureAreaProps,\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 Platform.OS === \"android\"\n ? require(\"./specs/ClippingScrollViewDecoratorViewNativeComponent\").default\n : ({ children }: ClippingScrollViewProps) => children;\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,GACpE9B,qBAAQ,CAACwB,EAAE,KAAK,SAAS,GACrB1B,OAAO,CAAC,wDAAwD,CAAC,CAACK,OAAO,GACzE,CAAC;EAAEuB;AAAkC,CAAC,KAAKA,QAAQ","ignoreList":[]}
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
- }, [onLayoutProps]);
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: 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: ref,
152
+ ref: combinedRef,
127
153
  style: combinedStyles,
128
154
  onLayout: onLayout
129
155
  }, props), children);