@react-native-ohos/react-native-keyboard-controller 1.16.7 → 1.16.8

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 (182) hide show
  1. package/LICENSE +21 -21
  2. package/README.OpenSource +10 -10
  3. package/README.md +610 -19
  4. package/harmony/keyboard_controller/BuildProfile.ets +16 -16
  5. package/harmony/keyboard_controller/Index.ets +28 -28
  6. package/harmony/keyboard_controller/build-profile.json5 +31 -31
  7. package/harmony/keyboard_controller/hvigorfile.ts +6 -6
  8. package/harmony/keyboard_controller/obfuscation-rules.txt +17 -17
  9. package/harmony/keyboard_controller/oh-package-lock.json5 +28 -19
  10. package/harmony/keyboard_controller/oh-package.json5 +10 -10
  11. package/harmony/keyboard_controller/src/main/cpp/CMakeLists.txt +7 -7
  12. package/harmony/keyboard_controller/src/main/cpp/EventEmitters.cpp +119 -96
  13. package/harmony/keyboard_controller/src/main/cpp/EventEmitters.h +111 -111
  14. package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentDescriptor.h +94 -94
  15. package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.cpp +833 -287
  16. package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.h +169 -103
  17. package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewJSIBinder.h +65 -65
  18. package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentDescriptor.h +79 -79
  19. package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.cpp +107 -107
  20. package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.h +83 -83
  21. package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaJSIBinder.h +60 -60
  22. package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.cpp +46 -46
  23. package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.h +48 -48
  24. package/harmony/keyboard_controller/src/main/cpp/RNStatusBarManagerCompat.cpp +45 -45
  25. package/harmony/keyboard_controller/src/main/cpp/RNStatusBarManagerCompat.h +49 -49
  26. package/harmony/keyboard_controller/src/main/cpp/ViewHierarchyNavigator.cpp +186 -186
  27. package/harmony/keyboard_controller/src/main/cpp/ViewHierarchyNavigator.h +112 -112
  28. package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.cpp +64 -64
  29. package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.h +77 -77
  30. package/harmony/keyboard_controller/src/main/ets/Logger.ts +66 -66
  31. package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerPackage.ts +66 -66
  32. package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerTurboModule.ts +441 -273
  33. package/harmony/keyboard_controller/src/main/ets/RNStatusBarManagerCompatTurboModule.ts +128 -119
  34. package/harmony/keyboard_controller/src/main/ets/Type.ts +62 -62
  35. package/harmony/keyboard_controller/src/main/module.json5 +11 -11
  36. package/harmony/keyboard_controller/src/main/resources/base/element/string.json +8 -8
  37. package/harmony/keyboard_controller/src/main/resources/en_US/element/string.json +8 -8
  38. package/harmony/keyboard_controller/src/main/resources/zh_CN/element/string.json +8 -8
  39. package/harmony/keyboard_controller/ts.ts +29 -29
  40. package/harmony/keyboard_controller.har +0 -0
  41. package/lib/commonjs/animated.js +2 -2
  42. package/lib/commonjs/animated.js.map +1 -1
  43. package/lib/commonjs/bindings.js +3 -3
  44. package/lib/commonjs/bindings.js.map +1 -1
  45. package/lib/commonjs/bindings.native.js +3 -3
  46. package/lib/commonjs/bindings.native.js.map +1 -1
  47. package/lib/commonjs/components/KeyboardAvoidingView/hooks.js.map +1 -1
  48. package/lib/commonjs/components/KeyboardAvoidingView/index.js +3 -3
  49. package/lib/commonjs/components/KeyboardAvoidingView/index.js.map +1 -1
  50. package/lib/commonjs/components/KeyboardAwareScrollView/index.js +43 -41
  51. package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
  52. package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +3 -3
  53. package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
  54. package/lib/commonjs/components/KeyboardAwareScrollView/utils.js.map +1 -1
  55. package/lib/commonjs/components/KeyboardStickyView/index.js.map +1 -1
  56. package/lib/commonjs/components/KeyboardToolbar/Arrow.js.map +1 -1
  57. package/lib/commonjs/components/KeyboardToolbar/Button.js.map +1 -1
  58. package/lib/commonjs/components/KeyboardToolbar/colors.js.map +1 -1
  59. package/lib/commonjs/components/KeyboardToolbar/colors.native.js.map +1 -1
  60. package/lib/commonjs/components/KeyboardToolbar/index.js +3 -3
  61. package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -1
  62. package/lib/commonjs/components/KeyboardToolbar/types.js.map +1 -1
  63. package/lib/commonjs/components/hooks/useColorScheme.js.map +1 -1
  64. package/lib/commonjs/components/index.js.map +1 -1
  65. package/lib/commonjs/constants.js.map +1 -1
  66. package/lib/commonjs/context.js +0 -1
  67. package/lib/commonjs/context.js.map +1 -1
  68. package/lib/commonjs/hooks/index.js.map +1 -1
  69. package/lib/commonjs/hooks/useWindowDimensions/index.android.js.map +1 -1
  70. package/lib/commonjs/hooks/useWindowDimensions/index.js.map +1 -1
  71. package/lib/commonjs/index.js.map +1 -1
  72. package/lib/commonjs/internal.js +18 -18
  73. package/lib/commonjs/internal.js.map +1 -1
  74. package/lib/commonjs/module.js.map +1 -1
  75. package/lib/commonjs/monkey-patch.android.js +4 -4
  76. package/lib/commonjs/monkey-patch.android.js.map +1 -1
  77. package/lib/commonjs/monkey-patch.js.map +1 -1
  78. package/lib/commonjs/reanimated.js.map +1 -1
  79. package/lib/commonjs/reanimated.native.js.map +1 -1
  80. package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js.map +1 -1
  81. package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js.map +1 -1
  82. package/lib/commonjs/specs/NativeKeyboardController.js.map +1 -1
  83. package/lib/commonjs/specs/NativeStatusBarManagerCompat.js.map +1 -1
  84. package/lib/commonjs/specs/OverKeyboardViewNativeComponent.js.map +1 -1
  85. package/lib/commonjs/types.js.map +1 -1
  86. package/lib/commonjs/utils.js.map +1 -1
  87. package/lib/commonjs/views/OverKeyboardView/index.js.map +1 -1
  88. package/lib/commonjs/views/index.js.map +1 -1
  89. package/lib/module/animated.js +2 -2
  90. package/lib/module/animated.js.map +1 -1
  91. package/lib/module/bindings.js +3 -3
  92. package/lib/module/bindings.js.map +1 -1
  93. package/lib/module/bindings.native.js +3 -3
  94. package/lib/module/bindings.native.js.map +1 -1
  95. package/lib/module/components/KeyboardAvoidingView/hooks.js.map +1 -1
  96. package/lib/module/components/KeyboardAvoidingView/index.js +3 -3
  97. package/lib/module/components/KeyboardAvoidingView/index.js.map +1 -1
  98. package/lib/module/components/KeyboardAwareScrollView/index.js +44 -42
  99. package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -1
  100. package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +3 -3
  101. package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
  102. package/lib/module/components/KeyboardAwareScrollView/utils.js.map +1 -1
  103. package/lib/module/components/KeyboardStickyView/index.js.map +1 -1
  104. package/lib/module/components/KeyboardToolbar/Arrow.js.map +1 -1
  105. package/lib/module/components/KeyboardToolbar/Button.js.map +1 -1
  106. package/lib/module/components/KeyboardToolbar/colors.js.map +1 -1
  107. package/lib/module/components/KeyboardToolbar/colors.native.js.map +1 -1
  108. package/lib/module/components/KeyboardToolbar/index.js +3 -3
  109. package/lib/module/components/KeyboardToolbar/index.js.map +1 -1
  110. package/lib/module/components/KeyboardToolbar/types.js.map +1 -1
  111. package/lib/module/components/hooks/useColorScheme.js.map +1 -1
  112. package/lib/module/components/index.js.map +1 -1
  113. package/lib/module/constants.js.map +1 -1
  114. package/lib/module/context.js +0 -1
  115. package/lib/module/context.js.map +1 -1
  116. package/lib/module/hooks/index.js.map +1 -1
  117. package/lib/module/hooks/useWindowDimensions/index.android.js.map +1 -1
  118. package/lib/module/hooks/useWindowDimensions/index.js.map +1 -1
  119. package/lib/module/index.js.map +1 -1
  120. package/lib/module/internal.js +18 -18
  121. package/lib/module/internal.js.map +1 -1
  122. package/lib/module/module.js.map +1 -1
  123. package/lib/module/monkey-patch.android.js +4 -4
  124. package/lib/module/monkey-patch.android.js.map +1 -1
  125. package/lib/module/monkey-patch.js.map +1 -1
  126. package/lib/module/reanimated.js.map +1 -1
  127. package/lib/module/reanimated.native.js.map +1 -1
  128. package/lib/module/specs/KeyboardControllerViewNativeComponent.js.map +1 -1
  129. package/lib/module/specs/KeyboardGestureAreaNativeComponent.js.map +1 -1
  130. package/lib/module/specs/NativeKeyboardController.js.map +1 -1
  131. package/lib/module/specs/NativeStatusBarManagerCompat.js.map +1 -1
  132. package/lib/module/specs/OverKeyboardViewNativeComponent.js.map +1 -1
  133. package/lib/module/types.js.map +1 -1
  134. package/lib/module/utils.js.map +1 -1
  135. package/lib/module/views/OverKeyboardView/index.js.map +1 -1
  136. package/lib/module/views/index.js.map +1 -1
  137. package/lib/typescript/bindings.d.ts +3 -4
  138. package/lib/typescript/bindings.native.d.ts +0 -1
  139. package/lib/typescript/components/KeyboardAwareScrollView/index.d.ts +6 -6
  140. package/lib/typescript/components/KeyboardAwareScrollView/utils.d.ts +1 -1
  141. package/lib/typescript/components/KeyboardStickyView/index.d.ts +5 -5
  142. package/lib/typescript/components/KeyboardToolbar/Button.d.ts +2 -1
  143. package/lib/typescript/types.d.ts +1 -0
  144. package/package.json +177 -174
  145. package/src/animated.tsx +255 -255
  146. package/src/bindings.native.ts +62 -62
  147. package/src/bindings.ts +42 -42
  148. package/src/components/KeyboardAvoidingView/hooks.ts +123 -123
  149. package/src/components/KeyboardAvoidingView/index.tsx +188 -188
  150. package/src/components/KeyboardAwareScrollView/index.tsx +397 -389
  151. package/src/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.ts +133 -133
  152. package/src/components/KeyboardAwareScrollView/utils.ts +41 -41
  153. package/src/components/KeyboardStickyView/index.tsx +66 -66
  154. package/src/components/KeyboardToolbar/Arrow.tsx +80 -80
  155. package/src/components/KeyboardToolbar/Button.tsx +98 -98
  156. package/src/components/KeyboardToolbar/colors.native.ts +37 -37
  157. package/src/components/KeyboardToolbar/colors.ts +16 -16
  158. package/src/components/KeyboardToolbar/index.tsx +223 -223
  159. package/src/components/KeyboardToolbar/types.ts +40 -40
  160. package/src/components/hooks/useColorScheme.ts +5 -5
  161. package/src/components/index.ts +11 -11
  162. package/src/constants.ts +19 -19
  163. package/src/context.ts +68 -69
  164. package/src/hooks/index.ts +90 -90
  165. package/src/hooks/useWindowDimensions/index.android.ts +38 -38
  166. package/src/hooks/useWindowDimensions/index.ts +1 -1
  167. package/src/index.ts +23 -23
  168. package/src/internal.ts +84 -84
  169. package/src/module.ts +52 -52
  170. package/src/monkey-patch.android.ts +44 -44
  171. package/src/monkey-patch.ts +4 -4
  172. package/src/reanimated.native.ts +132 -132
  173. package/src/reanimated.ts +29 -29
  174. package/src/specs/KeyboardControllerViewNativeComponent.ts +71 -71
  175. package/src/specs/KeyboardGestureAreaNativeComponent.ts +20 -20
  176. package/src/specs/NativeKeyboardController.ts +19 -19
  177. package/src/specs/NativeStatusBarManagerCompat.ts +14 -14
  178. package/src/specs/OverKeyboardViewNativeComponent.ts +12 -12
  179. package/src/types.ts +244 -243
  180. package/src/utils.ts +1 -1
  181. package/src/views/OverKeyboardView/index.tsx +43 -43
  182. package/src/views/index.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["uuid","Math","random","toString","slice","exports"],"sources":["utils.ts"],"sourcesContent":["export const uuid = () => Math.random().toString(36).slice(-6);\r\n"],"mappings":";;;;;;AAAO,MAAMA,IAAI,GAAGA,CAAA,KAAMC,IAAI,CAACC,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC;AAACC,OAAA,CAAAL,IAAA,GAAAA,IAAA","ignoreList":[]}
