react-native-keyboard-controller 1.21.0-beta.1 → 1.21.0-beta.3

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 (89) hide show
  1. package/android/src/fabric/java/com/reactnativekeyboardcontroller/ClippingScrollViewDecoratorViewManager.kt +7 -0
  2. package/android/src/main/java/com/reactnativekeyboardcontroller/views/ClippingScrollViewDecoratorView.kt +28 -1
  3. package/android/src/paper/java/com/reactnativekeyboardcontroller/ClippingScrollViewDecoratorViewManager.kt +8 -0
  4. package/jest/index.js +1 -0
  5. package/lib/commonjs/components/KeyboardAwareScrollView/index.js +7 -4
  6. package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
  7. package/lib/commonjs/components/KeyboardChatScrollView/hooks.js +13 -0
  8. package/lib/commonjs/components/KeyboardChatScrollView/hooks.js.map +1 -0
  9. package/lib/commonjs/components/KeyboardChatScrollView/index.js +80 -0
  10. package/lib/commonjs/components/KeyboardChatScrollView/index.js.map +1 -0
  11. package/lib/commonjs/components/KeyboardChatScrollView/types.js +6 -0
  12. package/lib/commonjs/components/KeyboardChatScrollView/types.js.map +1 -0
  13. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/helpers.js +135 -0
  14. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/helpers.js.map +1 -0
  15. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js +121 -0
  16. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js.map +1 -0
  17. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.js +205 -0
  18. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.js.map +1 -0
  19. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/types.js +6 -0
  20. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/types.js.map +1 -0
  21. package/lib/commonjs/components/KeyboardStickyView/index.js +9 -5
  22. package/lib/commonjs/components/KeyboardStickyView/index.js.map +1 -1
  23. package/lib/commonjs/components/ScrollViewWithBottomPadding/index.js +46 -13
  24. package/lib/commonjs/components/ScrollViewWithBottomPadding/index.js.map +1 -1
  25. package/lib/commonjs/components/hooks/useScrollState.js +20 -1
  26. package/lib/commonjs/components/hooks/useScrollState.js.map +1 -1
  27. package/lib/commonjs/components/index.js +7 -0
  28. package/lib/commonjs/components/index.js.map +1 -1
  29. package/lib/commonjs/index.js +7 -0
  30. package/lib/commonjs/index.js.map +1 -1
  31. package/lib/commonjs/specs/ClippingScrollViewDecoratorViewNativeComponent.js.map +1 -1
  32. package/lib/commonjs/types/views.js.map +1 -1
  33. package/lib/module/components/KeyboardAwareScrollView/index.js +7 -4
  34. package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -1
  35. package/lib/module/components/KeyboardChatScrollView/hooks.js +2 -0
  36. package/lib/module/components/KeyboardChatScrollView/hooks.js.map +1 -0
  37. package/lib/module/components/KeyboardChatScrollView/index.js +73 -0
  38. package/lib/module/components/KeyboardChatScrollView/index.js.map +1 -0
  39. package/lib/module/components/KeyboardChatScrollView/types.js +2 -0
  40. package/lib/module/components/KeyboardChatScrollView/types.js.map +1 -0
  41. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/helpers.js +125 -0
  42. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/helpers.js.map +1 -0
  43. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js +115 -0
  44. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js.map +1 -0
  45. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.js +199 -0
  46. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.js.map +1 -0
  47. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/types.js +2 -0
  48. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/types.js.map +1 -0
  49. package/lib/module/components/KeyboardStickyView/index.js +9 -5
  50. package/lib/module/components/KeyboardStickyView/index.js.map +1 -1
  51. package/lib/module/components/ScrollViewWithBottomPadding/index.js +47 -14
  52. package/lib/module/components/ScrollViewWithBottomPadding/index.js.map +1 -1
  53. package/lib/module/components/hooks/useScrollState.js +21 -2
  54. package/lib/module/components/hooks/useScrollState.js.map +1 -1
  55. package/lib/module/components/index.js +1 -0
  56. package/lib/module/components/index.js.map +1 -1
  57. package/lib/module/index.js +1 -1
  58. package/lib/module/index.js.map +1 -1
  59. package/lib/module/specs/ClippingScrollViewDecoratorViewNativeComponent.js.map +1 -1
  60. package/lib/module/types/views.js.map +1 -1
  61. package/lib/typescript/components/KeyboardChatScrollView/hooks.d.ts +2 -0
  62. package/lib/typescript/components/KeyboardChatScrollView/index.d.ts +12 -0
  63. package/lib/typescript/components/KeyboardChatScrollView/types.d.ts +48 -0
  64. package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/helpers.d.ts +77 -0
  65. package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/index.d.ts +21 -0
  66. package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/index.ios.d.ts +21 -0
  67. package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/types.d.ts +22 -0
  68. package/lib/typescript/components/ScrollViewWithBottomPadding/index.d.ts +3 -0
  69. package/lib/typescript/components/hooks/useScrollState.d.ts +3 -0
  70. package/lib/typescript/components/index.d.ts +2 -0
  71. package/lib/typescript/index.d.ts +2 -2
  72. package/lib/typescript/specs/ClippingScrollViewDecoratorViewNativeComponent.d.ts +1 -0
  73. package/lib/typescript/types/views.d.ts +2 -0
  74. package/package.json +12 -4
  75. package/src/components/KeyboardAwareScrollView/index.tsx +10 -3
  76. package/src/components/KeyboardChatScrollView/hooks.ts +2 -0
  77. package/src/components/KeyboardChatScrollView/index.tsx +106 -0
  78. package/src/components/KeyboardChatScrollView/types.ts +49 -0
  79. package/src/components/KeyboardChatScrollView/useChatKeyboard/helpers.ts +163 -0
  80. package/src/components/KeyboardChatScrollView/useChatKeyboard/index.ios.ts +180 -0
  81. package/src/components/KeyboardChatScrollView/useChatKeyboard/index.ts +300 -0
  82. package/src/components/KeyboardChatScrollView/useChatKeyboard/types.ts +30 -0
  83. package/src/components/KeyboardStickyView/index.tsx +8 -8
  84. package/src/components/ScrollViewWithBottomPadding/index.tsx +63 -17
  85. package/src/components/hooks/useScrollState.ts +24 -2
  86. package/src/components/index.ts +2 -0
  87. package/src/index.ts +2 -0
  88. package/src/specs/ClippingScrollViewDecoratorViewNativeComponent.ts +1 -0
  89. package/src/types/views.ts +2 -0
@@ -21,6 +21,12 @@ Object.defineProperty(exports, "KeyboardAwareScrollView", {
21
21
  return _KeyboardAwareScrollView.default;
22
22
  }
23
23
  });
