@react-native-ohos/react-native-keyboard-controller 1.16.8 → 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 (352) hide show
  1. package/README.OpenSource +2 -2
  2. package/README.md +105 -29
  3. package/harmony/keyboard_controller/BuildProfile.ets +1 -1
  4. package/harmony/keyboard_controller/Index.ets +1 -0
  5. package/harmony/keyboard_controller/oh-package-lock.json5 +7 -7
  6. package/harmony/keyboard_controller/oh-package.json5 +1 -1
  7. package/harmony/keyboard_controller/src/main/cpp/ClippingScrollViewComponentDescriptor.h +86 -0
  8. package/harmony/keyboard_controller/src/main/cpp/ClippingScrollViewComponentInstance.cpp +104 -0
  9. package/harmony/keyboard_controller/src/main/cpp/ClippingScrollViewComponentInstance.h +64 -0
  10. package/harmony/keyboard_controller/src/main/cpp/ClippingScrollViewJSIBinder.h +60 -0
  11. package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.cpp +8 -1
  12. package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.cpp +2 -2
  13. package/harmony/keyboard_controller/src/main/cpp/KeyboardToolbarGroupViewComponentDescriptor.h +46 -0
  14. package/harmony/keyboard_controller/src/main/cpp/KeyboardToolbarGroupViewComponentInstance.cpp +37 -0
  15. package/harmony/keyboard_controller/src/main/cpp/KeyboardToolbarGroupViewComponentInstance.h +32 -0
  16. package/harmony/keyboard_controller/src/main/cpp/KeyboardToolbarGroupViewJSIBinder.h +23 -0
  17. package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.cpp +58 -1
  18. package/harmony/keyboard_controller/src/main/cpp/RNKeyboardControllerPackage.h +20 -0
  19. package/harmony/keyboard_controller/src/main/cpp/ViewHierarchyNavigator.cpp +65 -44
  20. package/harmony/keyboard_controller/src/main/cpp/ViewHierarchyNavigator.h +22 -3
  21. package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.cpp +17 -4
  22. package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.h +9 -1
  23. package/harmony/keyboard_controller/src/main/ets/{RNKeyboardControllerPackage.ts → RNKeyboardControllerPackage.ets} +9 -5
  24. package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerTurboModule.ts +29 -5
  25. package/harmony/keyboard_controller/src/main/ets/Type.ts +2 -1
  26. package/harmony/keyboard_controller.har +0 -0
  27. package/lib/commonjs/animated.js +20 -9
  28. package/lib/commonjs/animated.js.map +1 -1
  29. package/lib/commonjs/architecture.js +8 -0
  30. package/lib/commonjs/architecture.js.map +1 -0
  31. package/lib/commonjs/bindings.js +37 -2
  32. package/lib/commonjs/bindings.js.map +1 -1
  33. package/lib/commonjs/bindings.native.js +25 -2
  34. package/lib/commonjs/bindings.native.js.map +1 -1
  35. package/lib/commonjs/compat.js +50 -0
  36. package/lib/commonjs/compat.js.map +1 -0
  37. package/lib/commonjs/components/KeyboardAvoidingView/hooks.js +21 -15
  38. package/lib/commonjs/components/KeyboardAvoidingView/hooks.js.map +1 -1
  39. package/lib/commonjs/components/KeyboardAvoidingView/index.js +36 -11
  40. package/lib/commonjs/components/KeyboardAvoidingView/index.js.map +1 -1
  41. package/lib/commonjs/components/KeyboardAwareScrollView/index.js +51 -16
  42. package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
  43. package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +2 -2
  44. package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
  45. package/lib/commonjs/components/KeyboardChatScrollView/hooks.js +13 -0
  46. package/lib/commonjs/components/KeyboardChatScrollView/hooks.js.map +1 -0
  47. package/lib/commonjs/components/KeyboardChatScrollView/index.js +122 -0
  48. package/lib/commonjs/components/KeyboardChatScrollView/index.js.map +1 -0
  49. package/lib/commonjs/components/KeyboardChatScrollView/types.js +6 -0
  50. package/lib/commonjs/components/KeyboardChatScrollView/types.js.map +1 -0
  51. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/helpers.js +221 -0
  52. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/helpers.js.map +1 -0
  53. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js +149 -0
  54. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js.map +1 -0
  55. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.js +240 -0
  56. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.js.map +1 -0
  57. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/types.js +6 -0
  58. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/types.js.map +1 -0
  59. package/lib/commonjs/components/KeyboardChatScrollView/useEndVisible.js +40 -0
  60. package/lib/commonjs/components/KeyboardChatScrollView/useEndVisible.js.map +1 -0
  61. package/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js +92 -0
  62. package/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js.map +1 -0
  63. package/lib/commonjs/components/KeyboardToolbar/Arrow.js +2 -3
  64. package/lib/commonjs/components/KeyboardToolbar/Arrow.js.map +1 -1
  65. package/lib/commonjs/components/KeyboardToolbar/Button.js +2 -3
  66. package/lib/commonjs/components/KeyboardToolbar/Button.js.map +1 -1
  67. package/lib/commonjs/components/KeyboardToolbar/compound/components/Background.js +13 -0
  68. package/lib/commonjs/components/KeyboardToolbar/compound/components/Background.js.map +1 -0
  69. package/lib/commonjs/components/KeyboardToolbar/compound/components/Content.js +25 -0
  70. package/lib/commonjs/components/KeyboardToolbar/compound/components/Content.js.map +1 -0
  71. package/lib/commonjs/components/KeyboardToolbar/compound/components/Done.js +58 -0
  72. package/lib/commonjs/components/KeyboardToolbar/compound/components/Done.js.map +1 -0
  73. package/lib/commonjs/components/KeyboardToolbar/compound/components/Next.js +49 -0
  74. package/lib/commonjs/components/KeyboardToolbar/compound/components/Next.js.map +1 -0
  75. package/lib/commonjs/components/KeyboardToolbar/compound/components/Prev.js +49 -0
  76. package/lib/commonjs/components/KeyboardToolbar/compound/components/Prev.js.map +1 -0
  77. package/lib/commonjs/components/KeyboardToolbar/compound/components/index.js +42 -0
  78. package/lib/commonjs/components/KeyboardToolbar/compound/components/index.js.map +1 -0
  79. package/lib/commonjs/components/KeyboardToolbar/compound/components/types.js +6 -0
  80. package/lib/commonjs/components/KeyboardToolbar/compound/components/types.js.map +1 -0
  81. package/lib/commonjs/components/KeyboardToolbar/compound/context.js +17 -0
  82. package/lib/commonjs/components/KeyboardToolbar/compound/context.js.map +1 -0
  83. package/lib/commonjs/components/KeyboardToolbar/constants.js +17 -0
  84. package/lib/commonjs/components/KeyboardToolbar/constants.js.map +1 -0
  85. package/lib/commonjs/components/KeyboardToolbar/index.js +95 -84
  86. package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -1
  87. package/lib/commonjs/components/KeyboardToolbar/types.js.map +1 -1
  88. package/lib/commonjs/components/ScrollViewWithBottomPadding/index.js +120 -0
  89. package/lib/commonjs/components/ScrollViewWithBottomPadding/index.js.map +1 -0
  90. package/lib/commonjs/components/ScrollViewWithBottomPadding/styles.js +15 -0
  91. package/lib/commonjs/components/ScrollViewWithBottomPadding/styles.js.map +1 -0
  92. package/lib/commonjs/components/hooks/useColorScheme.js +1 -1
  93. package/lib/commonjs/components/hooks/useColorScheme.js.map +1 -1
  94. package/lib/commonjs/components/hooks/useCombinedRef.js +24 -0
  95. package/lib/commonjs/components/hooks/useCombinedRef.js.map +1 -0
  96. package/lib/commonjs/components/hooks/useScrollState.js +62 -0
  97. package/lib/commonjs/components/hooks/useScrollState.js.map +1 -0
  98. package/lib/commonjs/components/index.js +7 -0
  99. package/lib/commonjs/components/index.js.map +1 -1
  100. package/lib/commonjs/constants.js +3 -1
  101. package/lib/commonjs/constants.js.map +1 -1
  102. package/lib/commonjs/context.js +1 -0
  103. package/lib/commonjs/context.js.map +1 -1
  104. package/lib/commonjs/hooks/index.js +14 -1
  105. package/lib/commonjs/hooks/index.js.map +1 -1
  106. package/lib/commonjs/hooks/useKeyboardState/index.js +39 -0
  107. package/lib/commonjs/hooks/useKeyboardState/index.js.map +1 -0
  108. package/lib/commonjs/index.js +27 -1
  109. package/lib/commonjs/index.js.map +1 -1
  110. package/lib/commonjs/internal.js +36 -0
  111. package/lib/commonjs/internal.js.map +1 -1
  112. package/lib/commonjs/module.js +21 -12
  113. package/lib/commonjs/module.js.map +1 -1
  114. package/lib/commonjs/specs/ClippingScrollViewDecoratorViewNativeComponent.js +12 -0
  115. package/lib/commonjs/specs/ClippingScrollViewDecoratorViewNativeComponent.js.map +1 -0
  116. package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js +8 -2
  117. package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js.map +1 -1
  118. package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js +2 -1
  119. package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js.map +1 -1
  120. package/lib/commonjs/specs/KeyboardToolbarGroupViewNativeComponent.js +12 -0
  121. package/lib/commonjs/specs/KeyboardToolbarGroupViewNativeComponent.js.map +1 -0
  122. package/lib/commonjs/specs/NativeKeyboardController.js.map +1 -1
  123. package/lib/commonjs/types.js.map +1 -1
  124. package/lib/commonjs/utils/findNodeHandle/index.js +9 -0
  125. package/lib/commonjs/utils/findNodeHandle/index.js.map +1 -0
  126. package/lib/commonjs/utils/findNodeHandle/index.native.js +13 -0
  127. package/lib/commonjs/utils/findNodeHandle/index.native.js.map +1 -0
  128. package/lib/commonjs/views/KeyboardExtender/index.js +30 -0
  129. package/lib/commonjs/views/KeyboardExtender/index.js.map +1 -0
  130. package/lib/commonjs/views/index.js +7 -0
  131. package/lib/commonjs/views/index.js.map +1 -1
  132. package/lib/module/animated.js +22 -11
  133. package/lib/module/animated.js.map +1 -1
  134. package/lib/module/architecture.js +2 -0
  135. package/lib/module/architecture.js.map +1 -0
  136. package/lib/module/bindings.js +36 -2
  137. package/lib/module/bindings.js.map +1 -1
  138. package/lib/module/bindings.native.js +24 -2
  139. package/lib/module/bindings.native.js.map +1 -1
  140. package/lib/module/compat.js +43 -0
  141. package/lib/module/compat.js.map +1 -0
  142. package/lib/module/components/KeyboardAvoidingView/hooks.js +22 -16
  143. package/lib/module/components/KeyboardAvoidingView/hooks.js.map +1 -1
  144. package/lib/module/components/KeyboardAvoidingView/index.js +35 -11
  145. package/lib/module/components/KeyboardAvoidingView/index.js.map +1 -1
  146. package/lib/module/components/KeyboardAwareScrollView/index.js +54 -19
  147. package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -1
  148. package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +2 -2
  149. package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
  150. package/lib/module/components/KeyboardChatScrollView/hooks.js +2 -0
  151. package/lib/module/components/KeyboardChatScrollView/hooks.js.map +1 -0
  152. package/lib/module/components/KeyboardChatScrollView/index.js +115 -0
  153. package/lib/module/components/KeyboardChatScrollView/index.js.map +1 -0
  154. package/lib/module/components/KeyboardChatScrollView/types.js +2 -0
  155. package/lib/module/components/KeyboardChatScrollView/types.js.map +1 -0
  156. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/helpers.js +207 -0
  157. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/helpers.js.map +1 -0
  158. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js +143 -0
  159. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js.map +1 -0
  160. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.js +234 -0
  161. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.js.map +1 -0
  162. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/types.js +2 -0
  163. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/types.js.map +1 -0
  164. package/lib/module/components/KeyboardChatScrollView/useEndVisible.js +33 -0
  165. package/lib/module/components/KeyboardChatScrollView/useEndVisible.js.map +1 -0
  166. package/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js +87 -0
  167. package/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js.map +1 -0
  168. package/lib/module/components/KeyboardToolbar/Arrow.js +2 -2
  169. package/lib/module/components/KeyboardToolbar/Arrow.js.map +1 -1
  170. package/lib/module/components/KeyboardToolbar/Button.js +2 -2
  171. package/lib/module/components/KeyboardToolbar/Button.js.map +1 -1
  172. package/lib/module/components/KeyboardToolbar/compound/components/Background.js +6 -0
  173. package/lib/module/components/KeyboardToolbar/compound/components/Background.js.map +1 -0
  174. package/lib/module/components/KeyboardToolbar/compound/components/Content.js +18 -0
  175. package/lib/module/components/KeyboardToolbar/compound/components/Content.js.map +1 -0
  176. package/lib/module/components/KeyboardToolbar/compound/components/Done.js +50 -0
  177. package/lib/module/components/KeyboardToolbar/compound/components/Done.js.map +1 -0
  178. package/lib/module/components/KeyboardToolbar/compound/components/Next.js +41 -0
  179. package/lib/module/components/KeyboardToolbar/compound/components/Next.js.map +1 -0
  180. package/lib/module/components/KeyboardToolbar/compound/components/Prev.js +41 -0
  181. package/lib/module/components/KeyboardToolbar/compound/components/Prev.js.map +1 -0
  182. package/lib/module/components/KeyboardToolbar/compound/components/index.js +6 -0
  183. package/lib/module/components/KeyboardToolbar/compound/components/index.js.map +1 -0
  184. package/lib/module/components/KeyboardToolbar/compound/components/types.js +2 -0
  185. package/lib/module/components/KeyboardToolbar/compound/components/types.js.map +1 -0
  186. package/lib/module/components/KeyboardToolbar/compound/context.js +10 -0
  187. package/lib/module/components/KeyboardToolbar/compound/context.js.map +1 -0
  188. package/lib/module/components/KeyboardToolbar/constants.js +11 -0
  189. package/lib/module/components/KeyboardToolbar/constants.js.map +1 -0
  190. package/lib/module/components/KeyboardToolbar/index.js +95 -85
  191. package/lib/module/components/KeyboardToolbar/index.js.map +1 -1
  192. package/lib/module/components/KeyboardToolbar/types.js.map +1 -1
  193. package/lib/module/components/ScrollViewWithBottomPadding/index.js +112 -0
  194. package/lib/module/components/ScrollViewWithBottomPadding/index.js.map +1 -0
  195. package/lib/module/components/ScrollViewWithBottomPadding/styles.js +9 -0
  196. package/lib/module/components/ScrollViewWithBottomPadding/styles.js.map +1 -0
  197. package/lib/module/components/hooks/useColorScheme.js +1 -1
  198. package/lib/module/components/hooks/useColorScheme.js.map +1 -1
  199. package/lib/module/components/hooks/useCombinedRef.js +18 -0
  200. package/lib/module/components/hooks/useCombinedRef.js.map +1 -0
  201. package/lib/module/components/hooks/useScrollState.js +56 -0
  202. package/lib/module/components/hooks/useScrollState.js.map +1 -0
  203. package/lib/module/components/index.js +1 -0
  204. package/lib/module/components/index.js.map +1 -1
  205. package/lib/module/constants.js +3 -0
  206. package/lib/module/constants.js.map +1 -1
  207. package/lib/module/context.js +1 -0
  208. package/lib/module/context.js.map +1 -1
  209. package/lib/module/hooks/index.js +3 -1
  210. package/lib/module/hooks/index.js.map +1 -1
  211. package/lib/module/hooks/useKeyboardState/index.js +33 -0
  212. package/lib/module/hooks/useKeyboardState/index.js.map +1 -0
  213. package/lib/module/index.js +3 -2
  214. package/lib/module/index.js.map +1 -1
  215. package/lib/module/internal.js +35 -0
  216. package/lib/module/internal.js.map +1 -1
  217. package/lib/module/module.js +21 -12
  218. package/lib/module/module.js.map +1 -1
  219. package/lib/module/specs/ClippingScrollViewDecoratorViewNativeComponent.js +6 -0
  220. package/lib/module/specs/ClippingScrollViewDecoratorViewNativeComponent.js.map +1 -0
  221. package/lib/module/specs/KeyboardControllerViewNativeComponent.js +7 -1
  222. package/lib/module/specs/KeyboardControllerViewNativeComponent.js.map +1 -1
  223. package/lib/module/specs/KeyboardGestureAreaNativeComponent.js +2 -1
  224. package/lib/module/specs/KeyboardGestureAreaNativeComponent.js.map +1 -1
  225. package/lib/module/specs/KeyboardToolbarGroupViewNativeComponent.js +5 -0
  226. package/lib/module/specs/KeyboardToolbarGroupViewNativeComponent.js.map +1 -0
  227. package/lib/module/specs/NativeKeyboardController.js.map +1 -1
  228. package/lib/module/types.js.map +1 -1
  229. package/lib/module/utils/findNodeHandle/index.js +2 -0
  230. package/lib/module/utils/findNodeHandle/index.js.map +1 -0
  231. package/lib/module/utils/findNodeHandle/index.native.js +3 -0
  232. package/lib/module/utils/findNodeHandle/index.native.js.map +1 -0
  233. package/lib/module/views/KeyboardExtender/index.js +23 -0
  234. package/lib/module/views/KeyboardExtender/index.js.map +1 -0
  235. package/lib/module/views/index.js +1 -0
  236. package/lib/module/views/index.js.map +1 -1
  237. package/lib/typescript/animated.d.ts +2 -38
  238. package/lib/typescript/architecture.d.ts +1 -0
  239. package/lib/typescript/bindings.d.ts +15 -1
  240. package/lib/typescript/bindings.native.d.ts +10 -1
  241. package/lib/typescript/compat.d.ts +12 -0
  242. package/lib/typescript/components/KeyboardAvoidingView/index.d.ts +5 -0
  243. package/lib/typescript/components/KeyboardAwareScrollView/index.d.ts +4 -1
  244. package/lib/typescript/components/KeyboardChatScrollView/hooks.d.ts +2 -0
  245. package/lib/typescript/components/KeyboardChatScrollView/index.d.ts +17 -0
  246. package/lib/typescript/components/KeyboardChatScrollView/types.d.ts +113 -0
  247. package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/helpers.d.ts +132 -0
  248. package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/index.d.ts +18 -0
  249. package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/index.ios.d.ts +21 -0
  250. package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/types.d.ts +37 -0
  251. package/lib/typescript/components/KeyboardChatScrollView/useEndVisible.d.ts +17 -0
  252. package/lib/typescript/components/KeyboardChatScrollView/useExtraContentPadding/index.d.ts +45 -0
  253. package/lib/typescript/components/KeyboardToolbar/Button.d.ts +2 -2
  254. package/lib/typescript/components/KeyboardToolbar/compound/components/Background.d.ts +6 -0
  255. package/lib/typescript/components/KeyboardToolbar/compound/components/Content.d.ts +7 -0
  256. package/lib/typescript/components/KeyboardToolbar/compound/components/Done.d.ts +7 -0
  257. package/lib/typescript/components/KeyboardToolbar/compound/components/Next.d.ts +4 -0
  258. package/lib/typescript/components/KeyboardToolbar/compound/components/Prev.d.ts +4 -0
  259. package/lib/typescript/components/KeyboardToolbar/compound/components/index.d.ts +5 -0
  260. package/lib/typescript/components/KeyboardToolbar/compound/components/types.d.ts +14 -0
  261. package/lib/typescript/components/KeyboardToolbar/compound/context.d.ts +9 -0
  262. package/lib/typescript/components/KeyboardToolbar/constants.d.ts +10 -0
  263. package/lib/typescript/components/KeyboardToolbar/index.d.ts +12 -45
  264. package/lib/typescript/components/KeyboardToolbar/types.d.ts +24 -1
  265. package/lib/typescript/components/ScrollViewWithBottomPadding/index.d.ts +30 -0
  266. package/lib/typescript/components/ScrollViewWithBottomPadding/styles.d.ts +7 -0
  267. package/lib/typescript/components/hooks/useCombinedRef.d.ts +3 -0
  268. package/lib/typescript/components/hooks/useScrollState.d.ts +17 -0
  269. package/lib/typescript/components/index.d.ts +3 -0
  270. package/lib/typescript/constants.d.ts +1 -0
  271. package/lib/typescript/context.d.ts +1 -0
  272. package/lib/typescript/hooks/index.d.ts +2 -0
  273. package/lib/typescript/hooks/useKeyboardState/index.d.ts +4 -0
  274. package/lib/typescript/index.d.ts +4 -3
  275. package/lib/typescript/internal.d.ts +4 -0
  276. package/lib/typescript/specs/ClippingScrollViewDecoratorViewNativeComponent.d.ts +10 -0
  277. package/lib/typescript/specs/KeyboardControllerViewNativeComponent.d.ts +4 -0
  278. package/lib/typescript/specs/KeyboardToolbarGroupViewNativeComponent.d.ts +6 -0
  279. package/lib/typescript/specs/NativeKeyboardController.d.ts +6 -2
  280. package/lib/typescript/types.d.ts +80 -5
  281. package/lib/typescript/utils/findNodeHandle/index.d.ts +4 -0
  282. package/lib/typescript/utils/findNodeHandle/index.native.d.ts +2 -0
  283. package/lib/typescript/views/KeyboardExtender/index.d.ts +5 -0
  284. package/lib/typescript/views/index.d.ts +1 -0
  285. package/package.json +15 -9
  286. package/src/animated.tsx +41 -48
  287. package/src/architecture.ts +1 -0
  288. package/src/bindings.native.ts +37 -2
  289. package/src/bindings.ts +40 -1
  290. package/src/compat.ts +44 -0
  291. package/src/components/KeyboardAvoidingView/hooks.ts +24 -17
  292. package/src/components/KeyboardAvoidingView/index.tsx +62 -18
  293. package/src/components/KeyboardAwareScrollView/index.tsx +75 -20
  294. package/src/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.ts +2 -2
  295. package/src/components/KeyboardChatScrollView/hooks.ts +2 -0
  296. package/src/components/KeyboardChatScrollView/index.tsx +164 -0
  297. package/src/components/KeyboardChatScrollView/types.ts +117 -0
  298. package/src/components/KeyboardChatScrollView/useChatKeyboard/helpers.ts +268 -0
  299. package/src/components/KeyboardChatScrollView/useChatKeyboard/index.ios.ts +260 -0
  300. package/src/components/KeyboardChatScrollView/useChatKeyboard/index.ts +374 -0
  301. package/src/components/KeyboardChatScrollView/useChatKeyboard/types.ts +39 -0
  302. package/src/components/KeyboardChatScrollView/useEndVisible.ts +66 -0
  303. package/src/components/KeyboardChatScrollView/useExtraContentPadding/index.ts +149 -0
  304. package/src/components/KeyboardToolbar/Arrow.tsx +2 -2
  305. package/src/components/KeyboardToolbar/Button.tsx +4 -4
  306. package/src/components/KeyboardToolbar/compound/components/Background.tsx +9 -0
  307. package/src/components/KeyboardToolbar/compound/components/Content.tsx +25 -0
  308. package/src/components/KeyboardToolbar/compound/components/Done.tsx +57 -0
  309. package/src/components/KeyboardToolbar/compound/components/Next.tsx +49 -0
  310. package/src/components/KeyboardToolbar/compound/components/Prev.tsx +49 -0
  311. package/src/components/KeyboardToolbar/compound/components/index.ts +5 -0
  312. package/src/components/KeyboardToolbar/compound/components/types.ts +15 -0
  313. package/src/components/KeyboardToolbar/compound/context.ts +25 -0
  314. package/src/components/KeyboardToolbar/constants.ts +14 -0
  315. package/src/components/KeyboardToolbar/index.tsx +143 -146
  316. package/src/components/KeyboardToolbar/types.ts +33 -1
  317. package/src/components/ScrollViewWithBottomPadding/index.tsx +216 -0
  318. package/src/components/ScrollViewWithBottomPadding/styles.ts +10 -0
  319. package/src/components/hooks/useColorScheme.ts +2 -1
  320. package/src/components/hooks/useCombinedRef.ts +22 -0
  321. package/src/components/hooks/useScrollState.ts +81 -0
  322. package/src/components/index.ts +3 -0
  323. package/src/constants.ts +4 -0
  324. package/src/context.ts +2 -0
  325. package/src/hooks/index.ts +2 -1
  326. package/src/hooks/useKeyboardState/index.ts +52 -0
  327. package/src/index.ts +5 -1
  328. package/src/internal.ts +62 -0
  329. package/src/module.ts +21 -9
  330. package/src/specs/ClippingScrollViewDecoratorViewNativeComponent.ts +19 -0
  331. package/src/specs/KeyboardControllerViewNativeComponent.ts +14 -3
  332. package/src/specs/KeyboardGestureAreaNativeComponent.ts +1 -0
  333. package/src/specs/KeyboardToolbarGroupViewNativeComponent.ts +10 -0
  334. package/src/specs/NativeKeyboardController.ts +6 -2
  335. package/src/types.ts +91 -5
  336. package/src/utils/findNodeHandle/index.native.ts +3 -0
  337. package/src/utils/findNodeHandle/index.ts +6 -0
  338. package/src/views/KeyboardExtender/index.tsx +30 -0
  339. package/src/views/index.ts +1 -0
  340. package/lib/commonjs/monkey-patch.android.js +0 -57
  341. package/lib/commonjs/monkey-patch.android.js.map +0 -1
  342. package/lib/commonjs/monkey-patch.js +0 -11
  343. package/lib/commonjs/monkey-patch.js.map +0 -1
  344. package/lib/module/monkey-patch.android.js +0 -47
  345. package/lib/module/monkey-patch.android.js.map +0 -1
  346. package/lib/module/monkey-patch.js +0 -5
  347. package/lib/module/monkey-patch.js.map +0 -1
  348. package/lib/typescript/monkey-patch.android.d.ts +0 -2
  349. package/lib/typescript/monkey-patch.d.ts +0 -2
  350. package/src/monkey-patch.android.ts +0 -44
  351. package/src/monkey-patch.ts +0 -4
  352. /package/harmony/keyboard_controller/{ts.ts → ts.ets} +0 -0