1
+ {"version":3,"names":["uuid","Math","random","toString","slice","exports"],"sources":["utils.ts"],"sourcesContent":["export const uuid = () => Math.random().toString(36).slice(-6);\n"],"mappings":";;;;;;AAAO,MAAMA,IAAI,GAAGA,CAAA,KAAMC,IAAI,CAACC,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC;AAACC,OAAA,CAAAL,IAAA,GAAAA,IAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_bindings","_hooks","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","OverKeyboardView","children","visible","height","width","useWindowDimensions","inner","useMemo","style","styles","absolute","Platform","OS","global","_IS_FABRIC","undefined","createElement","RCTOverKeyboardView","View","collapsable","StyleSheet","create","position","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\r\nimport { Platform, StyleSheet, View } from \"react-native\";\r\n\r\nimport { RCTOverKeyboardView } from \"../../bindings\";\r\nimport { useWindowDimensions } from \"../../hooks\";\r\n\r\nimport type { OverKeyboardViewProps } from \"../../types\";\r\nimport type { PropsWithChildren } from \"react\";\r\n\r\nconst OverKeyboardView = ({\r\n children,\r\n visible,\r\n}: PropsWithChildren<OverKeyboardViewProps>) => {\r\n const { height, width } = useWindowDimensions();\r\n const inner = useMemo(() => ({ height, width }), [height, width]);\r\n const style = useMemo(\r\n () => [\r\n styles.absolute,\r\n // On iOS - stretch view to full window dimensions to make yoga work\r\n // On Android Fabric we temporarily use the same approach\r\n // @ts-expect-error `_IS_FABRIC` is injected by REA\r\n Platform.OS === \"ios\" || global._IS_FABRIC ? inner : undefined,\r\n ],\r\n [inner],\r\n );\r\n\r\n return (\r\n <RCTOverKeyboardView visible={visible}>\r\n {/* `OverKeyboardView` should always have a single child */}\r\n <View collapsable={false} style={style}>\r\n {children}\r\n </View>\r\n </RCTOverKeyboardView>\r\n );\r\n};\r\n\r\nconst styles = StyleSheet.create({\r\n absolute: {\r\n position: \"absolute\",\r\n },\r\n});\r\n\r\nexport default OverKeyboardView;\r\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAAkD,SAAAD,wBAAAK,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAP,uBAAA,YAAAA,CAAAK,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAKlD,MAAMkB,gBAAgB,GAAGA,CAAC;EACxBC,QAAQ;EACRC;AACwC,CAAC,KAAK;EAC9C,MAAM;IAAEC,MAAM;IAAEC;EAAM,CAAC,GAAG,IAAAC,0BAAmB,EAAC,CAAC;EAC/C,MAAMC,KAAK,GAAG,IAAAC,cAAO,EAAC,OAAO;IAAEJ,MAAM;IAAEC;EAAM,CAAC,CAAC,EAAE,CAACD,MAAM,EAAEC,KAAK,CAAC,CAAC;EACjE,MAAMI,KAAK,GAAG,IAAAD,cAAO,EACnB,MAAM,CACJE,MAAM,CAACC,QAAQ;EACf;EACA;EACA;EACAC,qBAAQ,CAACC,EAAE,KAAK,KAAK,IAAIC,MAAM,CAACC,UAAU,GAAGR,KAAK,GAAGS,SAAS,CAC/D,EACD,CAACT,KAAK,CACR,CAAC;EAED,oBACE/B,MAAA,CAAAgB,OAAA,CAAAyB,aAAA,CAACrC,SAAA,CAAAsC,mBAAmB;IAACf,OAAO,EAAEA;EAAQ,gBAEpC3B,MAAA,CAAAgB,OAAA,CAAAyB,aAAA,CAACtC,YAAA,CAAAwC,IAAI;IAACC,WAAW,EAAE,KAAM;IAACX,KAAK,EAAEA;EAAM,GACpCP,QACG,CACa,CAAC;AAE1B,CAAC;AAED,MAAMQ,MAAM,GAAGW,uBAAU,CAACC,MAAM,CAAC;EAC/BX,QAAQ,EAAE;IACRY,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAjC,OAAA,GAEYS,gBAAgB","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_bindings","_hooks","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","OverKeyboardView","children","visible","height","width","useWindowDimensions","inner","useMemo","style","styles","absolute","Platform","OS","global","_IS_FABRIC","undefined","createElement","RCTOverKeyboardView","View","collapsable","StyleSheet","create","position","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { Platform, StyleSheet, View } from \"react-native\";\n\nimport { RCTOverKeyboardView } from \"../../bindings\";\nimport { useWindowDimensions } from \"../../hooks\";\n\nimport type { OverKeyboardViewProps } from \"../../types\";\nimport type { PropsWithChildren } from \"react\";\n\nconst OverKeyboardView = ({\n children,\n visible,\n}: PropsWithChildren<OverKeyboardViewProps>) => {\n const { height, width } = useWindowDimensions();\n const inner = useMemo(() => ({ height, width }), [height, width]);\n const style = useMemo(\n () => [\n styles.absolute,\n // On iOS - stretch view to full window dimensions to make yoga work\n // On Android Fabric we temporarily use the same approach\n // @ts-expect-error `_IS_FABRIC` is injected by REA\n Platform.OS === \"ios\" || global._IS_FABRIC ? inner : undefined,\n ],\n [inner],\n );\n\n return (\n <RCTOverKeyboardView visible={visible}>\n {/* `OverKeyboardView` should always have a single child */}\n <View collapsable={false} style={style}>\n {children}\n </View>\n </RCTOverKeyboardView>\n );\n};\n\nconst styles = StyleSheet.create({\n absolute: {\n position: \"absolute\",\n },\n});\n\nexport default OverKeyboardView;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAAkD,SAAAD,wBAAAK,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAP,uBAAA,YAAAA,CAAAK,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAA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,CAAAgB,OAAA,CAAAyB,aAAA,CAACtC,YAAA,CAAAwC,IAAI;IAACC,WAAW,EAAE,KAAM;IAACX,KAAK,EAAEA;EAAM,GACpCP,QACG,CACa,CAAC;AAE1B,CAAC;AAED,MAAMQ,MAAM,GAAGW,uBAAU,CAACC,MAAM,CAAC;EAC/BX,QAAQ,EAAE;IACRY,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAjC,OAAA,GAEYS,gBAAgB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_OverKeyboardView","_interopRequireDefault","require","e","__esModule","default"],"sources":["index.ts"],"sourcesContent":["export { default as OverKeyboardView } from \"./OverKeyboardView\";\r\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAiE,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
1
+ {"version":3,"names":["_OverKeyboardView","_interopRequireDefault","require","e","__esModule","default"],"sources":["index.ts"],"sourcesContent":["export { default as OverKeyboardView } from \"./OverKeyboardView\";\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAiE,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
@@ -89,13 +89,13 @@ export const KeyboardProvider = ({
89
89
  "worklet";
90
90
 
91
91
  broadcastKeyboardEvents("onMove", event);
92
- updateSharedValues(event, ["android"]);
92
+ updateSharedValues(event, ["android", "harmony"]);
93
93
  },
94
94
  onKeyboardMoveEnd: event => {
95
95
  "worklet";
96
96
 
97
97
  broadcastKeyboardEvents("onEnd", event);
98
- updateSharedValues(event, ['harmony']);
98
+ updateSharedValues(event, ["android", "harmony"]);
99
99
  },
100
100
  onKeyboardMoveInteractive: event => {
101
101
  "worklet";
@@ -1 +1 @@
1
- {"version":3,"names":["React","useEffect","useMemo","useState","Animated","Platform","StyleSheet","Reanimated","useSharedValue","KeyboardControllerView","KeyboardContext","useAnimatedValue","useSharedHandlers","applyMonkeyPatch","revertMonkeyPatch","useAnimatedKeyboardHandler","useFocusedInputLayoutHandler","useFocusedInputSelectionHandler","useFocusedInputTextHandler","KeyboardControllerViewAnimated","createAnimatedComponent","styles","create","container","flex","hidden","display","position","OS","KeyboardProvider","children","statusBarTranslucent","navigationBarTranslucent","preserveEdgeToEdge","enabled","initiallyEnabled","setEnabled","progress","height","progressSV","heightSV","layout","setKeyboardHandlers","broadcastKeyboardEvents","setInputHandlers","broadcastInputEvents","context","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","value","keyboardHandler","onKeyboardMoveStart","onKeyboardMoveEnd","onKeyboardMoveInteractive","inputLayoutHandler","onFocusedInputLayoutChanged","e","target","inputTextHandler","onFocusedInputTextChanged","inputSelectionHandler","onFocusedInputSelectionChanged","createElement","Provider","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","onFocusedInputTextChangedReanimated","onFocusedInputSelectionChangedReanimated","View"],"sources":["animated.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from \"react\";\r\nimport { Animated, Platform, StyleSheet } from \"react-native\";\r\nimport Reanimated, { useSharedValue } from \"react-native-reanimated\";\r\n\r\nimport { KeyboardControllerView } from \"./bindings\";\r\nimport { KeyboardContext } from \"./context\";\r\nimport { useAnimatedValue, useSharedHandlers } from \"./internal\";\r\nimport { applyMonkeyPatch, revertMonkeyPatch } from \"./monkey-patch\";\r\nimport {\r\n useAnimatedKeyboardHandler,\r\n useFocusedInputLayoutHandler,\r\n useFocusedInputSelectionHandler,\r\n useFocusedInputTextHandler,\r\n} from \"./reanimated\";\r\n\r\nimport type { KeyboardAnimationContext } from \"./context\";\r\nimport type {\r\n FocusedInputHandler,\r\n FocusedInputLayoutChangedEvent,\r\n KeyboardControllerProps,\r\n KeyboardHandler,\r\n NativeEvent,\r\n} from \"./types\";\r\nimport type { ViewStyle } from \"react-native\";\r\n\r\nconst KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\r\n Animated.createAnimatedComponent(\r\n KeyboardControllerView,\r\n ) as React.FC<KeyboardControllerProps>,\r\n);\r\n\r\ntype Styles = {\r\n container: ViewStyle;\r\n hidden: ViewStyle;\r\n};\r\n\r\nconst styles = StyleSheet.create<Styles>({\r\n container: {\r\n flex: 1,\r\n },\r\n hidden: {\r\n display: \"none\",\r\n position: \"absolute\",\r\n },\r\n});\r\n\r\ntype KeyboardProviderProps = {\r\n children: React.ReactNode;\r\n /**\r\n * Set the value to `true`, if you use translucent status bar on Android.\r\n * If you already control status bar translucency via `react-native-screens`\r\n * or `StatusBar` component from `react-native`, you can ignore it.\r\n * Defaults to `false`.\r\n *\r\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\r\n * @platform android\r\n */\r\n statusBarTranslucent?: boolean;\r\n /**\r\n * Set the value to `true`, if you use translucent navigation bar on Android.\r\n * Defaults to `false`.\r\n *\r\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\r\n * @platform android\r\n */\r\n navigationBarTranslucent?: boolean;\r\n /**\r\n * A boolean property indicating whether to keep edge-to-edge mode always enabled (even when you disable the module).\r\n * Defaults to `false`.\r\n *\r\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/592\r\n * @platform android\r\n */\r\n preserveEdgeToEdge?: boolean;\r\n /**\r\n * A boolean prop indicating whether the module is enabled. It indicate only initial state,\r\n * i. e. if you try to change this prop after component mount it will not have any effect.\r\n * To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.\r\n * Defaults to `true`.\r\n */\r\n enabled?: boolean;\r\n};\r\n\r\n// capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package\r\n// see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/393 and https://github.com/kirillzyusko/react-native-keyboard-controller/issues/294 for more details\r\nconst OS = Platform.OS;\r\n\r\nexport const KeyboardProvider = ({\r\n children,\r\n statusBarTranslucent,\r\n navigationBarTranslucent,\r\n preserveEdgeToEdge,\r\n enabled: initiallyEnabled = true,\r\n}: KeyboardProviderProps) => {\r\n // state\r\n const [enabled, setEnabled] = useState(initiallyEnabled);\r\n // animated values\r\n const progress = useAnimatedValue(0);\r\n const height = useAnimatedValue(0);\r\n // shared values\r\n const progressSV = useSharedValue(0);\r\n const heightSV = useSharedValue(0);\r\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\r\n const [setKeyboardHandlers, broadcastKeyboardEvents] =\r\n useSharedHandlers<KeyboardHandler>();\r\n const [setInputHandlers, broadcastInputEvents] =\r\n useSharedHandlers<FocusedInputHandler>();\r\n // memo\r\n const context = useMemo<KeyboardAnimationContext>(\r\n () => ({\r\n enabled,\r\n animated: { progress: progress, height: Animated.multiply(height,-1) },\r\n reanimated: { progress: progressSV, height: heightSV },\r\n layout,\r\n setKeyboardHandlers,\r\n setInputHandlers,\r\n setEnabled,\r\n }),\r\n [enabled],\r\n );\r\n const style = useMemo(\r\n () => [\r\n styles.hidden,\r\n { transform: [{ translateX: height }, { translateY: progress }] },\r\n ],\r\n [],\r\n );\r\n const onKeyboardMove = useMemo(\r\n () =>\r\n Animated.event(\r\n [\r\n {\r\n nativeEvent: {\r\n progress,\r\n height,\r\n },\r\n },\r\n ],\r\n { useNativeDriver:Platform.OS as string=='harmony'?false:true },\r\n ),\r\n [],\r\n );\r\n // handlers\r\n const updateSharedValues = (event: NativeEvent, platforms: string[]) => {\r\n \"worklet\";\r\n\r\n if (platforms.includes(OS)) {\r\n // eslint-disable-next-line react-compiler/react-compiler\r\n progressSV.value = event.progress;\r\n heightSV.value = -event.height;\r\n }\r\n };\r\n const keyboardHandler = useAnimatedKeyboardHandler(\r\n {\r\n onKeyboardMoveStart: (event: NativeEvent) => {\r\n \"worklet\";\r\n\r\n broadcastKeyboardEvents(\"onStart\", event);\r\n updateSharedValues(event, [\"ios\"]);\r\n },\r\n onKeyboardMove: (event: NativeEvent) => {\r\n \"worklet\";\r\n\r\n broadcastKeyboardEvents(\"onMove\", event);\r\n updateSharedValues(event, [\"android\"]);\r\n },\r\n onKeyboardMoveEnd: (event: NativeEvent) => {\r\n \"worklet\";\r\n broadcastKeyboardEvents(\"onEnd\", event);\r\n updateSharedValues(event, ['harmony']);\r\n },\r\n onKeyboardMoveInteractive: (event: NativeEvent) => {\r\n \"worklet\";\r\n\r\n updateSharedValues(event, [\"android\", \"ios\"]);\r\n broadcastKeyboardEvents(\"onInteractive\", event);\r\n },\r\n },\r\n [],\r\n );\r\n const inputLayoutHandler = useFocusedInputLayoutHandler(\r\n {\r\n onFocusedInputLayoutChanged: (e) => {\r\n \"worklet\";\r\n\r\n if (e.target !== -1) {\r\n layout.value = e;\r\n } else {\r\n layout.value = null;\r\n }\r\n },\r\n },\r\n [],\r\n );\r\n const inputTextHandler = useFocusedInputTextHandler(\r\n {\r\n onFocusedInputTextChanged: (e) => {\r\n \"worklet\";\r\n\r\n broadcastInputEvents(\"onChangeText\", e);\r\n },\r\n },\r\n [],\r\n );\r\n const inputSelectionHandler = useFocusedInputSelectionHandler(\r\n {\r\n onFocusedInputSelectionChanged: (e) => {\r\n \"worklet\";\r\n broadcastInputEvents(\"onSelectionChange\", e);\r\n },\r\n },\r\n [],\r\n );\r\n // effects\r\n useEffect(() => {\r\n if (enabled) {\r\n applyMonkeyPatch();\r\n } else {\r\n revertMonkeyPatch();\r\n }\r\n }, [enabled]);\r\n\r\n return (\r\n <KeyboardContext.Provider value={context}>\r\n <KeyboardControllerViewAnimated\r\n enabled={enabled}\r\n onKeyboardMoveReanimated={keyboardHandler}\r\n onKeyboardMoveStart={OS === \"ios\" ? onKeyboardMove : undefined}\r\n onKeyboardMove={OS === \"android\" ? onKeyboardMove : undefined}\r\n onKeyboardMoveInteractive={onKeyboardMove}\r\n onKeyboardMoveEnd={ OS as string === \"harmony\"?onKeyboardMove:undefined}\r\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\r\n onFocusedInputTextChangedReanimated={inputTextHandler}\r\n onFocusedInputSelectionChangedReanimated={inputSelectionHandler}\r\n navigationBarTranslucent={navigationBarTranslucent}\r\n statusBarTranslucent={statusBarTranslucent}\r\n preserveEdgeToEdge={preserveEdgeToEdge}\r\n style={styles.container}\r\n >\r\n {children}\r\n </KeyboardControllerViewAnimated>\r\n <Animated.View\r\n // we are using this small hack, because if the component (where\r\n // animated value has been used) is unmounted, then animation will\r\n // stop receiving events (seems like it's react-native optimization).\r\n // So we need to keep a reference to the animated value, to keep it's\r\n // always mounted (keep a reference to an animated value).\r\n //\r\n // To test why it's needed, try to open screen which consumes Animated.Value\r\n // then close it and open it again (for example 'Animated transition').\r\n style={style}\r\n />\r\n </KeyboardContext.Provider>\r\n );\r\n};\r\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAC3D,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AAC7D,OAAOC,UAAU,IAAIC,cAAc,QAAQ,yBAAyB;AAEpE,SAASC,sBAAsB,QAAQ,YAAY;AACnD,SAASC,eAAe,QAAQ,WAAW;AAC3C,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,YAAY;AAChE,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,gBAAgB;AACpE,SACEC,0BAA0B,EAC1BC,4BAA4B,EAC5BC,+BAA+B,EAC/BC,0BAA0B,QACrB,cAAc;AAYrB,MAAMC,8BAA8B,GAAGZ,UAAU,CAACa,uBAAuB,CACvEhB,QAAQ,CAACgB,uBAAuB,CAC9BX,sBACF,CACF,CAAC;AAOD,MAAMY,MAAM,GAAGf,UAAU,CAACgB,MAAM,CAAS;EACvCC,SAAS,EA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;IAC1CC,mBAAmB,EAAEnC,EAAE,KAAK,KAAK,GAAG0B,cAAc,GAAGuB,SAAU;IAC/DvB,cAAc,EAAE1B,EAAE,KAAK,SAAS,GAAG0B,cAAc,GAAGuB,SAAU;IAC9DZ,yBAAyB,EAAEX,cAAe;IAC1CU,iBAAiB,EAAGpC,EAAE,KAAe,SAAS,GAAC0B,cAAc,GAACuB,SAAU;IACxEC,qCAAqC,EAAEZ,kBAAmB;IAC1Da,mCAAmC,EAAET,gBAAiB;IACtDU,wCAAwC,EAAER,qBAAsB;IAChExC,wBAAwB,EAAEA,wBAAyB;IACnDD,oBAAoB,EAAEA,oBAAqB;IAC3CE,kBAAkB,EAAEA,kBAAmB;IACvCiB,KAAK,EAAE7B,MAAM,CAACE;EAAU,GAEvBO,QAC6B,CAAC,eACjC9B,KAAA,CAAA0E,aAAA,CAACtE,QAAQ,CAAC6E,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA/B,KAAK,EAAEA;EAAM,CACd,CACuB,CAAC;AAE/B,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","useEffect","useMemo","useState","Animated","Platform","StyleSheet","Reanimated","useSharedValue","KeyboardControllerView","KeyboardContext","useAnimatedValue","useSharedHandlers","applyMonkeyPatch","revertMonkeyPatch","useAnimatedKeyboardHandler","useFocusedInputLayoutHandler","useFocusedInputSelectionHandler","useFocusedInputTextHandler","KeyboardControllerViewAnimated","createAnimatedComponent","styles","create","container","flex","hidden","display","position","OS","KeyboardProvider","children","statusBarTranslucent","navigationBarTranslucent","preserveEdgeToEdge","enabled","initiallyEnabled","setEnabled","progress","height","progressSV","heightSV","layout","setKeyboardHandlers","broadcastKeyboardEvents","setInputHandlers","broadcastInputEvents","context","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","value","keyboardHandler","onKeyboardMoveStart","onKeyboardMoveEnd","onKeyboardMoveInteractive","inputLayoutHandler","onFocusedInputLayoutChanged","e","target","inputTextHandler","onFocusedInputTextChanged","inputSelectionHandler","onFocusedInputSelectionChanged","createElement","Provider","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","onFocusedInputTextChangedReanimated","onFocusedInputSelectionChangedReanimated","View"],"sources":["animated.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from \"react\";\nimport { Animated, Platform, StyleSheet } from \"react-native\";\nimport Reanimated, { useSharedValue } from \"react-native-reanimated\";\n\nimport { KeyboardControllerView } from \"./bindings\";\nimport { KeyboardContext } from \"./context\";\nimport { useAnimatedValue, useSharedHandlers } from \"./internal\";\nimport { applyMonkeyPatch, revertMonkeyPatch } from \"./monkey-patch\";\nimport {\n useAnimatedKeyboardHandler,\n useFocusedInputLayoutHandler,\n useFocusedInputSelectionHandler,\n useFocusedInputTextHandler,\n} from \"./reanimated\";\n\nimport type { KeyboardAnimationContext } from \"./context\";\nimport type {\n FocusedInputHandler,\n FocusedInputLayoutChangedEvent,\n KeyboardControllerProps,\n KeyboardHandler,\n NativeEvent,\n} from \"./types\";\nimport type { ViewStyle } from \"react-native\";\n\nconst KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\n Animated.createAnimatedComponent(\n KeyboardControllerView,\n ) as React.FC<KeyboardControllerProps>,\n);\n\ntype Styles = {\n container: ViewStyle;\n hidden: ViewStyle;\n};\n\nconst styles = StyleSheet.create<Styles>({\n container: {\n flex: 1,\n },\n hidden: {\n display: \"none\",\n position: \"absolute\",\n },\n});\n\ntype KeyboardProviderProps = {\n children: React.ReactNode;\n /**\n * Set the value to `true`, if you use translucent status bar on Android.\n * If you already control status bar translucency via `react-native-screens`\n * or `StatusBar` component from `react-native`, you can ignore it.\n * Defaults to `false`.\n *\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\n * @platform android\n */\n statusBarTranslucent?: boolean;\n /**\n * Set the value to `true`, if you use translucent navigation bar on Android.\n * Defaults to `false`.\n *\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\n * @platform android\n */\n navigationBarTranslucent?: boolean;\n /**\n * A boolean property indicating whether to keep edge-to-edge mode always enabled (even when you disable the module).\n * Defaults to `false`.\n *\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/592\n * @platform android\n */\n preserveEdgeToEdge?: boolean;\n /**\n * A boolean prop indicating whether the module is enabled. It indicate only initial state,\n * i. e. if you try to change this prop after component mount it will not have any effect.\n * To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.\n * Defaults to `true`.\n */\n enabled?: boolean;\n};\n\n// capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package\n// see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/393 and https://github.com/kirillzyusko/react-native-keyboard-controller/issues/294 for more details\nconst OS = Platform.OS;\n\nexport const KeyboardProvider = ({\n children,\n statusBarTranslucent,\n navigationBarTranslucent,\n preserveEdgeToEdge,\n enabled: initiallyEnabled = true,\n}: KeyboardProviderProps) => {\n // state\n const [enabled, setEnabled] = useState(initiallyEnabled);\n // animated values\n const progress = useAnimatedValue(0);\n const height = useAnimatedValue(0);\n // shared values\n const progressSV = useSharedValue(0);\n const heightSV = useSharedValue(0);\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\n const [setKeyboardHandlers, broadcastKeyboardEvents] =\n useSharedHandlers<KeyboardHandler>();\n const [setInputHandlers, broadcastInputEvents] =\n useSharedHandlers<FocusedInputHandler>();\n // memo\n const context = useMemo<KeyboardAnimationContext>(\n () => ({\n enabled,\n animated: { progress: progress, height: Animated.multiply(height,-1) },\n reanimated: { progress: progressSV, height: heightSV },\n layout,\n setKeyboardHandlers,\n setInputHandlers,\n setEnabled,\n }),\n [enabled],\n );\n const style = useMemo(\n () => [\n styles.hidden,\n { transform: [{ translateX: height }, { translateY: progress }] },\n ],\n [],\n );\n const onKeyboardMove = useMemo(\n () =>\n Animated.event(\n [\n {\n nativeEvent: {\n progress,\n height,\n },\n },\n ],\n { useNativeDriver:Platform.OS as string=='harmony'?false:true },\n ),\n [],\n );\n // handlers\n const updateSharedValues = (event: NativeEvent, platforms: string[]) => {\n \"worklet\";\n\n if (platforms.includes(OS)) {\n // eslint-disable-next-line react-compiler/react-compiler\n progressSV.value = event.progress;\n heightSV.value = -event.height;\n }\n };\n const keyboardHandler = useAnimatedKeyboardHandler(\n {\n onKeyboardMoveStart: (event: NativeEvent) => {\n \"worklet\";\n\n broadcastKeyboardEvents(\"onStart\", event);\n updateSharedValues(event, [\"ios\"]);\n },\n onKeyboardMove: (event: NativeEvent) => {\n \"worklet\";\n\n broadcastKeyboardEvents(\"onMove\", event);\n updateSharedValues(event, [\"android\", \"harmony\"]);\n },\n onKeyboardMoveEnd: (event: NativeEvent) => {\n \"worklet\";\n broadcastKeyboardEvents(\"onEnd\", event);\n updateSharedValues(event, [\"android\", \"harmony\"]);\n },\n onKeyboardMoveInteractive: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\", \"ios\"]);\n broadcastKeyboardEvents(\"onInteractive\", event);\n },\n },\n [],\n );\n const inputLayoutHandler = useFocusedInputLayoutHandler(\n {\n onFocusedInputLayoutChanged: (e) => {\n \"worklet\";\n\n if (e.target !== -1) {\n layout.value = e;\n } else {\n layout.value = null;\n }\n },\n },\n [],\n );\n const inputTextHandler = useFocusedInputTextHandler(\n {\n onFocusedInputTextChanged: (e) => {\n \"worklet\";\n\n broadcastInputEvents(\"onChangeText\", e);\n },\n },\n [],\n );\n const inputSelectionHandler = useFocusedInputSelectionHandler(\n {\n onFocusedInputSelectionChanged: (e) => {\n \"worklet\";\n broadcastInputEvents(\"onSelectionChange\", e);\n },\n },\n [],\n );\n // effects\n useEffect(() => {\n if (enabled) {\n applyMonkeyPatch();\n } else {\n revertMonkeyPatch();\n }\n }, [enabled]);\n\n return (\n <KeyboardContext.Provider value={context}>\n <KeyboardControllerViewAnimated\n enabled={enabled}\n onKeyboardMoveReanimated={keyboardHandler}\n onKeyboardMoveStart={OS === \"ios\" ? onKeyboardMove : undefined}\n onKeyboardMove={OS === \"android\" ? onKeyboardMove : undefined}\n onKeyboardMoveInteractive={onKeyboardMove}\n onKeyboardMoveEnd={ OS as string === \"harmony\"?onKeyboardMove:undefined}\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\n onFocusedInputTextChangedReanimated={inputTextHandler}\n onFocusedInputSelectionChangedReanimated={inputSelectionHandler}\n navigationBarTranslucent={navigationBarTranslucent}\n statusBarTranslucent={statusBarTranslucent}\n preserveEdgeToEdge={preserveEdgeToEdge}\n style={styles.container}\n >\n {children}\n </KeyboardControllerViewAnimated>\n <Animated.View\n // we are using this small hack, because if the component (where\n // animated value has been used) is unmounted, then animation will\n // stop receiving events (seems like it's react-native optimization).\n // So we need to keep a reference to the animated value, to keep it's\n // always mounted (keep a reference to an animated value).\n //\n // To test why it's needed, try to open screen which consumes Animated.Value\n // then close it and open it again (for example 'Animated transition').\n style={style}\n />\n </KeyboardContext.Provider>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAC3D,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AAC7D,OAAOC,UAAU,IAAIC,cAAc,QAAQ,yBAAyB;AAEpE,SAASC,sBAAsB,QAAQ,YAAY;AACnD,SAASC,eAAe,QAAQ,WAAW;AAC3C,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,YAAY;AAChE,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,gBAAgB;AACpE,SACEC,0BAA0B,EAC1BC,4BAA4B,EAC5BC,+BAA+B,EAC/BC,0BAA0B,QACrB,cAAc;AAYrB,MAAMC,8BAA8B,GAAGZ,UAAU,CAACa,uBAAuB,CACvEhB,QAAQ,CAACgB,uBAAuB,CAC9BX,sBACF,CACF,CAAC;AAOD,MAAMY,MAAM,GAAGf,UAAU,CAACgB,MAAM,CAAS;EACvCC,SAAS,EAAE;I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AAwB,EAAEd,eAAgB;IAC1CC,mBAAmB,EAAEnC,EAAE,KAAK,KAAK,GAAG0B,cAAc,GAAGuB,SAAU;IAC/DvB,cAAc,EAAE1B,EAAE,KAAK,SAAS,GAAG0B,cAAc,GAAGuB,SAAU;IAC9DZ,yBAAyB,EAAEX,cAAe;IAC1CU,iBAAiB,EAAGpC,EAAE,KAAe,SAAS,GAAC0B,cAAc,GAACuB,SAAU;IACxEC,qCAAqC,EAAEZ,kBAAmB;IAC1Da,mCAAmC,EAAET,gBAAiB;IACtDU,wCAAwC,EAAER,qBAAsB;IAChExC,wBAAwB,EAAEA,wBAAyB;IACnDD,oBAAoB,EAAEA,oBAAqB;IAC3CE,kBAAkB,EAAEA,kBAAmB;IACvCiB,KAAK,EAAE7B,MAAM,CAACE;EAAU,GAEvBO,QAC6B,CAAC,eACjC9B,KAAA,CAAA0E,aAAA,CAACtE,QAAQ,CAAC6E,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA/B,KAAK,EAAEA;EAAM,CACd,CACuB,CAAC;AAE/B,CAAC","ignoreList":[]}
@@ -13,9 +13,9 @@ export const KeyboardEvents = {
13
13
  remove: NOOP
14
14
  })
15
15
  };
16
- /**
17
- * This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.
18
- * Use it with cautious.
16
+ /**
17
+ * This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.
18
+ * Use it with cautious.
19
19
  */
20
20
  export const FocusedInputEvents = {
21
21
  addListener: () => ({
@@ -1 +1 @@
1
- {"version":3,"names":["View","NOOP","KeyboardControllerNative","setDefaultMode","setInputMode","dismiss","setFocusTo","addListener","removeListeners","KeyboardEvents","remove","FocusedInputEvents","WindowDimensionsEvents","KeyboardControllerView","KeyboardGestureArea","RCTOverKeyboardView"],"sources":["bindings.ts"],"sourcesContent":["import { View } from \"react-native\";\r\n\r\nimport type {\r\n FocusedInputEventsModule,\r\n KeyboardControllerNativeModule,\r\n KeyboardControllerProps,\r\n KeyboardEventsModule,\r\n KeyboardGestureAreaProps,\r\n OverKeyboardViewProps,\r\n WindowDimensionsEventsModule,\r\n} from \"./types\";\r\nimport type { EmitterSubscription } from \"react-native\";\r\n\r\nconst NOOP = () => {};\r\n\r\nexport const KeyboardControllerNative: KeyboardControllerNativeModule = {\r\n setDefaultMode: NOOP,\r\n setInputMode: NOOP,\r\n dismiss: NOOP,\r\n setFocusTo: NOOP,\r\n addListener: NOOP,\r\n removeListeners: NOOP,\r\n};\r\nexport const KeyboardEvents: KeyboardEventsModule = {\r\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\r\n};\r\n/**\r\n * This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.\r\n * Use it with cautious.\r\n */\r\nexport const FocusedInputEvents: FocusedInputEventsModule = {\r\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\r\n};\r\nexport const WindowDimensionsEvents: WindowDimensionsEventsModule = {\r\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\r\n};\r\nexport const KeyboardControllerView =\r\n View as unknown as React.FC<KeyboardControllerProps>;\r\nexport const KeyboardGestureArea =\r\n View as unknown as React.FC<KeyboardGestureAreaProps>;\r\nexport const RCTOverKeyboardView =\r\n View as unknown as React.FC<OverKeyboardViewProps>;\r\n"],"mappings":"AAAA,SAASA,IAAI,QAAQ,cAAc;AAanC,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,OAAO,MAAMC,wBAAwD,GAAG;EACtEC,cAAc,EAAEF,IAAI;EACpBG,YAAY,EAAEH,IAAI;EAClBI,OAAO,EAAEJ,IAAI;EACbK,UAAU,EAAEL,IAAI;EAChBM,WAAW,EAAEN,IAAI;EACjBO,eAAe,EAAEP;AACnB,CAAC;AACD,OAAO,MAAMQ,cAAoC,GAAG;EAClDF,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAET;EAAK,CAAC;AACtC,CAAC;AACD;AACA;AACA;AACA;AACA,OAAO,MAAMU,kBAA4C,GAAG;EAC1DJ,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAET;EAAK,CAAC;AACtC,CAAC;AACD,OAAO,MAAMW,sBAAoD,GAAG;EAClEL,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAET;EAAK,CAAC;AACtC,CAAC;AACD,OAAO,MAAMY,sBAAsB,GACjCb,IAAoD;AACtD,OAAO,MAAMc,mBAAmB,GAC9Bd,IAAqD;AACvD,OAAO,MAAMe,mBAAmB,GAC9Bf,IAAkD","ignoreList":[]}
1
+ {"version":3,"names":["View","NOOP","KeyboardControllerNative","setDefaultMode","setInputMode","dismiss","setFocusTo","addListener","removeListeners","KeyboardEvents","remove","FocusedInputEvents","WindowDimensionsEvents","KeyboardControllerView","KeyboardGestureArea","RCTOverKeyboardView"],"sources":["bindings.ts"],"sourcesContent":["import { View } from \"react-native\";\n\nimport type {\n FocusedInputEventsModule,\n KeyboardControllerNativeModule,\n KeyboardControllerProps,\n KeyboardEventsModule,\n KeyboardGestureAreaProps,\n OverKeyboardViewProps,\n WindowDimensionsEventsModule,\n} from \"./types\";\nimport type { EmitterSubscription } from \"react-native\";\n\nconst NOOP = () => {};\n\nexport const KeyboardControllerNative: KeyboardControllerNativeModule = {\n setDefaultMode: NOOP,\n setInputMode: NOOP,\n dismiss: NOOP,\n setFocusTo: NOOP,\n addListener: NOOP,\n removeListeners: NOOP,\n};\nexport const KeyboardEvents: KeyboardEventsModule = {\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\n};\n/**\n * This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.\n * Use it with cautious.\n */\nexport const FocusedInputEvents: FocusedInputEventsModule = {\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\n};\nexport const WindowDimensionsEvents: WindowDimensionsEventsModule = {\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\n};\nexport const KeyboardControllerView =\n View as unknown as React.FC<KeyboardControllerProps>;\nexport const KeyboardGestureArea =\n View as unknown as React.FC<KeyboardGestureAreaProps>;\nexport const RCTOverKeyboardView =\n View as unknown as React.FC<OverKeyboardViewProps>;\n"],"mappings":"AAAA,SAASA,IAAI,QAAQ,cAAc;AAanC,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,OAAO,MAAMC,wBAAwD,GAAG;EACtEC,cAAc,EAAEF,IAAI;EACpBG,YAAY,EAAEH,IAAI;EAClBI,OAAO,EAAEJ,IAAI;EACbK,UAAU,EAAEL,IAAI;EAChBM,WAAW,EAAEN,IAAI;EACjBO,eAAe,EAAEP;AACnB,CAAC;AACD,OAAO,MAAMQ,cAAoC,GAAG;EAClDF,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAET;EAAK,CAAC;AACtC,CAAC;AACD;AACA;AACA;AACA;AACA,OAAO,MAAMU,kBAA4C,GAAG;EAC1DJ,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAET;EAAK,CAAC;AACtC,CAAC;AACD,OAAO,MAAMW,sBAAoD,GAAG;EAClEL,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAET;EAAK,CAAC;AACtC,CAAC;AACD,OAAO,MAAMY,sBAAsB,GACjCb,IAAoD;AACtD,OAAO,MAAMc,mBAAmB,GAC9Bd,IAAqD;AACvD,OAAO,MAAMe,mBAAmB,GAC9Bf,IAAkD","ignoreList":[]}
@@ -15,9 +15,9 @@ export const KeyboardEvents = {
15
15
  addListener: (name, cb) => eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb)
16
16
  };
17
17
 
18
- /**
19
- * This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.
20
- * Use it with cautious.
18
+ /**
19
+ * This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.
20
+ * Use it with cautious.
21
21
  */
22
22
  export const FocusedInputEvents = {
23
23
  addListener: (name, cb) => eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb)
@@ -1 +1 @@
1
- {"version":3,"names":["NativeEventEmitter","Platform","LINKING_ERROR","select","ios","default","RCTKeyboardController","require","KeyboardControllerNative","Proxy","get","Error","KEYBOARD_CONTROLLER_NAMESPACE","eventEmitter","KeyboardEvents","addListener","name","cb","FocusedInputEvents","WindowDimensionsEvents","KeyboardControllerView","KeyboardGestureArea","OS","Version","children","RCTOverKeyboardView"],"sources":["bindings.native.ts"],"sourcesContent":["import { NativeEventEmitter, Platform } from \"react-native\";\r\n\r\nimport type {\r\n FocusedInputEventsModule,\r\n KeyboardControllerNativeModule,\r\n KeyboardControllerProps,\r\n KeyboardEventsModule,\r\n KeyboardGestureAreaProps,\r\n OverKeyboardViewProps,\r\n WindowDimensionsEventsModule,\r\n} from \"./types\";\r\n\r\nconst LINKING_ERROR =\r\n `The package 'react-native-keyboard-controller' doesn't seem to be linked. Make sure: \\n\\n` +\r\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: \"\" }) +\r\n \"- You rebuilt the app after installing the package\\n\" +\r\n \"- You are not using Expo Go\\n\";\r\n\r\nconst RCTKeyboardController =\r\n require(\"./specs/NativeKeyboardController\").default;\r\n\r\nexport const KeyboardControllerNative = (\r\n RCTKeyboardController\r\n ? RCTKeyboardController\r\n : new Proxy(\r\n {},\r\n {\r\n get() {\r\n throw new Error(LINKING_ERROR);\r\n },\r\n },\r\n )\r\n) as KeyboardControllerNativeModule;\r\n\r\nconst KEYBOARD_CONTROLLER_NAMESPACE = \"KeyboardController::\";\r\nconst eventEmitter = new NativeEventEmitter(KeyboardControllerNative);\r\n\r\nexport const KeyboardEvents: KeyboardEventsModule = {\r\n addListener: (name, cb) =>\r\n eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),\r\n};\r\n\r\n/**\r\n * This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.\r\n * Use it with cautious.\r\n */\r\nexport const FocusedInputEvents: FocusedInputEventsModule = {\r\n addListener: (name, cb) =>\r\n eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),\r\n};\r\nexport const WindowDimensionsEvents: WindowDimensionsEventsModule = {\r\n addListener: (name, cb) =>\r\n eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),\r\n};\r\nexport const KeyboardControllerView: React.FC<KeyboardControllerProps> =\r\n require(\"./specs/KeyboardControllerViewNativeComponent\").default;\r\nexport const KeyboardGestureArea: React.FC<KeyboardGestureAreaProps> =\r\n (Platform.OS === \"android\" && Platform.Version >= 30) || Platform.OS === \"ios\"\r\n ? require(\"./specs/KeyboardGestureAreaNativeComponent\").default\r\n : ({ children }: KeyboardGestureAreaProps) => children;\r\nexport const RCTOverKeyboardView: React.FC<OverKeyboardViewProps> =\r\n require(\"./specs/OverKeyboardViewNativeComponent\").default;\r\n"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;AAY3D,MAAMC,aAAa,GACjB,2FAA2F,GAC3FD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,qBAAqB,GACzBC,OAAO,CAAC,kCAAkC,CAAC,CAACF,OAAO;AAErD,OAAO,MAAMG,wBAAwB,GACnCF,qBAAqB,GACjBA,qBAAqB,GACrB,IAAIG,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CACF,CAC6B;AAEnC,MAAMU,6BAA6B,GAAG,sBAAsB;AAC5D,MAAMC,YAAY,GAAG,IAAIb,kBAAkB,CAACQ,wBAAwB,CAAC;AAErE,OAAO,MAAMM,cAAoC,GAAG;EAClDC,WAAW,EAAEA,CAACC,IAAI,EAAEC,EAAE,KACpBJ,YAAY,CAACE,WAAW,CAACH,6BAA6B,GAAGI,IAAI,EAAEC,EAAE;AACrE,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMC,kBAA4C,GAAG;EAC1DH,WAAW,EAAEA,CAACC,IAAI,EAAEC,EAAE,KACpBJ,YAAY,CAACE,WAAW,CAACH,6BAA6B,GAAGI,IAAI,EAAEC,EAAE;AACrE,CAAC;AACD,OAAO,MAAME,sBAAoD,GAAG;EAClEJ,WAAW,EAAEA,CAACC,IAAI,EAAEC,EAAE,KACpBJ,YAAY,CAACE,WAAW,CAACH,6BAA6B,GAAGI,IAAI,EAAEC,EAAE;AACrE,CAAC;AACD,OAAO,MAAMG,sBAAyD,GACpEb,OAAO,CAAC,+CAA+C,CAAC,CAACF,OAAO;AAClE,OAAO,MAAMgB,mBAAuD,GACjEpB,QAAQ,CAACqB,EAAE,KAAK,SAAS,IAAIrB,QAAQ,CAACsB,OAAO,IAAI,EAAE,IAAKtB,QAAQ,CAACqB,EAAE,KAAK,KAAK,GAC1Ef,OAAO,CAAC,4CAA4C,CAAC,CAACF,OAAO,GAC7D,CAAC;EAAEmB;AAAmC,CAAC,KAAKA,QAAQ;AAC1D,OAAO,MAAMC,mBAAoD,GAC/DlB,OAAO,CAAC,yCAAyC,CAAC,CAACF,OAAO","ignoreList":[]}
1
+ {"version":3,"names":["NativeEventEmitter","Platform","LINKING_ERROR","select","ios","default","RCTKeyboardController","require","KeyboardControllerNative","Proxy","get","Error","KEYBOARD_CONTROLLER_NAMESPACE","eventEmitter","KeyboardEvents","addListener","name","cb","FocusedInputEvents","WindowDimensionsEvents","KeyboardControllerView","KeyboardGestureArea","OS","Version","children","RCTOverKeyboardView"],"sources":["bindings.native.ts"],"sourcesContent":["import { NativeEventEmitter, Platform } from \"react-native\";\n\nimport type {\n FocusedInputEventsModule,\n KeyboardControllerNativeModule,\n KeyboardControllerProps,\n KeyboardEventsModule,\n KeyboardGestureAreaProps,\n OverKeyboardViewProps,\n WindowDimensionsEventsModule,\n} from \"./types\";\n\nconst LINKING_ERROR =\n `The package 'react-native-keyboard-controller' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: \"\" }) +\n \"- You rebuilt the app after installing the package\\n\" +\n \"- You are not using Expo Go\\n\";\n\nconst RCTKeyboardController =\n require(\"./specs/NativeKeyboardController\").default;\n\nexport const KeyboardControllerNative = (\n RCTKeyboardController\n ? RCTKeyboardController\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n },\n )\n) as KeyboardControllerNativeModule;\n\nconst KEYBOARD_CONTROLLER_NAMESPACE = \"KeyboardController::\";\nconst eventEmitter = new NativeEventEmitter(KeyboardControllerNative);\n\nexport const KeyboardEvents: KeyboardEventsModule = {\n addListener: (name, cb) =>\n eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),\n};\n\n/**\n * This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.\n * Use it with cautious.\n */\nexport const FocusedInputEvents: FocusedInputEventsModule = {\n addListener: (name, cb) =>\n eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),\n};\nexport const WindowDimensionsEvents: WindowDimensionsEventsModule = {\n addListener: (name, cb) =>\n eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),\n};\nexport const KeyboardControllerView: React.FC<KeyboardControllerProps> =\n require(\"./specs/KeyboardControllerViewNativeComponent\").default;\nexport const KeyboardGestureArea: React.FC<KeyboardGestureAreaProps> =\n (Platform.OS === \"android\" && Platform.Version >= 30) || Platform.OS === \"ios\"\n ? require(\"./specs/KeyboardGestureAreaNativeComponent\").default\n : ({ children }: KeyboardGestureAreaProps) => children;\nexport const RCTOverKeyboardView: React.FC<OverKeyboardViewProps> =\n require(\"./specs/OverKeyboardViewNativeComponent\").default;\n"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;AAY3D,MAAMC,aAAa,GACjB,2FAA2F,GAC3FD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GA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;AAAmC,CAAC,KAAKA,QAAQ;AAC1D,OAAO,MAAMC,mBAAoD,GAC/DlB,OAAO,CAAC,yCAAyC,CAAC,CAACF,OAAO","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["useSharedValue","useKeyboardHandler","useKeyboardContext","useState","Platform","OS","useKeyboardAnimation","reanimated","initialHeight","height","value","initialProgress","progress","heightWhenOpened","isClosed","onStart","e","onMove","onInteractive","onEnd","duration","useTranslateAnimation","padding","translate"],"sources":["hooks.ts"],"sourcesContent":["import { useSharedValue } from \"react-native-reanimated\";\r\n\r\nimport {useKeyboardHandler} from \"../../hooks\";\r\nimport {useKeyboardContext} from \"../../context\";\r\nimport { useState } from \"react\";\r\nimport { Platform } from \"react-native\";\r\n\r\nconst OS = Platform.OS;\r\n\r\nexport const useKeyboardAnimation = () => {\r\n const { reanimated } = useKeyboardContext();\r\n // calculate it only once on mount, to avoid `SharedValue` reads during a render\r\n const [initialHeight] = useState(() => -reanimated.height.value);\r\n const [initialProgress] = useState(() => reanimated.progress.value);\r\n\r\n const heightWhenOpened = useSharedValue(initialHeight);\r\n const height = useSharedValue(initialHeight);\r\n const progress = useSharedValue(initialProgress);\r\n const isClosed = useSharedValue(initialProgress === 0);\r\n\r\n useKeyboardHandler(\r\n {\r\n onStart: (e) => {\r\n \"worklet\";\r\n\r\n if (e.height > 0) {\r\n // eslint-disable-next-line react-compiler/react-compiler\r\n isClosed.value = false;\r\n heightWhenOpened.value = e.height;\r\n }\r\n },\r\n onMove: (e) => {\r\n \"worklet\";\r\n \r\n progress.value = e.progress;\r\n height.value = e.height;\r\n },\r\n onInteractive: (e) => {\r\n \"worklet\";\r\n\r\n progress.value = e.progress;\r\n height.value = e.height;\r\n },\r\n onEnd: (e) => {\r\n \"worklet\";\r\n if(Platform.OS as string === 'harmony'){\r\n heightWhenOpened.value = e.height;\r\n }\r\n \r\n isClosed.value = e.height === 0;\r\n\r\n // `height` update happens in `onMove` handler\r\n // in `onEnd` we need to update only if `onMove`\r\n // wasn't called (i. e. duration === 0)\r\n //\r\n // we can not call this code without condition below\r\n // because in some corner cases (iOS with `secureTextEntry`)\r\n // `onEnd` can be emitted before `onMove` and in this case\r\n // it may lead to choppy/glitchy/jumpy UI\r\n // see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/327\r\n if (e.duration === 0) {\r\n progress.value = e.progress;\r\n height.value = e.height;\r\n }\r\n },\r\n },\r\n [],\r\n );\r\n\r\n return { height, progress, heightWhenOpened, isClosed };\r\n};\r\n\r\nexport const useTranslateAnimation = () => {\r\n const { reanimated } = useKeyboardContext();\r\n\r\n // calculate it only once on mount, to avoid `SharedValue` reads during a render\r\n const [initialProgress] = useState(() => reanimated.progress.value);\r\n\r\n const padding = useSharedValue(initialProgress);\r\n const translate = useSharedValue(0);\r\n\r\n useKeyboardHandler(\r\n {\r\n onStart: (e) => {\r\n \"worklet\";\r\n\r\n if (e.height === 0) {\r\n // eslint-disable-next-line react-compiler/react-compiler\r\n padding.value = 0;\r\n }\r\n if (OS === \"ios\") {\r\n translate.value = e.progress;\r\n }\r\n },\r\n onMove: (e) => {\r\n \"worklet\";\r\n\r\n if (OS === \"android\") {\r\n translate.value = e.progress;\r\n }\r\n },\r\n onInteractive: (e) => {\r\n \"worklet\";\r\n\r\n padding.value = 0;\r\n\r\n translate.value = e.progress;\r\n },\r\n onEnd: (e) => {\r\n \"worklet\";\r\n\r\n padding.value = e.progress;\r\n\r\n if (OS === \"android\") {\r\n translate.value = e.progress;\r\n }\r\n },\r\n },\r\n [],\r\n );\r\n\r\n return { translate, padding };\r\n};\r\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,yBAAyB;AAExD,SAAQC,kBAAkB,QAAO,aAAa;AAC9C,SAAQC,kBAAkB,QAAO,eAAe;AAChD,SAASC,QAAQ,QAAQ,OAAO;AAChC,SAASC,QAAQ,QAAQ,cAAc;AAEvC,MAAMC,EAAE,GAAGD,QAAQ,CAACC,EAAE;AAEtB,OAAO,MAAMC,oBAAoB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,QAAQ;IAC9B,CAAC;IACDO,KAAK,EAAGH,CAAC,IAAK;MACZ,SAAS;;MAETM,OAAO,CAACZ,KAAK,GAAGM,CAAC,CAACJ,QAAQ;MAE1B,IAAIP,EAAE,KAAK,SAAS,EAAE;QACpBkB,SAAS,CAACb,KAAK,GAAGM,CAAC,CAACJ,QAAQ;MAC9B;IACF;EACF,CAAC,EACD,EACF,CAAC;EAED,OAAO;IAAEW,SAAS;IAAED;EAAQ,CAAC;AAC/B,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useSharedValue","useKeyboardHandler","useKeyboardContext","useState","Platform","OS","useKeyboardAnimation","reanimated","initialHeight","height","value","initialProgress","progress","heightWhenOpened","isClosed","onStart","e","onMove","onInteractive","onEnd","duration","useTranslateAnimation","padding","translate"],"sources":["hooks.ts"],"sourcesContent":["import { useSharedValue } from \"react-native-reanimated\";\n\nimport {useKeyboardHandler} from \"../../hooks\";\nimport {useKeyboardContext} from \"../../context\";\nimport { useState } from \"react\";\nimport { Platform } from \"react-native\";\n\nconst OS = Platform.OS;\n\nexport const useKeyboardAnimation = () => {\n const { reanimated } = useKeyboardContext();\n // calculate it only once on mount, to avoid `SharedValue` reads during a render\n const [initialHeight] = useState(() => -reanimated.height.value);\n const [initialProgress] = useState(() => reanimated.progress.value);\n\n const heightWhenOpened = useSharedValue(initialHeight);\n const height = useSharedValue(initialHeight);\n const progress = useSharedValue(initialProgress);\n const isClosed = useSharedValue(initialProgress === 0);\n\n useKeyboardHandler(\n {\n onStart: (e) => {\n \"worklet\";\n\n if (e.height > 0) {\n // eslint-disable-next-line react-compiler/react-compiler\n isClosed.value = false;\n heightWhenOpened.value = e.height;\n }\n },\n onMove: (e) => {\n \"worklet\";\n \n progress.value = e.progress;\n height.value = e.height;\n },\n onInteractive: (e) => {\n \"worklet\";\n\n progress.value = e.progress;\n height.value = e.height;\n },\n onEnd: (e) => {\n \"worklet\";\n if(Platform.OS as string === 'harmony'){\n heightWhenOpened.value = e.height;\n }\n \n isClosed.value = e.height === 0;\n\n // `height` update happens in `onMove` handler\n // in `onEnd` we need to update only if `onMove`\n // wasn't called (i. e. duration === 0)\n //\n // we can not call this code without condition below\n // because in some corner cases (iOS with `secureTextEntry`)\n // `onEnd` can be emitted before `onMove` and in this case\n // it may lead to choppy/glitchy/jumpy UI\n // see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/327\n if (e.duration === 0) {\n progress.value = e.progress;\n height.value = e.height;\n }\n },\n },\n [],\n );\n\n return { height, progress, heightWhenOpened, isClosed };\n};\n\nexport const useTranslateAnimation = () => {\n const { reanimated } = useKeyboardContext();\n\n // calculate it only once on mount, to avoid `SharedValue` reads during a render\n const [initialProgress] = useState(() => reanimated.progress.value);\n\n const padding = useSharedValue(initialProgress);\n const translate = useSharedValue(0);\n\n useKeyboardHandler(\n {\n onStart: (e) => {\n \"worklet\";\n\n if (e.height === 0) {\n // eslint-disable-next-line react-compiler/react-compiler\n padding.value = 0;\n }\n if (OS === \"ios\") {\n translate.value = e.progress;\n }\n },\n onMove: (e) => {\n \"worklet\";\n\n if (OS === \"android\") {\n translate.value = e.progress;\n }\n },\n onInteractive: (e) => {\n \"worklet\";\n\n padding.value = 0;\n\n translate.value = e.progress;\n },\n onEnd: (e) => {\n \"worklet\";\n\n padding.value = e.progress;\n\n if (OS === \"android\") {\n translate.value = e.progress;\n }\n },\n },\n [],\n );\n\n return { translate, padding };\n};\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,yBAAyB;AAExD,SAAQC,kBAAkB,QAAO,aAAa;AAC9C,SAAQC,kBAAkB,QAAO,eAAe;AAChD,SAASC,QAAQ,QAAQ,OAAO;AAChC,SAASC,QAAQ,QAAQ,cAAc;AAEvC,MAAMC,EAAE,GAAGD,QAAQ,CAACC,EAAE;AAEtB,OAAO,MAAMC,oBAAoB,GAAGA,CAAA,KAAM;EACxC,MAAM;IAAEC;EAAW,CAAC,GAAGL,kBAAkB,CAAC,CAAC;EAC3C;EACA,MAAM,CAACM,aAA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AACJ,QAAQ;MAE1B,IAAIP,EAAE,KAAK,SAAS,EAAE;QACpBkB,SAAS,CAACb,KAAK,GAAGM,CAAC,CAACJ,QAAQ;MAC9B;IACF;EACF,CAAC,EACD,EACF,CAAC;EAED,OAAO;IAAEW,SAAS;IAAED;EAAQ,CAAC;AAC/B,CAAC","ignoreList":[]}
@@ -11,9 +11,9 @@ const defaultLayout = {
11
11
  height: 0
12
12
  };
13
13
 
14
- /**
15
- * View that moves out of the way when the keyboard appears by automatically
16
- * adjusting its height, position, or bottom padding.
14
+ /**
15
+ * View that moves out of the way when the keyboard appears by automatically
16
+ * adjusting its height, position, or bottom padding.
17
17
  */
18
18
  const KeyboardAvoidingView = /*#__PURE__*/forwardRef(({
19
19
  behavior,
@@ -1 +1 @@
1
- {"version":3,"names":["React","forwardRef","useCallback","useMemo","View","Reanimated","interpolate","runOnUI","useAnimatedStyle","useDerivedValue","useSharedValue","useWindowDimensions","useKeyboardAnimation","useTranslateAnimation","defaultLayout","x","y","width","height","KeyboardAvoidingView","behavior","children","contentContainerStyle","enabled","keyboardVerticalOffset","style","onLayout","onLayoutProps","props","ref","initialFrame","frame","value","translate","padding","keyboard","screenHeight","relativeKeyboardHeight","keyboardY","heightWhenOpened","Math","max","interpolateToRelativeKeyboardHeight","onLayoutWorklet","layout","isClosed","e","nativeEvent","animatedStyle","bottom","progress","translateY","paddingBottom","bottomHeight","flex","transform","isPositionBehavior","containerStyle","combinedStyles","createElement","_extends"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo } from \"react\";\r\nimport { View } from \"react-native\";\r\nimport Reanimated, {\r\n interpolate,\r\n runOnUI,\r\n useAnimatedStyle,\r\n useDerivedValue,\r\n useSharedValue,\r\n} from \"react-native-reanimated\";\r\n\r\nimport { useWindowDimensions } from \"../../hooks\";\r\n\r\nimport { useKeyboardAnimation, useTranslateAnimation } from \"./hooks\";\r\n\r\nimport type { LayoutRectangle, ViewProps } from \"react-native\";\r\n\r\nexport type KeyboardAvoidingViewBaseProps = {\r\n /**\r\n * Controls whether this `KeyboardAvoidingView` instance should take effect.\r\n * This is useful when more than one is on the screen. Defaults to true.\r\n */\r\n enabled?: boolean;\r\n\r\n /**\r\n * Distance between the top of the user screen and the React Native view. This\r\n * may be non-zero in some cases. Defaults to 0.\r\n */\r\n keyboardVerticalOffset?: number;\r\n} & ViewProps;\r\n\r\nexport type KeyboardAvoidingViewProps = KeyboardAvoidingViewBaseProps &\r\n (\r\n | {\r\n /**\r\n * Specify how to react to the presence of the keyboard.\r\n */\r\n behavior?: \"position\";\r\n\r\n /**\r\n * Style of the content container when `behavior` is 'position'.\r\n */\r\n contentContainerStyle?: ViewProps[\"style\"];\r\n }\r\n | {\r\n /**\r\n * Specify how to react to the presence of the keyboard.\r\n */\r\n behavior?: \"height\" | \"padding\" | \"translate-with-padding\";\r\n\r\n /**\r\n * `contentContainerStyle` is not allowed for these behaviors.\r\n */\r\n contentContainerStyle?: never;\r\n }\r\n );\r\n\r\nconst defaultLayout: LayoutRectangle = {\r\n x: 0,\r\n y: 0,\r\n width: 0,\r\n height: 0,\r\n};\r\n\r\n/**\r\n * View that moves out of the way when the keyboard appears by automatically\r\n * adjusting its height, position, or bottom padding.\r\n */\r\nconst KeyboardAvoidingView = forwardRef<\r\n View,\r\n React.PropsWithChildren<KeyboardAvoidingViewProps>\r\n>(\r\n (\r\n {\r\n behavior,\r\n children,\r\n contentContainerStyle,\r\n enabled = true,\r\n keyboardVerticalOffset = 0,\r\n style,\r\n onLayout: onLayoutProps,\r\n ...props\r\n },\r\n ref,\r\n ) => {\r\n const initialFrame = useSharedValue<LayoutRectangle | null>(null);\r\n const frame = useDerivedValue(() => initialFrame.value || defaultLayout);\r\n\r\n const { translate, padding } = useTranslateAnimation();\r\n const keyboard = useKeyboardAnimation();\r\n const { height: screenHeight } = useWindowDimensions();\r\n\r\n const relativeKeyboardHeight = useCallback(() => {\r\n \"worklet\";\r\n\r\n const keyboardY =\r\n screenHeight - keyboard.heightWhenOpened.value - keyboardVerticalOffset;\r\n\r\n return Math.max(frame.value.y + frame.value.height - keyboardY, 0);\r\n }, [screenHeight, keyboardVerticalOffset]);\r\n const interpolateToRelativeKeyboardHeight = useCallback(\r\n (value: number) => {\r\n \"worklet\";\r\n\r\n return interpolate(value, [0, 1], [0, relativeKeyboardHeight()]);\r\n },\r\n [relativeKeyboardHeight],\r\n );\r\n\r\n const onLayoutWorklet = useCallback((layout: LayoutRectangle) => {\r\n \"worklet\";\r\n\r\n if (keyboard.isClosed.value || initialFrame.value === null) {\r\n // eslint-disable-next-line react-compiler/react-compiler\r\n initialFrame.value = layout;\r\n }\r\n }, []);\r\n const onLayout = useCallback<NonNullable<ViewProps[\"onLayout\"]>>(\r\n (e) => {\r\n runOnUI(onLayoutWorklet)(e.nativeEvent.layout);\r\n onLayoutProps?.(e);\r\n },\r\n [onLayoutProps],\r\n );\r\n\r\n const animatedStyle = useAnimatedStyle(() => {\r\n const bottom = interpolateToRelativeKeyboardHeight(\r\n keyboard.progress.value,\r\n );\r\n const translateY = interpolateToRelativeKeyboardHeight(translate.value);\r\n const paddingBottom = interpolateToRelativeKeyboardHeight(padding.value);\r\n const bottomHeight = enabled ? bottom : 0;\r\n\r\n switch (behavior) {\r\n case \"height\":\r\n if (!keyboard.isClosed.value) {\r\n return {\r\n height: frame.value.height - bottomHeight,\r\n flex: 0,\r\n };\r\n }\r\n\r\n return {};\r\n\r\n case \"position\":\r\n return { bottom: bottomHeight };\r\n\r\n case \"padding\":\r\n return { paddingBottom: bottomHeight };\r\n\r\n case \"translate-with-padding\":\r\n return {\r\n paddingBottom: paddingBottom,\r\n transform: [{ translateY: -translateY}],\r\n };\r\n\r\n default:\r\n return {};\r\n }\r\n }, [behavior, enabled, interpolateToRelativeKeyboardHeight]);\r\n const isPositionBehavior = behavior === \"position\";\r\n const containerStyle = isPositionBehavior ? contentContainerStyle : style;\r\n const combinedStyles = useMemo(\r\n () => [containerStyle, animatedStyle],\r\n [containerStyle, animatedStyle],\r\n );\r\n\r\n if (isPositionBehavior) {\r\n return (\r\n <View ref={ref} style={style} onLayout={onLayout} {...props}>\r\n <Reanimated.View style={combinedStyles}>{children}</Reanimated.View>\r\n </View>\r\n );\r\n }\r\n\r\n return (\r\n <Reanimated.View\r\n ref={ref}\r\n onLayout={onLayout}\r\n style={combinedStyles}\r\n {...props}\r\n >\r\n {children}\r\n </Reanimated.View>\r\n );\r\n },\r\n);\r\n\r\nexport default KeyboardAvoidingView;\r\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAC/D,SAASC,IAAI,QAAQ,cAAc;AACnC,OAAOC,UAAU,IACfC,WAAW,EACXC,OAAO,EACPC,gBAAgB,EAChBC,eAAe,EACfC,cAAc,QACT,yBAAyB;AAEhC,SAASC,mBAAmB,QAAQ,aAAa;AAEjD,SAASC,oBAAoB,EAAEC,qBAAqB,QAAQ,SAAS;AA4CrE,MAAMC,aAA8B,GAAG;EACrCC,CAAC,EAAE,CAAC;EACJC,CAAC,EAAE,CAAC;EACJC,KAAK,EAAE,CAAC;EACRC,MAAM,EAAE;AACV,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMC,oBAAoB,gBAAGlB,UAAU,CAIrC,CACE;EACEmB,QAAQ;EACRC,QAAQ;EACRC,qBAAqB;EACrBC,OAAO,GAAG,IAAI;EACdC,sBAAsB,GAAG,CAAC;EAC1BC,KAAK;EACLC,QAAQ,EAAEC,aAAa;EACvB,GAAGC;AACL,CAAC,EACDC,GAAG,KACA;EACH,MAAMC,YAAY,GAAGpB,cAAc,CAAyB,IAAI,CAAC;EACjE,MAAMqB,KAAK,GAAGtB,eAAe,CAAC,MAAMqB,YAAY,CAACE,KAAK,IAAIlB,aAAa,CAAC;EAExE,MAAM;IAAEmB,SAAS;IAAEC;EAAQ,CAAC,GAAGrB,qBAAqB,CAAC,CAAC;EACtD,MAAMsB,QAAQ,GAAGvB,oBAAoB,CAAC,C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Q,EAAEA;IAAS,GAAKE,KAAK,gBACzD5B,KAAA,CAAA2D,aAAA,CAACtD,UAAU,CAACD,IAAI;MAACqB,KAAK,EAAEiC;IAAe,GAAErC,QAA0B,CAC/D,CAAC;EAEX;EAEA,oBACErB,KAAA,CAAA2D,aAAA,CAACtD,UAAU,CAACD,IAAI,EAAAwD,QAAA;IACd/B,GAAG,EAAEA,GAAI;IACTH,QAAQ,EAAEA,QAAS;IACnBD,KAAK,EAAEiC;EAAe,GAClB9B,KAAK,GAERP,QACc,CAAC;AAEtB,CACF,CAAC;AAED,eAAeF,oBAAoB","ignoreList":[]}
1
+ {"version":3,"names":["React","forwardRef","useCallback","useMemo","View","Reanimated","interpolate","runOnUI","useAnimatedStyle","useDerivedValue","useSharedValue","useWindowDimensions","useKeyboardAnimation","useTranslateAnimation","defaultLayout","x","y","width","height","KeyboardAvoidingView","behavior","children","contentContainerStyle","enabled","keyboardVerticalOffset","style","onLayout","onLayoutProps","props","ref","initialFrame","frame","value","translate","padding","keyboard","screenHeight","relativeKeyboardHeight","keyboardY","heightWhenOpened","Math","max","interpolateToRelativeKeyboardHeight","onLayoutWorklet","layout","isClosed","e","nativeEvent","animatedStyle","bottom","progress","translateY","paddingBottom","bottomHeight","flex","transform","isPositionBehavior","containerStyle","combinedStyles","createElement","_extends"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo } from \"react\";\nimport { View } from \"react-native\";\nimport Reanimated, {\n interpolate,\n runOnUI,\n useAnimatedStyle,\n useDerivedValue,\n useSharedValue,\n} from \"react-native-reanimated\";\n\nimport { useWindowDimensions } from \"../../hooks\";\n\nimport { useKeyboardAnimation, useTranslateAnimation } from \"./hooks\";\n\nimport type { LayoutRectangle, ViewProps } from \"react-native\";\n\nexport type KeyboardAvoidingViewBaseProps = {\n /**\n * Controls whether this `KeyboardAvoidingView` instance should take effect.\n * This is useful when more than one is on the screen. Defaults to true.\n */\n enabled?: boolean;\n\n /**\n * Distance between the top of the user screen and the React Native view. This\n * may be non-zero in some cases. Defaults to 0.\n */\n keyboardVerticalOffset?: number;\n} & ViewProps;\n\nexport type KeyboardAvoidingViewProps = KeyboardAvoidingViewBaseProps &\n (\n | {\n /**\n * Specify how to react to the presence of the keyboard.\n */\n behavior?: \"position\";\n\n /**\n * Style of the content container when `behavior` is 'position'.\n */\n contentContainerStyle?: ViewProps[\"style\"];\n }\n | {\n /**\n * Specify how to react to the presence of the keyboard.\n */\n behavior?: \"height\" | \"padding\" | \"translate-with-padding\";\n\n /**\n * `contentContainerStyle` is not allowed for these behaviors.\n */\n contentContainerStyle?: never;\n }\n );\n\nconst defaultLayout: LayoutRectangle = {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n};\n\n/**\n * View that moves out of the way when the keyboard appears by automatically\n * adjusting its height, position, or bottom padding.\n */\nconst KeyboardAvoidingView = forwardRef<\n View,\n React.PropsWithChildren<KeyboardAvoidingViewProps>\n>(\n (\n {\n behavior,\n children,\n contentContainerStyle,\n enabled = true,\n keyboardVerticalOffset = 0,\n style,\n onLayout: onLayoutProps,\n ...props\n },\n ref,\n ) => {\n const initialFrame = useSharedValue<LayoutRectangle | null>(null);\n const frame = useDerivedValue(() => initialFrame.value || defaultLayout);\n\n const { translate, padding } = useTranslateAnimation();\n const keyboard = useKeyboardAnimation();\n const { height: screenHeight } = useWindowDimensions();\n\n const relativeKeyboardHeight = useCallback(() => {\n \"worklet\";\n\n const keyboardY =\n screenHeight - keyboard.heightWhenOpened.value - keyboardVerticalOffset;\n\n return Math.max(frame.value.y + frame.value.height - keyboardY, 0);\n }, [screenHeight, keyboardVerticalOffset]);\n const interpolateToRelativeKeyboardHeight = useCallback(\n (value: number) => {\n \"worklet\";\n\n return interpolate(value, [0, 1], [0, relativeKeyboardHeight()]);\n },\n [relativeKeyboardHeight],\n );\n\n const onLayoutWorklet = useCallback((layout: LayoutRectangle) => {\n \"worklet\";\n\n if (keyboard.isClosed.value || initialFrame.value === null) {\n // eslint-disable-next-line react-compiler/react-compiler\n initialFrame.value = layout;\n }\n }, []);\n const onLayout = useCallback<NonNullable<ViewProps[\"onLayout\"]>>(\n (e) => {\n runOnUI(onLayoutWorklet)(e.nativeEvent.layout);\n onLayoutProps?.(e);\n },\n [onLayoutProps],\n );\n\n const animatedStyle = useAnimatedStyle(() => {\n const bottom = interpolateToRelativeKeyboardHeight(\n keyboard.progress.value,\n );\n const translateY = interpolateToRelativeKeyboardHeight(translate.value);\n const paddingBottom = interpolateToRelativeKeyboardHeight(padding.value);\n const bottomHeight = enabled ? bottom : 0;\n\n switch (behavior) {\n case \"height\":\n if (!keyboard.isClosed.value) {\n return {\n height: frame.value.height - bottomHeight,\n flex: 0,\n };\n }\n\n return {};\n\n case \"position\":\n return { bottom: bottomHeight };\n\n case \"padding\":\n return { paddingBottom: bottomHeight };\n\n case \"translate-with-padding\":\n return {\n paddingBottom: paddingBottom,\n transform: [{ translateY: -translateY}],\n };\n\n default:\n return {};\n }\n }, [behavior, enabled, interpolateToRelativeKeyboardHeight]);\n const isPositionBehavior = behavior === \"position\";\n const containerStyle = isPositionBehavior ? contentContainerStyle : style;\n const combinedStyles = useMemo(\n () => [containerStyle, animatedStyle],\n [containerStyle, animatedStyle],\n );\n\n if (isPositionBehavior) {\n return (\n <View ref={ref} style={style} onLayout={onLayout} {...props}>\n <Reanimated.View style={combinedStyles}>{children}</Reanimated.View>\n </View>\n );\n }\n\n return (\n <Reanimated.View\n ref={ref}\n onLayout={onLayout}\n style={combinedStyles}\n {...props}\n >\n {children}\n </Reanimated.View>\n );\n },\n);\n\nexport default KeyboardAvoidingView;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAC/D,SAASC,IAAI,QAAQ,cAAc;AACnC,OAAOC,UAAU,IACfC,WAAW,EACXC,OAAO,EACPC,gBAAgB,EAChBC,eAAe,EACfC,cAAc,QACT,yBAAyB;AAEhC,SAASC,mBAAmB,QAAQ,aAAa;AA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SAAS;QACZ,OAAO;UAAED,aAAa,EAAEC;QAAa,CAAC;MAExC,KAAK,wBAAwB;QAC3B,OAAO;UACLD,aAAa,EAAEA,aAAa;UAC5BG,SAAS,EAAE,CAAC;YAAEJ,UAAU,EAAE,CAACA;UAAU,CAAC;QACxC,CAAC;MAEH;QACE,OAAO,CAAC,CAAC;IACb;EACF,CAAC,EAAE,CAAC/B,QAAQ,EAAEG,OAAO,EAAEmB,mCAAmC,CAAC,CAAC;EAC5D,MAAMc,kBAAkB,GAAGpC,QAAQ,KAAK,UAAU;EAClD,MAAMqC,cAAc,GAAGD,kBAAkB,GAAGlC,qBAAqB,GAAGG,KAAK;EACzE,MAAMiC,cAAc,GAAGvD,OAAO,CAC5B,MAAM,CAACsD,cAAc,EAAET,aAAa,CAAC,EACrC,CAACS,cAAc,EAAET,aAAa,CAChC,CAAC;EAED,IAAIQ,kBAAkB,EAAE;IACtB,oBACExD,KAAA,CAAA2D,aAAA,CAACvD,IAAI,EAAAwD,QAAA;MAAC/B,GAAG,EAAEA,GAAI;MAACJ,KAAK,EAAEA,KAAM;MAACC,QAAQ,EAAEA;IAAS,GAAKE,KAAK,gBACzD5B,KAAA,CAAA2D,aAAA,CAACtD,UAAU,CAACD,IAAI;MAACqB,KAAK,EAAEiC;IAAe,GAAErC,QAA0B,CAC/D,CAAC;EAEX;EAEA,oBACErB,KAAA,CAAA2D,aAAA,CAACtD,UAAU,CAACD,IAAI,EAAAwD,QAAA;IACd/B,GAAG,EAAEA,GAAI;IACTH,QAAQ,EAAEA,QAAS;IACnBD,KAAK,EAAEiC;EAAe,GAClB9B,KAAK,GAERP,QACc,CAAC;AAEtB,CACF,CAAC;AAED,eAAeF,oBAAoB","ignoreList":[]}
@@ -1,47 +1,48 @@
1
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
2
  import React, { forwardRef, useCallback, useMemo } from "react";
3
- import { findNodeHandle } from "react-native";
3
+ import { findNodeHandle, Platform } from "react-native";
4
4
  import Reanimated, { interpolate, scrollTo, useAnimatedReaction, useAnimatedRef, useAnimatedStyle, useScrollViewOffset, useSharedValue } from "react-native-reanimated";
5
5
  import { useFocusedInputHandler, useReanimatedFocusedInput, useWindowDimensions } from "../../hooks";
6
6
  import { useSmoothKeyboardHandler } from "./useSmoothKeyboardHandler";
7
7
  import { debounce, scrollDistanceWithRespectToSnapPoints } from "./utils";
8
- /*
9
- * Everything begins from `onStart` handler. This handler is called every time,
10
- * when keyboard changes its size or when focused `TextInput` was changed. In
11
- * this handler we are calculating/memoizing values which later will be used
12
- * during layout movement. For that we calculate:
13
- * - layout of focused field (`layout`) - to understand whether there will be overlap
14
- * - initial keyboard size (`initialKeyboardSize`) - used in scroll interpolation
15
- * - future keyboard height (`keyboardHeight`) - used in scroll interpolation
16
- * - current scroll position (`scrollPosition`) - used to scroll from this point
17
- *
18
- * Once we've calculated all necessary variables - we can actually start to use them.
19
- * It happens in `onMove` handler - this function simply calls `maybeScroll` with
20
- * current keyboard frame height. This functions makes the smooth transition.
21
- *
22
- * When the transition has finished we go to `onEnd` handler. In this handler
23
- * we verify, that the current field is not overlapped within a keyboard frame.
24
- * For full `onStart`/`onMove`/`onEnd` flow it may look like a redundant thing,
25
- * however there could be some cases, when `onMove` is not called:
26
- * - on iOS when TextInput was changed - keyboard transition is instant
27
- * - on Android when TextInput was changed and keyboard size wasn't changed
28
- * So `onEnd` handler handle the case, when `onMove` wasn't triggered.
29
- *
30
- * ====================================================================================================================+
31
- * -----------------------------------------------------Flow chart-----------------------------------------------------+
32
- * ====================================================================================================================+
33
- *
34
- * +============================+ +============================+ +==================================+
35
- * + User Press on TextInput + => + Keyboard starts showing + => + As keyboard moves frame by frame + =>
36
- * + + + (run `onStart`) + + `onMove` is getting called +
37
- * +============================+ +============================+ +==================================+
38
- *
39
- *
40
- * +============================+ +============================+ +=====================================+
41
- * + Keyboard is shown and we + => + User moved focus to + => + Only `onStart`/`onEnd` maybe called +
42
- * + call `onEnd` handler + + another `TextInput` + + (without involving `onMove`) +
43
- * +============================+ +============================+ +=====================================+
44
- *
8
+ const IS_HARMONY = Platform.OS === "harmony";
9
+ /*
10
+ * Everything begins from `onStart` handler. This handler is called every time,
11
+ * when keyboard changes its size or when focused `TextInput` was changed. In
12
+ * this handler we are calculating/memoizing values which later will be used
13
+ * during layout movement. For that we calculate:
14
+ * - layout of focused field (`layout`) - to understand whether there will be overlap
15
+ * - initial keyboard size (`initialKeyboardSize`) - used in scroll interpolation
16
+ * - future keyboard height (`keyboardHeight`) - used in scroll interpolation
17
+ * - current scroll position (`scrollPosition`) - used to scroll from this point
18
+ *
19
+ * Once we've calculated all necessary variables - we can actually start to use them.
20
+ * It happens in `onMove` handler - this function simply calls `maybeScroll` with
21
+ * current keyboard frame height. This functions makes the smooth transition.
22
+ *
23
+ * When the transition has finished we go to `onEnd` handler. In this handler
24
+ * we verify, that the current field is not overlapped within a keyboard frame.
25
+ * For full `onStart`/`onMove`/`onEnd` flow it may look like a redundant thing,
26
+ * however there could be some cases, when `onMove` is not called:
27
+ * - on iOS when TextInput was changed - keyboard transition is instant
28
+ * - on Android when TextInput was changed and keyboard size wasn't changed
29
+ * So `onEnd` handler handle the case, when `onMove` wasn't triggered.
30
+ *
31
+ * ====================================================================================================================+
32
+ * -----------------------------------------------------Flow chart-----------------------------------------------------+
33
+ * ====================================================================================================================+
34
+ *
35
+ * +============================+ +============================+ +==================================+
36
+ * + User Press on TextInput + => + Keyboard starts showing + => + As keyboard moves frame by frame + =>
37
+ * + + + (run `onStart`) + + `onMove` is getting called +
38
+ * +============================+ +============================+ +==================================+
39
+ *
40
+ *
41
+ * +============================+ +============================+ +=====================================+
42
+ * + Keyboard is shown and we + => + User moved focus to + => + Only `onStart`/`onEnd` maybe called +
43
+ * + call `onEnd` handler + + another `TextInput` + + (without involving `onMove`) +
44
+ * +============================+ +============================+ +=====================================+
45
+ *
45
46
  */
46
47
  const KeyboardAwareScrollView = /*#__PURE__*/forwardRef(({
47
48
  children,
@@ -83,8 +84,8 @@ const KeyboardAwareScrollView = /*#__PURE__*/forwardRef(({
83
84
  onLayout === null || onLayout === void 0 || onLayout(e);
84
85
  }, [onLayout]);
85
86
 
86
- /**
87
- * Function that will scroll a ScrollView as keyboard gets moving
87
+ /**
88
+ * Function that will scroll a ScrollView as keyboard gets moving
88
89
  */
89
90
  const maybeScroll = useCallback((e, animated = false) => {
90
91
  "worklet";
@@ -201,7 +202,7 @@ const KeyboardAwareScrollView = /*#__PURE__*/forwardRef(({
201
202
  // this value to achieve smooth hide effect
202
203
  scrollBeforeKeyboardMovement.value = position.value;
203
204
  }
204
- if (focusWasChanged && !keyboardWillAppear.value) {
205
+ if (focusWasChanged && (IS_HARMONY || !keyboardWillAppear.value)) {
205
206
  // update position on scroll value, so `onEnd` handler
206
207
  // will pick up correct values
207
208
  position.value += maybeScroll(e.height, true);
@@ -213,7 +214,7 @@ const KeyboardAwareScrollView = /*#__PURE__*/forwardRef(({
213
214
  syncKeyboardFrame(e);
214
215
 
215
216
  // if the user has set disableScrollOnKeyboardHide, only auto-scroll when the keyboard opens
216
- if (!disableScrollOnKeyboardHide || keyboardWillAppear.value) {
217
+ if ((!IS_HARMONY || !keyboardWillAppear.value) && (!disableScrollOnKeyboardHide || keyboardWillAppear.value)) {
217
218
  maybeScroll(e.height);
218
219
  }
219
220
  },
@@ -246,6 +247,7 @@ const KeyboardAwareScrollView = /*#__PURE__*/forwardRef(({
246
247
  ref: onRef
247
248
  }, rest, {
248
249
  onLayout: onScrollViewLayout,
250
+ scrollToOverflowEnabled: IS_HARMONY ? true : rest.scrollToOverflowEnabled,
249
251
  scrollEventThrottle: 16
250
252
  }), children, /*#__PURE__*/React.createElement(Reanimated.View, {
251
253
  style: view
@@ -1 +1 @@
1
- {"version":3,"names":["React","forwardRef","useCallback","useMemo","findNodeHandle","Reanimated","interpolate","scrollTo","useAnimatedReaction","useAnimatedRef","useAnimatedStyle","useScrollViewOffset","useSharedValue","useFocusedInputHandler","useReanimatedFocusedInput","useWindowDimensions","useSmoothKeyboardHandler","debounce","scrollDistanceWithRespectToSnapPoints","KeyboardAwareScrollView","children","onLayout","bottomOffset","disableScrollOnKeyboardHide","enabled","extraKeyboardSpace","ScrollViewComponent","ScrollView","rest","ref","scrollViewAnimatedRef","scrollViewTarget","scrollPosition","position","currentKeyboardFrameHeight","keyboardHeight","keyboardWillAppear","tag","initialKeyboardSize","scrollBeforeKeyboardMovement","input","layout","height","onRef","assignedRef","current","onScrollViewLayout","e","value","maybeScroll","animated","_layout$value","_layout$value2","_layout$value3","parentScrollViewTarget","visibleRect","absoluteY","inputHeight","point","relativeScrollTo","interpolatedScrollTo","snapToOffsets","targetScrollY","Math","max","positionOnScreen","topOfScreen","syncKeyboardFrame","keyboardFrame","scrollFromCurrentPosition","customHeight","_input$value","prevScrollPosition","prevLayout","onChangeText","_layout$value4","_input$value2","onSelectionChange","selection","start","end","y","onChangeTextHandler","onStart","keyboardWillChangeSize","keyboardWillHide","focusWasChanged","target","onMove","onEnd","previous","view","paddingBottom","createElement","_extends","scrollEventThrottle","View","style"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo } from \"react\";\r\nimport { findNodeHandle } from \"react-native\";\r\nimport Reanimated, {\r\n interpolate,\r\n scrollTo,\r\n useAnimatedReaction,\r\n useAnimatedRef,\r\n useAnimatedStyle,\r\n useScrollViewOffset,\r\n useSharedValue,\r\n} from \"react-native-reanimated\";\r\n\r\nimport {\r\n useFocusedInputHandler,\r\n useReanimatedFocusedInput,\r\n useWindowDimensions,\r\n} from \"../../hooks\";\r\n\r\nimport { useSmoothKeyboardHandler } from \"./useSmoothKeyboardHandler\";\r\nimport { debounce, scrollDistanceWithRespectToSnapPoints } from \"./utils\";\r\n\r\nimport type {\r\n LayoutChangeEvent,\r\n ScrollView,\r\n ScrollViewProps,\r\n} from \"react-native\";\r\nimport type {\r\n FocusedInputLayoutChangedEvent,\r\n FocusedInputSelectionChangedEvent,\r\n NativeEvent,\r\n} from \"..//../types\";\r\n\r\nexport type KeyboardAwareScrollViewProps = {\r\n /** The distance between keyboard and focused `TextInput` when keyboard is shown. Default is `0`. */\r\n bottomOffset?: number;\r\n /** Prevents automatic scrolling of the `ScrollView` when the keyboard gets hidden, maintaining the current screen position. Default is `false`. */\r\n disableScrollOnKeyboardHide?: boolean;\r\n /** Controls whether this `KeyboardAwareScrollView` instance should take effect. Default is `true` */\r\n enabled?: boolean;\r\n /** Adjusting the bottom spacing of KeyboardAwareScrollView. Default is `0` */\r\n extraKeyboardSpace?: number;\r\n /** Custom component for `ScrollView`. Default is `ScrollView` */\r\n ScrollViewComponent?: React.ComponentType<ScrollViewProps>;\r\n} & ScrollViewProps;\r\n\r\n/*\r\n * Everything begins from `onStart` handler. This handler is called every time,\r\n * when keyboard changes its size or when focused `TextInput` was changed. In\r\n * this handler we are calculating/memoizing values which later will be used\r\n * during layout movement. For that we calculate:\r\n * - layout of focused field (`layout`) - to understand whether there will be overlap\r\n * - initial keyboard size (`initialKeyboardSize`) - used in scroll interpolation\r\n * - future keyboard height (`keyboardHeight`) - used in scroll interpolation\r\n * - current scroll position (`scrollPosition`) - used to scroll from this point\r\n *\r\n * Once we've calculated all necessary variables - we can actually start to use them.\r\n * It happens in `onMove` handler - this function simply calls `maybeScroll` with\r\n * current keyboard frame height. This functions makes the smooth transition.\r\n *\r\n * When the transition has finished we go to `onEnd` handler. In this handler\r\n * we verify, that the current field is not overlapped within a keyboard frame.\r\n * For full `onStart`/`onMove`/`onEnd` flow it may look like a redundant thing,\r\n * however there could be some cases, when `onMove` is not called:\r\n * - on iOS when TextInput was changed - keyboard transition is instant\r\n * - on Android when TextInput was changed and keyboard size wasn't changed\r\n * So `onEnd` handler handle the case, when `onMove` wasn't triggered.\r\n *\r\n * ====================================================================================================================+\r\n * -----------------------------------------------------Flow chart-----------------------------------------------------+\r\n * ====================================================================================================================+\r\n *\r\n * +============================+ +============================+ +==================================+\r\n * + User Press on TextInput + => + Keyboard starts showing + => + As keyboard moves frame by frame + =>\r\n * + + + (run `onStart`) + + `onMove` is getting called +\r\n * +============================+ +============================+ +==================================+\r\n *\r\n *\r\n * +============================+ +============================+ +=====================================+\r\n * + Keyboard is shown and we + => + User moved focus to + => + Only `onStart`/`onEnd` maybe called +\r\n * + call `onEnd` handler + + another `TextInput` + + (without involving `onMove`) +\r\n * +============================+ +============================+ +=====================================+\r\n *\r\n */\r\nconst KeyboardAwareScrollView = forwardRef<\r\n ScrollView,\r\n React.PropsWithChildren<KeyboardAwareScrollViewProps>\r\n>(\r\n (\r\n {\r\n children,\r\n onLayout,\r\n bottomOffset = 0,\r\n disableScrollOnKeyboardHide = false,\r\n enabled = true,\r\n extraKeyboardSpace = 0,\r\n ScrollViewComponent = Reanimated.ScrollView,\r\n ...rest\r\n },\r\n ref,\r\n ) => {\r\n const scrollViewAnimatedRef = useAnimatedRef<Reanimated.ScrollView>();\r\n const scrollViewTarget = useSharedValue<number | null>(null);\r\n const scrollPosition = useSharedValue(0);\r\n const position = useScrollViewOffset(scrollViewAnimatedRef);\r\n const currentKeyboardFrameHeight = useSharedValue(0);\r\n const keyboardHeight = useSharedValue(0);\r\n const keyboardWillAppear = useSharedValue(false);\r\n const tag = useSharedValue(-1);\r\n const initialKeyboardSize = useSharedValue(0);\r\n const scrollBeforeKeyboardMovement = useSharedValue(0);\r\n const { input } = useReanimatedFocusedInput();\r\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\r\n\r\n const { height } = useWindowDimensions();\r\n\r\n const onRef = useCallback((assignedRef: Reanimated.ScrollView) => {\r\n if (typeof ref === \"function\") {\r\n ref(assignedRef);\r\n } else if (ref) {\r\n ref.current = assignedRef;\r\n }\r\n\r\n scrollViewAnimatedRef(assignedRef);\r\n }, []);\r\n const onScrollViewLayout = useCallback(\r\n (e: LayoutChangeEvent) => {\r\n scrollViewTarget.value = findNodeHandle(scrollViewAnimatedRef.current);\r\n\r\n onLayout?.(e);\r\n },\r\n [onLayout],\r\n );\r\n\r\n /**\r\n * Function that will scroll a ScrollView as keyboard gets moving\r\n */\r\n const maybeScroll = useCallback(\r\n (e: number, animated: boolean = false) => {\r\n \"worklet\";\r\n\r\n if (!enabled) {\r\n return 0;\r\n }\r\n\r\n // input belongs to ScrollView\r\n if (layout.value?.parentScrollViewTarget !== scrollViewTarget.value) {\r\n return 0;\r\n }\r\n\r\n const visibleRect = height - keyboardHeight.value;\r\n const absoluteY = layout.value?.layout.absoluteY || 0;\r\n const inputHeight = layout.value?.layout.height || 0;\r\n const point = absoluteY + inputHeight;\r\n\r\n if (visibleRect - point <= bottomOffset) {\r\n const relativeScrollTo =\r\n keyboardHeight.value - (height - point) + bottomOffset;\r\n const interpolatedScrollTo = interpolate(\r\n e,\r\n [initialKeyboardSize.value, keyboardHeight.value],\r\n [\r\n 0,\r\n scrollDistanceWithRespectToSnapPoints(\r\n relativeScrollTo + scrollPosition.value,\r\n rest.snapToOffsets,\r\n ) - scrollPosition.value,\r\n ],\r\n );\r\n const targetScrollY =\r\n Math.max(interpolatedScrollTo, 0) + scrollPosition.value;\r\n scrollTo(scrollViewAnimatedRef, 0, targetScrollY, animated);\r\n\r\n return interpolatedScrollTo;\r\n }\r\n\r\n if (absoluteY < 0) {\r\n const positionOnScreen = visibleRect - inputHeight - bottomOffset;\r\n const topOfScreen = scrollPosition.value + absoluteY;\r\n\r\n scrollTo(\r\n scrollViewAnimatedRef,\r\n 0,\r\n topOfScreen - positionOnScreen,\r\n animated,\r\n );\r\n }\r\n\r\n return 0;\r\n },\r\n [bottomOffset, enabled, height, rest.snapToOffsets],\r\n );\r\n\r\n const syncKeyboardFrame = useCallback(\r\n (e: NativeEvent) => {\r\n \"worklet\";\r\n\r\n const keyboardFrame = interpolate(\r\n e.height,\r\n [0, keyboardHeight.value],\r\n [0, keyboardHeight.value + extraKeyboardSpace],\r\n );\r\n\r\n currentKeyboardFrameHeight.value = keyboardFrame;\r\n },\r\n [extraKeyboardSpace],\r\n );\r\n\r\n const scrollFromCurrentPosition = useCallback(\r\n (customHeight?: number) => {\r\n \"worklet\";\r\n\r\n const prevScrollPosition = scrollPosition.value;\r\n const prevLayout = layout.value;\r\n\r\n if (!input.value?.layout) {\r\n return;\r\n }\r\n\r\n // eslint-disable-next-line react-compiler/react-compiler\r\n layout.value = {\r\n ...input.value,\r\n layout: {\r\n ...input.value.layout,\r\n height: customHeight ?? input.value.layout.height,\r\n },\r\n };\r\n scrollPosition.value = position.value;\r\n maybeScroll(keyboardHeight.value, true);\r\n scrollPosition.value = prevScrollPosition;\r\n layout.value = prevLayout;\r\n },\r\n [maybeScroll],\r\n );\r\n const onChangeText = useCallback(() => {\r\n \"worklet\";\r\n\r\n // if typing a text caused layout shift, then we need to ignore this handler\r\n // because this event will be handled in `useAnimatedReaction` below\r\n if (layout.value?.layout.height !== input.value?.layout.height) {\r\n return;\r\n }\r\n\r\n scrollFromCurrentPosition();\r\n }, [scrollFromCurrentPosition]);\r\n const onSelectionChange = useCallback(\r\n (e: FocusedInputSelectionChangedEvent) => {\r\n \"worklet\";\r\n\r\n if (e.selection.start.position !== e.selection.end.position) {\r\n scrollFromCurrentPosition(e.selection.end.y);\r\n }\r\n },\r\n [scrollFromCurrentPosition],\r\n );\r\n\r\n const onChangeTextHandler = useMemo(\r\n () => debounce(onChangeText, 200),\r\n [onChangeText],\r\n );\r\n\r\n useFocusedInputHandler(\r\n {\r\n onChangeText: onChangeTextHandler,\r\n onSelectionChange: onSelectionChange,\r\n },\r\n [onChangeTextHandler, onSelectionChange],\r\n );\r\n\r\n useSmoothKeyboardHandler(\r\n {\r\n onStart: (e) => {\r\n \"worklet\";\r\n\r\n const keyboardWillChangeSize =\r\n keyboardHeight.value !== e.height && e.height > 0;\r\n keyboardWillAppear.value = e.height > 0 && keyboardHeight.value === 0;\r\n const keyboardWillHide = e.height === 0;\r\n const focusWasChanged =\r\n (tag.value !== e.target && e.target !== -1) ||\r\n keyboardWillChangeSize;\r\n\r\n if (keyboardWillChangeSize) {\r\n initialKeyboardSize.value = keyboardHeight.value;\r\n }\r\n\r\n if (keyboardWillHide) {\r\n // on back transition need to interpolate as [0, keyboardHeight]\r\n initialKeyboardSize.value = 0;\r\n scrollPosition.value = scrollBeforeKeyboardMovement.value;\r\n }\r\n\r\n if (\r\n keyboardWillAppear.value ||\r\n keyboardWillChangeSize ||\r\n focusWasChanged\r\n ) {\r\n // persist scroll value\r\n scrollPosition.value = position.value;\r\n // just persist height - later will be used in interpolation\r\n keyboardHeight.value = e.height;\r\n }\r\n\r\n // focus was changed\r\n if (focusWasChanged) {\r\n tag.value = e.target;\r\n\r\n // save position of focused text input when keyboard starts to move\r\n layout.value = input.value;\r\n // save current scroll position - when keyboard will hide we'll reuse\r\n // this value to achieve smooth hide effect\r\n scrollBeforeKeyboardMovement.value = position.value;\r\n }\r\n\r\n if (focusWasChanged && !keyboardWillAppear.value) {\r\n // update position on scroll value, so `onEnd` handler\r\n // will pick up correct values\r\n position.value += maybeScroll(e.height, true);\r\n }\r\n },\r\n onMove: (e) => {\r\n \"worklet\";\r\n\r\n syncKeyboardFrame(e);\r\n\r\n // if the user has set disableScrollOnKeyboardHide, only auto-scroll when the keyboard opens\r\n if (!disableScrollOnKeyboardHide || keyboardWillAppear.value) {\r\n maybeScroll(e.height);\r\n }\r\n },\r\n onEnd: (e) => {\r\n \"worklet\";\r\n\r\n keyboardHeight.value = e.height;\r\n scrollPosition.value = position.value;\r\n\r\n syncKeyboardFrame(e);\r\n },\r\n },\r\n [maybeScroll, disableScrollOnKeyboardHide, syncKeyboardFrame],\r\n );\r\n\r\n useAnimatedReaction(\r\n () => input.value,\r\n (current, previous) => {\r\n if (\r\n current?.target === previous?.target &&\r\n current?.layout.height !== previous?.layout.height\r\n ) {\r\n const prevLayout = layout.value;\r\n\r\n layout.value = input.value;\r\n scrollPosition.value += maybeScroll(keyboardHeight.value, true);\r\n layout.value = prevLayout;\r\n }\r\n },\r\n [],\r\n );\r\n\r\n const view = useAnimatedStyle(\r\n () =>\r\n enabled\r\n ? {\r\n // animations become choppy when scrolling to the end of the `ScrollView` (when the last input is focused)\r\n // this happens because the layout recalculates on every frame. To avoid this we slightly increase padding\r\n // by `+1`. In this way we assure, that `scrollTo` will never scroll to the end, because it uses interpolation\r\n // from 0 to `keyboardHeight`, and here our padding is `keyboardHeight + 1`. It allows us not to re-run layout\r\n // re-calculation on every animation frame and it helps to achieve smooth animation.\r\n // see: https://github.com/kirillzyusko/react-native-keyboard-controller/pull/342\r\n paddingBottom: currentKeyboardFrameHeight.value + 1,\r\n }\r\n : {},\r\n [enabled],\r\n );\r\n\r\n return (\r\n <ScrollViewComponent\r\n ref={onRef}\r\n {...rest}\r\n onLayout={onScrollViewLayout}\r\n scrollEventThrottle={16}\r\n >\r\n {children}\r\n <Reanimated.View style={view} />\r\n </ScrollViewComponent>\r\n );\r\n },\r\n);\r\n\r\nexport default KeyboardAwareScrollView;\r\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAC/D,SAASC,cAAc,QAAQ,cAAc;AAC7C,OAAOC,UAAU,IACfC,WAAW,EACXC,QAAQ,EACRC,mBAAmB,EACnBC,cAAc,EACdC,gBAAgB,EAChBC,mBAAmB,EACnBC,cAAc,QACT,yBAAyB;AAEhC,SACEC,sBAAsB,EACtBC,yBAAyB,EACzBC,mBAAmB,QACd,aAAa;AAEpB,SAASC,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,QAAQ,EAAEC,qCAAqC,QAAQ,SAAS;AA0BzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,uBAAuB,gB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A,QAAQ,CAAEjD,MAAM,CAACC,MAAM,GAClD;MACA,MAAM+B,UAAU,GAAGhC,MAAM,CAACO,KAAK;MAE/BP,MAAM,CAACO,KAAK,GAAGR,KAAK,CAACQ,KAAK;MAC1BhB,cAAc,CAACgB,KAAK,IAAIC,WAAW,CAACd,cAAc,CAACa,KAAK,EAAE,IAAI,CAAC;MAC/DP,MAAM,CAACO,KAAK,GAAGyB,UAAU;IAC3B;EACF,CAAC,EACD,EACF,CAAC;EAED,MAAMkB,IAAI,GAAGjF,gBAAgB,CAC3B,MACEc,OAAO,GACH;IACA;IACA;IACA;IACA;IACA;IACA;IACAoE,aAAa,EAAE1D,0BAA0B,CAACc,KAAK,GAAG;EACpD,CAAC,GACC,CAAC,CAAC,EACR,CAACxB,OAAO,CACV,CAAC;EAED,oBACExB,KAAA,CAAA6F,aAAA,CAACnE,mBAAmB,EAAAoE,QAAA;IAClBjE,GAAG,EAAEc;EAAM,GACPf,IAAI;IACRP,QAAQ,EAAEyB,kBAAmB;IAC7BiD,mBAAmB,EAAE;EAAG,IAEvB3E,QAAQ,eACTpB,KAAA,CAAA6F,aAAA,CAACxF,UAAU,CAAC2F,IAAI;IAACC,KAAK,EAAEN;EAAK,CAAE,CACZ,CAAC;AAE1B,CACF,CAAC;AAED,eAAexE,uBAAuB","ignoreList":[]}
1
+ {"version":3,"names":["React","forwardRef","useCallback","useMemo","findNodeHandle","Platform","Reanimated","interpolate","scrollTo","useAnimatedReaction","useAnimatedRef","useAnimatedStyle","useScrollViewOffset","useSharedValue","useFocusedInputHandler","useReanimatedFocusedInput","useWindowDimensions","useSmoothKeyboardHandler","debounce","scrollDistanceWithRespectToSnapPoints","IS_HARMONY","OS","KeyboardAwareScrollView","children","onLayout","bottomOffset","disableScrollOnKeyboardHide","enabled","extraKeyboardSpace","ScrollViewComponent","ScrollView","rest","ref","scrollViewAnimatedRef","scrollViewTarget","scrollPosition","position","currentKeyboardFrameHeight","keyboardHeight","keyboardWillAppear","tag","initialKeyboardSize","scrollBeforeKeyboardMovement","input","layout","height","onRef","assignedRef","current","onScrollViewLayout","e","value","maybeScroll","animated","_layout$value","_layout$value2","_layout$value3","parentScrollViewTarget","visibleRect","absoluteY","inputHeight","point","relativeScrollTo","interpolatedScrollTo","snapToOffsets","targetScrollY","Math","max","positionOnScreen","topOfScreen","syncKeyboardFrame","keyboardFrame","scrollFromCurrentPosition","customHeight","_input$value","prevScrollPosition","prevLayout","onChangeText","_layout$value4","_input$value2","onSelectionChange","selection","start","end","y","onChangeTextHandler","onStart","keyboardWillChangeSize","keyboardWillHide","focusWasChanged","target","onMove","onEnd","previous","view","paddingBottom","createElement","_extends","scrollToOverflowEnabled","scrollEventThrottle","View","style"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo } from \"react\";\nimport { findNodeHandle, Platform } from \"react-native\";\nimport Reanimated, {\n interpolate,\n scrollTo,\n useAnimatedReaction,\n useAnimatedRef,\n useAnimatedStyle,\n useScrollViewOffset,\n useSharedValue,\n} from \"react-native-reanimated\";\n\nimport {\n useFocusedInputHandler,\n useReanimatedFocusedInput,\n useWindowDimensions,\n} from \"../../hooks\";\n\nimport { useSmoothKeyboardHandler } from \"./useSmoothKeyboardHandler\";\nimport { debounce, scrollDistanceWithRespectToSnapPoints } from \"./utils\";\n\nimport type {\n LayoutChangeEvent,\n ScrollView,\n ScrollViewProps,\n} from \"react-native\";\nimport type {\n FocusedInputLayoutChangedEvent,\n FocusedInputSelectionChangedEvent,\n NativeEvent,\n} from \"..//../types\";\n\nconst IS_HARMONY = (Platform.OS as string) === \"harmony\";\n\nexport type KeyboardAwareScrollViewProps = {\n /** The distance between keyboard and focused `TextInput` when keyboard is shown. Default is `0`. */\n bottomOffset?: number;\n /** Prevents automatic scrolling of the `ScrollView` when the keyboard gets hidden, maintaining the current screen position. Default is `false`. */\n disableScrollOnKeyboardHide?: boolean;\n /** Controls whether this `KeyboardAwareScrollView` instance should take effect. Default is `true` */\n enabled?: boolean;\n /** Adjusting the bottom spacing of KeyboardAwareScrollView. Default is `0` */\n extraKeyboardSpace?: number;\n /** Custom component for `ScrollView`. Default is `ScrollView` */\n ScrollViewComponent?: React.ComponentType<ScrollViewProps>;\n} & ScrollViewProps;\n\n/*\n * Everything begins from `onStart` handler. This handler is called every time,\n * when keyboard changes its size or when focused `TextInput` was changed. In\n * this handler we are calculating/memoizing values which later will be used\n * during layout movement. For that we calculate:\n * - layout of focused field (`layout`) - to understand whether there will be overlap\n * - initial keyboard size (`initialKeyboardSize`) - used in scroll interpolation\n * - future keyboard height (`keyboardHeight`) - used in scroll interpolation\n * - current scroll position (`scrollPosition`) - used to scroll from this point\n *\n * Once we've calculated all necessary variables - we can actually start to use them.\n * It happens in `onMove` handler - this function simply calls `maybeScroll` with\n * current keyboard frame height. This functions makes the smooth transition.\n *\n * When the transition has finished we go to `onEnd` handler. In this handler\n * we verify, that the current field is not overlapped within a keyboard frame.\n * For full `onStart`/`onMove`/`onEnd` flow it may look like a redundant thing,\n * however there could be some cases, when `onMove` is not called:\n * - on iOS when TextInput was changed - keyboard transition is instant\n * - on Android when TextInput was changed and keyboard size wasn't changed\n * So `onEnd` handler handle the case, when `onMove` wasn't triggered.\n *\n * ====================================================================================================================+\n * -----------------------------------------------------Flow chart-----------------------------------------------------+\n * ====================================================================================================================+\n *\n * +============================+ +============================+ +==================================+\n * + User Press on TextInput + => + Keyboard starts showing + => + As keyboard moves frame by frame + =>\n * + + + (run `onStart`) + + `onMove` is getting called +\n * +============================+ +============================+ +==================================+\n *\n *\n * +============================+ +============================+ +=====================================+\n * + Keyboard is shown and we + => + User moved focus to + => + Only `onStart`/`onEnd` maybe called +\n * + call `onEnd` handler + + another `TextInput` + + (without involving `onMove`) +\n * +============================+ +============================+ +=====================================+\n *\n */\nconst KeyboardAwareScrollView = forwardRef<\n ScrollView,\n React.PropsWithChildren<KeyboardAwareScrollViewProps>\n>(\n (\n {\n children,\n onLayout,\n bottomOffset = 0,\n disableScrollOnKeyboardHide = false,\n enabled = true,\n extraKeyboardSpace = 0,\n ScrollViewComponent = Reanimated.ScrollView,\n ...rest\n },\n ref,\n ) => {\n const scrollViewAnimatedRef = useAnimatedRef<Reanimated.ScrollView>();\n const scrollViewTarget = useSharedValue<number | null>(null);\n const scrollPosition = useSharedValue(0);\n const position = useScrollViewOffset(scrollViewAnimatedRef);\n const currentKeyboardFrameHeight = useSharedValue(0);\n const keyboardHeight = useSharedValue(0);\n const keyboardWillAppear = useSharedValue(false);\n const tag = useSharedValue(-1);\n const initialKeyboardSize = useSharedValue(0);\n const scrollBeforeKeyboardMovement = useSharedValue(0);\n const { input } = useReanimatedFocusedInput();\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\n\n const { height } = useWindowDimensions();\n\n const onRef = useCallback((assignedRef: Reanimated.ScrollView) => {\n if (typeof ref === \"function\") {\n ref(assignedRef);\n } else if (ref) {\n ref.current = assignedRef;\n }\n\n scrollViewAnimatedRef(assignedRef);\n }, []);\n const onScrollViewLayout = useCallback(\n (e: LayoutChangeEvent) => {\n scrollViewTarget.value = findNodeHandle(scrollViewAnimatedRef.current);\n\n onLayout?.(e);\n },\n [onLayout],\n );\n\n /**\n * Function that will scroll a ScrollView as keyboard gets moving\n */\n const maybeScroll = useCallback(\n (e: number, animated: boolean = false) => {\n \"worklet\";\n\n if (!enabled) {\n return 0;\n }\n\n // input belongs to ScrollView\n if (layout.value?.parentScrollViewTarget !== scrollViewTarget.value) {\n return 0;\n }\n\n const visibleRect = height - keyboardHeight.value;\n const absoluteY = layout.value?.layout.absoluteY || 0;\n const inputHeight = layout.value?.layout.height || 0;\n const point = absoluteY + inputHeight;\n\n if (visibleRect - point <= bottomOffset) {\n const relativeScrollTo =\n keyboardHeight.value - (height - point) + bottomOffset;\n const interpolatedScrollTo = interpolate(\n e,\n [initialKeyboardSize.value, keyboardHeight.value],\n [\n 0,\n scrollDistanceWithRespectToSnapPoints(\n relativeScrollTo + scrollPosition.value,\n rest.snapToOffsets,\n ) - scrollPosition.value,\n ],\n );\n const targetScrollY =\n Math.max(interpolatedScrollTo, 0) + scrollPosition.value;\n scrollTo(scrollViewAnimatedRef, 0, targetScrollY, animated);\n\n return interpolatedScrollTo;\n }\n\n if (absoluteY < 0) {\n const positionOnScreen = visibleRect - inputHeight - bottomOffset;\n const topOfScreen = scrollPosition.value + absoluteY;\n\n scrollTo(\n scrollViewAnimatedRef,\n 0,\n topOfScreen - positionOnScreen,\n animated,\n );\n }\n\n return 0;\n },\n [bottomOffset, enabled, height, rest.snapToOffsets],\n );\n\n const syncKeyboardFrame = useCallback(\n (e: NativeEvent) => {\n \"worklet\";\n\n const keyboardFrame = interpolate(\n e.height,\n [0, keyboardHeight.value],\n [0, keyboardHeight.value + extraKeyboardSpace],\n );\n\n currentKeyboardFrameHeight.value = keyboardFrame;\n },\n [extraKeyboardSpace],\n );\n\n const scrollFromCurrentPosition = useCallback(\n (customHeight?: number) => {\n \"worklet\";\n\n const prevScrollPosition = scrollPosition.value;\n const prevLayout = layout.value;\n\n if (!input.value?.layout) {\n return;\n }\n\n // eslint-disable-next-line react-compiler/react-compiler\n layout.value = {\n ...input.value,\n layout: {\n ...input.value.layout,\n height: customHeight ?? input.value.layout.height,\n },\n };\n scrollPosition.value = position.value;\n maybeScroll(keyboardHeight.value, true);\n scrollPosition.value = prevScrollPosition;\n layout.value = prevLayout;\n },\n [maybeScroll],\n );\n const onChangeText = useCallback(() => {\n \"worklet\";\n\n // if typing a text caused layout shift, then we need to ignore this handler\n // because this event will be handled in `useAnimatedReaction` below\n if (layout.value?.layout.height !== input.value?.layout.height) {\n return;\n }\n\n scrollFromCurrentPosition();\n }, [scrollFromCurrentPosition]);\n const onSelectionChange = useCallback(\n (e: FocusedInputSelectionChangedEvent) => {\n \"worklet\";\n\n if (e.selection.start.position !== e.selection.end.position) {\n scrollFromCurrentPosition(e.selection.end.y);\n }\n },\n [scrollFromCurrentPosition],\n );\n\n const onChangeTextHandler = useMemo(\n () => debounce(onChangeText, 200),\n [onChangeText],\n );\n\n useFocusedInputHandler(\n {\n onChangeText: onChangeTextHandler,\n onSelectionChange: onSelectionChange,\n },\n [onChangeTextHandler, onSelectionChange],\n );\n\n useSmoothKeyboardHandler(\n {\n onStart: (e) => {\n \"worklet\";\n\n const keyboardWillChangeSize =\n keyboardHeight.value !== e.height && e.height > 0;\n keyboardWillAppear.value = e.height > 0 && keyboardHeight.value === 0;\n const keyboardWillHide = e.height === 0;\n const focusWasChanged =\n (tag.value !== e.target && e.target !== -1) ||\n keyboardWillChangeSize;\n\n if (keyboardWillChangeSize) {\n initialKeyboardSize.value = keyboardHeight.value;\n }\n\n if (keyboardWillHide) {\n // on back transition need to interpolate as [0, keyboardHeight]\n initialKeyboardSize.value = 0;\n scrollPosition.value = scrollBeforeKeyboardMovement.value;\n }\n\n if (\n keyboardWillAppear.value ||\n keyboardWillChangeSize ||\n focusWasChanged\n ) {\n // persist scroll value\n scrollPosition.value = position.value;\n // just persist height - later will be used in interpolation\n keyboardHeight.value = e.height;\n }\n\n // focus was changed\n if (focusWasChanged) {\n tag.value = e.target;\n\n // save position of focused text input when keyboard starts to move\n layout.value = input.value;\n // save current scroll position - when keyboard will hide we'll reuse\n // this value to achieve smooth hide effect\n scrollBeforeKeyboardMovement.value = position.value;\n }\n\n if (focusWasChanged && (IS_HARMONY || !keyboardWillAppear.value)) {\n // update position on scroll value, so `onEnd` handler\n // will pick up correct values\n position.value += maybeScroll(e.height, true);\n }\n },\n onMove: (e) => {\n \"worklet\";\n\n syncKeyboardFrame(e);\n\n // if the user has set disableScrollOnKeyboardHide, only auto-scroll when the keyboard opens\n if (\n (!IS_HARMONY || !keyboardWillAppear.value) &&\n (!disableScrollOnKeyboardHide || keyboardWillAppear.value)\n ) {\n maybeScroll(e.height);\n }\n },\n onEnd: (e) => {\n \"worklet\";\n\n keyboardHeight.value = e.height;\n scrollPosition.value = position.value;\n\n syncKeyboardFrame(e);\n },\n },\n [maybeScroll, disableScrollOnKeyboardHide, syncKeyboardFrame],\n );\n\n useAnimatedReaction(\n () => input.value,\n (current, previous) => {\n if (\n current?.target === previous?.target &&\n current?.layout.height !== previous?.layout.height\n ) {\n const prevLayout = layout.value;\n\n layout.value = input.value;\n scrollPosition.value += maybeScroll(keyboardHeight.value, true);\n layout.value = prevLayout;\n }\n },\n [],\n );\n\n const view = useAnimatedStyle(\n () =>\n enabled\n ? {\n // animations become choppy when scrolling to the end of the `ScrollView` (when the last input is focused)\n // this happens because the layout recalculates on every frame. To avoid this we slightly increase padding\n // by `+1`. In this way we assure, that `scrollTo` will never scroll to the end, because it uses interpolation\n // from 0 to `keyboardHeight`, and here our padding is `keyboardHeight + 1`. It allows us not to re-run layout\n // re-calculation on every animation frame and it helps to achieve smooth animation.\n // see: https://github.com/kirillzyusko/react-native-keyboard-controller/pull/342\n paddingBottom: currentKeyboardFrameHeight.value + 1,\n }\n : {},\n [enabled],\n );\n\n return (\n <ScrollViewComponent\n ref={onRef}\n {...rest}\n onLayout={onScrollViewLayout}\n scrollToOverflowEnabled={\n IS_HARMONY ? true : rest.scrollToOverflowEnabled\n }\n scrollEventThrottle={16}\n >\n {children}\n <Reanimated.View style={view} />\n </ScrollViewComponent>\n );\n },\n);\n\nexport default KeyboardAwareScrollView;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAC/D,SAASC,cAAc,EAAEC,QAAQ,QAAQ,cAAc;AACvD,OAAOC,UAAU,IACfC,WAAW,EACXC,QAAQ,EACRC,mBAAmB,EACnBC,cAAc,EACdC,gBAAgB,EAChBC,mBAAmB,EACnBC,cAAc,QACT,yBAAyB;AAEhC,SACEC,sBAAsB,EACtBC,yBAAyB,EACzBC,mBAAmB,QACd,aAAa;AAEpB,SAASC,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,QAAQ,EAAEC,qCAAqC,QAAQ,SAAS;AAazE,MAAMC,UAAU,GAAIf,QAAQ,CAACgB,EAAE,KAAgB,SAAS;AA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IG = {
12
12
  easing: Easing.bezier(0.19919472913616398, 0.010644531250000006, 0.27920937042459737, 0.91025390625)
13
13
  };
14
14
 
15
- /**
16
- * Hook that uses default transitions for iOS and Android > 11, and uses
17
- * custom interpolation on Android < 11 to achieve more smooth animation
15
+ /**
16
+ * Hook that uses default transitions for iOS and Android > 11, and uses
17
+ * custom interpolation on Android < 11 to achieve more smooth animation
18
18
  */
19
19
  export const useSmoothKeyboardHandler = (handler, deps) => {
20
20
  const target = useSharedValue(-1);