react-native-keyboard-controller 1.17.4 → 1.18.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 (185) hide show
  1. package/README.md +4 -1
  2. package/android/src/base/java/com/reactnativekeyboardcontroller/KeyboardControllerPackage.kt +6 -5
  3. package/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardBackgroundViewManager.kt +19 -0
  4. package/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardControllerModule.kt +4 -0
  5. package/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardControllerViewManager.kt +3 -5
  6. package/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardGestureAreaViewManager.kt +3 -5
  7. package/android/src/fabric/java/com/reactnativekeyboardcontroller/OverKeyboardViewManager.kt +3 -5
  8. package/android/src/fabric/java/com/reactnativekeyboardcontroller/StatusBarManagerCompatModule.kt +3 -1
  9. package/android/src/main/java/com/reactnativekeyboardcontroller/extensions/Context.kt +20 -0
  10. package/android/src/main/java/com/reactnativekeyboardcontroller/extensions/ThemedReactContext.kt +2 -12
  11. package/android/src/main/java/com/reactnativekeyboardcontroller/managers/KeyboardBackgroundViewManagerImpl.kt +13 -0
  12. package/android/src/main/java/com/reactnativekeyboardcontroller/managers/KeyboardControllerViewManagerImpl.kt +2 -6
  13. package/android/src/main/java/com/reactnativekeyboardcontroller/managers/KeyboardGestureAreaViewManagerImpl.kt +1 -5
  14. package/android/src/main/java/com/reactnativekeyboardcontroller/managers/OverKeyboardViewManagerImpl.kt +1 -5
  15. package/android/src/main/java/com/reactnativekeyboardcontroller/modules/KeyboardControllerModuleImpl.kt +4 -0
  16. package/android/src/main/java/com/reactnativekeyboardcontroller/modules/{StatusBarManagerCompatModuleImpl.kt → statusbar/StatusBarManagerCompatModuleImpl.kt} +31 -5
  17. package/android/src/main/java/com/reactnativekeyboardcontroller/modules/statusbar/StatusBarModuleProxy.kt +86 -0
  18. package/android/src/main/java/com/reactnativekeyboardcontroller/views/EdgeToEdgeReactViewGroup.kt +9 -11
  19. package/android/src/main/java/com/reactnativekeyboardcontroller/views/background/KeyboardBackgroundViewGroup.kt +35 -0
  20. package/android/src/main/java/com/reactnativekeyboardcontroller/views/background/Skins.kt +91 -0
  21. package/android/src/main/jni/reactnativekeyboardcontroller.h +1 -0
  22. package/android/src/main/res/values/attrs.xml +7 -0
  23. package/android/src/main/res/values/colors.xml +35 -0
  24. package/android/src/main/res/values-v29/colors.xml +5 -0
  25. package/android/src/main/res/values-v30/colors.xml +17 -0
  26. package/android/src/main/res/values-v33/colors.xml +16 -0
  27. package/android/src/main/res/values-v34/colors.xml +18 -0
  28. package/android/src/main/res/values-v35/colors.xml +10 -0
  29. package/android/src/paper/java/com/reactnativekeyboardcontroller/KeyboardBackgroundViewManager.kt +15 -0
  30. package/android/src/paper/java/com/reactnativekeyboardcontroller/KeyboardControllerModule.kt +5 -0
  31. package/android/src/paper/java/com/reactnativekeyboardcontroller/KeyboardControllerViewManager.kt +2 -5
  32. package/android/src/paper/java/com/reactnativekeyboardcontroller/KeyboardGestureAreaViewManager.kt +2 -5
  33. package/android/src/paper/java/com/reactnativekeyboardcontroller/OverKeyboardViewManager.kt +2 -5
  34. package/android/src/paper/java/com/reactnativekeyboardcontroller/StatusBarManagerCompatModule.kt +3 -1
  35. package/android/src/turbo/java/com/reactnativekeyboardcontroller/KeyboardControllerPackage.kt +5 -5
  36. package/common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardBackgroundViewComponentDescriptor.h +27 -0
  37. package/common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardBackgroundViewShadowNode.cpp +14 -0
  38. package/common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardBackgroundViewShadowNode.h +30 -0
  39. package/common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardBackgroundViewState.h +28 -0
  40. package/common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardExtenderComponentDescriptor.h +27 -0
  41. package/common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardExtenderShadowNode.cpp +14 -0
  42. package/common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardExtenderShadowNode.h +30 -0
  43. package/common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardExtenderState.h +28 -0
  44. package/ios/KeyboardControllerModule.mm +9 -0
  45. package/ios/delegates/KCTextInputCompositeDelegate.swift +5 -5
  46. package/ios/events/KeyboardEventEmitterPayload.swift +1 -1
  47. package/ios/extensions/String.swift +12 -0
  48. package/ios/extensions/UIResponder.swift +27 -0
  49. package/ios/interactive/KeyboardAreaExtender.swift +5 -5
  50. package/ios/observers/FocusedInputObserver.swift +14 -5
  51. package/ios/observers/KeyboardMovementObserver.swift +24 -9
  52. package/ios/protocols/TextInput.swift +22 -0
  53. package/ios/swizzling/UIResponderSwizzle.swift +3 -0
  54. package/ios/traversal/KeyboardView.swift +6 -3
  55. package/ios/views/KeyboardBackgroundViewManager.h +29 -0
  56. package/ios/views/KeyboardBackgroundViewManager.mm +168 -0
  57. package/ios/views/KeyboardExtenderContainerView.swift +59 -0
  58. package/ios/views/KeyboardExtenderManager.h +29 -0
  59. package/ios/views/KeyboardExtenderManager.mm +287 -0
  60. package/jest/index.js +6 -1
  61. package/lib/commonjs/animated.js +7 -10
  62. package/lib/commonjs/animated.js.map +1 -1
  63. package/lib/commonjs/bindings.js +15 -1
  64. package/lib/commonjs/bindings.js.map +1 -1
  65. package/lib/commonjs/bindings.native.js +5 -1
  66. package/lib/commonjs/bindings.native.js.map +1 -1
  67. package/lib/commonjs/components/KeyboardAwareScrollView/index.js +49 -29
  68. package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
  69. package/lib/commonjs/components/KeyboardToolbar/Arrow.js +2 -3
  70. package/lib/commonjs/components/KeyboardToolbar/Arrow.js.map +1 -1
  71. package/lib/commonjs/components/KeyboardToolbar/Button.js +2 -3
  72. package/lib/commonjs/components/KeyboardToolbar/Button.js.map +1 -1
  73. package/lib/commonjs/components/KeyboardToolbar/constants.js +17 -0
  74. package/lib/commonjs/components/KeyboardToolbar/constants.js.map +1 -0
  75. package/lib/commonjs/components/KeyboardToolbar/index.js +25 -22
  76. package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -1
  77. package/lib/commonjs/hooks/useKeyboardState/index.js +18 -8
  78. package/lib/commonjs/hooks/useKeyboardState/index.js.map +1 -1
  79. package/lib/commonjs/index.js +8 -1
  80. package/lib/commonjs/index.js.map +1 -1
  81. package/lib/commonjs/module.js +2 -1
  82. package/lib/commonjs/module.js.map +1 -1
  83. package/lib/commonjs/specs/KeyboardBackgroundViewNativeComponent.js +12 -0
  84. package/lib/commonjs/specs/KeyboardBackgroundViewNativeComponent.js.map +1 -0
  85. package/lib/commonjs/specs/KeyboardExtenderNativeComponent.js +13 -0
  86. package/lib/commonjs/specs/KeyboardExtenderNativeComponent.js.map +1 -0
  87. package/lib/commonjs/specs/NativeKeyboardController.js.map +1 -1
  88. package/lib/commonjs/types/module.js.map +1 -1
  89. package/lib/commonjs/types/views.js.map +1 -1
  90. package/lib/commonjs/views/KeyboardExtender/index.ios.js +43 -0
  91. package/lib/commonjs/views/KeyboardExtender/index.ios.js.map +1 -0
  92. package/lib/commonjs/views/KeyboardExtender/index.js +46 -0
  93. package/lib/commonjs/views/KeyboardExtender/index.js.map +1 -0
  94. package/lib/commonjs/views/index.js +7 -0
  95. package/lib/commonjs/views/index.js.map +1 -1
  96. package/lib/module/animated.js +8 -11
  97. package/lib/module/animated.js.map +1 -1
  98. package/lib/module/bindings.js +14 -0
  99. package/lib/module/bindings.js.map +1 -1
  100. package/lib/module/bindings.native.js +4 -0
  101. package/lib/module/bindings.native.js.map +1 -1
  102. package/lib/module/components/KeyboardAwareScrollView/index.js +50 -30
  103. package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -1
  104. package/lib/module/components/KeyboardToolbar/Arrow.js +2 -2
  105. package/lib/module/components/KeyboardToolbar/Arrow.js.map +1 -1
  106. package/lib/module/components/KeyboardToolbar/Button.js +2 -2
  107. package/lib/module/components/KeyboardToolbar/Button.js.map +1 -1
  108. package/lib/module/components/KeyboardToolbar/constants.js +11 -0
  109. package/lib/module/components/KeyboardToolbar/constants.js.map +1 -0
  110. package/lib/module/components/KeyboardToolbar/index.js +17 -14
  111. package/lib/module/components/KeyboardToolbar/index.js.map +1 -1
  112. package/lib/module/hooks/useKeyboardState/index.js +18 -6
  113. package/lib/module/hooks/useKeyboardState/index.js.map +1 -1
  114. package/lib/module/index.js +1 -1
  115. package/lib/module/index.js.map +1 -1
  116. package/lib/module/module.js +2 -1
  117. package/lib/module/module.js.map +1 -1
  118. package/lib/module/specs/KeyboardBackgroundViewNativeComponent.js +5 -0
  119. package/lib/module/specs/KeyboardBackgroundViewNativeComponent.js.map +1 -0
  120. package/lib/module/specs/KeyboardExtenderNativeComponent.js +6 -0
  121. package/lib/module/specs/KeyboardExtenderNativeComponent.js.map +1 -0
  122. package/lib/module/specs/NativeKeyboardController.js.map +1 -1
  123. package/lib/module/types/module.js.map +1 -1
  124. package/lib/module/types/views.js.map +1 -1
  125. package/lib/module/views/KeyboardExtender/index.ios.js +36 -0
  126. package/lib/module/views/KeyboardExtender/index.ios.js.map +1 -0
  127. package/lib/module/views/KeyboardExtender/index.js +39 -0
  128. package/lib/module/views/KeyboardExtender/index.js.map +1 -0
  129. package/lib/module/views/index.js +1 -0
  130. package/lib/module/views/index.js.map +1 -1
  131. package/lib/typescript/animated.d.ts +7 -0
  132. package/lib/typescript/bindings.d.ts +14 -1
  133. package/lib/typescript/bindings.native.d.ts +3 -1
  134. package/lib/typescript/components/KeyboardAwareScrollView/index.d.ts +2 -2
  135. package/lib/typescript/components/KeyboardToolbar/constants.d.ts +10 -0
  136. package/lib/typescript/hooks/useKeyboardState/index.d.ts +8 -2
  137. package/lib/typescript/index.d.ts +1 -1
  138. package/lib/typescript/specs/KeyboardBackgroundViewNativeComponent.d.ts +6 -0
  139. package/lib/typescript/specs/KeyboardExtenderNativeComponent.d.ts +7 -0
  140. package/lib/typescript/specs/NativeKeyboardController.d.ts +1 -0
  141. package/lib/typescript/types/module.d.ts +15 -3
  142. package/lib/typescript/types/views.d.ts +5 -0
  143. package/lib/typescript/views/KeyboardExtender/index.d.ts +19 -0
  144. package/lib/typescript/views/KeyboardExtender/index.ios.d.ts +19 -0
  145. package/lib/typescript/views/index.d.ts +1 -0
  146. package/package.json +7 -3
  147. package/react-native.config.js +1 -0
  148. package/src/animated.tsx +14 -9
  149. package/src/bindings.native.ts +8 -0
  150. package/src/bindings.ts +18 -0
  151. package/src/components/KeyboardAwareScrollView/index.tsx +72 -47
  152. package/src/components/KeyboardToolbar/Arrow.tsx +2 -2
  153. package/src/components/KeyboardToolbar/Button.tsx +2 -2
  154. package/src/components/KeyboardToolbar/constants.ts +15 -0
  155. package/src/components/KeyboardToolbar/index.tsx +45 -17
  156. package/src/hooks/useKeyboardState/index.ts +25 -6
  157. package/src/index.ts +1 -1
  158. package/src/module.ts +2 -1
  159. package/src/specs/KeyboardBackgroundViewNativeComponent.ts +10 -0
  160. package/src/specs/KeyboardExtenderNativeComponent.ts +13 -0
  161. package/src/specs/NativeKeyboardController.ts +1 -0
  162. package/src/types/module.ts +17 -3
  163. package/src/types/views.ts +5 -0
  164. package/src/views/KeyboardExtender/index.ios.tsx +35 -0
  165. package/src/views/KeyboardExtender/index.tsx +42 -0
  166. package/src/views/index.ts +1 -0
  167. package/ios/extensions/UIKeyboardAppearance.swift +0 -21
  168. package/lib/commonjs/components/hooks/useColorScheme.js +0 -10
  169. package/lib/commonjs/components/hooks/useColorScheme.js.map +0 -1
  170. package/lib/commonjs/monkey-patch.android.js +0 -53
  171. package/lib/commonjs/monkey-patch.android.js.map +0 -1
  172. package/lib/commonjs/monkey-patch.js +0 -11
  173. package/lib/commonjs/monkey-patch.js.map +0 -1
  174. package/lib/module/components/hooks/useColorScheme.js +0 -4
  175. package/lib/module/components/hooks/useColorScheme.js.map +0 -1
  176. package/lib/module/monkey-patch.android.js +0 -42
  177. package/lib/module/monkey-patch.android.js.map +0 -1
  178. package/lib/module/monkey-patch.js +0 -5
  179. package/lib/module/monkey-patch.js.map +0 -1
  180. package/lib/typescript/components/hooks/useColorScheme.d.ts +0 -2
  181. package/lib/typescript/monkey-patch.android.d.ts +0 -2
  182. package/lib/typescript/monkey-patch.d.ts +0 -2
  183. package/src/components/hooks/useColorScheme.ts +0 -5
  184. package/src/monkey-patch.android.ts +0 -41
  185. package/src/monkey-patch.ts +0 -5
