@react-native-ohos/react-native-keyboard-controller 1.12.8-rc.1

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 (248) hide show
  1. package/LICENSE +21 -0
  2. package/README.OpenSource +11 -0
  3. package/README.md +19 -0
  4. package/harmony/keyboard_controller/BuildProfile.ets +17 -0
  5. package/harmony/keyboard_controller/Index.ets +9 -0
  6. package/harmony/keyboard_controller/ResourceTable.txt +9 -0
  7. package/harmony/keyboard_controller/build-profile.json5 +31 -0
  8. package/harmony/keyboard_controller/consumer-rules.txt +0 -0
  9. package/harmony/keyboard_controller/hvigorfile.ts +6 -0
  10. package/harmony/keyboard_controller/obfuscation-rules.txt +18 -0
  11. package/harmony/keyboard_controller/oh-package.json5 +11 -0
  12. package/harmony/keyboard_controller/src/main/cpp/CMakeLists.txt +7 -0
  13. package/harmony/keyboard_controller/src/main/cpp/EventEmitters.cpp +96 -0
  14. package/harmony/keyboard_controller/src/main/cpp/EventEmitters.h +90 -0
  15. package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentDescriptor.h +77 -0
  16. package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.cpp +158 -0
  17. package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.h +74 -0
  18. package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewJSIBinder.h +43 -0
  19. package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentDescriptor.h +64 -0
  20. package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.cpp +89 -0
  21. package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.h +63 -0
  22. package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaJSIBinder.h +39 -0
  23. package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.cpp +25 -0
  24. package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.h +27 -0
  25. package/harmony/keyboard_controller/src/main/cpp/RNKeyboardControllerPackage.cpp +43 -0
  26. package/harmony/keyboard_controller/src/main/cpp/RNKeyboardControllerPackage.h +56 -0
  27. package/harmony/keyboard_controller/src/main/cpp/RNStatusBarManagerCompat.cpp +24 -0
  28. package/harmony/keyboard_controller/src/main/cpp/RNStatusBarManagerCompat.h +28 -0
  29. package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.cpp +43 -0
  30. package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.h +56 -0
  31. package/harmony/keyboard_controller/src/main/ets/Logger.ts +46 -0
  32. package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerPackage.ets +46 -0
  33. package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerTurboModule.ts +210 -0
  34. package/harmony/keyboard_controller/src/main/ets/RNStatusBarManagerCompatTurboModule.ts +98 -0
  35. package/harmony/keyboard_controller/src/main/ets/Type.ts +41 -0
  36. package/harmony/keyboard_controller/src/main/module.json +29 -0
  37. package/harmony/keyboard_controller/src/main/module.json5 +11 -0
  38. package/harmony/keyboard_controller/src/main/resources/base/element/string.json +8 -0
  39. package/harmony/keyboard_controller/src/main/resources/en_US/element/string.json +8 -0
  40. package/harmony/keyboard_controller/src/main/resources/zh_CN/element/string.json +8 -0
  41. package/harmony/keyboard_controller/ts.ets +9 -0
  42. package/harmony/keyboard_controller.har +0 -0
  43. package/lib/commonjs/animated.js +174 -0
  44. package/lib/commonjs/animated.js.map +1 -0
  45. package/lib/commonjs/bindings.js +38 -0
  46. package/lib/commonjs/bindings.js.map +1 -0
  47. package/lib/commonjs/bindings.native.js +37 -0
  48. package/lib/commonjs/bindings.native.js.map +1 -0
  49. package/lib/commonjs/components/KeyboardAvoidingView/hooks.js +66 -0
  50. package/lib/commonjs/components/KeyboardAvoidingView/hooks.js.map +1 -0
  51. package/lib/commonjs/components/KeyboardAvoidingView/index.js +102 -0
  52. package/lib/commonjs/components/KeyboardAvoidingView/index.js.map +1 -0
  53. package/lib/commonjs/components/KeyboardAwareScrollView/index.js +255 -0
  54. package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -0
  55. package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +110 -0
  56. package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -0
  57. package/lib/commonjs/components/KeyboardAwareScrollView/utils.js +37 -0
  58. package/lib/commonjs/components/KeyboardAwareScrollView/utils.js.map +1 -0
  59. package/lib/commonjs/components/KeyboardStickyView/index.js +40 -0
  60. package/lib/commonjs/components/KeyboardStickyView/index.js.map +1 -0
  61. package/lib/commonjs/components/KeyboardToolbar/Arrow.js +76 -0
  62. package/lib/commonjs/components/KeyboardToolbar/Arrow.js.map +1 -0
  63. package/lib/commonjs/components/KeyboardToolbar/Button.js +70 -0
  64. package/lib/commonjs/components/KeyboardToolbar/Button.js.map +1 -0
  65. package/lib/commonjs/components/KeyboardToolbar/colors.js +21 -0
  66. package/lib/commonjs/components/KeyboardToolbar/colors.js.map +1 -0
  67. package/lib/commonjs/components/KeyboardToolbar/colors.native.js +40 -0
  68. package/lib/commonjs/components/KeyboardToolbar/colors.native.js.map +1 -0
  69. package/lib/commonjs/components/KeyboardToolbar/index.js +152 -0
  70. package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -0
  71. package/lib/commonjs/components/KeyboardToolbar/types.js +6 -0
  72. package/lib/commonjs/components/KeyboardToolbar/types.js.map +1 -0
  73. package/lib/commonjs/components/hooks/useColorScheme.js +10 -0
  74. package/lib/commonjs/components/hooks/useColorScheme.js.map +1 -0
  75. package/lib/commonjs/components/index.js +42 -0
  76. package/lib/commonjs/components/index.js.map +1 -0
  77. package/lib/commonjs/constants.js +25 -0
  78. package/lib/commonjs/constants.js.map +1 -0
  79. package/lib/commonjs/context.js +42 -0
  80. package/lib/commonjs/context.js.map +1 -0
  81. package/lib/commonjs/hooks/index.js +104 -0
  82. package/lib/commonjs/hooks/index.js.map +1 -0
  83. package/lib/commonjs/hooks/useWindowDimensions/index.android.js +29 -0
  84. package/lib/commonjs/hooks/useWindowDimensions/index.android.js.map +1 -0
  85. package/lib/commonjs/hooks/useWindowDimensions/index.js +13 -0
  86. package/lib/commonjs/hooks/useWindowDimensions/index.js.map +1 -0
  87. package/lib/commonjs/index.js +116 -0
  88. package/lib/commonjs/index.js.map +1 -0
  89. package/lib/commonjs/internal.js +73 -0
  90. package/lib/commonjs/internal.js.map +1 -0
  91. package/lib/commonjs/monkey-patch.android.js +57 -0
  92. package/lib/commonjs/monkey-patch.android.js.map +1 -0
  93. package/lib/commonjs/monkey-patch.js +11 -0
  94. package/lib/commonjs/monkey-patch.js.map +1 -0
  95. package/lib/commonjs/reanimated.js +12 -0
  96. package/lib/commonjs/reanimated.js.map +1 -0
  97. package/lib/commonjs/reanimated.native.js +88 -0
  98. package/lib/commonjs/reanimated.native.js.map +1 -0
  99. package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js +10 -0
  100. package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js.map +1 -0
  101. package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js +12 -0
  102. package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js.map +1 -0
  103. package/lib/commonjs/specs/NativeKeyboardController.js +9 -0
  104. package/lib/commonjs/specs/NativeKeyboardController.js.map +1 -0
  105. package/lib/commonjs/specs/NativeStatusBarManagerCompat.js +9 -0
  106. package/lib/commonjs/specs/NativeStatusBarManagerCompat.js.map +1 -0
  107. package/lib/commonjs/types.js +6 -0
  108. package/lib/commonjs/types.js.map +1 -0
  109. package/lib/commonjs/utils.js +9 -0
  110. package/lib/commonjs/utils.js.map +1 -0
  111. package/lib/module/animated.js +166 -0
  112. package/lib/module/animated.js.map +1 -0
  113. package/lib/module/bindings.js +32 -0
  114. package/lib/module/bindings.js.map +1 -0
  115. package/lib/module/bindings.native.js +31 -0
  116. package/lib/module/bindings.native.js.map +1 -0
  117. package/lib/module/components/KeyboardAvoidingView/hooks.js +59 -0
  118. package/lib/module/components/KeyboardAvoidingView/hooks.js.map +1 -0
  119. package/lib/module/components/KeyboardAvoidingView/index.js +95 -0
  120. package/lib/module/components/KeyboardAvoidingView/index.js.map +1 -0
  121. package/lib/module/components/KeyboardAwareScrollView/index.js +248 -0
  122. package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -0
  123. package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +103 -0
  124. package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -0
  125. package/lib/module/components/KeyboardAwareScrollView/utils.js +29 -0
  126. package/lib/module/components/KeyboardAwareScrollView/utils.js.map +1 -0
  127. package/lib/module/components/KeyboardStickyView/index.js +33 -0
  128. package/lib/module/components/KeyboardStickyView/index.js.map +1 -0
  129. package/lib/module/components/KeyboardToolbar/Arrow.js +68 -0
  130. package/lib/module/components/KeyboardToolbar/Arrow.js.map +1 -0
  131. package/lib/module/components/KeyboardToolbar/Button.js +62 -0
  132. package/lib/module/components/KeyboardToolbar/Button.js.map +1 -0
  133. package/lib/module/components/KeyboardToolbar/colors.js +15 -0
  134. package/lib/module/components/KeyboardToolbar/colors.js.map +1 -0
  135. package/lib/module/components/KeyboardToolbar/colors.native.js +34 -0
  136. package/lib/module/components/KeyboardToolbar/colors.native.js.map +1 -0
  137. package/lib/module/components/KeyboardToolbar/index.js +140 -0
  138. package/lib/module/components/KeyboardToolbar/index.js.map +1 -0
  139. package/lib/module/components/KeyboardToolbar/types.js +2 -0
  140. package/lib/module/components/KeyboardToolbar/types.js.map +1 -0
  141. package/lib/module/components/hooks/useColorScheme.js +4 -0
  142. package/lib/module/components/hooks/useColorScheme.js.map +1 -0
  143. package/lib/module/components/index.js +5 -0
  144. package/lib/module/components/index.js.map +1 -0
  145. package/lib/module/constants.js +19 -0
  146. package/lib/module/constants.js.map +1 -0
  147. package/lib/module/context.js +35 -0
  148. package/lib/module/context.js.map +1 -0
  149. package/lib/module/hooks/index.js +68 -0
  150. package/lib/module/hooks/index.js.map +1 -0
  151. package/lib/module/hooks/useWindowDimensions/index.android.js +22 -0
  152. package/lib/module/hooks/useWindowDimensions/index.android.js.map +1 -0
  153. package/lib/module/hooks/useWindowDimensions/index.js +2 -0
  154. package/lib/module/hooks/useWindowDimensions/index.js.map +1 -0
  155. package/lib/module/index.js +10 -0
  156. package/lib/module/index.js.map +1 -0
  157. package/lib/module/internal.js +66 -0
  158. package/lib/module/internal.js.map +1 -0
  159. package/lib/module/monkey-patch.android.js +47 -0
  160. package/lib/module/monkey-patch.android.js.map +1 -0
  161. package/lib/module/monkey-patch.js +5 -0
  162. package/lib/module/monkey-patch.js.map +1 -0
  163. package/lib/module/reanimated.js +6 -0
  164. package/lib/module/reanimated.js.map +1 -0
  165. package/lib/module/reanimated.native.js +78 -0
  166. package/lib/module/reanimated.native.js.map +1 -0
  167. package/lib/module/specs/KeyboardControllerViewNativeComponent.js +3 -0
  168. package/lib/module/specs/KeyboardControllerViewNativeComponent.js.map +1 -0
  169. package/lib/module/specs/KeyboardGestureAreaNativeComponent.js +5 -0
  170. package/lib/module/specs/KeyboardGestureAreaNativeComponent.js.map +1 -0
  171. package/lib/module/specs/NativeKeyboardController.js +3 -0
  172. package/lib/module/specs/NativeKeyboardController.js.map +1 -0
  173. package/lib/module/specs/NativeStatusBarManagerCompat.js +3 -0
  174. package/lib/module/specs/NativeStatusBarManagerCompat.js.map +1 -0
  175. package/lib/module/types.js +2 -0
  176. package/lib/module/types.js.map +1 -0
  177. package/lib/module/utils.js +2 -0
  178. package/lib/module/utils.js.map +1 -0
  179. package/lib/typescript/animated.d.ts +31 -0
  180. package/lib/typescript/bindings.d.ts +12 -0
  181. package/lib/typescript/bindings.native.d.ts +12 -0
  182. package/lib/typescript/components/KeyboardAvoidingView/hooks.d.ts +6 -0
  183. package/lib/typescript/components/KeyboardAvoidingView/index.d.ts +50 -0
  184. package/lib/typescript/components/KeyboardAwareScrollView/index.d.ts +25 -0
  185. package/lib/typescript/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.d.ts +6 -0
  186. package/lib/typescript/components/KeyboardAwareScrollView/utils.d.ts +2 -0
  187. package/lib/typescript/components/KeyboardStickyView/index.d.ts +35 -0
  188. package/lib/typescript/components/KeyboardToolbar/Arrow.d.ts +9 -0
  189. package/lib/typescript/components/KeyboardToolbar/Button.d.ts +15 -0
  190. package/lib/typescript/components/KeyboardToolbar/colors.d.ts +2 -0
  191. package/lib/typescript/components/KeyboardToolbar/colors.native.d.ts +2 -0
  192. package/lib/typescript/components/KeyboardToolbar/index.d.ts +50 -0
  193. package/lib/typescript/components/KeyboardToolbar/types.d.ts +18 -0
  194. package/lib/typescript/components/hooks/useColorScheme.d.ts +2 -0
  195. package/lib/typescript/components/index.d.ts +8 -0
  196. package/lib/typescript/constants.d.ts +16 -0
  197. package/lib/typescript/context.d.ts +23 -0
  198. package/lib/typescript/hooks/index.d.ts +17 -0
  199. package/lib/typescript/hooks/useWindowDimensions/index.android.d.ts +2 -0
  200. package/lib/typescript/hooks/useWindowDimensions/index.d.ts +1 -0
  201. package/lib/typescript/index.d.ts +8 -0
  202. package/lib/typescript/internal.d.ts +30 -0
  203. package/lib/typescript/monkey-patch.android.d.ts +2 -0
  204. package/lib/typescript/monkey-patch.d.ts +2 -0
  205. package/lib/typescript/reanimated.d.ts +5 -0
  206. package/lib/typescript/reanimated.native.d.ts +7 -0
  207. package/lib/typescript/specs/KeyboardControllerViewNativeComponent.d.ts +53 -0
  208. package/lib/typescript/specs/KeyboardGestureAreaNativeComponent.d.ts +10 -0
  209. package/lib/typescript/specs/NativeKeyboardController.d.ts +12 -0
  210. package/lib/typescript/specs/NativeStatusBarManagerCompat.d.ts +10 -0
  211. package/lib/typescript/types.d.ts +133 -0
  212. package/lib/typescript/utils.d.ts +1 -0
  213. package/package.json +177 -0
  214. package/react-native-keyboard-controller.podspec +61 -0
  215. package/src/animated.tsx +246 -0
  216. package/src/bindings.native.ts +57 -0
  217. package/src/bindings.ts +38 -0
  218. package/src/components/KeyboardAvoidingView/hooks.ts +58 -0
  219. package/src/components/KeyboardAvoidingView/index.tsx +156 -0
  220. package/src/components/KeyboardAwareScrollView/index.tsx +373 -0
  221. package/src/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.ts +133 -0
  222. package/src/components/KeyboardAwareScrollView/utils.ts +41 -0
  223. package/src/components/KeyboardStickyView/index.tsx +57 -0
  224. package/src/components/KeyboardToolbar/Arrow.tsx +80 -0
  225. package/src/components/KeyboardToolbar/Button.tsx +98 -0
  226. package/src/components/KeyboardToolbar/colors.native.ts +37 -0
  227. package/src/components/KeyboardToolbar/colors.ts +16 -0
  228. package/src/components/KeyboardToolbar/index.tsx +211 -0
  229. package/src/components/KeyboardToolbar/types.ts +40 -0
  230. package/src/components/hooks/useColorScheme.ts +5 -0
  231. package/src/components/index.ts +11 -0
  232. package/src/constants.ts +19 -0
  233. package/src/context.ts +65 -0
  234. package/src/hooks/index.ts +90 -0
  235. package/src/hooks/useWindowDimensions/index.android.ts +33 -0
  236. package/src/hooks/useWindowDimensions/index.ts +1 -0
  237. package/src/index.ts +21 -0
  238. package/src/internal.ts +84 -0
  239. package/src/monkey-patch.android.ts +44 -0
  240. package/src/monkey-patch.ts +4 -0
  241. package/src/reanimated.native.ts +132 -0
  242. package/src/reanimated.ts +29 -0
  243. package/src/specs/KeyboardControllerViewNativeComponent.ts +70 -0
  244. package/src/specs/KeyboardGestureAreaNativeComponent.ts +15 -0
  245. package/src/specs/NativeKeyboardController.ts +19 -0
  246. package/src/specs/NativeStatusBarManagerCompat.ts +14 -0
  247. package/src/types.ts +211 -0
  248. package/src/utils.ts +1 -0