@@ -1 +1 @@
1
- {"version":3,"names":["React","useCallback","useEffect","useMemo","useState","StyleSheet","Text","View","FocusedInputEvents","KeyboardStickyView","KeyboardControllerNative","useColorScheme","Arrow","Button","colors","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","dismiss","goToNextField","setFocusTo","goToPrevField","KeyboardToolbar","content","theme","doneText","button","icon","showArrows","onNextCallback","onPrevCallback","onDoneCallback","blur","opacity","offset","closed","opened","enabled","rest","colorScheme","inputs","setInputs","current","count","isPrevDisabled","isNextDisabled","subscription","addListener","e","remove","doneStyle","styles","doneButton","color","primary","toolbarStyle","toolbar","backgroundColor","background","ButtonContainer","IconContainer","onPressNext","onPressPrev","onPressDone","createElement","_extends","style","testID","Fragment","accessibilityLabel","accessibilityHint","disabled","onPress","type","flex","rippleRadius","doneButtonContainer","maxFontSizeMultiplier","create","position","bottom","alignItems","width","flexDirection","height","paddingHorizontal","fontWeight","fontSize","marginRight","DefaultKeyboardToolbarTheme"],"sources":["index.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { StyleSheet, Text, View } from \"react-native\";\n\nimport {\n FocusedInputEvents,\n} from \"../../bindings\";\nimport KeyboardStickyView from \"../KeyboardStickyView\"\nimport { KeyboardControllerNative } from \"../../bindings\";\nimport useColorScheme from \"../hooks/useColorScheme\";\n\nimport Arrow from \"./Arrow\";\nimport Button from \"./Button\";\nimport { colors } from \"./colors\";\n\nimport type { HEX, KeyboardToolbarTheme } from \"./types\";\nimport type { KeyboardStickyViewProps } from \"../KeyboardStickyView\";\nimport type { ReactNode } from \"react\";\nimport type { ViewProps } from \"react-native\";\n\nexport type KeyboardToolbarProps = Omit<\n ViewProps,\n \"style\" | \"testID\" | \"children\"\n> & {\n /** An element that is shown in the middle of the toolbar. */\n content?: JSX.Element | null;\n /** A set of dark/light colors consumed by toolbar component. */\n theme?: KeyboardToolbarTheme;\n /** Custom text for done button. */\n doneText?: ReactNode;\n /** Custom touchable component for toolbar (used for prev/next/done buttons). */\n button?: typeof Button;\n /** Custom icon component used to display next/prev buttons. */\n icon?: typeof Arrow;\n /**\n * Whether to show next and previous buttons. Can be useful to set it to `false` if you have only one input\n * and want to show only `Done` button. Default to `true`.\n */\n showArrows?: boolean;\n /**\n * A callback that is called when the user presses the next button along with the default action.\n */\n onNextCallback?: () => void;\n /**\n * A callback that is called when the user presses the previous button along with the default action.\n */\n onPrevCallback?: () => void;\n /**\n * A callback that is called when the user presses the done button along with the default action.\n */\n onDoneCallback?: () => void;\n /**\n * A component that applies blur effect to the toolbar.\n */\n blur?: JSX.Element | null;\n /**\n * A value for container opacity in hexadecimal format (e.g. `ff`). Default value is `ff`.\n */\n opacity?: HEX;\n} & Pick<KeyboardStickyViewProps, \"offset\" | \"enabled\">;\n\nconst TEST_ID_KEYBOARD_TOOLBAR = \"keyboard.toolbar\";\nconst TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS = `${TEST_ID_KEYBOARD_TOOLBAR}.previous`;\nconst TEST_ID_KEYBOARD_TOOLBAR_NEXT = `${TEST_ID_KEYBOARD_TOOLBAR}.next`;\nconst TEST_ID_KEYBOARD_TOOLBAR_CONTENT = `${TEST_ID_KEYBOARD_TOOLBAR}.content`;\nconst TEST_ID_KEYBOARD_TOOLBAR_DONE = `${TEST_ID_KEYBOARD_TOOLBAR}.done`;\n\nconst KEYBOARD_TOOLBAR_HEIGHT = 42;\nconst DEFAULT_OPACITY: HEX = \"FF\";\n\nconst dismissKeyboard = () => KeyboardControllerNative.dismiss(false);\nconst goToNextField = () => KeyboardControllerNative.setFocusTo(\"next\");\nconst goToPrevField = () => KeyboardControllerNative.setFocusTo(\"prev\");\n\n/**\n * `KeyboardToolbar` is a component that is shown above the keyboard with `Prev`/`Next` and\n * `Done` buttons.\n */\nconst KeyboardToolbar: React.FC<KeyboardToolbarProps> = ({\n content,\n theme = colors,\n doneText,\n button,\n icon,\n showArrows = true,\n onNextCallback,\n onPrevCallback,\n onDoneCallback,\n blur = null,\n opacity = DEFAULT_OPACITY,\n offset: { closed = 0, opened = 0 } = {},\n enabled = true,\n ...rest\n}) => {\n const colorScheme = useColorScheme();\n const [inputs, setInputs] = useState({\n current: 0,\n count: 0,\n });\n const isPrevDisabled = inputs.current === 0;\n const isNextDisabled = inputs.current === inputs.count - 1;\n\n useEffect(() => {\n const subscription = FocusedInputEvents.addListener(\"focusDidSet\", (e) => {\n setInputs(e);\n });\n\n return subscription.remove;\n }, []);\n const doneStyle = useMemo(\n () => [styles.doneButton, { color: theme[colorScheme].primary }],\n [colorScheme, theme],\n );\n const toolbarStyle = useMemo(\n () => [\n styles.toolbar,\n {\n backgroundColor: `${theme[colorScheme].background}${opacity}`,\n },\n ],\n [colorScheme, opacity, theme],\n );\n const offset = useMemo(\n () => ({ closed: closed + KEYBOARD_TOOLBAR_HEIGHT, opened }),\n [closed, opened],\n );\n const ButtonContainer = button || Button;\n const IconContainer = icon || Arrow;\n\n const onPressNext = useCallback(() => {\n goToNextField();\n onNextCallback?.();\n }, [onNextCallback]);\n const onPressPrev = useCallback(() => {\n goToPrevField();\n onPrevCallback?.();\n }, [onPrevCallback]);\n const onPressDone = useCallback(() => {\n dismissKeyboard();\n onDoneCallback?.();\n }, [onDoneCallback]);\n\n return (\n <KeyboardStickyView enabled={enabled} offset={offset}>\n <View {...rest} style={toolbarStyle} testID={TEST_ID_KEYBOARD_TOOLBAR}>\n {blur}\n {showArrows && (\n <>\n <ButtonContainer\n accessibilityLabel=\"Previous\"\n accessibilityHint=\"Will move focus to previous field\"\n disabled={isPrevDisabled}\n onPress={onPressPrev}\n testID={TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS}\n theme={theme}\n >\n <IconContainer\n disabled={isPrevDisabled}\n type=\"prev\"\n theme={theme}\n />\n </ButtonContainer>\n <ButtonContainer\n accessibilityLabel=\"Next\"\n accessibilityHint=\"Will move focus to next field\"\n disabled={isNextDisabled}\n onPress={onPressNext}\n testID={TEST_ID_KEYBOARD_TOOLBAR_NEXT}\n theme={theme}\n >\n <IconContainer\n disabled={isNextDisabled}\n type=\"next\"\n theme={theme}\n />\n </ButtonContainer>\n </>\n )}\n\n <View style={styles.flex} testID={TEST_ID_KEYBOARD_TOOLBAR_CONTENT}>\n {content}\n </View>\n <ButtonContainer\n accessibilityLabel=\"Done\"\n accessibilityHint=\"Will close the keyboard\"\n onPress={onPressDone}\n testID={TEST_ID_KEYBOARD_TOOLBAR_DONE}\n rippleRadius={28}\n style={styles.doneButtonContainer}\n theme={theme}\n >\n <Text style={doneStyle} maxFontSizeMultiplier={1.3}>\n {doneText || \"Done\"}\n </Text>\n </ButtonContainer>\n </View>\n </KeyboardStickyView>\n );\n};\n\nconst styles = StyleSheet.create({\n flex: {\n flex: 1,\n },\n toolbar: {\n position: \"absolute\",\n bottom: 0,\n alignItems: \"center\",\n width: \"100%\",\n flexDirection: \"row\",\n height: KEYBOARD_TOOLBAR_HEIGHT,\n paddingHorizontal: 8,\n },\n doneButton: {\n fontWeight: \"600\",\n fontSize: 15,\n },\n doneButtonContainer: {\n marginRight: 8,\n },\n});\n\nexport { colors as DefaultKeyboardToolbarTheme };\nexport default KeyboardToolbar;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AACxE,SAASC,UAAU,EAAEC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AAErD,SACEC,kBAAkB,QACb,gBAAgB;AACvB,OAAOC,kBAAkB,MAAM,uBAAuB;AACtD,SAASC,wBAAwB,QAAQ,gBAAgB;AACzD,OAAOC,cAAc,MAAM,yBAAyB;AAEpD,OAAOC,KAAK,MAAM,SAAS;AAC3B,OAAOC,MAAM,MAAM,UAAU;AAC7B,SAASC,MAAM,QAAQ,UAAU;AAgDjC,MAAMC,wBAAwB,GAAG,kBAAk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MAAM,CAACuB,IAAK;IAACP,MAAM,EAAEtD;EAAiC,GAChEU,OACG,CAAC,eACP5B,KAAA,CAAAqE,aAAA,CAACL,eAAe;IACdU,kBAAkB,EAAC,MAAM;IACzBC,iBAAiB,EAAC,yBAAyB;IAC3CE,OAAO,EAAET,WAAY;IACrBI,MAAM,EAAErD,6BAA8B;IACtC6D,YAAY,EAAE,EAAG;IACjBT,KAAK,EAAEf,MAAM,CAACyB,mBAAoB;IAClCpD,KAAK,EAAEA;EAAM,gBAEb7B,KAAA,CAAAqE,aAAA,CAAC/D,IAAI;IAACiE,KAAK,EAAEhB,SAAU;IAAC2B,qBAAqB,EAAE;EAAI,GAChDpD,QAAQ,IAAI,MACT,CACS,CACb,CACY,CAAC;AAEzB,CAAC;AAED,MAAM0B,MAAM,GAAGnD,UAAU,CAAC8E,MAAM,CAAC;EAC/BJ,IAAI,EAAE;IACJA,IAAI,EAAE;EACR,CAAC;EACDlB,OAAO,EAAE;IACPuB,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,CAAC;IACTC,UAAU,EAAE,QAAQ;IACpBC,KAAK,EAAE,MAAM;IACbC,aAAa,EAAE,KAAK;IACpBC,MAAM,EAAErE,uBAAuB;IAC/BsE,iBAAiB,EAAE;EACrB,CAAC;EACDjC,UAAU,EAAE;IACVkC,UAAU,EAAE,KAAK;IACjBC,QAAQ,EAAE;EACZ,CAAC;EACDX,mBAAmB,EAAE;IACnBY,WAAW,EAAE;EACf;AACF,CAAC,CAAC;AAEF,SAAS/E,MAAM,IAAIgF,2BAA2B;AAC9C,eAAenE,eAAe","ignoreList":[]}
1
+ {"version":3,"names":["React","useEffect","useMemo","useState","StyleSheet","View","FocusedInputEvents","RCTKeyboardToolbarGroupView","useKeyboardState","KeyboardStickyView","Arrow","Button","colors","Background","Content","Done","Next","Prev","ToolbarContext","DEFAULT_OPACITY","KEYBOARD_HAS_ROUNDED_CORNERS","KEYBOARD_TOOLBAR_HEIGHT","OPENED_OFFSET","TEST_ID_KEYBOARD_TOOLBAR","KeyboardToolbar","children","content","theme","doneText","button","icon","showArrows","onNextCallback","onPrevCallback","onDoneCallback","blur","opacity","offset","closed","opened","enabled","insets","rest","colorScheme","state","appearance","inputs","setInputs","current","count","isPrevDisabled","isNextDisabled","buttonContainer","iconContainer","subscription","addListener","e","remove","toolbarStyle","styles","toolbar","backgroundColor","background","paddingLeft","left","paddingRight","right","floating","containerStyle","sticky","backgroundElement","arrowsElement","contentContainer","doneElement","prevChild","nextChild","contentChild","doneChild","backgroundChild","Children","forEach","child","isValidElement","type","createElement","style","arrows","onPress","text","contextValue","Provider","value","_extends","testID","create","position","bottom","height","alignItems","width","flexDirection","alignSelf","borderRadius","overflow","Group","DefaultKeyboardToolbarTheme"],"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;\nKeyboardToolbar.Done = Done;\nKeyboardToolbar.Group = RCTKeyboardToolbarGroupView;\n\nexport { colors as DefaultKeyboardToolbarTheme, KeyboardToolbarProps };\nexport default KeyboardToolbar;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAC3D,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAE/C,SACEC,kBAAkB,EAClBC,2BAA2B,QACtB,gBAAgB;AACvB,SAASC,gBAAgB,QAAQ,aAAa;AAC9C,OAAOC,kBAAkB,MAAM,uBAAuB;AAEtD,OAAOC,KAAK,MAAM,SAAS;AAC3B,OAAOC,MAAM,MAAM,UAAU;AAC7B,SAASC,MAAM,QAAQ,UAAU;AACjC,SAASC,UAAU,EAAEC,OAAO,EAAEC,IAAI,EAAEC,IAAI,EAAEC,IAAI,QAAQ,uBAAuB;AAC7E,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SACEC,eAAe,EACfC,4BAA4B,EAC5BC,uBAAuB,EACvBC,aAAa,EACbC,wBAAwB,QACnB,aAAa;AAKpB;AACA;AACA;AACA;AACA,MAAMC,eAOL,GAAGA,CAAC;EACHC,QAAQ;EACRC,OAAO;EACPC,KAAK,GAAGf,MAAM;EACdgB,QAAQ,GAAG,MAAM;EACjBC,MAAM;EACNC,IAAI;EACJC,UAAU,GAAG,IAAI;EACjBC,cAAc;EACdC,cAAc;EACdC,cAAc;EACdC,IAAI,GAAG,IAAI;EACXC,OAAO,GAAGjB,eAAe;EACzBkB,MAAM,EAAE;IAAEC,MAAM,GAAG,CAAC;IAAEC,MAAM,GAAG;EAAE,CAAC,GAAG,CAAC,CAAC;EACvCC,OAAO,GAAG,IAAI;EACdC,MAAM;EACN,GAAGC;AACL,CAAC,KAAK;EACJ,MAAMC,WAAW,GAAGnC,gBAAgB,CAAEoC,KAAK,IAAKA,KAAK,CAACC,UAAU,CAAC;EACjE,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAG5C,QAAQ,CAAC;IAC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oreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { ColorValue } 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"],"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,112 @@
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ import React, { forwardRef, useState } from "react";
3
+ import { Platform } from "react-native";
4
+ import Reanimated, { runOnJS, useAnimatedProps, useAnimatedReaction, useDerivedValue, useSharedValue } from "react-native-reanimated";
5
+ import { ClippingScrollView } from "../../bindings";
6
+ import styles from "./styles";
7
+ const OS = Platform.OS;
8
+ const ReanimatedClippingScrollView = OS === "android" || OS === "harmony" ? Reanimated.createAnimatedComponent(ClippingScrollView) : ClippingScrollView;
9
+ const ScrollViewWithBottomPadding = /*#__PURE__*/forwardRef(({
10
+ ScrollViewComponent,
11
+ bottomPadding,
12
+ scrollIndicatorPadding,
13
+ contentInset,
14
+ scrollIndicatorInsets,
15
+ inverted,
16
+ contentOffsetY,
17
+ applyWorkaroundForContentInsetHitTestBug,
18
+ onContentInsetChange,
19
+ contentContainerStyle,
20
+ children,
21
+ ...rest
22
+ }, ref) => {
23
+ const prevContentOffsetY = useSharedValue(null);
24
+
25
+ // HarmonyOS workaround: ArkUI ScrollView's scrollable range only follows
26
+ // contentSize (contentInset prop is dropped, padding/scrollToOverflowEnabled
27
+ // don't extend it). So we mirror the keyboard-driven bottomPadding into the
28
+ // inner ScrollView's contentContainerStyle.paddingBottom to actually expand
29
+ // contentSize, letting the worklet's scrollTo reach the keyboard area.
30
+ const isHarmony = OS === "harmony";
31
+ const [harmonyKbPad, setHarmonyKbPad] = useState(0);
32
+ useAnimatedReaction(() => isHarmony ? bottomPadding.value : 0, (cur, prev) => {
33
+ if (isHarmony && cur !== prev) {
34
+ runOnJS(setHarmonyKbPad)(Math.round(cur));
35
+ }
36
+ }, [isHarmony]);
37
+ const insets = useDerivedValue(() => {
38
+ const dynamicTop = inverted ? bottomPadding.value : 0;
39
+ const dynamicBottom = !inverted ? bottomPadding.value : 0;
40
+ return {
41
+ dynamic: {
42
+ top: dynamicTop,
43
+ bottom: dynamicBottom
44
+ },
45
+ effective: {
46
+ top: dynamicTop + ((contentInset === null || contentInset === void 0 ? void 0 : contentInset.top) || 0),
47
+ bottom: dynamicBottom + ((contentInset === null || contentInset === void 0 ? void 0 : contentInset.bottom) || 0),
48
+ left: (contentInset === null || contentInset === void 0 ? void 0 : contentInset.left) || 0,
49
+ right: (contentInset === null || contentInset === void 0 ? void 0 : contentInset.right) || 0
50
+ }
51
+ };
52
+ }, [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]);
53
+ useAnimatedReaction(() => insets.value.effective, (current, previous) => {
54
+ if (!onContentInsetChange) {
55
+ return;
56
+ }
57
+ if (previous && current.top === previous.top && current.bottom === previous.bottom && current.left === previous.left && current.right === previous.right) {
58
+ return;
59
+ }
60
+ runOnJS(onContentInsetChange)(current);
61
+ }, [onContentInsetChange]);
62
+ const animatedProps = useAnimatedProps(() => {
63
+ const {
64
+ dynamic,
65
+ effective
66
+ } = insets.value;
67
+ const indicatorPadding = scrollIndicatorPadding ?? bottomPadding;
68
+ const indicatorTop = (inverted ? indicatorPadding.value : 0) + ((scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.top) || 0);
69
+ const indicatorBottom = (!inverted ? indicatorPadding.value : 0) + ((scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.bottom) || 0);
70
+ const result = {
71
+ // iOS prop
72
+ contentInset: effective,
73
+ scrollIndicatorInsets: {
74
+ bottom: indicatorBottom,
75
+ top: indicatorTop,
76
+ right: scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.right,
77
+ left: scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.left
78
+ },
79
+ // Android prop
80
+ contentInsetBottom: dynamic.bottom,
81
+ contentInsetTop: dynamic.top
82
+ };
83
+ if (contentOffsetY) {
84
+ const curr = contentOffsetY.value;
85
+ if (curr !== prevContentOffsetY.value) {
86
+ // eslint-disable-next-line react-compiler/react-compiler
87
+ prevContentOffsetY.value = curr;
88
+ result.contentOffset = {
89
+ x: 0,
90
+ y: curr
91
+ };
92
+ }
93
+ }
94
+ return result;
95
+ }, [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]);
96
+ return /*#__PURE__*/React.createElement(ReanimatedClippingScrollView, {
97
+ animatedProps: animatedProps,
98
+ applyWorkaroundForContentInsetHitTestBug: applyWorkaroundForContentInsetHitTestBug,
99
+ style: styles.container
100
+ }, /*#__PURE__*/React.createElement(ScrollViewComponent, _extends({
101
+ ref: ref,
102
+ animatedProps: animatedProps
103
+ }, rest, {
104
+ contentContainerStyle: isHarmony ? [contentContainerStyle, inverted ? {
105
+ paddingTop: harmonyKbPad
106
+ } : {
107
+ paddingBottom: harmonyKbPad
108
+ }] : contentContainerStyle
109
+ }), children));
110
+ });
111
+ export default ScrollViewWithBottomPadding;
112
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","forwardRef","useState","Platform","Reanimated","runOnJS","useAnimatedProps","useAnimatedReaction","useDerivedValue","useSharedValue","ClippingScrollView","styles","OS","ReanimatedClippingScrollView","createAnimatedComponent","ScrollViewWithBottomPadding","ScrollViewComponent","bottomPadding","scrollIndicatorPadding","contentInset","scrollIndicatorInsets","inverted","contentOffsetY","applyWorkaroundForContentInsetHitTestBug","onContentInsetChange","contentContainerStyle","children","rest","ref","prevContentOffsetY","isHarmony","harmonyKbPad","setHarmonyKbPad","value","cur","prev","Math","round","insets","dynamicTop","dynamicBottom","dynamic","top","bottom","effective","left","right","current","previous","animatedProps","indicatorPadding","indicatorTop","indicatorBottom","result","contentInsetBottom","contentInsetTop","curr","contentOffset","x","y","createElement","style","container","_extends","paddingTop","paddingBottom"],"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,OAAOA,KAAK,IAAIC,UAAU,EAAEC,QAAQ,QAAQ,OAAO;AACnD,SAASC,QAAQ,QAAQ,cAAc;AACvC,OAAOC,UAAU,IACfC,OAAO,EACPC,gBAAgB,EAChBC,mBAAmB,EACnBC,eAAe,EACfC,cAAc,QACT,yBAAyB;AAEhC,SAASC,kBAAkB,QAAQ,gBAAgB;AAEnD,OAAOC,MAAM,MAAM,UAAU;AAK7B,MAAMC,EAAE,GAAGT,QAAQ,CAACS,EAAE;AACtB,MAAMC,4BAA4B,GAChCD,EAAE,KAAK,SAAS,IAAKA,EAAE,KAAgB,SAAS,GAC5CR,UAAU,CAACU,uBAAuB,CAACJ,kBAAkB,CAAC,GACtDA,kBAAkB;AAmCxB,MAAMK,2BAA2B,gBAAGd,UAAU,CAI5C,CACE;EACEe,mBAAmB;EACnBC,aAAa;EACbC,sBAAsB;EACtBC,YAAY;EACZC,qBAAqB;EACrBC,QAAQ;EACRC,cAAc;EACdC,wCAAwC;EACxCC,oBAAoB;EACpBC,qBAAqB;EACrBC,QAAQ;EACR,GAAGC;AACL,CAAC,EACDC,GAAG,KACA;EACH,MAAMC,kBAAkB,GAAGpB,cAAc,CAAgB,IAAI,CAAC;;EAE9D;EACA;EACA;EACA;EACA;EACA,MAAMqB,SAAS,GAAIlB,EAAE,KAAgB,SAAS;EAC9C,MAAM,CAACmB,YAAY,EAAEC,eAAe,CAAC,GAAG9B,QAAQ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aAAa,EAAElC;IAAa,CAAC,CACpC,GACDN;EACL,IAEAC,QACkB,CACO,CAAC;AAEnC,CACF,CAAC;AAED,eAAeX,2BAA2B","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ import { StyleSheet } from "react-native";
2
+ const styles = StyleSheet.create({
3
+ container: {
4
+ flexGrow: 1,
5
+ flexShrink: 1
6
+ }
7
+ });
8
+ export default styles;
9
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["StyleSheet","styles","create","container","flexGrow","flexShrink"],"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,SAASA,UAAU,QAAQ,cAAc;AAEzC,MAAMC,MAAM,GAAGD,UAAU,CAACE,MAAM,CAAC;EAC/BC,SAAS,EAAE;IACTC,QAAQ,EAAE,CAAC;IACXC,UAAU,EAAE;EACd;AACF,CAAC,CAAC;AAEF,eAAeJ,MAAM","ignoreList":[]}
@@ -1,4 +1,4 @@
1
1
  import { useColorScheme as useColorSchemeRN } from "react-native";
