@react-native-ohos/react-native-keyboard-controller 1.17.0-beta.2 → 1.17.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 (408) hide show
  1. package/LICENSE +21 -21
  2. package/README.OpenSource +11 -11
  3. package/README.md +686 -19
  4. package/harmony/keyboard_controller/BuildProfile.ets +16 -16
  5. package/harmony/keyboard_controller/Index.ets +29 -28
  6. package/harmony/keyboard_controller/build-profile.json5 +31 -31
  7. package/harmony/keyboard_controller/hvigorfile.ts +6 -6
  8. package/harmony/keyboard_controller/obfuscation-rules.txt +17 -17
  9. package/harmony/keyboard_controller/oh-package-lock.json5 +28 -18
  10. package/harmony/keyboard_controller/oh-package.json5 +10 -10
  11. package/harmony/keyboard_controller/src/main/cpp/CMakeLists.txt +7 -7
  12. package/harmony/keyboard_controller/src/main/cpp/ClippingScrollViewComponentDescriptor.h +86 -0
  13. package/harmony/keyboard_controller/src/main/cpp/ClippingScrollViewComponentInstance.cpp +104 -0
  14. package/harmony/keyboard_controller/src/main/cpp/ClippingScrollViewComponentInstance.h +64 -0
  15. package/harmony/keyboard_controller/src/main/cpp/ClippingScrollViewJSIBinder.h +60 -0
  16. package/harmony/keyboard_controller/src/main/cpp/EventEmitters.cpp +119 -96
  17. package/harmony/keyboard_controller/src/main/cpp/EventEmitters.h +111 -111
  18. package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentDescriptor.h +94 -94
  19. package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.cpp +840 -288
  20. package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.h +169 -103
  21. package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewJSIBinder.h +65 -65
  22. package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentDescriptor.h +79 -79
  23. package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.cpp +108 -108
  24. package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.h +83 -83
  25. package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaJSIBinder.h +60 -60
  26. package/harmony/keyboard_controller/src/main/cpp/KeyboardToolbarGroupViewComponentDescriptor.h +46 -0
  27. package/harmony/keyboard_controller/src/main/cpp/KeyboardToolbarGroupViewComponentInstance.cpp +37 -0
  28. package/harmony/keyboard_controller/src/main/cpp/KeyboardToolbarGroupViewComponentInstance.h +32 -0
  29. package/harmony/keyboard_controller/src/main/cpp/KeyboardToolbarGroupViewJSIBinder.h +23 -0
  30. package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.cpp +103 -46
  31. package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.h +48 -48
  32. package/harmony/keyboard_controller/src/main/cpp/RNKeyboardControllerPackage.h +20 -0
  33. package/harmony/keyboard_controller/src/main/cpp/RNStatusBarManagerCompat.cpp +45 -45
  34. package/harmony/keyboard_controller/src/main/cpp/RNStatusBarManagerCompat.h +49 -49
  35. package/harmony/keyboard_controller/src/main/cpp/ViewHierarchyNavigator.cpp +207 -186
  36. package/harmony/keyboard_controller/src/main/cpp/ViewHierarchyNavigator.h +131 -112
  37. package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.cpp +77 -64
  38. package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.h +85 -77
  39. package/harmony/keyboard_controller/src/main/ets/Logger.ts +66 -66
  40. package/harmony/keyboard_controller/src/main/ets/{RNKeyboardControllerPackage.ts → RNKeyboardControllerPackage.ets} +70 -66
  41. package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerTurboModule.ts +465 -273
  42. package/harmony/keyboard_controller/src/main/ets/RNStatusBarManagerCompatTurboModule.ts +128 -119
  43. package/harmony/keyboard_controller/src/main/ets/Type.ts +63 -62
  44. package/harmony/keyboard_controller/src/main/module.json5 +11 -11
  45. package/harmony/keyboard_controller/src/main/resources/base/element/string.json +8 -8
  46. package/harmony/keyboard_controller/src/main/resources/en_US/element/string.json +8 -8
  47. package/harmony/keyboard_controller/src/main/resources/zh_CN/element/string.json +8 -8
  48. package/harmony/keyboard_controller/{ts.ts → ts.ets} +29 -29
  49. package/harmony/keyboard_controller.har +0 -0
  50. package/lib/commonjs/animated.js +22 -11
  51. package/lib/commonjs/animated.js.map +1 -1
  52. package/lib/commonjs/architecture.js +8 -0
  53. package/lib/commonjs/architecture.js.map +1 -0
  54. package/lib/commonjs/bindings.js +40 -5
  55. package/lib/commonjs/bindings.js.map +1 -1
  56. package/lib/commonjs/bindings.native.js +28 -5
  57. package/lib/commonjs/bindings.native.js.map +1 -1
  58. package/lib/commonjs/compat.js +50 -0
  59. package/lib/commonjs/compat.js.map +1 -0
  60. package/lib/commonjs/components/KeyboardAvoidingView/hooks.js +21 -15
  61. package/lib/commonjs/components/KeyboardAvoidingView/hooks.js.map +1 -1
  62. package/lib/commonjs/components/KeyboardAvoidingView/index.js +39 -14
  63. package/lib/commonjs/components/KeyboardAvoidingView/index.js.map +1 -1
  64. package/lib/commonjs/components/KeyboardAwareScrollView/index.js +94 -57
  65. package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
  66. package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +5 -5
  67. package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
  68. package/lib/commonjs/components/KeyboardAwareScrollView/utils.js.map +1 -1
  69. package/lib/commonjs/components/KeyboardChatScrollView/hooks.js +13 -0
  70. package/lib/commonjs/components/KeyboardChatScrollView/hooks.js.map +1 -0
  71. package/lib/commonjs/components/KeyboardChatScrollView/index.js +122 -0
  72. package/lib/commonjs/components/KeyboardChatScrollView/index.js.map +1 -0
  73. package/lib/commonjs/components/KeyboardChatScrollView/types.js +6 -0
  74. package/lib/commonjs/components/KeyboardChatScrollView/types.js.map +1 -0
  75. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/helpers.js +221 -0
  76. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/helpers.js.map +1 -0
  77. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js +149 -0
  78. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js.map +1 -0
  79. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.js +240 -0
  80. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.js.map +1 -0
  81. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/types.js +6 -0
  82. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/types.js.map +1 -0
  83. package/lib/commonjs/components/KeyboardChatScrollView/useEndVisible.js +40 -0
  84. package/lib/commonjs/components/KeyboardChatScrollView/useEndVisible.js.map +1 -0
  85. package/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js +92 -0
  86. package/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js.map +1 -0
  87. package/lib/commonjs/components/KeyboardStickyView/index.js.map +1 -1
  88. package/lib/commonjs/components/KeyboardToolbar/Arrow.js +2 -3
  89. package/lib/commonjs/components/KeyboardToolbar/Arrow.js.map +1 -1
  90. package/lib/commonjs/components/KeyboardToolbar/Button.js +2 -3
  91. package/lib/commonjs/components/KeyboardToolbar/Button.js.map +1 -1
  92. package/lib/commonjs/components/KeyboardToolbar/colors.js.map +1 -1
  93. package/lib/commonjs/components/KeyboardToolbar/colors.native.js.map +1 -1
  94. package/lib/commonjs/components/KeyboardToolbar/compound/components/Background.js +13 -0
  95. package/lib/commonjs/components/KeyboardToolbar/compound/components/Background.js.map +1 -0
  96. package/lib/commonjs/components/KeyboardToolbar/compound/components/Content.js +25 -0
  97. package/lib/commonjs/components/KeyboardToolbar/compound/components/Content.js.map +1 -0
  98. package/lib/commonjs/components/KeyboardToolbar/compound/components/Done.js +58 -0
  99. package/lib/commonjs/components/KeyboardToolbar/compound/components/Done.js.map +1 -0
  100. package/lib/commonjs/components/KeyboardToolbar/compound/components/Next.js +49 -0
  101. package/lib/commonjs/components/KeyboardToolbar/compound/components/Next.js.map +1 -0
  102. package/lib/commonjs/components/KeyboardToolbar/compound/components/Prev.js +49 -0
  103. package/lib/commonjs/components/KeyboardToolbar/compound/components/Prev.js.map +1 -0
  104. package/lib/commonjs/components/KeyboardToolbar/compound/components/index.js +42 -0
  105. package/lib/commonjs/components/KeyboardToolbar/compound/components/index.js.map +1 -0
  106. package/lib/commonjs/components/KeyboardToolbar/compound/components/types.js +6 -0
  107. package/lib/commonjs/components/KeyboardToolbar/compound/components/types.js.map +1 -0
  108. package/lib/commonjs/components/KeyboardToolbar/compound/context.js +17 -0
  109. package/lib/commonjs/components/KeyboardToolbar/compound/context.js.map +1 -0
  110. package/lib/commonjs/components/KeyboardToolbar/constants.js +17 -0
  111. package/lib/commonjs/components/KeyboardToolbar/constants.js.map +1 -0
  112. package/lib/commonjs/components/KeyboardToolbar/index.js +98 -87
  113. package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -1
  114. package/lib/commonjs/components/KeyboardToolbar/types.js.map +1 -1
  115. package/lib/commonjs/components/ScrollViewWithBottomPadding/index.js +120 -0
  116. package/lib/commonjs/components/ScrollViewWithBottomPadding/index.js.map +1 -0
  117. package/lib/commonjs/components/ScrollViewWithBottomPadding/styles.js +15 -0
  118. package/lib/commonjs/components/ScrollViewWithBottomPadding/styles.js.map +1 -0
  119. package/lib/commonjs/components/hooks/useColorScheme.js.map +1 -1
  120. package/lib/commonjs/components/hooks/useCombinedRef.js +24 -0
  121. package/lib/commonjs/components/hooks/useCombinedRef.js.map +1 -0
  122. package/lib/commonjs/components/hooks/useScrollState.js +62 -0
  123. package/lib/commonjs/components/hooks/useScrollState.js.map +1 -0
  124. package/lib/commonjs/components/index.js +7 -0
  125. package/lib/commonjs/components/index.js.map +1 -1
  126. package/lib/commonjs/constants.js +3 -1
  127. package/lib/commonjs/constants.js.map +1 -1
  128. package/lib/commonjs/context.js +1 -0
  129. package/lib/commonjs/context.js.map +1 -1
  130. package/lib/commonjs/hooks/index.js +14 -1
  131. package/lib/commonjs/hooks/index.js.map +1 -1
  132. package/lib/commonjs/hooks/useKeyboardState/index.js +39 -0
  133. package/lib/commonjs/hooks/useKeyboardState/index.js.map +1 -0
  134. package/lib/commonjs/hooks/useWindowDimensions/index.android.js.map +1 -1
  135. package/lib/commonjs/hooks/useWindowDimensions/index.js.map +1 -1
  136. package/lib/commonjs/index.js +27 -1
  137. package/lib/commonjs/index.js.map +1 -1
  138. package/lib/commonjs/internal.js +54 -18
  139. package/lib/commonjs/internal.js.map +1 -1
  140. package/lib/commonjs/module.js +21 -12
  141. package/lib/commonjs/module.js.map +1 -1
  142. package/lib/commonjs/reanimated.js.map +1 -1
  143. package/lib/commonjs/reanimated.native.js.map +1 -1
  144. package/lib/commonjs/specs/ClippingScrollViewDecoratorViewNativeComponent.js +12 -0
  145. package/lib/commonjs/specs/ClippingScrollViewDecoratorViewNativeComponent.js.map +1 -0
  146. package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js +8 -2
  147. package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js.map +1 -1
  148. package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js +2 -1
  149. package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js.map +1 -1
  150. package/lib/commonjs/specs/KeyboardToolbarGroupViewNativeComponent.js +12 -0
  151. package/lib/commonjs/specs/KeyboardToolbarGroupViewNativeComponent.js.map +1 -0
  152. package/lib/commonjs/specs/NativeKeyboardController.js.map +1 -1
  153. package/lib/commonjs/specs/NativeStatusBarManagerCompat.js.map +1 -1
  154. package/lib/commonjs/specs/OverKeyboardViewNativeComponent.js.map +1 -1
  155. package/lib/commonjs/types.js.map +1 -1
  156. package/lib/commonjs/utils/findNodeHandle/index.js +9 -0
  157. package/lib/commonjs/utils/findNodeHandle/index.js.map +1 -0
  158. package/lib/commonjs/utils/findNodeHandle/index.native.js +13 -0
  159. package/lib/commonjs/utils/findNodeHandle/index.native.js.map +1 -0
  160. package/lib/commonjs/utils.js.map +1 -1
  161. package/lib/commonjs/views/KeyboardExtender/index.js +30 -0
  162. package/lib/commonjs/views/KeyboardExtender/index.js.map +1 -0
  163. package/lib/commonjs/views/OverKeyboardView/index.js.map +1 -1
  164. package/lib/commonjs/views/index.js +7 -0
  165. package/lib/commonjs/views/index.js.map +1 -1
  166. package/lib/module/animated.js +24 -13
  167. package/lib/module/animated.js.map +1 -1
  168. package/lib/module/architecture.js +2 -0
  169. package/lib/module/architecture.js.map +1 -0
  170. package/lib/module/bindings.js +39 -5
  171. package/lib/module/bindings.js.map +1 -1
  172. package/lib/module/bindings.native.js +27 -5
  173. package/lib/module/bindings.native.js.map +1 -1
  174. package/lib/module/compat.js +43 -0
  175. package/lib/module/compat.js.map +1 -0
  176. package/lib/module/components/KeyboardAvoidingView/hooks.js +22 -16
  177. package/lib/module/components/KeyboardAvoidingView/hooks.js.map +1 -1
  178. package/lib/module/components/KeyboardAvoidingView/index.js +38 -14
  179. package/lib/module/components/KeyboardAvoidingView/index.js.map +1 -1
  180. package/lib/module/components/KeyboardAwareScrollView/index.js +97 -60
  181. package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -1
  182. package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +5 -5
  183. package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
  184. package/lib/module/components/KeyboardAwareScrollView/utils.js.map +1 -1
  185. package/lib/module/components/KeyboardChatScrollView/hooks.js +2 -0
  186. package/lib/module/components/KeyboardChatScrollView/hooks.js.map +1 -0
  187. package/lib/module/components/KeyboardChatScrollView/index.js +115 -0
  188. package/lib/module/components/KeyboardChatScrollView/index.js.map +1 -0
  189. package/lib/module/components/KeyboardChatScrollView/types.js +2 -0
  190. package/lib/module/components/KeyboardChatScrollView/types.js.map +1 -0
  191. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/helpers.js +207 -0
  192. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/helpers.js.map +1 -0
  193. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js +143 -0
  194. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js.map +1 -0
  195. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.js +234 -0
  196. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.js.map +1 -0
  197. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/types.js +2 -0
  198. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/types.js.map +1 -0
  199. package/lib/module/components/KeyboardChatScrollView/useEndVisible.js +33 -0
  200. package/lib/module/components/KeyboardChatScrollView/useEndVisible.js.map +1 -0
  201. package/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js +87 -0
  202. package/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js.map +1 -0
  203. package/lib/module/components/KeyboardStickyView/index.js.map +1 -1
  204. package/lib/module/components/KeyboardToolbar/Arrow.js +2 -2
  205. package/lib/module/components/KeyboardToolbar/Arrow.js.map +1 -1
  206. package/lib/module/components/KeyboardToolbar/Button.js +2 -2
  207. package/lib/module/components/KeyboardToolbar/Button.js.map +1 -1
  208. package/lib/module/components/KeyboardToolbar/colors.js.map +1 -1
  209. package/lib/module/components/KeyboardToolbar/colors.native.js.map +1 -1
  210. package/lib/module/components/KeyboardToolbar/compound/components/Background.js +6 -0
  211. package/lib/module/components/KeyboardToolbar/compound/components/Background.js.map +1 -0
  212. package/lib/module/components/KeyboardToolbar/compound/components/Content.js +18 -0
  213. package/lib/module/components/KeyboardToolbar/compound/components/Content.js.map +1 -0
  214. package/lib/module/components/KeyboardToolbar/compound/components/Done.js +50 -0
  215. package/lib/module/components/KeyboardToolbar/compound/components/Done.js.map +1 -0
  216. package/lib/module/components/KeyboardToolbar/compound/components/Next.js +41 -0
  217. package/lib/module/components/KeyboardToolbar/compound/components/Next.js.map +1 -0
  218. package/lib/module/components/KeyboardToolbar/compound/components/Prev.js +41 -0
  219. package/lib/module/components/KeyboardToolbar/compound/components/Prev.js.map +1 -0
  220. package/lib/module/components/KeyboardToolbar/compound/components/index.js +6 -0
  221. package/lib/module/components/KeyboardToolbar/compound/components/index.js.map +1 -0
  222. package/lib/module/components/KeyboardToolbar/compound/components/types.js +2 -0
  223. package/lib/module/components/KeyboardToolbar/compound/components/types.js.map +1 -0
  224. package/lib/module/components/KeyboardToolbar/compound/context.js +10 -0
  225. package/lib/module/components/KeyboardToolbar/compound/context.js.map +1 -0
  226. package/lib/module/components/KeyboardToolbar/constants.js +11 -0
  227. package/lib/module/components/KeyboardToolbar/constants.js.map +1 -0
  228. package/lib/module/components/KeyboardToolbar/index.js +98 -88
  229. package/lib/module/components/KeyboardToolbar/index.js.map +1 -1
  230. package/lib/module/components/KeyboardToolbar/types.js.map +1 -1
  231. package/lib/module/components/ScrollViewWithBottomPadding/index.js +112 -0
  232. package/lib/module/components/ScrollViewWithBottomPadding/index.js.map +1 -0
  233. package/lib/module/components/ScrollViewWithBottomPadding/styles.js +9 -0
  234. package/lib/module/components/ScrollViewWithBottomPadding/styles.js.map +1 -0
  235. package/lib/module/components/hooks/useColorScheme.js.map +1 -1
  236. package/lib/module/components/hooks/useCombinedRef.js +18 -0
  237. package/lib/module/components/hooks/useCombinedRef.js.map +1 -0
  238. package/lib/module/components/hooks/useScrollState.js +56 -0
  239. package/lib/module/components/hooks/useScrollState.js.map +1 -0
  240. package/lib/module/components/index.js +1 -0
  241. package/lib/module/components/index.js.map +1 -1
  242. package/lib/module/constants.js +3 -0
  243. package/lib/module/constants.js.map +1 -1
  244. package/lib/module/context.js +1 -0
  245. package/lib/module/context.js.map +1 -1
  246. package/lib/module/hooks/index.js +3 -1
  247. package/lib/module/hooks/index.js.map +1 -1
  248. package/lib/module/hooks/useKeyboardState/index.js +33 -0
  249. package/lib/module/hooks/useKeyboardState/index.js.map +1 -0
  250. package/lib/module/hooks/useWindowDimensions/index.android.js.map +1 -1
  251. package/lib/module/hooks/useWindowDimensions/index.js.map +1 -1
  252. package/lib/module/index.js +3 -2
  253. package/lib/module/index.js.map +1 -1
  254. package/lib/module/internal.js +53 -18
  255. package/lib/module/internal.js.map +1 -1
  256. package/lib/module/module.js +21 -12
  257. package/lib/module/module.js.map +1 -1
  258. package/lib/module/reanimated.js.map +1 -1
  259. package/lib/module/reanimated.native.js.map +1 -1
  260. package/lib/module/specs/ClippingScrollViewDecoratorViewNativeComponent.js +6 -0
  261. package/lib/module/specs/ClippingScrollViewDecoratorViewNativeComponent.js.map +1 -0
  262. package/lib/module/specs/KeyboardControllerViewNativeComponent.js +7 -1
  263. package/lib/module/specs/KeyboardControllerViewNativeComponent.js.map +1 -1
  264. package/lib/module/specs/KeyboardGestureAreaNativeComponent.js +2 -1
  265. package/lib/module/specs/KeyboardGestureAreaNativeComponent.js.map +1 -1
  266. package/lib/module/specs/KeyboardToolbarGroupViewNativeComponent.js +5 -0
  267. package/lib/module/specs/KeyboardToolbarGroupViewNativeComponent.js.map +1 -0
  268. package/lib/module/specs/NativeKeyboardController.js.map +1 -1
  269. package/lib/module/specs/NativeStatusBarManagerCompat.js.map +1 -1
  270. package/lib/module/specs/OverKeyboardViewNativeComponent.js.map +1 -1
  271. package/lib/module/types.js.map +1 -1
  272. package/lib/module/utils/findNodeHandle/index.js +2 -0
  273. package/lib/module/utils/findNodeHandle/index.js.map +1 -0
  274. package/lib/module/utils/findNodeHandle/index.native.js +3 -0
  275. package/lib/module/utils/findNodeHandle/index.native.js.map +1 -0
  276. package/lib/module/utils.js.map +1 -1
  277. package/lib/module/views/KeyboardExtender/index.js +23 -0
  278. package/lib/module/views/KeyboardExtender/index.js.map +1 -0
  279. package/lib/module/views/OverKeyboardView/index.js.map +1 -1
  280. package/lib/module/views/index.js +1 -0
  281. package/lib/module/views/index.js.map +1 -1
  282. package/lib/typescript/animated.d.ts +2 -38
  283. package/lib/typescript/architecture.d.ts +1 -0
  284. package/lib/typescript/bindings.d.ts +15 -1
  285. package/lib/typescript/bindings.native.d.ts +10 -1
  286. package/lib/typescript/compat.d.ts +12 -0
  287. package/lib/typescript/components/KeyboardAvoidingView/index.d.ts +5 -0
  288. package/lib/typescript/components/KeyboardAwareScrollView/index.d.ts +4 -1
  289. package/lib/typescript/components/KeyboardChatScrollView/hooks.d.ts +2 -0
  290. package/lib/typescript/components/KeyboardChatScrollView/index.d.ts +17 -0
  291. package/lib/typescript/components/KeyboardChatScrollView/types.d.ts +113 -0
  292. package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/helpers.d.ts +132 -0
  293. package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/index.d.ts +18 -0
  294. package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/index.ios.d.ts +21 -0
  295. package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/types.d.ts +37 -0
  296. package/lib/typescript/components/KeyboardChatScrollView/useEndVisible.d.ts +17 -0
  297. package/lib/typescript/components/KeyboardChatScrollView/useExtraContentPadding/index.d.ts +45 -0
  298. package/lib/typescript/components/KeyboardToolbar/Button.d.ts +2 -2
  299. package/lib/typescript/components/KeyboardToolbar/compound/components/Background.d.ts +6 -0
  300. package/lib/typescript/components/KeyboardToolbar/compound/components/Content.d.ts +7 -0
  301. package/lib/typescript/components/KeyboardToolbar/compound/components/Done.d.ts +7 -0
  302. package/lib/typescript/components/KeyboardToolbar/compound/components/Next.d.ts +4 -0
  303. package/lib/typescript/components/KeyboardToolbar/compound/components/Prev.d.ts +4 -0
  304. package/lib/typescript/components/KeyboardToolbar/compound/components/index.d.ts +5 -0
  305. package/lib/typescript/components/KeyboardToolbar/compound/components/types.d.ts +14 -0
  306. package/lib/typescript/components/KeyboardToolbar/compound/context.d.ts +9 -0
  307. package/lib/typescript/components/KeyboardToolbar/constants.d.ts +10 -0
  308. package/lib/typescript/components/KeyboardToolbar/index.d.ts +12 -45
  309. package/lib/typescript/components/KeyboardToolbar/types.d.ts +24 -1
  310. package/lib/typescript/components/ScrollViewWithBottomPadding/index.d.ts +30 -0
  311. package/lib/typescript/components/ScrollViewWithBottomPadding/styles.d.ts +7 -0
  312. package/lib/typescript/components/hooks/useCombinedRef.d.ts +3 -0
  313. package/lib/typescript/components/hooks/useScrollState.d.ts +17 -0
  314. package/lib/typescript/components/index.d.ts +3 -0
  315. package/lib/typescript/constants.d.ts +1 -0
  316. package/lib/typescript/context.d.ts +1 -0
  317. package/lib/typescript/hooks/index.d.ts +2 -0
  318. package/lib/typescript/hooks/useKeyboardState/index.d.ts +4 -0
  319. package/lib/typescript/index.d.ts +4 -3
  320. package/lib/typescript/internal.d.ts +4 -0
  321. package/lib/typescript/specs/ClippingScrollViewDecoratorViewNativeComponent.d.ts +10 -0
  322. package/lib/typescript/specs/KeyboardControllerViewNativeComponent.d.ts +4 -0
  323. package/lib/typescript/specs/KeyboardToolbarGroupViewNativeComponent.d.ts +6 -0
  324. package/lib/typescript/specs/NativeKeyboardController.d.ts +6 -2
  325. package/lib/typescript/types.d.ts +81 -5
  326. package/lib/typescript/utils/findNodeHandle/index.d.ts +4 -0
  327. package/lib/typescript/utils/findNodeHandle/index.native.d.ts +2 -0
  328. package/lib/typescript/views/KeyboardExtender/index.d.ts +5 -0
  329. package/lib/typescript/views/index.d.ts +1 -0
  330. package/package.json +183 -174
  331. package/src/animated.tsx +248 -255
  332. package/src/architecture.ts +1 -0
  333. package/src/bindings.native.ts +97 -62
  334. package/src/bindings.ts +81 -42
  335. package/src/compat.ts +44 -0
  336. package/src/components/KeyboardAvoidingView/hooks.ts +130 -123
  337. package/src/components/KeyboardAvoidingView/index.tsx +232 -188
  338. package/src/components/KeyboardAwareScrollView/index.tsx +452 -389
  339. package/src/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.ts +133 -133
  340. package/src/components/KeyboardAwareScrollView/utils.ts +41 -41
  341. package/src/components/KeyboardChatScrollView/hooks.ts +2 -0
  342. package/src/components/KeyboardChatScrollView/index.tsx +164 -0
  343. package/src/components/KeyboardChatScrollView/types.ts +117 -0
  344. package/src/components/KeyboardChatScrollView/useChatKeyboard/helpers.ts +268 -0
  345. package/src/components/KeyboardChatScrollView/useChatKeyboard/index.ios.ts +260 -0
  346. package/src/components/KeyboardChatScrollView/useChatKeyboard/index.ts +374 -0
  347. package/src/components/KeyboardChatScrollView/useChatKeyboard/types.ts +39 -0
  348. package/src/components/KeyboardChatScrollView/useEndVisible.ts +66 -0
  349. package/src/components/KeyboardChatScrollView/useExtraContentPadding/index.ts +149 -0
  350. package/src/components/KeyboardStickyView/index.tsx +66 -66
  351. package/src/components/KeyboardToolbar/Arrow.tsx +80 -80
  352. package/src/components/KeyboardToolbar/Button.tsx +98 -98
  353. package/src/components/KeyboardToolbar/colors.native.ts +37 -37
  354. package/src/components/KeyboardToolbar/colors.ts +16 -16
  355. package/src/components/KeyboardToolbar/compound/components/Background.tsx +9 -0
  356. package/src/components/KeyboardToolbar/compound/components/Content.tsx +25 -0
  357. package/src/components/KeyboardToolbar/compound/components/Done.tsx +57 -0
  358. package/src/components/KeyboardToolbar/compound/components/Next.tsx +49 -0
  359. package/src/components/KeyboardToolbar/compound/components/Prev.tsx +49 -0
  360. package/src/components/KeyboardToolbar/compound/components/index.ts +5 -0
  361. package/src/components/KeyboardToolbar/compound/components/types.ts +15 -0
  362. package/src/components/KeyboardToolbar/compound/context.ts +25 -0
  363. package/src/components/KeyboardToolbar/constants.ts +14 -0
  364. package/src/components/KeyboardToolbar/index.tsx +220 -223
  365. package/src/components/KeyboardToolbar/types.ts +72 -40
  366. package/src/components/ScrollViewWithBottomPadding/index.tsx +216 -0
  367. package/src/components/ScrollViewWithBottomPadding/styles.ts +10 -0
  368. package/src/components/hooks/useColorScheme.ts +6 -6
  369. package/src/components/hooks/useCombinedRef.ts +22 -0
  370. package/src/components/hooks/useScrollState.ts +81 -0
  371. package/src/components/index.ts +14 -11
  372. package/src/constants.ts +23 -19
  373. package/src/context.ts +70 -68
  374. package/src/hooks/index.ts +91 -90
  375. package/src/hooks/useKeyboardState/index.ts +52 -0
  376. package/src/hooks/useWindowDimensions/index.android.ts +38 -38
  377. package/src/hooks/useWindowDimensions/index.ts +1 -1
  378. package/src/index.ts +27 -23
  379. package/src/internal.ts +146 -84
  380. package/src/module.ts +64 -52
  381. package/src/reanimated.native.ts +132 -132
  382. package/src/reanimated.ts +29 -29
  383. package/src/specs/ClippingScrollViewDecoratorViewNativeComponent.ts +19 -0
  384. package/src/specs/KeyboardControllerViewNativeComponent.ts +82 -71
  385. package/src/specs/KeyboardGestureAreaNativeComponent.ts +21 -20
  386. package/src/specs/KeyboardToolbarGroupViewNativeComponent.ts +10 -0
  387. package/src/specs/NativeKeyboardController.ts +23 -19
  388. package/src/specs/NativeStatusBarManagerCompat.ts +14 -14
  389. package/src/specs/OverKeyboardViewNativeComponent.ts +12 -12
  390. package/src/types.ts +330 -243
  391. package/src/utils/findNodeHandle/index.native.ts +3 -0
  392. package/src/utils/findNodeHandle/index.ts +6 -0
  393. package/src/utils.ts +1 -1
  394. package/src/views/KeyboardExtender/index.tsx +30 -0
  395. package/src/views/OverKeyboardView/index.tsx +43 -43
  396. package/src/views/index.ts +2 -1
  397. package/lib/commonjs/monkey-patch.android.js +0 -57
  398. package/lib/commonjs/monkey-patch.android.js.map +0 -1
  399. package/lib/commonjs/monkey-patch.js +0 -11
  400. package/lib/commonjs/monkey-patch.js.map +0 -1
  401. package/lib/module/monkey-patch.android.js +0 -47
  402. package/lib/module/monkey-patch.android.js.map +0 -1
  403. package/lib/module/monkey-patch.js +0 -5
  404. package/lib/module/monkey-patch.js.map +0 -1
  405. package/lib/typescript/monkey-patch.android.d.ts +0 -2
  406. package/lib/typescript/monkey-patch.d.ts +0 -2
  407. package/src/monkey-patch.android.ts +0 -44
  408. package/src/monkey-patch.ts +0 -4
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_bindings","_KeyboardStickyView","_interopRequireDefault","_useColorScheme","_Arrow","_Button","_colors","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_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","dismissKeyboard","KeyboardControllerNative","dismiss","goToNextField","setFocusTo","goToPrevField","KeyboardToolbar","content","theme","colors","doneText","button","icon","showArrows","onNextCallback","onPrevCallback","onDoneCallback","blur","opacity","offset","closed","opened","enabled","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","onPressPrev","onPressDone","createElement","View","style","testID","Fragment","accessibilityLabel","accessibilityHint","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\";\r\nimport { StyleSheet, Text, View } from \"react-native\";\r\n\r\nimport {\r\n FocusedInputEvents,\r\n} from \"../../bindings\";\r\nimport KeyboardStickyView from \"../KeyboardStickyView\"\r\nimport { KeyboardControllerNative } from \"../../bindings\";\r\nimport useColorScheme from \"../hooks/useColorScheme\";\r\n\r\nimport Arrow from \"./Arrow\";\r\nimport Button from \"./Button\";\r\nimport { colors } from \"./colors\";\r\n\r\nimport type { HEX, KeyboardToolbarTheme } from \"./types\";\r\nimport type { KeyboardStickyViewProps } from \"../KeyboardStickyView\";\r\nimport type { ReactNode } from \"react\";\r\nimport type { ViewProps } from \"react-native\";\r\n\r\nexport type KeyboardToolbarProps = Omit<\r\n ViewProps,\r\n \"style\" | \"testID\" | \"children\"\r\n> & {\r\n /** An element that is shown in the middle of the toolbar. */\r\n content?: JSX.Element | null;\r\n /** A set of dark/light colors consumed by toolbar component. */\r\n theme?: KeyboardToolbarTheme;\r\n /** Custom text for done button. */\r\n doneText?: ReactNode;\r\n /** Custom touchable component for toolbar (used for prev/next/done buttons). */\r\n button?: typeof Button;\r\n /** Custom icon component used to display next/prev buttons. */\r\n icon?: typeof Arrow;\r\n /**\r\n * Whether to show next and previous buttons. Can be useful to set it to `false` if you have only one input\r\n * and want to show only `Done` button. Default to `true`.\r\n */\r\n showArrows?: boolean;\r\n /**\r\n * A callback that is called when the user presses the next button along with the default action.\r\n */\r\n onNextCallback?: () => void;\r\n /**\r\n * A callback that is called when the user presses the previous button along with the default action.\r\n */\r\n onPrevCallback?: () => void;\r\n /**\r\n * A callback that is called when the user presses the done button along with the default action.\r\n */\r\n onDoneCallback?: () => void;\r\n /**\r\n * A component that applies blur effect to the toolbar.\r\n */\r\n blur?: JSX.Element | null;\r\n /**\r\n * A value for container opacity in hexadecimal format (e.g. `ff`). Default value is `ff`.\r\n */\r\n opacity?: HEX;\r\n} & Pick<KeyboardStickyViewProps, \"offset\" | \"enabled\">;\r\n\r\nconst TEST_ID_KEYBOARD_TOOLBAR = \"keyboard.toolbar\";\r\nconst TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS = `${TEST_ID_KEYBOARD_TOOLBAR}.previous`;\r\nconst TEST_ID_KEYBOARD_TOOLBAR_NEXT = `${TEST_ID_KEYBOARD_TOOLBAR}.next`;\r\nconst TEST_ID_KEYBOARD_TOOLBAR_CONTENT = `${TEST_ID_KEYBOARD_TOOLBAR}.content`;\r\nconst TEST_ID_KEYBOARD_TOOLBAR_DONE = `${TEST_ID_KEYBOARD_TOOLBAR}.done`;\r\n\r\nconst KEYBOARD_TOOLBAR_HEIGHT = 42;\r\nconst DEFAULT_OPACITY: HEX = \"FF\";\r\n\r\nconst dismissKeyboard = () => KeyboardControllerNative.dismiss(false);\r\nconst goToNextField = () => KeyboardControllerNative.setFocusTo(\"next\");\r\nconst goToPrevField = () => KeyboardControllerNative.setFocusTo(\"prev\");\r\n\r\n/**\r\n * `KeyboardToolbar` is a component that is shown above the keyboard with `Prev`/`Next` and\r\n * `Done` buttons.\r\n */\r\nconst KeyboardToolbar: React.FC<KeyboardToolbarProps> = ({\r\n content,\r\n theme = colors,\r\n doneText,\r\n button,\r\n icon,\r\n showArrows = true,\r\n onNextCallback,\r\n onPrevCallback,\r\n onDoneCallback,\r\n blur = null,\r\n opacity = DEFAULT_OPACITY,\r\n offset: { closed = 0, opened = 0 } = {},\r\n enabled = true,\r\n ...rest\r\n}) => {\r\n const colorScheme = useColorScheme();\r\n const [inputs, setInputs] = useState({\r\n current: 0,\r\n count: 0,\r\n });\r\n const isPrevDisabled = inputs.current === 0;\r\n const isNextDisabled = inputs.current === inputs.count - 1;\r\n\r\n useEffect(() => {\r\n const subscription = FocusedInputEvents.addListener(\"focusDidSet\", (e) => {\r\n setInputs(e);\r\n });\r\n\r\n return subscription.remove;\r\n }, []);\r\n const doneStyle = useMemo(\r\n () => [styles.doneButton, { color: theme[colorScheme].primary }],\r\n [colorScheme, theme],\r\n );\r\n const toolbarStyle = useMemo(\r\n () => [\r\n styles.toolbar,\r\n {\r\n backgroundColor: `${theme[colorScheme].background}${opacity}`,\r\n },\r\n ],\r\n [colorScheme, opacity, theme],\r\n );\r\n const offset = useMemo(\r\n () => ({ closed: closed + KEYBOARD_TOOLBAR_HEIGHT, opened }),\r\n [closed, opened],\r\n );\r\n const ButtonContainer = button || Button;\r\n const IconContainer = icon || Arrow;\r\n\r\n const onPressNext = useCallback(() => {\r\n goToNextField();\r\n onNextCallback?.();\r\n }, [onNextCallback]);\r\n const onPressPrev = useCallback(() => {\r\n goToPrevField();\r\n onPrevCallback?.();\r\n }, [onPrevCallback]);\r\n const onPressDone = useCallback(() => {\r\n dismissKeyboard();\r\n onDoneCallback?.();\r\n }, [onDoneCallback]);\r\n\r\n return (\r\n <KeyboardStickyView enabled={enabled} offset={offset}>\r\n <View {...rest} style={toolbarStyle} testID={TEST_ID_KEYBOARD_TOOLBAR}>\r\n {blur}\r\n {showArrows && (\r\n <>\r\n <ButtonContainer\r\n accessibilityLabel=\"Previous\"\r\n accessibilityHint=\"Will move focus to previous field\"\r\n disabled={isPrevDisabled}\r\n onPress={onPressPrev}\r\n testID={TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS}\r\n theme={theme}\r\n >\r\n <IconContainer\r\n disabled={isPrevDisabled}\r\n type=\"prev\"\r\n theme={theme}\r\n />\r\n </ButtonContainer>\r\n <ButtonContainer\r\n accessibilityLabel=\"Next\"\r\n accessibilityHint=\"Will move focus to next field\"\r\n disabled={isNextDisabled}\r\n onPress={onPressNext}\r\n testID={TEST_ID_KEYBOARD_TOOLBAR_NEXT}\r\n theme={theme}\r\n >\r\n <IconContainer\r\n disabled={isNextDisabled}\r\n type=\"next\"\r\n theme={theme}\r\n />\r\n </ButtonContainer>\r\n </>\r\n )}\r\n\r\n <View style={styles.flex} testID={TEST_ID_KEYBOARD_TOOLBAR_CONTENT}>\r\n {content}\r\n </View>\r\n <ButtonContainer\r\n accessibilityLabel=\"Done\"\r\n accessibilityHint=\"Will close the keyboard\"\r\n onPress={onPressDone}\r\n testID={TEST_ID_KEYBOARD_TOOLBAR_DONE}\r\n rippleRadius={28}\r\n style={styles.doneButtonContainer}\r\n theme={theme}\r\n >\r\n <Text style={doneStyle} maxFontSizeMultiplier={1.3}>\r\n {doneText || \"Done\"}\r\n </Text>\r\n </ButtonContainer>\r\n </View>\r\n </KeyboardStickyView>\r\n );\r\n};\r\n\r\nconst styles = StyleSheet.create({\r\n flex: {\r\n flex: 1,\r\n },\r\n toolbar: {\r\n position: \"absolute\",\r\n bottom: 0,\r\n alignItems: \"center\",\r\n width: \"100%\",\r\n flexDirection: \"row\",\r\n height: KEYBOARD_TOOLBAR_HEIGHT,\r\n paddingHorizontal: 8,\r\n },\r\n doneButton: {\r\n fontWeight: \"600\",\r\n fontSize: 15,\r\n },\r\n doneButtonContainer: {\r\n marginRight: 8,\r\n },\r\n});\r\n\r\nexport { colors as DefaultKeyboardToolbarTheme };\r\nexport default KeyboardToolbar;\r\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AAGA,IAAAG,mBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAEA,IAAAK,eAAA,GAAAD,sBAAA,CAAAJ,OAAA;AAEA,IAAAM,MAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,OAAA,GAAAH,sBAAA,CAAAJ,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AAAkC,SAAAI,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAV,wBAAAU,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAd,uBAAA,YAAAA,CAAAU,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,CAAAI,GAAA,CAAAX,CAAA,UAAAO,CAAA,CAAAK,GAAA,CAAAZ,CAAA,GAAAO,CAAA,CAAAM,GAAA,CAAAb,CAAA,EAAAS,CAAA,gBAA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OAAO,EAAET,WAAY;IACrBI,MAAM,EAAE9D,6BAA8B;IACtCsE,YAAY,EAAE,EAAG;IACjBT,KAAK,EAAElB,MAAM,CAAC4B,mBAAoB;IAClC5D,KAAK,EAAEA;EAAM,gBAEbnD,MAAA,CAAAa,OAAA,CAAAsF,aAAA,CAAChG,YAAA,CAAA6G,IAAI;IAACX,KAAK,EAAEpB,SAAU;IAACgC,qBAAqB,EAAE;EAAI,GAChD5D,QAAQ,IAAI,MACT,CACS,CACb,CACY,CAAC;AAEzB,CAAC;AAED,MAAM8B,MAAM,GAAG+B,uBAAU,CAACC,MAAM,CAAC;EAC/BN,IAAI,EAAE;IACJA,IAAI,EAAE;EACR,CAAC;EACDrB,OAAO,EAAE;IACP4B,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;EACDtC,UAAU,EAAE;IACVuC,UAAU,EAAE,KAAK;IACjBC,QAAQ,EAAE;EACZ,CAAC;EACDb,mBAAmB,EAAE;IACnBc,WAAW,EAAE;EACf;AACF,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAlH,OAAA,GAGYoC,eAAe","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_bindings","_hooks","_KeyboardStickyView","_interopRequireDefault","_Arrow","_Button","_colors","_components","_context","_constants","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","KeyboardToolbar","children","content","theme","colors","doneText","button","icon","showArrows","onNextCallback","onPrevCallback","onDoneCallback","blur","opacity","DEFAULT_OPACITY","offset","closed","opened","enabled","insets","rest","colorScheme","useKeyboardState","state","appearance","inputs","setInputs","useState","current","count","isPrevDisabled","isNextDisabled","buttonContainer","Button","iconContainer","Arrow","useEffect","subscription","FocusedInputEvents","addListener","remove","toolbarStyle","useMemo","styles","toolbar","backgroundColor","background","KEYBOARD_HAS_ROUNDED_CORNERS","paddingLeft","left","paddingRight","right","floating","containerStyle","sticky","KEYBOARD_TOOLBAR_HEIGHT","OPENED_OFFSET","backgroundElement","arrowsElement","contentContainer","doneElement","prevChild","nextChild","contentChild","doneChild","backgroundChild","React","Children","forEach","child","isValidElement","type","Background","Content","Prev","Next","Done","createElement","View","style","arrows","onPress","text","contextValue","ToolbarContext","Provider","value","testID","TEST_ID_KEYBOARD_TOOLBAR","StyleSheet","create","position","bottom","height","alignItems","width","flexDirection","alignSelf","borderRadius","overflow","Group","RCTKeyboardToolbarGroupView","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from \"react\";\nimport { StyleSheet, View } from \"react-native\";\n\nimport {\n FocusedInputEvents,\n RCTKeyboardToolbarGroupView,\n} from \"../../bindings\";\nimport { useKeyboardState } from \"../../hooks\";\nimport KeyboardStickyView from \"../KeyboardStickyView\";\n\nimport Arrow from \"./Arrow\";\nimport Button from \"./Button\";\nimport { colors } from \"./colors\";\nimport { Background, Content, Done, Next, Prev } from \"./compound/components\";\nimport { ToolbarContext } from \"./compound/context\";\nimport {\n DEFAULT_OPACITY,\n KEYBOARD_HAS_ROUNDED_CORNERS,\n KEYBOARD_TOOLBAR_HEIGHT,\n OPENED_OFFSET,\n TEST_ID_KEYBOARD_TOOLBAR,\n} from \"./constants\";\n\nimport type { KeyboardToolbarProps } from \"./types\";\nimport type { ReactNode } from \"react\";\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 Background: typeof Background;\n Content: typeof Content;\n Prev: typeof Prev;\n Next: typeof Next;\n Done: typeof Done;\n Group: typeof RCTKeyboardToolbarGroupView;\n} = ({\n children,\n content,\n theme = colors,\n doneText = \"Done\",\n button,\n icon,\n showArrows = true,\n onNextCallback,\n onPrevCallback,\n onDoneCallback,\n blur = null,\n opacity = DEFAULT_OPACITY,\n offset: { closed = 0, opened = 0 } = {},\n enabled = true,\n insets,\n ...rest\n}) => {\n const colorScheme = useKeyboardState((state) => state.appearance);\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 const buttonContainer = button ?? Button;\n const iconContainer = icon ?? Arrow;\n\n useEffect(() => {\n const subscription = FocusedInputEvents.addListener(\"focusDidSet\", (e) => {\n setInputs(e);\n });\n\n return subscription.remove;\n }, []);\n const toolbarStyle = useMemo(\n () => [\n styles.toolbar,\n {\n backgroundColor: `${theme[colorScheme].background}${opacity}`,\n },\n !KEYBOARD_HAS_ROUNDED_CORNERS\n ? {\n paddingLeft: insets?.left,\n paddingRight: insets?.right,\n }\n : null,\n KEYBOARD_HAS_ROUNDED_CORNERS ? styles.floating : null,\n ],\n [colorScheme, opacity, theme, insets],\n );\n const containerStyle = useMemo(\n () => [\n // CRUCIAL: gives the native view real bounds\n styles.sticky,\n KEYBOARD_HAS_ROUNDED_CORNERS\n ? ({\n left: (insets?.left ?? 0) + 16,\n right: (insets?.right ?? 0) + 16,\n } as const)\n : null,\n ],\n [insets],\n );\n const offset = useMemo(\n () => ({\n closed: closed + KEYBOARD_TOOLBAR_HEIGHT,\n opened: opened + OPENED_OFFSET,\n }),\n [closed, opened],\n );\n let backgroundElement: ReactNode = null;\n let arrowsElement: ReactNode = null;\n let contentContainer: ReactNode = null;\n let doneElement: ReactNode = null;\n\n if (children) {\n let prevChild: ReactNode = null;\n let nextChild: ReactNode = null;\n let contentChild: ReactNode = null;\n let doneChild: ReactNode = null;\n let backgroundChild: ReactNode = null;\n\n React.Children.forEach(children, (child) => {\n if (!React.isValidElement(child)) return;\n if (child.type === Background) backgroundChild = child;\n else if (child.type === Content) contentChild = child;\n else if (child.type === Prev) prevChild = child;\n else if (child.type === Next) nextChild = child;\n else if (child.type === Done) doneChild = child;\n });\n\n backgroundElement = backgroundChild;\n doneElement = doneChild;\n arrowsElement =\n prevChild || nextChild ? (\n <View style={styles.arrows}>\n {prevChild}\n {nextChild}\n </View>\n ) : null;\n contentContainer = contentChild ?? <Content>{contentChild}</Content>;\n } else {\n backgroundElement = blur;\n arrowsElement = showArrows ? (\n <View style={styles.arrows}>\n <Prev\n button={buttonContainer}\n icon={iconContainer}\n onPress={onPrevCallback}\n />\n <Next\n button={buttonContainer}\n icon={iconContainer}\n onPress={onNextCallback}\n />\n </View>\n ) : null;\n contentContainer = <Content>{content}</Content>;\n doneElement = doneText ? (\n <Done button={buttonContainer} text={doneText} onPress={onDoneCallback} />\n ) : null;\n }\n\n const contextValue = useMemo(\n () => ({ theme, isPrevDisabled, isNextDisabled }),\n [theme, isPrevDisabled, isNextDisabled],\n );\n\n return (\n <ToolbarContext.Provider value={contextValue}>\n <KeyboardStickyView\n enabled={enabled}\n offset={offset}\n style={containerStyle}\n >\n <View {...rest} style={toolbarStyle} testID={TEST_ID_KEYBOARD_TOOLBAR}>\n {backgroundElement}\n {arrowsElement}\n {contentContainer}\n {doneElement}\n </View>\n </KeyboardStickyView>\n </ToolbarContext.Provider>\n );\n};\n\nconst styles = StyleSheet.create({\n sticky: {\n position: \"absolute\",\n left: 0,\n right: 0,\n bottom: 0,\n height: KEYBOARD_TOOLBAR_HEIGHT,\n },\n toolbar: {\n position: \"absolute\",\n bottom: 0,\n alignItems: \"center\",\n width: \"100%\",\n flexDirection: \"row\",\n height: KEYBOARD_TOOLBAR_HEIGHT,\n },\n arrows: {\n flexDirection: \"row\",\n paddingLeft: 8,\n },\n floating: {\n alignSelf: \"center\",\n borderRadius: 20,\n overflow: \"hidden\",\n },\n});\n\nKeyboardToolbar.Background = Background;\nKeyboardToolbar.Content = Content;\nKeyboardToolbar.Prev = Prev;\nKeyboardToolbar.Next = Next;\nK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D,WAAW,EAAE;EACf,CAAC;EACDI,QAAQ,EAAE;IACR6C,SAAS,EAAE,QAAQ;IACnBC,YAAY,EAAE,EAAE;IAChBC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;AAEFnG,eAAe,CAACwE,UAAU,GAAGA,sBAAU;AACvCxE,eAAe,CAACyE,OAAO,GAAGA,mBAAO;AACjCzE,eAAe,CAAC0E,IAAI,GAAGA,gBAAI;AAC3B1E,eAAe,CAAC2E,IAAI,GAAGA,gBAAI;AAC3B3E,eAAe,CAAC4E,IAAI,GAAGA,gBAAI;AAC3B5E,eAAe,CAACoG,KAAK,GAAGC,qCAA2B;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA9H,OAAA,GAGrCuB,eAAe","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { ColorValue } from \"react-native\";\r\n\r\ntype Theme = {\r\n /** Color for arrow when it's enabled */\r\n primary: ColorValue;\r\n /** Color for arrow when it's disabled */\r\n disabled: ColorValue;\r\n /** Keyboard toolbar background color */\r\n background: string;\r\n /** Color for ripple effect (on button touch) on Android */\r\n ripple: ColorValue;\r\n};\r\nexport type KeyboardToolbarTheme = {\r\n light: Theme;\r\n dark: Theme;\r\n};\r\ntype HexSymbol =\r\n | \"0\"\r\n | \"1\"\r\n | \"2\"\r\n | \"3\"\r\n | \"4\"\r\n | \"5\"\r\n | \"6\"\r\n | \"7\"\r\n | \"8\"\r\n | \"9\"\r\n | \"A\"\r\n | \"B\"\r\n | \"C\"\r\n | \"D\"\r\n | \"E\"\r\n | \"F\"\r\n | \"a\"\r\n | \"b\"\r\n | \"c\"\r\n | \"d\"\r\n | \"e\"\r\n | \"f\";\r\nexport type HEX = `${HexSymbol}${HexSymbol}`;\r\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type Arrow from \"./Arrow\";\nimport type Button from \"./Button\";\nimport type { KeyboardStickyViewProps } from \"../KeyboardStickyView\";\nimport type { ReactNode } from \"react\";\nimport type {\n ColorValue,\n GestureResponderEvent,\n ViewProps,\n} from \"react-native\";\n\ntype Theme = {\n /** Color for arrow when it's enabled */\n primary: ColorValue;\n /** Color for arrow when it's disabled */\n disabled: ColorValue;\n /** Keyboard toolbar background color */\n background: string;\n /** Color for ripple effect (on button touch) on Android */\n ripple: ColorValue;\n};\nexport type KeyboardToolbarTheme = {\n light: Theme;\n dark: Theme;\n};\ntype HexSymbol =\n | \"0\"\n | \"1\"\n | \"2\"\n | \"3\"\n | \"4\"\n | \"5\"\n | \"6\"\n | \"7\"\n | \"8\"\n | \"9\"\n | \"A\"\n | \"B\"\n | \"C\"\n | \"D\"\n | \"E\"\n | \"F\"\n | \"a\"\n | \"b\"\n | \"c\"\n | \"d\"\n | \"e\"\n | \"f\";\nexport type HEX = `${HexSymbol}${HexSymbol}`;\n\ntype SafeAreaInsets = {\n left: number;\n right: number;\n};\n\nexport type KeyboardToolbarProps = Omit<\n ViewProps,\n \"style\" | \"testID\" | \"children\"\n> & {\n content?: React.JSX.Element | null;\n theme?: KeyboardToolbarTheme;\n doneText?: ReactNode;\n button?: typeof Button;\n icon?: typeof Arrow;\n showArrows?: boolean;\n onNextCallback?: (event: GestureResponderEvent) => void;\n onPrevCallback?: (event: GestureResponderEvent) => void;\n onDoneCallback?: (event: GestureResponderEvent) => void;\n blur?: React.JSX.Element | null;\n opacity?: HEX;\n insets?: SafeAreaInsets;\n children?: ReactNode;\n} & Pick<KeyboardStickyViewProps, \"offset\" | \"enabled\">;\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
10
+ var _bindings = require("../../bindings");
11
+ var _styles = _interopRequireDefault(require("./styles"));
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
14
+ 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); }
15
+ const OS = _reactNative.Platform.OS;
16
+ const ReanimatedClippingScrollView = OS === "android" || OS === "harmony" ? _reactNativeReanimated.default.createAnimatedComponent(_bindings.ClippingScrollView) : _bindings.ClippingScrollView;
17
+ const ScrollViewWithBottomPadding = /*#__PURE__*/(0, _react.forwardRef)(({
18
+ ScrollViewComponent,
19
+ bottomPadding,
20
+ scrollIndicatorPadding,
21
+ contentInset,
22
+ scrollIndicatorInsets,
23
+ inverted,
24
+ contentOffsetY,
25
+ applyWorkaroundForContentInsetHitTestBug,
26
+ onContentInsetChange,
27
+ contentContainerStyle,
28
+ children,
29
+ ...rest
30
+ }, ref) => {
31
+ const prevContentOffsetY = (0, _reactNativeReanimated.useSharedValue)(null);
32
+
33
+ // HarmonyOS workaround: ArkUI ScrollView's scrollable range only follows
34
+ // contentSize (contentInset prop is dropped, padding/scrollToOverflowEnabled
35
+ // don't extend it). So we mirror the keyboard-driven bottomPadding into the
36
+ // inner ScrollView's contentContainerStyle.paddingBottom to actually expand
37
+ // contentSize, letting the worklet's scrollTo reach the keyboard area.
38
+ const isHarmony = OS === "harmony";
39
+ const [harmonyKbPad, setHarmonyKbPad] = (0, _react.useState)(0);
40
+ (0, _reactNativeReanimated.useAnimatedReaction)(() => isHarmony ? bottomPadding.value : 0, (cur, prev) => {
41
+ if (isHarmony && cur !== prev) {
42
+ (0, _reactNativeReanimated.runOnJS)(setHarmonyKbPad)(Math.round(cur));
43
+ }
44
+ }, [isHarmony]);
45
+ const insets = (0, _reactNativeReanimated.useDerivedValue)(() => {
46
+ const dynamicTop = inverted ? bottomPadding.value : 0;
47
+ const dynamicBottom = !inverted ? bottomPadding.value : 0;
48
+ return {
49
+ dynamic: {
50
+ top: dynamicTop,
51
+ bottom: dynamicBottom
52
+ },
53
+ effective: {
54
+ top: dynamicTop + ((contentInset === null || contentInset === void 0 ? void 0 : contentInset.top) || 0),
55
+ bottom: dynamicBottom + ((contentInset === null || contentInset === void 0 ? void 0 : contentInset.bottom) || 0),
56
+ left: (contentInset === null || contentInset === void 0 ? void 0 : contentInset.left) || 0,
57
+ right: (contentInset === null || contentInset === void 0 ? void 0 : contentInset.right) || 0
58
+ }
59
+ };
60
+ }, [inverted, contentInset === null || contentInset === void 0 ? void 0 : contentInset.top, contentInset === null || contentInset === void 0 ? void 0 : contentInset.bottom, contentInset === null || contentInset === void 0 ? void 0 : contentInset.left, contentInset === null || contentInset === void 0 ? void 0 : contentInset.right]);
61
+ (0, _reactNativeReanimated.useAnimatedReaction)(() => insets.value.effective, (current, previous) => {
62
+ if (!onContentInsetChange) {
63
+ return;
64
+ }
65
+ if (previous && current.top === previous.top && current.bottom === previous.bottom && current.left === previous.left && current.right === previous.right) {
66
+ return;
67
+ }
68
+ (0, _reactNativeReanimated.runOnJS)(onContentInsetChange)(current);
69
+ }, [onContentInsetChange]);
70
+ const animatedProps = (0, _reactNativeReanimated.useAnimatedProps)(() => {
71
+ const {
72
+ dynamic,
73
+ effective
74
+ } = insets.value;
75
+ const indicatorPadding = scrollIndicatorPadding ?? bottomPadding;
76
+ const indicatorTop = (inverted ? indicatorPadding.value : 0) + ((scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.top) || 0);
77
+ const indicatorBottom = (!inverted ? indicatorPadding.value : 0) + ((scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.bottom) || 0);
78
+ const result = {
79
+ // iOS prop
80
+ contentInset: effective,
81
+ scrollIndicatorInsets: {
82
+ bottom: indicatorBottom,
83
+ top: indicatorTop,
84
+ right: scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.right,
85
+ left: scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.left
86
+ },
87
+ // Android prop
88
+ contentInsetBottom: dynamic.bottom,
89
+ contentInsetTop: dynamic.top
90
+ };
91
+ if (contentOffsetY) {
92
+ const curr = contentOffsetY.value;
93
+ if (curr !== prevContentOffsetY.value) {
94
+ // eslint-disable-next-line react-compiler/react-compiler
95
+ prevContentOffsetY.value = curr;
96
+ result.contentOffset = {
97
+ x: 0,
98
+ y: curr
99
+ };
100
+ }
101
+ }
102
+ return result;
103
+ }, [scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.bottom, scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.top, scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.right, scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.left, inverted, contentOffsetY]);
104
+ return /*#__PURE__*/_react.default.createElement(ReanimatedClippingScrollView, {
105
+ animatedProps: animatedProps,
106
+ applyWorkaroundForContentInsetHitTestBug: applyWorkaroundForContentInsetHitTestBug,
107
+ style: _styles.default.container
108
+ }, /*#__PURE__*/_react.default.createElement(ScrollViewComponent, _extends({
109
+ ref: ref,
110
+ animatedProps: animatedProps
111
+ }, rest, {
112
+ contentContainerStyle: isHarmony ? [contentContainerStyle, inverted ? {
113
+ paddingTop: harmonyKbPad
114
+ } : {
115
+ paddingBottom: harmonyKbPad
116
+ }] : contentContainerStyle
117
+ }), children));
118
+ });
119
+ var _default = exports.default = ScrollViewWithBottomPadding;
120
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_bindings","_styles","_interopRequireDefault","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","OS","Platform","ReanimatedClippingScrollView","Reanimated","createAnimatedComponent","ClippingScrollView","ScrollViewWithBottomPadding","forwardRef","ScrollViewComponent","bottomPadding","scrollIndicatorPadding","contentInset","scrollIndicatorInsets","inverted","contentOffsetY","applyWorkaroundForContentInsetHitTestBug","onContentInsetChange","contentContainerStyle","children","rest","ref","prevContentOffsetY","useSharedValue","isHarmony","harmonyKbPad","setHarmonyKbPad","useState","useAnimatedReaction","value","cur","prev","runOnJS","Math","round","insets","useDerivedValue","dynamicTop","dynamicBottom","dynamic","top","bottom","effective","left","right","current","previous","animatedProps","useAnimatedProps","indicatorPadding","indicatorTop","indicatorBottom","result","contentInsetBottom","contentInsetTop","curr","contentOffset","x","y","createElement","style","styles","container","paddingTop","paddingBottom","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef, useState } from \"react\";\nimport { Platform } from \"react-native\";\nimport Reanimated, {\n runOnJS,\n useAnimatedProps,\n useAnimatedReaction,\n useDerivedValue,\n useSharedValue,\n} from \"react-native-reanimated\";\n\nimport { ClippingScrollView } from \"../../bindings\";\n\nimport styles from \"./styles\";\n\nimport type { ScrollViewProps } from \"react-native\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nconst OS = Platform.OS;\nconst ReanimatedClippingScrollView =\n OS === \"android\" || (OS as string) === \"harmony\"\n ? Reanimated.createAnimatedComponent(ClippingScrollView)\n : ClippingScrollView;\n\ntype AnimatedScrollViewProps = React.ComponentProps<\n typeof Reanimated.ScrollView\n>;\n\nexport type AnimatedScrollViewComponent = React.ForwardRefExoticComponent<\n AnimatedScrollViewProps & React.RefAttributes<Reanimated.ScrollView>\n>;\n\nexport type ScrollViewContentInsets = {\n top: number;\n bottom: number;\n left: number;\n right: number;\n};\n\ntype ScrollViewWithBottomPaddingProps = {\n ScrollViewComponent: AnimatedScrollViewComponent;\n children?: React.ReactNode;\n inverted?: boolean;\n bottomPadding: SharedValue<number>;\n /** Padding for scroll indicator insets (excludes blankSpace). Falls back to bottomPadding when not provided. */\n scrollIndicatorPadding?: SharedValue<number>;\n /** Absolute Y content offset (iOS only, for KeyboardChatScrollView). */\n contentOffsetY?: SharedValue<number>;\n applyWorkaroundForContentInsetHitTestBug?: boolean;\n /**\n * Fires whenever the effective content inset changes (combines the static `contentInset`\n * prop with the dynamic keyboard-driven padding). Useful on Android where the synthetic\n * inset is not reflected in `onScroll` events.\n */\n onContentInsetChange?: (insets: ScrollViewContentInsets) => void;\n} & ScrollViewProps;\n\nconst ScrollViewWithBottomPadding = forwardRef<\n Reanimated.ScrollView,\n ScrollViewWithBottomPaddingProps\n>(\n (\n {\n ScrollViewComponent,\n bottomPadding,\n scrollIndicatorPadding,\n contentInset,\n scrollIndicatorInsets,\n inverted,\n contentOffsetY,\n applyWorkaroundForContentInsetHitTestBug,\n onContentInsetChange,\n contentContainerStyle,\n children,\n ...rest\n },\n ref,\n ) => {\n const prevContentOffsetY = useSharedValue<number | null>(null);\n\n // HarmonyOS workaround: ArkUI ScrollView's scrollable range only follows\n // contentSize (contentInset prop is dropped, padding/scrollToOverflowEnabled\n // don't extend it). So we mirror the keyboard-driven bottomPadding into the\n // inner ScrollView's contentContainerStyle.paddingBottom to actually expand\n // contentSize, letting the worklet's scrollTo reach the keyboard area.\n const isHarmony = (OS as string) === \"harmony\";\n const [harmonyKbPad, setHarmonyKbPad] = useState(0);\n useAnimatedReaction(\n () => (isHarmony ? bottomPadding.value : 0),\n (cur, prev) => {\n if (isHarmony && cur !== prev) {\n runOnJS(setHarmonyKbPad)(Math.round(cur));\n }\n },\n [isHarmony],\n );\n\n const insets = useDerivedValue(() => {\n const dynamicTop = inverted ? bottomPadding.value : 0;\n const dynamicBottom = !inverted ? bottomPadding.value : 0;\n\n return {\n dynamic: {\n top: dynamicTop,\n bottom: dynamicBottom,\n },\n effective: {\n top: dynamicTop + (contentInset?.top || 0),\n bottom: dynamicBottom + (contentInset?.bottom || 0),\n left: contentInset?.left || 0,\n right: contentInset?.right || 0,\n } as ScrollViewContentInsets,\n };\n }, [\n inverted,\n contentInset?.top,\n contentInset?.bottom,\n contentInset?.left,\n contentInset?.right,\n ]);\n\n useAnimatedReaction(\n () => insets.value.effective,\n (current, previous) => {\n if (!onContentInsetChange) {\n return;\n }\n if (\n previous &&\n current.top === previous.top &&\n current.bottom === previous.bottom &&\n current.left === previous.left &&\n current.right === previous.right\n ) {\n return;\n }\n runOnJS(onContentInsetChange)(current);\n },\n [onContentInsetChange],\n );\n\n const animatedProps = useAnimatedProps(() => {\n const { dynamic, effective } = insets.value;\n\n const indicatorPadding = scrollIndicatorPadding ?? bottomPadding;\n const indicatorTop =\n (inverted ? indicatorPadding.value : 0) +\n (scrollIndicatorInsets?.top || 0);\n const indicatorBottom =\n (!inverted ? indicatorPadding.value : 0) +\n (scrollIndicatorInsets?.bottom || 0);\n\n const result: Record<string, unknown> = {\n // iOS prop\n contentInset: effective,\n scrollIndicatorInsets: {\n bottom: indicatorBottom,\n top: indicatorTop,\n right: scrollIndicatorInsets?.right,\n left: scrollIndicatorInsets?.left,\n },\n // Android prop\n contentInsetBottom: dynamic.bottom,\n contentInsetTop: dynamic.top,\n };\n\n if (contentOffsetY) {\n const curr = contentOffsetY.value;\n\n if (curr !== prevContentOffsetY.value) {\n // eslint-disable-next-line react-compiler/react-compiler\n prevContentOffsetY.value = curr;\n result.contentOffset = { x: 0, y: curr };\n }\n }\n\n return result;\n }, [\n scrollIndicatorInsets?.bottom,\n scrollIndicatorInsets?.top,\n scrollIndicatorInsets?.right,\n scrollIndicatorInsets?.left,\n inverted,\n contentOffsetY,\n ]);\n\n return (\n <ReanimatedClippingScrollView\n animatedProps={animatedProps}\n applyWorkaroundForContentInsetHitTestBug={\n applyWorkaroundForContentInsetHitTestBug\n }\n style={styles.container}\n >\n <ScrollViewComponent\n ref={ref}\n animatedProps={animatedProps}\n {...rest}\n contentContainerStyle={\n isHarmony\n ? [\n contentContainerStyle,\n inverted\n ? { paddingTop: harmonyKbPad }\n : { paddingBottom: harmonyKbPad },\n ]\n : contentContainerStyle\n }\n >\n {children}\n </ScrollViewComponent>\n </ReanimatedClippingScrollView>\n );\n },\n);\n\nexport default ScrollViewWithBottomPadding;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAH,uBAAA,CAAAC,OAAA;AAQA,IAAAG,SAAA,GAAAH,OAAA;AAEA,IAAAI,OAAA,GAAAC,sBAAA,CAAAL,OAAA;AAA8B,SAAAK,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAP,wBAAAO,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAX,uBAAA,YAAAA,CAAAO,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAA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E/C,MAAA,CAAAU,OAAA,CAAAiF,aAAA,CAACxD,4BAA4B;IAC3B4C,aAAa,EAAEA,aAAc;IAC7B/B,wCAAwC,EACtCA,wCACD;IACD4C,KAAK,EAAEC,eAAM,CAACC;EAAU,gBAExB9F,MAAA,CAAAU,OAAA,CAAAiF,aAAA,CAAClD,mBAAmB,EAAAd,QAAA;IAClB0B,GAAG,EAAEA,GAAI;IACT0B,aAAa,EAAEA;EAAc,GACzB3B,IAAI;IACRF,qBAAqB,EACnBM,SAAS,GACL,CACEN,qBAAqB,EACrBJ,QAAQ,GACJ;MAAEiD,UAAU,EAAEtC;IAAa,CAAC,GAC5B;MAAEuC,aAAa,EAAEvC;IAAa,CAAC,CACpC,GACDP;EACL,IAEAC,QACkB,CACO,CAAC;AAEnC,CACF,CAAC;AAAC,IAAA8C,QAAA,GAAAC,OAAA,CAAAxF,OAAA,GAEa6B,2BAA2B","ignoreList":[]}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _reactNative = require("react-native");
8
+ const styles = _reactNative.StyleSheet.create({
9
+ container: {
10
+ flexGrow: 1,
11
+ flexShrink: 1
12
+ }
13
+ });
14
+ var _default = exports.default = styles;
15
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","styles","StyleSheet","create","container","flexGrow","flexShrink","_default","exports","default"],"sources":["styles.ts"],"sourcesContent":["import { StyleSheet } from \"react-native\";\n\nconst styles = StyleSheet.create({\n container: {\n flexGrow: 1,\n flexShrink: 1,\n },\n});\n\nexport default styles;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,MAAM,GAAGC,uBAAU,CAACC,MAAM,CAAC;EAC/BC,SAAS,EAAE;IACTC,QAAQ,EAAE,CAAC;IACXC,UAAU,EAAE;EACd;AACF,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEYR,MAAM","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","useColorScheme","useColorSchemeRN","_default","exports","default"],"sources":["useColorScheme.ts"],"sourcesContent":["import { useColorScheme as useColorSchemeRN } from \"react-native\";\r\n\r\nconst useColorScheme = (): \"light\" | \"dark\" =>\r\n\tuseColorSchemeRN() === \"dark\" ? \"dark\" : \"light\";\r\n\r\nexport default useColorScheme;\r\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,cAAc,GAAGA,CAAA,KACtB,IAAAC,2BAAgB,EAAC,CAAC,KAAK,MAAM,GAAG,MAAM,GAAG,OAAO;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEnCJ,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","useColorScheme","useColorSchemeRN","_default","exports","default"],"sources":["useColorScheme.ts"],"sourcesContent":["import { useColorScheme as useColorSchemeRN } from \"react-native\";\n\nconst useColorScheme = (): \"light\" | \"dark\" =>\n useColorSchemeRN() === \"dark\" ? \"dark\" : \"light\";\n\nexport default useColorScheme;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,cAAc,GAAGA,CAAA,KACrB,IAAAC,2BAAgB,EAAC,CAAC,KAAK,MAAM,GAAG,MAAM,GAAG,OAAO;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEpCJ,cAAc","ignoreList":[]}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = require("react");
8
+ const useCombinedRef = (...refs) => {
9
+ return (0, _react.useCallback)(value => {
10
+ for (const ref of refs) {
11
+ if (!ref) {
12
+ continue;
13
+ }
14
+ if (typeof ref === "function") {
15
+ ref(value);
16
+ } else {
17
+ ref.current = value;
18
+ }
19
+ }
20
+ // eslint-disable-next-line react-compiler/react-compiler
21
+ }, refs);
22
+ };
23
+ var _default = exports.default = useCombinedRef;
24
+ //# sourceMappingURL=useCombinedRef.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","useCombinedRef","refs","useCallback","value","ref","current","_default","exports","default"],"sources":["useCombinedRef.ts"],"sourcesContent":["import { useCallback } from \"react\";\n\nimport type { MutableRefObject, Ref, RefCallback } from \"react\";\n\nconst useCombinedRef = <T>(...refs: Ref<T>[]): RefCallback<T> => {\n return useCallback((value: T | null) => {\n for (const ref of refs) {\n if (!ref) {\n continue;\n }\n\n if (typeof ref === \"function\") {\n ref(value);\n } else {\n (ref as MutableRefObject<T | null>).current = value;\n }\n }\n // eslint-disable-next-line react-compiler/react-compiler\n }, refs);\n};\n\nexport default useCombinedRef;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,MAAMC,cAAc,GAAGA,CAAI,GAAGC,IAAc,KAAqB;EAC/D,OAAO,IAAAC,kBAAW,EAAEC,KAAe,IAAK;IACtC,KAAK,MAAMC,GAAG,IAAIH,IAAI,EAAE;MACtB,IAAI,CAACG,GAAG,EAAE;QACR;MACF;MAEA,IAAI,OAAOA,GAAG,KAAK,UAAU,EAAE;QAC7BA,GAAG,CAACD,KAAK,CAAC;MACZ,CAAC,MAAM;QACJC,GAAG,CAAgCC,OAAO,GAAGF,KAAK;MACrD;IACF;IACA;EACF,CAAC,EAAEF,IAAI,CAAC;AACV,CAAC;AAAC,IAAAK,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaR,cAAc","ignoreList":[]}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = require("react");
8
+ var _reactNativeReanimated = require("react-native-reanimated");
9
+ var _internal = require("../../internal");
10
+ const NATIVE_SCROLL_EVENT_NAMES = ["onScroll", "onScrollBeginDrag", "onScrollEndDrag", "onMomentumScrollBegin", "onMomentumScrollEnd"];
11
+ const useScrollState = ref => {
12
+ const offset = (0, _reactNativeReanimated.useSharedValue)(0);
13
+ const layout = (0, _reactNativeReanimated.useSharedValue)({
14
+ width: 0,
15
+ height: 0
16
+ });
17
+ const size = (0, _reactNativeReanimated.useSharedValue)({
18
+ width: 0,
19
+ height: 0
20
+ });
21
+ const register = (0, _internal.useEventHandlerRegistration)(ref);
22
+ const eventHandler = (0, _reactNativeReanimated.useEvent)(event => {
23
+ "worklet";
24
+
25
+ // eslint-disable-next-line react-compiler/react-compiler
26
+ offset.value = event.contentOffset.y;
27
+ layout.value = event.layoutMeasurement;
28
+ size.value = event.contentSize;
29
+ }, NATIVE_SCROLL_EVENT_NAMES);
30
+ (0, _react.useEffect)(() => {
31
+ const cleanup = register(eventHandler);
32
+ return () => {
33
+ cleanup();
34
+ };
35
+ }, []);
36
+
37
+ // `onContentSizeChange` is synthesized in JS (from the content container's
38
+ // onLayout) and `onLayout` has a different payload shape than scroll events,
39
+ // so neither can be reliably captured via native event registration.
40
+ // Instead we expose callbacks for the consumer to attach as props.
41
+ const onLayout = (0, _react.useCallback)(e => {
42
+ layout.value = {
43
+ width: e.nativeEvent.layout.width,
44
+ height: e.nativeEvent.layout.height
45
+ };
46
+ }, [layout]);
47
+ const onContentSizeChange = (0, _react.useCallback)((w, h) => {
48
+ size.value = {
49
+ width: w,
50
+ height: h
51
+ };
52
+ }, [size]);
53
+ return {
54
+ offset,
55
+ layout,
56
+ size,
57
+ onLayout,
58
+ onContentSizeChange
59
+ };
60
+ };
61
+ var _default = exports.default = useScrollState;
62
+ //# sourceMappingURL=useScrollState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_reactNativeReanimated","_internal","NATIVE_SCROLL_EVENT_NAMES","useScrollState","ref","offset","useSharedValue","layout","width","height","size","register","useEventHandlerRegistration","eventHandler","useEvent","event","value","contentOffset","y","layoutMeasurement","contentSize","useEffect","cleanup","onLayout","useCallback","e","nativeEvent","onContentSizeChange","w","h","_default","exports","default"],"sources":["useScrollState.ts"],"sourcesContent":["import { useCallback, useEffect } from \"react\";\nimport { useEvent, useSharedValue } from \"react-native-reanimated\";\n\nimport { useEventHandlerRegistration } from \"../../internal\";\n\nimport type { LayoutChangeEvent } from \"react-native\";\nimport type { AnimatedRef } from \"react-native-reanimated\";\nimport type Reanimated from \"react-native-reanimated\";\n\nconst NATIVE_SCROLL_EVENT_NAMES = [\n \"onScroll\",\n \"onScrollBeginDrag\",\n \"onScrollEndDrag\",\n \"onMomentumScrollBegin\",\n \"onMomentumScrollEnd\",\n];\n\ntype ScrollEvent = {\n contentOffset: {\n x: number;\n y: number;\n };\n layoutMeasurement: {\n width: number;\n height: number;\n };\n contentSize: {\n width: number;\n height: number;\n };\n};\n\nconst useScrollState = (ref: AnimatedRef<Reanimated.ScrollView>) => {\n const offset = useSharedValue(0);\n const layout = useSharedValue({ width: 0, height: 0 });\n const size = useSharedValue({ width: 0, height: 0 });\n\n const register = useEventHandlerRegistration(ref);\n\n const eventHandler = useEvent((event: ScrollEvent) => {\n \"worklet\";\n\n // eslint-disable-next-line react-compiler/react-compiler\n offset.value = event.contentOffset.y;\n layout.value = event.layoutMeasurement;\n size.value = event.contentSize;\n }, NATIVE_SCROLL_EVENT_NAMES);\n\n useEffect(() => {\n const cleanup = register(eventHandler);\n\n return () => {\n cleanup();\n };\n }, []);\n\n // `onContentSizeChange` is synthesized in JS (from the content container's\n // onLayout) and `onLayout` has a different payload shape than scroll events,\n // so neither can be reliably captured via native event registration.\n // Instead we expose callbacks for the consumer to attach as props.\n const onLayout = useCallback(\n (e: LayoutChangeEvent) => {\n layout.value = {\n width: e.nativeEvent.layout.width,\n height: e.nativeEvent.layout.height,\n };\n },\n [layout],\n );\n\n const onContentSizeChange = useCallback(\n (w: number, h: number) => {\n size.value = { width: w, height: h };\n },\n [size],\n );\n\n return { offset, layout, size, onLayout, onContentSizeChange };\n};\n\nex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jCC,MAAM,EAAEgB,CAAC,CAACC,WAAW,CAACnB,MAAM,CAACE;IAC/B,CAAC;EACH,CAAC,EACD,CAACF,MAAM,CACT,CAAC;EAED,MAAMoB,mBAAmB,GAAG,IAAAH,kBAAW,EACrC,CAACI,CAAS,EAAEC,CAAS,KAAK;IACxBnB,IAAI,CAACM,KAAK,GAAG;MAAER,KAAK,EAAEoB,CAAC;MAAEnB,MAAM,EAAEoB;IAAE,CAAC;EACtC,CAAC,EACD,CAACnB,IAAI,CACP,CAAC;EAED,OAAO;IAAEL,MAAM;IAAEE,MAAM;IAAEG,IAAI;IAAEa,QAAQ;IAAEI;EAAoB,CAAC;AAChE,CAAC;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa7B,cAAc","ignoreList":[]}
@@ -21,6 +21,12 @@ Object.defineProperty(exports, "KeyboardAwareScrollView", {
21
21
  return _KeyboardAwareScrollView.default;
22
22
  }
23
23
  });
