react-native-keyboard-controller 1.11.3 → 1.11.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/ios/KeyboardController-Bridging-Header.h +1 -0
  2. package/ios/KeyboardController.xcodeproj/project.pbxproj +18 -0
  3. package/ios/objc/RCTUIManager+LayoutAnimationManager.h +15 -0
  4. package/ios/objc/RCTUIManager+LayoutAnimationManager.m +32 -0
  5. package/ios/observers/KeyboardMovementObserver.swift +13 -26
  6. package/ios/traversal/KeyboardView.swift +36 -0
  7. package/ios/views/KeyboardControllerView.mm +6 -0
  8. package/ios/views/KeyboardControllerViewManager.swift +14 -0
  9. package/lib/commonjs/animated.js +14 -12
  10. package/lib/commonjs/animated.js.map +1 -1
  11. package/lib/commonjs/bindings.js +5 -10
  12. package/lib/commonjs/bindings.js.map +1 -1
  13. package/lib/commonjs/bindings.native.js +7 -15
  14. package/lib/commonjs/bindings.native.js.map +1 -1
  15. package/lib/commonjs/components/KeyboardAvoidingView/hooks.js +7 -4
  16. package/lib/commonjs/components/KeyboardAvoidingView/hooks.js.map +1 -1
  17. package/lib/commonjs/components/KeyboardAvoidingView/index.js +15 -17
  18. package/lib/commonjs/components/KeyboardAvoidingView/index.js.map +1 -1
  19. package/lib/commonjs/components/KeyboardAwareScrollView/index.js +13 -16
  20. package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
  21. package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +7 -7
  22. package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
  23. package/lib/commonjs/components/KeyboardAwareScrollView/utils.js +3 -4
  24. package/lib/commonjs/components/KeyboardAwareScrollView/utils.js.map +1 -1
  25. package/lib/commonjs/components/KeyboardStickyView/index.js +12 -14
  26. package/lib/commonjs/components/KeyboardStickyView/index.js.map +1 -1
  27. package/lib/commonjs/components/KeyboardToolbar/Arrow.js +8 -10
  28. package/lib/commonjs/components/KeyboardToolbar/Arrow.js.map +1 -1
  29. package/lib/commonjs/components/KeyboardToolbar/Button.js +23 -26
  30. package/lib/commonjs/components/KeyboardToolbar/Button.js.map +1 -1
  31. package/lib/commonjs/components/KeyboardToolbar/colors.js +1 -2
  32. package/lib/commonjs/components/KeyboardToolbar/colors.js.map +1 -1
  33. package/lib/commonjs/components/KeyboardToolbar/colors.native.js +1 -2
  34. package/lib/commonjs/components/KeyboardToolbar/colors.native.js.map +1 -1
  35. package/lib/commonjs/components/KeyboardToolbar/index.js +11 -13
  36. package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -1
  37. package/lib/commonjs/components/KeyboardToolbar/types.js.map +1 -1
  38. package/lib/commonjs/components/hooks/useColorScheme.js +1 -2
  39. package/lib/commonjs/components/hooks/useColorScheme.js.map +1 -1
  40. package/lib/commonjs/components/index.js +2 -2
  41. package/lib/commonjs/components/index.js.map +1 -1
  42. package/lib/commonjs/constants.js +3 -4
  43. package/lib/commonjs/constants.js.map +1 -1
  44. package/lib/commonjs/context.js +1 -2
  45. package/lib/commonjs/context.js.map +1 -1
  46. package/lib/commonjs/hooks.js.map +1 -1
  47. package/lib/commonjs/index.js.map +1 -1
  48. package/lib/commonjs/internal.js +1 -1
  49. package/lib/commonjs/internal.js.map +1 -1
  50. package/lib/commonjs/monkey-patch.android.js +2 -2
  51. package/lib/commonjs/monkey-patch.android.js.map +1 -1
  52. package/lib/commonjs/monkey-patch.js +2 -4
  53. package/lib/commonjs/monkey-patch.js.map +1 -1
  54. package/lib/commonjs/reanimated.js +3 -6
  55. package/lib/commonjs/reanimated.js.map +1 -1
  56. package/lib/commonjs/reanimated.native.js.map +1 -1
  57. package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js +1 -2
  58. package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js.map +1 -1
  59. package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js +1 -2
  60. package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js.map +1 -1
  61. package/lib/commonjs/specs/NativeKeyboardController.js +1 -2
  62. package/lib/commonjs/specs/NativeKeyboardController.js.map +1 -1
  63. package/lib/commonjs/specs/NativeStatusBarManagerCompat.js +1 -2
  64. package/lib/commonjs/specs/NativeStatusBarManagerCompat.js.map +1 -1
  65. package/lib/commonjs/types.js.map +1 -1
  66. package/lib/commonjs/utils.js.map +1 -1
  67. package/lib/module/animated.js +12 -10
  68. package/lib/module/animated.js.map +1 -1
  69. package/lib/module/bindings.js.map +1 -1
  70. package/lib/module/bindings.native.js +3 -6
  71. package/lib/module/bindings.native.js.map +1 -1
  72. package/lib/module/components/KeyboardAvoidingView/hooks.js +8 -5
  73. package/lib/module/components/KeyboardAvoidingView/hooks.js.map +1 -1
  74. package/lib/module/components/KeyboardAvoidingView/index.js +12 -13
  75. package/lib/module/components/KeyboardAvoidingView/index.js.map +1 -1
  76. package/lib/module/components/KeyboardAwareScrollView/index.js +10 -12
  77. package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -1
  78. package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +7 -7
  79. package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
  80. package/lib/module/components/KeyboardAwareScrollView/utils.js +3 -4
  81. package/lib/module/components/KeyboardAwareScrollView/utils.js.map +1 -1
  82. package/lib/module/components/KeyboardStickyView/index.js +9 -10
  83. package/lib/module/components/KeyboardStickyView/index.js.map +1 -1
  84. package/lib/module/components/KeyboardToolbar/Arrow.js +5 -6
  85. package/lib/module/components/KeyboardToolbar/Arrow.js.map +1 -1
  86. package/lib/module/components/KeyboardToolbar/Button.js +20 -22
  87. package/lib/module/components/KeyboardToolbar/Button.js.map +1 -1
  88. package/lib/module/components/KeyboardToolbar/colors.js.map +1 -1
  89. package/lib/module/components/KeyboardToolbar/colors.native.js.map +1 -1
  90. package/lib/module/components/KeyboardToolbar/index.js +8 -9
  91. package/lib/module/components/KeyboardToolbar/index.js.map +1 -1
  92. package/lib/module/components/KeyboardToolbar/types.js.map +1 -1
  93. package/lib/module/components/hooks/useColorScheme.js.map +1 -1
  94. package/lib/module/components/index.js.map +1 -1
  95. package/lib/module/constants.js +3 -3
  96. package/lib/module/constants.js.map +1 -1
  97. package/lib/module/context.js.map +1 -1
  98. package/lib/module/hooks.js.map +1 -1
  99. package/lib/module/index.js.map +1 -1
  100. package/lib/module/internal.js +1 -1
  101. package/lib/module/internal.js.map +1 -1
  102. package/lib/module/monkey-patch.android.js.map +1 -1
  103. package/lib/module/monkey-patch.js.map +1 -1
  104. package/lib/module/reanimated.js.map +1 -1
  105. package/lib/module/reanimated.native.js.map +1 -1
  106. package/lib/module/specs/KeyboardControllerViewNativeComponent.js.map +1 -1
  107. package/lib/module/specs/KeyboardGestureAreaNativeComponent.js.map +1 -1
  108. package/lib/module/specs/NativeKeyboardController.js.map +1 -1
  109. package/lib/module/specs/NativeStatusBarManagerCompat.js.map +1 -1
  110. package/lib/module/types.js.map +1 -1
  111. package/lib/module/utils.js.map +1 -1
  112. package/lib/typescript/animated.d.ts +1 -1
  113. package/lib/typescript/components/KeyboardToolbar/Button.d.ts +1 -1
  114. package/package.json +7 -7
  115. package/src/animated.tsx +7 -3
  116. package/src/components/KeyboardAvoidingView/hooks.ts +9 -5
  117. package/src/components/KeyboardAvoidingView/index.tsx +1 -1