2
- const useColorScheme = () => useColorSchemeRN() || "light";
2
+ const useColorScheme = () => useColorSchemeRN() === "dark" ? "dark" : "light";
3
3
  export default useColorScheme;
4
4
  //# sourceMappingURL=useColorScheme.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useColorScheme","useColorSchemeRN"],"sources":["useColorScheme.ts"],"sourcesContent":["import { useColorScheme as useColorSchemeRN } from \"react-native\";\n\nconst useColorScheme = () => useColorSchemeRN() || \"light\";\n\nexport default useColorScheme;\n"],"mappings":"AAAA,SAASA,cAAc,IAAIC,gBAAgB,QAAQ,cAAc;AAEjE,MAAMD,cAAc,GAAGA,CAAA,KAAMC,gBAAgB,CAAC,CAAC,IAAI,OAAO;AAE1D,eAAeD,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["useColorScheme","useColorSchemeRN"],"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,SAASA,cAAc,IAAIC,gBAAgB,QAAQ,cAAc;AAEjE,MAAMD,cAAc,GAAGA,CAAA,KACrBC,gBAAgB,CAAC,CAAC,KAAK,MAAM,GAAG,MAAM,GAAG,OAAO;AAElD,eAAeD,cAAc","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ import { useCallback } from "react";