@@ -0,0 +1,32 @@
1
+ import { View } from "react-native";
2
+ const NOOP = () => {};
3
+ export const KeyboardController = {
4
+ setDefaultMode: NOOP,
5
+ setInputMode: NOOP,
6
+ dismiss: NOOP,
7
+ setFocusTo: NOOP,
8
+ addListener: NOOP,
9
+ removeListeners: NOOP
10
+ };
11
+ export const KeyboardEvents = {
12
+ addListener: () => ({
13
+ remove: NOOP
14
+ })
15
+ };
16
+ /**
17
+ * This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.
18
+ * Use it with cautious.
19
+ */
20
+ export const FocusedInputEvents = {
21
+ addListener: () => ({
22
+ remove: NOOP
23
+ })
24
+ };
25
+ export const WindowDimensionsEvents = {
26
+ addListener: () => ({
27
+ remove: NOOP
28
+ })
29
+ };
30
+ export const KeyboardControllerView = View;
31
+ export const KeyboardGestureArea = View;
32
+ //# sourceMappingURL=bindings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["View","NOOP","KeyboardController","setDefaultMode","setInputMode","dismiss","setFocusTo","addListener","removeListeners","KeyboardEvents","remove","FocusedInputEvents","WindowDimensionsEvents","KeyboardControllerView","KeyboardGestureArea"],"sources":["bindings.ts"],"sourcesContent":["import { View } from \"react-native\";\r\n\r\nimport type {\r\n FocusedInputEventsModule,\r\n KeyboardControllerModule,\r\n KeyboardControllerProps,\r\n KeyboardEventsModule,\r\n KeyboardGestureAreaProps,\r\n WindowDimensionsEventsModule,\r\n} from \"./types\";\r\nimport type { EmitterSubscription } from \"react-native\";\r\n\r\nconst NOOP = () => {};\r\nexport const KeyboardController: KeyboardControllerModule = {\r\n setDefaultMode: NOOP,\r\n setInputMode: NOOP,\r\n dismiss: NOOP,\r\n setFocusTo: NOOP,\r\n addListener: NOOP,\r\n removeListeners: NOOP,\r\n};\r\nexport const KeyboardEvents: KeyboardEventsModule = {\r\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\r\n};\r\n/**\r\n * This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.\r\n * Use it with cautious.\r\n */\r\nexport const FocusedInputEvents: FocusedInputEventsModule = {\r\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\r\n};\r\nexport const WindowDimensionsEvents: WindowDimensionsEventsModule = {\r\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\r\n};\r\nexport const KeyboardControllerView =\r\n View as unknown as React.FC<KeyboardControllerProps>;\r\nexport const KeyboardGestureArea =\r\n View as unknown as React.FC<KeyboardGestureAreaProps>;\r\n"],"mappings":"AAAA,SAASA,IAAI,QAAQ,cAAc;AAYnC,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AACrB,OAAO,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;AACD,OAAO,MAAMQ,cAAoC,GAAG;EAClDF,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAET;EAAK,CAAC;AACtC,CAAC;AACD;AACA;AACA;AACA;AACA,OAAO,MAAMU,kBAA4C,GAAG;EAC1DJ,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAET;EAAK,CAAC;AACtC,CAAC;AACD,OAAO,MAAMW,sBAAoD,GAAG;EAClEL,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAET;EAAK,CAAC;AACtC,CAAC;AACD,OAAO,MAAMY,sBAAsB,GACjCb,IAAoD;AACtD,OAAO,MAAMc,mBAAmB,GAC9Bd,IAAqD","ignoreList":[]}
@@ -0,0 +1,31 @@
1
+ import { NativeEventEmitter, Platform } from "react-native";
2
+ const LINKING_ERROR = `The package 'react-native-keyboard-controller' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
3
+ ios: "- You have run 'pod install'\n",
4
+ default: ""
5
+ }) + "- You rebuilt the app after installing the package\n" + "- You are not using Expo Go\n";
6
+ const RCTKeyboardController = require("./specs/NativeKeyboardController").default;
7
+ export const KeyboardController = RCTKeyboardController ? RCTKeyboardController : new Proxy({}, {
8
+ get() {
9
+ throw new Error(LINKING_ERROR);
10
+ }
11
+ });
12
+ const KEYBOARD_CONTROLLER_NAMESPACE = "KeyboardController::";
13
+ const eventEmitter = new NativeEventEmitter(KeyboardController);
14
+ export const KeyboardEvents = {
15
+ addListener: (name, cb) => eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb)
16
+ };
17
+ /**
18
+ * This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.
19
+ * Use it with cautious.
20
+ */
21
+ export const FocusedInputEvents = {
22
+ addListener: (name, cb) => eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb)
23
+ };
24
+ export const WindowDimensionsEvents = {
25
+ addListener: (name, cb) => eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb)
26
+ };
27
+ export const KeyboardControllerView = require("./specs/KeyboardControllerViewNativeComponent").default;
28
+ export const KeyboardGestureArea = Platform.OS === "android" && Platform.Version >= 30 ? require("./specs/KeyboardGestureAreaNativeComponent").default : ({
29
+ children
30
+ }) => children;
31
+ //# sourceMappingURL=bindings.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeEventEmitter","Platform","LINKING_ERROR","select","ios","default","RCTKeyboardController","require","KeyboardController","Proxy","get","Error","KEYBOARD_CONTROLLER_NAMESPACE","eventEmitter","KeyboardEvents","addListener","name","cb","FocusedInputEvents","WindowDimensionsEvents","KeyboardControllerView","KeyboardGestureArea","OS","Version","children"],"sources":["bindings.native.ts"],"sourcesContent":["import { NativeEventEmitter, Platform } from \"react-native\";\r\n\r\nimport type {\r\n FocusedInputEventsModule,\r\n KeyboardControllerModule,\r\n KeyboardControllerProps,\r\n KeyboardEventsModule,\r\n KeyboardGestureAreaProps,\r\n WindowDimensionsEventsModule,\r\n} from \"./types\";\r\n\r\nconst LINKING_ERROR =\r\n `The package 'react-native-keyboard-controller' doesn't seem to be linked. Make sure: \\n\\n` +\r\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: \"\" }) +\r\n \"- You rebuilt the app after installing the package\\n\" +\r\n \"- You are not using Expo Go\\n\";\r\n\r\nconst RCTKeyboardController =\r\n require(\"./specs/NativeKeyboardController\").default;\r\nexport const KeyboardController = (\r\n RCTKeyboardController\r\n ? RCTKeyboardController\r\n : new Proxy(\r\n {},\r\n {\r\n get() {\r\n throw new Error(LINKING_ERROR);\r\n },\r\n },\r\n )\r\n) as KeyboardControllerModule;\r\n\r\nconst KEYBOARD_CONTROLLER_NAMESPACE = \"KeyboardController::\";\r\nconst eventEmitter = new NativeEventEmitter(KeyboardController);\r\n\r\nexport const KeyboardEvents: KeyboardEventsModule = {\r\n addListener: (name, cb) =>\r\n eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),\r\n};\r\n/**\r\n * This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.\r\n * Use it with cautious.\r\n */\r\nexport const FocusedInputEvents: FocusedInputEventsModule = {\r\n addListener: (name, cb) =>\r\n eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),\r\n};\r\nexport const WindowDimensionsEvents: WindowDimensionsEventsModule = {\r\n addListener: (name, cb) =>\r\n eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),\r\n};\r\nexport const KeyboardControllerView: React.FC<KeyboardControllerProps> =\r\n require(\"./specs/KeyboardControllerViewNativeComponent\").default;\r\nexport const KeyboardGestureArea: React.FC<KeyboardGestureAreaProps> =\r\n Platform.OS === \"android\" && Platform.Version >= 30\r\n ? require(\"./specs/KeyboardGestureAreaNativeComponent\").default\r\n : ({ children }: KeyboardGestureAreaProps) => children;\r\n"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;AAW3D,MAAMC,aAAa,GACjB,2FAA2F,GAC3FD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,qBAAqB,GACzBC,OAAO,CAAC,kCAAkC,CAAC,CAACF,OAAO;AACrD,OAAO,MAAMG,kBAAkB,GAC7BF,qBAAqB,GACjBA,qBAAqB,GACrB,IAAIG,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CACF,CACuB;AAE7B,MAAMU,6BAA6B,GAAG,sBAAsB;AAC5D,MAAMC,YAAY,GAAG,IAAIb,kBAAkB,CAACQ,kBAAkB,CAAC;AAE/D,OAAO,MAAMM,cAAoC,GAAG;EAClDC,WAAW,EAAEA,CAACC,IAAI,EAAEC,EAAE,KACpBJ,YAAY,CAACE,WAAW,CAACH,6BAA6B,GAAGI,IAAI,EAAEC,EAAE;AACrE,CAAC;AACD;AACA;AACA;AACA;AACA,OAAO,MAAMC,kBAA4C,GAAG;EAC1DH,WAAW,EAAEA,CAACC,IAAI,EAAEC,EAAE,KACpBJ,YAAY,CAACE,WAAW,CAACH,6BAA6B,GAAGI,IAAI,EAAEC,EAAE;AACrE,CAAC;AACD,OAAO,MAAME,sBAAoD,GAAG;EAClEJ,WAAW,EAAEA,CAACC,IAAI,EAAEC,EAAE,KACpBJ,YAAY,CAACE,WAAW,CAACH,6BAA6B,GAAGI,IAAI,EAAEC,EAAE;AACrE,CAAC;AACD,OAAO,MAAMG,sBAAyD,GACpEb,OAAO,CAAC,+CAA+C,CAAC,CAACF,OAAO;AAClE,OAAO,MAAMgB,mBAAuD,GAClEpB,QAAQ,CAACqB,EAAE,KAAK,SAAS,IAAIrB,QAAQ,CAACsB,OAAO,IAAI,EAAE,GAC/ChB,OAAO,CAAC,4CAA4C,CAAC,CAACF,OAAO,GAC7D,CAAC;EAAEmB;AAAmC,CAAC,KAAKA,QAAQ","ignoreList":[]}
@@ -0,0 +1,59 @@
1
+ import { useSharedValue } from "react-native-reanimated";
2
+ import { useKeyboardHandler } from "../../hooks";
3
+ import { useKeyboardContext } from "../../context";
4
+ import { Platform } from "react-native";
5
+ export const useKeyboardAnimation = () => {
6
+ const {
7
+ reanimated
8
+ } = useKeyboardContext();
9
+ const heightWhenOpened = useSharedValue(-reanimated.height.value);
10
+ const height = useSharedValue(-reanimated.height.value);
11
+ const progress = useSharedValue(reanimated.progress.value);
12
+ const isClosed = useSharedValue(reanimated.progress.value === 0);
13
+ useKeyboardHandler({
14
+ onStart: e => {
15
+ "worklet";
16
+
17
+ if (e.height > 0) {
18
+ // eslint-disable-next-line react-compiler/react-compiler
19
+ isClosed.value = false;
20
+ heightWhenOpened.value = e.height;
21
+ }
22
+ },
23
+ onMove: e => {
24
+ "worklet";
25
+
26
+ progress.value = e.progress;
27
+ height.value = e.height;
28
+ },
29
+ onEnd: e => {
30
+ "worklet";
31
+
32
+ if (Platform.OS === 'harmony') {
33
+ heightWhenOpened.value = e.height;
34
+ }
35
+ isClosed.value = e.height === 0;
36
+
37
+ // `height` update happens in `onMove` handler
38
+ // in `onEnd` we need to update only if `onMove`
39
+ // wasn't called (i. e. duration === 0)
40
+ //
41
+ // we can not call this code without condition below
42
+ // because in some corner cases (iOS with `secureTextEntry`)
43
+ // `onEnd` can be emitted before `onMove` and in this case
44
+ // it may lead to choppy/glitchy/jumpy UI
45
+ // see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/327
46
+ if (e.duration === 0) {
47
+ progress.value = e.progress;
48
+ height.value = e.height;
49
+ }
50
+ }
51
+ }, []);
52
+ return {
53
+ height,
54
+ progress,
55
+ heightWhenOpened,
56
+ isClosed
57
+ };
58
+ };
59
+ //# sourceMappingURL=hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useSharedValue","useKeyboardHandler","useKeyboardContext","Platform","useKeyboardAnimation","reanimated","heightWhenOpened","height","value","progress","isClosed","onStart","e","onMove","onEnd","OS","duration"],"sources":["hooks.ts"],"sourcesContent":["import { useSharedValue } from \"react-native-reanimated\";\r\n\r\nimport {useKeyboardHandler} from \"../../hooks\";\r\nimport {useKeyboardContext} from \"../../context\";\r\nimport { Platform } from \"react-native\";\r\n\r\nexport const useKeyboardAnimation = () => {\r\n const { reanimated } = useKeyboardContext();\r\n const heightWhenOpened = useSharedValue(-reanimated.height.value);\r\n const height = useSharedValue(-reanimated.height.value);\r\n const progress = useSharedValue(reanimated.progress.value);\r\n const isClosed = useSharedValue(reanimated.progress.value === 0);\r\n\r\n useKeyboardHandler(\r\n {\r\n onStart: (e) => {\r\n \"worklet\";\r\n\r\n if (e.height > 0) {\r\n // eslint-disable-next-line react-compiler/react-compiler\r\n isClosed.value = false;\r\n heightWhenOpened.value = e.height;\r\n }\r\n },\r\n onMove: (e) => {\r\n \"worklet\";\r\n \r\n progress.value = e.progress;\r\n height.value = e.height;\r\n },\r\n onEnd: (e) => {\r\n \"worklet\";\r\n if(Platform.OS as string === 'harmony'){\r\n heightWhenOpened.value = e.height;\r\n }\r\n \r\n isClosed.value = e.height === 0;\r\n\r\n // `height` update happens in `onMove` handler\r\n // in `onEnd` we need to update only if `onMove`\r\n // wasn't called (i. e. duration === 0)\r\n //\r\n // we can not call this code without condition below\r\n // because in some corner cases (iOS with `secureTextEntry`)\r\n // `onEnd` can be emitted before `onMove` and in this case\r\n // it may lead to choppy/glitchy/jumpy UI\r\n // see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/327\r\n if (e.duration === 0) {\r\n progress.value = e.progress;\r\n height.value = e.height;\r\n }\r\n },\r\n },\r\n [],\r\n );\r\n\r\n return { height, progress, heightWhenOpened, isClosed };\r\n};\r\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,yBAAyB;AAExD,SAAQC,kBAAkB,QAAO,aAAa;AAC9C,SAAQC,kBAAkB,QAAO,eAAe;AAChD,SAASC,QAAQ,QAAQ,cAAc;AAEvC,OAAO,MAAMC,oBAAoB,GAAGA,CAAA,KAAM;EACxC,MAAM;IAAEC;EAAW,CAAC,GAAGH,kBAAkB,CAAC,CAAC;EAC3C,MAAMI,gBAAgB,GAAGN,cAAc,CAAC,CAACK,UAAU,CAACE,MAAM,CAACC,KAAK,CAAC;EACjE,MAAMD,MAAM,GAAGP,cAAc,CAAC,CAACK,UAAU,CAACE,MAAM,CAACC,KAAK,CAAC;EACvD,MAAMC,QAAQ,GAAGT,cAAc,CAACK,UAAU,CAACI,QAAQ,CAACD,KAAK,CAAC;EAC1D,MAAME,QAAQ,GAAGV,cAAc,CAACK,UAAU,CAACI,QAAQ,CAACD,KAAK,KAAK,CAAC,CAAC;EAEhEP,kBAAkB,CAChB;IACEU,OAAO,EAAGC,CAAC,IAAK;MACd,SAAS;;MAET,IAAIA,CAAC,CAACL,MAAM,GAAG,CAAC,EAAE;QAChB;QACAG,QAAQ,CAACF,KAAK,GAAG,KAAK;QACtBF,gBAAgB,CAACE,KAAK,GAAGI,CAAC,CAACL,MAAM;MACnC;IACF,CAAC;IACDM,MAAM,EAAGD,CAAC,IAAK;MACb,SAAS;;MAETH,QAAQ,CAACD,KAAK,GAAGI,CAAC,CAACH,QAAQ;MAC3BF,MAAM,CAACC,KAAK,GAAGI,CAAC,CAACL,MAAM;IACzB,CAAC;IACDO,KAAK,EAAGF,CAAC,IAAK;MACZ,SAAS;;MACV,IAAGT,QAAQ,CAACY,EAAE,KAAe,SAAS,EAAC;QACtCT,gBAAgB,CAACE,KAAK,GAAGI,CAAC,CAACL,MAAM;MAClC;MAECG,QAAQ,CAACF,KAAK,GAAGI,CAAC,CAACL,MAAM,KAAK,CAAC;;MAE/B;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA,IAAIK,CAAC,CAACI,QAAQ,KAAK,CAAC,EAAE;QACpBP,QAAQ,CAACD,KAAK,GAAGI,CAAC,CAACH,QAAQ;QAC3BF,MAAM,CAACC,KAAK,GAAGI,CAAC,CAACL,MAAM;MACzB;IACF;EACF,CAAC,EACD,EACF,CAAC;EAED,OAAO;IAAEA,MAAM;IAAEE,QAAQ;IAAEH,gBAAgB;IAAEI;EAAS,CAAC;AACzD,CAAC","ignoreList":[]}
@@ -0,0 +1,95 @@
1
+ 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); }
2
+ import React, { forwardRef, useCallback, useMemo } from "react";
3
+ import { View } from "react-native";
4
+ import Reanimated, { interpolate, runOnUI, useAnimatedStyle, useDerivedValue, useSharedValue } from "react-native-reanimated";
5
+ import { useWindowDimensions } from "../../hooks";
6
+ import { useKeyboardAnimation } from "./hooks";
7
+ const defaultLayout = {
8
+ x: 0,
9
+ y: 0,
10
+ width: 0,
11
+ height: 0
12
+ };
13
+
14
+ /**
15
+ * View that moves out of the way when the keyboard appears by automatically
16
+ * adjusting its height, position, or bottom padding.
17
+ */
18
+ const KeyboardAvoidingView = /*#__PURE__*/forwardRef(({
19
+ behavior,
20
+ children,
21
+ contentContainerStyle,
22
+ enabled = true,
23
+ keyboardVerticalOffset = 0,
24
+ style,
25
+ onLayout: onLayoutProps,
26
+ ...props
27
+ }, ref) => {
28
+ const initialFrame = useSharedValue(null);
29
+ const frame = useDerivedValue(() => initialFrame.value || defaultLayout);
30
+ const keyboard = useKeyboardAnimation();
31
+ const {
32
+ height: screenHeight
33
+ } = useWindowDimensions();
34
+ const relativeKeyboardHeight = useCallback(() => {
35
+ "worklet";
36
+
37
+ const keyboardY = screenHeight - keyboard.heightWhenOpened.value - keyboardVerticalOffset;
38
+ return Math.max(frame.value.y + frame.value.height - keyboardY, 0);
39
+ }, [screenHeight, keyboardVerticalOffset]);
40
+ const onLayoutWorklet = useCallback(layout => {
41
+ "worklet";
42
+
43
+ if (keyboard.isClosed.value || initialFrame.value === null) {
44
+ // eslint-disable-next-line react-compiler/react-compiler
45
+ initialFrame.value = layout;
46
+ }
47
+ }, []);
48
+ const onLayout = useCallback(e => {
49
+ runOnUI(onLayoutWorklet)(e.nativeEvent.layout);
50
+ onLayoutProps === null || onLayoutProps === void 0 || onLayoutProps(e);
51
+ }, [onLayoutProps]);
52
+ const animatedStyle = useAnimatedStyle(() => {
53
+ const bottom = interpolate(keyboard.progress.value, [0, 1], [0, relativeKeyboardHeight()]);
54
+ const bottomHeight = enabled ? bottom : 0;
55
+ switch (behavior) {
56
+ case "height":
57
+ if (!keyboard.isClosed.value) {
58
+ return {
59
+ height: frame.value.height - bottomHeight,
60
+ flex: 0
61
+ };
62
+ }
63
+ return {};
64
+ case "position":
65
+ return {
66
+ bottom: bottomHeight
67
+ };
68
+ case "padding":
69
+ return {
70
+ paddingBottom: bottomHeight
71
+ };
72
+ default:
73
+ return {};
74
+ }
75
+ }, [behavior, enabled, relativeKeyboardHeight]);
76
+ const isPositionBehavior = behavior === "position";
77
+ const containerStyle = isPositionBehavior ? contentContainerStyle : style;
78
+ const combinedStyles = useMemo(() => [containerStyle, animatedStyle], [containerStyle, animatedStyle]);
79
+ if (isPositionBehavior) {
80
+ return /*#__PURE__*/React.createElement(View, _extends({
81
+ ref: ref,
82
+ style: style,
83
+ onLayout: onLayout
84
+ }, props), /*#__PURE__*/React.createElement(Reanimated.View, {
85
+ style: combinedStyles
86
+ }, children));
87
+ }
88
+ return /*#__PURE__*/React.createElement(Reanimated.View, _extends({
89
+ ref: ref,
90
+ onLayout: onLayout,
91
+ style: combinedStyles
92
+ }, props), children);
93
+ });
94
+ export default KeyboardAvoidingView;
95
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","forwardRef","useCallback","useMemo","View","Reanimated","interpolate","runOnUI","useAnimatedStyle","useDerivedValue","useSharedValue","useWindowDimensions","useKeyboardAnimation","defaultLayout","x","y","width","height","KeyboardAvoidingView","behavior","children","contentContainerStyle","enabled","keyboardVerticalOffset","style","onLayout","onLayoutProps","props","ref","initialFrame","frame","value","keyboard","screenHeight","relativeKeyboardHeight","keyboardY","heightWhenOpened","Math","max","onLayoutWorklet","layout","isClosed","e","nativeEvent","animatedStyle","bottom","progress","bottomHeight","flex","paddingBottom","isPositionBehavior","containerStyle","combinedStyles","createElement","_extends"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo } from \"react\";\r\nimport { View } from \"react-native\";\r\nimport Reanimated, {\r\n interpolate,\r\n runOnUI,\r\n useAnimatedStyle,\r\n useDerivedValue,\r\n useSharedValue,\r\n} from \"react-native-reanimated\";\r\n\r\nimport { useWindowDimensions } from \"../../hooks\";\r\n\r\nimport { useKeyboardAnimation } from \"./hooks\";\r\n\r\nimport type { LayoutRectangle, ViewProps } from \"react-native\";\r\n\r\nexport type KeyboardAvoidingViewProps = {\r\n /**\r\n * Specify how to react to the presence of the keyboard.\r\n */\r\n behavior?: \"height\" | \"position\" | \"padding\";\r\n\r\n /**\r\n * Style of the content container when `behavior` is 'position'.\r\n */\r\n contentContainerStyle?: ViewProps[\"style\"];\r\n\r\n /**\r\n * Controls whether this `KeyboardAvoidingView` instance should take effect.\r\n * This is useful when more than one is on the screen. Defaults to true.\r\n */\r\n enabled?: boolean;\r\n\r\n /**\r\n * Distance between the top of the user screen and the React Native view. This\r\n * may be non-zero in some cases. Defaults to 0.\r\n */\r\n keyboardVerticalOffset?: number;\r\n} & ViewProps;\r\n\r\nconst defaultLayout: LayoutRectangle = {\r\n x: 0,\r\n y: 0,\r\n width: 0,\r\n height: 0,\r\n};\r\n\r\n/**\r\n * View that moves out of the way when the keyboard appears by automatically\r\n * adjusting its height, position, or bottom padding.\r\n */\r\nconst KeyboardAvoidingView = forwardRef<\r\n View,\r\n React.PropsWithChildren<KeyboardAvoidingViewProps>\r\n>(\r\n (\r\n {\r\n behavior,\r\n children,\r\n contentContainerStyle,\r\n enabled = true,\r\n keyboardVerticalOffset = 0,\r\n style,\r\n onLayout: onLayoutProps,\r\n ...props\r\n },\r\n ref,\r\n ) => {\r\n const initialFrame = useSharedValue<LayoutRectangle | null>(null);\r\n const frame = useDerivedValue(() => initialFrame.value || defaultLayout);\r\n\r\n const keyboard = useKeyboardAnimation();\r\n const { height: screenHeight } = useWindowDimensions();\r\n\r\n const relativeKeyboardHeight = useCallback(() => {\r\n \"worklet\";\r\n\r\n const keyboardY =\r\n screenHeight - keyboard.heightWhenOpened.value - keyboardVerticalOffset;\r\n\r\n return Math.max(frame.value.y + frame.value.height - keyboardY, 0);\r\n }, [screenHeight, keyboardVerticalOffset]);\r\n\r\n const onLayoutWorklet = useCallback((layout: LayoutRectangle) => {\r\n \"worklet\";\r\n\r\n if (keyboard.isClosed.value || initialFrame.value === null) {\r\n // eslint-disable-next-line react-compiler/react-compiler\r\n initialFrame.value = layout;\r\n }\r\n }, []);\r\n const onLayout = useCallback<NonNullable<ViewProps[\"onLayout\"]>>(\r\n (e) => {\r\n runOnUI(onLayoutWorklet)(e.nativeEvent.layout);\r\n onLayoutProps?.(e);\r\n },\r\n [onLayoutProps],\r\n );\r\n\r\n const animatedStyle = useAnimatedStyle(() => {\r\n const bottom = interpolate(\r\n keyboard.progress.value,\r\n [0, 1],\r\n [0, relativeKeyboardHeight()],\r\n );\r\n const bottomHeight = enabled ? bottom : 0;\r\n\r\n switch (behavior) {\r\n case \"height\":\r\n if (!keyboard.isClosed.value) {\r\n return {\r\n height: frame.value.height - bottomHeight,\r\n flex: 0,\r\n };\r\n }\r\n\r\n return {};\r\n\r\n case \"position\":\r\n return { bottom: bottomHeight };\r\n\r\n case \"padding\":\r\n return { paddingBottom: bottomHeight };\r\n default:\r\n return {};\r\n }\r\n }, [behavior, enabled, relativeKeyboardHeight]);\r\n const isPositionBehavior = behavior === \"position\";\r\n const containerStyle = isPositionBehavior ? contentContainerStyle : style;\r\n const combinedStyles = useMemo(\r\n () => [containerStyle, animatedStyle],\r\n [containerStyle, animatedStyle],\r\n );\r\n\r\n if (isPositionBehavior) {\r\n return (\r\n <View ref={ref} style={style} onLayout={onLayout} {...props}>\r\n <Reanimated.View style={combinedStyles}>{children}</Reanimated.View>\r\n </View>\r\n );\r\n }\r\n\r\n return (\r\n <Reanimated.View\r\n ref={ref}\r\n onLayout={onLayout}\r\n style={combinedStyles}\r\n {...props}\r\n >\r\n {children}\r\n </Reanimated.View>\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EACF,CAAC,EAAE,CAAC5B,QAAQ,EAAEG,OAAO,EAAEY,sBAAsB,CAAC,CAAC;EAC/C,MAAMgB,kBAAkB,GAAG/B,QAAQ,KAAK,UAAU;EAClD,MAAMgC,cAAc,GAAGD,kBAAkB,GAAG7B,qBAAqB,GAAGG,KAAK;EACzE,MAAM4B,cAAc,GAAGjD,OAAO,CAC5B,MAAM,CAACgD,cAAc,EAAEP,aAAa,CAAC,EACrC,CAACO,cAAc,EAAEP,aAAa,CAChC,CAAC;EAED,IAAIM,kBAAkB,EAAE;IACtB,oBACElD,KAAA,CAAAqD,aAAA,CAACjD,IAAI,EAAAkD,QAAA;MAAC1B,GAAG,EAAEA,GAAI;MAACJ,KAAK,EAAEA,KAAM;MAACC,QAAQ,EAAEA;IAAS,GAAKE,KAAK,gBACzD3B,KAAA,CAAAqD,aAAA,CAAChD,UAAU,CAACD,IAAI;MAACoB,KAAK,EAAE4B;IAAe,GAAEhC,QAA0B,CAC/D,CAAC;EAEX;EAEA,oBACEpB,KAAA,CAAAqD,aAAA,CAAChD,UAAU,CAACD,IAAI,EAAAkD,QAAA;IACd1B,GAAG,EAAEA,GAAI;IACTH,QAAQ,EAAEA,QAAS;IACnBD,KAAK,EAAE4B;EAAe,GAClBzB,KAAK,GAERP,QACc,CAAC;AAEtB,CACF,CAAC;AAED,eAAeF,oBAAoB","ignoreList":[]}
@@ -0,0 +1,248 @@
1
+ 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); }
2
+ import React, { forwardRef, useCallback, useMemo } from "react";
3
+ import { findNodeHandle } from "react-native";
4
+ import Reanimated, { interpolate, scrollTo, useAnimatedReaction, useAnimatedRef, useAnimatedStyle, useScrollViewOffset, useSharedValue } from "react-native-reanimated";
5
+ import { useFocusedInputHandler, useReanimatedFocusedInput, useWindowDimensions } from "../../hooks";
6
+ import { useSmoothKeyboardHandler } from "./useSmoothKeyboardHandler";
7
+ import { debounce, scrollDistanceWithRespectToSnapPoints } from "./utils";
8
+ /*
9
+ * Everything begins from `onStart` handler. This handler is called every time,
10
+ * when keyboard changes its size or when focused `TextInput` was changed. In
11
+ * this handler we are calculating/memoizing values which later will be used
12
+ * during layout movement. For that we calculate:
13
+ * - layout of focused field (`layout`) - to understand whether there will be overlap
14
+ * - initial keyboard size (`initialKeyboardSize`) - used in scroll interpolation
15
+ * - future keyboard height (`keyboardHeight`) - used in scroll interpolation
16
+ * - current scroll position (`scrollPosition`) - used to scroll from this point
17
+ *
18
+ * Once we've calculated all necessary variables - we can actually start to use them.
19
+ * It happens in `onMove` handler - this function simply calls `maybeScroll` with
20
+ * current keyboard frame height. This functions makes the smooth transition.
21
+ *
22
+ * When the transition has finished we go to `onEnd` handler. In this handler
23
+ * we verify, that the current field is not overlapped within a keyboard frame.
24
+ * For full `onStart`/`onMove`/`onEnd` flow it may look like a redundant thing,
25
+ * however there could be some cases, when `onMove` is not called:
26
+ * - on iOS when TextInput was changed - keyboard transition is instant
27
+ * - on Android when TextInput was changed and keyboard size wasn't changed
28
+ * So `onEnd` handler handle the case, when `onMove` wasn't triggered.
29
+ *
30
+ * ====================================================================================================================+
31
+ * -----------------------------------------------------Flow chart-----------------------------------------------------+
32
+ * ====================================================================================================================+
33
+ *
34
+ * +============================+ +============================+ +==================================+
35
+ * + User Press on TextInput + => + Keyboard starts showing + => + As keyboard moves frame by frame + =>
36
+ * + + + (run `onStart`) + + `onMove` is getting called +
37
+ * +============================+ +============================+ +==================================+
38
+ *
39
+ *
40
+ * +============================+ +============================+ +=====================================+
41
+ * + Keyboard is shown and we + => + User moved focus to + => + Only `onStart`/`onEnd` maybe called +
42
+ * + call `onEnd` handler + + another `TextInput` + + (without involving `onMove`) +
43
+ * +============================+ +============================+ +=====================================+
44
+ *
45
+ */
46
+ const KeyboardAwareScrollView = /*#__PURE__*/forwardRef(({
47
+ children,
48
+ onLayout,
49
+ bottomOffset = 0,
50
+ disableScrollOnKeyboardHide = false,
51
+ enabled = true,
52
+ extraKeyboardSpace = 0,
53
+ ...rest
54
+ }, ref) => {
55
+ const scrollViewAnimatedRef = useAnimatedRef();
56
+ const scrollViewTarget = useSharedValue(null);
57
+ const scrollPosition = useSharedValue(0);
58
+ const position = useScrollViewOffset(scrollViewAnimatedRef);
59
+ const currentKeyboardFrameHeight = useSharedValue(0);
60
+ const keyboardHeight = useSharedValue(0);
61
+ const keyboardWillAppear = useSharedValue(false);
62
+ const tag = useSharedValue(-1);
63
+ const initialKeyboardSize = useSharedValue(0);
64
+ const scrollBeforeKeyboardMovement = useSharedValue(0);
65
+ const {
66
+ input
67
+ } = useReanimatedFocusedInput();
68
+ const layout = useSharedValue(null);
69
+ const {
70
+ height
71
+ } = useWindowDimensions();
72
+ const onRef = useCallback(assignedRef => {
73
+ if (typeof ref === "function") {
74
+ ref(assignedRef);
75
+ } else if (ref) {
76
+ ref.current = assignedRef;
77
+ }
78
+ scrollViewAnimatedRef(assignedRef);
79
+ }, []);
80
+ const onScrollViewLayout = useCallback(e => {
81
+ scrollViewTarget.value = findNodeHandle(scrollViewAnimatedRef.current);
82
+ onLayout === null || onLayout === void 0 || onLayout(e);
83
+ }, [onLayout]);
84
+
85
+ /**
86
+ * Function that will scroll a ScrollView as keyboard gets moving
87
+ */
88
+ const maybeScroll = useCallback((e, animated = false) => {
89
+ "worklet";
90
+
91
+ var _layout$value, _layout$value2, _layout$value3;
92
+ if (!enabled) {
93
+ return 0;
94
+ }
95
+
96
+ // input belongs to ScrollView
97
+ if (((_layout$value = layout.value) === null || _layout$value === void 0 ? void 0 : _layout$value.parentScrollViewTarget) !== scrollViewTarget.value) {
98
+ return 0;
99
+ }
100
+ const visibleRect = height - keyboardHeight.value;
101
+ const absoluteY = ((_layout$value2 = layout.value) === null || _layout$value2 === void 0 ? void 0 : _layout$value2.layout.absoluteY) || 0;
102
+ const inputHeight = ((_layout$value3 = layout.value) === null || _layout$value3 === void 0 ? void 0 : _layout$value3.layout.height) || 0;
103
+ const point = absoluteY + inputHeight;
104
+ if (visibleRect - point <= bottomOffset) {
105
+ const relativeScrollTo = keyboardHeight.value - (height - point) + bottomOffset;
106
+ const interpolatedScrollTo = interpolate(e, [initialKeyboardSize.value, keyboardHeight.value], [0, scrollDistanceWithRespectToSnapPoints(relativeScrollTo + scrollPosition.value, rest.snapToOffsets) - scrollPosition.value]);
107
+ const targetScrollY = Math.max(interpolatedScrollTo, 0) + scrollPosition.value;
108
+ scrollTo(scrollViewAnimatedRef, 0, targetScrollY, animated);
109
+ return interpolatedScrollTo;
110
+ }
111
+ if (absoluteY < 0) {
112
+ const positionOnScreen = visibleRect - inputHeight - bottomOffset;
113
+ const topOfScreen = scrollPosition.value + absoluteY;
114
+ scrollTo(scrollViewAnimatedRef, 0, topOfScreen - positionOnScreen, animated);
115
+ }
116
+ return 0;
117
+ }, [bottomOffset, enabled, height, rest.snapToOffsets]);
118
+ const scrollFromCurrentPosition = useCallback(customHeight => {
119
+ "worklet";
120
+
121
+ var _input$value;
122
+ const prevScrollPosition = scrollPosition.value;
123
+ const prevLayout = layout.value;
124
+ if (!((_input$value = input.value) !== null && _input$value !== void 0 && _input$value.layout)) {
125
+ return;
126
+ }
127
+
128
+ // eslint-disable-next-line react-compiler/react-compiler
129
+ layout.value = {
130
+ ...input.value,
131
+ layout: {
132
+ ...input.value.layout,
133
+ height: customHeight ?? input.value.layout.height
134
+ }
135
+ };
136
+ scrollPosition.value = position.value;
137
+ maybeScroll(keyboardHeight.value, true);
138
+ scrollPosition.value = prevScrollPosition;
139
+ layout.value = prevLayout;
140
+ }, [maybeScroll]);
141
+ const onChangeText = useCallback(() => {
142
+ "worklet";
143
+
144
+ // if typing a text caused layout shift, then we need to ignore this handler
145
+ // because this event will be handled in `useAnimatedReaction` below
146
+ var _layout$value4, _input$value2;
147
+ if (((_layout$value4 = layout.value) === null || _layout$value4 === void 0 ? void 0 : _layout$value4.layout.height) !== ((_input$value2 = input.value) === null || _input$value2 === void 0 ? void 0 : _input$value2.layout.height)) {
148
+ return;
149
+ }
150
+ scrollFromCurrentPosition();
151
+ }, [scrollFromCurrentPosition]);
152
+ const onSelectionChange = useCallback(e => {
153
+ "worklet";
154
+
155
+ if (e.selection.start.position !== e.selection.end.position) {
156
+ scrollFromCurrentPosition(e.selection.end.y);
157
+ }
158
+ }, [scrollFromCurrentPosition]);
159
+ const onChangeTextHandler = useMemo(() => debounce(onChangeText, 200), [onChangeText]);
160
+ useFocusedInputHandler({
161
+ onChangeText: onChangeTextHandler,
162
+ onSelectionChange: onSelectionChange
163
+ }, [onChangeTextHandler, onSelectionChange]);
164
+ useSmoothKeyboardHandler({
165
+ onStart: e => {
166
+ "worklet";
167
+
168
+ const keyboardWillChangeSize = keyboardHeight.value !== e.height && e.height > 0;
169
+ keyboardWillAppear.value = e.height > 0 && keyboardHeight.value === 0;
170
+ const keyboardWillHide = e.height === 0;
171
+ const focusWasChanged = tag.value !== e.target && e.target !== -1 || keyboardWillChangeSize;
172
+ if (keyboardWillChangeSize) {
173
+ initialKeyboardSize.value = keyboardHeight.value;
174
+ }
175
+ if (keyboardWillHide) {
176
+ // on back transition need to interpolate as [0, keyboardHeight]
177
+ initialKeyboardSize.value = 0;
178
+ scrollPosition.value = scrollBeforeKeyboardMovement.value;
179
+ }
180
+ if (keyboardWillAppear.value || keyboardWillChangeSize || focusWasChanged) {
181
+ // persist scroll value
182
+ scrollPosition.value = position.value;
183
+ // just persist height - later will be used in interpolation
184
+ keyboardHeight.value = e.height;
185
+ }
186
+
187
+ // focus was changed
188
+ if (focusWasChanged) {
189
+ tag.value = e.target;
190
+
191
+ // save position of focused text input when keyboard starts to move
192
+ layout.value = input.value;
193
+ // save current scroll position - when keyboard will hide we'll reuse
194
+ // this value to achieve smooth hide effect
195
+ scrollBeforeKeyboardMovement.value = position.value;
196
+ }
197
+ if (focusWasChanged && !keyboardWillAppear.value) {
198
+ // update position on scroll value, so `onEnd` handler
199
+ // will pick up correct values
200
+ position.value += maybeScroll(e.height, true);
201
+ }
202
+ },
203
+ onMove: e => {
204
+ "worklet";
205
+
206
+ const keyboardFrame = interpolate(e.height, [0, keyboardHeight.value], [0, keyboardHeight.value + extraKeyboardSpace]);
207
+ currentKeyboardFrameHeight.value = keyboardFrame;
208
+
209
+ // if the user has set disableScrollOnKeyboardHide, only auto-scroll when the keyboard opens
210
+ if (!disableScrollOnKeyboardHide || keyboardWillAppear.value) {
211
+ maybeScroll(e.height);
212
+ }
213
+ },
214
+ onEnd: e => {
215
+ "worklet";
216
+
217
+ keyboardHeight.value = e.height;
218
+ scrollPosition.value = position.value;
219
+ }
220
+ }, [maybeScroll, disableScrollOnKeyboardHide, extraKeyboardSpace]);
221
+ useAnimatedReaction(() => input.value, (current, previous) => {
222
+ if ((current === null || current === void 0 ? void 0 : current.target) === (previous === null || previous === void 0 ? void 0 : previous.target) && (current === null || current === void 0 ? void 0 : current.layout.height) !== (previous === null || previous === void 0 ? void 0 : previous.layout.height)) {
223
+ const prevLayout = layout.value;
224
+ layout.value = input.value;
225
+ scrollPosition.value += maybeScroll(keyboardHeight.value, true);
226
+ layout.value = prevLayout;
227
+ }
228
+ }, []);
229
+ const view = useAnimatedStyle(() => enabled ? {
230
+ // animations become choppy when scrolling to the end of the `ScrollView` (when the last input is focused)
231
+ // this happens because the layout recalculates on every frame. To avoid this we slightly increase padding
232
+ // by `+1`. In this way we assure, that `scrollTo` will never scroll to the end, because it uses interpolation
233
+ // from 0 to `keyboardHeight`, and here our padding is `keyboardHeight + 1`. It allows us not to re-run layout
234
+ // re-calculation on every animation frame and it helps to achieve smooth animation.
235
+ // see: https://github.com/kirillzyusko/react-native-keyboard-controller/pull/342
236
+ paddingBottom: currentKeyboardFrameHeight.value + 1
237
+ } : {}, [enabled]);
238
+ return /*#__PURE__*/React.createElement(Reanimated.ScrollView, _extends({
239
+ ref: onRef
240
+ }, rest, {
241
+ onLayout: onScrollViewLayout,
242
+ scrollEventThrottle: 16
243
+ }), children, /*#__PURE__*/React.createElement(Reanimated.View, {
244
+ style: view
245
+ }));
246
+ });
247
+ export default KeyboardAwareScrollView;
248
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","forwardRef","useCallback","useMemo","findNodeHandle","Reanimated","interpolate","scrollTo","useAnimatedReaction","useAnimatedRef","useAnimatedStyle","useScrollViewOffset","useSharedValue","useFocusedInputHandler","useReanimatedFocusedInput","useWindowDimensions","useSmoothKeyboardHandler","debounce","scrollDistanceWithRespectToSnapPoints","KeyboardAwareScrollView","children","onLayout","bottomOffset","disableScrollOnKeyboardHide","enabled","extraKeyboardSpace","rest","ref","scrollViewAnimatedRef","scrollViewTarget","scrollPosition","position","currentKeyboardFrameHeight","keyboardHeight","keyboardWillAppear","tag","initialKeyboardSize","scrollBeforeKeyboardMovement","input","layout","height","onRef","assignedRef","current","onScrollViewLayout","e","value","maybeScroll","animated","_layout$value","_layout$value2","_layout$value3","parentScrollViewTarget","visibleRect","absoluteY","inputHeight","point","relativeScrollTo","interpolatedScrollTo","snapToOffsets","targetScrollY","Math","max","positionOnScreen","topOfScreen","scrollFromCurrentPosition","customHeight","_input$value","prevScrollPosition","prevLayout","onChangeText","_layout$value4","_input$value2","onSelectionChange","selection","start","end","y","onChangeTextHandler","onStart","keyboardWillChangeSize","keyboardWillHide","focusWasChanged","target","onMove","keyboardFrame","onEnd","previous","view","paddingBottom","createElement","ScrollView","_extends","scrollEventThrottle","View","style"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo } from \"react\";\r\nimport { findNodeHandle } from \"react-native\";\r\nimport Reanimated, {\r\n interpolate,\r\n scrollTo,\r\n useAnimatedReaction,\r\n useAnimatedRef,\r\n useAnimatedStyle,\r\n useScrollViewOffset,\r\n useSharedValue,\r\n} from \"react-native-reanimated\";\r\n\r\nimport {\r\n useFocusedInputHandler,\r\n useReanimatedFocusedInput,\r\n useWindowDimensions,\r\n} from \"../../hooks\";\r\n\r\nimport { useSmoothKeyboardHandler } from \"./useSmoothKeyboardHandler\";\r\nimport { debounce, scrollDistanceWithRespectToSnapPoints } from \"./utils\";\r\n\r\nimport type {\r\n LayoutChangeEvent,\r\n ScrollView,\r\n ScrollViewProps,\r\n} from \"react-native\";\r\nimport type {\r\n FocusedInputLayoutChangedEvent,\r\n FocusedInputSelectionChangedEvent,\r\n} from \"..//../types\";\r\n\r\nexport type KeyboardAwareScrollViewProps = {\r\n /** The distance between keyboard and focused `TextInput` when keyboard is shown. Default is `0`. */\r\n bottomOffset?: number;\r\n /** Prevents automatic scrolling of the `ScrollView` when the keyboard gets hidden, maintaining the current screen position. Default is `false`. */\r\n disableScrollOnKeyboardHide?: boolean;\r\n /** Controls whether this `KeyboardAwareScrollView` instance should take effect. Default is `true` */\r\n enabled?: boolean;\r\n /** Adjusting the bottom spacing of KeyboardAwareScrollView. Default is `0` */\r\n extraKeyboardSpace?: number;\r\n} & ScrollViewProps;\r\n\r\n/*\r\n * Everything begins from `onStart` handler. This handler is called every time,\r\n * when keyboard changes its size or when focused `TextInput` was changed. In\r\n * this handler we are calculating/memoizing values which later will be used\r\n * during layout movement. For that we calculate:\r\n * - layout of focused field (`layout`) - to understand whether there will be overlap\r\n * - initial keyboard size (`initialKeyboardSize`) - used in scroll interpolation\r\n * - future keyboard height (`keyboardHeight`) - used in scroll interpolation\r\n * - current scroll position (`scrollPosition`) - used to scroll from this point\r\n *\r\n * Once we've calculated all necessary variables - we can actually start to use them.\r\n * It happens in `onMove` handler - this function simply calls `maybeScroll` with\r\n * current keyboard frame height. This functions makes the smooth transition.\r\n *\r\n * When the transition has finished we go to `onEnd` handler. In this handler\r\n * we verify, that the current field is not overlapped within a keyboard frame.\r\n * For full `onStart`/`onMove`/`onEnd` flow it may look like a redundant thing,\r\n * however there could be some cases, when `onMove` is not called:\r\n * - on iOS when TextInput was changed - keyboard transition is instant\r\n * - on Android when TextInput was changed and keyboard size wasn't changed\r\n * So `onEnd` handler handle the case, when `onMove` wasn't triggered.\r\n *\r\n * ====================================================================================================================+\r\n * -----------------------------------------------------Flow chart-----------------------------------------------------+\r\n * ====================================================================================================================+\r\n *\r\n * +============================+ +============================+ +==================================+\r\n * + User Press on TextInput + => + Keyboard starts showing + => + As keyboard moves frame by frame + =>\r\n * + + + (run `onStart`) + + `onMove` is getting called +\r\n * +============================+ +============================+ +==================================+\r\n *\r\n *\r\n * +============================+ +============================+ +=====================================+\r\n * + Keyboard is shown and we + => + User moved focus to + => + Only `onStart`/`onEnd` maybe called +\r\n * + call `onEnd` handler + + another `TextInput` + + (without involving `onMove`) +\r\n * +============================+ +============================+ +=====================================+\r\n *\r\n */\r\nconst KeyboardAwareScrollView = forwardRef<\r\n ScrollView,\r\n React.PropsWithChildren<KeyboardAwareScrollViewProps>\r\n>(\r\n (\r\n {\r\n children,\r\n onLayout,\r\n bottomOffset = 0,\r\n disableScrollOnKeyboardHide = false,\r\n enabled = true,\r\n extraKeyboardSpace = 0,\r\n ...rest\r\n },\r\n ref,\r\n ) => {\r\n const scrollViewAnimatedRef = useAnimatedRef<Reanimated.ScrollView>();\r\n const scrollViewTarget = useSharedValue<number | null>(null);\r\n const scrollPosition = useSharedValue(0);\r\n const position = useScrollViewOffset(scrollViewAnimatedRef);\r\n const currentKeyboardFrameHeight = useSharedValue(0);\r\n const keyboardHeight = useSharedValue(0);\r\n const keyboardWillAppear = useSharedValue(false);\r\n const tag = useSharedValue(-1);\r\n const initialKeyboardSize = useSharedValue(0);\r\n const scrollBeforeKeyboardMovement = useSharedValue(0);\r\n const { input } = useReanimatedFocusedInput();\r\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\r\n\r\n const { height } = useWindowDimensions();\r\n\r\n const onRef = useCallback((assignedRef: Reanimated.ScrollView) => {\r\n if (typeof ref === \"function\") {\r\n ref(assignedRef);\r\n } else if (ref) {\r\n ref.current = assignedRef;\r\n }\r\n\r\n scrollViewAnimatedRef(assignedRef);\r\n }, []);\r\n const onScrollViewLayout = useCallback(\r\n (e: LayoutChangeEvent) => {\r\n scrollViewTarget.value = findNodeHandle(scrollViewAnimatedRef.current);\r\n\r\n onLayout?.(e);\r\n },\r\n [onLayout],\r\n );\r\n\r\n /**\r\n * Function that will scroll a ScrollView as keyboard gets moving\r\n */\r\n const maybeScroll = useCallback(\r\n (e: number, animated: boolean = false) => {\r\n \"worklet\";\r\n\r\n if (!enabled) {\r\n return 0;\r\n }\r\n\r\n // input belongs to ScrollView\r\n if (layout.value?.parentScrollViewTarget !== scrollViewTarget.value) {\r\n return 0;\r\n }\r\n\r\n const visibleRect = height - keyboardHeight.value;\r\n const absoluteY = layout.value?.layout.absoluteY || 0;\r\n const inputHeight = layout.value?.layout.height || 0;\r\n const point = absoluteY + inputHeight;\r\n\r\n if (visibleRect - point <= bottomOffset) {\r\n const relativeScrollTo =\r\n keyboardHeight.value - (height - point) + bottomOffset;\r\n const interpolatedScrollTo = interpolate(\r\n e,\r\n [initialKeyboardSize.value, keyboardHeight.value],\r\n [\r\n 0,\r\n scrollDistanceWithRespectToSnapPoints(\r\n relativeScrollTo + scrollPosition.value,\r\n rest.snapToOffsets,\r\n ) - scrollPosition.value,\r\n ],\r\n );\r\n const targetScrollY =\r\n Math.max(interpolatedScrollTo, 0) + scrollPosition.value;\r\n scrollTo(scrollViewAnimatedRef, 0, targetScrollY, animated);\r\n\r\n return interpolatedScrollTo;\r\n }\r\n\r\n if (absoluteY < 0) {\r\n const positionOnScreen = visibleRect - inputHeight - bottomOffset;\r\n const topOfScreen = scrollPosition.value + absoluteY;\r\n\r\n scrollTo(\r\n scrollViewAnimatedRef,\r\n 0,\r\n topOfScreen - positionOnScreen,\r\n animated,\r\n );\r\n }\r\n\r\n return 0;\r\n },\r\n [bottomOffset, enabled, height, rest.snapToOffsets],\r\n );\r\n\r\n const scrollFromCurrentPosition = useCallback(\r\n (customHeight?: number) => {\r\n \"worklet\";\r\n\r\n const prevScrollPosition = scrollPosition.value;\r\n const prevLayout = layout.value;\r\n\r\n if (!input.value?.layout) {\r\n return;\r\n }\r\n\r\n // eslint-disable-next-line react-compiler/react-compiler\r\n layout.value = {\r\n ...input.value,\r\n layout: {\r\n ...input.value.layout,\r\n height: customHeight ?? input.value.layout.height,\r\n },\r\n };\r\n scrollPosition.value = position.value;\r\n maybeScroll(keyboardHeight.value, true);\r\n scrollPosition.value = prevScrollPosition;\r\n layout.value = prevLayout;\r\n },\r\n [maybeScroll],\r\n );\r\n const onChangeText = useCallback(() => {\r\n \"worklet\";\r\n\r\n // if typing a text caused layout shift, then we need to ignore this handler\r\n // because this event will be handled in `useAnimatedReaction` below\r\n if (layout.value?.layout.height !== input.value?.layout.height) {\r\n return;\r\n }\r\n\r\n scrollFromCurrentPosition();\r\n }, [scrollFromCurrentPosition]);\r\n const onSelectionChange = useCallback(\r\n (e: FocusedInputSelectionChangedEvent) => {\r\n \"worklet\";\r\n\r\n if (e.selection.start.position !== e.selection.end.position) {\r\n scrollFromCurrentPosition(e.selection.end.y);\r\n }\r\n },\r\n [scrollFromCurrentPosition],\r\n );\r\n\r\n const onChangeTextHandler = useMemo(\r\n () => debounce(onChangeText, 200),\r\n [onChangeText],\r\n );\r\n\r\n useFocusedInputHandler(\r\n {\r\n onChangeText: onChangeTextHandler,\r\n onSelectionChange: onSelectionChange,\r\n },\r\n [onChangeTextHandler, onSelectionChange],\r\n );\r\n\r\n useSmoothKeyboardHandler(\r\n {\r\n onStart: (e) => {\r\n \"worklet\";\r\n\r\n const keyboardWillChangeSize =\r\n keyboardHeight.value !== e.height && e.height > 0;\r\n keyboardWillAppear.value = e.height > 0 && keyboardHeight.value === 0;\r\n const keyboardWillHide = e.height === 0;\r\n const focusWasChanged =\r\n (tag.value !== e.target && e.target !== -1) ||\r\n keyboardWillChangeSize;\r\n\r\n if (keyboardWillChangeSize) {\r\n initialKeyboardSize.value = keyboardHeight.value;\r\n }\r\n\r\n if (keyboardWillHide) {\r\n // on back transition need to interpolate as [0, keyboardHeight]\r\n initialKeyboardSize.value = 0;\r\n scrollPosition.value = scrollBeforeKeyboardMovement.value;\r\n }\r\n\r\n if (\r\n keyboardWillAppear.value ||\r\n keyboardWillChangeSize ||\r\n focusWasChanged\r\n ) {\r\n // persist scroll value\r\n scrollPosition.value = position.value;\r\n // just persist height - later will be used in interpolation\r\n keyboardHeight.value = e.height;\r\n }\r\n\r\n // focus was changed\r\n if (focusWasChanged) {\r\n tag.value = e.target;\r\n\r\n // save position of focused text input when keyboard starts to move\r\n layout.value = input.value;\r\n // save current scroll position - when keyboard will hide we'll reuse\r\n // this value to achieve smooth hide effect\r\n scrollBeforeKeyboardMovement.value = position.value;\r\n }\r\n\r\n if (focusWasChanged && !keyboardWillAppear.value) {\r\n // update position on scroll value, so `onEnd` handler\r\n // will pick up correct values\r\n position.value += maybeScroll(e.height, true);\r\n }\r\n },\r\n onMove: (e) => {\r\n \"worklet\";\r\n\r\n const keyboardFrame = interpolate(\r\n e.height,\r\n [0, keyboardHeight.value],\r\n [0, keyboardHeight.value + extraKeyboardSpace],\r\n );\r\n currentKeyboardFrameHeight.value = keyboardFrame;\r\n\r\n // if the user has set disableScrollOnKeyboardHide, only auto-scroll when the keyboard opens\r\n if (!disableScrollOnKeyboardHide || keyboardWillAppear.value) {\r\n maybeScroll(e.height);\r\n }\r\n },\r\n onEnd: (e) => {\r\n \"worklet\";\r\n\r\n keyboardHeight.value = e.height;\r\n scrollPosition.value = position.value;\r\n },\r\n },\r\n [maybeScroll, disableScrollOnKeyboardHide, extraKeyboardSpace],\r\n );\r\n\r\n useAnimatedReaction(\r\n () => input.value,\r\n (current, previous) => {\r\n if (\r\n current?.target === previous?.target &&\r\n current?.layout.height !== previous?.layout.height\r\n ) {\r\n const prevLayout = layout.value;\r\n\r\n layout.value = input.value;\r\n scrollPosition.value += maybeScroll(keyboardHeight.value, true);\r\n layout.value = prevLayout;\r\n }\r\n },\r\n [],\r\n );\r\n\r\n const view = useAnimatedStyle(\r\n () =>\r\n enabled\r\n ? {\r\n // animations become choppy when scrolling to the end of the `ScrollView` (when the last input is focused)\r\n // this happens because the layout recalculates on every frame. To avoid this we slightly increase padding\r\n // by `+1`. In this way we assure, that `scrollTo` will never scroll to the end, because it uses interpolation\r\n // from 0 to `keyboardHeight`, and here our padding is `keyboardHeight + 1`. It allows us not to re-run layout\r\n // re-calculation on every animation frame and it helps to achieve smooth animation.\r\n // see: https://github.com/kirillzyusko/react-native-keyboard-controller/pull/342\r\n paddingBottom: currentKeyboardFrameHeight.value + 1,\r\n }\r\n : {},\r\n [enabled],\r\n );\r\n\r\n return (\r\n <Reanimated.ScrollView\r\n ref={onRef}\r\n {...rest}\r\n onLayout={onScrollViewLayout}\r\n scrollEventThrottle={16}\r\n >\r\n {children}\r\n <Reanimated.View style={view} />\r\n </Reanimated.ScrollView>\r\n );\r\n },\r\n);\r\n\r\nexport default KeyboardAwareScrollView;\r\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAC/D,SAASC,cAAc,QAAQ,cAAc;AAC7C,OAAOC,UAAU,IACfC,WAAW,EACXC,QAAQ,EACRC,mBAAmB,EACnBC,cAAc,EACdC,gBAAgB,EAChBC,mBAAmB,EACnBC,cAAc,QACT,yBAAyB;AAEhC,SACEC,sBAAsB,EACtBC,yBAAyB,EACzBC,mBAAmB,QACd,aAAa;AAEpB,SAASC,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,QAAQ,EAAEC,qCAAqC,QAAQ,SAAS;AAuBzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,uBAAuB,gBAAGlB,UAAU,CAIxC,CACE;EACEmB,QAAQ;EACRC,QAAQ;EACRC,YAAY,GAAG,CAAC;EAChBC,2BAA2B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