@@ -1 +1,2 @@
1
+ #import <React/RCTUIManager.h>
1
2
  #import <React/RCTViewManager.h>
@@ -15,6 +15,8 @@
15
15
  084AEEC62ACF49A8001A3069 /* FocusedInputLayoutChangedEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 084AEEC52ACF49A8001A3069 /* FocusedInputLayoutChangedEvent.m */; };
16
16
  084AEEC82ACF4AB2001A3069 /* FocusedInputObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 084AEEC72ACF4AB2001A3069 /* FocusedInputObserver.swift */; };
17
17
  089BA5DC2B3E0C9D000A9A90 /* ViewHierarchyNavigator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 089BA5DB2B3E0C9D000A9A90 /* ViewHierarchyNavigator.swift */; };
18
+ 08C47AFC2BA9AF7100DB93BB /* KeyboardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08C47AFB2BA9AF7100DB93BB /* KeyboardView.swift */; };
19
+ 08DF17B32BB1838D00279890 /* RCTUIManager+LayoutAnimationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 08DF17B22BB1838D00279890 /* RCTUIManager+LayoutAnimationManager.m */; };
18
20
  F333F8D428996B8D0015B05F /* KeyboardControllerView.mm in Sources */ = {isa = PBXBuildFile; fileRef = F333F8D228996B8D0015B05F /* KeyboardControllerView.mm */; };
19
21
  F359D34F28133C26000B6AFE /* KeyboardControllerModule.mm in Sources */ = {isa = PBXBuildFile; fileRef = F359D34E28133C26000B6AFE /* KeyboardControllerModule.mm */; };
20
22
  F3626A0728B3FE760021B2D9 /* KeyboardMovementObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3626A0628B3FE760021B2D9 /* KeyboardMovementObserver.swift */; };
@@ -45,6 +47,9 @@
45
47
  084AEEC52ACF49A8001A3069 /* FocusedInputLayoutChangedEvent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FocusedInputLayoutChangedEvent.m; sourceTree = "<group>"; };
46
48
  084AEEC72ACF4AB2001A3069 /* FocusedInputObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FocusedInputObserver.swift; sourceTree = "<group>"; };
47
49
  089BA5DB2B3E0C9D000A9A90 /* ViewHierarchyNavigator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewHierarchyNavigator.swift; sourceTree = "<group>"; };
50
+ 08C47AFB2BA9AF7100DB93BB /* KeyboardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyboardView.swift; sourceTree = "<group>"; };
51
+ 08DF17B22BB1838D00279890 /* RCTUIManager+LayoutAnimationManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "RCTUIManager+LayoutAnimationManager.m"; sourceTree = "<group>"; };
52
+ 08DF17B52BB1845500279890 /* RCTUIManager+LayoutAnimationManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RCTUIManager+LayoutAnimationManager.h"; sourceTree = "<group>"; };
48
53
  134814201AA4EA6300B7C361 /* libKeyboardController.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libKeyboardController.a; sourceTree = BUILT_PRODUCTS_DIR; };
49
54
  B3E7B5891CC2AC0600A0062D /* KeyboardControllerViewManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KeyboardControllerViewManager.mm; sourceTree = "<group>"; };
50
55
  F333F8D128996B1C0015B05F /* KeyboardControllerView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KeyboardControllerView.h; sourceTree = "<group>"; };
@@ -109,10 +114,20 @@
109
114
  089BA5DB2B3E0C9D000A9A90 /* ViewHierarchyNavigator.swift */,
110
115
  0800511B2B65548600928E51 /* FocusedInputHolder.swift */,
111
116
  0800511D2B65558800928E51 /* TextInput.swift */,
117
+ 08C47AFB2BA9AF7100DB93BB /* KeyboardView.swift */,
112
118
  );
113
119
  path = traversal;
114
120
  sourceTree = "<group>";
115
121
  };