2
+ const useCombinedRef = (...refs) => {
3
+ return useCallback(value => {
4
+ for (const ref of refs) {
5
+ if (!ref) {
6
+ continue;
7
+ }
8
+ if (typeof ref === "function") {
9
+ ref(value);
10
+ } else {
11
+ ref.current = value;
12
+ }
13
+ }
14
+ // eslint-disable-next-line react-compiler/react-compiler
15
+ }, refs);
16
+ };
17
+ export default useCombinedRef;
18
+ //# sourceMappingURL=useCombinedRef.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useCombinedRef","refs","value","ref","current"],"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,SAASA,WAAW,QAAQ,OAAO;AAInC,MAAMC,cAAc,GAAGA,CAAI,GAAGC,IAAc,KAAqB;EAC/D,OAAOF,WAAW,CAAEG,KAAe,IAAK;IACtC,KAAK,MAAMC,GAAG,IAAIF,IAAI,EAAE;MACtB,IAAI,CAACE,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,EAAED,IAAI,CAAC;AACV,CAAC;AAED,eAAeD,cAAc","ignoreList":[]}
@@ -0,0 +1,56 @@
1
+ import { useCallback, useEffect } from "react";
2
+ import { useEvent, useSharedValue } from "react-native-reanimated";
3
+ import { useEventHandlerRegistration } from "../../internal";
4
+ const NATIVE_SCROLL_EVENT_NAMES = ["onScroll", "onScrollBeginDrag", "onScrollEndDrag", "onMomentumScrollBegin", "onMomentumScrollEnd"];
5
+ const useScrollState = ref => {
6
+ const offset = useSharedValue(0);
7
+ const layout = useSharedValue({
8
+ width: 0,
9
+ height: 0
10
+ });
11
+ const size = useSharedValue({
12
+ width: 0,
13
+ height: 0
14
+ });
15
+ const register = useEventHandlerRegistration(ref);
16
+ const eventHandler = useEvent(event => {
17
+ "worklet";
18
+
19
+ // eslint-disable-next-line react-compiler/react-compiler
20
+ offset.value = event.contentOffset.y;
21
+ layout.value = event.layoutMeasurement;
22
+ size.value = event.contentSize;
23
+ }, NATIVE_SCROLL_EVENT_NAMES);
24
+ useEffect(() => {
25
+ const cleanup = register(eventHandler);
26
+ return () => {
27
+ cleanup();
28
+ };
29
+ }, []);
30
+
31
+ // `onContentSizeChange` is synthesized in JS (from the content container's
32
+ // onLayout) and `onLayout` has a different payload shape than scroll events,
33
+ // so neither can be reliably captured via native event registration.
34
+ // Instead we expose callbacks for the consumer to attach as props.
35
+ const onLayout = useCallback(e => {
36
+ layout.value = {
37
+ width: e.nativeEvent.layout.width,
38
+ height: e.nativeEvent.layout.height
39
+ };
40
+ }, [layout]);
41
+ const onContentSizeChange = useCallback((w, h) => {
42
+ size.value = {
43
+ width: w,
44
+ height: h
45
+ };
46
+ }, [size]);
47
+ return {
48
+ offset,
49
+ layout,
50
+ size,
51
+ onLayout,
52
+ onContentSizeChange
53
+ };
54
+ };
55
+ export default useScrollState;
56
+ //# sourceMappingURL=useScrollState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useEffect","useEvent","useSharedValue","useEventHandlerRegistration","NATIVE_SCROLL_EVENT_NAMES","useScrollState","ref","offset","layout","width","height","size","register","eventHandler","event","value","contentOffset","y","layoutMeasurement","contentSize","cleanup","onLayout","e","nativeEvent","onContentSizeChange","w","h"],"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\nexport default useScrollState;\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,SAAS,QAAQ,OAAO;AAC9C,SAASC,QAAQ,EAAEC,cAAc,QAAQ,yBAAyB;AAElE,SAASC,2BAA2B,QAAQ,gBAAgB;AAM5D,MAAMC,yBAAyB,GAAG,CAChC,UAAU,EACV,mBAAmB,EACnB,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,CACtB;AAiBD,MAAMC,cAAc,GAAIC,GAAuC,IAAK;EAClE,MAAMC,MAAM,GAAGL,cAAc,CAAC,CAAC,CAAC;EAChC,MAAMM,MAAM,GAAGN,cAAc,CAAC;IAAEO,KAAK,EAAE,CAAC;IAAEC,MAAM,EAAE;EAAE,CAAC,CAAC;EACtD,MAAMC,IAAI,GAAGT,cAAc,CAAC;IAAEO,KAAK,EAAE,CAAC;IAAEC,MAAM,EAAE;EAAE,CAAC,CAAC;EAEpD,MAAME,QAAQ,GAAGT,2BAA2B,CAACG,GAAG,CAAC;EAEjD,MAAMO,YAAY,GAAGZ,QAAQ,CAAEa,KAAkB,IAAK;IACpD,SAAS;;IAET;IACAP,MAAM,CAACQ,KAAK,GAAGD,KAAK,CAACE,aAAa,CAACC,CAAC;IACpCT,MAAM,CAACO,KAAK,GAAGD,KAAK,CAACI,iBAAiB;IACtCP,IAAI,CAACI,KAAK,GAAGD,KAAK,CAACK,WAAW;EAChC,CAAC,EAAEf,yBAAyB,CAAC;EAE7BJ,SAAS,CAAC,MAAM;IACd,MAAMoB,OAAO,GAAGR,QAAQ,CAACC,YAAY,CAAC;IAEtC,OAAO,MAAM;MACXO,OAAO,CAAC,CAAC;IACX,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;;EAEN;EACA;EACA;EACA;EACA,MAAMC,QAAQ,GAAGtB,WAAW,CACzBuB,CAAoB,IAAK;IACxBd,MAAM,CAACO,KAAK,GAAG;MACbN,KAAK,EAAEa,CAAC,CAACC,WAAW,CAACf,MAAM,CAACC,KAAK;MACjCC,MAAM,EAAEY,CAAC,CAACC,WAAW,CAACf,MAAM,CAACE;IAC/B,CAAC;EACH,CAAC,EACD,CAACF,MAAM,CACT,CAAC;EAED,MAAMgB,mBAAmB,GAAGzB,WAAW,CACrC,CAAC0B,CAAS,EAAEC,CAAS,KAAK;IACxBf,IAAI,CAACI,KAAK,GAAG;MAAEN,KAAK,EAAEgB,CAAC;MAAEf,MAAM,EAAEgB;IAAE,CAAC;EACtC,CAAC,EACD,CAACf,IAAI,CACP,CAAC;EAED,OAAO;IAAEJ,MAAM;IAAEC,MAAM;IAAEG,IAAI;IAAEU,QAAQ;IAAEG;EAAoB,CAAC;AAChE,CAAC;AAED,eAAenB,cAAc","ignoreList":[]}
@@ -1,5 +1,6 @@
1
1
  export { default as KeyboardAvoidingView } from "./KeyboardAvoidingView";
