react-native-keyboard-controller 1.13.3 → 1.14.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 (121) hide show
  1. package/README.md +1 -0
  2. package/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardControllerModule.kt +5 -3
  3. package/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardControllerViewManager.kt +19 -20
  4. package/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardGestureAreaViewManager.kt +22 -12
  5. package/android/src/fabric/java/com/reactnativekeyboardcontroller/OverKeyboardViewManager.kt +40 -0
  6. package/android/src/fabric/java/com/reactnativekeyboardcontroller/StatusBarManagerCompatModule.kt +7 -3
  7. package/android/src/main/java/com/reactnativekeyboardcontroller/KeyboardControllerPackage.kt +33 -27
  8. package/android/src/main/java/com/reactnativekeyboardcontroller/events/FocusedInputLayoutChangedEvent.kt +16 -15
  9. package/android/src/main/java/com/reactnativekeyboardcontroller/events/FocusedInputSelectionChangedEvent.kt +25 -24
  10. package/android/src/main/java/com/reactnativekeyboardcontroller/events/FocusedInputTextChangedEvent.kt +4 -3
  11. package/android/src/main/java/com/reactnativekeyboardcontroller/events/KeyboardTransitionEvent.kt +7 -6
  12. package/android/src/main/java/com/reactnativekeyboardcontroller/extensions/Context.kt +38 -0
  13. package/android/src/main/java/com/reactnativekeyboardcontroller/extensions/EditText.kt +82 -62
  14. package/android/src/main/java/com/reactnativekeyboardcontroller/extensions/ReactContext.kt +9 -4
  15. package/android/src/main/java/com/reactnativekeyboardcontroller/extensions/ThemedReactContext.kt +12 -5
  16. package/android/src/main/java/com/reactnativekeyboardcontroller/extensions/View.kt +12 -10
  17. package/android/src/main/java/com/reactnativekeyboardcontroller/interactive/KeyboardAnimationController.kt +65 -60
  18. package/android/src/main/java/com/reactnativekeyboardcontroller/interactive/interpolators/Interpolator.kt +6 -1
  19. package/android/src/main/java/com/reactnativekeyboardcontroller/interactive/interpolators/IosInterpolator.kt +4 -2
  20. package/android/src/main/java/com/reactnativekeyboardcontroller/interactive/interpolators/LinearInterpolator.kt +1 -3
  21. package/android/src/main/java/com/reactnativekeyboardcontroller/listeners/FocusedInputObserver.kt +62 -58
  22. package/android/src/main/java/com/reactnativekeyboardcontroller/listeners/KeyboardAnimationCallback.kt +52 -46
  23. package/android/src/main/java/com/reactnativekeyboardcontroller/listeners/WindowDimensionListener.kt +13 -7
  24. package/android/src/main/java/com/reactnativekeyboardcontroller/log/Logger.kt +28 -0
  25. package/android/src/main/java/com/reactnativekeyboardcontroller/managers/KeyboardControllerViewManagerImpl.kt +35 -24
  26. package/android/src/main/java/com/reactnativekeyboardcontroller/managers/KeyboardGestureAreaViewManagerImpl.kt +21 -8
  27. package/android/src/main/java/com/reactnativekeyboardcontroller/managers/OverKeyboardViewManagerImpl.kt +27 -0
  28. package/android/src/main/java/com/reactnativekeyboardcontroller/modal/ModalAttachedWatcher.kt +15 -13
  29. package/android/src/main/java/com/reactnativekeyboardcontroller/modules/KeyboardControllerModuleImpl.kt +8 -8
  30. package/android/src/main/java/com/reactnativekeyboardcontroller/modules/StatusBarManagerCompatModuleImpl.kt +10 -5
  31. package/android/src/main/java/com/reactnativekeyboardcontroller/traversal/FocusedInputHolder.kt +1 -3
  32. package/android/src/main/java/com/reactnativekeyboardcontroller/traversal/ViewHierarchyNavigator.kt +19 -13
  33. package/android/src/main/java/com/reactnativekeyboardcontroller/ui/FrameScheduler.kt +11 -8
  34. package/android/src/main/java/com/reactnativekeyboardcontroller/views/EdgeToEdgeReactViewGroup.kt +24 -19
  35. package/android/src/main/java/com/reactnativekeyboardcontroller/views/KeyboardGestureAreaReactViewGroup.kt +23 -14
  36. package/android/src/main/java/com/reactnativekeyboardcontroller/views/overlay/OverKeyboardHostShadowNode.kt +30 -0
  37. package/android/src/main/java/com/reactnativekeyboardcontroller/views/overlay/OverKeyboardViewGroup.kt +185 -0
  38. package/android/src/paper/java/com/reactnativekeyboardcontroller/KeyboardControllerModule.kt +3 -1
  39. package/android/src/paper/java/com/reactnativekeyboardcontroller/KeyboardControllerViewManager.kt +19 -10
  40. package/android/src/paper/java/com/reactnativekeyboardcontroller/KeyboardGestureAreaViewManager.kt +21 -8
  41. package/android/src/paper/java/com/reactnativekeyboardcontroller/OverKeyboardViewManager.kt +33 -0
  42. package/android/src/paper/java/com/reactnativekeyboardcontroller/StatusBarManagerCompatModule.kt +7 -3
  43. package/android/src/test/java/com/reactnativekeyboardcontroller/traversal/ViewHierarchyNavigatorTest.kt +30 -21
  44. package/ios/KeyboardController-Bridging-Header.h +1 -0
  45. package/ios/extensions/UIResponder.swift +0 -3
  46. package/ios/extensions/UIWindow.swift +48 -0
  47. package/ios/views/OverKeyboardViewManager.h +29 -0
  48. package/ios/views/OverKeyboardViewManager.mm +220 -0
  49. package/jest/index.js +1 -0
  50. package/lib/commonjs/bindings.js +2 -1
  51. package/lib/commonjs/bindings.js.map +1 -1
  52. package/lib/commonjs/bindings.native.js +2 -1
  53. package/lib/commonjs/bindings.native.js.map +1 -1
  54. package/lib/commonjs/components/KeyboardAwareScrollView/index.js +2 -1
  55. package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
  56. package/lib/commonjs/components/KeyboardToolbar/index.js +5 -3
  57. package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -1
  58. package/lib/commonjs/hooks/index.js +2 -4
  59. package/lib/commonjs/hooks/index.js.map +1 -1
  60. package/lib/commonjs/index.js +9 -1
  61. package/lib/commonjs/index.js.map +1 -1
  62. package/lib/commonjs/internal.js +24 -12
  63. package/lib/commonjs/internal.js.map +1 -1
  64. package/lib/commonjs/specs/OverKeyboardViewNativeComponent.js +10 -0
  65. package/lib/commonjs/specs/OverKeyboardViewNativeComponent.js.map +1 -0
  66. package/lib/commonjs/types.js.map +1 -1
  67. package/lib/commonjs/views/OverKeyboardView/index.js +43 -0
  68. package/lib/commonjs/views/OverKeyboardView/index.js.map +1 -0
  69. package/lib/commonjs/views/index.js +14 -0
  70. package/lib/commonjs/views/index.js.map +1 -0
  71. package/lib/module/bindings.js +1 -0
  72. package/lib/module/bindings.js.map +1 -1
  73. package/lib/module/bindings.native.js +1 -0
  74. package/lib/module/bindings.native.js.map +1 -1
  75. package/lib/module/components/KeyboardAwareScrollView/index.js +2 -1
  76. package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -1
  77. package/lib/module/components/KeyboardToolbar/index.js +5 -3
  78. package/lib/module/components/KeyboardToolbar/index.js.map +1 -1
  79. package/lib/module/hooks/index.js +3 -4
  80. package/lib/module/hooks/index.js.map +1 -1
  81. package/lib/module/index.js +1 -0
  82. package/lib/module/index.js.map +1 -1
  83. package/lib/module/internal.js +24 -12
  84. package/lib/module/internal.js.map +1 -1
  85. package/lib/module/specs/OverKeyboardViewNativeComponent.js +3 -0
  86. package/lib/module/specs/OverKeyboardViewNativeComponent.js.map +1 -0
  87. package/lib/module/types.js.map +1 -1
  88. package/lib/module/views/OverKeyboardView/index.js +35 -0
  89. package/lib/module/views/OverKeyboardView/index.js.map +1 -0
  90. package/lib/module/views/index.js +2 -0
  91. package/lib/module/views/index.js.map +1 -0
  92. package/lib/typescript/bindings.d.ts +2 -1
  93. package/lib/typescript/bindings.native.d.ts +2 -1
  94. package/lib/typescript/components/KeyboardAwareScrollView/index.d.ts +4 -0
  95. package/lib/typescript/components/KeyboardToolbar/index.d.ts +2 -2
  96. package/lib/typescript/index.d.ts +1 -0
  97. package/lib/typescript/specs/OverKeyboardViewNativeComponent.d.ts +7 -0
  98. package/lib/typescript/types.d.ts +4 -1
  99. package/lib/typescript/views/OverKeyboardView/index.d.ts +5 -0
  100. package/lib/typescript/views/index.d.ts +1 -0
  101. package/package.json +8 -3
  102. package/src/bindings.native.ts +3 -0
  103. package/src/bindings.ts +3 -0
  104. package/src/components/KeyboardAwareScrollView/index.tsx +5 -2
  105. package/src/components/KeyboardToolbar/index.tsx +7 -3
  106. package/src/hooks/index.ts +3 -5
  107. package/src/index.ts +1 -0
  108. package/src/internal.ts +34 -15
  109. package/src/specs/OverKeyboardViewNativeComponent.ts +12 -0
  110. package/src/types.ts +4 -0
  111. package/src/views/OverKeyboardView/index.tsx +43 -0
  112. package/src/views/index.ts +1 -0
  113. package/ios/.clang-format +0 -90
  114. package/ios/.swiftformat +0 -5
  115. package/ios/.swiftlint.yml +0 -14
  116. package/lib/commonjs/hooks/useSyncEffect/index.js +0 -37
  117. package/lib/commonjs/hooks/useSyncEffect/index.js.map +0 -1
  118. package/lib/module/hooks/useSyncEffect/index.js +0 -31
  119. package/lib/module/hooks/useSyncEffect/index.js.map +0 -1
  120. package/lib/typescript/hooks/useSyncEffect/index.d.ts +0 -14
  121. package/src/hooks/useSyncEffect/index.ts +0 -36