@@ -0,0 +1,287 @@
1
+ //
2
+ // KeyboardExtenderManager.mm
3
+ // react-native-keyboard-controller
4
+ //
5
+ // Created by Kiryl Ziusko on 13/04/2025.
6
+ //
7
+
8
+ #import "KeyboardExtenderManager.h"
9
+
10
+ #if __has_include("react_native_keyboard_controller-Swift.h")
11
+ #import "react_native_keyboard_controller-Swift.h"
12
+ #else
13
+ #import <react_native_keyboard_controller/react_native_keyboard_controller-Swift.h>
14
+ #endif
15
+
16
+ #ifdef RCT_NEW_ARCH_ENABLED
17
+ #import <React/RCTSurfaceTouchHandler.h>
18
+
19
+ #import <react/renderer/components/reactnativekeyboardcontroller/EventEmitters.h>
20
+ #import <react/renderer/components/reactnativekeyboardcontroller/Props.h>
21
+ #import <react/renderer/components/reactnativekeyboardcontroller/RCTComponentViewHelpers.h>
22
+ #import <react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardExtenderComponentDescriptor.h>
23
+
24
+ #import "RCTFabricComponentsPlugins.h"
25
+ #endif
26
+
27
+ #import <React/RCTTouchHandler.h>
28
+ #import <UIKit/UIKit.h>
29
+
30
+ #ifdef RCT_NEW_ARCH_ENABLED
31
+ using namespace facebook::react;
32
+ #endif
33
+
34
+ // MARK: Manager
35
+ @implementation KeyboardExtenderManager
36
+
37
+ RCT_EXPORT_MODULE(KeyboardExtenderManager)
38
+
39
+ // Expose the `enabled` prop to React Native
40
+ RCT_EXPORT_VIEW_PROPERTY(enabled, BOOL)
41
+
42
+ + (BOOL)requiresMainQueueSetup
43
+ {
44
+ return NO;
45
+ }
46
+
47
+ #ifndef RCT_NEW_ARCH_ENABLED
48
+ - (UIView *)view
49
+ {
50
+ return [[KeyboardExtender alloc] initWithBridge:self.bridge];
51
+ }
52
+ #endif
53
+
54
+ @end
55
+
56
+ // MARK: View
57
+ #ifdef RCT_NEW_ARCH_ENABLED
58
+ @interface KeyboardExtender () <RCTKeyboardExtenderViewProtocol>
59
+ @end
60
+ #endif
61
+
62
+ @implementation KeyboardExtender {
63
+ UIView *_contentView;
64
+ UIView *_sharedInputAccessoryView;
65
+ #ifdef RCT_NEW_ARCH_ENABLED
66
+ RCTSurfaceTouchHandler *_touchHandler;
67
+ #else
68
+ RCTTouchHandler *_touchHandler;
69
+ #endif
70
+ }
71
+
72
+ #ifdef RCT_NEW_ARCH_ENABLED
73
+ + (ComponentDescriptorProvider)componentDescriptorProvider
74
+ {
75
+ return concreteComponentDescriptorProvider<KeyboardExtenderComponentDescriptor>();
76
+ }
77
+ #endif
78
+
79
+ // Needed because of this: https://github.com/facebook/react-native/pull/37274
80
+ + (void)load
81
+ {
82
+ [super load];
83
+ }
84
+
85
+ // MARK: Constructor
86
+ #ifdef RCT_NEW_ARCH_ENABLED
87
+ - (instancetype)init
88
+ {
89
+ if (self = [super init]) {
90
+ _touchHandler = [RCTSurfaceTouchHandler new];
91
+ _contentView = [[UIView alloc] initWithFrame:CGRectZero];
92
+ }
93
+ #else
94
+ - (instancetype)initWithBridge:(RCTBridge *)bridge
95
+ {
96
+ self = [super initWithFrame:CGRectZero];
97
+ if (self) {
98
+ _touchHandler = [[RCTTouchHandler alloc] initWithBridge:bridge];
99
+ _contentView = [[UIView alloc] initWithFrame:CGRectZero];
100
+ }
101
+ #endif
102
+ [_touchHandler attachToView:_contentView];
103
+ [self setupObservers];
104
+ return self;
105
+ }
106
+
107
+ - (void)dealloc
108
+ {
109
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
110
+ }
111
+
112
+ // MARK: Listeners
113
+ - (void)setupObservers
114
+ {
115
+ [[NSNotificationCenter defaultCenter] addObserver:self
116
+ selector:@selector(handleTextInputDidBeginEditing:)
117
+ name:UITextFieldTextDidBeginEditingNotification
118
+ object:nil];
119
+
120
+ [[NSNotificationCenter defaultCenter] addObserver:self
121
+ selector:@selector(handleTextInputDidBeginEditing:)
122
+ name:UITextViewTextDidBeginEditingNotification
123
+ object:nil];
124
+ }
125
+
126
+ - (void)handleTextInputDidBeginEditing:(NSNotification *)notification
127
+ {
128
+ if (self.enabled) {
129
+ [self attachToTextInput:(UIView *)notification.object];
130
+ } else {
131
+ [self detachInputAccessoryView];
132
+ }
133
+ }
134
+
135
+ - (void)attachToTextInput:(UIView *)textInput
136
+ {
137
+ if ([textInput isKindOfClass:[UITextField class]]) {
138
+ [self attachInputAccessoryViewTo:(UITextField *)textInput];
139
+ } else if ([textInput isKindOfClass:[UITextView class]]) {
140
+ [self attachInputAccessoryViewTo:(UITextView *)textInput];
141
+ }
142
+ }
143
+
144
+ - (void)createSharedInputAccessoryView
145
+ {
146
+ CGRect internalFrame = _contentView.subviews[0].frame;
147
+ _sharedInputAccessoryView = [KeyboardExtenderContainerView
148
+ createWithFrame:CGRectMake(
149
+ 0, 0, UIScreen.mainScreen.bounds.size.width, internalFrame.size.height)
150
+ contentView:_contentView];
151
+ }
152
+
153
+ - (void)attachInputAccessoryViewTo:(UIView<UITextInput> *)input
154
+ {
155
+ // Initialize the shared input accessory view once
156
+ if (!_sharedInputAccessoryView) {
157
+ [self createSharedInputAccessoryView];
158
+ }
159
+
160
+ // Assign the inputAccessoryView
161
+ if ([input isKindOfClass:[UITextField class]]) {
162
+ ((UITextField *)input).inputAccessoryView = _sharedInputAccessoryView;
163
+ } else if ([input isKindOfClass:[UITextView class]]) {
164
+ ((UITextView *)input).inputAccessoryView = _sharedInputAccessoryView;
165
+ }
166
+
167
+ // Refresh input view to apply changes
168
+ [input reloadInputViews];
169
+ }
170
+
171
+ - (void)detachInputAccessoryView
172
+ {
173
+ // Remove the accessory view from the current text input
174
+ UIResponder *firstResponder = [UIResponder current];
175
+ if ([firstResponder isKindOfClass:[UITextField class]] ||
176
+ [firstResponder isKindOfClass:[UITextView class]]) {
177
+ UIView<UITextInput> *textInput = (UIView<UITextInput> *)firstResponder;
178
+ if (textInput.inputAccessoryView == _sharedInputAccessoryView) {
179
+ // Assign the inputAccessoryView
180
+ if ([textInput isKindOfClass:[UITextField class]]) {
181
+ ((UITextField *)textInput).inputAccessoryView = nil;
182
+ } else if ([textInput isKindOfClass:[UITextView class]]) {
183
+ ((UITextView *)textInput).inputAccessoryView = nil;
184
+ }
185
+ [textInput reloadInputViews];
186
+ }
187
+ }
188
+ }
189
+
190
+ // MARK: touch handling
191
+ - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
192
+ {
193
+ BOOL canReceiveTouchEvents = ([self isUserInteractionEnabled] && ![self isHidden] && _enabled);
194
+ if (!canReceiveTouchEvents) {
195
+ return nil;
196
+ }
197
+
198
+ // `hitSubview` is the topmost subview which was hit. The hit point can
199
+ // be outside the bounds of `view` (e.g., if -clipsToBounds is NO).
200
+ UIView *hitSubview = nil;
201
+ BOOL isPointInside = [self pointInside:point withEvent:event];
202
+ if (![self clipsToBounds] || isPointInside) {
203
+ // TODO: should we take zIndex into consideration?
204
+ // The default behaviour of UIKit is that if a view does not contain a point,
205
+ // then no subviews will be returned from hit testing, even if they contain
206
+ // the hit point. By doing hit testing directly on the subviews, we bypass
207
+ // the strict containment policy (i.e., UIKit guarantees that every ancestor
208
+ // of the hit view will return YES from -pointInside:withEvent:). See:
209
+ // - https://developer.apple.com/library/ios/qa/qa2013/qa1812.html
210
+ for (UIView *subview in [_contentView.subviews reverseObjectEnumerator]) {
211
+ CGPoint convertedPoint = [subview convertPoint:point fromView:self];
212
+ hitSubview = [subview hitTest:convertedPoint withEvent:event];
213
+ if (hitSubview != nil) {
214
+ break;
215
+ }
216
+ }
217
+ }
218
+ return hitSubview;
219
+ }
220
+
221
+ // MARK: props updater
222
+ #ifdef RCT_NEW_ARCH_ENABLED
223
+ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
224
+ {
225
+ const auto &oldViewProps = *std::static_pointer_cast<const KeyboardExtenderProps>(_props);
226
+ const auto &newViewProps = *std::static_pointer_cast<const KeyboardExtenderProps>(props);
227
+
228
+ if (newViewProps.enabled != oldViewProps.enabled) {
229
+ [self updateEnabledState:newViewProps.enabled];
230
+ }
231
+
232
+ [super updateProps:props oldProps:oldProps];
233
+ }
234
+ #else
235
+ - (void)setEnabled:(BOOL)enabled
236
+ {
237
+ _enabled = enabled;
238
+
239
+ [self updateEnabledState:enabled];
240
+ }
241
+ #endif
242
+
243
+ - (void)updateEnabledState:(BOOL)enabled
244
+ {
245
+ _enabled = enabled;
246
+
247
+ if (_sharedInputAccessoryView) {
248
+ if (!enabled) {
249
+ [self detachInputAccessoryView];
250
+ } else {
251
+ // Re-attach if a text input is active
252
+ UIResponder *firstResponder = [UIResponder current];
253
+ if ([firstResponder conformsToProtocol:@protocol(UITextInput)]) {
254
+ [self attachToTextInput:(UIView *)firstResponder];
255
+ }
256
+ }
257
+ }
258
+ }
259
+
260
+ // MARK: child management
261
+ #ifdef RCT_NEW_ARCH_ENABLED
262
+ - (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView
263
+ index:(NSInteger)index
264
+ {
265
+ [_contentView insertSubview:childComponentView atIndex:index];
266
+ }
267
+
268
+ - (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView
269
+ index:(NSInteger)index
270
+ {
271
+ [childComponentView removeFromSuperview];
272
+ }
273
+ #else
274
+ - (void)addSubview:(UIView *)view
275
+ {
276
+ [_contentView addSubview:view];
277
+ }
278
+ #endif
279
+
280
+ #ifdef RCT_NEW_ARCH_ENABLED
281
+ Class<RCTComponentViewProtocol> KeyboardExtenderCls(void)
282
+ {
283
+ return KeyboardExtender.class;
284
+ }
285
+ #endif
286
+
287
+ @end
package/jest/index.js CHANGED
@@ -51,7 +51,9 @@ const mock = {
51
51
  useGenericKeyboardHandler: jest.fn(),
52
52
  useKeyboardHandler: jest.fn(),
53
53
  useKeyboardContext: jest.fn().mockReturnValue(values),
54
- useKeyboardState: jest.fn().mockReturnValue(state),
54
+ useKeyboardState: jest
55
+ .fn()
56
+ .mockImplementation((selector) => (selector ? selector(state) : state)),
55
57
  /// input
56
58
  useReanimatedFocusedInput: jest.fn().mockReturnValue(focusedInput),
57
59
  useFocusedInputHandler: jest.fn(),
@@ -65,6 +67,7 @@ const mock = {
65
67
  KeyboardController: {
66
68
  setInputMode: jest.fn(),
67
69
  setDefaultMode: jest.fn(),
70
+ preload: jest.fn(),
68
71
  dismiss: jest.fn().mockReturnValue(Promise.resolve()),
69
72
  setFocusTo: jest.fn(),
70
73
  isVisible: jest.fn().mockReturnValue(false),
@@ -93,6 +96,8 @@ const mock = {
93
96
  KeyboardControllerView: "KeyboardControllerView",
94
97
  KeyboardGestureArea: "KeyboardGestureArea",
95
98
  OverKeyboardView: "OverKeyboardView",
99
+ KeyboardBackgroundView: "KeyboardBackgroundView",
100
+ KeyboardExtender: "KeyboardExtender",
96
101
  // providers
97
102
  KeyboardProvider: "KeyboardProvider",
98
103
  // components
@@ -12,7 +12,7 @@ var _bindings = require("./bindings");
12
12
  var _context = require("./context");
13
13
  var _eventMappings = require("./event-mappings");
14
14
  var _internal = require("./internal");
15
- var _monkeyPatch = require("./monkey-patch");
15
+ var _module = require("./module");
16
16
  var _reanimated = require("./reanimated");
17
17
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
18
18
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -53,7 +53,8 @@ const KeyboardProvider = props => {
53
53
  statusBarTranslucent,
54
54
  navigationBarTranslucent,
55
55
  preserveEdgeToEdge,
56
- enabled: initiallyEnabled = true
56
+ enabled: initiallyEnabled = true,
57
+ preload = true
57
58
  } = props;
58
59
  // ref
59
60
  const viewTagRef = (0, _react.useRef)(null);
@@ -144,15 +145,11 @@ const KeyboardProvider = props => {
144
145
  }
145
146
  }
146
147
  }, []);
147
-
148
- // layout effects
149
- (0, _react.useLayoutEffect)(() => {
150
- if (enabled) {
151
- (0, _monkeyPatch.applyMonkeyPatch)();
152
- } else {
153
- (0, _monkeyPatch.revertMonkeyPatch)();
148
+ (0, _react.useEffect)(() => {
149
+ if (preload) {
150
+ _module.KeyboardController.preload();
154
151
  }
155
- }, [enabled]);
152
+ }, [preload]);
156
153
  if (__DEV__) {
157
154
  (0, _reactNativeIsEdgeToEdge.controlEdgeToEdgeValues)({
158
155
  statusBarTranslucent,
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeIsEdgeToEdge","_reactNativeReanimated","_bindings","_context","_eventMappings","_internal","_monkeyPatch","_reanimated","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","IS_EDGE_TO_EDGE","isEdgeToEdge","KeyboardControllerViewAnimated","Reanimated","createAnimatedComponent","Animated","KeyboardControllerView","styles","StyleSheet","create","container","flex","hidden","display","position","OS","Platform","KeyboardProvider","props","children","statusBarTranslucent","navigationBarTranslucent","preserveEdgeToEdge","enabled","initiallyEnabled","viewTagRef","useRef","setEnabled","useState","progress","useAnimatedValue","height","progressSV","useSharedValue","heightSV","layout","setKeyboardHandlers","useEventHandlerRegistration","keyboardEventsMap","setInputHandlers","focusedInputEventsMap","context","useMemo","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","value","keyboardHandler","useAnimatedKeyboardHandler","onKeyboardMoveStart","onKeyboardMoveInteractive","onKeyboardMoveEnd","inputLayoutHandler","useFocusedInputLayoutHandler","onFocusedInputLayoutChanged","target","useLayoutEffect","applyMonkeyPatch","revertMonkeyPatch","__DEV__","controlEdgeToEdgeValues","createElement","KeyboardContext","Provider","ref","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","View","exports"],"sources":["animated.tsx"],"sourcesContent":["/* eslint react/jsx-sort-props: off */\nimport React, { useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport { Animated, Platform, StyleSheet } from \"react-native\";\nimport {\n controlEdgeToEdgeValues,\n isEdgeToEdge,\n} from \"react-native-is-edge-to-edge\";\nimport Reanimated, { useSharedValue } from \"react-native-reanimated\";\n\nimport { KeyboardControllerView } from \"./bindings\";\nimport { KeyboardContext } from \"./context\";\nimport { focusedInputEventsMap, keyboardEventsMap } from \"./event-mappings\";\nimport { useAnimatedValue, useEventHandlerRegistration } from \"./internal\";\nimport { applyMonkeyPatch, revertMonkeyPatch } from \"./monkey-patch\";\nimport {\n useAnimatedKeyboardHandler,\n useFocusedInputLayoutHandler,\n} from \"./reanimated\";\n\nimport type { KeyboardAnimationContext } from \"./context\";\nimport type {\n FocusedInputHandler,\n FocusedInputLayoutChangedEvent,\n KeyboardControllerProps,\n KeyboardHandler,\n NativeEvent,\n} from \"./types\";\nimport type { ViewStyle } from \"react-native\";\n\nconst IS_EDGE_TO_EDGE = isEdgeToEdge();\n\nconst KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\n Animated.createAnimatedComponent(KeyboardControllerView),\n);\n\ntype Styles = {\n container: ViewStyle;\n hidden: ViewStyle;\n};\n\nconst styles = StyleSheet.create<Styles>({\n container: {\n flex: 1,\n },\n hidden: {\n display: \"none\",\n position: \"absolute\",\n },\n});\n\ntype KeyboardProviderProps = {\n children: React.ReactNode;\n /**\n * Set the value to `true`, if you use translucent status bar on Android.\n * If you already control status bar translucency via `react-native-screens`\n * or `StatusBar` component from `react-native`, you can ignore it.\n * Defaults to `false`.\n *\n * @platform android\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\n */\n statusBarTranslucent?: boolean;\n /**\n * Set the value to `true`, if you use translucent navigation bar on Android.\n * Defaults to `false`.\n *\n * @platform android\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\n */\n navigationBarTranslucent?: boolean;\n /**\n * A boolean property indicating whether to keep edge-to-edge mode always enabled (even when you disable the module).\n * Defaults to `false`.\n *\n * @platform android\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/592\n */\n preserveEdgeToEdge?: boolean;\n /**\n * A boolean prop indicating whether the module is enabled. It indicate only initial state\n * (if you try to change this prop after component mount it will not have any effect).\n * To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.\n * Defaults to `true`.\n */\n enabled?: boolean;\n};\n\n// capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package\n// see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/393 and https://github.com/kirillzyusko/react-native-keyboard-controller/issues/294 for more details\nconst OS = Platform.OS;\n\n/**\n * A component that wrap your app. Under the hood it works with {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller-view|KeyboardControllerView} to receive events during keyboard movements,\n * maps these events to `Animated`/`Reanimated` values and store them in context.\n *\n * @param props - Provider props, such as `statusBarTranslucent`, `navigationBarTranslucent`, etc.\n * @returns A component that should be mounted in root of your App layout.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-provider|Documentation} page for more details.\n * @example\n * ```tsx\n * <KeyboardProvider>\n * <NavigationContainer />\n * </KeyboardProvider>\n * ```\n */\nexport const KeyboardProvider = (props: KeyboardProviderProps) => {\n const {\n children,\n statusBarTranslucent,\n navigationBarTranslucent,\n preserveEdgeToEdge,\n enabled: initiallyEnabled = true,\n } = props;\n // ref\n const viewTagRef = useRef<React.Component<KeyboardControllerProps>>(null);\n // state\n const [enabled, setEnabled] = useState(initiallyEnabled);\n // animated values\n const progress = useAnimatedValue(0);\n const height = useAnimatedValue(0);\n // shared values\n const progressSV = useSharedValue(0);\n const heightSV = useSharedValue(0);\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\n const setKeyboardHandlers = useEventHandlerRegistration<KeyboardHandler>(\n keyboardEventsMap,\n viewTagRef,\n );\n const setInputHandlers = useEventHandlerRegistration<FocusedInputHandler>(\n focusedInputEventsMap,\n viewTagRef,\n );\n // memo\n const context = useMemo<KeyboardAnimationContext>(\n () => ({\n enabled,\n animated: { progress: progress, height: Animated.multiply(height, -1) },\n reanimated: { progress: progressSV, height: heightSV },\n layout,\n setKeyboardHandlers,\n setInputHandlers,\n setEnabled,\n }),\n [enabled],\n );\n const style = useMemo(\n () => [\n styles.hidden,\n { transform: [{ translateX: height }, { translateY: progress }] },\n ],\n [],\n );\n const onKeyboardMove = useMemo(\n () =>\n Animated.event(\n [\n {\n nativeEvent: {\n progress,\n height,\n },\n },\n ],\n // Setting useNativeDriver to true on web triggers a warning due to the absence of a native driver for web. Therefore, it is set to false.\n { useNativeDriver: Platform.OS !== \"web\" },\n ),\n [],\n );\n // handlers\n const updateSharedValues = (event: NativeEvent, platforms: string[]) => {\n \"worklet\";\n\n if (platforms.includes(OS)) {\n // eslint-disable-next-line react-compiler/react-compiler\n progressSV.value = event.progress;\n heightSV.value = -event.height;\n }\n };\n const keyboardHandler = useAnimatedKeyboardHandler(\n {\n onKeyboardMoveStart: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"ios\"]);\n },\n onKeyboardMove: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\"]);\n },\n onKeyboardMoveInteractive: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\", \"ios\"]);\n },\n onKeyboardMoveEnd: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\"]);\n },\n },\n [],\n );\n const inputLayoutHandler = useFocusedInputLayoutHandler(\n {\n onFocusedInputLayoutChanged: (e) => {\n \"worklet\";\n\n if (e.target !== -1) {\n layout.value = e;\n } else {\n layout.value = null;\n }\n },\n },\n [],\n );\n\n // layout effects\n useLayoutEffect(() => {\n if (enabled) {\n applyMonkeyPatch();\n } else {\n revertMonkeyPatch();\n }\n }, [enabled]);\n\n if (__DEV__) {\n controlEdgeToEdgeValues({\n statusBarTranslucent,\n navigationBarTranslucent,\n preserveEdgeToEdge,\n });\n }\n\n return (\n <KeyboardContext.Provider value={context}>\n <KeyboardControllerViewAnimated\n ref={viewTagRef}\n enabled={enabled}\n navigationBarTranslucent={IS_EDGE_TO_EDGE || navigationBarTranslucent}\n statusBarTranslucent={IS_EDGE_TO_EDGE || statusBarTranslucent}\n preserveEdgeToEdge={IS_EDGE_TO_EDGE || preserveEdgeToEdge}\n style={styles.container}\n // on*Reanimated prop must precede animated handlers to work correctly\n onKeyboardMoveReanimated={keyboardHandler}\n onKeyboardMoveStart={OS === \"ios\" ? onKeyboardMove : undefined}\n onKeyboardMove={OS === \"android\" ? onKeyboardMove : undefined}\n onKeyboardMoveInteractive={onKeyboardMove}\n onKeyboardMoveEnd={OS === \"android\" ? onKeyboardMove : undefined}\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\n >\n {children}\n </KeyboardControllerViewAnimated>\n <Animated.View\n // we are using this small hack, because if the component (where\n // animated value has been used) is unmounted, then animation will\n // stop receiving events (seems like it's react-native optimization).\n // So we need to keep a reference to the animated value, to keep it's\n // always mounted (keep a reference to an animated value).\n //\n // To test why it's needed, try to open screen which consumes Animated.Value\n // then close it and open it again (for example 'Animated transition').\n style={style}\n />\n </Keybo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BAAoB;MACpBC,wBAAwB;MACxBC;IACF,CAAC,CAAC;EACJ;EAEA,oBACEtD,MAAA,CAAAkB,OAAA,CAAAsF,aAAA,CAACjG,QAAA,CAAAkG,eAAe,CAACC,QAAQ;IAACjB,KAAK,EAAEhB;EAAQ,gBACvCzE,MAAA,CAAAkB,OAAA,CAAAsF,aAAA,CAACtE,8BAA8B;IAC7ByE,GAAG,EAAElD,UAAW;IAChBF,OAAO,EAAEA,OAAQ;IACjBF,wBAAwB,EAAErB,eAAe,IAAIqB,wBAAyB;IACtED,oBAAoB,EAAEpB,eAAe,IAAIoB,oBAAqB;IAC9DE,kBAAkB,EAAEtB,eAAe,IAAIsB,kBAAmB;IAC1DwB,KAAK,EAAEvC,MAAM,CAACG;IACd;IAAA;IACAkE,wBAAwB,EAAElB,eAAgB;IAC1CE,mBAAmB,EAAE7C,EAAE,KAAK,KAAK,GAAGmC,cAAc,GAAG2B,SAAU;IAC/D3B,cAAc,EAAEnC,EAAE,KAAK,SAAS,GAAGmC,cAAc,GAAG2B,SAAU;IAC9DhB,yBAAyB,EAAEX,cAAe;IAC1CY,iBAAiB,EAAE/C,EAAE,KAAK,SAAS,GAAGmC,cAAc,GAAG2B,SAAU;IACjEC,qCAAqC,EAAEf;EAAmB,GAEzD5C,QAC6B,CAAC,eACjCnD,MAAA,CAAAkB,OAAA,CAAAsF,aAAA,CAACrG,YAAA,CAAAkC,QAAQ,CAAC0E,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACAjC,KAAK,EAAEA;EAAM,CACd,CACuB,CAAC;AAE/B,CAAC;AAACkC,OAAA,CAAA/D,gBAAA,GAAAA,gBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeIsEdgeToEdge","_reactNativeReanimated","_bindings","_context","_eventMappings","_internal","_module","_reanimated","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","IS_EDGE_TO_EDGE","isEdgeToEdge","KeyboardControllerViewAnimated","Reanimated","createAnimatedComponent","Animated","KeyboardControllerView","styles","StyleSheet","create","container","flex","hidden","display","position","OS","Platform","KeyboardProvider","props","children","statusBarTranslucent","navigationBarTranslucent","preserveEdgeToEdge","enabled","initiallyEnabled","preload","viewTagRef","useRef","setEnabled","useState","progress","useAnimatedValue","height","progressSV","useSharedValue","heightSV","layout","setKeyboardHandlers","useEventHandlerRegistration","keyboardEventsMap","setInputHandlers","focusedInputEventsMap","context","useMemo","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","value","keyboardHandler","useAnimatedKeyboardHandler","onKeyboardMoveStart","onKeyboardMoveInteractive","onKeyboardMoveEnd","inputLayoutHandler","useFocusedInputLayoutHandler","onFocusedInputLayoutChanged","target","useEffect","KeyboardController","__DEV__","controlEdgeToEdgeValues","createElement","KeyboardContext","Provider","ref","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","View","exports"],"sources":["animated.tsx"],"sourcesContent":["/* eslint react/jsx-sort-props: off */\nimport React, { useEffect, useMemo, useRef, useState } from \"react\";\nimport { Animated, Platform, StyleSheet } from \"react-native\";\nimport {\n controlEdgeToEdgeValues,\n isEdgeToEdge,\n} from \"react-native-is-edge-to-edge\";\nimport Reanimated, { useSharedValue } from \"react-native-reanimated\";\n\nimport { KeyboardControllerView } from \"./bindings\";\nimport { KeyboardContext } from \"./context\";\nimport { focusedInputEventsMap, keyboardEventsMap } from \"./event-mappings\";\nimport { useAnimatedValue, useEventHandlerRegistration } from \"./internal\";\nimport { KeyboardController } from \"./module\";\nimport {\n useAnimatedKeyboardHandler,\n useFocusedInputLayoutHandler,\n} from \"./reanimated\";\n\nimport type { KeyboardAnimationContext } from \"./context\";\nimport type {\n FocusedInputHandler,\n FocusedInputLayoutChangedEvent,\n KeyboardControllerProps,\n KeyboardHandler,\n NativeEvent,\n} from \"./types\";\nimport type { ViewStyle } from \"react-native\";\n\nconst IS_EDGE_TO_EDGE = isEdgeToEdge();\n\nconst KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\n Animated.createAnimatedComponent(KeyboardControllerView),\n);\n\ntype Styles = {\n container: ViewStyle;\n hidden: ViewStyle;\n};\n\nconst styles = StyleSheet.create<Styles>({\n container: {\n flex: 1,\n },\n hidden: {\n display: \"none\",\n position: \"absolute\",\n },\n});\n\ntype KeyboardProviderProps = {\n children: React.ReactNode;\n /**\n * Set the value to `true`, if you use translucent status bar on Android.\n * If you already control status bar translucency via `react-native-screens`\n * or `StatusBar` component from `react-native`, you can ignore it.\n * Defaults to `false`.\n *\n * @platform android\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\n */\n statusBarTranslucent?: boolean;\n /**\n * Set the value to `true`, if you use translucent navigation bar on Android.\n * Defaults to `false`.\n *\n * @platform android\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\n */\n navigationBarTranslucent?: boolean;\n /**\n * A boolean property indicating whether to keep edge-to-edge mode always enabled (even when you disable the module).\n * Defaults to `false`.\n *\n * @platform android\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/592\n */\n preserveEdgeToEdge?: boolean;\n /**\n * A boolean prop indicating whether the module is enabled. It indicate only initial state\n * (if you try to change this prop after component mount it will not have any effect).\n * To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.\n * Defaults to `true`.\n */\n enabled?: boolean;\n /**\n * A boolean prop indicating whether to preload the keyboard to reduce time-to-interaction (TTI) on first input focus.\n * Defaults to `true`.\n *\n * @platform ios\n */\n preload?: boolean;\n};\n\n// capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package\n// see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/393 and https://github.com/kirillzyusko/react-native-keyboard-controller/issues/294 for more details\nconst OS = Platform.OS;\n\n/**\n * A component that wrap your app. Under the hood it works with {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller-view|KeyboardControllerView} to receive events during keyboard movements,\n * maps these events to `Animated`/`Reanimated` values and store them in context.\n *\n * @param props - Provider props, such as `statusBarTranslucent`, `navigationBarTranslucent`, etc.\n * @returns A component that should be mounted in root of your App layout.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-provider|Documentation} page for more details.\n * @example\n * ```tsx\n * <KeyboardProvider>\n * <NavigationContainer />\n * </KeyboardProvider>\n * ```\n */\nexport const KeyboardProvider = (props: KeyboardProviderProps) => {\n const {\n children,\n statusBarTranslucent,\n navigationBarTranslucent,\n preserveEdgeToEdge,\n enabled: initiallyEnabled = true,\n preload = true,\n } = props;\n // ref\n const viewTagRef = useRef<React.Component<KeyboardControllerProps>>(null);\n // state\n const [enabled, setEnabled] = useState(initiallyEnabled);\n // animated values\n const progress = useAnimatedValue(0);\n const height = useAnimatedValue(0);\n // shared values\n const progressSV = useSharedValue(0);\n const heightSV = useSharedValue(0);\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\n const setKeyboardHandlers = useEventHandlerRegistration<KeyboardHandler>(\n keyboardEventsMap,\n viewTagRef,\n );\n const setInputHandlers = useEventHandlerRegistration<FocusedInputHandler>(\n focusedInputEventsMap,\n viewTagRef,\n );\n // memo\n const context = useMemo<KeyboardAnimationContext>(\n () => ({\n enabled,\n animated: { progress: progress, height: Animated.multiply(height, -1) },\n reanimated: { progress: progressSV, height: heightSV },\n layout,\n setKeyboardHandlers,\n setInputHandlers,\n setEnabled,\n }),\n [enabled],\n );\n const style = useMemo(\n () => [\n styles.hidden,\n { transform: [{ translateX: height }, { translateY: progress }] },\n ],\n [],\n );\n const onKeyboardMove = useMemo(\n () =>\n Animated.event(\n [\n {\n nativeEvent: {\n progress,\n height,\n },\n },\n ],\n // Setting useNativeDriver to true on web triggers a warning due to the absence of a native driver for web. Therefore, it is set to false.\n { useNativeDriver: Platform.OS !== \"web\" },\n ),\n [],\n );\n // handlers\n const updateSharedValues = (event: NativeEvent, platforms: string[]) => {\n \"worklet\";\n\n if (platforms.includes(OS)) {\n // eslint-disable-next-line react-compiler/react-compiler\n progressSV.value = event.progress;\n heightSV.value = -event.height;\n }\n };\n const keyboardHandler = useAnimatedKeyboardHandler(\n {\n onKeyboardMoveStart: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"ios\"]);\n },\n onKeyboardMove: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\"]);\n },\n onKeyboardMoveInteractive: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\", \"ios\"]);\n },\n onKeyboardMoveEnd: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\"]);\n },\n },\n [],\n );\n const inputLayoutHandler = useFocusedInputLayoutHandler(\n {\n onFocusedInputLayoutChanged: (e) => {\n \"worklet\";\n\n if (e.target !== -1) {\n layout.value = e;\n } else {\n layout.value = null;\n }\n },\n },\n [],\n );\n\n useEffect(() => {\n if (preload) {\n KeyboardController.preload();\n }\n }, [preload]);\n\n if (__DEV__) {\n controlEdgeToEdgeValues({\n statusBarTranslucent,\n navigationBarTranslucent,\n preserveEdgeToEdge,\n });\n }\n\n return (\n <KeyboardContext.Provider value={context}>\n <KeyboardControllerViewAnimated\n ref={viewTagRef}\n enabled={enabled}\n navigationBarTranslucent={IS_EDGE_TO_EDGE || navigationBarTranslucent}\n statusBarTranslucent={IS_EDGE_TO_EDGE || statusBarTranslucent}\n preserveEdgeToEdge={IS_EDGE_TO_EDGE || preserveEdgeToEdge}\n style={styles.container}\n // on*Reanimated prop must precede animated handlers to work correctly\n onKeyboardMoveReanimated={keyboardHandler}\n onKeyboardMoveStart={OS === \"ios\" ? onKeyboardMove : undefined}\n onKeyboardMove={OS === \"android\" ? onKeyboardMove : undefined}\n onKeyboardMoveInteractive={onKeyboardMove}\n onKeyboardMoveEnd={OS === \"android\" ? onKeyboardMove : undefined}\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\n >\n {children}\n </KeyboardControllerViewAnimated>\n <Animated.View\n // we are using this small hack, because if the component (where\n // animated value has been used) is unmounted, then animation will\n // stop receiving events (seems like it's react-native optimization).\n // So we need to keep a reference to the animated value, to keep it's\n // always mounted (keep a reference to an animated value).\n //\n // To test why it's needed, try to open screen which consumes Animated.Value\n // then close it and open it again (for example 'Animated transition').\n style={style}\n />\n </KeyboardContext.Provider>\n );\n};\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,wBAAA,GAAAF,OAAA;AAIA,IAAAG,sBAAA,GAAAJ,uBAAA,CAAAC,OAAA;AAEA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AAGsB,SAAAU,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAZ,wBAAAY,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA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C;AAACiC,OAAA,CAAA/D,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -3,12 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.WindowDimensionsEvents = exports.RCTOverKeyboardView = exports.KeyboardGestureArea = exports.KeyboardEvents = exports.KeyboardControllerView = exports.KeyboardControllerNative = exports.FocusedInputEvents = void 0;
6
+ exports.WindowDimensionsEvents = exports.RCTOverKeyboardView = exports.RCTKeyboardExtender = exports.KeyboardGestureArea = exports.KeyboardEvents = exports.KeyboardControllerView = exports.KeyboardControllerNative = exports.KeyboardBackgroundView = exports.FocusedInputEvents = void 0;
7
7
  var _reactNative = require("react-native");
8
8
  const NOOP = () => {};
9
9
  const KeyboardControllerNative = exports.KeyboardControllerNative = {
10
10
  setDefaultMode: NOOP,
11
11
  setInputMode: NOOP,
12
+ preload: NOOP,
12
13
  dismiss: NOOP,
13
14
  setFocusTo: NOOP,
14
15
  addListener: NOOP,
@@ -55,4 +56,17 @@ const KeyboardControllerView = exports.KeyboardControllerView = _reactNative.Vie
55
56
  */
56
57
  const KeyboardGestureArea = exports.KeyboardGestureArea = _reactNative.View;
57
58
  const RCTOverKeyboardView = exports.RCTOverKeyboardView = _reactNative.View;
59
+ /**
60
+ * A view that matches keyboard background.
61
+ *
62
+ * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-background-view|Documentation} page for more details.
63
+ */
64
+ const KeyboardBackgroundView = exports.KeyboardBackgroundView = _reactNative.View;
65
+ /**
66
+ * A container that will embed its children into the keyboard
67
+ * and will always show them above the keyboard.
68
+ *
69
+ * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-extender|Documentation} page for more details.
70
+ */
71
+ const RCTKeyboardExtender = exports.RCTKeyboardExtender = _reactNative.View;
58
72
  //# sourceMappingURL=bindings.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","NOOP","KeyboardControllerNative","exports","setDefaultMode","setInputMode","dismiss","setFocusTo","addListener","removeListeners","KeyboardEvents","remove","FocusedInputEvents","WindowDimensionsEvents","KeyboardControllerView","View","KeyboardGestureArea","RCTOverKeyboardView"],"sources":["bindings.ts"],"sourcesContent":["import { View } from \"react-native\";\n\nimport type {\n FocusedInputEventsModule,\n KeyboardControllerNativeModule,\n KeyboardControllerProps,\n KeyboardEventsModule,\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 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>;\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"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAaA,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,UAAU,EAAEN,IAAI;EAChBO,WAAW,EAAEP,IAAI;EACjBQ,eAAe,EAAER;AACnB,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMS,cAAoC,GAAAP,OAAA,CAAAO,cAAA,GAAG;EAClDF,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAEV;EAAK,CAAC;AACtC,CAAC;AACD;AACA;AACA;AACA;AACO,MAAMW,kBAA4C,GAAAT,OAAA,CAAAS,kBAAA,GAAG;EAC1DJ,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAEV;EAAK,CAAC;AACtC,CAAC;AACM,MAAMY,sBAAoD,GAAAV,OAAA,CAAAU,sBAAA,GAAG;EAClEL,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAEV;EAAK,CAAC;AACtC,CAAC;AACD;AACA;AACA;AACA;AACA;AACO,MAAMa,sBAAsB,GAAAX,OAAA,CAAAW,sBAAA,GACjCC,iBAAoD;AACtD;AACA;AACA;AACA;AACA;AACO,MAAMC,mBAAmB,GAAAb,OAAA,CAAAa,mBAAA,GAC9BD,iBAAqD;AAChD,MAAME,mBAAmB,GAAAd,OAAA,CAAAc,mBAAA,GAC9BF,iBAAkD","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","NOOP","KeyboardControllerNative","exports","setDefaultMode","setInputMode","preload","dismiss","setFocusTo","addListener","removeListeners","KeyboardEvents","remove","FocusedInputEvents","WindowDimensionsEvents","KeyboardControllerView","View","KeyboardGestureArea","RCTOverKeyboardView","KeyboardBackgroundView","RCTKeyboardExtender"],"sources":["bindings.ts"],"sourcesContent":["import { View } from \"react-native\";\n\nimport type {\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>;\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"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAeA,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;AACtD;AACA;AACA;AACA;AACA;AACO,MAAMC,mBAAmB,GAAAd,OAAA,CAAAc,mBAAA,GAC9BD,iBAAqD;AAChD,MAAME,mBAAmB,GAAAf,OAAA,CAAAe,mBAAA,GAC9BF,iBAAkD;AACpD;AACA;AACA;AACA;AACA;AACO,MAAMG,sBAAsB,GAAAhB,OAAA,CAAAgB,sBAAA,GACjCH,iBAAwD;AAC1D;AACA;AACA;AACA;AACA;AACA;AACO,MAAMI,mBAAmB,GAAAjB,OAAA,CAAAiB,mBAAA,GAC9BJ,iBAAkD","ignoreList":[]}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.WindowDimensionsEvents = exports.RCTOverKeyboardView = exports.KeyboardGestureArea = exports.KeyboardEvents = exports.KeyboardControllerView = exports.KeyboardControllerNative = exports.FocusedInputEvents = void 0;
6
+ exports.WindowDimensionsEvents = exports.RCTOverKeyboardView = exports.RCTKeyboardExtender = exports.KeyboardGestureArea = exports.KeyboardEvents = exports.KeyboardControllerView = exports.KeyboardControllerNative = exports.KeyboardBackgroundView = exports.FocusedInputEvents = 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",
@@ -36,4 +36,8 @@ const KeyboardGestureArea = exports.KeyboardGestureArea = _reactNative.Platform.
36
36
  children
37
37
  }) => children;
38
38
  const RCTOverKeyboardView = exports.RCTOverKeyboardView = require("./specs/OverKeyboardViewNativeComponent").default;
39
+ const KeyboardBackgroundView = exports.KeyboardBackgroundView = require("./specs/KeyboardBackgroundViewNativeComponent").default;
40
+ const RCTKeyboardExtender = exports.RCTKeyboardExtender = _reactNative.Platform.OS === "ios" ? require("./specs/KeyboardExtenderNativeComponent").default : ({
41
+ children
42
+ }) => children;
39
43
  //# sourceMappingURL=bindings.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","RCTKeyboardController","KeyboardControllerNative","exports","Proxy","get","Error","KEYBOARD_CONTROLLER_NAMESPACE","eventEmitter","NativeEventEmitter","KeyboardEvents","addListener","name","cb","FocusedInputEvents","WindowDimensionsEvents","KeyboardControllerView","KeyboardGestureArea","OS","Version","children","RCTOverKeyboardView"],"sources":["bindings.native.ts"],"sourcesContent":["import { NativeEventEmitter, Platform } from \"react-native\";\n\nimport type {\n FocusedInputEventsModule,\n KeyboardControllerNativeModule,\n KeyboardControllerProps,\n KeyboardEventsModule,\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 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 require(\"./specs/KeyboardControllerViewNativeComponent\").default;\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;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAYA,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,qBAAqB,GACzBN,OAAO,CAAC,kCAAkC,CAAC,CAACK,OAAO;AAE9C,MAAME,wBAAwB,GAAAC,OAAA,CAAAD,wBAAA,GACnCD,qBAAqB,GACjBA,qBAAqB,GACrB,IAAIG,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACV,aAAa,CAAC;EAChC;AACF,CACF,CAC6B;AAEnC,MAAMW,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,GACpErB,OAAO,CAAC,+CAA+C,CAAC,CAACK,OAAO;AAC3D,MAAMiB,mBAAuD,GAAAd,OAAA,CAAAc,mBAAA,GACjEpB,qBAAQ,CAACqB,EAAE,KAAK,SAAS,IAAIrB,qBAAQ,CAACsB,OAAO,IAAI,EAAE,IAAKtB,qBAAQ,CAACqB,EAAE,KAAK,KAAK,GAC1EvB,OAAO,CAAC,4CAA4C,CAAC,CAACK,OAAO,GAC7D,CAAC;EAAEoB;AAAmC,CAAC,KAAKA,QAAQ;AACnD,MAAMC,mBAAoD,GAAAlB,OAAA,CAAAkB,mBAAA,GAC/D1B,OAAO,CAAC,yCAAyC,CAAC,CAACK,OAAO","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","RCTKeyboardController","KeyboardControllerNative","exports","Proxy","get","Error","KEYBOARD_CONTROLLER_NAMESPACE","eventEmitter","NativeEventEmitter","KeyboardEvents","addListener","name","cb","FocusedInputEvents","WindowDimensionsEvents","KeyboardControllerView","KeyboardGestureArea","OS","Version","children","RCTOverKeyboardView","KeyboardBackgroundView","RCTKeyboardExtender"],"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 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 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 require(\"./specs/KeyboardControllerViewNativeComponent\").default;\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;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAcA,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,qBAAqB,GACzBN,OAAO,CAAC,kCAAkC,CAAC,CAACK,OAAO;AAE9C,MAAME,wBAAwB,GAAAC,OAAA,CAAAD,wBAAA,GACnCD,qBAAqB,GACjBA,qBAAqB,GACrB,IAAIG,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACV,aAAa,CAAC;EAChC;AACF,CACF,CAC6B;AAEnC,MAAMW,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,CA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