2
2
  export { default as KeyboardStickyView } from "./KeyboardStickyView";
3
3
  export { default as KeyboardAwareScrollView } from "./KeyboardAwareScrollView";
4
+ export { default as KeyboardChatScrollView } from "./KeyboardChatScrollView";
4
5
  export { default as KeyboardToolbar, DefaultKeyboardToolbarTheme } from "./KeyboardToolbar";
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["default","KeyboardAvoidingView","KeyboardStickyView","KeyboardAwareScrollView","KeyboardToolbar","DefaultKeyboardToolbarTheme"],"sources":["index.ts"],"sourcesContent":["export { default as KeyboardAvoidingView } from \"./KeyboardAvoidingView\";\nexport { default as KeyboardStickyView } from \"./KeyboardStickyView\";\nexport { default as KeyboardAwareScrollView } from \"./KeyboardAwareScrollView\";\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 { KeyboardToolbarProps } from \"./KeyboardToolbar\";\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,oBAAoB,QAAQ,wBAAwB;AACxE,SAASD,OAAO,IAAIE,kBAAkB,QAAQ,sBAAsB;AACpE,SAASF,OAAO,IAAIG,uBAAuB,QAAQ,2BAA2B;AAC9E,SACEH,OAAO,IAAII,eAAe,EAC1BC,2BAA2B,QACtB,mBAAmB","ignoreList":[]}
1
+ {"version":3,"names":["default","KeyboardAvoidingView","KeyboardStickyView","KeyboardAwareScrollView","KeyboardChatScrollView","KeyboardToolbar","DefaultKeyboardToolbarTheme"],"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,SAASA,OAAO,IAAIC,oBAAoB,QAAQ,wBAAwB;AACxE,SAASD,OAAO,IAAIE,kBAAkB,QAAQ,sBAAsB;AACpE,SAASF,OAAO,IAAIG,uBAAuB,QAAQ,2BAA2B;AAC9E,SAASH,OAAO,IAAII,sBAAsB,QAAQ,0BAA0B;AAC5E,SACEJ,OAAO,IAAIK,eAAe,EAC1BC,2BAA2B,QACtB,mBAAmB","ignoreList":[]}
@@ -1,3 +1,5 @@
1
+ import { KeyboardControllerNative } from "./bindings";
2
+
1
3
  // copied from `android.view.WindowManager.LayoutParams`