@@ -0,0 +1,220 @@
1
+ //
2
+ // OverKeyboardViewManager.mm
3
+ // react-native-keyboard-controller
4
+ //
5
+ // Created by Kiryl Ziusko on 11/09/2024.
6
+ //
7
+
8
+ #import "OverKeyboardViewManager.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/ComponentDescriptors.h>
20
+ #import <react/renderer/components/reactnativekeyboardcontroller/EventEmitters.h>
21
+ #import <react/renderer/components/reactnativekeyboardcontroller/Props.h>
22
+ #import <react/renderer/components/reactnativekeyboardcontroller/RCTComponentViewHelpers.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 OverKeyboardViewManager
36
+
37
+ RCT_EXPORT_MODULE(OverKeyboardViewManager)
38
+
39
+ // Expose the `visible` prop to React Native
40
+ RCT_EXPORT_VIEW_PROPERTY(visible, BOOL)
41
+
42
+ + (BOOL)requiresMainQueueSetup
43
+ {
44
+ return NO;
45
+ }
46
+
47
+ #ifndef RCT_NEW_ARCH_ENABLED
48
+ - (UIView *)view
49
+ {
50
+ return [[OverKeyboardView alloc] initWithBridge:self.bridge];
51
+ }
52
+ #endif
53
+
54
+ @end
55
+
56
+ // MARK: View
57
+ #ifdef RCT_NEW_ARCH_ENABLED
58
+ @interface OverKeyboardView () <RCTOverKeyboardViewViewProtocol>
59
+ @end
60
+ #endif
61
+
62
+ @implementation OverKeyboardView {
63
+ UIView *_contentView;
64
+ #ifdef RCT_NEW_ARCH_ENABLED
65
+ RCTSurfaceTouchHandler *_touchHandler;
66
+ #else
67
+ RCTTouchHandler *_touchHandler;
68
+ #endif
69
+ }
70
+
71
+ #ifdef RCT_NEW_ARCH_ENABLED
72
+ + (ComponentDescriptorProvider)componentDescriptorProvider
73
+ {
74
+ return concreteComponentDescriptorProvider<OverKeyboardViewComponentDescriptor>();
75
+ }
76
+ #endif
77
+
78
+ // Needed because of this: https://github.com/facebook/react-native/pull/37274
79
+ + (void)load
80
+ {
81
+ [super load];
82
+
83
+ // Eagerly initialize the observer
84
+ (void)[UIWindow sharedKeyboardWindowObserver];
85
+ }
86
+
87
+ // MARK: Constructor
88
+ #ifdef RCT_NEW_ARCH_ENABLED
89
+ - (instancetype)init
90
+ {
91
+ if (self = [super init]) {
92
+ _touchHandler = [RCTSurfaceTouchHandler new];
93
+ _contentView = [[UIView alloc] initWithFrame:CGRectZero];
94
+ }
95
+ return self;
96
+ }
97
+ #else
98
+ - (instancetype)initWithBridge:(RCTBridge *)bridge
99
+ {
100
+ self = [super initWithFrame:CGRectZero];
101
+ if (self) {
102
+ _touchHandler = [[RCTTouchHandler alloc] initWithBridge:bridge];
103
+ _contentView = [[UIView alloc] initWithFrame:CGRectZero];
104
+ }
105
+ return self;
106
+ }
107
+ #endif
108
+
109
+ // MARK: touch handling
110
+ - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
111
+ {
112
+ BOOL canReceiveTouchEvents = ([self isUserInteractionEnabled] && ![self isHidden] && _visible);
113
+ if (!canReceiveTouchEvents) {
114
+ return nil;
115
+ }
116
+
117
+ // `hitSubview` is the topmost subview which was hit. The hit point can
118
+ // be outside the bounds of `view` (e.g., if -clipsToBounds is NO).
119
+ UIView *hitSubview = nil;
120
+ BOOL isPointInside = [self pointInside:point withEvent:event];
121
+ if (![self clipsToBounds] || isPointInside) {
122
+ // TODO: should we take zIndex into consideration?
123
+ // The default behaviour of UIKit is that if a view does not contain a point,
124
+ // then no subviews will be returned from hit testing, even if they contain
125
+ // the hit point. By doing hit testing directly on the subviews, we bypass
126
+ // the strict containment policy (i.e., UIKit guarantees that every ancestor
127
+ // of the hit view will return YES from -pointInside:withEvent:). See:
128
+ // - https://developer.apple.com/library/ios/qa/qa2013/qa1812.html
129
+ for (UIView *subview in [_contentView.subviews reverseObjectEnumerator]) {
130
+ CGPoint convertedPoint = [subview convertPoint:point fromView:self];
131
+ hitSubview = [subview hitTest:convertedPoint withEvent:event];
132
+ if (hitSubview != nil) {
133
+ break;
134
+ }
135
+ }
136
+ }
137
+ return hitSubview;
138
+ }
139
+
140
+ // MARK: props updater
141
+ #ifdef RCT_NEW_ARCH_ENABLED
142
+ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
143
+ {
144
+ const auto &oldViewProps = *std::static_pointer_cast<const OverKeyboardViewProps>(_props);
145
+ const auto &newViewProps = *std::static_pointer_cast<const OverKeyboardViewProps>(props);
146
+
147
+ if (newViewProps.visible != oldViewProps.visible) {
148
+ if (newViewProps.visible) {
149
+ [self show];
150
+ } else {
151
+ [self hide];
152
+ }
153
+ }
154
+
155
+ [super updateProps:props oldProps:oldProps];
156
+ }
157
+ #else
158
+ - (void)setVisible:(BOOL)visible
159
+ {
160
+ if (visible) {
161
+ [self show];
162
+ } else {
163
+ [self hide];
164
+ }
165
+ }
166
+ #endif
167
+
168
+ // MARK: child management
169
+ #ifdef RCT_NEW_ARCH_ENABLED
170
+ - (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView
171
+ index:(NSInteger)index
172
+ {
173
+ [_contentView insertSubview:childComponentView atIndex:index];
174
+ }
175
+
176
+ - (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView
177
+ index:(NSInteger)index
178
+ {
179
+ [childComponentView removeFromSuperview];
180
+ }
181
+ #else
182
+ - (void)addSubview:(UIView *)view
183
+ {
184
+ [_contentView addSubview:view];
185
+ }
186
+ #endif
187
+
188
+ - (void)show
189
+ {
190
+ if (_visible) {
191
+ return;
192
+ }
193
+ _visible = true;
194
+ _contentView.frame = self.window.bounds;
195
+ _contentView.autoresizingMask =
196
+ UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
197
+ [_touchHandler attachToView:_contentView];
198
+
199
+ UIWindow *topWindow = [UIWindow topWindow];
200
+ [topWindow addSubview:_contentView];
201
+ }
202
+
203
+ - (void)hide
204
+ {
205
+ if (!_visible) {
206
+ return;
207
+ }
208
+ _visible = false;
209
+ [_contentView removeFromSuperview];
210
+ [_touchHandler detachFromView:_contentView];
211
+ }
212
+
213
+ #ifdef RCT_NEW_ARCH_ENABLED
214
+ Class<RCTComponentViewProtocol> OverKeyboardViewCls(void)
215
+ {
216
+ return OverKeyboardView.class;
217
+ }
218
+ #endif
219
+
220
+ @end
package/jest/index.js CHANGED
@@ -74,6 +74,7 @@ const mock = {
74
74
  // views
75
75
  KeyboardControllerView: "KeyboardControllerView",
76
76
  KeyboardGestureArea: "KeyboardGestureArea",
77
+ OverKeyboardView: "OverKeyboardView",
77
78
  // providers
78
79
  KeyboardProvider: "KeyboardProvider",
79
80
  // components
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.WindowDimensionsEvents = exports.KeyboardGestureArea = exports.KeyboardEvents = exports.KeyboardControllerView = exports.KeyboardController = exports.FocusedInputEvents = void 0;
6
+ exports.WindowDimensionsEvents = exports.RCTOverKeyboardView = exports.KeyboardGestureArea = exports.KeyboardEvents = exports.KeyboardControllerView = exports.KeyboardController = exports.FocusedInputEvents = void 0;
7
7
  var _reactNative = require("react-native");
8
8
  const NOOP = () => {};
9
9
  const KeyboardController = exports.KeyboardController = {
@@ -35,4 +35,5 @@ const WindowDimensionsEvents = exports.WindowDimensionsEvents = {
35
35
  };
36
36
  const KeyboardControllerView = exports.KeyboardControllerView = _reactNative.View;
37
37
  const KeyboardGestureArea = exports.KeyboardGestureArea = _reactNative.View;
38
+ const RCTOverKeyboardView = exports.RCTOverKeyboardView = _reactNative.View;
38
39
  //# sourceMappingURL=bindings.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","NOOP","KeyboardController","exports","setDefaultMode","setInputMode","dismiss","setFocusTo","addListener","removeListeners","KeyboardEvents","remove","FocusedInputEvents","WindowDimensionsEvents","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 WindowDimensionsEventsModule,\n} from \"./types\";\nimport type { EmitterSubscription } from \"react-native\";\n\nconst NOOP = () => {};\n\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 WindowDimensionsEvents: WindowDimensionsEventsModule = {\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;AAYA,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAEd,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,sBAAoD,GAAAV,OAAA,CAAAU,sBAAA,GAAG;EAClEL,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAEV;EAAK,CAAC;AACtC,CAAC;AACM,MAAMa,sBAAsB,GAAAX,OAAA,CAAAW,sBAAA,GACjCC,iBAAoD;AAC/C,MAAMC,mBAAmB,GAAAb,OAAA,CAAAa,mBAAA,GAC9BD,iBAAqD","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","NOOP","KeyboardController","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 KeyboardControllerModule,\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 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 WindowDimensionsEvents: WindowDimensionsEventsModule = {\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>;\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,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,sBAAoD,GAAAV,OAAA,CAAAU,sBAAA,GAAG;EAClEL,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAEV;EAAK,CAAC;AACtC,CAAC;AACM,MAAMa,sBAAsB,GAAAX,OAAA,CAAAW,sBAAA,GACjCC,iBAAoD;AAC/C,MAAMC,mBAAmB,GAAAb,OAAA,CAAAa,mBAAA,GAC9BD,iBAAqD;AAChD,MAAME,mBAAmB,GAAAd,OAAA,CAAAc,mBAAA,GAC9BF,iBAAkD","ignoreList":[]}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.WindowDimensionsEvents = exports.KeyboardGestureArea = exports.KeyboardEvents = exports.KeyboardControllerView = exports.KeyboardController = exports.FocusedInputEvents = void 0;
6
+ exports.WindowDimensionsEvents = exports.RCTOverKeyboardView = exports.KeyboardGestureArea = exports.KeyboardEvents = exports.KeyboardControllerView = exports.KeyboardController = 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",
@@ -34,4 +34,5 @@ const KeyboardControllerView = exports.KeyboardControllerView = require("./specs
34
34
  const KeyboardGestureArea = exports.KeyboardGestureArea = _reactNative.Platform.OS === "android" && _reactNative.Platform.Version >= 30 ? require("./specs/KeyboardGestureAreaNativeComponent").default : ({
35
35
  children
36
36
  }) => children;
37
+ const RCTOverKeyboardView = exports.RCTOverKeyboardView = require("./specs/OverKeyboardViewNativeComponent").default;
37
38
  //# sourceMappingURL=bindings.native.js.map
@@ -1 +1 @@
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","WindowDimensionsEvents","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 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 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 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\n ? require(\"./specs/KeyboardGestureAreaNativeComponent\").default\n : ({ children }: KeyboardGestureAreaProps) => children;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAWA,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,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,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,GAClEpB,qBAAQ,CAACqB,EAAE,KAAK,SAAS,IAAIrB,qBAAQ,CAACsB,OAAO,IAAI,EAAE,GAC/CxB,OAAO,CAAC,4CAA4C,CAAC,CAACK,OAAO,GAC7D,CAAC;EAAEoB;AAAmC,CAAC,KAAKA,QAAQ","ignoreList":[]}
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","WindowDimensionsEvents","KeyboardControllerView","KeyboardGestureArea","OS","Version","children","RCTOverKeyboardView"],"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 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 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 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\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,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,a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abled = true,
60
60
  extraKeyboardSpace = 0,
61
+ ScrollViewComponent = _reactNativeReanimated.default.ScrollView,
61
62
  snapToOffsets,
62
63
  ...rest
63
64
  }, ref) => {
@@ -244,7 +245,7 @@ const KeyboardAwareScrollView = /*#__PURE__*/(0, _react.forwardRef)(({
244
245
  // see: https://github.com/kirillzyusko/react-native-keyboard-controller/pull/342
245
246
  paddingBottom: currentKeyboardFrameHeight.value + 1
246
247
  } : {}, [enabled]);
247
- return /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.ScrollView, _extends({
248
+ return /*#__PURE__*/_react.default.createElement(ScrollViewComponent, _extends({
248
249
  ref: onRef
249
250
  }, rest, {
250
251
  scrollEventThrottle: 16,
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_hooks","_useSmoothKeyboardHandler","_utils","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","KeyboardAwareScrollView","forwardRef","children","onLayout","bottomOffset","disableScrollOnKeyboardHide","enabled","extraKeyboardSpace","snapToOffsets","rest","ref","scrollViewAnimatedRef","useAnimatedRef","scrollViewTarget","useSharedValue","scrollPosition","position","useScrollViewOffset","currentKeyboardFrameHeight","keyboardHeight","keyboardWillAppear","tag","initialKeyboardSize","scrollBeforeKeyboardMovement","input","useReanimatedFocusedInput","layout","height","useWindowDimensions","onRef","useCallback","assignedRef","current","onScrollViewLayout","value","findNodeHandle","maybeScroll","animated","_layout$value","_layout$value2","_layout$value3","parentScrollViewTarget","visibleRect","absoluteY","inputHeight","point","relativeScrollTo","interpolatedScrollTo","interpolate","scrollDistanceWithRespectToSnapPoints","targetScrollY","Math","max","scrollTo","positionOnScreen","topOfScreen","scrollFromCurrentPosition","customHeight","_input$value","prevScrollPosition","prevLayout","onChangeText","_layout$value4","_input$value2","onSelectionChange","selection","start","end","y","onChangeTextHandler","useMemo","debounce","useFocusedInputHandler","useSmoothKeyboardHandler","onStart","keyboardWillChangeSize","keyboardWillHide","focusWasChanged","target","onMove","keyboardFrame","onEnd","useAnimatedReaction","previous","view","useAnimatedStyle","paddingBottom","createElement","ScrollView","scrollEventThrottle","View","style","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo } from \"react\";\nimport { findNodeHandle } from \"react-native\";\nimport Reanimated, {\n interpolate,\n scrollTo,\n useAnimatedReaction,\n useAnimatedRef,\n useAnimatedStyle,\n useScrollViewOffset,\n useSharedValue,\n} from \"react-native-reanimated\";\n\nimport {\n useFocusedInputHandler,\n useReanimatedFocusedInput,\n useWindowDimensions,\n} from \"../../hooks\";\n\nimport { useSmoothKeyboardHandler } from \"./useSmoothKeyboardHandler\";\nimport { debounce, scrollDistanceWithRespectToSnapPoints } from \"./utils\";\n\nimport type {\n LayoutChangeEvent,\n ScrollView,\n ScrollViewProps,\n} from \"react-native\";\nimport type {\n FocusedInputLayoutChangedEvent,\n FocusedInputSelectionChangedEvent,\n} from \"react-native-keyboard-controller\";\n\nexport type KeyboardAwareScrollViewProps = {\n /** The distance between keyboard and focused `TextInput` when keyboard is shown. Default is `0`. */\n bottomOffset?: number;\n /** Prevents automatic scrolling of the `ScrollView` when the keyboard gets hidden, maintaining the current screen position. Default is `false`. */\n disableScrollOnKeyboardHide?: boolean;\n /** Controls whether this `KeyboardAwareScrollView` instance should take effect. Default is `true` */\n enabled?: boolean;\n /** Adjusting the bottom spacing of KeyboardAwareScrollView. Default is `0` */\n extraKeyboardSpace?: number;\n} & ScrollViewProps;\n\n/*\n * Everything begins from `onStart` handler. This handler is called every time,\n * when keyboard changes its size or when focused `TextInput` was changed. In\n * this handler we are calculating/memoizing values which later will be used\n * during layout movement. For that we calculate:\n * - layout of focused field (`layout`) - to understand whether there will be overlap\n * - initial keyboard size (`initialKeyboardSize`) - used in scroll interpolation\n * - future keyboard height (`keyboardHeight`) - used in scroll interpolation\n * - current scroll position (`scrollPosition`) - used to scroll from this point\n *\n * Once we've calculated all necessary variables - we can actually start to use them.\n * It happens in `onMove` handler - this function simply calls `maybeScroll` with\n * current keyboard frame height. This functions makes the smooth transition.\n *\n * When the transition has finished we go to `onEnd` handler. In this handler\n * we verify, that the current field is not overlapped within a keyboard frame.\n * For full `onStart`/`onMove`/`onEnd` flow it may look like a redundant thing,\n * however there could be some cases, when `onMove` is not called:\n * - on iOS when TextInput was changed - keyboard transition is instant\n * - on Android when TextInput was changed and keyboard size wasn't changed\n * So `onEnd` handler handle the case, when `onMove` wasn't triggered.\n *\n * ====================================================================================================================+\n * -----------------------------------------------------Flow chart-----------------------------------------------------+\n * ====================================================================================================================+\n *\n * +============================+ +============================+ +==================================+\n * + User Press on TextInput + => + Keyboard starts showing + => + As keyboard moves frame by frame + =>\n * + + + (run `onStart`) + + `onMove` is getting called +\n * +============================+ +============================+ +==================================+\n *\n *\n * +============================+ +============================+ +=====================================+\n * + Keyboard is shown and we + => + User moved focus to + => + Only `onStart`/`onEnd` maybe called +\n * + call `onEnd` handler + + another `TextInput` + + (without involving `onMove`) +\n * +============================+ +============================+ +=====================================+\n *\n */\nconst KeyboardAwareScrollView = forwardRef<\n ScrollView,\n React.PropsWithChildren<KeyboardAwareScrollViewProps>\n>(\n (\n {\n children,\n onLayout,\n bottomOffset = 0,\n disableScrollOnKeyboardHide = false,\n enabled = true,\n extraKeyboardSpace = 0,\n snapToOffsets,\n ...rest\n },\n ref,\n ) => {\n const scrollViewAnimatedRef = useAnimatedRef<Reanimated.ScrollView>();\n const scrollViewTarget = useSharedValue<number | null>(null);\n const scrollPosition = useSharedValue(0);\n const position = useScrollViewOffset(scrollViewAnimatedRef);\n const currentKeyboardFrameHeight = useSharedValue(0);\n const keyboardHeight = useSharedValue(0);\n const keyboardWillAppear = useSharedValue(false);\n const tag = useSharedValue(-1);\n const initialKeyboardSize = useSharedValue(0);\n const scrollBeforeKeyboardMovement = useSharedValue(0);\n const { input } = useReanimatedFocusedInput();\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\n\n const { height } = useWindowDimensions();\n\n const onRef = useCallback((assignedRef: Reanimated.ScrollView) => {\n if (typeof ref === \"function\") {\n ref(assignedRef);\n } else if (ref) {\n ref.current = assignedRef;\n }\n\n scrollViewAnimatedRef(assignedRef);\n }, []);\n const onScrollViewLayout = useCallback(\n (e: LayoutChangeEvent) => {\n scrollViewTarget.value = findNodeHandle(scrollViewAnimatedRef.current);\n\n onLayout?.(e);\n },\n [onLayout],\n );\n\n /**\n * Function that will scroll a ScrollView as keyboard gets moving\n */\n const maybeScroll = useCallback(\n (e: number, animated: boolean = false) => {\n \"worklet\";\n\n if (!enabled) {\n return 0;\n }\n\n // input belongs to ScrollView\n if (layout.value?.parentScrollViewTarget !== scrollViewTarget.value) {\n return 0;\n }\n\n const visibleRect = height - keyboardHeight.value;\n const absoluteY = layout.value?.layout.absoluteY || 0;\n const inputHeight = layout.value?.layout.height || 0;\n const point = absoluteY + inputHeight;\n\n if (visibleRect - point <= bottomOffset) {\n const relativeScrollTo =\n keyboardHeight.value - (height - point) + bottomOffset;\n const interpolatedScrollTo = interpolate(\n e,\n [initialKeyboardSize.value, keyboardHeight.value],\n [\n 0,\n scrollDistanceWithRespectToSnapPoints(\n relativeScrollTo + scrollPosition.value,\n snapToOffsets,\n ) - scrollPosition.value,\n ],\n );\n const targetScrollY =\n Math.max(interpolatedScrollTo, 0) + scrollPosition.value;\n\n scrollTo(scrollViewAnimatedRef, 0, targetScrollY, animated);\n\n return interpolatedScrollTo;\n }\n\n if (absoluteY < 0) {\n const positionOnScreen = visibleRect - inputHeight - bottomOffset;\n const topOfScreen = scrollPosition.value + absoluteY;\n\n scrollTo(\n scrollViewAnimatedRef,\n 0,\n topOfScreen - positionOnScreen,\n animated,\n );\n }\n\n return 0;\n },\n [bottomOffset, enabled, height, snapToOffsets],\n );\n\n const scrollFromCurrentPosition = useCallback(\n (customHeight?: number) => {\n \"worklet\";\n\n const prevScrollPosition = scrollPosition.value;\n const prevLayout = layout.value;\n\n if (!input.value?.layout) {\n return;\n }\n\n // eslint-disable-next-line react-compiler/react-compiler\n layout.value = {\n ...input.value,\n layout: {\n ...input.value.layout,\n height: customHeight ?? input.value.layout.height,\n },\n };\n scrollPosition.value = position.value;\n maybeScroll(keyboardHeight.value, true);\n scrollPosition.value = prevScrollPosition;\n layout.value = prevLayout;\n },\n [maybeScroll],\n );\n const onChangeText = useCallback(() => {\n \"worklet\";\n\n // if typing a text caused layout shift, then we need to ignore this handler\n // because this event will be handled in `useAnimatedReaction` below\n if (layout.value?.layout.height !== input.value?.layout.height) {\n return;\n }\n\n scrollFromCurrentPosition();\n }, [scrollFromCurrentPosition]);\n const onSelectionChange = useCallback(\n (e: FocusedInputSelectionChangedEvent) => {\n \"worklet\";\n\n if (e.selection.start.position !== e.selection.end.position) {\n scrollFromCurrentPosition(e.selection.end.y);\n }\n },\n [scrollFromCurrentPosition],\n );\n\n const onChangeTextHandler = useMemo(\n () => debounce(onChangeText, 200),\n [onChangeText],\n );\n\n useFocusedInputHandler(\n {\n onChangeText: onChangeTextHandler,\n onSelectionChange: onSelectionChange,\n },\n [onChangeTextHandler, onSelectionChange],\n );\n\n useSmoothKeyboardHandler(\n {\n onStart: (e) => {\n \"worklet\";\n\n const keyboardWillChangeSize =\n keyboardHeight.value !== e.height && e.height > 0;\n\n keyboardWillAppear.value = e.height > 0 && keyboardHeight.value === 0;\n\n const keyboardWillHide = e.height === 0;\n const focusWasChanged =\n (tag.value !== e.target && e.target !== -1) ||\n keyboardWillChangeSize;\n\n if (keyboardWillChangeSize) {\n initialKeyboardSize.value = keyboardHeight.value;\n }\n\n if (keyboardWillHide) {\n // on back transition need to interpolate as [0, keyboardHeight]\n initialKeyboardSize.value = 0;\n scrollPosition.value = scrollBeforeKeyboardMovement.value;\n }\n\n if (\n keyboardWillAppear.value ||\n keyboardWillChangeSize ||\n focusWasChanged\n ) {\n // persist scroll value\n scrollPosition.value = position.value;\n // just persist height - later will be used in interpolation\n keyboardHeight.value = e.height;\n }\n\n // focus was changed\n if (focusWasChanged) {\n tag.value = e.target;\n\n // save position of focused text input when keyboard starts to move\n layout.value = input.value;\n // save current scroll position - when keyboard will hide we'll reuse\n // this value to achieve smooth hide effect\n scrollBeforeKeyboardMovement.value = position.value;\n }\n\n if (focusWasChanged && !keyboardWillAppear.value) {\n // update position on scroll value, so `onEnd` handler\n // will pick up correct values\n position.value += maybeScroll(e.height, true);\n }\n },\n onMove: (e) => {\n \"worklet\";\n\n const keyboardFrame = interpolate(\n e.height,\n [0, keyboardHeight.value],\n [0, keyboardHeight.value + extraKeyboardSpace],\n );\n\n currentKeyboardFrameHeight.value = keyboardFrame;\n\n // if the user has set disableScrollOnKeyboardHide, only auto-scroll when the keyboard opens\n if (!disableScrollOnKeyboardHide || keyboardWillAppear.value) {\n maybeScroll(e.height);\n }\n },\n onEnd: (e) => {\n \"worklet\";\n\n keyboardHeight.value = e.height;\n scrollPosition.value = position.value;\n },\n },\n [maybeScroll, disableScrollOnKeyboardHide, extraKeyboardSpace],\n );\n\n useAnimatedReaction(\n () => input.value,\n (current, previous) => {\n if (\n current?.target === previous?.target &&\n current?.layout.height !== previous?.layout.height\n ) {\n const prevLayout = layout.value;\n\n layout.value = input.value;\n scrollPosition.value += maybeScroll(keyboardHeight.value, true);\n layout.value = prevLayout;\n }\n },\n [],\n );\n\n const view = useAnimatedStyle(\n () =>\n enabled\n ? {\n // animations become choppy when scrolling to the end of the `ScrollView` (when the last input is focused)\n // this happens because the layout recalculates on every frame. To avoid this we slightly increase padding\n // by `+1`. In this way we assure, that `scrollTo` will never scroll to the end, because it uses interpolation\n // from 0 to `keyboardHeight`, and here our padding is `keyboardHeight + 1`. It allows us not to re-run layout\n // re-calculation on every animation frame and it helps to achieve smooth animation.\n // see: https://github.com/kirillzyusko/react-native-keyboard-controller/pull/342\n paddingBottom: currentKeyboardFrameHeight.value + 1,\n }\n : {},\n [enabled],\n );\n\n return (\n <Reanimated.ScrollView\n ref={onRef}\n {...rest}\n scrollEventThrottle={16}\n onLayout={onScrollViewLayout}\n >\n {children}\n <Reanimated.View style={view} />\n </Reanimated.ScrollView>\n );\n },\n);\n\nexport default KeyboardAwareScrollView;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAH,uBAAA,CAAAC,OAAA;AAUA,IAAAG,MAAA,GAAAH,OAAA;AAMA,IAAAI,yBAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAA0E,SAAAM,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,SAAAR,wBAAAQ,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,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA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,EAAEpE,0BAA0B,CAACgB,KAAK,GAAG;EACpD,CAAC,GACD,CAAC,CAAC,EACR,CAAC5B,OAAO,CACV,CAAC;EAED,oBACExC,MAAA,CAAAc,OAAA,CAAA2G,aAAA,CAACrH,sBAAA,CAAAU,OAAU,CAAC4G,UAAU,EAAA9F,QAAA;IACpBgB,GAAG,EAAEmB;EAAM,GACPpB,IAAI;IACRgF,mBAAmB,EAAE,EAAG;IACxBtF,QAAQ,EAAE8B;EAAmB,IAE5B/B,QAAQ,eACTpC,MAAA,CAAAc,OAAA,CAAA2G,aAAA,CAACrH,sBAAA,CAAAU,OAAU,CAAC8G,IAAI;IAACC,KAAK,EAAEP;EAAK,CAAE,CACV,CAAC;AAE5B,CACF,CAAC;AAAC,IAAAQ,QAAA,GAAAC,OAAA,CAAAjH,OAAA,GAEaoB,uBAAuB","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_hooks","_useSmoothKeyboardHandler","_utils","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","KeyboardAwareScrollView","forwardRef","children","onLayout","bottomOffset","disableScrollOnKeyboardHide","enabled","extraKeyboardSpace","ScrollViewComponent","Reanimated","ScrollView","snapToOffsets","rest","ref","scrollViewAnimatedRef","useAnimatedRef","scrollViewTarget","useSharedValue","scrollPosition","position","useScrollViewOffset","currentKeyboardFrameHeight","keyboardHeight","keyboardWillAppear","tag","initialKeyboardSize","scrollBeforeKeyboardMovement","input","useReanimatedFocusedInput","layout","height","useWindowDimensions","onRef","useCallback","assignedRef","current","onScrollViewLayout","value","findNodeHandle","maybeScroll","animated","_layout$value","_layout$value2","_layout$value3","parentScrollViewTarget","visibleRect","absoluteY","inputHeight","point","relativeScrollTo","interpolatedScrollTo","interpolate","scrollDistanceWithRespectToSnapPoints","targetScrollY","Math","max","scrollTo","positionOnScreen","topOfScreen","scrollFromCurrentPosition","customHeight","_input$value","prevScrollPosition","prevLayout","onChangeText","_layout$value4","_input$value2","onSelectionChange","selection","start","end","y","onChangeTextHandler","useMemo","debounce","useFocusedInputHandler","useSmoothKeyboardHandler","onStart","keyboardWillChangeSize","keyboardWillHide","focusWasChanged","target","onMove","keyboardFrame","onEnd","useAnimatedReaction","previous","view","useAnimatedStyle","paddingBottom","createElement","scrollEventThrottle","View","style","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo } from \"react\";\nimport { findNodeHandle } from \"react-native\";\nimport Reanimated, {\n interpolate,\n scrollTo,\n useAnimatedReaction,\n useAnimatedRef,\n useAnimatedStyle,\n useScrollViewOffset,\n useSharedValue,\n} from \"react-native-reanimated\";\n\nimport {\n useFocusedInputHandler,\n useReanimatedFocusedInput,\n useWindowDimensions,\n} from \"../../hooks\";\n\nimport { useSmoothKeyboardHandler } from \"./useSmoothKeyboardHandler\";\nimport { debounce, scrollDistanceWithRespectToSnapPoints } from \"./utils\";\n\nimport type {\n LayoutChangeEvent,\n ScrollView,\n ScrollViewProps,\n} from \"react-native\";\nimport type {\n FocusedInputLayoutChangedEvent,\n FocusedInputSelectionChangedEvent,\n} from \"react-native-keyboard-controller\";\n\nexport type KeyboardAwareScrollViewProps = {\n /** The distance between keyboard and focused `TextInput` when keyboard is shown. Default is `0`. */\n bottomOffset?: number;\n /** Prevents automatic scrolling of the `ScrollView` when the keyboard gets hidden, maintaining the current screen position. Default is `false`. */\n disableScrollOnKeyboardHide?: boolean;\n /** Controls whether this `KeyboardAwareScrollView` instance should take effect. Default is `true` */\n enabled?: boolean;\n /** Adjusting the bottom spacing of KeyboardAwareScrollView. Default is `0` */\n extraKeyboardSpace?: number;\n /** Custom component for `ScrollView`. Default is `ScrollView` */\n ScrollViewComponent?: React.ComponentType<ScrollViewProps>;\n} & ScrollViewProps;\n\n/*\n * Everything begins from `onStart` handler. This handler is called every time,\n * when keyboard changes its size or when focused `TextInput` was changed. In\n * this handler we are calculating/memoizing values which later will be used\n * during layout movement. For that we calculate:\n * - layout of focused field (`layout`) - to understand whether there will be overlap\n * - initial keyboard size (`initialKeyboardSize`) - used in scroll interpolation\n * - future keyboard height (`keyboardHeight`) - used in scroll interpolation\n * - current scroll position (`scrollPosition`) - used to scroll from this point\n *\n * Once we've calculated all necessary variables - we can actually start to use them.\n * It happens in `onMove` handler - this function simply calls `maybeScroll` with\n * current keyboard frame height. This functions makes the smooth transition.\n *\n * When the transition has finished we go to `onEnd` handler. In this handler\n * we verify, that the current field is not overlapped within a keyboard frame.\n * For full `onStart`/`onMove`/`onEnd` flow it may look like a redundant thing,\n * however there could be some cases, when `onMove` is not called:\n * - on iOS when TextInput was changed - keyboard transition is instant\n * - on Android when TextInput was changed and keyboard size wasn't changed\n * So `onEnd` handler handle the case, when `onMove` wasn't triggered.\n *\n * ====================================================================================================================+\n * -----------------------------------------------------Flow chart-----------------------------------------------------+\n * ====================================================================================================================+\n *\n * +============================+ +============================+ +==================================+\n * + User Press on TextInput + => + Keyboard starts showing + => + As keyboard moves frame by frame + =>\n * + + + (run `onStart`) + + `onMove` is getting called +\n * +============================+ +============================+ +==================================+\n *\n *\n * +============================+ +============================+ +=====================================+\n * + Keyboard is shown and we + => + User moved focus to + => + Only `onStart`/`onEnd` maybe called +\n * + call `onEnd` handler + + another `TextInput` + + (without involving `onMove`) +\n * +============================+ +============================+ +=====================================+\n *\n */\nconst KeyboardAwareScrollView = forwardRef<\n ScrollView,\n React.PropsWithChildren<KeyboardAwareScrollViewProps>\n>(\n (\n {\n children,\n onLayout,\n bottomOffset = 0,\n disableScrollOnKeyboardHide = false,\n enabled = true,\n extraKeyboardSpace = 0,\n ScrollViewComponent = Reanimated.ScrollView,\n snapToOffsets,\n ...rest\n },\n ref,\n ) => {\n const scrollViewAnimatedRef = useAnimatedRef<Reanimated.ScrollView>();\n const scrollViewTarget = useSharedValue<number | null>(null);\n const scrollPosition = useSharedValue(0);\n const position = useScrollViewOffset(scrollViewAnimatedRef);\n const currentKeyboardFrameHeight = useSharedValue(0);\n const keyboardHeight = useSharedValue(0);\n const keyboardWillAppear = useSharedValue(false);\n const tag = useSharedValue(-1);\n const initialKeyboardSize = useSharedValue(0);\n const scrollBeforeKeyboardMovement = useSharedValue(0);\n const { input } = useReanimatedFocusedInput();\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\n\n const { height } = useWindowDimensions();\n\n const onRef = useCallback((assignedRef: Reanimated.ScrollView) => {\n if (typeof ref === \"function\") {\n ref(assignedRef);\n } else if (ref) {\n ref.current = assignedRef;\n }\n\n scrollViewAnimatedRef(assignedRef);\n }, []);\n const onScrollViewLayout = useCallback(\n (e: LayoutChangeEvent) => {\n scrollViewTarget.value = findNodeHandle(scrollViewAnimatedRef.current);\n\n onLayout?.(e);\n },\n [onLayout],\n );\n\n /**\n * Function that will scroll a ScrollView as keyboard gets moving\n */\n const maybeScroll = useCallback(\n (e: number, animated: boolean = false) => {\n \"worklet\";\n\n if (!enabled) {\n return 0;\n }\n\n // input belongs to ScrollView\n if (layout.value?.parentScrollViewTarget !== scrollViewTarget.value) {\n return 0;\n }\n\n const visibleRect = height - keyboardHeight.value;\n const absoluteY = layout.value?.layout.absoluteY || 0;\n const inputHeight = layout.value?.layout.height || 0;\n const point = absoluteY + inputHeight;\n\n if (visibleRect - point <= bottomOffset) {\n const relativeScrollTo =\n keyboardHeight.value - (height - point) + bottomOffset;\n const interpolatedScrollTo = interpolate(\n e,\n [initialKeyboardSize.value, keyboardHeight.value],\n [\n 0,\n scrollDistanceWithRespectToSnapPoints(\n relativeScrollTo + scrollPosition.value,\n snapToOffsets,\n ) - scrollPosition.value,\n ],\n );\n const targetScrollY =\n Math.max(interpolatedScrollTo, 0) + scrollPosition.value;\n\n scrollTo(scrollViewAnimatedRef, 0, targetScrollY, animated);\n\n return interpolatedScrollTo;\n }\n\n if (absoluteY < 0) {\n const positionOnScreen = visibleRect - inputHeight - bottomOffset;\n const topOfScreen = scrollPosition.value + absoluteY;\n\n scrollTo(\n scrollViewAnimatedRef,\n 0,\n topOfScreen - positionOnScreen,\n animated,\n );\n }\n\n return 0;\n },\n [bottomOffset, enabled, height, snapToOffsets],\n );\n\n const scrollFromCurrentPosition = useCallback(\n (customHeight?: number) => {\n \"worklet\";\n\n const prevScrollPosition = scrollPosition.value;\n const prevLayout = layout.value;\n\n if (!input.value?.layout) {\n return;\n }\n\n // eslint-disable-next-line react-compiler/react-compiler\n layout.value = {\n ...input.value,\n layout: {\n ...input.value.layout,\n height: customHeight ?? input.value.layout.height,\n },\n };\n scrollPosition.value = position.value;\n maybeScroll(keyboardHeight.value, true);\n scrollPosition.value = prevScrollPosition;\n layout.value = prevLayout;\n },\n [maybeScroll],\n );\n const onChangeText = useCallback(() => {\n \"worklet\";\n\n // if typing a text caused layout shift, then we need to ignore this handler\n // because this event will be handled in `useAnimatedReaction` below\n if (layout.value?.layout.height !== input.value?.layout.height) {\n return;\n }\n\n scrollFromCurrentPosition();\n }, [scrollFromCurrentPosition]);\n const onSelectionChange = useCallback(\n (e: FocusedInputSelectionChangedEvent) => {\n \"worklet\";\n\n if (e.selection.start.position !== e.selection.end.position) {\n scrollFromCurrentPosition(e.selection.end.y);\n }\n },\n [scrollFromCurrentPosition],\n );\n\n const onChangeTextHandler = useMemo(\n () => debounce(onChangeText, 200),\n [onChangeText],\n );\n\n useFocusedInputHandler(\n {\n onChangeText: onChangeTextHandler,\n onSelectionChange: onSelectionChange,\n },\n [onChangeTextHandler, onSelectionChange],\n );\n\n useSmoothKeyboardHandler(\n {\n onStart: (e) => {\n \"worklet\";\n\n const keyboardWillChangeSize =\n keyboardHeight.value !== e.height && e.height > 0;\n\n keyboardWillAppear.value = e.height > 0 && keyboardHeight.value === 0;\n\n const keyboardWillHide = e.height === 0;\n const focusWasChanged =\n (tag.value !== e.target && e.target !== -1) ||\n keyboardWillChangeSize;\n\n if (keyboardWillChangeSize) {\n initialKeyboardSize.value = keyboardHeight.value;\n }\n\n if (keyboardWillHide) {\n // on back transition need to interpolate as [0, keyboardHeight]\n initialKeyboardSize.value = 0;\n scrollPosition.value = scrollBeforeKeyboardMovement.value;\n }\n\n if (\n keyboardWillAppear.value ||\n keyboardWillChangeSize ||\n focusWasChanged\n ) {\n // persist scroll value\n scrollPosition.value = position.value;\n // just persist height - later will be used in interpolation\n keyboardHeight.value = e.height;\n }\n\n // focus was changed\n if (focusWasChanged) {\n tag.value = e.target;\n\n // save position of focused text input when keyboard starts to move\n layout.value = input.value;\n // save current scroll position - when keyboard will hide we'll reuse\n // this value to achieve smooth hide effect\n scrollBeforeKeyboardMovement.value = position.value;\n }\n\n if (focusWasChanged && !keyboardWillAppear.value) {\n // update position on scroll value, so `onEnd` handler\n // will pick up correct values\n position.value += maybeScroll(e.height, true);\n }\n },\n onMove: (e) => {\n \"worklet\";\n\n const keyboardFrame = interpolate(\n e.height,\n [0, keyboardHeight.value],\n [0, keyboardHeight.value + extraKeyboardSpace],\n );\n\n currentKeyboardFrameHeight.value = keyboardFrame;\n\n // if the user has set disableScrollOnKeyboardHide, only auto-scroll when the keyboard opens\n if (!disableScrollOnKeyboardHide || keyboardWillAppear.value) {\n maybeScroll(e.height);\n }\n },\n onEnd: (e) => {\n \"worklet\";\n\n keyboardHeight.value = e.height;\n scrollPosition.value = position.value;\n },\n },\n [maybeScroll, disableScrollOnKeyboardHide, extraKeyboardSpace],\n );\n\n useAnimatedReaction(\n () => input.value,\n (current, previous) => {\n if (\n current?.target === previous?.target &&\n current?.layout.height !== previous?.layout.height\n ) {\n const prevLayout = layout.value;\n\n layout.value = input.value;\n scrollPosition.value += maybeScroll(keyboardHeight.value, true);\n layout.value = prevLayout;\n }\n },\n [],\n );\n\n const view = useAnimatedStyle(\n () =>\n enabled\n ? {\n // animations become choppy when scrolling to the end of the `ScrollView` (when the last input is focused)\n // this happens because the layout recalculates on every frame. To avoid this we slightly increase padding\n // by `+1`. In this way we assure, that `scrollTo` will never scroll to the end, because it uses interpolation\n // from 0 to `keyboardHeight`, and here our padding is `keyboardHeight + 1`. It allows us not to re-run layout\n // re-calculation on every animation frame and it helps to achieve smooth animation.\n // see: https://github.com/kirillzyusko/react-native-keyboard-controller/pull/342\n paddingBottom: currentKeyboardFrameHeight.value + 1,\n }\n : {},\n [enabled],\n );\n\n return (\n <ScrollViewComponent\n ref={onRef}\n {...rest}\n scrollEventThrottle={16}\n onLayout={onScrollViewLayout}\n >\n {children}\n <Reanimated.View style={view} />\n </ScrollViewComponent>\n );\n },\n);\n\nexport default KeyboardAwareScrollView;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAH,uBAAA,CAAAC,OAAA;AAUA,IAAAG,MAAA,GAAAH,OAAA;AAMA,IAAAI,yBAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAA0E,SAAAM,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,SAAAR,wBAAAQ,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,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAA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AAIE,WAAW,CAACjB,cAAc,CAACe,KAAK,EAAE,IAAI,CAAC;MAC/DR,MAAM,CAACQ,KAAK,GAAG0B,UAAU;IAC3B;EACF,CAAC,EACD,EACF,CAAC;EAED,MAAMwB,IAAI,GAAG,IAAAC,uCAAgB,EAC3B,MACElF,OAAO,GACH;IACE;IACA;IACA;IACA;IACA;IACA;IACAmF,aAAa,EAAEpE,0BAA0B,CAACgB,KAAK,GAAG;EACpD,CAAC,GACD,CAAC,CAAC,EACR,CAAC/B,OAAO,CACV,CAAC;EAED,oBACExC,MAAA,CAAAc,OAAA,CAAA8G,aAAA,CAAClF,mBAAmB,EAAAd,QAAA;IAClBmB,GAAG,EAAEmB;EAAM,GACPpB,IAAI;IACR+E,mBAAmB,EAAE,EAAG;IACxBxF,QAAQ,EAAEiC;EAAmB,IAE5BlC,QAAQ,eACTpC,MAAA,CAAAc,OAAA,CAAA8G,aAAA,CAACxH,sBAAA,CAAAU,OAAU,CAACgH,IAAI;IAACC,KAAK,EAAEN;EAAK,CAAE,CACZ,CAAC;AAE1B,CACF,CAAC;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAnH,OAAA,GAEaoB,uBAAuB","ignoreList":[]}
@@ -21,6 +21,7 @@ var _colors = require("./colors");
21
21
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
22
22
  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); }
23
23
  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; }
24
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
24
25
  const TEST_ID_KEYBOARD_TOOLBAR = "keyboard.toolbar";
25
26
  const TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS = `${TEST_ID_KEYBOARD_TOOLBAR}.previous`;
26
27
  const TEST_ID_KEYBOARD_TOOLBAR_NEXT = `${TEST_ID_KEYBOARD_TOOLBAR}.next`;
@@ -50,7 +51,8 @@ const KeyboardToolbar = ({
50
51
  onPrevCallback,
51
52
  onDoneCallback,
52
53
  blur = null,
53
- opacity = DEFAULT_OPACITY
54
+ opacity = DEFAULT_OPACITY,
55
+ ...rest
54
56
  }) => {
55
57
  const colorScheme = (0, _useColorScheme.default)();
56
58
  const [inputs, setInputs] = (0, _react.useState)({
@@ -93,10 +95,10 @@ const KeyboardToolbar = ({
93
95
  }, [onDoneCallback]);
94
96
  return /*#__PURE__*/_react.default.createElement(_KeyboardStickyView.default, {
95
97
  offset: offset
96
- }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
98
+ }, /*#__PURE__*/_react.default.createElement(_reactNative.View, _extends({}, rest, {
97
99
  style: toolbarStyle,
98
100
  testID: TEST_ID_KEYBOARD_TOOLBAR
99
- }, blur, showArrows && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(ButtonContainer, {
101
+ }), blur, showArrows && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(ButtonContainer, {
100
102
  accessibilityHint: "Moves focus to the previous field",
101
103
  accessibilityLabel: "Previous",
102
104
  disabled: isPrevDisabled,
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_bindings","_useColorScheme","_interopRequireDefault","_KeyboardStickyView","_Arrow","_Button","_colors","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","TEST_ID_KEYBOARD_TOOLBAR","TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS","TEST_ID_KEYBOARD_TOOLBAR_NEXT","TEST_ID_KEYBOARD_TOOLBAR_CONTENT","TEST_ID_KEYBOARD_TOOLBAR_DONE","KEYBOARD_TOOLBAR_HEIGHT","DEFAULT_OPACITY","offset","closed","dismissKeyboard","KeyboardController","dismiss","goToNextField","setFocusTo","goToPrevField","KeyboardToolbar","content","theme","colors","doneText","button","icon","showArrows","onNextCallback","onPrevCallback","onDoneCallback","blur","opacity","colorScheme","useColorScheme","inputs","setInputs","useState","current","count","isPrevDisabled","isNextDisabled","useEffect","subscription","FocusedInputEvents","addListener","remove","doneStyle","useMemo","styles","doneButton","color","primary","toolbarStyle","toolbar","backgroundColor","background","ButtonContainer","Button","IconContainer","Arrow","onPressNext","useCallback","event","isDefaultPrevented","onPressPrev","onPressDone","createElement","View","style","testID","Fragment","accessibilityHint","accessibilityLabel","disabled","onPress","type","flex","rippleRadius","doneButtonContainer","Text","maxFontSizeMultiplier","StyleSheet","create","position","bottom","alignItems","width","flexDirection","height","paddingHorizontal","fontWeight","fontSize","marginRight","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { StyleSheet, Text, View } from \"react-native\";\n\nimport { FocusedInputEvents, KeyboardController } from \"../../bindings\";\nimport useColorScheme from \"../hooks/useColorScheme\";\nimport KeyboardStickyView from \"../KeyboardStickyView\";\n\nimport Arrow from \"./Arrow\";\nimport Button from \"./Button\";\nimport { colors } from \"./colors\";\n\nimport type { HEX, KeyboardToolbarTheme } from \"./types\";\nimport type { ReactNode } from \"react\";\nimport type { GestureResponderEvent } from \"react-native\";\n\nexport type KeyboardToolbarProps = {\n /** An element that is shown in the middle of the toolbar. */\n content?: JSX.Element | null;\n /** A set of dark/light colors consumed by toolbar component. */\n theme?: KeyboardToolbarTheme;\n /** Custom text for done button. */\n doneText?: ReactNode;\n /** Custom touchable component for toolbar (used for prev/next/done buttons). */\n button?: typeof Button;\n /** Custom icon component used to display next/prev buttons. */\n icon?: typeof Arrow;\n /**\n * Whether to show next and previous buttons. Can be useful to set it to `false` if you have only one input\n * and want to show only `Done` button. Default to `true`.\n */\n showArrows?: boolean;\n /**\n * A callback that is called when the user presses the next button along with the default action.\n */\n onNextCallback?: (event: GestureResponderEvent) => void;\n /**\n * A callback that is called when the user presses the previous button along with the default action.\n */\n onPrevCallback?: (event: GestureResponderEvent) => void;\n /**\n * A callback that is called when the user presses the done button along with the default action.\n */\n onDoneCallback?: (event: GestureResponderEvent) => void;\n /**\n * A component that applies blur effect to the toolbar.\n */\n blur?: JSX.Element | null;\n /**\n * A value for container opacity in hexadecimal format (e.g. `ff`). Default value is `ff`.\n */\n opacity?: HEX;\n};\n\nconst TEST_ID_KEYBOARD_TOOLBAR = \"keyboard.toolbar\";\nconst TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS = `${TEST_ID_KEYBOARD_TOOLBAR}.previous`;\nconst TEST_ID_KEYBOARD_TOOLBAR_NEXT = `${TEST_ID_KEYBOARD_TOOLBAR}.next`;\nconst TEST_ID_KEYBOARD_TOOLBAR_CONTENT = `${TEST_ID_KEYBOARD_TOOLBAR}.content`;\nconst TEST_ID_KEYBOARD_TOOLBAR_DONE = `${TEST_ID_KEYBOARD_TOOLBAR}.done`;\n\nconst KEYBOARD_TOOLBAR_HEIGHT = 42;\nconst DEFAULT_OPACITY: HEX = \"FF\";\nconst offset = { closed: KEYBOARD_TOOLBAR_HEIGHT };\n\nconst dismissKeyboard = () => KeyboardController.dismiss();\nconst goToNextField = () => KeyboardController.setFocusTo(\"next\");\nconst goToPrevField = () => KeyboardController.setFocusTo(\"prev\");\n\n/**\n * `KeyboardToolbar` is a component that is shown above the keyboard with `Prev`/`Next` and\n * `Done` buttons.\n */\nconst KeyboardToolbar: React.FC<KeyboardToolbarProps> = ({\n content,\n theme = colors,\n doneText,\n button,\n icon,\n showArrows = true,\n onNextCallback,\n onPrevCallback,\n onDoneCallback,\n blur = null,\n opacity = DEFAULT_OPACITY,\n}) => {\n const colorScheme = useColorScheme();\n const [inputs, setInputs] = useState({\n current: 0,\n count: 0,\n });\n const isPrevDisabled = inputs.current === 0;\n const isNextDisabled = inputs.current === inputs.count - 1;\n\n useEffect(() => {\n const subscription = FocusedInputEvents.addListener(\"focusDidSet\", (e) => {\n setInputs(e);\n });\n\n return subscription.remove;\n }, []);\n const doneStyle = useMemo(\n () => [styles.doneButton, { color: theme[colorScheme].primary }],\n [colorScheme, theme],\n );\n const toolbarStyle = useMemo(\n () => [\n styles.toolbar,\n {\n backgroundColor: `${theme[colorScheme].background}${opacity}`,\n },\n ],\n [colorScheme, opacity, theme],\n );\n const ButtonContainer = button || Button;\n const IconContainer = icon || Arrow;\n\n const onPressNext = useCallback(\n (event: GestureResponderEvent) => {\n onNextCallback?.(event);\n\n if (!event.isDefaultPrevented()) {\n goToNextField();\n }\n },\n [onNextCallback],\n );\n const onPressPrev = useCallback(\n (event: GestureResponderEvent) => {\n onPrevCallback?.(event);\n\n if (!event.isDefaultPrevented()) {\n goToPrevField();\n }\n },\n [onPrevCallback],\n );\n const onPressDone = useCallback(\n (event: GestureResponderEvent) => {\n onDoneCallback?.(event);\n\n if (!event.isDefaultPrevented()) {\n dismissKeyboard();\n }\n },\n [onDoneCallback],\n );\n\n return (\n <KeyboardStickyView offset={offset}>\n <View style={toolbarStyle} testID={TEST_ID_KEYBOARD_TOOLBAR}>\n {blur}\n {showArrows && (\n <>\n <ButtonContainer\n accessibilityHint=\"Moves focus to the previous field\"\n accessibilityLabel=\"Previous\"\n disabled={isPrevDisabled}\n testID={TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS}\n theme={theme}\n onPress={onPressPrev}\n >\n <IconContainer\n disabled={isPrevDisabled}\n theme={theme}\n type=\"prev\"\n />\n </ButtonContainer>\n <ButtonContainer\n accessibilityHint=\"Moves focus to the next field\"\n accessibilityLabel=\"Next\"\n disabled={isNextDisabled}\n testID={TEST_ID_KEYBOARD_TOOLBAR_NEXT}\n theme={theme}\n onPress={onPressNext}\n >\n <IconContainer\n disabled={isNextDisabled}\n theme={theme}\n type=\"next\"\n />\n </ButtonContainer>\n </>\n )}\n\n <View style={styles.flex} testID={TEST_ID_KEYBOARD_TOOLBAR_CONTENT}>\n {content}\n </View>\n <ButtonContainer\n accessibilityHint=\"Closes the keyboard\"\n accessibilityLabel=\"Done\"\n rippleRadius={28}\n style={styles.doneButtonContainer}\n testID={TEST_ID_KEYBOARD_TOOLBAR_DONE}\n theme={theme}\n onPress={onPressDone}\n >\n <Text maxFontSizeMultiplier={1.3} style={doneStyle}>\n {doneText || \"Done\"}\n </Text>\n </ButtonContainer>\n </View>\n </KeyboardStickyView>\n );\n};\n\nconst styles = StyleSheet.create({\n flex: {\n flex: 1,\n },\n toolbar: {\n position: \"absolute\",\n bottom: 0,\n alignItems: \"center\",\n width: \"100%\",\n flexDirection: \"row\",\n height: KEYBOARD_TOOLBAR_HEIGHT,\n paddingHorizontal: 8,\n },\n doneButton: {\n fontWeight: \"600\",\n fontSize: 15,\n },\n doneButtonContainer: {\n marginRight: 8,\n },\n});\n\nexport { colors as DefaultKeyboardToolbarTheme };\nexport default KeyboardToolbar;\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,mBAAA,GAAAD,sBAAA,CAAAJ,OAAA;AAEA,IAAAM,MAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,OAAA,GAAAH,sBAAA,CAAAJ,OAAA;AACA,IAAAQ,OAAA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bsD,IAAI,EAAC;EAAM,CACZ,CACc,CACjB,CACH,eAEDtG,MAAA,CAAAa,OAAA,CAAAgF,aAAA,CAAC1F,YAAA,CAAA2F,IAAI;IAACC,KAAK,EAAEpB,MAAM,CAAC4B,IAAK;IAACP,MAAM,EAAE9D;EAAiC,GAChEa,OACG,CAAC,eACP/C,MAAA,CAAAa,OAAA,CAAAgF,aAAA,CAACV,eAAe;IACde,iBAAiB,EAAC,qBAAqB;IACvCC,kBAAkB,EAAC,MAAM;IACzBK,YAAY,EAAE,EAAG;IACjBT,KAAK,EAAEpB,MAAM,CAAC8B,mBAAoB;IAClCT,MAAM,EAAE7D,6BAA8B;IACtCa,KAAK,EAAEA,KAAM;IACbqD,OAAO,EAAET;EAAY,gBAErB5F,MAAA,CAAAa,OAAA,CAAAgF,aAAA,CAAC1F,YAAA,CAAAuG,IAAI;IAACC,qBAAqB,EAAE,GAAI;IAACZ,KAAK,EAAEtB;EAAU,GAChDvB,QAAQ,IAAI,MACT,CACS,CACb,CACY,CAAC;AAEzB,CAAC;AAED,MAAMyB,MAAM,GAAGiC,uBAAU,CAACC,MAAM,CAAC;EAC/BN,IAAI,EAAE;IACJA,IAAI,EAAE;EACR,CAAC;EACDvB,OAAO,EAAE;IACP8B,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,CAAC;IACTC,UAAU,EAAE,QAAQ;IACpBC,KAAK,EAAE,MAAM;IACbC,aAAa,EAAE,KAAK;IACpBC,MAAM,EAAE/E,uBAAuB;IAC/BgF,iBAAiB,EAAE;EACrB,CAAC;EACDxC,UAAU,EAAE;IACVyC,UAAU,EAAE,KAAK;IACjBC,QAAQ,EAAE;EACZ,CAAC;EACDb,mBAAmB,EAAE;IACnBc,WAAW,EAAE;EACf;AACF,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA5G,OAAA,GAGYiC,eAAe","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_bindings","_useColorScheme","_interopRequireDefault","_KeyboardStickyView","_Arrow","_Button","_colors","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","TEST_ID_KEYBOARD_TOOLBAR","TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS","TEST_ID_KEYBOARD_TOOLBAR_NEXT","TEST_ID_KEYBOARD_TOOLBAR_CONTENT","TEST_ID_KEYBOARD_TOOLBAR_DONE","KEYBOARD_TOOLBAR_HEIGHT","DEFAULT_OPACITY","offset","closed","dismissKeyboard","KeyboardController","dismiss","goToNextField","setFocusTo","goToPrevField","KeyboardToolbar","content","theme","colors","doneText","button","icon","showArrows","onNextCallback","onPrevCallback","onDoneCallback","blur","opacity","rest","colorScheme","useColorScheme","inputs","setInputs","useState","current","count","isPrevDisabled","isNextDisabled","useEffect","subscription","FocusedInputEvents","addListener","remove","doneStyle","useMemo","styles","doneButton","color","primary","toolbarStyle","toolbar","backgroundColor","background","ButtonContainer","Button","IconContainer","Arrow","onPressNext","useCallback","event","isDefaultPrevented","onPressPrev","onPressDone","createElement","View","style","testID","Fragment","accessibilityHint","accessibilityLabel","disabled","onPress","type","flex","rippleRadius","doneButtonContainer","Text","maxFontSizeMultiplier","StyleSheet","create","position","bottom","alignItems","width","flexDirection","height","paddingHorizontal","fontWeight","fontSize","marginRight","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { StyleSheet, Text, View } from \"react-native\";\n\nimport { FocusedInputEvents, KeyboardController } from \"../../bindings\";\nimport useColorScheme from \"../hooks/useColorScheme\";\nimport KeyboardStickyView from \"../KeyboardStickyView\";\n\nimport Arrow from \"./Arrow\";\nimport Button from \"./Button\";\nimport { colors } from \"./colors\";\n\nimport type { HEX, KeyboardToolbarTheme } from \"./types\";\nimport type { ReactNode } from \"react\";\nimport type { GestureResponderEvent, ViewProps } from \"react-native\";\n\nexport type KeyboardToolbarProps = Omit<\n ViewProps,\n \"style\" | \"testID\" | \"children\"\n> & {\n /** An element that is shown in the middle of the toolbar. */\n content?: JSX.Element | null;\n /** A set of dark/light colors consumed by toolbar component. */\n theme?: KeyboardToolbarTheme;\n /** Custom text for done button. */\n doneText?: ReactNode;\n /** Custom touchable component for toolbar (used for prev/next/done buttons). */\n button?: typeof Button;\n /** Custom icon component used to display next/prev buttons. */\n icon?: typeof Arrow;\n /**\n * Whether to show next and previous buttons. Can be useful to set it to `false` if you have only one input\n * and want to show only `Done` button. Default to `true`.\n */\n showArrows?: boolean;\n /**\n * A callback that is called when the user presses the next button along with the default action.\n */\n onNextCallback?: (event: GestureResponderEvent) => void;\n /**\n * A callback that is called when the user presses the previous button along with the default action.\n */\n onPrevCallback?: (event: GestureResponderEvent) => void;\n /**\n * A callback that is called when the user presses the done button along with the default action.\n */\n onDoneCallback?: (event: GestureResponderEvent) => void;\n /**\n * A component that applies blur effect to the toolbar.\n */\n blur?: JSX.Element | null;\n /**\n * A value for container opacity in hexadecimal format (e.g. `ff`). Default value is `ff`.\n */\n opacity?: HEX;\n};\n\nconst TEST_ID_KEYBOARD_TOOLBAR = \"keyboard.toolbar\";\nconst TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS = `${TEST_ID_KEYBOARD_TOOLBAR}.previous`;\nconst TEST_ID_KEYBOARD_TOOLBAR_NEXT = `${TEST_ID_KEYBOARD_TOOLBAR}.next`;\nconst TEST_ID_KEYBOARD_TOOLBAR_CONTENT = `${TEST_ID_KEYBOARD_TOOLBAR}.content`;\nconst TEST_ID_KEYBOARD_TOOLBAR_DONE = `${TEST_ID_KEYBOARD_TOOLBAR}.done`;\n\nconst KEYBOARD_TOOLBAR_HEIGHT = 42;\nconst DEFAULT_OPACITY: HEX = \"FF\";\nconst offset = { closed: KEYBOARD_TOOLBAR_HEIGHT };\n\nconst dismissKeyboard = () => KeyboardController.dismiss();\nconst goToNextField = () => KeyboardController.setFocusTo(\"next\");\nconst goToPrevField = () => KeyboardController.setFocusTo(\"prev\");\n\n/**\n * `KeyboardToolbar` is a component that is shown above the keyboard with `Prev`/`Next` and\n * `Done` buttons.\n */\nconst KeyboardToolbar: React.FC<KeyboardToolbarProps> = ({\n content,\n theme = colors,\n doneText,\n button,\n icon,\n showArrows = true,\n onNextCallback,\n onPrevCallback,\n onDoneCallback,\n blur = null,\n opacity = DEFAULT_OPACITY,\n ...rest\n}) => {\n const colorScheme = useColorScheme();\n const [inputs, setInputs] = useState({\n current: 0,\n count: 0,\n });\n const isPrevDisabled = inputs.current === 0;\n const isNextDisabled = inputs.current === inputs.count - 1;\n\n useEffect(() => {\n const subscription = FocusedInputEvents.addListener(\"focusDidSet\", (e) => {\n setInputs(e);\n });\n\n return subscription.remove;\n }, []);\n const doneStyle = useMemo(\n () => [styles.doneButton, { color: theme[colorScheme].primary }],\n [colorScheme, theme],\n );\n const toolbarStyle = useMemo(\n () => [\n styles.toolbar,\n {\n backgroundColor: `${theme[colorScheme].background}${opacity}`,\n },\n ],\n [colorScheme, opacity, theme],\n );\n const ButtonContainer = button || Button;\n const IconContainer = icon || Arrow;\n\n const onPressNext = useCallback(\n (event: GestureResponderEvent) => {\n onNextCallback?.(event);\n\n if (!event.isDefaultPrevented()) {\n goToNextField();\n }\n },\n [onNextCallback],\n );\n const onPressPrev = useCallback(\n (event: GestureResponderEvent) => {\n onPrevCallback?.(event);\n\n if (!event.isDefaultPrevented()) {\n goToPrevField();\n }\n },\n [onPrevCallback],\n );\n const onPressDone = useCallback(\n (event: GestureResponderEvent) => {\n onDoneCallback?.(event);\n\n if (!event.isDefaultPrevented()) {\n dismissKeyboard();\n }\n },\n [onDoneCallback],\n );\n\n return (\n <KeyboardStickyView offset={offset}>\n <View {...rest} style={toolbarStyle} testID={TEST_ID_KEYBOARD_TOOLBAR}>\n {blur}\n {showArrows && (\n <>\n <ButtonContainer\n accessibilityHint=\"Moves focus to the previous field\"\n accessibilityLabel=\"Previous\"\n disabled={isPrevDisabled}\n testID={TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS}\n theme={theme}\n onPress={onPressPrev}\n >\n <IconContainer\n disabled={isPrevDisabled}\n theme={theme}\n type=\"prev\"\n />\n </ButtonContainer>\n <ButtonContainer\n accessibilityHint=\"Moves focus to the next field\"\n accessibilityLabel=\"Next\"\n disabled={isNextDisabled}\n testID={TEST_ID_KEYBOARD_TOOLBAR_NEXT}\n theme={theme}\n onPress={onPressNext}\n >\n <IconContainer\n disabled={isNextDisabled}\n theme={theme}\n type=\"next\"\n />\n </ButtonContainer>\n </>\n )}\n\n <View style={styles.flex} testID={TEST_ID_KEYBOARD_TOOLBAR_CONTENT}>\n {content}\n </View>\n <ButtonContainer\n accessibilityHint=\"Closes the keyboard\"\n accessibilityLabel=\"Done\"\n rippleRadius={28}\n style={styles.doneButtonContainer}\n testID={TEST_ID_KEYBOARD_TOOLBAR_DONE}\n theme={theme}\n onPress={onPressDone}\n >\n <Text maxFontSizeMultiplier={1.3} style={doneStyle}>\n {doneText || \"Done\"}\n </Text>\n </ButtonContainer>\n </View>\n </KeyboardStickyView>\n );\n};\n\nconst styles = StyleSheet.create({\n flex: {\n flex: 1,\n },\n toolbar: {\n position: \"absolute\",\n bottom: 0,\n alignItems: \"center\",\n width: \"100%\",\n flexDirection: \"row\",\n height: KEYBOARD_TOOLBAR_HEIGHT,\n paddingHorizontal: 8,\n },\n doneButton: {\n fontWeight: \"600\",\n fontSize: 15,\n },\n doneButtonContainer: {\n marginRight: 8,\n },\n});\n\nexport { colors as DefaultKeyboardToolbarTheme };\nexport default KeyboardToolbar;\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,mBAAA,GAAAD,sBAAA,CAAAJ,OAAA;AA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M,GAAGiC,uBAAU,CAACC,MAAM,CAAC;EAC/BN,IAAI,EAAE;IACJA,IAAI,EAAE;EACR,CAAC;EACDvB,OAAO,EAAE;IACP8B,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,CAAC;IACTC,UAAU,EAAE,QAAQ;IACpBC,KAAK,EAAE,MAAM;IACbC,aAAa,EAAE,KAAK;IACpBC,MAAM,EAAEhF,uBAAuB;IAC/BiF,iBAAiB,EAAE;EACrB,CAAC;EACDxC,UAAU,EAAE;IACVyC,UAAU,EAAE,KAAK;IACjBC,QAAQ,EAAE;EACZ,CAAC;EACDb,mBAAmB,EAAE;IACnBc,WAAW,EAAE;EACf;AACF,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAnH,OAAA,GAGYuC,eAAe","ignoreList":[]}
@@ -24,7 +24,6 @@ var _react = require("react");
24
24
  var _bindings = require("../bindings");
25
25
  var _constants = require("../constants");
26
26
  var _context = require("../context");
27
- var _useSyncEffect = _interopRequireDefault(require("./useSyncEffect"));
28
27
  var _useWindowDimensions = require("./useWindowDimensions");
29
28
  Object.keys(_useWindowDimensions).forEach(function (key) {
30
29
  if (key === "default" || key === "__esModule") return;
@@ -37,7 +36,6 @@ Object.keys(_useWindowDimensions).forEach(function (key) {
37
36
  }
38
37
  });
39
38
  });
40
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
41
39
  const useResizeMode = () => {
42
40
  (0, _react.useEffect)(() => {
43
41
  _bindings.KeyboardController.setInputMode(_constants.AndroidSoftInputModes.SOFT_INPUT_ADJUST_RESIZE);
@@ -59,7 +57,7 @@ const useReanimatedKeyboardAnimation = () => {
59
57
  exports.useReanimatedKeyboardAnimation = useReanimatedKeyboardAnimation;
60
58
  function useGenericKeyboardHandler(handler, deps) {
61
59
  const context = (0, _context.useKeyboardContext)();
62
- (0, _useSyncEffect.default)(() => {
60
+ (0, _react.useLayoutEffect)(() => {
63
61
  const cleanup = context.setKeyboardHandlers(handler);
64
62
  return () => cleanup();
65
63
  }, deps);
@@ -83,7 +81,7 @@ function useReanimatedFocusedInput() {
83
81
  }
84
82
  function useFocusedInputHandler(handler, deps) {
85
83
  const context = (0, _context.useKeyboardContext)();
86
- (0, _useSyncEffect.default)(() => {
84
+ (0, _react.useLayoutEffect)(() => {
87
85
  const cleanup = context.setInputHandlers(handler);
88
86
  return () => cleanup();
89
87
  }, deps);
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_bindings","_constants","_context","_useSyncEffect","_interopRequireDefault","_useWindowDimensions","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","e","__esModule","default","useResizeMode","useEffect","KeyboardController","setInputMode","AndroidSoftInputModes","SOFT_INPUT_ADJUST_RESIZE","setDefaultMode","useKeyboardAnimation","context","useKeyboardContext","animated","useReanimatedKeyboardAnimation","reanimated","useGenericKeyboardHandler","handler","deps","useSyncEffect","cleanup","setKeyboardHandlers","useKeyboardHandler","useKeyboardController","setEnabled","enabled","useReanimatedFocusedInput","input","layout","useFocusedInputHandler","setInputHandlers"],"sources":["index.ts"],"sourcesContent":["import { useEffect } from \"react\";\n\nimport { KeyboardController } from \"../bindings\";\nimport { AndroidSoftInputModes } from \"../constants\";\nimport { useKeyboardContext } from \"../context\";\n\nimport useSyncEffect from \"./useSyncEffect\";\n\nimport type { AnimatedContext, ReanimatedContext } from \"../context\";\nimport type { FocusedInputHandler, KeyboardHandler } from \"../types\";\nimport type { DependencyList } from \"react\";\n\nexport const useResizeMode = () => {\n useEffect(() => {\n KeyboardController.setInputMode(\n AndroidSoftInputModes.SOFT_INPUT_ADJUST_RESIZE,\n );\n\n return () => KeyboardController.setDefaultMode();\n }, []);\n};\n\nexport const useKeyboardAnimation = (): AnimatedContext => {\n useResizeMode();\n const context = useKeyboardContext();\n\n return context.animated;\n};\n\nexport const useReanimatedKeyboardAnimation = (): ReanimatedContext => {\n useResizeMode();\n const context = useKeyboardContext();\n\n return context.reanimated;\n};\n\nexport function useGenericKeyboardHandler(\n handler: KeyboardHandler,\n deps?: DependencyList,\n) {\n const context = useKeyboardContext();\n\n useSyncEffect(() => {\n const cleanup = context.setKeyboardHandlers(handler);\n\n return () => cleanup();\n }, deps);\n}\n\nexport function useKeyboardHandler(\n handler: KeyboardHandler,\n deps?: DependencyList,\n) {\n useResizeMode();\n useGenericKeyboardHandler(handler, deps);\n}\n\nexport function useKeyboardController() {\n const context = useKeyboardContext();\n\n return { setEnabled: context.setEnabled, enabled: context.enabled };\n}\n\nexport function useReanimatedFocusedInput() {\n const context = useKeyboardContext();\n\n return { input: context.layout };\n}\n\nexport function useFocusedInputHandler(\n handler: FocusedInputHandler,\n deps?: DependencyList,\n) {\n const context = useKeyboardContext();\n\n useSyncEffect(() => {\n const cleanup = context.setInputHandlers(handler);\n\n return () => cleanup();\n }, deps);\n}\n\nexport * from \"./useWindowDimensions\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAEA,IAAAI,cAAA,GAAAC,sBAAA,CAAAL,OAAA;AA4EA,IAAAM,oBAAA,GAAAN,OAAA;AAAAO,MAAA,CAAAC,IAAA,CAAAF,oBAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,oBAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,oBAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAAsC,SAAAL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C,MAAMZ,OAAO,GAAG,IAAAC,2BAAkB,EAAC,CAAC;EAEpC,OAAO;IAAEY,UAAU,EAAEb,OAAO,CAACa,UAAU;IAAEC,OAAO,EAAEd,OAAO,CAACc;EAAQ,CAAC;AACrE;AAEO,SAASC,yBAAyBA,CAAA,EAAG;EAC1C,MAAMf,OAAO,GAAG,IAAAC,2BAAkB,EAAC,CAAC;EAEpC,OAAO;IAAEe,KAAK,EAAEhB,OAAO,CAACiB;EAAO,CAAC;AAClC;AAEO,SAASC,sBAAsBA,CACpCZ,OAA4B,EAC5BC,IAAqB,EACrB;EACA,MAAMP,OAAO,GAAG,IAAAC,2BAAkB,EAAC,CAAC;EAEpC,IAAAO,sBAAa,EAAC,MAAM;IAClB,MAAMC,OAAO,GAAGT,OAAO,CAACmB,gBAAgB,CAACb,OAAO,CAAC;IAEjD,OAAO,MAAMG,OAAO,CAAC,CAAC;EACxB,CAAC,EAAEF,IAAI,CAAC;AACV","ignoreList":[]}
1
+ {"version":3,"names":["_react","require","_bindings","_constants","_context","_useWindowDimensions","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","useResizeMode","useEffect","KeyboardController","setInputMode","AndroidSoftInputModes","SOFT_INPUT_ADJUST_RESIZE","setDefaultMode","useKeyboardAnimation","context","useKeyboardContext","animated","useReanimatedKeyboardAnimation","reanimated","useGenericKeyboardHandler","handler","deps","useLayoutEffect","cleanup","setKeyboardHandlers","useKeyboardHandler","useKeyboardController","setEnabled","enabled","useReanimatedFocusedInput","input","layout","useFocusedInputHandler","setInputHandlers"],"sources":["index.ts"],"sourcesContent":["import { useEffect, useLayoutEffect } from \"react\";\n\nimport { KeyboardController } from \"../bindings\";\nimport { AndroidSoftInputModes } from \"../constants\";\nimport { useKeyboardContext } from \"../context\";\n\nimport type { AnimatedContext, ReanimatedContext } from \"../context\";\nimport type { FocusedInputHandler, KeyboardHandler } from \"../types\";\nimport type { DependencyList } from \"react\";\n\nexport const useResizeMode = () => {\n useEffect(() => {\n KeyboardController.setInputMode(\n AndroidSoftInputModes.SOFT_INPUT_ADJUST_RESIZE,\n );\n\n return () => KeyboardController.setDefaultMode();\n }, []);\n};\n\nexport const useKeyboardAnimation = (): AnimatedContext => {\n useResizeMode();\n const context = useKeyboardContext();\n\n return context.animated;\n};\n\nexport const useReanimatedKeyboardAnimation = (): ReanimatedContext => {\n useResizeMode();\n const context = useKeyboardContext();\n\n return context.reanimated;\n};\n\nexport function useGenericKeyboardHandler(\n handler: KeyboardHandler,\n deps?: DependencyList,\n) {\n const context = useKeyboardContext();\n\n useLayoutEffect(() => {\n const cleanup = context.setKeyboardHandlers(handler);\n\n return () => cleanup();\n }, deps);\n}\n\nexport function useKeyboardHandler(\n handler: KeyboardHandler,\n deps?: DependencyList,\n) {\n useResizeMode();\n useGenericKeyboardHandler(handler, deps);\n}\n\nexport function useKeyboardController() {\n const context = useKeyboardContext();\n\n return { setEnabled: context.setEnabled, enabled: context.enabled };\n}\n\nexport function useReanimatedFocusedInput() {\n const context = useKeyboardContext();\n\n return { input: context.layout };\n}\n\nexport function useFocusedInputHandler(\n handler: FocusedInputHandler,\n deps?: DependencyList,\n) {\n const context = useKeyboardContext();\n\n useLayoutEffect(() => {\n const cleanup = context.setInputHandlers(handler);\n\n return () => cleanup();\n }, deps);\n}\n\nexport * from \"./useWindowDimensions\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AA4EA,IAAAI,oBAAA,GAAAJ,OAAA;AAAAK,MAAA,CAAAC,IAAA,CAAAF,oBAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAA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