24
+ Object.defineProperty(exports, "KeyboardChatScrollView", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _KeyboardChatScrollView.default;
28
+ }
29
+ });
24
30
  Object.defineProperty(exports, "KeyboardStickyView", {
25
31
  enumerable: true,
26
32
  get: function () {
@@ -36,6 +42,7 @@ Object.defineProperty(exports, "KeyboardToolbar", {
36
42
  var _KeyboardAvoidingView = _interopRequireDefault(require("./KeyboardAvoidingView"));
37
43
  var _KeyboardStickyView = _interopRequireDefault(require("./KeyboardStickyView"));
38
44
  var _KeyboardAwareScrollView = _interopRequireDefault(require("./KeyboardAwareScrollView"));
45
+ var _KeyboardChatScrollView = _interopRequireDefault(require("./KeyboardChatScrollView"));
39
46
  var _KeyboardToolbar = _interopRequireWildcard(require("./KeyboardToolbar"));
40
47
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
41
48
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -1 +1 @@
1
- {"version":3,"names":["_KeyboardAvoidingView","_interopRequireDefault","require","_KeyboardStickyView","_KeyboardAwareScrollView","_KeyboardToolbar","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor"],"sources":["index.ts"],"sourcesContent":["export { default as KeyboardAvoidingView } from \"./KeyboardAvoidingView\";\r\nexport { default as KeyboardStickyView } from \"./KeyboardStickyView\";\r\nexport { default as KeyboardAwareScrollView } from \"./KeyboardAwareScrollView\";\r\nexport {\r\n default as KeyboardToolbar,\r\n DefaultKeyboardToolbarTheme,\r\n} from \"./KeyboardToolbar\";\r\nexport type { KeyboardAvoidingViewProps } from \"./KeyboardAvoidingView\";\r\nexport type { KeyboardStickyViewProps } from \"./KeyboardStickyView\";\r\nexport type { KeyboardAwareScrollViewProps } from \"./KeyboardAwareScrollView\";\r\nexport type { KeyboardToolbarProps } from \"./KeyboardToolbar\";\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,wBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,gBAAA,GAAAC,uBAAA,CAAAJ,OAAA;AAG2B,SAAAI,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,CAAAC,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAAA,SAAAP,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAK,UAAA,GAAAL,CAAA,KAAAU,OAAA,EAAAV,CAAA","ignoreList":[]}
1
+ {"version":3,"names":["_KeyboardAvoidingView","_interopRequireDefault","require","_KeyboardStickyView","_KeyboardAwareScrollView","_KeyboardChatScrollView","_KeyboardToolbar","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor"],"sources":["index.ts"],"sourcesContent":["export { default as KeyboardAvoidingView } from \"./KeyboardAvoidingView\";\nexport { default as KeyboardStickyView } from \"./KeyboardStickyView\";\nexport { default as KeyboardAwareScrollView } from \"./KeyboardAwareScrollView\";\nexport { default as KeyboardChatScrollView } from \"./KeyboardChatScrollView\";\nexport {\n default as KeyboardToolbar,\n DefaultKeyboardToolbarTheme,\n} from \"./KeyboardToolbar\";\nexport type { KeyboardAvoidingViewProps } from \"./KeyboardAvoidingView\";\nexport type { KeyboardStickyViewProps } from \"./KeyboardStickyView\";\nexport type { KeyboardAwareScrollViewProps } from \"./KeyboardAwareScrollView\";\nexport type { KeyboardAwareScrollViewRef } from \"./KeyboardAwareScrollView\";\nexport type { KeyboardChatScrollViewProps } from \"./KeyboardChatScrollView/types\";\nexport type { KeyboardToolbarProps } from \"./KeyboardToolbar\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,wBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,uBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,gBAAA,GAAAC,uBAAA,CAAAL,OAAA;AAG2B,SAAAK,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,CAAAC,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAAA,SAAAR,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAK,UAAA,GAAAL,CAAA,KAAAU,OAAA,EAAAV,CAAA","ignoreList":[]}
@@ -3,7 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.AndroidSoftInputModes = void 0;
6
+ exports.KEYBOARD_BORDER_RADIUS = exports.AndroidSoftInputModes = void 0;
7
+ var _bindings = require("./bindings");
7
8
  // copied from `android.view.WindowManager.LayoutParams`
8
9
  let AndroidSoftInputModes = exports.AndroidSoftInputModes = /*#__PURE__*/function (AndroidSoftInputModes) {
9
10
  AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_ADJUST_NOTHING"] = 48] = "SOFT_INPUT_ADJUST_NOTHING";
@@ -24,4 +25,5 @@ let AndroidSoftInputModes = exports.AndroidSoftInputModes = /*#__PURE__*/functio
24
25
  AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_VISIBLE"] = 4] = "SOFT_INPUT_STATE_VISIBLE";
25
26
  return AndroidSoftInputModes;
26
27
  }({});
28
+ const KEYBOARD_BORDER_RADIUS = exports.KEYBOARD_BORDER_RADIUS = _bindings.KeyboardControllerNative.getConstants().keyboardBorderRadius;
27
29
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["AndroidSoftInputModes","exports"],"sources":["constants.ts"],"sourcesContent":["// copied from `android.view.WindowManager.LayoutParams`\r\nexport enum AndroidSoftInputModes {\r\n SOFT_INPUT_ADJUST_NOTHING = 48,\r\n SOFT_INPUT_ADJUST_PAN = 32,\r\n SOFT_INPUT_ADJUST_RESIZE = 16,\r\n SOFT_INPUT_ADJUST_UNSPECIFIED = 0,\r\n SOFT_INPUT_IS_FORWARD_NAVIGATION = 256,\r\n SOFT_INPUT_MASK_ADJUST = 240,\r\n SOFT_INPUT_MASK_STATE = 15,\r\n SOFT_INPUT_MODE_CHANGED = 512,\r\n SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3,\r\n SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5,\r\n SOFT_INPUT_STATE_HIDDEN = 2,\r\n SOFT_INPUT_STATE_UNCHANGED = 1,\r\n // temporarily disable this rule to avoid breaking changes.\r\n // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values\r\n SOFT_INPUT_STATE_UNSPECIFIED = 0,\r\n SOFT_INPUT_STATE_VISIBLE = 4,\r\n}\r\n"],"mappings":";;;;;;AAAA;AAAA,IACYA,qBAAqB,GAAAC,OAAA,CAAAD,qBAAA,0BAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAa/B;EACA;EAdUA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["_bindings","require","AndroidSoftInputModes","exports","KEYBOARD_BORDER_RADIUS","KeyboardControllerNative","getConstants","keyboardBorderRadius"],"sources":["constants.ts"],"sourcesContent":["import { KeyboardControllerNative } from \"./bindings\";\n\n// copied from `android.view.WindowManager.LayoutParams`\nexport enum AndroidSoftInputModes {\n SOFT_INPUT_ADJUST_NOTHING = 48,\n SOFT_INPUT_ADJUST_PAN = 32,\n SOFT_INPUT_ADJUST_RESIZE = 16,\n SOFT_INPUT_ADJUST_UNSPECIFIED = 0,\n SOFT_INPUT_IS_FORWARD_NAVIGATION = 256,\n SOFT_INPUT_MASK_ADJUST = 240,\n SOFT_INPUT_MASK_STATE = 15,\n SOFT_INPUT_MODE_CHANGED = 512,\n SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3,\n SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5,\n SOFT_INPUT_STATE_HIDDEN = 2,\n SOFT_INPUT_STATE_UNCHANGED = 1,\n // temporarily disable this rule to avoid breaking changes.\n // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values\n SOFT_INPUT_STATE_UNSPECIFIED = 0,\n SOFT_INPUT_STATE_VISIBLE = 4,\n}\nexport const KEYBOARD_BORDER_RADIUS =\n KeyboardControllerNative.getConstants().keyboardBorderRadius;\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAEA;AAAA,IACYC,qBAAqB,GAAAC,OAAA,CAAAD,qBAAA,0BAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAa/B;EACA;EAdUA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA;AAkB1B,MAAME,sBAAsB,GAAAD,OAAA,CAAAC,sBAAA,GACjCC,kCAAwB,CAACC,YAAY,CAAC,CAAC,CAACC,oBAAoB","ignoreList":[]}
@@ -29,6 +29,7 @@ const defaultContext = {
29
29
  height: DEFAULT_SHARED_VALUE
30
30
  },
31
31
  layout: DEFAULT_LAYOUT,
32
+ update: () => Promise.resolve(),
32
33
  setKeyboardHandlers: NESTED_NOOP,
33
34
  setInputHandlers: NESTED_NOOP,
34
35
  setEnabled: NOOP
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_reactNative","NOOP","NESTED_NOOP","withSharedValue","value","addListener","removeListener","modify","get","set","DEFAULT_SHARED_VALUE","DEFAULT_LAYOUT","defaultContext","enabled","animated","progress","Animated","Value","height","reanimated","layout","setKeyboardHandlers","setInputHandlers","setEnabled","KeyboardContext","exports","createContext","useKeyboardContext","context","useContext","__DEV__","console","warn"],"sources":["context.ts"],"sourcesContent":["import { createContext, useContext } from \"react\";\r\nimport { Animated } from \"react-native\";\r\n\r\nimport type {\r\n FocusedInputHandlers,\r\n FocusedInputLayoutChangedEvent,\r\n KeyboardHandlers,\r\n} from \"./types\";\r\nimport type React from \"react\";\r\nimport type { SharedValue } from \"react-native-reanimated\";\r\n\r\nexport type AnimatedContext = {\r\n progress: Animated.Value;\r\n height: Animated.AnimatedMultiplication<number>;\r\n};\r\nexport type ReanimatedContext = {\r\n progress: SharedValue<number>;\r\n height: SharedValue<number>;\r\n};\r\nexport type KeyboardAnimationContext = {\r\n enabled: boolean;\r\n animated: AnimatedContext;\r\n reanimated: ReanimatedContext;\r\n layout: SharedValue<FocusedInputLayoutChangedEvent | null>;\r\n setKeyboardHandlers: (handlers: KeyboardHandlers) => void;\r\n setInputHandlers: (handlers: FocusedInputHandlers) => void;\r\n setEnabled: React.Dispatch<React.SetStateAction<boolean>>;\r\n};\r\nconst NOOP = () => {};\r\nconst NESTED_NOOP = () => NOOP;\r\nconst withSharedValue = <T>(value: T): SharedValue<T> => ({\r\n value,\r\n addListener: NOOP,\r\n removeListener: NOOP,\r\n modify: NOOP,\r\n get: () => value,\r\n set: NOOP,\r\n});\r\nconst DEFAULT_SHARED_VALUE = withSharedValue(0);\r\nconst DEFAULT_LAYOUT = withSharedValue<FocusedInputLayoutChangedEvent | null>(\r\n null,\r\n);\r\nconst defaultContext: KeyboardAnimationContext = {\r\n enabled: true,\r\n animated: {\r\n progress: new Animated.Value(0),\r\n height: new Animated.Value(0),\r\n },\r\n reanimated: {\r\n progress: DEFAULT_SHARED_VALUE,\r\n height: DEFAULT_SHARED_VALUE,\r\n },\r\n layout: DEFAULT_LAYOUT,\r\n setKeyboardHandlers: NESTED_NOOP,\r\n setInputHandlers: NESTED_NOOP,\r\n setEnabled: NOOP,\r\n};\r\nexport const KeyboardContext = createContext(defaultContext);\r\nexport const useKeyboardContext = () => {\r\n const context = useContext(KeyboardContext);\r\n if (__DEV__ && context === defaultContext) {\r\n console.warn(\r\n \"Couldn't find real values for `KeyboardContext`. Please make sure you're inside of `KeyboardProvider` - otherwise functionality of `react-native-keyboard-controller` will not work.\",\r\n );\r\n }\r\n\r\n return context;\r\n};\r\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AA2BA,MAAME,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AACrB,MAAMC,WAAW,GAAGA,CAAA,KAAMD,IAAI;AAC9B,MAAME,eAAe,GAAOC,KAAQ,KAAsB;EACxDA,KAAK;EACLC,WAAW,EAAEJ,IAAI;EACjBK,cAAc,EAAEL,IAAI;EACpBM,MAAM,EAAEN,IAAI;EACZO,GAAG,EAAEA,CAAA,KAAMJ,KAAK;EAChBK,GAAG,EAAER;AACP,CAAC,CAAC;AACF,MAAMS,oBAAoB,GAAGP,eAAe,CAAC,CAAC,CAAC;AAC/C,MAAMQ,cAAc,GAAGR,eAAe,CACpC,IACF,CAAC;AACD,MAAMS,cAAwC,GAAG;EAC/CC,OAAO,EAAE,IAAI;EACbC,QAAQ,EAAE;IACRC,QAAQ,EAAE,IAAIC,qBAAQ,CAACC,KAAK,CAAC,CAAC,CAAC;IAC/BC,MAAM,EAAE,IAAIF,qBAAQ,CAACC,KAAK,CAAC,CAAC;EAC9B,CAAC;EACDE,UAAU,EAAE;IACVJ,QAAQ,EAAEL,oBAAoB;IAC9BQ,MAAM,EAAER;EACV,CAAC;EACDU,MAAM,EAAET,cAAc;EACtBU,mBAAmB,EAAEnB,WAAW;EAChCoB,gBAAgB,EAAEpB,WAAW;EAC7BqB,UAAU,EAAEtB;AACd,CAAC;AACM,MAAMuB,eAAe,GAAAC,OAAA,CAAAD,eAAA,gBAAG,IAAAE,oBAAa,EAACd,cAAc,CAAC;AACrD,MAAMe,kBAAkB,GAAGA,CAAA,KAAM;EACtC,MAAMC,OAAO,GAAG,IAAAC,iBAAU,EAACL,eAAe,CAAC;EAC3C,IAAIM,OAAO,IAAIF,OAAO,KAAKhB,cAAc,EAAE;IACzCmB,OAAO,CAACC,IAAI,CACV,sLACF,CAAC;EACH;EAEA,OAAOJ,OAAO;AAChB,CAAC;AAACH,OAAA,CAAAE,kBAAA,GAAAA,kBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_react","require","_reactNative","NOOP","NESTED_NOOP","withSharedValue","value","addListener","removeListener","modify","get","set","DEFAULT_SHARED_VALUE","DEFAULT_LAYOUT","defaultContext","enabled","animated","progress","Animated","Value","height","reanimated","layout","update","Promise","resolve","setKeyboardHandlers","setInputHandlers","setEnabled","KeyboardContext","exports","createContext","useKeyboardContext","context","useContext","__DEV__","console","warn"],"sources":["context.ts"],"sourcesContent":["import { createContext, useContext } from \"react\";\nimport { Animated } from \"react-native\";\n\nimport type {\n FocusedInputHandlers,\n FocusedInputLayoutChangedEvent,\n KeyboardHandlers,\n} from \"./types\";\nimport type React from \"react\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nexport type AnimatedContext = {\n progress: Animated.Value;\n height: Animated.AnimatedMultiplication<number>;\n};\nexport type ReanimatedContext = {\n progress: SharedValue<number>;\n height: SharedValue<number>;\n};\nexport type KeyboardAnimationContext = {\n enabled: boolean;\n animated: AnimatedContext;\n reanimated: ReanimatedContext;\n layout: SharedValue<FocusedInputLayoutChangedEvent | null>;\n update: () => Promise<void>;\n setKeyboardHandlers: (handlers: KeyboardHandlers) => void;\n setInputHandlers: (handlers: FocusedInputHandlers) => void;\n setEnabled: React.Dispatch<React.SetStateAction<boolean>>;\n};\nconst NOOP = () => {};\nconst NESTED_NOOP = () => NOOP;\nconst withSharedValue = <T>(value: T): SharedValue<T> => ({\n value,\n addListener: NOOP,\n removeListener: NOOP,\n modify: NOOP,\n get: () => value,\n set: NOOP,\n});\nconst DEFAULT_SHARED_VALUE = withSharedValue(0);\nconst DEFAULT_LAYOUT = withSharedValue<FocusedInputLayoutChangedEvent | null>(\n null,\n);\nconst defaultContext: KeyboardAnimationContext = {\n enabled: true,\n animated: {\n progress: new Animated.Value(0),\n height: new Animated.Value(0),\n },\n reanimated: {\n progress: DEFAULT_SHARED_VALUE,\n height: DEFAULT_SHARED_VALUE,\n },\n layout: DEFAULT_LAYOUT,\n update: () => Promise.resolve(),\n setKeyboardHandlers: NESTED_NOOP,\n setInputHandlers: NESTED_NOOP,\n setEnabled: NOOP,\n};\nexport const KeyboardContext = createContext(defaultContext);\nexport const useKeyboardContext = () => {\n const context = useContext(KeyboardContext);\n if (__DEV__ && context === defaultContext) {\n console.warn(\n \"Couldn't find real values for `KeyboardContext`. Please make sure you're inside of `KeyboardProvider` -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OAAO,KAAKnB,cAAc,EAAE;IACzCsB,OAAO,CAACC,IAAI,CACV,sLACF,CAAC;EACH;EAEA,OAAOJ,OAAO;AAChB,CAAC;AAACH,OAAA,CAAAE,kBAAA,GAAAA,kBAAA","ignoreList":[]}
@@ -37,6 +37,18 @@ Object.keys(_useWindowDimensions).forEach(function (key) {
37
37
  }
38
38
  });
39
39
  });
40
+ var _useKeyboardState = require("./useKeyboardState");
41
+ Object.keys(_useKeyboardState).forEach(function (key) {
42
+ if (key === "default" || key === "__esModule") return;
43
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
44
+ if (key in exports && exports[key] === _useKeyboardState[key]) return;
45
+ Object.defineProperty(exports, key, {
46
+ enumerable: true,
47
+ get: function () {
48
+ return _useKeyboardState[key];
49
+ }
50
+ });
51
+ });
40
52
  const useResizeMode = () => {
41
53
  (0, _react.useEffect)(() => {
42
54
  _module.KeyboardController.setInputMode(_constants.AndroidSoftInputModes.SOFT_INPUT_ADJUST_RESIZE);
@@ -84,7 +96,8 @@ function useKeyboardController() {
84
96
  function useReanimatedFocusedInput() {
85
97
  const context = (0, _context.useKeyboardContext)();
86
98
  return {
87
- input: context.layout
99
+ input: context.layout,
100
+ update: context.update
88
101
  };
89
102
  }
90
103
  function useFocusedInputHandler(handler, deps) {
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_constants","_context","_utils","_module","_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","uuid","setKeyboardHandlers","undefined","useKeyboardHandler","useKeyboardController","setEnabled","enabled","useReanimatedFocusedInput","input","layout","useFocusedInputHandler","setInputHandlers"],"sources":["index.ts"],"sourcesContent":["import { useEffect } from \"react\";\r\n\r\nimport { AndroidSoftInputModes } from \"../constants\";\r\nimport { useKeyboardContext } from \"../context\";\r\nimport { uuid } from \"../utils\";\r\nimport { KeyboardController } from \"../module\";\r\n\r\nimport type { AnimatedContext, ReanimatedContext } from \"../context\";\r\nimport type { FocusedInputHandler, KeyboardHandler } from \"../types\";\r\nimport type { DependencyList } from \"react\";\r\n\r\nexport const useResizeMode = () => {\r\n useEffect(() => {\r\n KeyboardController.setInputMode(\r\n AndroidSoftInputModes.SOFT_INPUT_ADJUST_RESIZE,\r\n );\r\n\r\n return () => KeyboardController.setDefaultMode();\r\n }, []);\r\n};\r\n\r\nexport const useKeyboardAnimation = (): AnimatedContext => {\r\n useResizeMode();\r\n const context = useKeyboardContext();\r\n\r\n return context.animated;\r\n};\r\n\r\nexport const useReanimatedKeyboardAnimation = (): ReanimatedContext => {\r\n useResizeMode();\r\n const context = useKeyboardContext();\r\n\r\n return context.reanimated;\r\n};\r\n\r\nexport function useGenericKeyboardHandler(\r\n handler: KeyboardHandler,\r\n deps?: DependencyList,\r\n) {\r\n const context = useKeyboardContext();\r\n\r\n useEffect(() => {\r\n const key = uuid();\r\n\r\n context.setKeyboardHandlers({ [key]: handler });\r\n\r\n return () => {\r\n context.setKeyboardHandlers({ [key]: undefined });\r\n };\r\n }, deps);\r\n}\r\n\r\nexport function useKeyboardHandler(\r\n handler: KeyboardHandler,\r\n deps?: DependencyList,\r\n) {\r\n useResizeMode();\r\n useGenericKeyboardHandler(handler, deps);\r\n}\r\n\r\nexport function useKeyboardController() {\r\n const context = useKeyboardContext();\r\n\r\n return { setEnabled: context.setEnabled, enabled: context.enabled };\r\n}\r\n\r\nexport function useReanimatedFocusedInput() {\r\n const context = useKeyboardContext();\r\n\r\n return { input: context.layout };\r\n}\r\n\r\nexport function useFocusedInputHandler(\r\n handler?: FocusedInputHandler,\r\n deps?: DependencyList,\r\n) {\r\n const context = useKeyboardContext();\r\n\r\n useEffect(() => {\r\n const key = uuid();\r\n\r\n context.setInputHandlers({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gBAAS,EAAC,MAAM;IACd,MAAMV,GAAG,GAAG,IAAAyB,WAAI,EAAC,CAAC;IAElBR,OAAO,CAACmB,gBAAgB,CAAC;MAAE,CAACpC,GAAG,GAAGuB;IAAQ,CAAC,CAAC;IAE5C,OAAO,MAAM;MACXN,OAAO,CAACmB,gBAAgB,CAAC;QAAE,CAACpC,GAAG,GAAG2B;MAAU,CAAC,CAAC;IAChD,CAAC;EACH,CAAC,EAAEH,IAAI,CAAC;AACV","ignoreList":[]}
1
+ {"version":3,"names":["_react","require","_constants","_context","_utils","_module","_useWindowDimensions","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_useKeyboardState","useResizeMode","useEffect","KeyboardController","setInputMode","AndroidSoftInputModes","SOFT_INPUT_ADJUST_RESIZE","setDefaultMode","useKeyboardAnimation","context","useKeyboardContext","animated","useReanimatedKeyboardAnimation","reanimated","useGenericKeyboardHandler","handler","deps","uuid","setKeyboardHandlers","undefined","useKeyboardHandler","useKeyboardController","setEnabled","enabled","useReanimatedFocusedInput","input","layout","update","useFocusedInputHandler","setInputHandlers"],"sources":["index.ts"],"sourcesContent":["import { useEffect } from \"react\";\n\nimport { AndroidSoftInputModes } from \"../constants\";\nimport { useKeyboardContext } from \"../context\";\nimport { uuid } from \"../utils\";\nimport { KeyboardController } from \"../module\";\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 useEffect(() => {\n const key = uuid();\n\n context.setKeyboardHandlers({ [key]: handler });\n\n return () => {\n context.setKeyboardHandlers({ [key]: undefined });\n };\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, update: context.update };\n}\n\nexport function useFocusedInputHandler(\n handler?: FocusedInputHandler,\n deps?: DependencyList,\n) {\n const context = useKeyboardContext();\n\n useEffect(() => {\n const key = uuid();\n\n context.setInputHandlers({ [key]: handler });\n\n return () => {\n context.setInputHandlers({ [key]: undefined });\n };\n }, deps);\n}\n\nexport * from \"./useWindowDimensions\";\nexport * from \"./useKeyboardState\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAoFA,IAAAK,oBAAA,GAAAL,OAAA;AAAAM,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;IA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gBAAgB,CAAC;QAAE,CAACtC,GAAG,GAAG4B;MAAU,CAAC,CAAC;IAChD,CAAC;EACH,CAAC,EAAEH,IAAI,CAAC;AACV","ignoreList":[]}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useKeyboardState = useKeyboardState;
7
+ var _react = require("react");
8
+ var _bindings = require("../../bindings");
9
+ var _module = require("../../module");
10
+ const EVENTS = ["keyboardDidShow", "keyboardDidHide"];
11
+ const getLatestState = () => ({
12
+ ..._module.KeyboardController.state(),
13
+ isVisible: _module.KeyboardController.isVisible()
14
+ });
15
+ const defaultSelector = state => state;
16
+ function useKeyboardState(selector = defaultSelector) {
17
+ const [state, setState] = (0, _react.useState)(() => selector(getLatestState()));
18
+ (0, _react.useEffect)(() => {
19
+ const subscriptions = EVENTS.map(event => _bindings.KeyboardEvents.addListener(event, () =>
20
+ // state will be updated by global listener first,
21
+ // so we simply read it and don't derive data from the event
22
+ setState(selector(getLatestState()))));
23
+ const willShowSubscription = _bindings.KeyboardEvents.addListener("keyboardWillShow", event => setState(selector({
24
+ ...getLatestState(),
25
+ appearance: event.appearance
26
+ })));
27
+
28
+ // we might have missed an update between reading a value in render and
29
+ // `addListener` in this handler, so we set it here. If there was
30
+ // no change, React will filter out this update as a no-op.
31
+ setState(selector(getLatestState()));
32
+ return () => {
33
+ subscriptions.forEach(subscription => subscription.remove());
34
+ willShowSubscription.remove();
35
+ };
36
+ }, []);
37
+ return state;
38
+ }
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_bindings","_module","EVENTS","getLatestState","KeyboardController","state","isVisible","defaultSelector","useKeyboardState","selector","setState","useState","useEffect","subscriptions","map","event","KeyboardEvents","addListener","willShowSubscription","appearance","forEach","subscription","remove"],"sources":["index.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nimport { KeyboardEvents } from \"../../bindings\";\nimport { KeyboardController } from \"../../module\";\n\nimport type { IKeyboardState } from \"../../types\";\n\nconst EVENTS = [\"keyboardDidShow\", \"keyboardDidHide\"] as const;\n\nconst getLatestState = () => ({\n ...KeyboardController.state(),\n isVisible: KeyboardController.isVisible(),\n});\n\ntype KeyboardStateSelector<T> = (state: IKeyboardState) => T;\n\nconst defaultSelector: KeyboardStateSelector<IKeyboardState> = (state) => state;\n\nexport function useKeyboardState<T = IKeyboardState>(\n selector: KeyboardStateSelector<T> = defaultSelector as KeyboardStateSelector<T>,\n): T {\n const [state, setState] = useState<T>(() => selector(getLatestState()));\n\n useEffect(() => {\n const subscriptions = EVENTS.map((event) =>\n KeyboardEvents.addListener(event, () =>\n // state will be updated by global listener first,\n // so we simply read it and don't derive data from the event\n setState(selector(getLatestState())),\n ),\n );\n const willShowSubscription = KeyboardEvents.addListener(\n \"keyboardWillShow\",\n (event) =>\n setState(\n selector({ ...getLatestState(), appearance: event.appearance }),\n ),\n );\n\n // we might have missed an update between reading a value in render and\n // `addListener` in this handler, so we set it here. If there was\n // no change, React will filter out this update as a no-op.\n setState(selector(getLatestState()));\n\n return () => {\n subscriptions.forEach((subscription) => subscription.remove());\n willShowSubscription.remove();\n };\n }, []);\n\n return state;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAIA,MAAMG,MAAM,GAAG,CAAC,iBAAiB,EAAE,iBAAiB,CAAU;AAE9D,MAAMC,cAAc,GAAGA,CAAA,MAAO;EAC5B,GAAGC,0BAAkB,CAACC,KAAK,CAAC,CAAC;EAC7BC,SAAS,EAAEF,0BAAkB,CAACE,SAAS,CAAC;AAC1C,CAAC,CAAC;AAIF,MAAMC,eAAsD,GAAIF,KAAK,IAAKA,KAAK;AAExE,SAASG,gBAAgBA,CAC9BC,QAAkC,GAAGF,eAA2C,EAC7E;EACH,MAAM,CAACF,KAAK,EAAEK,QAAQ,CAAC,GAAG,IAAAC,eAAQ,EAAI,MAAMF,QAAQ,CAACN,cAAc,CAAC,CAAC,CAAC,CAAC;EAEvE,IAAAS,gBAAS,EAAC,MAAM;IACd,MAAMC,aAAa,GAAGX,MAAM,CAACY,GAAG,CAAEC,KAAK,IACrCC,wBAAc,CAACC,WAAW,CAACF,KAAK,EAAE;IAChC;IACA;IACAL,QAAQ,CAACD,QAAQ,CAACN,cAAc,CAAC,CAAC,CAAC,CACrC,CACF,CAAC;IACD,MAAMe,oBAAoB,GAAGF,wBAAc,CAACC,WAAW,CACrD,kBAAkB,EACjBF,KAAK,IACJL,QAAQ,CACND,QAAQ,CAAC;MAAE,GAAGN,cAAc,CAAC,CAAC;MAAEgB,UAAU,EAAEJ,KAAK,CAACI;IAAW,CAAC,CAChE,CACJ,CAAC;;IAED;IACA;IACA;IACAT,QAAQ,CAACD,QAAQ,CAACN,cAAc,CAAC,CAAC,CAAC,CAAC;IAEpC,OAAO,MAAM;MACXU,aAAa,CAACO,OAAO,CAAEC,YAAY,IAAKA,YAAY,CAACC,MAAM,CAAC,CAAC,CAAC;MAC9DJ,oBAAoB,CAACI,MAAM,CAAC,CAAC;IAC/B,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOjB,KAAK;AACd","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_bindings","initialDimensions","width","height","WindowDimensionsEvents","addListener","e","useWindowDimensions","dimensions","setDimensions","useState","useEffect","subscription","remove","exports"],"sources":["index.android.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\r\n\r\nimport { WindowDimensionsEvents } from \"../../bindings\";\r\n\r\nimport type { WindowDimensionsEventData } from \"../../types\";\r\n\r\nlet initialDimensions: WindowDimensionsEventData = {\r\n width: 0,\r\n height: 0,\r\n};\r\n\r\nWindowDimensionsEvents.addListener(\"windowDidResize\", (e) => {\r\n initialDimensions = e;\r\n});\r\n\r\nexport const useWindowDimensions = () => {\r\n const [dimensions, setDimensions] = useState(initialDimensions);\r\n\r\n useEffect(() => {\r\n const subscription = WindowDimensionsEvents.addListener(\r\n \"windowDidResize\",\r\n (e) => {\r\n setDimensions(e);\r\n },\r\n );\r\n\r\n // we might have missed an update between reading a value in render and\r\n // `addListener` in this handler, so we set it here. If there was\r\n // no change, React will filter out this update as a no-op.\r\n setDimensions(initialDimensions);\r\n\r\n return () => {\r\n subscription.remove();\r\n };\r\n }, []);\r\n\r\n return dimensions;\r\n};\r\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAIA,IAAIE,iBAA4C,GAAG;EACjDC,KAAK,EAAE,CAAC;EACRC,MAAM,EAAE;AACV,CAAC;AAEDC,gCAAsB,CAACC,WAAW,CAAC,iBAAiB,EAAGC,CAAC,IAAK;EAC3DL,iBAAiB,GAAGK,CAAC;AACvB,CAAC,CAAC;AAEK,MAAMC,mBAAmB,GAAGA,CAAA,KAAM;EACvC,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAG,IAAAC,eAAQ,EAACT,iBAAiB,CAAC;EAE/D,IAAAU,gBAAS,EAAC,MAAM;IACd,MAAMC,YAAY,GAAGR,gCAAsB,CAACC,WAAW,CACrD,iBAAiB,EAChBC,CAAC,IAAK;MACLG,aAAa,CAACH,CAAC,CAAC;IAClB,CACF,CAAC;;IAED;IACA;IACA;IACAG,aAAa,CAACR,iBAAiB,CAAC;IAEhC,OAAO,MAAM;MACXW,YAAY,CAACC,MAAM,CAAC,CAAC;IACvB,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOL,UAAU;AACnB,CAAC;AAACM,OAAA,CAAAP,mBAAA,GAAAA,mBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_react","require","_bindings","initialDimensions","width","height","WindowDimensionsEvents","addListener","e","useWindowDimensions","dimensions","setDimensions","useState","useEffect","subscription","remove","exports"],"sources":["index.android.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nimport { WindowDimensionsEvents } from \"../../bindings\";\n\nimport type { WindowDimensionsEventData } from \"../../types\";\n\nlet initialDimensions: WindowDimensionsEventData = {\n width: 0,\n height: 0,\n};\n\nWindowDimensionsEvents.addListener(\"windowDidResize\", (e) => {\n initialDimensions = e;\n});\n\nexport const useWindowDimensions = () => {\n const [dimensions, setDimensions] = useState(initialDimensions);\n\n useEffect(() => {\n const subscription = WindowDimensionsEvents.addListener(\n \"windowDidResize\",\n (e) => {\n setDimensions(e);\n },\n );\n\n // we might have missed an update between reading a value in render and\n // `addListener` in this handler, so we set it here. If there was\n // no change, React will filter out this update as a no-op.\n setDimensions(initialDimensions);\n\n return () => {\n subscription.remove();\n };\n }, []);\n\n return dimensions;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAIA,IAAIE,iBAA4C,GAAG;EACjDC,KAAK,EAAE,CAAC;EACRC,MAAM,EAAE;AACV,CAAC;AAEDC,gCAAsB,CAACC,WAAW,CAAC,iBAAiB,EAAGC,CAAC,IAAK;EAC3DL,iBAAiB,GAAGK,CAAC;AACvB,CAAC,CAAC;AAEK,MAAMC,mBAAmB,GAAGA,CAAA,KAAM;EACvC,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAG,IAAAC,eAAQ,EAACT,iBAAiB,CAAC;EAE/D,IAAAU,gBAAS,EAAC,MAAM;IACd,MAAMC,YAAY,GAAGR,gCAAsB,CAACC,WAAW,CACrD,iBAAiB,EAChBC,CAAC,IAAK;MACLG,aAAa,CAACH,CAAC,CAAC;IAClB,CACF,CAAC;;IAED;IACA;IACA;IACAG,aAAa,CAACR,iBAAiB,CAAC;IAEhC,OAAO,MAAM;MACXW,YAAY,CAACC,MAAM,CAAC,CAAC;IACvB,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOL,UAAU;AACnB,CAAC;AAACM,OAAA,CAAAP,mBAAA,GAAAA,mBAAA","ignoreList":[]}