2
4
  export let AndroidSoftInputModes = /*#__PURE__*/function (AndroidSoftInputModes) {
3
5
  AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_ADJUST_NOTHING"] = 48] = "SOFT_INPUT_ADJUST_NOTHING";
@@ -18,4 +20,5 @@ export let AndroidSoftInputModes = /*#__PURE__*/function (AndroidSoftInputModes)
18
20
  AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_VISIBLE"] = 4] = "SOFT_INPUT_STATE_VISIBLE";
19
21
  return AndroidSoftInputModes;
20
22
  }({});
23
+ export const KEYBOARD_BORDER_RADIUS = KeyboardControllerNative.getConstants().keyboardBorderRadius;
21
24
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["AndroidSoftInputModes"],"sources":["constants.ts"],"sourcesContent":["// 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}\n"],"mappings":"AAAA;AACA,WAAYA,qBAAqB,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":["KeyboardControllerNative","AndroidSoftInputModes","KEYBOARD_BORDER_RADIUS","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,SAASA,wBAAwB,QAAQ,YAAY;;AAErD;AACA,WAAYC,qBAAqB,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;AAkBjC,OAAO,MAAMC,sBAAsB,GACjCF,wBAAwB,CAACG,YAAY,CAAC,CAAC,CAACC,oBAAoB","ignoreList":[]}
@@ -23,6 +23,7 @@ const defaultContext = {
23
23
  height: DEFAULT_SHARED_VALUE
24
24
  },
25
25
  layout: DEFAULT_LAYOUT,
26
+ update: () => Promise.resolve(),
26
27
  setKeyboardHandlers: NESTED_NOOP,
27
28
  setInputHandlers: NESTED_NOOP,
28
29
  setEnabled: NOOP