24
+ Object.defineProperty(exports, "KeyboardChatScrollView", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _KeyboardChatScrollView.default;
28
+ }
29
+ });
24
30
  Object.defineProperty(exports, "KeyboardStickyView", {
25
31
  enumerable: true,
26
32
  get: function () {
@@ -37,6 +43,7 @@ var _KeyboardAvoidingView = _interopRequireDefault(require("./KeyboardAvoidingVi
37
43
  var _KeyboardStickyView = _interopRequireDefault(require("./KeyboardStickyView"));
38
44
  var _KeyboardAwareScrollView = _interopRequireDefault(require("./KeyboardAwareScrollView"));
39
45
  var _KeyboardToolbar = _interopRequireWildcard(require("./KeyboardToolbar"));
46
+ var _KeyboardChatScrollView = _interopRequireDefault(require("./KeyboardChatScrollView"));
40
47
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
41
48
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
42
49
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_KeyboardAvoidingView","_interopRequireDefault","require","_KeyboardStickyView","_KeyboardAwareScrollView","_KeyboardToolbar","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor"],"sources":["index.ts"],"sourcesContent":["export { default as KeyboardAvoidingView } from \"./KeyboardAvoidingView\";\nexport { default as KeyboardStickyView } from \"./KeyboardStickyView\";\nexport { default as KeyboardAwareScrollView } from \"./KeyboardAwareScrollView\";\nexport {\n default as KeyboardToolbar,\n DefaultKeyboardToolbarTheme,\n} from \"./KeyboardToolbar\";\nexport type { KeyboardAvoidingViewProps } from \"./KeyboardAvoidingView\";\nexport type { KeyboardStickyViewProps } from \"./KeyboardStickyView\";\nexport type {\n KeyboardAwareScrollViewProps,\n KeyboardAwareScrollViewRef,\n} from \"./KeyboardAwareScrollView\";\nexport type { KeyboardToolbarProps } from \"./KeyboardToolbar\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,wBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,gBAAA,GAAAC,uBAAA,CAAAJ,OAAA;AAG2B,SAAAI,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,CAAAC,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAAA,SAAAP,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAK,UAAA,GAAAL,CAAA,KAAAU,OAAA,EAAAV,CAAA","ignoreList":[]}
1
+ {"version":3,"names":["_KeyboardAvoidingView","_interopRequireDefault","require","_KeyboardStickyView","_KeyboardAwareScrollView","_KeyboardToolbar","_interopRequireWildcard","_KeyboardChatScrollView","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor"],"sources":["index.ts"],"sourcesContent":["export { default as KeyboardAvoidingView } from \"./KeyboardAvoidingView\";\nexport { default as KeyboardStickyView } from \"./KeyboardStickyView\";\nexport { default as KeyboardAwareScrollView } from \"./KeyboardAwareScrollView\";\nexport {\n default as KeyboardToolbar,\n DefaultKeyboardToolbarTheme,\n} from \"./KeyboardToolbar\";\nexport { default as KeyboardChatScrollView } from \"./KeyboardChatScrollView\";\nexport type { KeyboardAvoidingViewProps } from \"./KeyboardAvoidingView\";\nexport type { KeyboardStickyViewProps } from \"./KeyboardStickyView\";\nexport type {\n KeyboardAwareScrollViewProps,\n KeyboardAwareScrollViewRef,\n} from \"./KeyboardAwareScrollView\";\nexport type { KeyboardToolbarProps } from \"./KeyboardToolbar\";\nexport type { KeyboardChatScrollViewProps } from \"./KeyboardChatScrollView/types\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,wBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,gBAAA,GAAAC,uBAAA,CAAAJ,OAAA;AAIA,IAAAK,uBAAA,GAAAN,sBAAA,CAAAC,OAAA;AAA6E,SAAAI,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAAA,SAAAR,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAK,UAAA,GAAAL,CAAA,KAAAU,OAAA,EAAAV,CAAA","ignoreList":[]}
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  var _exportNames = {
7
+ KeyboardChatScrollView: true,
7
8
  KeyboardAvoidingView: true,
8
9
  KeyboardStickyView: true,
9
10
  KeyboardAwareScrollView: true,
@@ -30,6 +31,12 @@ Object.defineProperty(exports, "KeyboardAwareScrollView", {
30
31
  return _components.KeyboardAwareScrollView;
31
32
  }
32
33
  });
34
+ Object.defineProperty(exports, "KeyboardChatScrollView", {
35
+ enumerable: true,
36
+ get: function () {
37
+ return _components.KeyboardChatScrollView;
38
+ }
39
+ });
33
40
  Object.defineProperty(exports, "KeyboardExtender", {
34
41
  enumerable: true,
35
42
  get: function () {
@@ -1 +1 @@
1
- {"version":3,"names":["_bindings","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_animated","_context","_hooks","_constants","_module","_types","_compat","_components","_views"],"sources":["index.ts"],"sourcesContent":["export * from \"./bindings\";\nexport * from \"./animated\";\nexport * from \"./context\";\nexport * from \"./hooks\";\nexport * from \"./constants\";\nexport * from \"./module\";\nexport * from \"./types\";\nexport * from \"./compat\";\n\nexport {\n KeyboardAvoidingView,\n KeyboardStickyView,\n KeyboardAwareScrollView,\n // keyboard toolbar\n KeyboardToolbar,\n DefaultKeyboardToolbarTheme,\n} from \"./components\";\nexport type {\n KeyboardAvoidingViewProps,\n KeyboardStickyViewProps,\n KeyboardAwareScrollViewProps,\n KeyboardAwareScrollViewRef,\n KeyboardToolbarProps,\n} from \"./components\";\nexport { OverKeyboardView, KeyboardExtender } from \"./views\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,SAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,SAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,SAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,SAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,SAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAS,SAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,SAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AACA,IAAAU,QAAA,GAAAd,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAY,QAAA,EAAAX,OAAA,WAAAC,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AAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAO,OAAA,CAAAf,GAAA;IAAA;EAAA;AAAA;AAEA,IAAAgB,WAAA,GAAApB,OAAA;AAeA,IAAAqB,MAAA,GAAArB,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["_bindings","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_animated","_context","_hooks","_constants","_module","_types","_compat","_components","_views"],"sources":["index.ts"],"sourcesContent":["export * from \"./bindings\";\nexport * from \"./animated\";\nexport * from \"./context\";\nexport * from \"./hooks\";\nexport * from \"./constants\";\nexport * from \"./module\";\nexport * from \"./types\";\nexport * from \"./compat\";\n\nexport {\n KeyboardChatScrollView,\n KeyboardAvoidingView,\n KeyboardStickyView,\n KeyboardAwareScrollView,\n // keyboard toolbar\n KeyboardToolbar,\n DefaultKeyboardToolbarTheme,\n} from \"./components\";\nexport type {\n KeyboardChatScrollViewProps,\n KeyboardAvoidingViewProps,\n KeyboardStickyViewProps,\n KeyboardAwareScrollViewProps,\n KeyboardAwareScrollViewRef,\n KeyboardToolbarProps,\n} from \"./components\";\nexport { OverKeyboardView, KeyboardExtender } from \"./views\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,SAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,SAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,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AA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAc,MAAA,CAAAd,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAM,MAAA,CAAAd,GAAA;IAAA;EAAA;AAAA;AACA,IAAAe,OAAA,GAAAnB,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAiB,OAAA,EAAAhB,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAe,OAAA,CAAAf,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAO,OAAA,CAAAf,GAAA;IAAA;EAAA;AAAA;AAEA,IAAAgB,WAAA,GAAApB,OAAA;AAiBA,IAAAqB,MAAA,GAAArB,OAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_default","exports","default","codegenNativeComponent","interfaceOnly","excludedPlatforms"],"sources":["ClippingScrollViewDecoratorViewNativeComponent.ts"],"sourcesContent":["import { codegenNativeComponent } from \"react-native\";\n\nimport type { HostComponent } from \"react-native\";\nimport type { ViewProps } from \"react-native\";\nimport type { Double } from \"react-native/Libraries/Types/CodegenTypes\";\n\nexport interface NativeProps extends ViewProps {\n contentInsetBottom: Double;\n}\n\nexport default codegenNativeComponent<NativeProps>(\n \"ClippingScrollViewDecoratorView\",\n {\n interfaceOnly: true,\n excludedPlatforms: [\"iOS\"],\n },\n) as HostComponent<NativeProps>;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAAsD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAUvC,IAAAC,mCAAsB,EACnC,iCAAiC,EACjC;EACEC,aAAa,EAAE,IAAI;EACnBC,iBAAiB,EAAE,CAAC,KAAK;AAC3B,CACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","_default","exports","default","codegenNativeComponent","interfaceOnly","excludedPlatforms"],"sources":["ClippingScrollViewDecoratorViewNativeComponent.ts"],"sourcesContent":["import { codegenNativeComponent } from \"react-native\";\n\nimport type { HostComponent } from \"react-native\";\nimport type { ViewProps } from \"react-native\";\nimport type { Double } from \"react-native/Libraries/Types/CodegenTypes\";\n\nexport interface NativeProps extends ViewProps {\n contentInsetBottom: Double;\n contentInsetTop: Double;\n}\n\nexport default codegenNativeComponent<NativeProps>(\n \"ClippingScrollViewDecoratorView\",\n {\n interfaceOnly: true,\n excludedPlatforms: [\"iOS\"],\n },\n) as HostComponent<NativeProps>;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAAsD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAWvC,IAAAC,mCAAsB,EACnC,iCAAiC,EACjC;EACEC,aAAa,EAAE,IAAI;EACnBC,iBAAiB,EAAE,CAAC,KAAK;AAC3B,CACF,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["views.ts"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport type { ViewProps } from \"react-native\";\n\nexport type KeyboardGestureAreaProps = {\n /**\n * Determines how the keyboard position will be controlled:\n * - `ios` - keyboard will be following finger only when finger touches keyboard\n * - `linear` - keyboard will be following finger position linearly.\n *\n * @platform android\n */\n interpolator?: \"ios\" | \"linear\";\n /**\n * Whether to allow to show a keyboard from dismissed state by swipe up.\n * Default to `false`.\n *\n * @platform android\n */\n showOnSwipeUp?: boolean;\n /**\n * Whether to allow to control a keyboard by gestures. The strategy how\n * it should be controlled is determined by `interpolator` property.\n * Defaults to `true`.\n *\n * @platform android\n */\n enableSwipeToDismiss?: boolean;\n /**\n * Extra distance to the keyboard.\n */\n offset?: number;\n /**\n * A corresponding `nativeID` value from the associated `TextInput` (a string that links the `KeyboardGestureArea` to one or more `TextInput` components).\n * This is **required on iOS** in order to apply the `offset` when the keyboard is shown. Only the currently focused `TextInput` with a matching `nativeID`\n * will receive offset behavior.\n *\n * @platform ios\n */\n textInputNativeID?: string;\n} & ViewProps;\nexport type OverKeyboardViewProps = PropsWithChildren<{\n /**\n * A boolean prop indicating whether the view is visible or not. If it's true then view is shown on the screen. If it's false then view is hidden.\n */\n visible: boolean;\n}>;\nexport type KeyboardBackgroundViewProps = PropsWithChildren<ViewProps>;\nexport type KeyboardExtenderProps = PropsWithChildren<{\n /** Controls whether this `KeyboardExtender` instance should take an effect. Default is `true`. */\n enabled?: boolean;\n}>;\nexport type ClippingScrollViewProps = PropsWithChildren<\n ViewProps & {\n /** An additional space that gets applied to the bottom of the `ScrollView` (inside a scrollable content). Default is `0`. */\n contentInsetBottom?: number;\n }\n>;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["views.ts"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport type { ViewProps } from \"react-native\";\n\nexport type KeyboardGestureAreaProps = {\n /**\n * Determines how the keyboard position will be controlled:\n * - `ios` - keyboard will be following finger only when finger touches keyboard\n * - `linear` - keyboard will be following finger position linearly.\n *\n * @platform android\n */\n interpolator?: \"ios\" | \"linear\";\n /**\n * Whether to allow to show a keyboard from dismissed state by swipe up.\n * Default to `false`.\n *\n * @platform android\n */\n showOnSwipeUp?: boolean;\n /**\n * Whether to allow to control a keyboard by gestures. The strategy how\n * it should be controlled is determined by `interpolator` property.\n * Defaults to `true`.\n *\n * @platform android\n */\n enableSwipeToDismiss?: boolean;\n /**\n * Extra distance to the keyboard.\n */\n offset?: number;\n /**\n * A corresponding `nativeID` value from the associated `TextInput` (a string that links the `KeyboardGestureArea` to one or more `TextInput` components).\n * This is **required on iOS** in order to apply the `offset` when the keyboard is shown. Only the currently focused `TextInput` with a matching `nativeID`\n * will receive offset behavior.\n *\n * @platform ios\n */\n textInputNativeID?: string;\n} & ViewProps;\nexport type OverKeyboardViewProps = PropsWithChildren<{\n /**\n * A boolean prop indicating whether the view is visible or not. If it's true then view is shown on the screen. If it's false then view is hidden.\n */\n visible: boolean;\n}>;\nexport type KeyboardBackgroundViewProps = PropsWithChildren<ViewProps>;\nexport type KeyboardExtenderProps = PropsWithChildren<{\n /** Controls whether this `KeyboardExtender` instance should take an effect. Default is `true`. */\n enabled?: boolean;\n}>;\nexport type ClippingScrollViewProps = PropsWithChildren<\n ViewProps & {\n /** An additional space that gets applied to the bottom of the `ScrollView` (inside a scrollable content). Default is `0`. */\n contentInsetBottom?: number;\n /** An additional space that gets applied to the top of the `ScrollView` (inside a scrollable content). Default is `0`. */\n contentInsetTop?: number;\n }\n>;\n"],"mappings":"","ignoreList":[]}
@@ -327,11 +327,14 @@ const KeyboardAwareScrollView = /*#__PURE__*/forwardRef(({
327
327
  }, [update, scrollFromCurrentPosition]);
328
328
  useImperativeHandle(ref, () => {
329
329
  const scrollView = scrollViewRef.current;
330
- const existingMethods = scrollView ? {
331
- ...scrollView
332
- } : {};
330
+ if (scrollView) {
331
+ const scrollViewWithMethods = scrollView;
332
+ scrollViewWithMethods.assureFocusedInputVisible = () => {
333
+ synchronize();
334
+ };
335
+ return scrollViewWithMethods;
336
+ }
333
337
  return {
334
- ...existingMethods,
335
338
  assureFocusedInputVisible: () => {
336
339
  synchronize();
337
340
  }
@@ -1 +1 @@
1
- {"version":3,"names":["React","forwardRef","useCallback","useEffect","useImperativeHandle","useMemo","Reanimated","clamp","interpolate","runOnUI","scrollTo","useAnimatedReaction","useAnimatedRef","useDerivedValue","useSharedValue","useFocusedInputHandler","useReanimatedFocusedInput","useWindowDimensions","findNodeHandle","useCombinedRef","useScrollState","ScrollViewWithBottomPadding","useSmoothKeyboardHandler","debounce","scrollDistanceWithRespectToSnapPoints","KeyboardAwareScrollView","children","onLayout","bottomOffset","disableScrollOnKeyboardHide","enabled","extraKeyboardSpace","ScrollViewComponent","ScrollView","snapToOffsets","rest","ref","scrollViewAnimatedRef","scrollViewRef","useRef","onRef","scrollViewTarget","scrollPosition","offset","position","layout","scrollViewLayout","size","scrollViewContentSize","currentKeyboardFrameHeight","keyboardHeight","keyboardWillAppear","tag","initialKeyboardSize","scrollBeforeKeyboardMovement","input","update","lastSelection","ghostViewSpace","pendingSelectionForFocus","height","onScrollViewLayout","e","value","current","maybeScroll","animated","_layout$value","_layout$value2","_layout$value3","parentScrollViewTarget","visibleRect","absoluteY","inputHeight","point","relativeScrollTo","interpolatedScrollTo","targetScrollY","Math","max","positionOnScreen","topOfScreen","removeGhostPadding","performScrollWithPositionRestoration","newPosition","prevScroll","syncKeyboardFrame","keyboardFrame","updateLayoutFromSelection","_lastSelection$value","_input$value","customHeight","selection","end","y","scrollFromCurrentPosition","prevLayout","onChangeText","onChangeTextHandler","onSelectionChange","_lastSelection$value2","_lastSelection$value3","lastTarget","target","latestSelection","start","onStart","keyboardWillChangeSize","keyboardWillHide","focusWasChanged","_lastSelection$value4","onMove","onEnd","synchronize","scrollView","existingMethods","assureFocusedInputVisible","previous","padding","createElement","_extends","bottomPadding","scrollEventThrottle"],"sources":["index.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n} from \"react\";\nimport Reanimated, {\n clamp,\n interpolate,\n runOnUI,\n scrollTo,\n useAnimatedReaction,\n useAnimatedRef,\n useDerivedValue,\n useSharedValue,\n} from \"react-native-reanimated\";\n\nimport {\n useFocusedInputHandler,\n useReanimatedFocusedInput,\n useWindowDimensions,\n} from \"../../hooks\";\nimport { findNodeHandle } from \"../../utils/findNodeHandle\";\nimport useCombinedRef from \"../hooks/useCombinedRef\";\nimport useScrollState from \"../hooks/useScrollState\";\nimport ScrollViewWithBottomPadding from \"../ScrollViewWithBottomPadding\";\n\nimport { useSmoothKeyboardHandler } from \"./useSmoothKeyboardHandler\";\nimport { debounce, scrollDistanceWithRespectToSnapPoints } from \"./utils\";\n\nimport type { AnimatedScrollViewComponent } from \"../ScrollViewWithBottomPadding\";\nimport type {\n LayoutChangeEvent,\n ScrollView,\n ScrollViewProps,\n} from \"react-native\";\nimport type {\n FocusedInputLayoutChangedEvent,\n FocusedInputSelectionChangedEvent,\n NativeEvent,\n} from \"react-native-keyboard-controller\";\n\nexport type KeyboardAwareScrollViewProps = {\n /** The distance between the keyboard and the caret inside a focused `TextInput` when the 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?: AnimatedScrollViewComponent;\n} & ScrollViewProps;\nexport type KeyboardAwareScrollViewRef = {\n assureFocusedInputVisible: () => void;\n} & ScrollView;\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// + 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\n/**\n * A ScrollView component that automatically handles keyboard appearance and disappearance\n * by adjusting its content position to ensure the focused input remains visible.\n *\n * The component uses a sophisticated animation system to smoothly handle keyboard transitions\n * and maintain proper scroll position during keyboard interactions.\n *\n * @returns A ScrollView component that handles keyboard interactions.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/components/keyboard-aware-scroll-view|Documentation} page for more details.\n * @example\n * ```tsx\n * <KeyboardAwareScrollView bottomOffset={20}>\n * <TextInput placeholder=\"Enter text\" />\n * <TextInput placeholder=\"Another input\" />\n * </KeyboardAwareScrollView>\n * ```\n */\nconst KeyboardAwareScrollView = forwardRef<\n KeyboardAwareScrollViewRef,\n React.PropsWithChildren<KeyboardAwareScrollViewProps>\n>(\n (\n {\n children,\n onLayout,\n bottomOffset = 0,\n disableScrollOnKeyboardHide = false,\n enabled = true,\n extraKeyboardSpace = 0,\n ScrollViewComponent = Reanimated.ScrollView,\n snapToOffsets,\n ...rest\n },\n ref,\n ) => {\n const scrollViewAnimatedRef = useAnimatedRef<Reanimated.ScrollView>();\n const scrollViewRef = React.useRef<ScrollView>(null);\n const onRef = useCombinedRef(scrollViewAnimatedRef, scrollViewRef);\n const scrollViewTarget = useSharedValue<number | null>(null);\n const scrollPosition = useSharedValue(0);\n const {\n offset: position,\n layout: scrollViewLayout,\n size: scrollViewContentSize,\n } = useScrollState(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, update } = useReanimatedFocusedInput();\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\n const lastSelection =\n useSharedValue<FocusedInputSelectionChangedEvent | null>(null);\n const ghostViewSpace = useSharedValue(-1);\n const pendingSelectionForFocus = useSharedValue(false);\n\n const { height } = useWindowDimensions();\n\n const onScrollViewLayout = useCallback(\n (e: LayoutChangeEvent) => {\n scrollViewTarget.value = findNodeHandle(scrollViewAnimatedRef.current);\n\n onLayout?.(e);\n },\n [onLayout],\n );\n\n /**\n * Function that will scroll a ScrollView as keyboard gets moving.\n */\n const maybeScroll = useCallback(\n (e: number, animated: boolean = false) => {\n \"worklet\";\n\n if (!enabled) {\n return 0;\n }\n\n // input belongs to ScrollView\n if (layout.value?.parentScrollViewTarget !== scrollViewTarget.value) {\n return 0;\n }\n\n const visibleRect = height - keyboardHeight.value;\n const absoluteY = layout.value?.layout.absoluteY || 0;\n const inputHeight = layout.value?.layout.height || 0;\n const point = absoluteY + inputHeight;\n\n if (visibleRect - point <= bottomOffset) {\n const relativeScrollTo =\n keyboardHeight.value - (height - point) + bottomOffset;\n const interpolatedScrollTo = interpolate(\n e,\n [initialKeyboardSize.value, keyboardHeight.value],\n [\n 0,\n scrollDistanceWithRespectToSnapPoints(\n relativeScrollTo + scrollPosition.value,\n snapToOffsets,\n ) - scrollPosition.value,\n ],\n );\n const targetScrollY =\n Math.max(interpolatedScrollTo, 0) + scrollPosition.value;\n\n scrollTo(scrollViewAnimatedRef, 0, targetScrollY, animated);\n\n return interpolatedScrollTo;\n }\n\n if (point < 0) {\n const positionOnScreen = visibleRect - bottomOffset;\n const topOfScreen = scrollPosition.value + point;\n\n scrollTo(\n scrollViewAnimatedRef,\n 0,\n topOfScreen - positionOnScreen,\n animated,\n );\n }\n\n return 0;\n },\n [bottomOffset, enabled, height, snapToOffsets],\n );\n const removeGhostPadding = useCallback((e: number) => {\n \"worklet\";\n\n // new `ScrollViewWithBottomPadding` behavior: if we hide keyboard and we are in the end of `ScrollView`\n // then we always need to scroll back, because we apply a padding that doesn't change layout, so we will\n // not have auto scroll back in this case\n if (!keyboardWillAppear.value && ghostViewSpace.value > 0) {\n scrollTo(\n scrollViewAnimatedRef,\n 0,\n scrollPosition.value -\n interpolate(\n e,\n [initialKeyboardSize.value, keyboardHeight.value],\n [ghostViewSpace.value, 0],\n ),\n false,\n );\n\n return true;\n }\n\n return false;\n }, []);\n const performScrollWithPositionRestoration = useCallback(\n (newPosition: number) => {\n \"worklet\";\n\n const prevScroll = scrollPosition.value;\n\n // eslint-disable-next-line react-compiler/react-compiler\n scrollPosition.value = newPosition;\n maybeScroll(keyboardHeight.value, true);\n scrollPosition.value = prevScroll;\n },\n [scrollPosition, keyboardHeight, maybeScroll],\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 updateLayoutFromSelection = useCallback(() => {\n \"worklet\";\n\n const customHeight = lastSelection.value?.selection.end.y;\n\n if (!input.value?.layout || !customHeight) {\n return false;\n }\n\n layout.value = {\n ...input.value,\n layout: {\n ...input.value.layout,\n // when we have multiline input with limited amount of lines, then custom height can be very big\n // so we clamp it to max input height\n height: clamp(customHeight, 0, input.value.layout.height),\n },\n };\n\n return true;\n }, [input, lastSelection, layout]);\n const scrollFromCurrentPosition = useCallback(() => {\n \"worklet\";\n\n const prevLayout = layout.value;\n\n if (!updateLayoutFromSelection()) {\n return;\n }\n\n performScrollWithPositionRestoration(position.value);\n\n layout.value = prevLayout;\n }, [performScrollWithPositionRestoration]);\n const onChangeText = useCallback(() => {\n \"worklet\";\n scrollFromCurrentPosition();\n }, [scrollFromCurrentPosition]);\n const onChangeTextHandler = useMemo(\n () => debounce(onChangeText, 200),\n [onChangeText],\n );\n const onSelectionChange = useCallback(\n (e: FocusedInputSelectionChangedEvent) => {\n \"worklet\";\n\n const lastTarget = lastSelection.value?.target;\n const latestSelection = lastSelection.value?.selection;\n\n lastSelection.value = e;\n\n if (e.target !== lastTarget) {\n if (pendingSelectionForFocus.value) {\n // selection arrived after onStart - complete the deferred setup\n pendingSelectionForFocus.value = false;\n updateLayoutFromSelection();\n\n // if keyboard was already visible (focus change, no onMove expected),\n // perform the deferred scroll now\n if (!keyboardWillAppear.value && keyboardHeight.value > 0) {\n position.value += maybeScroll(keyboardHeight.value, true);\n }\n }\n\n return;\n }\n // caret in the end + end coordinates has been changed -> we moved to a new line\n // so input may grow\n if (\n e.selection.end.position === e.selection.start.position &&\n latestSelection?.end.y !== e.selection.end.y\n ) {\n return scrollFromCurrentPosition();\n }\n // selection has been changed\n if (e.selection.start.position !== e.selection.end.position) {\n return scrollFromCurrentPosition();\n }\n\n onChangeTextHandler();\n },\n [\n scrollFromCurrentPosition,\n onChangeTextHandler,\n updateLayoutFromSelection,\n maybeScroll,\n ],\n );\n\n useFocusedInputHandler(\n {\n onSelectionChange: onSelectionChange,\n },\n [onSelectionChange],\n );\n\n useSmoothKeyboardHandler(\n {\n onStart: (e) => {\n \"worklet\";\n\n const keyboardWillChangeSize =\n keyboardHeight.value !== e.height && e.height > 0;\n\n keyboardWillAppear.value = e.height > 0 && keyboardHeight.value === 0;\n\n const keyboardWillHide = e.height === 0;\n const focusWasChanged =\n (tag.value !== e.target && e.target !== -1) ||\n keyboardWillChangeSize;\n\n if (keyboardWillChangeSize) {\n initialKeyboardSize.value = keyboardHeight.value;\n }\n\n if (keyboardWillHide) {\n // on back transition need to interpolate as [0, keyboardHeight]\n initialKeyboardSize.value = 0;\n scrollPosition.value = scrollBeforeKeyboardMovement.value;\n pendingSelectionForFocus.value = false;\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 if (lastSelection.value?.target === e.target) {\n // selection arrived before onStart - use it to update layout\n updateLayoutFromSelection();\n pendingSelectionForFocus.value = false;\n } else {\n // selection hasn't arrived yet for the new target.\n // use input layout as-is; will be refined when selection arrives.\n if (input.value) {\n layout.value = input.value;\n }\n pendingSelectionForFocus.value = true;\n }\n\n // save current scroll position - when keyboard will hide we'll reuse\n // this value to achieve smooth hide effect\n scrollBeforeKeyboardMovement.value = position.value;\n }\n\n if (focusWasChanged && !keyboardWillAppear.value) {\n if (!pendingSelectionForFocus.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\n ghostViewSpace.value =\n position.value +\n scrollViewLayout.value.height -\n scrollViewContentSize.value.height;\n\n if (ghostViewSpace.value > 0) {\n scrollPosition.value = position.value;\n }\n },\n onMove: (e) => {\n \"worklet\";\n\n syncKeyboardFrame(e);\n\n if (removeGhostPadding(e.height)) {\n return;\n }\n\n // if the user has set disableScrollOnKeyboardHide, only auto-scroll when the keyboard opens\n if (!disableScrollOnKeyboardHide || keyboardWillAppear.value) {\n maybeScroll(e.height);\n }\n },\n onEnd: (e) => {\n \"worklet\";\n\n removeGhostPadding(e.height);\n\n keyboardHeight.value = e.height;\n scrollPosition.value = position.value;\n\n if (e.height === 0) {\n lastSelection.value = null;\n }\n\n syncKeyboardFrame(e);\n },\n },\n [\n maybeScroll,\n removeGhostPadding,\n disableScrollOnKeyboardHide,\n syncKeyboardFrame,\n ],\n );\n\n const synchronize = useCallback(async () => {\n await update();\n\n runOnUI(() => {\n \"worklet\";\n\n scrollFromCurrentPosition();\n })();\n }, [update, scrollFromCurrentPosition]);\n\n useImperativeHandle(\n ref,\n () => {\n const scrollView = scrollViewRef.current;\n\n const existingMethods = scrollView ? { ...scrollView } : {};\n\n return {\n ...existingMethods,\n\n assureFocusedInputVisible: () => {\n synchronize();\n },\n } as KeyboardAwareScrollViewRef;\n },\n [synchronize],\n );\n\n useEffect(() => {\n synchronize();\n }, [bottomOffset]);\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 // input has changed layout - let's check if we need to scroll\n // may happen when you paste text, then onSelectionChange will be\n // fired earlier than text actually changes its layout\n scrollFromCurrentPosition();\n }\n },\n [],\n );\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 const padding = useDerivedValue(\n () => (enabled ? currentKeyboardFrameHeight.value + 1 : 0),\n [enabled],\n );\n\n return (\n <ScrollViewWithBottomPadding\n ref={onRef}\n {...rest}\n bottomPadding={padding}\n scrollEventThrottle={16}\n ScrollViewComponent={ScrollViewComponent}\n onLayout={onScrollViewLayout}\n >\n {children}\n </ScrollViewWithBottomPadding>\n );\n },\n);\n\nexport default KeyboardAwareScrollView;\n"],"mappings":";AAAA,OAAOA,KAAK,IACVC,UAAU,EACVC,WAAW,EACXC,SAAS,EACTC,mBAAmB,EACnBC,OAAO,QACF,OAAO;AACd,OAAOC,UAAU,IACfC,KA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CAAC,MAAM;IACd8G,WAAW,CAAC,CAAC;EACf,CAAC,EAAE,CAACrF,YAAY,CAAC,CAAC;EAElBjB,mBAAmB,CACjB,MAAM4C,KAAK,CAACQ,KAAK,EACjB,CAACC,OAAO,EAAEqD,QAAQ,KAAK;IACrB,IACE,CAAArD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEuC,MAAM,OAAKc,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEd,MAAM,KACpC,CAAAvC,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEnB,MAAM,CAACe,MAAM,OAAKyD,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAExE,MAAM,CAACe,MAAM,GAClD;MACA;MACA;MACA;MACAmC,yBAAyB,CAAC,CAAC;IAC7B;EACF,CAAC,EACD,EACF,CAAC;;EAED;EACA;EACA;EACA;EACA;EACA;EACA,MAAMuB,OAAO,GAAGzG,eAAe,CAC7B,MAAOiB,OAAO,GAAGmB,0BAA0B,CAACc,KAAK,GAAG,CAAC,GAAG,CAAE,EAC1D,CAACjC,OAAO,CACV,CAAC;EAED,oBACE9B,KAAA,CAAAuH,aAAA,CAAClG,2BAA2B,EAAAmG,QAAA;IAC1BpF,GAAG,EAAEI;EAAM,GACPL,IAAI;IACRsF,aAAa,EAAEH,OAAQ;IACvBI,mBAAmB,EAAE,EAAG;IACxB1F,mBAAmB,EAAEA,mBAAoB;IACzCL,QAAQ,EAAEkC;EAAmB,IAE5BnC,QAC0B,CAAC;AAElC,CACF,CAAC;AAED,eAAeD,uBAAuB","ignoreList":[]}
1
+ {"version":3,"names":["React","forwardRef","useCallback","useEffect","useImperativeHandle","useMemo","Reanimated","clamp","interpolate","runOnUI","scrollTo","useAnimatedReaction","useAnimatedRef","useDerivedValue","useSharedValue","useFocusedInputHandler","useReanimatedFocusedInput","useWindowDimensions","findNodeHandle","useCombinedRef","useScrollState","ScrollViewWithBottomPadding","useSmoothKeyboardHandler","debounce","scrollDistanceWithRespectToSnapPoints","KeyboardAwareScrollView","children","onLayout","bottomOffset","disableScrollOnKeyboardHide","enabled","extraKeyboardSpace","ScrollViewComponent","ScrollView","snapToOffsets","rest","ref","scrollViewAnimatedRef","scrollViewRef","useRef","onRef","scrollViewTarget","scrollPosition","offset","position","layout","scrollViewLayout","size","scrollViewContentSize","currentKeyboardFrameHeight","keyboardHeight","keyboardWillAppear","tag","initialKeyboardSize","scrollBeforeKeyboardMovement","input","update","lastSelection","ghostViewSpace","pendingSelectionForFocus","height","onScrollViewLayout","e","value","current","maybeScroll","animated","_layout$value","_layout$value2","_layout$value3","parentScrollViewTarget","visibleRect","absoluteY","inputHeight","point","relativeScrollTo","interpolatedScrollTo","targetScrollY","Math","max","positionOnScreen","topOfScreen","removeGhostPadding","performScrollWithPositionRestoration","newPosition","prevScroll","syncKeyboardFrame","keyboardFrame","updateLayoutFromSelection","_lastSelection$value","_input$value","customHeight","selection","end","y","scrollFromCurrentPosition","prevLayout","onChangeText","onChangeTextHandler","onSelectionChange","_lastSelection$value2","_lastSelection$value3","lastTarget","target","latestSelection","start","onStart","keyboardWillChangeSize","keyboardWillHide","focusWasChanged","_lastSelection$value4","onMove","onEnd","synchronize","scrollView","scrollViewWithMethods","assureFocusedInputVisible","previous","padding","createElement","_extends","bottomPadding","scrollEventThrottle"],"sources":["index.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n} from \"react\";\nimport Reanimated, {\n clamp,\n interpolate,\n runOnUI,\n scrollTo,\n useAnimatedReaction,\n useAnimatedRef,\n useDerivedValue,\n useSharedValue,\n} from \"react-native-reanimated\";\n\nimport {\n useFocusedInputHandler,\n useReanimatedFocusedInput,\n useWindowDimensions,\n} from \"../../hooks\";\nimport { findNodeHandle } from \"../../utils/findNodeHandle\";\nimport useCombinedRef from \"../hooks/useCombinedRef\";\nimport useScrollState from \"../hooks/useScrollState\";\nimport ScrollViewWithBottomPadding from \"../ScrollViewWithBottomPadding\";\n\nimport { useSmoothKeyboardHandler } from \"./useSmoothKeyboardHandler\";\nimport { debounce, scrollDistanceWithRespectToSnapPoints } from \"./utils\";\n\nimport type { AnimatedScrollViewComponent } from \"../ScrollViewWithBottomPadding\";\nimport type {\n LayoutChangeEvent,\n ScrollView,\n ScrollViewProps,\n} from \"react-native\";\nimport type {\n FocusedInputLayoutChangedEvent,\n FocusedInputSelectionChangedEvent,\n NativeEvent,\n} from \"react-native-keyboard-controller\";\n\nexport type KeyboardAwareScrollViewProps = {\n /** The distance between the keyboard and the caret inside a focused `TextInput` when the 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?: AnimatedScrollViewComponent;\n} & ScrollViewProps;\nexport type KeyboardAwareScrollViewRef = {\n assureFocusedInputVisible: () => void;\n} & ScrollView;\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// + 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\n/**\n * A ScrollView component that automatically handles keyboard appearance and disappearance\n * by adjusting its content position to ensure the focused input remains visible.\n *\n * The component uses a sophisticated animation system to smoothly handle keyboard transitions\n * and maintain proper scroll position during keyboard interactions.\n *\n * @returns A ScrollView component that handles keyboard interactions.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/components/keyboard-aware-scroll-view|Documentation} page for more details.\n * @example\n * ```tsx\n * <KeyboardAwareScrollView bottomOffset={20}>\n * <TextInput placeholder=\"Enter text\" />\n * <TextInput placeholder=\"Another input\" />\n * </KeyboardAwareScrollView>\n * ```\n */\nconst KeyboardAwareScrollView = forwardRef<\n KeyboardAwareScrollViewRef,\n React.PropsWithChildren<KeyboardAwareScrollViewProps>\n>(\n (\n {\n children,\n onLayout,\n bottomOffset = 0,\n disableScrollOnKeyboardHide = false,\n enabled = true,\n extraKeyboardSpace = 0,\n ScrollViewComponent = Reanimated.ScrollView,\n snapToOffsets,\n ...rest\n },\n ref,\n ) => {\n const scrollViewAnimatedRef = useAnimatedRef<Reanimated.ScrollView>();\n const scrollViewRef = React.useRef<ScrollView>(null);\n const onRef = useCombinedRef(scrollViewAnimatedRef, scrollViewRef);\n const scrollViewTarget = useSharedValue<number | null>(null);\n const scrollPosition = useSharedValue(0);\n const {\n offset: position,\n layout: scrollViewLayout,\n size: scrollViewContentSize,\n } = useScrollState(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, update } = useReanimatedFocusedInput();\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\n const lastSelection =\n useSharedValue<FocusedInputSelectionChangedEvent | null>(null);\n const ghostViewSpace = useSharedValue(-1);\n const pendingSelectionForFocus = useSharedValue(false);\n\n const { height } = useWindowDimensions();\n\n const onScrollViewLayout = useCallback(\n (e: LayoutChangeEvent) => {\n scrollViewTarget.value = findNodeHandle(scrollViewAnimatedRef.current);\n\n onLayout?.(e);\n },\n [onLayout],\n );\n\n /**\n * Function that will scroll a ScrollView as keyboard gets moving.\n */\n const maybeScroll = useCallback(\n (e: number, animated: boolean = false) => {\n \"worklet\";\n\n if (!enabled) {\n return 0;\n }\n\n // input belongs to ScrollView\n if (layout.value?.parentScrollViewTarget !== scrollViewTarget.value) {\n return 0;\n }\n\n const visibleRect = height - keyboardHeight.value;\n const absoluteY = layout.value?.layout.absoluteY || 0;\n const inputHeight = layout.value?.layout.height || 0;\n const point = absoluteY + inputHeight;\n\n if (visibleRect - point <= bottomOffset) {\n const relativeScrollTo =\n keyboardHeight.value - (height - point) + bottomOffset;\n const interpolatedScrollTo = interpolate(\n e,\n [initialKeyboardSize.value, keyboardHeight.value],\n [\n 0,\n scrollDistanceWithRespectToSnapPoints(\n relativeScrollTo + scrollPosition.value,\n snapToOffsets,\n ) - scrollPosition.value,\n ],\n );\n const targetScrollY =\n Math.max(interpolatedScrollTo, 0) + scrollPosition.value;\n\n scrollTo(scrollViewAnimatedRef, 0, targetScrollY, animated);\n\n return interpolatedScrollTo;\n }\n\n if (point < 0) {\n const positionOnScreen = visibleRect - bottomOffset;\n const topOfScreen = scrollPosition.value + point;\n\n scrollTo(\n scrollViewAnimatedRef,\n 0,\n topOfScreen - positionOnScreen,\n animated,\n );\n }\n\n return 0;\n },\n [bottomOffset, enabled, height, snapToOffsets],\n );\n const removeGhostPadding = useCallback((e: number) => {\n \"worklet\";\n\n // new `ScrollViewWithBottomPadding` behavior: if we hide keyboard and we are in the end of `ScrollView`\n // then we always need to scroll back, because we apply a padding that doesn't change layout, so we will\n // not have auto scroll back in this case\n if (!keyboardWillAppear.value && ghostViewSpace.value > 0) {\n scrollTo(\n scrollViewAnimatedRef,\n 0,\n scrollPosition.value -\n interpolate(\n e,\n [initialKeyboardSize.value, keyboardHeight.value],\n [ghostViewSpace.value, 0],\n ),\n false,\n );\n\n return true;\n }\n\n return false;\n }, []);\n const performScrollWithPositionRestoration = useCallback(\n (newPosition: number) => {\n \"worklet\";\n\n const prevScroll = scrollPosition.value;\n\n // eslint-disable-next-line react-compiler/react-compiler\n scrollPosition.value = newPosition;\n maybeScroll(keyboardHeight.value, true);\n scrollPosition.value = prevScroll;\n },\n [scrollPosition, keyboardHeight, maybeScroll],\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 updateLayoutFromSelection = useCallback(() => {\n \"worklet\";\n\n const customHeight = lastSelection.value?.selection.end.y;\n\n if (!input.value?.layout || !customHeight) {\n return false;\n }\n\n layout.value = {\n ...input.value,\n layout: {\n ...input.value.layout,\n // when we have multiline input with limited amount of lines, then custom height can be very big\n // so we clamp it to max input height\n height: clamp(customHeight, 0, input.value.layout.height),\n },\n };\n\n return true;\n }, [input, lastSelection, layout]);\n const scrollFromCurrentPosition = useCallback(() => {\n \"worklet\";\n\n const prevLayout = layout.value;\n\n if (!updateLayoutFromSelection()) {\n return;\n }\n\n performScrollWithPositionRestoration(position.value);\n\n layout.value = prevLayout;\n }, [performScrollWithPositionRestoration]);\n const onChangeText = useCallback(() => {\n \"worklet\";\n scrollFromCurrentPosition();\n }, [scrollFromCurrentPosition]);\n const onChangeTextHandler = useMemo(\n () => debounce(onChangeText, 200),\n [onChangeText],\n );\n const onSelectionChange = useCallback(\n (e: FocusedInputSelectionChangedEvent) => {\n \"worklet\";\n\n const lastTarget = lastSelection.value?.target;\n const latestSelection = lastSelection.value?.selection;\n\n lastSelection.value = e;\n\n if (e.target !== lastTarget) {\n if (pendingSelectionForFocus.value) {\n // selection arrived after onStart - complete the deferred setup\n pendingSelectionForFocus.value = false;\n updateLayoutFromSelection();\n\n // if keyboard was already visible (focus change, no onMove expected),\n // perform the deferred scroll now\n if (!keyboardWillAppear.value && keyboardHeight.value > 0) {\n position.value += maybeScroll(keyboardHeight.value, true);\n }\n }\n\n return;\n }\n // caret in the end + end coordinates has been changed -> we moved to a new line\n // so input may grow\n if (\n e.selection.end.position === e.selection.start.position &&\n latestSelection?.end.y !== e.selection.end.y\n ) {\n return scrollFromCurrentPosition();\n }\n // selection has been changed\n if (e.selection.start.position !== e.selection.end.position) {\n return scrollFromCurrentPosition();\n }\n\n onChangeTextHandler();\n },\n [\n scrollFromCurrentPosition,\n onChangeTextHandler,\n updateLayoutFromSelection,\n maybeScroll,\n ],\n );\n\n useFocusedInputHandler(\n {\n onSelectionChange: onSelectionChange,\n },\n [onSelectionChange],\n );\n\n useSmoothKeyboardHandler(\n {\n onStart: (e) => {\n \"worklet\";\n\n const keyboardWillChangeSize =\n keyboardHeight.value !== e.height && e.height > 0;\n\n keyboardWillAppear.value = e.height > 0 && keyboardHeight.value === 0;\n\n const keyboardWillHide = e.height === 0;\n const focusWasChanged =\n (tag.value !== e.target && e.target !== -1) ||\n keyboardWillChangeSize;\n\n if (keyboardWillChangeSize) {\n initialKeyboardSize.value = keyboardHeight.value;\n }\n\n if (keyboardWillHide) {\n // on back transition need to interpolate as [0, keyboardHeight]\n initialKeyboardSize.value = 0;\n scrollPosition.value = scrollBeforeKeyboardMovement.value;\n pendingSelectionForFocus.value = false;\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 if (lastSelection.value?.target === e.target) {\n // selection arrived before onStart - use it to update layout\n updateLayoutFromSelection();\n pendingSelectionForFocus.value = false;\n } else {\n // selection hasn't arrived yet for the new target.\n // use input layout as-is; will be refined when selection arrives.\n if (input.value) {\n layout.value = input.value;\n }\n pendingSelectionForFocus.value = true;\n }\n\n // save current scroll position - when keyboard will hide we'll reuse\n // this value to achieve smooth hide effect\n scrollBeforeKeyboardMovement.value = position.value;\n }\n\n if (focusWasChanged && !keyboardWillAppear.value) {\n if (!pendingSelectionForFocus.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\n ghostViewSpace.value =\n position.value +\n scrollViewLayout.value.height -\n scrollViewContentSize.value.height;\n\n if (ghostViewSpace.value > 0) {\n scrollPosition.value = position.value;\n }\n },\n onMove: (e) => {\n \"worklet\";\n\n syncKeyboardFrame(e);\n\n if (removeGhostPadding(e.height)) {\n return;\n }\n\n // if the user has set disableScrollOnKeyboardHide, only auto-scroll when the keyboard opens\n if (!disableScrollOnKeyboardHide || keyboardWillAppear.value) {\n maybeScroll(e.height);\n }\n },\n onEnd: (e) => {\n \"worklet\";\n\n removeGhostPadding(e.height);\n\n keyboardHeight.value = e.height;\n scrollPosition.value = position.value;\n\n if (e.height === 0) {\n lastSelection.value = null;\n }\n\n syncKeyboardFrame(e);\n },\n },\n [\n maybeScroll,\n removeGhostPadding,\n disableScrollOnKeyboardHide,\n syncKeyboardFrame,\n ],\n );\n\n const synchronize = useCallback(async () => {\n await update();\n\n runOnUI(() => {\n \"worklet\";\n\n scrollFromCurrentPosition();\n })();\n }, [update, scrollFromCurrentPosition]);\n\n useImperativeHandle(\n ref,\n () => {\n const scrollView = scrollViewRef.current;\n\n if (scrollView) {\n const scrollViewWithMethods =\n scrollView as KeyboardAwareScrollViewRef;\n\n scrollViewWithMethods.assureFocusedInputVisible = () => {\n synchronize();\n };\n\n return scrollViewWithMethods;\n }\n\n return {\n assureFocusedInputVisible: () => {\n synchronize();\n },\n } as KeyboardAwareScrollViewRef;\n },\n [synchronize],\n );\n\n useEffect(() => {\n synchronize();\n }, [bottomOffset]);\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 // input has changed layout - let's check if we need to scroll\n // may happen when you paste text, then onSelectionChange will be\n // fired earlier than text actually changes its layout\n scrollFromCurrentPosition();\n }\n },\n [],\n );\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 const padding = useDerivedValue(\n () => (enabled ? currentKeyboardFrameHeight.value + 1 : 0),\n [enabled],\n );\n\n return (\n <ScrollViewWithBottomPadding\n ref={onRef}\n {...rest}\n bottomPadding={padding}\n scrollEventThrottle={16}\n ScrollViewComponent={ScrollViewComponent}\n onLayout={onScrollViewLayout}\n >\n {children}\n </ScrollViewWithBottomPadding>\n );\n },\n);\n\nexport default KeyboardAwareScrollView;\n"],"mappings":";AAAA,OAAOA,KAAK,IACVC,UAAU,EACVC,WAAW,EACXC,SAAS,EACTC,mBAAmB,EACnBC,OAAO,QACF,OAAO;AACd,OAAOC,UAAU,IACfC,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MACf;IACF,CAAC;EACH,CAAC,EACD,CAACA,WAAW,CACd,CAAC;EAED9G,SAAS,CAAC,MAAM;IACd8G,WAAW,CAAC,CAAC;EACf,CAAC,EAAE,CAACrF,YAAY,CAAC,CAAC;EAElBjB,mBAAmB,CACjB,MAAM4C,KAAK,CAACQ,KAAK,EACjB,CAACC,OAAO,EAAEqD,QAAQ,KAAK;IACrB,IACE,CAAArD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEuC,MAAM,OAAKc,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEd,MAAM,KACpC,CAAAvC,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEnB,MAAM,CAACe,MAAM,OAAKyD,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAExE,MAAM,CAACe,MAAM,GAClD;MACA;MACA;MACA;MACAmC,yBAAyB,CAAC,CAAC;IAC7B;EACF,CAAC,EACD,EACF,CAAC;;EAED;EACA;EACA;EACA;EACA;EACA;EACA,MAAMuB,OAAO,GAAGzG,eAAe,CAC7B,MAAOiB,OAAO,GAAGmB,0BAA0B,CAACc,KAAK,GAAG,CAAC,GAAG,CAAE,EAC1D,CAACjC,OAAO,CACV,CAAC;EAED,oBACE9B,KAAA,CAAAuH,aAAA,CAAClG,2BAA2B,EAAAmG,QAAA;IAC1BpF,GAAG,EAAEI;EAAM,GACPL,IAAI;IACRsF,aAAa,EAAEH,OAAQ;IACvBI,mBAAmB,EAAE,EAAG;IACxB1F,mBAAmB,EAAEA,mBAAoB;IACzCL,QAAQ,EAAEkC;EAAmB,IAE5BnC,QAC0B,CAAC;AAElC,CACF,CAAC;AAED,eAAeD,uBAAuB","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export { useChatKeyboard } from "./useChatKeyboard";
2
+ //# sourceMappingURL=hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useChatKeyboard"],"sources":["hooks.ts"],"sourcesContent":["export { useChatKeyboard } from \"./useChatKeyboard\";\nexport type { KeyboardLiftBehavior } from \"./useChatKeyboard/types\";\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,mBAAmB","ignoreList":[]}
@@ -0,0 +1,73 @@
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ import React, { forwardRef, useCallback, useMemo } from "react";
3
+ import { StyleSheet } from "react-native";
4
+ import { useAnimatedRef, useAnimatedStyle } from "react-native-reanimated";
5
+ import Reanimated from "react-native-reanimated";
6
+ import useCombinedRef from "../hooks/useCombinedRef";
7
+ import ScrollViewWithBottomPadding from "../ScrollViewWithBottomPadding";
8
+ import { useChatKeyboard } from "./useChatKeyboard";
9
+ const KeyboardChatScrollView = /*#__PURE__*/forwardRef(({
10
+ children,
11
+ ScrollViewComponent = Reanimated.ScrollView,
12
+ inverted = false,
13
+ keyboardLiftBehavior = "always",
14
+ freeze = false,
15
+ offset = 0,
16
+ onLayout: onLayoutProp,
17
+ onContentSizeChange: onContentSizeChangeProp,
18
+ ...rest
19
+ }, ref) => {
20
+ const scrollViewRef = useAnimatedRef();
21
+ const onRef = useCombinedRef(ref, scrollViewRef);
22
+ const {
23
+ padding,
24
+ currentHeight,
25
+ contentOffsetY,
26
+ onLayout: onLayoutInternal,
27
+ onContentSizeChange: onContentSizeChangeInternal
28
+ } = useChatKeyboard(scrollViewRef, {
29
+ inverted,
30
+ keyboardLiftBehavior,
31
+ freeze,
32
+ offset
33
+ });
34
+ const onLayout = useCallback(e => {
35
+ onLayoutInternal(e);
36
+ onLayoutProp === null || onLayoutProp === void 0 || onLayoutProp(e);
37
+ }, [onLayoutInternal, onLayoutProp]);
38
+ const onContentSizeChange = useCallback((w, h) => {
39
+ onContentSizeChangeInternal(w, h);
40
+ onContentSizeChangeProp === null || onContentSizeChangeProp === void 0 || onContentSizeChangeProp(w, h);
41
+ }, [onContentSizeChangeInternal, onContentSizeChangeProp]);
42
+
43
+ // Invisible view whose animated style changes every frame during keyboard
44
+ // animation. On Fabric, this forces Reanimated to schedule a commit,
45
+ // which flushes the scrollTo call in the same frame (fixing de-synchronization).
46
+ // see https://github.com/software-mansion/react-native-reanimated/issues/9000
47
+ const commitStyle = useAnimatedStyle(() => ({
48
+ transform: [{
49
+ translateY: -currentHeight.value
50
+ }]
51
+ }), []);
52
+ const commit = useMemo(() => [styles.commitView, commitStyle], [commitStyle]);
53
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ScrollViewWithBottomPadding, _extends({
54
+ ref: onRef
55
+ }, rest, {
56
+ bottomPadding: padding,
57
+ contentOffsetY: contentOffsetY,
58
+ inverted: inverted,
59
+ ScrollViewComponent: ScrollViewComponent,
60
+ onContentSizeChange: onContentSizeChange,
61
+ onLayout: onLayout
62
+ }), children), /*#__PURE__*/React.createElement(Reanimated.View, {
63
+ style: commit
64
+ }));
65
+ });
66
+ const styles = StyleSheet.create({
67
+ commitView: {
68
+ display: "none",
69
+ position: "absolute"
70
+ }
71
+ });
72
+ export default KeyboardChatScrollView;
73
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","forwardRef","useCallback","useMemo","StyleSheet","useAnimatedRef","useAnimatedStyle","Reanimated","useCombinedRef","ScrollViewWithBottomPadding","useChatKeyboard","KeyboardChatScrollView","children","ScrollViewComponent","ScrollView","inverted","keyboardLiftBehavior","freeze","offset","onLayout","onLayoutProp","onContentSizeChange","onContentSizeChangeProp","rest","ref","scrollViewRef","onRef","padding","currentHeight","contentOffsetY","onLayoutInternal","onContentSizeChangeInternal","e","w","h","commitStyle","transform","translateY","value","commit","styles","commitView","createElement","Fragment","_extends","bottomPadding","View","style","create","display","position"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\nimport { useAnimatedRef, useAnimatedStyle } from \"react-native-reanimated\";\nimport Reanimated from \"react-native-reanimated\";\n\nimport useCombinedRef from \"../hooks/useCombinedRef\";\nimport ScrollViewWithBottomPadding from \"../ScrollViewWithBottomPadding\";\n\nimport { useChatKeyboard } from \"./useChatKeyboard\";\n\nimport type { KeyboardChatScrollViewProps } from \"./types\";\nimport type { LayoutChangeEvent } from \"react-native\";\n\nconst KeyboardChatScrollView = forwardRef<\n Reanimated.ScrollView,\n React.PropsWithChildren<KeyboardChatScrollViewProps>\n>(\n (\n {\n children,\n ScrollViewComponent = Reanimated.ScrollView,\n inverted = false,\n keyboardLiftBehavior = \"always\",\n freeze = false,\n offset = 0,\n onLayout: onLayoutProp,\n onContentSizeChange: onContentSizeChangeProp,\n ...rest\n },\n ref,\n ) => {\n const scrollViewRef = useAnimatedRef<Reanimated.ScrollView>();\n const onRef = useCombinedRef(ref, scrollViewRef);\n\n const {\n padding,\n currentHeight,\n contentOffsetY,\n onLayout: onLayoutInternal,\n onContentSizeChange: onContentSizeChangeInternal,\n } = useChatKeyboard(scrollViewRef, {\n inverted,\n keyboardLiftBehavior,\n freeze,\n offset,\n });\n\n const onLayout = useCallback(\n (e: LayoutChangeEvent) => {\n onLayoutInternal(e);\n onLayoutProp?.(e);\n },\n [onLayoutInternal, onLayoutProp],\n );\n\n const onContentSizeChange = useCallback(\n (w: number, h: number) => {\n onContentSizeChangeInternal(w, h);\n onContentSizeChangeProp?.(w, h);\n },\n [onContentSizeChangeInternal, onContentSizeChangeProp],\n );\n\n // Invisible view whose animated style changes every frame during keyboard\n // animation. On Fabric, this forces Reanimated to schedule a commit,\n // which flushes the scrollTo call in the same frame (fixing de-synchronization).\n // see https://github.com/software-mansion/react-native-reanimated/issues/9000\n const commitStyle = useAnimatedStyle(\n () => ({\n transform: [{ translateY: -currentHeight.value }],\n }),\n [],\n );\n const commit = useMemo(\n () => [styles.commitView, commitStyle],\n [commitStyle],\n );\n\n return (\n <>\n <ScrollViewWithBottomPadding\n ref={onRef}\n {...rest}\n bottomPadding={padding}\n contentOffsetY={contentOffsetY}\n inverted={inverted}\n ScrollViewComponent={ScrollViewComponent}\n onContentSizeChange={onContentSizeChange}\n onLayout={onLayout}\n >\n {children}\n </ScrollViewWithBottomPadding>\n <Reanimated.View style={commit} />\n </>\n );\n },\n);\n\nconst styles = StyleSheet.create({\n commitView: {\n display: \"none\",\n position: \"absolute\",\n },\n});\n\nexport default KeyboardChatScrollView;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAC/D,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,cAAc,EAAEC,gBAAgB,QAAQ,yBAAyB;AAC1E,OAAOC,UAAU,MAAM,yBAAyB;AAEhD,OAAOC,cAAc,MAAM,yBAAyB;AACpD,OAAOC,2BAA2B,MAAM,gCAAgC;AAExE,SAASC,eAAe,QAAQ,mBAAmB;AAKnD,MAAMC,sBAAsB,gBAAGV,UAAU,CAIvC,CACE;EACEW,QAAQ;EACRC,mBAAmB,GAAGN,UAAU,CAACO,UAAU;EAC3CC,QAAQ,GAAG,KAAK;EAChBC,oBAAoB,GAAG,QAAQ;EAC/BC,MAAM,GAAG,KAAK;EACdC,MAAM,GAAG,CAAC;EACVC,QAAQ,EAAEC,YAAY;EACtBC,mBAAmB,EAAEC,uBAAuB;EAC5C,GAAGC;AACL,CAAC,EACDC,GAAG,KACA;EACH,MAAMC,aAAa,GAAGpB,cAAc,CAAwB,CAAC;EAC7D,MAAMqB,KAAK,GAAGlB,cAAc,CAACgB,GAAG,EAAEC,aAAa,CAAC;EAEhD,MAAM;IACJE,OAAO;IACPC,aAAa;IACbC,cAAc;IACdV,QAAQ,EAAEW,gBAAgB;IAC1BT,mBAAmB,EAAEU;EACvB,CAAC,GAAGrB,eAAe,CAACe,aAAa,EAAE;IACjCV,QAAQ;IACRC,oBAAoB;IACpBC,MAAM;IACNC;EACF,CAAC,CAAC;EAEF,MAAMC,QAAQ,GA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GAAGpC,UAAU,CAAC4C,MAAM,CAAC;EAC/BP,UAAU,EAAE;IACVQ,OAAO,EAAE,MAAM;IACfC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;AAEF,eAAevC,sBAAsB","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { AnimatedScrollViewComponent } from \"../ScrollViewWithBottomPadding\";\nimport type { KeyboardLiftBehavior } from \"./useChatKeyboard/types\";\nimport type { ScrollViewProps } from \"react-native\";\n\nexport type KeyboardChatScrollViewProps = {\n /** Custom component for `ScrollView`. Default is `ScrollView`. */\n ScrollViewComponent?: AnimatedScrollViewComponent;\n /** Whether list are using `inverted` prop. Default is `false`. */\n inverted?: boolean;\n /**\n * The distance between the bottom of the screen and the `ScrollView`.\n * When the keyboard appears, the `ScrollView` will only push content by the effective\n * distance (`keyboardHeight - offset`) instead of the full keyboard height.\n *\n * Useful when the input is not at the very bottom of the screen (e.g., above safe area, above\n * bottom tabs, etc. - in this case offset should be equal to the height of the elements between\n * `ScrollView` and bottom of the screen).\n *\n * Default is `0`.\n */\n offset?: number;\n /**\n * Determines how the chat content should behave when the keyboard appears, specifically whether\n * the scroll view should automatically lift its content to keep it visible above the keyboard.\n *\n * Possible values:\n * - `'always'`: The content always lifts along with the keyboard, ensuring the messages from the bottom part of screen\n * remain visible regardless of the current scroll position. This is the default behavior for most chat applications (used in Telegram).\n * - `'whenAtEnd'`: The content lifts only if the scroll view is at the end (i.e., the last message\n * is visible or near the bottom). This prevents unnecessary adjustments when the user is scrolling\n * through older messages (ChatGPT mobile app behavior).\n * - `'persistent'`: The content always lifts when the keyboard appears (similar to `'always'`), but\n * does not reset (lower) when the keyboard hides. This mimics behaviors where the view remains adjusted\n * after keyboard dismissal to maintain focus on the latest content without shifting back (Claude mobile app behavior).\n * - `'never'`: The content does not lift at all when the keyboard appears. Use this for scenarios\n * when you don't want to disturb user attention with animations (Perplexity mobile app behavior).\n *\n * Default is `'always'`.\n */\n keyboardLiftBehavior?: KeyboardLiftBehavior;\n /**\n * When `true`, freezes all keyboard-driven layout changes (padding, content offset, scroll position).\n * Useful when dismissing the keyboard to open a bottom sheet — prevents visual disruption\n * while the sheet is visible.\n *\n * Default is `false`.\n */\n freeze?: boolean;\n} & ScrollViewProps;\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,125 @@
1
+ import { interpolate } from "react-native-reanimated";
2
+ const AT_END_THRESHOLD = 20;
3
+
4
+ /**
5
+ * Map the current keyboard height to an effective height that accounts for a
6
+ * fixed offset (e.g. bottom safe-area or tab-bar height).
7
+ *
8
+ * @param height - Current keyboard height.
9
+ * @param targetKeyboardHeight - Full target keyboard height (captured on keyboard open).
10
+ * @param offset - Fixed distance between the scroll-view bottom and the screen bottom.
11
+ * @returns Effective height after subtracting the offset proportionally.
12
+ * @example
13
+ * ```ts
14
+ * getEffectiveHeight(300, 300, 50); // 250
15
+ * getEffectiveHeight(150, 300, 50); // 125
16
+ * ```
17
+ */
18
+ export function getEffectiveHeight(height, targetKeyboardHeight, offset) {
19
+ "worklet";
20
+
21
+ if (offset === 0 || targetKeyboardHeight === 0) {
22
+ return height;
23
+ }
24
+ return interpolate(height, [0, targetKeyboardHeight], [0, Math.max(targetKeyboardHeight - offset, 0)]);
25
+ }
26
+
27
+ /**
28
+ * Check whether the scroll view is at the end of its content.
29
+ *
30
+ * For non-inverted lists the "end" is the bottom of the content.
31
+ * For inverted lists the "end" is the top (scroll offset near 0),
32
+ * because that is where the latest messages are displayed.
33
+ *
34
+ * @param scrollOffset - Current vertical scroll offset.
35
+ * @param layoutHeight - Visible height of the scroll view.
36
+ * @param contentHeight - Total height of the scrollable content.
37
+ * @param inverted - Whether the list is inverted.
38
+ * @returns `true` if the scroll position is within the threshold of the content end.
39
+ * @example
40
+ * ```ts
41
+ * const atEnd = isScrollAtEnd(100, 800, 920); // true (100 + 800 >= 920 - 20)
42
+ * const atEndInverted = isScrollAtEnd(5, 800, 2000, true); // true (5 <= 20)
43
+ * ```
44
+ */
45
+ export function isScrollAtEnd(scrollOffset, layoutHeight, contentHeight, inverted = false) {
46
+ "worklet";
47
+
48
+ if (inverted) {
49
+ return scrollOffset <= AT_END_THRESHOLD;
50
+ }
51
+ return scrollOffset + layoutHeight >= contentHeight - AT_END_THRESHOLD;
52
+ }
53
+
54
+ /**
55
+ * Decide whether content should be shifted based on the keyboard lift behavior.
56
+ *
57
+ * @param behavior - The configured keyboard lift behavior.
58
+ * @param isAtEnd - Whether the scroll view is currently at the end.
59
+ * @returns `true` if content should be shifted.
60
+ * @example
61
+ * ```ts
62
+ * shouldShiftContent("always", false); // true
63
+ * shouldShiftContent("whenAtEnd", false); // false
64
+ * ```
65
+ */
66
+ export function shouldShiftContent(behavior, isAtEnd) {
67
+ "worklet";
68
+
69
+ switch (behavior) {
70
+ case "always":
71
+ return true;
72
+ case "never":
73
+ return false;
74
+ case "whenAtEnd":
75
+ return isAtEnd;
76
+ case "persistent":
77
+ return true;
78
+ }
79
+ }
80
+
81
+ /**
82
+ * Compute the clamped scroll target for non-inverted lists.
83
+ *
84
+ * @param offsetBeforeScroll - Scroll position before keyboard appeared.
85
+ * @param keyboardHeight - Current keyboard height.
86
+ * @param contentHeight - Total height of the scrollable content.
87
+ * @param layoutHeight - Visible height of the scroll view.
88
+ * @returns Clamped scroll target between 0 and maxScroll.
89
+ * @example
90
+ * ```ts
91
+ * clampedScrollTarget(100, 300, 1000, 800); // 400
92
+ * ```
93
+ */
94
+ export function clampedScrollTarget(offsetBeforeScroll, keyboardHeight, contentHeight, layoutHeight) {
95
+ "worklet";
96
+
97
+ const maxScroll = Math.max(contentHeight - layoutHeight + keyboardHeight, 0);
98
+ return Math.min(Math.max(offsetBeforeScroll + keyboardHeight, 0), maxScroll);
99
+ }
100
+
101
+ /**
102
+ * Compute contentOffset.y for iOS lists.
103
+ *
104
+ * @param relativeScroll - Scroll position relative to current inset.
105
+ * @param keyboardHeight - Target keyboard height.
106
+ * @param contentHeight - Total height of the scrollable content.
107
+ * @param layoutHeight - Visible height of the scroll view.
108
+ * @param inverted - Whether the list is inverted.
109
+ * @returns The absolute contentOffset.y to set.
110
+ * @example
111
+ * ```ts
112
+ * computeIOSContentOffset(100, 300, 1000, 800, false); // 400
113
+ * ```
114
+ */
115
+ export function computeIOSContentOffset(relativeScroll, keyboardHeight, contentHeight, layoutHeight, inverted) {
116
+ "worklet";
117
+
118
+ if (inverted) {
119
+ const maxScroll = Math.max(contentHeight - layoutHeight, 0);
120
+ return Math.max(Math.min(relativeScroll - keyboardHeight, maxScroll), -keyboardHeight);
121
+ }
122
+ const maxScroll = Math.max(contentHeight - layoutHeight + keyboardHeight, 0);
123
+ return Math.min(Math.max(keyboardHeight + relativeScroll, 0), maxScroll);
124
+ }
125
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["interpolate","AT_END_THRESHOLD","getEffectiveHeight","height","targetKeyboardHeight","offset","Math","max","isScrollAtEnd","scrollOffset","layoutHeight","contentHeight","inverted","shouldShiftContent","behavior","isAtEnd","clampedScrollTarget","offsetBeforeScroll","keyboardHeight","maxScroll","min","computeIOSContentOffset","relativeScroll"],"sources":["helpers.ts"],"sourcesContent":["import { interpolate } from \"react-native-reanimated\";\n\nimport type { KeyboardLiftBehavior } from \"./types\";\n\nconst AT_END_THRESHOLD = 20;\n\n/**\n * Map the current keyboard height to an effective height that accounts for a\n * fixed offset (e.g. bottom safe-area or tab-bar height).\n *\n * @param height - Current keyboard height.\n * @param targetKeyboardHeight - Full target keyboard height (captured on keyboard open).\n * @param offset - Fixed distance between the scroll-view bottom and the screen bottom.\n * @returns Effective height after subtracting the offset proportionally.\n * @example\n * ```ts\n * getEffectiveHeight(300, 300, 50); // 250\n * getEffectiveHeight(150, 300, 50); // 125\n * ```\n */\nexport function getEffectiveHeight(\n height: number,\n targetKeyboardHeight: number,\n offset: number,\n): number {\n \"worklet\";\n\n if (offset === 0 || targetKeyboardHeight === 0) {\n return height;\n }\n\n return interpolate(\n height,\n [0, targetKeyboardHeight],\n [0, Math.max(targetKeyboardHeight - offset, 0)],\n );\n}\n\n/**\n * Check whether the scroll view is at the end of its content.\n *\n * For non-inverted lists the \"end\" is the bottom of the content.\n * For inverted lists the \"end\" is the top (scroll offset near 0),\n * because that is where the latest messages are displayed.\n *\n * @param scrollOffset - Current vertical scroll offset.\n * @param layoutHeight - Visible height of the scroll view.\n * @param contentHeight - Total height of the scrollable content.\n * @param inverted - Whether the list is inverted.\n * @returns `true` if the scroll position is within the threshold of the content end.\n * @example\n * ```ts\n * const atEnd = isScrollAtEnd(100, 800, 920); // true (100 + 800 >= 920 - 20)\n * const atEndInverted = isScrollAtEnd(5, 800, 2000, true); // true (5 <= 20)\n * ```\n */\nexport function isScrollAtEnd(\n scrollOffset: number,\n layoutHeight: number,\n contentHeight: number,\n inverted: boolean = false,\n): boolean {\n \"worklet\";\n\n if (inverted) {\n return scrollOffset <= AT_END_THRESHOLD;\n }\n\n return scrollOffset + layoutHeight >= contentHeight - AT_END_THRESHOLD;\n}\n\n/**\n * Decide whether content should be shifted based on the keyboard lift behavior.\n *\n * @param behavior - The configured keyboard lift behavior.\n * @param isAtEnd - Whether the scroll view is currently at the end.\n * @returns `true` if content should be shifted.\n * @example\n * ```ts\n * shouldShiftContent(\"always\", false); // true\n * shouldShiftContent(\"whenAtEnd\", false); // false\n * ```\n */\nexport function shouldShiftContent(\n behavior: KeyboardLiftBehavior,\n isAtEnd: boolean,\n): boolean {\n \"worklet\";\n\n switch (behavior) {\n case \"always\":\n return true;\n case \"never\":\n return false;\n case \"whenAtEnd\":\n return isAtEnd;\n case \"persistent\":\n return true;\n }\n}\n\n/**\n * Compute the clamped scroll target for non-inverted lists.\n *\n * @param offsetBeforeScroll - Scroll position before keyboard appeared.\n * @param keyboardHeight - Current keyboard height.\n * @param contentHeight - Total height of the scrollable content.\n * @param layoutHeight - Visible height of the scroll view.\n * @returns Clamped scroll target between 0 and maxScroll.\n * @example\n * ```ts\n * clampedScrollTarget(100, 300, 1000, 800); // 400\n * ```\n */\nexport function clampedScrollTarget(\n offsetBeforeScroll: number,\n keyboardHeight: number,\n contentHeight: number,\n layoutHeight: number,\n): number {\n \"worklet\";\n\n const maxScroll = Math.max(contentHeight - layoutHeight + keyboardHeight, 0);\n\n return Math.min(Math.max(offsetBeforeScroll + keyboardHeight, 0), maxScroll);\n}\n\n/**\n * Compute contentOffset.y for iOS lists.\n *\n * @param relativeScroll - Scroll position relative to current inset.\n * @param keyboardHeight - Target keyboard height.\n * @param contentHeight - Total height of the scrollable content.\n * @param layoutHeight - Visible height of the scroll view.\n * @param inverted - Whether the list is inverted.\n * @returns The absolute contentOffset.y to set.\n * @example\n * ```ts\n * computeIOSContentOffset(100, 300, 1000, 800, false); // 400\n * ```\n */\nexport function computeIOSContentOffset(\n relativeScroll: number,\n keyboardHeight: number,\n contentHeight: number,\n layoutHeight: number,\n inverted: boolean,\n): number {\n \"worklet\";\n\n if (inverted) {\n const maxScroll = Math.max(contentHeight - layoutHeight, 0);\n\n return Math.max(\n Math.min(relativeScroll - keyboardHeight, maxScroll),\n -keyboardHeight,\n );\n }\n\n const maxScroll = Math.max(contentHeight - layoutHeight + keyboardHeight, 0);\n\n return Math.min(Math.max(keyboardHeight + relativeScroll, 0), maxScroll);\n}\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,yBAAyB;AAIrD,MAAMC,gBAAgB,GAAG,EAAE;;AAE3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAChCC,MAAc,EACdC,oBAA4B,EAC5BC,MAAc,EACN;EACR,SAAS;;EAET,IAAIA,MAAM,KAAK,CAAC,IAAID,oBAAoB,KAAK,CAAC,EAAE;IAC9C,OAAOD,MAAM;EACf;EAEA,OAAOH,WAAW,CAChBG,MAAM,EACN,CAAC,CAAC,E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