122
+ 08DF17B12BB1834400279890 /* objc */ = {
123
+ isa = PBXGroup;
124
+ children = (
125
+ 08DF17B22BB1838D00279890 /* RCTUIManager+LayoutAnimationManager.m */,
126
+ 08DF17B52BB1845500279890 /* RCTUIManager+LayoutAnimationManager.h */,
127
+ );
128
+ path = objc;
129
+ sourceTree = "<group>";
130
+ };
116
131
  134814211AA4EA7D00B7C361 /* Products */ = {
117
132
  isa = PBXGroup;
118
133
  children = (
@@ -124,6 +139,7 @@
124
139
  58B511D21A9E6C8500147676 = {
125
140
  isa = PBXGroup;
126
141
  children = (
142
+ 08DF17B12BB1834400279890 /* objc */,
127
143
  089BA5DD2B3EC978000A9A90 /* traversal */,
128
144
  084AEEC12ACF405C001A3069 /* views */,
129
145
  084AEEC02ACDFC2A001A3069 /* observers */,
@@ -202,6 +218,8 @@
202
218
  F4FF95D7245B92E800C19C63 /* KeyboardControllerViewManager.swift in Sources */,
203
219
  F333F8D428996B8D0015B05F /* KeyboardControllerView.mm in Sources */,
204
220
  0800511E2B65558800928E51 /* TextInput.swift in Sources */,
221
+ 08DF17B32BB1838D00279890 /* RCTUIManager+LayoutAnimationManager.m in Sources */,
222
+ 08C47AFC2BA9AF7100DB93BB /* KeyboardView.swift in Sources */,
205
223
  F3F50669289E653B003091D6 /* KeyboardMoveEvent.m in Sources */,
206
224
  083FB9852B15171600C0EFF0 /* TextChangeObserver.swift in Sources */,
207
225
  089BA5DC2B3E0C9D000A9A90 /* ViewHierarchyNavigator.swift in Sources */,
@@ -0,0 +1,15 @@
1
+ //
2
+ // RCTUIManager+LayoutAnimationManager.h
3
+ // react-native-keyboard-controller
4
+ //
5
+ // Created by Kiryl Ziusko on 22/03/2024.
6
+ //
7
+
8
+ #import <React/RCTUIManager.h>
9
+
10
+ @interface RCTUIManager (LayoutAnimationManager)
11
+
12
+ - (void)scheduleKeyboardAnimation;
13
+ - (void)unscheduleKeyboardAnimation;
14
+
15
+ @end
@@ -0,0 +1,32 @@
1
+ //
2
+ // RCTUIManager+LayoutAnimationManager.m
3
+ // react-native-keyboard-controller
4
+ //
5
+ // Created by Kiryl Ziusko on 22/03/2024.
6
+ //
7
+
8
+ #import <React/RCTLayoutAnimationGroup.h>
9
+ #import "RCTUIManager+LayoutAnimationManager.h"
10
+
11
+ @implementation RCTUIManager (LayoutAnimationManager)
12
+
13
+ - (void)scheduleKeyboardAnimation
14
+ {
15
+ NSDictionary *animationConfig =
16
+ @{@"duration" : @250, @"update" : @{@"duration" : @250, @"type" : @"keyboard"}};
17
+
18
+ RCTLayoutAnimationGroup *layoutAnimationGroup =
19
+ [[RCTLayoutAnimationGroup alloc] initWithConfig:animationConfig callback:nil];
20
+
21
+ [self setValue:layoutAnimationGroup forKey:@"_layoutAnimationGroup"];
22
+ }
23
+
24
+ - (void)unscheduleKeyboardAnimation
25
+ {
26
+ RCTLayoutAnimationGroup *layoutAnimationGroup =
27
+ [[RCTLayoutAnimationGroup alloc] initWithConfig:nil callback:nil];
28
+
29
+ [self setValue:layoutAnimationGroup forKey:@"_layoutAnimationGroup"];
30
+ }
31
+
32
+ @end
@@ -14,13 +14,16 @@ public class KeyboardMovementObserver: NSObject {
14
14
  // class members
15
15
  var onEvent: (NSString, NSNumber, NSNumber, NSNumber, NSNumber) -> Void
16
16
  var onNotify: (String, Any) -> Void
17
+ // animation
18
+ var onRequestAnimation: () -> Void
19
+ var onCancelAnimation: () -> Void
17
20
  // progress tracker
18
21
  private var _keyboardView: UIView?
19
22
  private var keyboardView: UIView? {
20
23
  let windowsCount = UIApplication.shared.windows.count
21
24
 
22
25
  if _keyboardView == nil || windowsCount != _windowsCount {
23
- _keyboardView = findKeyboardView()
26
+ _keyboardView = KeyboardView.find()
24
27
  _windowsCount = windowsCount
25
28
  }
26
29
 
@@ -39,10 +42,14 @@ public class KeyboardMovementObserver: NSObject {
39
42
 
40
43
  @objc public init(
41
44
  handler: @escaping (NSString, NSNumber, NSNumber, NSNumber, NSNumber) -> Void,
42
- onNotify: @escaping (String, Any) -> Void
45
+ onNotify: @escaping (String, Any) -> Void,
46
+ onRequestAnimation: @escaping () -> Void,
47
+ onCancelAnimation: @escaping () -> Void
43
48
  ) {
44
49
  onEvent = handler
45
50
  self.onNotify = onNotify
51
+ self.onRequestAnimation = onRequestAnimation
52
+ self.onCancelAnimation = onCancelAnimation
46
53
  }
47
54
 
48
55
  @objc public func mount() {
@@ -167,6 +174,7 @@ public class KeyboardMovementObserver: NSObject {
167
174
  data["timestamp"] = Date.currentTimeStamp
168
175
  data["target"] = tag
169
176
 
177
+ onRequestAnimation()
170
178
  onEvent("onKeyboardMoveStart", Float(keyboardHeight) as NSNumber, 1, duration as NSNumber, tag)
171
179
  onNotify("KeyboardController::keyboardWillShow", data)
172
180
 
@@ -187,6 +195,7 @@ public class KeyboardMovementObserver: NSObject {
187
195
  data["timestamp"] = Date.currentTimeStamp
188
196
  data["target"] = tag
189
197
 
198
+ onRequestAnimation()
190
199
  onEvent("onKeyboardMoveStart", 0, 0, duration as NSNumber, tag)
191
200
  onNotify("KeyboardController::keyboardWillHide", data)
192
201
 
@@ -209,6 +218,7 @@ public class KeyboardMovementObserver: NSObject {
209
218
  data["timestamp"] = Date.currentTimeStamp
210
219
  data["target"] = tag
211
220
 
221
+ onCancelAnimation()
212
222
  onEvent("onKeyboardMoveEnd", keyboardHeight as NSNumber, 1, duration as NSNumber, tag)
213
223
  onNotify("KeyboardController::keyboardDidShow", data)
214
224
 
@@ -228,6 +238,7 @@ public class KeyboardMovementObserver: NSObject {
228
238
  data["timestamp"] = Date.currentTimeStamp
229
239
  data["target"] = tag
230
240
 
241
+ onCancelAnimation()
231
242
  onEvent("onKeyboardMoveEnd", 0 as NSNumber, 0, duration as NSNumber, tag)
232
243
  onNotify("KeyboardController::keyboardDidHide", data)
233
244
 
@@ -252,30 +263,6 @@ public class KeyboardMovementObserver: NSObject {
252
263
  displayLink = nil
253
264
  }
254
265
 
255
- // https://stackoverflow.com/questions/32598490/show-uiview-with-buttons-over-keyboard-like-in-skype-viber-messengers-swift-i
256
- func findKeyboardView() -> UIView? {
257
- var result: UIView?
258
-
259
- let windows = UIApplication.shared.windows
260
- for window in windows {
261
- if window.description.hasPrefix("<UITextEffectsWindow") {
262
- for subview in window.subviews {
263
- if subview.description.hasPrefix("<UIInputSetContainerView") {
264
- for hostView in subview.subviews {
265
- if hostView.description.hasPrefix("<UIInputSetHostView") {
266
- result = hostView
267
- break
268
- }
269
- }
270
- break
271
- }
272
- }
273
- break
274
- }
275
- }
276
- return result
277
- }
278
-
279
266
  @objc func updateKeyboardFrame() {
280
267
  if keyboardView == nil {
281
268
  return
@@ -0,0 +1,36 @@
1
+ //
2
+ // KeyboardView.swift
3
+ // KeyboardController
4
+ //
5
+ // Created by Kiryl Ziusko on 19/03/2024.
6
+ // Copyright © 2024 Facebook. All rights reserved.
7
+ //
8
+
9
+ import Foundation
10
+ import UIKit
11
+
12
+ enum KeyboardView {
13
+ // https://stackoverflow.com/questions/32598490/show-uiview-with-buttons-over-keyboard-like-in-skype-viber-messengers-swift-i
14
+ static func find() -> UIView? {
15
+ var result: UIView?
16
+
17
+ let windows = UIApplication.shared.windows
18
+ for window in windows {
19
+ if window.description.hasPrefix("<UITextEffectsWindow") {
20
+ for subview in window.subviews {
21
+ if subview.description.hasPrefix("<UIInputSetContainerView") {
22
+ for hostView in subview.subviews {
23
+ if hostView.description.hasPrefix("<UIInputSetHostView") {
24
+ result = hostView
25
+ break
26
+ }
27
+ }
28
+ break
29
+ }
30
+ }
31
+ break
32
+ }
33
+ }
34
+ return result
35
+ }
36
+ }
@@ -175,6 +175,12 @@ using namespace facebook::react;
175
175
  }
176
176
  onNotify:^(NSString *event, NSDictionary *data) {
177
177
  [KeyboardController.shared sendEvent:event body:data];
178
+ }
179
+ onRequestAnimation:^() {
180
+ // no-op for fabric
181
+ }
182
+ onCancelAnimation:^(){
183
+ // no-op for fabric
178
184
  }];
179
185
  }
180
186
 
@@ -52,6 +52,12 @@ class KeyboardControllerView: UIView {
52
52
  },
53
53
  onNotify: { [weak self] event, data in
54
54
  self?.onNotify(event: event, data: data)
55
+ },
56
+ onRequestAnimation: { [weak self] in
57
+ self?.onRequestAnimation()
58
+ },
59
+ onCancelAnimation: { [weak self] in
60
+ self?.onCancelAnimation()
55
61
  }
56
62
  )
57
63
  }
@@ -102,6 +108,14 @@ class KeyboardControllerView: UIView {
102
108
  )
103
109
  }
104
110
 
111
+ func onRequestAnimation() {
112
+ bridge.uiManager.scheduleKeyboardAnimation()
113
+ }
114
+
115
+ func onCancelAnimation() {
116
+ bridge.uiManager.unscheduleKeyboardAnimation()
117
+ }
118
+
105
119
  func onNotify(event: String, data: Any) {
106
120
  KeyboardController.shared()?.sendEvent(event, body: data)
107
121
  }
@@ -12,8 +12,8 @@ var _context = require("./context");
12
12
  var _internal = require("./internal");
13
13
  var _monkeyPatch = require("./monkey-patch");
14
14
  var _reanimated = require("./reanimated");
15
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
16
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
+ 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); }
16
+ 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 && Object.prototype.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; }
17
17
  const KeyboardControllerViewAnimated = _reactNativeReanimated.default.createAnimatedComponent(_reactNative.Animated.createAnimatedComponent(_bindings.KeyboardControllerView));
18
18
  const styles = _reactNative.StyleSheet.create({
19
19
  container: {
@@ -24,13 +24,15 @@ const styles = _reactNative.StyleSheet.create({
24
24
  position: "absolute"
25
25
  }
26
26
  });
27
- const KeyboardProvider = _ref => {
28
- let {
29
- children,
30
- statusBarTranslucent,
31
- navigationBarTranslucent,
32
- enabled: initiallyEnabled = true
33
- } = _ref;
27
+ // capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package
28
+ // 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
29
+ const OS = _reactNative.Platform.OS;
30
+ const KeyboardProvider = ({
31
+ children,
32
+ statusBarTranslucent,
33
+ navigationBarTranslucent,
34
+ enabled: initiallyEnabled = true
35
+ }) => {
34
36
  // state
35
37
  const [enabled, setEnabled] = (0, _react.useState)(initiallyEnabled);
36
38
  // animated values
@@ -77,7 +79,7 @@ const KeyboardProvider = _ref => {
77
79
  const updateSharedValues = (event, platforms) => {
78
80
  "worklet";
79
81
 
80
- if (platforms.includes(_reactNative.Platform.OS)) {
82
+ if (platforms.includes(OS)) {
81
83
  progressSV.value = event.progress;
82
84
  heightSV.value = -event.height;
83
85
  }
@@ -138,8 +140,8 @@ const KeyboardProvider = _ref => {
138
140
  }, /*#__PURE__*/_react.default.createElement(KeyboardControllerViewAnimated, {
139
141
  enabled: enabled,
140
142
  onKeyboardMoveReanimated: keyboardHandler,
141
- onKeyboardMoveStart: _reactNative.Platform.OS === "ios" ? onKeyboardMove : undefined,
142
- onKeyboardMove: _reactNative.Platform.OS === "android" ? onKeyboardMove : undefined,
143
+ onKeyboardMoveStart: OS === "ios" ? onKeyboardMove : undefined,
144
+ onKeyboardMove: OS === "android" ? onKeyboardMove : undefined,
143
145
  onKeyboardMoveInteractive: onKeyboardMove,
144
146
  onFocusedInputLayoutChangedReanimated: inputLayoutHandler,
145
147
  onFocusedInputTextChangedReanimated: inputTextHandler,
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_bindings","_context","_internal","_monkeyPatch","_reanimated","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","KeyboardControllerViewAnimated","Reanimated","createAnimatedComponent","Animated","KeyboardControllerView","styles","StyleSheet","create","container","flex","hidden","display","position","KeyboardProvider","_ref","children","statusBarTranslucent","navigationBarTranslucent","enabled","initiallyEnabled","setEnabled","useState","progress","useAnimatedValue","height","progressSV","useSharedValue","heightSV","layout","setKeyboardHandlers","broadcastKeyboardEvents","useSharedHandlers","setInputHandlers","broadcastInputEvents","context","useMemo","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","Platform","OS","value","keyboardHandler","useAnimatedKeyboardHandler","onKeyboardMoveStart","onKeyboardMoveEnd","onKeyboardMoveInteractive","inputLayoutHandler","useFocusedInputLayoutHandler","onFocusedInputLayoutChanged","e","target","inputTextHandler","useFocusedInputTextHandler","onFocusedInputTextChanged","useEffect","applyMonkeyPatch","revertMonkeyPatch","createElement","KeyboardContext","Provider","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","onFocusedInputTextChangedReanimated","View","exports"],"sources":["animated.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from \"react\";\nimport { Animated, Platform, StyleSheet } from \"react-native\";\nimport Reanimated, { useSharedValue } from \"react-native-reanimated\";\n\nimport { KeyboardControllerView } from \"./bindings\";\nimport { KeyboardContext } from \"./context\";\nimport { useAnimatedValue, useSharedHandlers } from \"./internal\";\nimport { applyMonkeyPatch, revertMonkeyPatch } from \"./monkey-patch\";\nimport {\n useAnimatedKeyboardHandler,\n useFocusedInputLayoutHandler,\n useFocusedInputTextHandler,\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 KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\n Animated.createAnimatedComponent(\n KeyboardControllerView,\n ) as React.FC<KeyboardControllerProps>,\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 * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\n * @platform android\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 * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\n * @platform android\n */\n navigationBarTranslucent?: boolean;\n /**\n * A boolean prop indicating whether the module is enabled. It indicate only initial state,\n * i. e. 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\nexport const KeyboardProvider = ({\n children,\n statusBarTranslucent,\n navigationBarTranslucent,\n enabled: initiallyEnabled = true,\n}: KeyboardProviderProps) => {\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, broadcastKeyboardEvents] =\n useSharedHandlers<KeyboardHandler>();\n const [setInputHandlers, broadcastInputEvents] =\n useSharedHandlers<FocusedInputHandler>();\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 { useNativeDriver: true },\n ),\n [],\n );\n // handlers\n const updateSharedValues = (event: NativeEvent, platforms: string[]) => {\n \"worklet\";\n\n if (platforms.includes(Platform.OS)) {\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 broadcastKeyboardEvents(\"onStart\", event);\n updateSharedValues(event, [\"ios\"]);\n },\n onKeyboardMove: (event: NativeEvent) => {\n \"worklet\";\n\n broadcastKeyboardEvents(\"onMove\", event);\n updateSharedValues(event, [\"android\"]);\n },\n onKeyboardMoveEnd: (event: NativeEvent) => {\n \"worklet\";\n\n broadcastKeyboardEvents(\"onEnd\", event);\n },\n onKeyboardMoveInteractive: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\", \"ios\"]);\n broadcastKeyboardEvents(\"onInteractive\", event);\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 const inputTextHandler = useFocusedInputTextHandler(\n {\n onFocusedInputTextChanged: (e) => {\n \"worklet\";\n\n broadcastInputEvents(\"onChangeText\", e);\n },\n },\n [],\n );\n // effects\n useEffect(() => {\n if (enabled) {\n applyMonkeyPatch();\n } else {\n revertMonkeyPatch();\n }\n }, [enabled]);\n\n return (\n <KeyboardContext.Provider value={context}>\n <KeyboardControllerViewAnimated\n enabled={enabled}\n onKeyboardMoveReanimated={keyboardHandler}\n onKeyboardMoveStart={Platform.OS === \"ios\" ? onKeyboardMove : undefined}\n onKeyboardMove={Platform.OS === \"android\" ? onKeyboardMove : undefined}\n onKeyboardMoveInteractive={onKeyboardMove}\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\n onFocusedInputTextChangedReanimated={inputTextHandler}\n navigationBarTranslucent={navigationBarTranslucent}\n statusBarTranslucent={statusBarTranslucent}\n style={styles.container}\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":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAH,uBAAA,CAAAC,OAAA;AAEA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AAIsB,SAAAQ,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WA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AM,CAACG;EAAU,GAEvBO,QAC6B,CAAC,eACjC/C,MAAA,CAAAiB,OAAA,CAAAoF,aAAA,CAAClG,YAAA,CAAAgC,QAAQ,CAACyE,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACArC,KAAK,EAAEA;EAAM,CACd,CACuB,CAAC;AAE/B,CAAC;AAACsC,OAAA,CAAAhE,gBAAA,GAAAA,gBAAA"}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_bindings","_context","_internal","_monkeyPatch","_reanimated","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","KeyboardControllerViewAnimated","Reanimated","createAnimatedComponent","Animated","KeyboardControllerView","styles","StyleSheet","create","container","flex","hidden","display","position","OS","Platform","KeyboardProvider","children","statusBarTranslucent","navigationBarTranslucent","enabled","initiallyEnabled","setEnabled","useState","progress","useAnimatedValue","height","progressSV","useSharedValue","heightSV","layout","setKeyboardHandlers","broadcastKeyboardEvents","useSharedHandlers","setInputHandlers","broadcastInputEvents","context","useMemo","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","value","keyboardHandler","useAnimatedKeyboardHandler","onKeyboardMoveStart","onKeyboardMoveEnd","onKeyboardMoveInteractive","inputLayoutHandler","useFocusedInputLayoutHandler","onFocusedInputLayoutChanged","target","inputTextHandler","useFocusedInputTextHandler","onFocusedInputTextChanged","useEffect","applyMonkeyPatch","revertMonkeyPatch","createElement","KeyboardContext","Provider","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","onFocusedInputTextChangedReanimated","View","exports"],"sources":["animated.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from \"react\";\nimport { Animated, Platform, StyleSheet } from \"react-native\";\nimport Reanimated, { useSharedValue } from \"react-native-reanimated\";\n\nimport { KeyboardControllerView } from \"./bindings\";\nimport { KeyboardContext } from \"./context\";\nimport { useAnimatedValue, useSharedHandlers } from \"./internal\";\nimport { applyMonkeyPatch, revertMonkeyPatch } from \"./monkey-patch\";\nimport {\n useAnimatedKeyboardHandler,\n useFocusedInputLayoutHandler,\n useFocusedInputTextHandler,\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 KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\n Animated.createAnimatedComponent(\n KeyboardControllerView,\n ) as React.FC<KeyboardControllerProps>,\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 * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\n * @platform android\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 * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\n * @platform android\n */\n navigationBarTranslucent?: boolean;\n /**\n * A boolean prop indicating whether the module is enabled. It indicate only initial state,\n * i. e. 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\nexport const KeyboardProvider = ({\n children,\n statusBarTranslucent,\n navigationBarTranslucent,\n enabled: initiallyEnabled = true,\n}: KeyboardProviderProps) => {\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, broadcastKeyboardEvents] =\n useSharedHandlers<KeyboardHandler>();\n const [setInputHandlers, broadcastInputEvents] =\n useSharedHandlers<FocusedInputHandler>();\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 { useNativeDriver: true },\n ),\n [],\n );\n // handlers\n const updateSharedValues = (event: NativeEvent, platforms: string[]) => {\n \"worklet\";\n\n if (platforms.includes(OS)) {\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 broadcastKeyboardEvents(\"onStart\", event);\n updateSharedValues(event, [\"ios\"]);\n },\n onKeyboardMove: (event: NativeEvent) => {\n \"worklet\";\n\n broadcastKeyboardEvents(\"onMove\", event);\n updateSharedValues(event, [\"android\"]);\n },\n onKeyboardMoveEnd: (event: NativeEvent) => {\n \"worklet\";\n\n broadcastKeyboardEvents(\"onEnd\", event);\n },\n onKeyboardMoveInteractive: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\", \"ios\"]);\n broadcastKeyboardEvents(\"onInteractive\", event);\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 const inputTextHandler = useFocusedInputTextHandler(\n {\n onFocusedInputTextChanged: (e) => {\n \"worklet\";\n\n broadcastInputEvents(\"onChangeText\", e);\n },\n },\n [],\n );\n // effects\n useEffect(() => {\n if (enabled) {\n applyMonkeyPatch();\n } else {\n revertMonkeyPatch();\n }\n }, [enabled]);\n\n return (\n <KeyboardContext.Provider value={context}>\n <KeyboardControllerViewAnimated\n enabled={enabled}\n onKeyboardMoveReanimated={keyboardHandler}\n onKeyboardMoveStart={OS === \"ios\" ? onKeyboardMove : undefined}\n onKeyboardMove={OS === \"android\" ? onKeyboardMove : undefined}\n onKeyboardMoveInteractive={onKeyboardMove}\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\n onFocusedInputTextChangedReanimated={inputTextHandler}\n navigationBarTranslucent={navigationBarTranslucent}\n statusBarTranslucent={statusBarTranslucent}\n style={styles.container}\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":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAH,uBAAA,CAAAC,OAAA;AAEA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IA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AAG+B,cAAc,GAAG2B,SAAU;IAC/D3B,cAAc,EAAE/B,EAAE,KAAK,SAAS,GAAG+B,cAAc,GAAG2B,SAAU;IAC9Df,yBAAyB,EAAEZ,cAAe;IAC1C4B,qCAAqC,EAAEf,kBAAmB;IAC1DgB,mCAAmC,EAAEZ,gBAAiB;IACtD3C,wBAAwB,EAAEA,wBAAyB;IACnDD,oBAAoB,EAAEA,oBAAqB;IAC3CuB,KAAK,EAAEnC,MAAM,CAACG;EAAU,GAEvBQ,QAC6B,CAAC,eACjC/C,MAAA,CAAAgB,OAAA,CAAAkF,aAAA,CAAC/F,YAAA,CAAA+B,QAAQ,CAACuE,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACAlC,KAAK,EAAEA;EAAM,CACd,CACuB,CAAC;AAE/B,CAAC;AAACmC,OAAA,CAAA5D,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.KeyboardGestureArea = exports.KeyboardEvents = exports.KeyboardControllerView = exports.KeyboardController = exports.FocusedInputEvents = void 0;
7
7
  var _reactNative = require("react-native");
8
8
  const NOOP = () => {};
9
- const KeyboardController = {
9
+ const KeyboardController = exports.KeyboardController = {
10
10
  setDefaultMode: NOOP,
11
11
  setInputMode: NOOP,
12
12
  dismiss: NOOP,
@@ -14,8 +14,7 @@ const KeyboardController = {
14
14
  addListener: NOOP,
15
15
  removeListeners: NOOP
16
16
  };
17
- exports.KeyboardController = KeyboardController;
18
- const KeyboardEvents = {
17
+ const KeyboardEvents = exports.KeyboardEvents = {
19
18
  addListener: () => ({
20
19
  remove: NOOP
21
20
  })
@@ -24,15 +23,11 @@ const KeyboardEvents = {
24
23
  * This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.
25
24
  * Use it with cautious.
26
25
  */
27
- exports.KeyboardEvents = KeyboardEvents;
28
- const FocusedInputEvents = {
26
+ const FocusedInputEvents = exports.FocusedInputEvents = {
29
27
  addListener: () => ({
30
28
  remove: NOOP
31
29
  })
32
30
  };
33
- exports.FocusedInputEvents = FocusedInputEvents;
34
- const KeyboardControllerView = _reactNative.View;
35
- exports.KeyboardControllerView = KeyboardControllerView;
36
- const KeyboardGestureArea = _reactNative.View;
37
- exports.KeyboardGestureArea = KeyboardGestureArea;
31
+ const KeyboardControllerView = exports.KeyboardControllerView = _reactNative.View;
32
+ const KeyboardGestureArea = exports.KeyboardGestureArea = _reactNative.View;
38
33
  //# sourceMappingURL=bindings.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","NOOP","KeyboardController","setDefaultMode","setInputMode","dismiss","setFocusTo","addListener","removeListeners","exports","KeyboardEvents","remove","FocusedInputEvents","KeyboardControllerView","View","KeyboardGestureArea"],"sources":["bindings.ts"],"sourcesContent":["import { View } from \"react-native\";\n\nimport type {\n FocusedInputEventsModule,\n KeyboardControllerModule,\n KeyboardControllerProps,\n KeyboardEventsModule,\n KeyboardGestureAreaProps,\n} from \"./types\";\nimport type { EmitterSubscription } from \"react-native\";\n\nconst NOOP = () => {};\nexport const KeyboardController: KeyboardControllerModule = {\n setDefaultMode: NOOP,\n setInputMode: NOOP,\n dismiss: NOOP,\n setFocusTo: NOOP,\n addListener: NOOP,\n removeListeners: NOOP,\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 KeyboardControllerView =\n View as unknown as React.FC<KeyboardControllerProps>;\nexport const KeyboardGestureArea =\n View as unknown as React.FC<KeyboardGestureAreaProps>;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAWA,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AACd,MAAMC,kBAA4C,GAAG;EAC1DC,cAAc,EAAEF,IAAI;EACpBG,YAAY,EAAEH,IAAI;EAClBI,OAAO,EAAEJ,IAAI;EACbK,UAAU,EAAEL,IAAI;EAChBM,WAAW,EAAEN,IAAI;EACjBO,eAAe,EAAEP;AACnB,CAAC;AAACQ,OAAA,CAAAP,kBAAA,GAAAA,kBAAA;AACK,MAAMQ,cAAoC,GAAG;EAClDH,WAAW,EAAEA,CAAA,MAAO;IAAEI,MAAM,EAAEV;EAAK,CAAC;AACtC,CAAC;AACD;AACA;AACA;AACA;AAHAQ,OAAA,CAAAC,cAAA,GAAAA,cAAA;AAIO,MAAME,kBAA4C,GAAG;EAC1DL,WAAW,EAAEA,CAAA,MAAO;IAAEI,MAAM,EAAEV;EAAK,CAAC;AACtC,CAAC;AAACQ,OAAA,CAAAG,kBAAA,GAAAA,kBAAA;AACK,MAAMC,sBAAsB,GACjCC,iBAAoD;AAACL,OAAA,CAAAI,sBAAA,GAAAA,sBAAA;AAChD,MAAME,mBAAmB,GAC9BD,iBAAqD;AAACL,OAAA,CAAAM,mBAAA,GAAAA,mBAAA"}
1
+ {"version":3,"names":["_reactNative","require","NOOP","KeyboardController","exports","setDefaultMode","setInputMode","dismiss","setFocusTo","addListener","removeListeners","KeyboardEvents","remove","FocusedInputEvents","KeyboardControllerView","View","KeyboardGestureArea"],"sources":["bindings.ts"],"sourcesContent":["import { View } from \"react-native\";\n\nimport type {\n FocusedInputEventsModule,\n KeyboardControllerModule,\n KeyboardControllerProps,\n KeyboardEventsModule,\n KeyboardGestureAreaProps,\n} from \"./types\";\nimport type { EmitterSubscription } from \"react-native\";\n\nconst NOOP = () => {};\nexport const KeyboardController: KeyboardControllerModule = {\n setDefaultMode: NOOP,\n setInputMode: NOOP,\n dismiss: NOOP,\n setFocusTo: NOOP,\n addListener: NOOP,\n removeListeners: NOOP,\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 KeyboardControllerView =\n View as unknown as React.FC<KeyboardControllerProps>;\nexport const KeyboardGestureArea =\n View as unknown as React.FC<KeyboardGestureAreaProps>;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAWA,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AACd,MAAMC,kBAA4C,GAAAC,OAAA,CAAAD,kBAAA,GAAG;EAC1DE,cAAc,EAAEH,IAAI;EACpBI,YAAY,EAAEJ,IAAI;EAClBK,OAAO,EAAEL,IAAI;EACbM,UAAU,EAAEN,IAAI;EAChBO,WAAW,EAAEP,IAAI;EACjBQ,eAAe,EAAER;AACnB,CAAC;AACM,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,sBAAsB,GAAAV,OAAA,CAAAU,sBAAA,GACjCC,iBAAoD;AAC/C,MAAMC,mBAAmB,GAAAZ,OAAA,CAAAY,mBAAA,GAC9BD,iBAAqD","ignoreList":[]}
@@ -10,33 +10,25 @@ const LINKING_ERROR = `The package 'react-native-keyboard-controller' doesn't se
10
10
  default: ""
11
11
  }) + "- You rebuilt the app after installing the package\n" + "- You are not using Expo Go\n";
12
12
  const RCTKeyboardController = require("./specs/NativeKeyboardController").default;
13
- const KeyboardController = RCTKeyboardController ? RCTKeyboardController : new Proxy({}, {
13
+ const KeyboardController = exports.KeyboardController = RCTKeyboardController ? RCTKeyboardController : new Proxy({}, {
14
14
  get() {
15
15
  throw new Error(LINKING_ERROR);
16
16
  }
17
17
  });
18
- exports.KeyboardController = KeyboardController;
19
18
  const KEYBOARD_CONTROLLER_NAMESPACE = "KeyboardController::";
20
19
  const eventEmitter = new _reactNative.NativeEventEmitter(KeyboardController);
21
- const KeyboardEvents = {
20
+ const KeyboardEvents = exports.KeyboardEvents = {
22
21
  addListener: (name, cb) => eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb)
23
22
  };
24
23
  /**
25
24
  * This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.
26
25
  * Use it with cautious.
27
26
  */
28
- exports.KeyboardEvents = KeyboardEvents;
29
- const FocusedInputEvents = {
27
+ const FocusedInputEvents = exports.FocusedInputEvents = {
30
28
  addListener: (name, cb) => eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb)
31
29
  };
32
- exports.FocusedInputEvents = FocusedInputEvents;
33
- const KeyboardControllerView = require("./specs/KeyboardControllerViewNativeComponent").default;
34
- exports.KeyboardControllerView = KeyboardControllerView;
35
- const KeyboardGestureArea = _reactNative.Platform.OS === "android" && _reactNative.Platform.Version >= 30 ? require("./specs/KeyboardGestureAreaNativeComponent").default : _ref => {
36
- let {
37
- children
38
- } = _ref;
39
- return children;
40
- };
41
- exports.KeyboardGestureArea = KeyboardGestureArea;
30
+ const KeyboardControllerView = exports.KeyboardControllerView = require("./specs/KeyboardControllerViewNativeComponent").default;
31
+ const KeyboardGestureArea = exports.KeyboardGestureArea = _reactNative.Platform.OS === "android" && _reactNative.Platform.Version >= 30 ? require("./specs/KeyboardGestureAreaNativeComponent").default : ({
32
+ children
33
+ }) => children;
42
34
  //# sourceMappingURL=bindings.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","RCTKeyboardController","KeyboardController","Proxy","get","Error","exports","KEYBOARD_CONTROLLER_NAMESPACE","eventEmitter","NativeEventEmitter","KeyboardEvents","addListener","name","cb","FocusedInputEvents","KeyboardControllerView","KeyboardGestureArea","OS","Version","_ref","children"],"sources":["bindings.native.ts"],"sourcesContent":["import { NativeEventEmitter, Platform } from \"react-native\";\n\nimport type {\n FocusedInputEventsModule,\n KeyboardControllerModule,\n KeyboardControllerProps,\n KeyboardEventsModule,\n KeyboardGestureAreaProps,\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;\nexport const KeyboardController = (\n RCTKeyboardController\n ? RCTKeyboardController\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n },\n )\n) as KeyboardControllerModule;\n\nconst KEYBOARD_CONTROLLER_NAMESPACE = \"KeyboardController::\";\nconst eventEmitter = new NativeEventEmitter(KeyboardController);\n\nexport const KeyboardEvents: KeyboardEventsModule = {\n addListener: (name, cb) =>\n eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),\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 KeyboardControllerView: React.FC<KeyboardControllerProps> =\n require(\"./specs/KeyboardControllerViewNativeComponent\").default;\nexport const KeyboardGestureArea: React.FC<KeyboardGestureAreaProps> =\n Platform.OS === \"android\" && Platform.Version >= 30\n ? require(\"./specs/KeyboardGestureAreaNativeComponent\").default\n : ({ children }: KeyboardGestureAreaProps) => children;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAUA,MAAMC,aAAa,GAChB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;IAAEC;EAAmC,CAAC,GAAAD,IAAA;EAAA,OAAKC,QAAQ;AAAA;AAACd,OAAA,CAAAU,mBAAA,GAAAA,mBAAA"}
1
+ {"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","RCTKeyboardController","KeyboardController","exports","Proxy","get","Error","KEYBOARD_CONTROLLER_NAMESPACE","eventEmitter","NativeEventEmitter","KeyboardEvents","addListener","name","cb","FocusedInputEvents","KeyboardControllerView","KeyboardGestureArea","OS","Version","children"],"sources":["bindings.native.ts"],"sourcesContent":["import { NativeEventEmitter, Platform } from \"react-native\";\n\nimport type {\n FocusedInputEventsModule,\n KeyboardControllerModule,\n KeyboardControllerProps,\n KeyboardEventsModule,\n KeyboardGestureAreaProps,\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;\nexport const KeyboardController = (\n RCTKeyboardController\n ? RCTKeyboardController\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n },\n )\n) as KeyboardControllerModule;\n\nconst KEYBOARD_CONTROLLER_NAMESPACE = \"KeyboardController::\";\nconst eventEmitter = new NativeEventEmitter(KeyboardController);\n\nexport const KeyboardEvents: KeyboardEventsModule = {\n addListener: (name, cb) =>\n eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),\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 KeyboardControllerView: React.FC<KeyboardControllerProps> =\n require(\"./specs/KeyboardControllerViewNativeComponent\").default;\nexport const KeyboardGestureArea: React.FC<KeyboardGestureAreaProps> =\n Platform.OS === \"android\" && Platform.Version >= 30\n ? require(\"./specs/KeyboardGestureAreaNativeComponent\").default\n : ({ children }: KeyboardGestureAreaProps) => children;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAUA,MAAMC,aAAa,GAChB,2FAA0F,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;AAC9C,MAAME,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAC7BD,qBAAqB,GACjBA,qBAAqB,GACrB,IAAIG,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACV,aAAa,CAAC;EAChC;AACF,CACF,CACuB;AAE7B,MAAMW,6BAA6B,GAAG,sBAAsB;AAC5D,MAAMC,YAAY,GAAG,IAAIC,+BAAkB,CAACP,kBAAkB,CAAC;AAExD,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;AACD;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,sBAAyD,GAAAZ,OAAA,CAAAY,sBAAA,GACpEpB,OAAO,CAAC,+CAA+C,CAAC,CAACK,OAAO;AAC3D,MAAMgB,mBAAuD,GAAAb,OAAA,CAAAa,mBAAA,GAClEnB,qBAAQ,CAACoB,EAAE,KAAK,SAAS,IAAIpB,qBAAQ,CAACqB,OAAO,IAAI,EAAE,GAC/CvB,OAAO,CAAC,4CAA4C,CAAC,CAACK,OAAO,GAC7D,CAAC;EAAEmB;AAAmC,CAAC,KAAKA,QAAQ","ignoreList":[]}
@@ -7,10 +7,13 @@ exports.useKeyboardAnimation = void 0;
7
7
  var _reactNativeReanimated = require("react-native-reanimated");
8
8
  var _reactNativeKeyboardController = require("react-native-keyboard-controller");
9
9
  const useKeyboardAnimation = () => {
10
- const heightWhenOpened = (0, _reactNativeReanimated.useSharedValue)(0);
11
- const height = (0, _reactNativeReanimated.useSharedValue)(0);
12
- const progress = (0, _reactNativeReanimated.useSharedValue)(0);
13
- const isClosed = (0, _reactNativeReanimated.useSharedValue)(true);
10
+ const {
11
+ reanimated
12
+ } = (0, _reactNativeKeyboardController.useKeyboardContext)();
13
+ const heightWhenOpened = (0, _reactNativeReanimated.useSharedValue)(-reanimated.height.value);
14
+ const height = (0, _reactNativeReanimated.useSharedValue)(-reanimated.height.value);
15
+ const progress = (0, _reactNativeReanimated.useSharedValue)(reanimated.progress.value);
16
+ const isClosed = (0, _reactNativeReanimated.useSharedValue)(reanimated.progress.value === 0);
14
17
  (0, _reactNativeKeyboardController.useKeyboardHandler)({
15
18
  onStart: e => {
16
19
  "worklet";
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNativeReanimated","require","_reactNativeKeyboardController","useKeyboardAnimation","heightWhenOpened","useSharedValue","height","progress","isClosed","useKeyboardHandler","onStart","e","value","onMove","onEnd","duration","exports"],"sources":["hooks.ts"],"sourcesContent":["import { useSharedValue } from \"react-native-reanimated\";\n\nimport { useKeyboardHandler } from \"react-native-keyboard-controller\";\n\nexport const useKeyboardAnimation = () => {\n const heightWhenOpened = useSharedValue(0);\n const height = useSharedValue(0);\n const progress = useSharedValue(0);\n const isClosed = useSharedValue(true);\n\n useKeyboardHandler(\n {\n onStart: (e) => {\n \"worklet\";\n\n if (e.height > 0) {\n isClosed.value = false;\n heightWhenOpened.value = e.height;\n }\n },\n onMove: (e) => {\n \"worklet\";\n\n progress.value = e.progress;\n height.value = e.height;\n },\n onEnd: (e) => {\n \"worklet\";\n\n isClosed.value = e.height === 0;\n\n // `height` update happens in `onMove` handler\n // in `onEnd` we need to update only if `onMove`\n // wasn't called (i. e. duration === 0)\n //\n // we can not call this code without condition below\n // because in some corner cases (iOS with `secureTextEntry`)\n // `onEnd` can be emitted before `onMove` and in this case\n // it may lead to choppy/glitchy/jumpy UI\n // see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/327\n if (e.duration === 0) {\n progress.value = e.progress;\n height.value = e.height;\n }\n },\n },\n [],\n );\n\n return { height, progress, heightWhenOpened, isClosed };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AAEA,IAAAC,8BAAA,GAAAD,OAAA;AAEO,MAAME,oBAAoB,GAAGA,CAAA,KAAM;EACxC,MAAMC,gBAAgB,GAAG,IAAAC,qCAAc,EAAC,CAAC,CAAC;EAC1C,MAAMC,MAAM,GAAG,IAAAD,qCAAc,EAAC,CAAC,CAAC;EAChC,MAAME,QAAQ,GAAG,IAAAF,qCAAc,EAAC,CAAC,CAAC;EAClC,MAAMG,QAAQ,GAAG,IAAAH,qCAAc,EAAC,IAAI,CAAC;EAErC,IAAAI,iDAAkB,EAChB;IACEC,OAAO,EAAGC,CAAC,IAAK;MACd,SAAS;;MAET,IAAIA,CAAC,CAACL,MAAM,GAAG,CAAC,EAAE;QAChBE,QAAQ,CAACI,KAAK,GAAG,KAAK;QACtBR,gBAAgB,CAACQ,KAAK,GAAGD,CAAC,CAACL,MAAM;MACnC;IACF,CAAC;IACDO,MAAM,EAAGF,CAAC,IAAK;MACb,SAAS;;MAETJ,QAAQ,CAACK,KAAK,GAAGD,CAAC,CAACJ,QAAQ;MAC3BD,MAAM,CAACM,KAAK,GAAGD,CAAC,CAACL,MAAM;IACzB,CAAC;IACDQ,KAAK,EAAGH,CAAC,IAAK;MACZ,SAAS;;MAETH,QAAQ,CAACI,KAAK,GAAGD,CAAC,CAACL,MAAM,KAAK,CAAC;;MAE/B;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA,IAAIK,CAAC,CAACI,QAAQ,KAAK,CAAC,EAAE;QACpBR,QAAQ,CAACK,KAAK,GAAGD,CAAC,CAACJ,QAAQ;QAC3BD,MAAM,CAACM,KAAK,GAAGD,CAAC,CAACL,MAAM;MACzB;IACF;EACF,CAAC,EACD,EACF,CAAC;EAED,OAAO;IAAEA,MAAM;IAAEC,QAAQ;IAAEH,gBAAgB;IAAEI;EAAS,CAAC;AACzD,CAAC;AAACQ,OAAA,CAAAb,oBAAA,GAAAA,oBAAA"}
1
+ {"version":3,"names":["_reactNativeReanimated","require","_reactNativeKeyboardController","useKeyboardAnimation","reanimated","useKeyboardContext","heightWhenOpened","useSharedValue","height","value","progress","isClosed","useKeyboardHandler","onStart","e","onMove","onEnd","duration","exports"],"sources":["hooks.ts"],"sourcesContent":["import { useSharedValue } from \"react-native-reanimated\";\n\nimport {\n useKeyboardContext,\n useKeyboardHandler,\n} from \"react-native-keyboard-controller\";\n\nexport const useKeyboardAnimation = () => {\n const { reanimated } = useKeyboardContext();\n const heightWhenOpened = useSharedValue(-reanimated.height.value);\n const height = useSharedValue(-reanimated.height.value);\n const progress = useSharedValue(reanimated.progress.value);\n const isClosed = useSharedValue(reanimated.progress.value === 0);\n\n useKeyboardHandler(\n {\n onStart: (e) => {\n \"worklet\";\n\n if (e.height > 0) {\n isClosed.value = false;\n heightWhenOpened.value = e.height;\n }\n },\n onMove: (e) => {\n \"worklet\";\n\n progress.value = e.progress;\n height.value = e.height;\n },\n onEnd: (e) => {\n \"worklet\";\n\n isClosed.value = e.height === 0;\n\n // `height` update happens in `onMove` handler\n // in `onEnd` we need to update only if `onMove`\n // wasn't called (i. e. duration === 0)\n //\n // we can not call this code without condition below\n // because in some corner cases (iOS with `secureTextEntry`)\n // `onEnd` can be emitted before `onMove` and in this case\n // it may lead to choppy/glitchy/jumpy UI\n // see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/327\n if (e.duration === 0) {\n progress.value = e.progress;\n height.value = e.height;\n }\n },\n },\n [],\n );\n\n return { height, progress, heightWhenOpened, isClosed };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AAEA,IAAAC,8BAAA,GAAAD,OAAA;AAKO,MAAME,oBAAoB,GAAGA,CAAA,KAAM;EACxC,MAAM;IAAEC;EAAW,CAAC,GAAG,IAAAC,iDAAkB,EAAC,CAAC;EAC3C,MAAMC,gBAAgB,GAAG,IAAAC,qCAAc,EAAC,CAACH,UAAU,CAACI,MAAM,CAACC,KAAK,CAAC;EACjE,MAAMD,MAAM,GAAG,IAAAD,qCAAc,EAAC,CAACH,UAAU,CAACI,MAAM,CAACC,KAAK,CAAC;EACvD,MAAMC,QAAQ,GAAG,IAAAH,qCAAc,EAACH,UAAU,CAACM,QAAQ,CAACD,KAAK,CAAC;EAC1D,MAAME,QAAQ,GAAG,IAAAJ,qCAAc,EAACH,UAAU,CAACM,QAAQ,CAACD,KAAK,KAAK,CAAC,CAAC;EAEhE,IAAAG,iDAAkB,EAChB;IACEC,OAAO,EAAGC,CAAC,IAAK;MACd,SAAS;;MAET,IAAIA,CAAC,CAACN,MAAM,GAAG,CAAC,EAAE;QAChBG,QAAQ,CAACF,KAAK,GAAG,KAAK;QACtBH,gBAAgB,CAACG,KAAK,GAAGK,CAAC,CAACN,MAAM;MACnC;IACF,CAAC;IACDO,MAAM,EAAGD,CAAC,IAAK;MACb,SAAS;;MAETJ,QAAQ,CAACD,KAAK,GAAGK,CAAC,CAACJ,QAAQ;MAC3BF,MAAM,CAACC,KAAK,GAAGK,CAAC,CAACN,MAAM;IACzB,CAAC;IACDQ,KAAK,EAAGF,CAAC,IAAK;MACZ,SAAS;;MAETH,QAAQ,CAAC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