@@ -1 +1 @@
1
- {"version":3,"names":["createContext","useContext","Animated","NOOP","NESTED_NOOP","withSharedValue","value","addListener","removeListener","modify","get","set","DEFAULT_SHARED_VALUE","DEFAULT_LAYOUT","defaultContext","enabled","animated","progress","Value","height","reanimated","layout","setKeyboardHandlers","setInputHandlers","setEnabled","KeyboardContext","useKeyboardContext","context","__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 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 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` - otherwise functionality of `react-native-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C","ignoreList":[]}
1
+ {"version":3,"names":["createContext","useContext","Animated","NOOP","NESTED_NOOP","withSharedValue","value","addListener","removeListener","modify","get","set","DEFAULT_SHARED_VALUE","DEFAULT_LAYOUT","defaultContext","enabled","animated","progress","Value","height","reanimated","layout","update","Promise","resolve","setKeyboardHandlers","setInputHandlers","setEnabled","KeyboardContext","useKeyboardContext","context","__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` - otherwise functionality of `react-native-keyboard-controller` will not work.\",\n );\n }\n\n return context;\n};\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,OAAO;AACjD,SAASC,QAAQ,QAAQ,cAAc;AA4BvC,MAAMC,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,IAAIf,QAAQ,CAACgB,KAAK,CAAC,CAAC,CAAC;IAC/BC,MAAM,EAAE,IAAIjB,QAAQ,CAACgB,KAAK,CAAC,CAAC;EAC9B,CAAC;EACDE,UAAU,EAAE;IACVH,QAAQ,EAAEL,oBAAoB;IAC9BO,MAAM,EAAEP;EACV,CAAC;EACDS,MAAM,EAAER,cAAc;EACtBS,MAAM,EAAEA,CAAA,KAAMC,OAAO,CAACC,OAAO,CAAC,CAAC;EAC/BC,mBAAmB,EAAErB,WAAW;EAChCsB,gBAAgB,EAAEtB,WAAW;EAC7BuB,UAAU,EAAExB;AACd,CAAC;AACD,OAAO,MAAMyB,eAAe,gBAAG5B,aAAa,CAACc,cAAc,CAAC;AAC5D,OAAO,MAAMe,kBAAkB,GAAGA,CAAA,KAAM;EACtC,MAAMC,OAAO,GAAG7B,UAAU,CAAC2B,eAAe,CAAC;EAC3C,IAAIG,OAAO,IAAID,OAAO,KAAKhB,cAAc,EAAE;IACzCkB,OAAO,CAACC,IAAI,CACV,sLACF,CAAC;EACH;EAEA,OAAOH,OAAO;AAChB,CAAC","ignoreList":[]}
@@ -47,7 +47,8 @@ export function useKeyboardController() {
47
47
  export function useReanimatedFocusedInput() {
48
48
  const context = useKeyboardContext();
49
49
  return {
50
- input: context.layout
50
+ input: context.layout,
51
+ update: context.update
51
52
  };
52
53
  }
53
54
  export function useFocusedInputHandler(handler, deps) {
@@ -65,4 +66,5 @@ export function useFocusedInputHandler(handler, deps) {
65
66
  }, deps);
66
67
  }
67
68
  export * from "./useWindowDimensions";
69
+ export * from "./useKeyboardState";
68
70
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","AndroidSoftInputModes","useKeyboardContext","uuid","KeyboardController","useResizeMode","setInputMode","SOFT_INPUT_ADJUST_RESIZE","setDefaultMode","useKeyboardAnimation","context","animated","useReanimatedKeyboardAnimation","reanimated","useGenericKeyboardHandler","handler","deps","key","setKeyboardHandlers","undefined","useKeyboardHandler","useKeyboardController","setEnabled","enabled","useReanimatedFocusedInput","input","layout","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 };\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\";\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,OAAO;AAEjC,SAASC,qBAAqB,QAAQ,cAAc;AACpD,SAASC,kBAAkB,QAAQ,YAAY;AAC/C,SAASC,IAAI,QAAQ,UAAU;AAC/B,SAASC,kBAAkB,QAAQ,WAAW;AAM9C,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAM;EACjCL,SAAS,CAAC,MAAM;IACdI,kBAAkB,CAACE,YAAY,CAC7BL,qBAAqB,CAACM,wBACxB,CAAC;IAED,OAAO,MAAMH,kBAAkB,CAACI,cAAc,CAAC,CAAC;EAClD,CAAC,EAAE,EA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AAClC;AAEA,OAAO,SAASC,sBAAsBA,CACpCZ,OAA6B,EAC7BC,IAAqB,EACrB;EACA,MAAMN,OAAO,GAAGR,kBAAkB,CAAC,CAAC;EAEpCF,SAAS,CAAC,MAAM;IACd,MAAMiB,GAAG,GAAGd,IAAI,CAAC,CAAC;IAElBO,OAAO,CAACkB,gBAAgB,CAAC;MAAE,CAACX,GAAG,GAAGF;IAAQ,CAAC,CAAC;IAE5C,OAAO,MAAM;MACXL,OAAO,CAACkB,gBAAgB,CAAC;QAAE,CAACX,GAAG,GAAGE;MAAU,CAAC,CAAC;IAChD,CAAC;EACH,CAAC,EAAEH,IAAI,CAAC;AACV;AAEA,cAAc,uBAAuB","ignoreList":[]}
1
+ {"version":3,"names":["useEffect","AndroidSoftInputModes","useKeyboardContext","uuid","KeyboardController","useResizeMode","setInputMode","SOFT_INPUT_ADJUST_RESIZE","setDefaultMode","useKeyboardAnimation","context","animated","useReanimatedKeyboardAnimation","reanimated","useGenericKeyboardHandler","handler","deps","key","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,SAASA,SAAS,QAAQ,OAAO;AAEjC,SAASC,qBAAqB,QAAQ,cAAc;AACpD,SAASC,kBAAkB,QAAQ,YAAY;AAC/C,SAASC,IAAI,QAAQ,UAAU;AAC/B,SAASC,kBAAkB,QAAQ,WAAW;AAM9C,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAM;EACjCL,SAAS,CAAC,MAAM;IACdI,kBAAkB,CAACE,YAAY,CAC7BL,qBAAqB,CAACM,wBACxB,CAAC;IAED,OAAO,MAAMH,kBAAkB,CAACI,cAAc,CAAC,CAAC;EAClD,CAAC,EAAE,EAAE,CAAC;AACR,CAAC;AAED,OAAO,MAAMC,oBAAoB,GAAGA,CAAA,KAAuB;EACzDJ,aAAa,CAAC,CAAC;EACf,MAAMK,OAAO,GAAGR,kBAAkB,CAAC,CAAC;EAEpC,OAAOQ,OAAO,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pCF,SAAS,CAAC,MAAM;IACd,MAAMiB,GAAG,GAAGd,IAAI,CAAC,CAAC;IAElBO,OAAO,CAACmB,gBAAgB,CAAC;MAAE,CAACZ,GAAG,GAAGF;IAAQ,CAAC,CAAC;IAE5C,OAAO,MAAM;MACXL,OAAO,CAACmB,gBAAgB,CAAC;QAAE,CAACZ,GAAG,GAAGE;MAAU,CAAC,CAAC;IAChD,CAAC;EACH,CAAC,EAAEH,IAAI,CAAC;AACV;AAEA,cAAc,uBAAuB;AACrC,cAAc,oBAAoB","ignoreList":[]}
@@ -0,0 +1,33 @@
1
+ import { useEffect, useState } from "react";
2
+ import { KeyboardEvents } from "../../bindings";
3
+ import { KeyboardController } from "../../module";
4
+ const EVENTS = ["keyboardDidShow", "keyboardDidHide"];
5
+ const getLatestState = () => ({
6
+ ...KeyboardController.state(),
7
+ isVisible: KeyboardController.isVisible()
8
+ });
9
+ const defaultSelector = state => state;
10
+ export function useKeyboardState(selector = defaultSelector) {
11
+ const [state, setState] = useState(() => selector(getLatestState()));
12
+ useEffect(() => {
13
+ const subscriptions = EVENTS.map(event => KeyboardEvents.addListener(event, () =>
14
+ // state will be updated by global listener first,
15
+ // so we simply read it and don't derive data from the event
16
+ setState(selector(getLatestState()))));
17
+ const willShowSubscription = KeyboardEvents.addListener("keyboardWillShow", event => setState(selector({
18
+ ...getLatestState(),
19
+ appearance: event.appearance
20
+ })));
21
+
22
+ // we might have missed an update between reading a value in render and
23
+ // `addListener` in this handler, so we set it here. If there was
24
+ // no change, React will filter out this update as a no-op.
25
+ setState(selector(getLatestState()));
26
+ return () => {
27
+ subscriptions.forEach(subscription => subscription.remove());
28
+ willShowSubscription.remove();
29
+ };
30
+ }, []);
31
+ return state;
32
+ }
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEffect","useState","KeyboardEvents","KeyboardController","EVENTS","getLatestState","state","isVisible","defaultSelector","useKeyboardState","selector","setState","subscriptions","map","event","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,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAE3C,SAASC,cAAc,QAAQ,gBAAgB;AAC/C,SAASC,kBAAkB,QAAQ,cAAc;AAIjD,MAAMC,MAAM,GAAG,CAAC,iBAAiB,EAAE,iBAAiB,CAAU;AAE9D,MAAMC,cAAc,GAAGA,CAAA,MAAO;EAC5B,GAAGF,kBAAkB,CAACG,KAAK,CAAC,CAAC;EAC7BC,SAAS,EAAEJ,kBAAkB,CAACI,SAAS,CAAC;AAC1C,CAAC,CAAC;AAIF,MAAMC,eAAsD,GAAIF,KAAK,IAAKA,KAAK;AAE/E,OAAO,SAASG,gBAAgBA,CAC9BC,QAAkC,GAAGF,eAA2C,EAC7E;EACH,MAAM,CAACF,KAAK,EAAEK,QAAQ,CAAC,GAAGV,QAAQ,CAAI,MAAMS,QAAQ,CAACL,cAAc,CAAC,CAAC,CAAC,CAAC;EAEvEL,SAAS,CAAC,MAAM;IACd,MAAMY,aAAa,GAAGR,MAAM,CAACS,GAAG,CAAEC,KAAK,IACrCZ,cAAc,CAACa,WAAW,CAACD,KAAK,EAAE;IAChC;IACA;IACAH,QAAQ,CAACD,QAAQ,CAACL,cAAc,CAAC,CAAC,CAAC,CACrC,CACF,CAAC;IACD,MAAMW,oBAAoB,GAAGd,cAAc,CAACa,WAAW,CACrD,kBAAkB,EACjBD,KAAK,IACJH,QAAQ,CACND,QAAQ,CAAC;MAAE,GAAGL,cAAc,CAAC,CAAC;MAAEY,UAAU,EAAEH,KAAK,CAACG;IAAW,CAAC,CAChE,CACJ,CAAC;;IAED;IACA;IACA;IACAN,QAAQ,CAACD,QAAQ,CAACL,cAAc,CAAC,CAAC,CAAC,CAAC;IAEpC,OAAO,MAAM;MACXO,aAAa,CAACM,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,OAAOd,KAAK;AACd","ignoreList":[]}
@@ -5,8 +5,9 @@ export * from "./hooks";
5
5
  export * from "./constants";
6
6
  export * from "./module";
7
7
  export * from "./types";
8
- export { KeyboardAvoidingView, KeyboardStickyView, KeyboardAwareScrollView,
8
+ export * from "./compat";
9
+ export { KeyboardChatScrollView, KeyboardAvoidingView, KeyboardStickyView, KeyboardAwareScrollView,
9
10
  // keyboard toolbar
10
11
  KeyboardToolbar, DefaultKeyboardToolbarTheme } from "./components";
11
- export { OverKeyboardView } from "./views";
12
+ export { OverKeyboardView, KeyboardExtender } from "./views";
12
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["KeyboardAvoidingView","KeyboardStickyView","KeyboardAwareScrollView","KeyboardToolbar","DefaultKeyboardToolbarTheme","OverKeyboardView"],"sources":["index.ts"],"sourcesContent":["export * from \"./bindings\";\nexport * from \"./animated\";\nexport * from \"./context\";\nexport * from \"./hooks\";\nexport * from \"./constants\";\nexport * from \"./module\";\nexport * from \"./types\";\n\nexport {\n KeyboardAvoidingView,\n KeyboardStickyView,\n KeyboardAwareScrollView,\n // keyboard toolbar\n KeyboardToolbar,\n DefaultKeyboardToolbarTheme,\n} from \"./components\";\nexport type {\n KeyboardAvoidingViewProps,\n KeyboardStickyViewProps,\n KeyboardAwareScrollViewProps,\n KeyboardToolbarProps,\n} from \"./components\";\nexport { OverKeyboardView } from \"./views\";\n"],"mappings":"AAAA,cAAc,YAAY;AAC1B,cAAc,YAAY;AAC1B,cAAc,WAAW;AACzB,cAAc,SAAS;AACvB,cAAc,aAAa;AAC3B,cAAc,UAAU;AACxB,cAAc,SAAS;AAEvB,SACEA,oBAAoB,EACpBC,kBAAkB,EAClBC,uBAAuB;AACvB;AACAC,eAAe,EACfC,2BAA2B,QACtB,cAAc;AAOrB,SAASC,gBAAgB,QAAQ,SAAS","ignoreList":[]}
1
+ {"version":3,"names":["KeyboardChatScrollView","KeyboardAvoidingView","KeyboardStickyView","KeyboardAwareScrollView","KeyboardToolbar","DefaultKeyboardToolbarTheme","OverKeyboardView","KeyboardExtender"],"sources":["index.ts"],"sourcesContent":["export * from \"./bindings\";\nexport * from \"./animated\";\nexport * from \"./context\";\nexport * from \"./hooks\";\nexport * from \"./constants\";\nexport * from \"./module\";\nexport * from \"./types\";\nexport * from \"./compat\";\n\nexport {\n KeyboardChatScrollView,\n KeyboardAvoidingView,\n KeyboardStickyView,\n KeyboardAwareScrollView,\n // keyboard toolbar\n KeyboardToolbar,\n DefaultKeyboardToolbarTheme,\n} from \"./components\";\nexport type {\n KeyboardChatScrollViewProps,\n KeyboardAvoidingViewProps,\n KeyboardStickyViewProps,\n KeyboardAwareScrollViewProps,\n KeyboardAwareScrollViewRef,\n KeyboardToolbarProps,\n} from \"./components\";\nexport { OverKeyboardView, KeyboardExtender } from \"./views\";\n"],"mappings":"AAAA,cAAc,YAAY;AAC1B,cAAc,YAAY;AAC1B,cAAc,WAAW;AACzB,cAAc,SAAS;AACvB,cAAc,aAAa;AAC3B,cAAc,UAAU;AACxB,cAAc,SAAS;AACvB,cAAc,UAAU;AAExB,SACEA,sBAAsB,EACtBC,oBAAoB,EACpBC,kBAAkB,EAClBC,uBAAuB;AACvB;AACAC,eAAe,EACfC,2BAA2B,QACtB,cAAc;AASrB,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,SAAS","ignoreList":[]}
@@ -1,6 +1,41 @@
1
1
  import { useCallback, useRef } from "react";
2
2
  import { Animated } from "react-native";
3
3
  import { useSharedValue } from "react-native-reanimated";
4
+ import { findNodeHandle } from "./utils/findNodeHandle";
5
+ export function useEventHandlerRegistration(viewTagRef) {
6
+ const onRegisterHandler = handler => {
7
+ const currentHandler = handler;
8
+ const attachWorkletHandlers = () => {
9
+ const viewTag = findNodeHandle(viewTagRef.current);
10
+ if (__DEV__ && !viewTag) {
11
+ console.warn("Can not attach worklet handlers for `react-native-keyboard-controller` because view tag can not be resolved. Be sure that `KeyboardProvider` is fully mounted before registering handlers. If you think it is a bug in library, please open an issue.");
12
+ }
13
+ if (viewTag) {
14
+ if ("workletEventHandler" in currentHandler) {
15
+ currentHandler.workletEventHandler.registerForEvents(viewTag);
16
+ } else {
17
+ currentHandler.registerForEvents(viewTag);
18
+ }
19
+ }
20
+ };
21
+ if (viewTagRef.current) {
22
+ attachWorkletHandlers();
23
+ } else {
24
+ queueMicrotask(attachWorkletHandlers);
25
+ }
26
+ return () => {
27
+ const viewTag = findNodeHandle(viewTagRef.current);
28
+ if (viewTag) {
29
+ if ("workletEventHandler" in currentHandler) {
30
+ currentHandler.workletEventHandler.unregisterFromEvents(viewTag);
31
+ } else {
32
+ currentHandler.unregisterFromEvents(viewTag);
33
+ }
34
+ }
35
+ };
36
+ };
37
+ return onRegisterHandler;
38
+ }
4
39
  /**
5
40
  * Hook for storing worklet handlers (objects with keys, where values are worklets).
6
41
  * Returns methods for setting handlers and broadcasting events in them.
@@ -1 +1 @@
1
- {"version":3,"names":["useCallback","useRef","Animated","useSharedValue","useSharedHandlers","handlers","jsHandlers","updateSharedHandlers","value","current","setHandlers","handler","broadcast","type","event","Object","keys","forEach","key","_handlers$value$key","_handlers$value$key$t","call","useAnimatedValue","initialValue","config","ref","Value"],"sources":["internal.ts"],"sourcesContent":["import { useCallback, useRef } from \"react\";\nimport { Animated } from \"react-native\";\nimport { useSharedValue } from \"react-native-reanimated\";\n\nimport type { Handlers } from \"./types\";\n\ntype UntypedHandler = Record<string, (event: never) => void>;\ntype SharedHandlersReturnType<T extends UntypedHandler> = [\n (handler: Handlers<T>) => void,\n <K extends keyof T>(type: K, event: Parameters<T[K]>[0]) => void,\n];\n\n/**\n * Hook for storing worklet handlers (objects with keys, where values are worklets).\n * Returns methods for setting handlers and broadcasting events in them.\n *\n * T is a generic that looks like:\n * @example\n * {\n * onEvent: () => {},\n * onEvent2: () => {},\n * }\n */\nexport function useSharedHandlers<\n T extends UntypedHandler,\n>(): SharedHandlersReturnType<T> {\n const handlers = useSharedValue<Handlers<T>>({});\n const jsHandlers = useRef<Handlers<T>>({});\n\n // since js -> worklet -> js call is asynchronous, we can not write handlers\n // straight into shared variable (using current shared value as a previous result),\n // since there may be a race condition in a call, and closure may have out-of-dated\n // values. As a result, some of handlers may be not written to \"all handlers\" object.\n // Below we are writing all handlers to `ref` and afterwards synchronize them with\n // shared value (since `refs` are not referring to actual value in worklets).\n // This approach allow us to update synchronously handlers in js thread (and it assures,\n // that it will have all of them) and then update them in worklet thread (calls are\n // happening in FIFO order, so we will always have actual value).\n const updateSharedHandlers = () => {\n // eslint-disable-next-line react-compiler/react-compiler\n handlers.value = jsHandlers.current;\n };\n const setHandlers = useCallback((handler: Handlers<T>) => {\n jsHandlers.current = {\n ...jsHandlers.current,\n ...handler,\n };\n updateSharedHandlers();\n }, []);\n const broadcast = <K extends keyof T>(\n type: K,\n event: Parameters<T[K]>[0],\n ) => {\n \"worklet\";\n\n Object.keys(handlers.value).forEach((key) => {\n handlers.value[key]?.[type]?.(event);\n });\n };\n\n return [setHandlers, broadcast];\n}\n\n/**\n * TS variant of `useAnimatedValue` hook which is added in RN 0.71\n * A better alternative of storing animated values in refs, since\n * it doesn't recreate a new `Animated.Value` object on every re-render\n * and therefore consumes less memory. We can not use a variant from\n * RN, since this library supports earlier versions of RN.\n *\n * @see https://github.com/facebook/react-native/commit/e22217fe8b9455e32695f88ca835e11442b0a937\n */\nexport function useAnimatedValue(\n initialValue: number,\n config?: Animated.AnimatedConfig,\n): Animated.Value {\n const ref = useRef<Animated.Value | null>(null);\n\n if (ref.current == null) {\n ref.current = new Animated.Value(initialValue, config);\n }\n\n return ref.current;\n}\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,MAAM,QAAQ,OAAO;AAC3C,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,cAAc,QAAQ,yBAAyB;AAUxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAAA,EAEA;EAC/B,MAAMC,QAAQ,GAAGF,cAAc,CAAc,CAAC,CAAC,CAAC;EAChD,MAAMG,UAAU,GAAGL,MAAM,CAAc,CAAC,CAAC,CAAC;;EAE1C;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,MAAMM,oBAAoB,GAAGA,CAAA,KAAM;IACjC;IACAF,QAAQ,CAACG,KAAK,GAAGF,UAAU,CAACG,OAAO;EACrC,CAAC;EACD,MAAMC,WAAW,GAAGV,WAAW,CAAEW,OAAoB,IAAK;IACxDL,UAAU,CAACG,OAAO,GAAG;MACnB,GAAGH,UAAU,CAACG,OAAO;MACrB,GAAGE;IACL,CAAC;IACDJ,oBAAoB,CAAC,CAAC;EACxB,CAAC,EAAE,EAAE,CAAC;EACN,MAAMK,SAAS,GAAGA,CAChBC,IAAO,EACPC,KAA0B,KACvB;IACH,SAAS;;IAETC,MAAM,CAACC,IAAI,CAACX,QAAQ,CAACG,KAAK,CAAC,CAACS,OAAO,CAAEC,GAAG,IAAK;MAAA,IAAAC,mBAAA,EAAAC,qBAAA;MAC3C,CAAAD,mBAAA,GAAAd,QAAQ,CAACG,KAAK,CAACU,GAAG,CAAC,cAAAC,mBAAA,gBAAAC,qBAAA,GAAnBD,mBAAA,CAAsBN,IAAI,CAAC,cAAAO,qBAAA,eAA3BA,qBAAA,CAAAC,IAAA,CAAAF,mBAAA,EAA8BL,KAAK,CAAC;IACtC,CAAC,CAAC;EACJ,CAAC;EAED,OAAO,CAACJ,WAAW,EAAEE,SAAS,CAAC;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASU,gBAAgBA,CAC9BC,YAAoB,EACpBC,MAAgC,EAChB;EAChB,MAAMC,GAAG,GAAGxB,MAAM,CAAwB,IAAI,CAAC;EAE/C,IAAIwB,GAAG,CAAChB,OAAO,IAAI,IAAI,EAAE;IACvBgB,GAAG,CAAChB,OAAO,GAAG,IAAIP,QAAQ,CAACwB,KAAK,CAACH,YAAY,EAAEC,MAAM,CAAC;EACxD;EAEA,OAAOC,GAAG,CAAChB,OAAO;AACpB","ignoreList":[]}
1
+ {"version":3,"names":["useCallback","useRef","Animated","useSharedValue","findNodeHandle","useEventHandlerRegistration","viewTagRef","onRegisterHandler","handler","currentHandler","attachWorkletHandlers","viewTag","current","__DEV__","console","warn","workletEventHandler","registerForEvents","queueMicrotask","unregisterFromEvents","useSharedHandlers","handlers","jsHandlers","updateSharedHandlers","value","setHandlers","broadcast","type","event","Object","keys","forEach","key","_handlers$value$key","_handlers$value$key$t","call","useAnimatedValue","initialValue","config","ref","Value"],"sources":["internal.ts"],"sourcesContent":["import { useCallback, useRef } from \"react\";\nimport { Animated } from \"react-native\";\nimport { useSharedValue } from \"react-native-reanimated\";\n\nimport { findNodeHandle } from \"./utils/findNodeHandle\";\n\nimport type { EventHandlerProcessed } from \"react-native-reanimated\";\nimport type { Handlers } from \"./types\";\n\ntype ComponentOrHandle = Parameters<typeof findNodeHandle>[0];\n\ntype WorkletHandler = {\n registerForEvents: (viewTag: number) => void;\n unregisterFromEvents: (viewTag: number) => void;\n};\n\ntype WorkletHandlerOrWorkletHandlerObject =\n | WorkletHandler\n | {\n workletEventHandler: WorkletHandler;\n };\n\nexport function useEventHandlerRegistration(\n viewTagRef: React.MutableRefObject<ComponentOrHandle>,\n) {\n const onRegisterHandler = (handler: EventHandlerProcessed<never, never>) => {\n const currentHandler =\n handler as unknown as WorkletHandlerOrWorkletHandlerObject;\n const attachWorkletHandlers = () => {\n const viewTag = findNodeHandle(viewTagRef.current);\n\n if (__DEV__ && !viewTag) {\n console.warn(\n \"Can not attach worklet handlers for `react-native-keyboard-controller` because view tag can not be resolved. Be sure that `KeyboardProvider` is fully mounted before registering handlers. If you think it is a bug in library, please open an issue.\",\n );\n }\n\n if (viewTag) {\n if (\"workletEventHandler\" in currentHandler) {\n currentHandler.workletEventHandler.registerForEvents(viewTag);\n } else {\n currentHandler.registerForEvents(viewTag);\n }\n }\n };\n\n if (viewTagRef.current) {\n attachWorkletHandlers();\n } else {\n queueMicrotask(attachWorkletHandlers);\n }\n\n return () => {\n const viewTag = findNodeHandle(viewTagRef.current);\n\n if (viewTag) {\n if (\"workletEventHandler\" in currentHandler) {\n currentHandler.workletEventHandler.unregisterFromEvents(viewTag);\n } else {\n currentHandler.unregisterFromEvents(viewTag);\n }\n }\n };\n };\n\n return onRegisterHandler;\n}\n\ntype UntypedHandler = Record<string, (event: never) => void>;\ntype SharedHandlersReturnType<T extends UntypedHandler> = [\n (handler: Handlers<T>) => void,\n <K extends keyof T>(type: K, event: Parameters<T[K]>[0]) => void,\n];\n\n/**\n * Hook for storing worklet handlers (objects with keys, where values are worklets).\n * Returns methods for setting handlers and broadcasting events in them.\n *\n * T is a generic that looks like:\n * @example\n * {\n * onEvent: () => {},\n * onEvent2: () => {},\n * }\n */\nexport function useSharedHandlers<\n T extends UntypedHandler,\n>(): SharedHandlersReturnType<T> {\n const handlers = useSharedValue<Handlers<T>>({});\n const jsHandlers = useRef<Handlers<T>>({});\n\n // since js -> worklet -> js call is asynchronous, we can not write handlers\n // straight into shared variable (using current shared value as a previous result),\n // since there may be a race condition in a call, and closure may have out-of-dated\n // values. As a result, some of handlers may be not written to \"all handlers\" object.\n // Below we are writing all handlers to `ref` and afterwards synchronize them with\n // shared value (since `refs` are not referring to actual value in worklets).\n // This approach allow us to update synchronously handlers in js thread (and it assures,\n // that it will have all of them) and then update them in worklet thread (calls are\n // happening in FIFO order, so we will always have actual value).\n const updateSharedHandlers = () => {\n // eslint-disable-next-line react-compiler/react-compiler\n handlers.value = jsHandlers.current;\n };\n const setHandlers = useCallback((handler: Handlers<T>) => {\n jsHandlers.current = {\n ...jsHandlers.current,\n ...handler,\n };\n updateSharedHandlers();\n }, []);\n const broadcast = <K extends keyof T>(\n type: K,\n event: Parameters<T[K]>[0],\n ) => {\n \"worklet\";\n\n Object.keys(handlers.value).forEach((key) => {\n handlers.value[key]?.[type]?.(event);\n });\n };\n\n return [setHandlers, broadcast];\n}\n\n/**\n * TS variant of `useAnimatedValue` hook which is added in RN 0.71\n * A better alternative of storing animated values in refs, since\n * it doesn't recreate a new `Animated.Value` object on every re-render\n * and therefore consumes less memory. We can not use a variant from\n * RN, since this library supports earlier versions of RN.\n *\n * @see https://github.com/facebook/react-native/commit/e22217fe8b9455e32695f88ca835e11442b0a937\n */\nexport function useAnimatedValue(\n initialValue: number,\n config?: Animated.AnimatedConfig,\n): Animated.Value {\n const ref = useRef<Animated.Value | null>(null);\n\n if (ref.current == null) {\n ref.current = new Animated.Value(initialValue, config);\n }\n\n return ref.current;\n}\n"],"mapp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