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
@@ -0,0 +1,115 @@
1
+ import { useSharedValue } from "react-native-reanimated";
2
+ import { useKeyboardHandler } from "../../../hooks";
3
+ import useScrollState from "../../hooks/useScrollState";
4
+ import { computeIOSContentOffset, getEffectiveHeight, isScrollAtEnd, shouldShiftContent } from "./helpers";
5
+ /**
6
+ * Hook that manages keyboard-driven scrolling for chat-style scroll views.
7
+ * Calculates padding (extra scrollable space) and content shift values,
8
+ * using iOS-specific strategy (contentOffset set once in onStart).
9
+ *
10
+ * @param scrollViewRef - Animated ref to the scroll view.
11
+ * @param options - Configuration for inverted and keyboardLiftBehavior.
12
+ * @returns Shared values for padding and contentOffsetY.
13
+ * @example
14
+ * ```tsx
15
+ * const { padding, contentOffsetY } = useChatKeyboard(ref, {
16
+ * inverted: false,
17
+ * keyboardLiftBehavior: "always",
18
+ * });
19
+ * ```
20
+ */
21
+ function useChatKeyboard(scrollViewRef, options) {
22
+ const {
23
+ inverted,
24
+ keyboardLiftBehavior,
25
+ freeze,
26
+ offset
27
+ } = options;
28
+ const padding = useSharedValue(0);
29
+ const currentHeight = useSharedValue(0);
30
+ const contentOffsetY = useSharedValue(0);
31
+ const targetKeyboardHeight = useSharedValue(0);
32
+ const {
33
+ layout,
34
+ size,
35
+ offset: scroll,
36
+ onLayout,
37
+ onContentSizeChange
38
+ } = useScrollState(scrollViewRef);
39
+ useKeyboardHandler({
40
+ onStart: e => {
41
+ "worklet";
42
+
43
+ if (freeze) {
44
+ return;
45
+ }
46
+ if (e.height > 0) {
47
+ // eslint-disable-next-line react-compiler/react-compiler
48
+ targetKeyboardHeight.value = e.height;
49
+ }
50
+ const effective = getEffectiveHeight(e.height, targetKeyboardHeight.value, offset);
51
+ const atEnd = isScrollAtEnd(scroll.value, layout.value.height, size.value.height, inverted);
52
+
53
+ // persistent mode: when keyboard shrinks, snap to end or hold position
54
+ if (keyboardLiftBehavior === "persistent" && effective < padding.value) {
55
+ padding.value = effective;
56
+ if (atEnd) {
57
+ if (inverted) {
58
+ contentOffsetY.value = -effective;
59
+ } else {
60
+ contentOffsetY.value = Math.max(size.value.height - layout.value.height + effective, 0);
61
+ }
62
+ } else {
63
+ // Preserve current scroll position so the animated props
64
+ // don't re-apply the stale contentOffset from keyboard open
65
+ contentOffsetY.value = scroll.value;
66
+ }
67
+ return;
68
+ }
69
+
70
+ // never mode: when keyboard shrinks and at end, snap to end
71
+ // to avoid ghost padding
72
+ if (keyboardLiftBehavior === "never" && effective < padding.value && atEnd) {
73
+ padding.value = effective;
74
+ if (inverted) {
75
+ contentOffsetY.value = -effective;
76
+ } else {
77
+ contentOffsetY.value = Math.max(size.value.height - layout.value.height + effective, 0);
78
+ }
79
+ return;
80
+ }
81
+ const relativeScroll = inverted ? scroll.value + padding.value : scroll.value - padding.value;
82
+ padding.value = effective;
83
+ if (!shouldShiftContent(keyboardLiftBehavior, atEnd)) {
84
+ // Preserve current scroll position so animated props
85
+ // don't re-apply a stale contentOffset when padding changes
86
+ contentOffsetY.value = scroll.value;
87
+ return;
88
+ }
89
+ contentOffsetY.value = computeIOSContentOffset(relativeScroll, effective, size.value.height, layout.value.height, inverted);
90
+ },
91
+ onMove: () => {
92
+ "worklet";
93
+
94
+ // iOS doesn't need per-frame updates (contentOffset handles it)
95
+ },
96
+ onEnd: e => {
97
+ "worklet";
98
+
99
+ if (freeze) {
100
+ return;
101
+ }
102
+ const effective = getEffectiveHeight(e.height, targetKeyboardHeight.value, offset);
103
+ padding.value = effective;
104
+ }
105
+ }, [inverted, keyboardLiftBehavior, freeze, offset]);
106
+ return {
107
+ padding,
108
+ currentHeight,
109
+ contentOffsetY,
110
+ onLayout,
111
+ onContentSizeChange
112
+ };
113
+ }
114
+ export { useChatKeyboard };
115
+ //# sourceMappingURL=index.ios.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useSharedValue","useKeyboardHandler","useScrollState","computeIOSContentOffset","getEffectiveHeight","isScrollAtEnd","shouldShiftContent","useChatKeyboard","scrollViewRef","options","inverted","keyboardLiftBehavior","freeze","offset","padding","currentHeight","contentOffsetY","targetKeyboardHeight","layout","size","scroll","onLayout","onContentSizeChange","onStart","e","height","value","effective","atEnd","Math","max","relativeScroll","onMove","onEnd"],"sources":["index.ios.ts"],"sourcesContent":["import { useSharedValue } from \"react-native-reanimated\";\n\nimport { useKeyboardHandler } from \"../../../hooks\";\nimport useScrollState from \"../../hooks/useScrollState\";\n\nimport {\n computeIOSContentOffset,\n getEffectiveHeight,\n isScrollAtEnd,\n shouldShiftContent,\n} from \"./helpers\";\n\nimport type { UseChatKeyboardOptions, UseChatKeyboardReturn } from \"./types\";\nimport type { AnimatedRef } from \"react-native-reanimated\";\nimport type Reanimated from \"react-native-reanimated\";\n\n/**\n * Hook that manages keyboard-driven scrolling for chat-style scroll views.\n * Calculates padding (extra scrollable space) and content shift values,\n * using iOS-specific strategy (contentOffset set once in onStart).\n *\n * @param scrollViewRef - Animated ref to the scroll view.\n * @param options - Configuration for inverted and keyboardLiftBehavior.\n * @returns Shared values for padding and contentOffsetY.\n * @example\n * ```tsx\n * const { padding, contentOffsetY } = useChatKeyboard(ref, {\n * inverted: false,\n * keyboardLiftBehavior: \"always\",\n * });\n * ```\n */\nfunction useChatKeyboard(\n scrollViewRef: AnimatedRef<Reanimated.ScrollView>,\n options: UseChatKeyboardOptions,\n): UseChatKeyboardReturn {\n const { inverted, keyboardLiftBehavior, freeze, offset } = options;\n\n const padding = useSharedValue(0);\n const currentHeight = useSharedValue(0);\n const contentOffsetY = useSharedValue(0);\n const targetKeyboardHeight = useSharedValue(0);\n\n const {\n layout,\n size,\n offset: scroll,\n onLayout,\n onContentSizeChange,\n } = useScrollState(scrollViewRef);\n\n useKeyboardHandler(\n {\n onStart: (e) => {\n \"worklet\";\n\n if (freeze) {\n return;\n }\n\n if (e.height > 0) {\n // eslint-disable-next-line react-compiler/react-compiler\n targetKeyboardHeight.value = e.height;\n }\n\n const effective = getEffectiveHeight(\n e.height,\n targetKeyboardHeight.value,\n offset,\n );\n\n const atEnd = isScrollAtEnd(\n scroll.value,\n layout.value.height,\n size.value.height,\n inverted,\n );\n\n // persistent mode: when keyboard shrinks, snap to end or hold position\n if (\n keyboardLiftBehavior === \"persistent\" &&\n effective < padding.value\n ) {\n padding.value = effective;\n\n if (atEnd) {\n if (inverted) {\n contentOffsetY.value = -effective;\n } else {\n contentOffsetY.value = Math.max(\n size.value.height - layout.value.height + effective,\n 0,\n );\n }\n } else {\n // Preserve current scroll position so the animated props\n // don't re-apply the stale contentOffset from keyboard open\n contentOffsetY.value = scroll.value;\n }\n\n return;\n }\n\n // never mode: when keyboard shrinks and at end, snap to end\n // to avoid ghost padding\n if (\n keyboardLiftBehavior === \"never\" &&\n effective < padding.value &&\n atEnd\n ) {\n padding.value = effective;\n\n if (inverted) {\n contentOffsetY.value = -effective;\n } else {\n contentOffsetY.value = Math.max(\n size.value.height - layout.value.height + effective,\n 0,\n );\n }\n\n return;\n }\n\n const relativeScroll = inverted\n ? scroll.value + padding.value\n : scroll.value - padding.value;\n\n padding.value = effective;\n\n if (!shouldShiftContent(keyboardLiftBehavior, atEnd)) {\n // Preserve current scroll position so animated props\n // don't re-apply a stale contentOffset when padding changes\n contentOffsetY.value = scroll.value;\n\n return;\n }\n\n contentOffsetY.value = computeIOSContentOffset(\n relativeScroll,\n effective,\n size.value.height,\n layout.value.height,\n inverted,\n );\n },\n onMove: () => {\n \"worklet\";\n\n // iOS doesn't need per-frame updates (contentOffset handles it)\n },\n onEnd: (e) => {\n \"worklet\";\n\n if (freeze) {\n return;\n }\n\n const effective = getEffectiveHeight(\n e.height,\n targetKeyboardHeight.value,\n offset,\n );\n\n padding.value = effective;\n },\n },\n [inverted, keyboardLiftBehavior, freeze, offset],\n );\n\n return {\n padding,\n currentHeight,\n contentOffsetY,\n onLayout,\n onContentSizeChange,\n };\n}\n\nexport { useChatKeyboard };\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,yBAAyB;AAExD,SAASC,kBAAkB,QAAQ,gBAAgB;AACnD,OAAOC,cAAc,MAAM,4BAA4B;AAEvD,SACEC,uBAAuB,EACvBC,kBAAkB,EAClBC,aAAa,EACbC,kBAAkB,QACb,WAAW;AAMlB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,eAAeA,CACtBC,aAAiD,EACjDC,OAA+B,EACR;EACvB,MAAM;IAAEC,QAAQ;IAAEC,oBAAoB;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGJ,OAAO;EAElE,MAAMK,OAAO,GAAGd,cAAc,CAAC,CAAC,CAAC;EACjC,MAAMe,aAAa,GAAGf,cAAc,CAAC,CAAC,CAAC;EACvC,MAAMgB,cAAc,GAAGhB,cAAc,CAAC,CAAC,CAAC;EACxC,MAAMiB,oBAAoB,GAAGjB,cAAc,CAAC,CAAC,CAAC;EAE9C,MAAM;IACJkB,MAAM;IACNC,IAAI;IACJN,MAAM,EAAEO,MAAM;IACdC,QAAQ;IACRC;EACF,CAAC,GAAGpB,cAAc,CAACM,aAAa,CAAC;EAEjCP,kBAAkB,CAChB;IACEsB,OAAO,EAAGC,CAAC,IAAK;MACd,SAAS;;MAET,IAAIZ,MAAM,EAAE;QACV;MACF;MAEA,IAAIY,CAAC,CAACC,MAAM,GAAG,CAAC,EAAE;QAChB;QACAR,oBAAoB,CAACS,KAAK,GAAGF,CAAC,CAACC,MAAM;MACvC;MAEA,MAAME,SAAS,GAAGvB,kBAAkB,CA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OAAO,CAACY,KAAK;MAEhCZ,OAAO,CAACY,KAAK,GAAGC,SAAS;MAEzB,IAAI,CAACrB,kBAAkB,CAACK,oBAAoB,EAAEiB,KAAK,CAAC,EAAE;QACpD;QACA;QACAZ,cAAc,CAACU,KAAK,GAAGN,MAAM,CAACM,KAAK;QAEnC;MACF;MAEAV,cAAc,CAACU,KAAK,GAAGvB,uBAAuB,CAC5C4B,cAAc,EACdJ,SAAS,EACTR,IAAI,CAACO,KAAK,CAACD,MAAM,EACjBP,MAAM,CAACQ,KAAK,CAACD,MAAM,EACnBf,QACF,CAAC;IACH,CAAC;IACDsB,MAAM,EAAEA,CAAA,KAAM;MACZ,SAAS;;MAET;IACF,CAAC;IACDC,KAAK,EAAGT,CAAC,IAAK;MACZ,SAAS;;MAET,IAAIZ,MAAM,EAAE;QACV;MACF;MAEA,MAAMe,SAAS,GAAGvB,kBAAkB,CAClCoB,CAAC,CAACC,MAAM,EACRR,oBAAoB,CAACS,KAAK,EAC1Bb,MACF,CAAC;MAEDC,OAAO,CAACY,KAAK,GAAGC,SAAS;IAC3B;EACF,CAAC,EACD,CAACjB,QAAQ,EAAEC,oBAAoB,EAAEC,MAAM,EAAEC,MAAM,CACjD,CAAC;EAED,OAAO;IACLC,OAAO;IACPC,aAAa;IACbC,cAAc;IACdK,QAAQ;IACRC;EACF,CAAC;AACH;AAEA,SAASf,eAAe","ignoreList":[]}
@@ -0,0 +1,199 @@
1
+ import { scrollTo, useSharedValue } from "react-native-reanimated";
2
+ import { useKeyboardHandler } from "../../../hooks";
3
+ import useScrollState from "../../hooks/useScrollState";
4
+ import { clampedScrollTarget, getEffectiveHeight, isScrollAtEnd, shouldShiftContent } from "./helpers";
5
+ /**
6
+ * Hook that manages keyboard-driven scrolling for chat-style scroll views.
7
+ * Calculates padding (extra scrollable space) and content shift values,
8
+ * using per-frame scrollTo updates (Android and other platforms).
9
+ *
10
+ * @param scrollViewRef - Animated ref to the scroll view.
11
+ * @param options - Configuration for inverted and keyboardLiftBehavior.
12
+ * @returns Shared values for padding and contentOffsetY (always `undefined`).
13
+ * @example
14
+ * ```tsx
15
+ * const { padding, contentOffsetY } = useChatKeyboard(ref, {
16
+ * inverted: false,
17
+ * keyboardLiftBehavior: "always",
18
+ * });
19
+ * ```
20
+ */
21
+ function useChatKeyboard(scrollViewRef, options) {
22
+ const {
23
+ inverted,
24
+ keyboardLiftBehavior,
25
+ freeze,
26
+ offset
27
+ } = options;
28
+ const padding = useSharedValue(0);
29
+ const currentHeight = useSharedValue(0);
30
+ const offsetBeforeScroll = useSharedValue(0);
31
+ const targetKeyboardHeight = useSharedValue(0);
32
+ const closing = useSharedValue(false);
33
+ const {
34
+ layout,
35
+ size,
36
+ offset: scroll,
37
+ onLayout,
38
+ onContentSizeChange
39
+ } = useScrollState(scrollViewRef);
40
+ const clampScrollIfNeeded = effective => {
41
+ "worklet";
42
+
43
+ const maxScroll = Math.max(size.value.height - layout.value.height + effective, 0);
44
+ if (scroll.value > maxScroll) {
45
+ scrollTo(scrollViewRef, 0, maxScroll, false);
46
+ }
47
+ };
48
+ useKeyboardHandler({
49
+ onStart: e => {
50
+ "worklet";
51
+
52
+ if (freeze) {
53
+ return;
54
+ }
55
+ if (e.height > 0) {
56
+ // eslint-disable-next-line react-compiler/react-compiler
57
+ targetKeyboardHeight.value = e.height;
58
+ closing.value = false;
59
+ } else {
60
+ closing.value = true;
61
+ }
62
+ const effective = getEffectiveHeight(e.height, targetKeyboardHeight.value, offset);
63
+ const atEnd = isScrollAtEnd(scroll.value, layout.value.height, size.value.height, inverted);
64
+ if (inverted && e.duration === -1) {
65
+ // Android inverted: skip post-interactive snap-back events
66
+ // (duration === -1 means the keyboard is re-establishing its
67
+ // position after an interactive gesture, not a real animation)
68
+ return;
69
+ } else if (e.height > 0) {
70
+ // Android: keyboard opening — set padding + capture scroll position
71
+ padding.value = effective;
72
+ offsetBeforeScroll.value = scroll.value;
73
+ if (!inverted && keyboardLiftBehavior === "whenAtEnd" && !atEnd) {
74
+ // Sentinel: don't scroll in onMove (non-inverted only)
75
+ offsetBeforeScroll.value = -1;
76
+ }
77
+ } else {
78
+ // Android: keyboard closing — re-capture scroll position
79
+ if (inverted) {
80
+ offsetBeforeScroll.value = scroll.value;
81
+ } else {
82
+ // Preserve "whenAtEnd" sentinel: if open didn't shift, close shouldn't either
83
+ if (offsetBeforeScroll.value !== -1) {
84
+ // Non-inverted: subtract padding to get the "natural" position
85
+ // so onMove smoothly scrolls back from where the user is now
86
+ offsetBeforeScroll.value = scroll.value - padding.value;
87
+ }
88
+ }
89
+ }
90
+ },
91
+ onMove: e => {
92
+ "worklet";
93
+
94
+ if (freeze) {
95
+ return;
96
+ }
97
+ currentHeight.value = e.height;
98
+ if (inverted) {
99
+ // Skip post-interactive snap-back (duration === -1)
100
+ if (e.duration === -1) {
101
+ return;
102
+ }
103
+ const effective = getEffectiveHeight(e.height, targetKeyboardHeight.value, offset);
104
+
105
+ // Check if we should shift content based on position when keyboard started
106
+ const wasAtEnd = isScrollAtEnd(offsetBeforeScroll.value, layout.value.height, size.value.height, inverted);
107
+
108
+ // "never" at end: scroll along when keyboard closes to avoid jump
109
+ if (keyboardLiftBehavior === "never" && wasAtEnd && effective < padding.value) {
110
+ padding.value = effective;
111
+ scrollTo(scrollViewRef, 0, 0, false);
112
+ return;
113
+ }
114
+ if (!shouldShiftContent(keyboardLiftBehavior, wasAtEnd)) {
115
+ // Closing, not shifting: reduce padding to avoid gap
116
+ if (closing.value && effective < padding.value) {
117
+ padding.value = effective;
118
+ clampScrollIfNeeded(effective);
119
+ }
120
+ return;
121
+ }
122
+
123
+ // Persistent: don't let shift decrease
124
+ if (keyboardLiftBehavior === "persistent") {
125
+ const currentShift = offsetBeforeScroll.value + padding.value - scroll.value;
126
+ if (effective < currentShift) {
127
+ // When at end, allow scrolling back (snap to end + reduce padding)
128
+ if (wasAtEnd) {
129
+ padding.value = effective;
130
+ scrollTo(scrollViewRef, 0, 0, false);
131
+ } else if (closing.value) {
132
+ // Not at end: reduce padding to avoid gap
133
+ padding.value = effective;
134
+ clampScrollIfNeeded(effective);
135
+ }
136
+ return;
137
+ }
138
+ }
139
+ const target = offsetBeforeScroll.value + padding.value - effective;
140
+ scrollTo(scrollViewRef, 0, target, false);
141
+ } else {
142
+ const effective = getEffectiveHeight(e.height, targetKeyboardHeight.value, offset);
143
+
144
+ // "never" closing: scroll along when at end to avoid jump
145
+ if (keyboardLiftBehavior === "never" && closing.value && effective < padding.value) {
146
+ const wasAtEnd = isScrollAtEnd(offsetBeforeScroll.value + padding.value, layout.value.height, size.value.height, false);
147
+ if (wasAtEnd) {
148
+ const target = clampedScrollTarget(offsetBeforeScroll.value, effective, size.value.height, layout.value.height);
149
+ scrollTo(scrollViewRef, 0, target, false);
150
+ } else {
151
+ // Clamp to valid range as padding shrinks
152
+ clampScrollIfNeeded(effective);
153
+ }
154
+ return;
155
+ }
156
+ if (!shouldShiftContent(keyboardLiftBehavior, true)) {
157
+ return;
158
+ }
159
+
160
+ // "whenAtEnd" sentinel check
161
+ if (offsetBeforeScroll.value === -1) {
162
+ if (closing.value) {
163
+ // Keyboard didn't shift on open; ensure valid position on close
164
+ clampScrollIfNeeded(effective);
165
+ }
166
+ return;
167
+ }
168
+
169
+ // "persistent" closing: maintain position, clamped to valid range
170
+ if (keyboardLiftBehavior === "persistent" && closing.value) {
171
+ const keepAt = offsetBeforeScroll.value + padding.value;
172
+ const maxScroll = Math.max(size.value.height - layout.value.height + effective, 0);
173
+ scrollTo(scrollViewRef, 0, Math.min(keepAt, maxScroll), false);
174
+ return;
175
+ }
176
+ const target = clampedScrollTarget(offsetBeforeScroll.value, effective, size.value.height, layout.value.height);
177
+ scrollTo(scrollViewRef, 0, target, false);
178
+ }
179
+ },
180
+ onEnd: e => {
181
+ "worklet";
182
+
183
+ if (freeze) {
184
+ return;
185
+ }
186
+ const effective = getEffectiveHeight(e.height, targetKeyboardHeight.value, offset);
187
+ padding.value = effective;
188
+ }
189
+ }, [inverted, keyboardLiftBehavior, freeze, offset]);
190
+ return {
191
+ padding,
192
+ currentHeight,
193
+ contentOffsetY: undefined,
194
+ onLayout,
195
+ onContentSizeChange
196
+ };
197
+ }
198
+ export { useChatKeyboard };
199
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["scrollTo","useSharedValue","useKeyboardHandler","useScrollState","clampedScrollTarget","getEffectiveHeight","isScrollAtEnd","shouldShiftContent","useChatKeyboard","scrollViewRef","options","inverted","keyboardLiftBehavior","freeze","offset","padding","currentHeight","offsetBeforeScroll","targetKeyboardHeight","closing","layout","size","scroll","onLayout","onContentSizeChange","clampScrollIfNeeded","effective","maxScroll","Math","max","value","height","onStart","e","atEnd","duration","onMove","wasAtEnd","currentShift","target","keepAt","min","onEnd","contentOffsetY","undefined"],"sources":["index.ts"],"sourcesContent":["import { scrollTo, useSharedValue } from \"react-native-reanimated\";\n\nimport { useKeyboardHandler } from \"../../../hooks\";\nimport useScrollState from \"../../hooks/useScrollState\";\n\nimport {\n clampedScrollTarget,\n getEffectiveHeight,\n isScrollAtEnd,\n shouldShiftContent,\n} from \"./helpers\";\n\nimport type { UseChatKeyboardOptions, UseChatKeyboardReturn } from \"./types\";\nimport type { AnimatedRef } from \"react-native-reanimated\";\nimport type Reanimated from \"react-native-reanimated\";\n\n/**\n * Hook that manages keyboard-driven scrolling for chat-style scroll views.\n * Calculates padding (extra scrollable space) and content shift values,\n * using per-frame scrollTo updates (Android and other platforms).\n *\n * @param scrollViewRef - Animated ref to the scroll view.\n * @param options - Configuration for inverted and keyboardLiftBehavior.\n * @returns Shared values for padding and contentOffsetY (always `undefined`).\n * @example\n * ```tsx\n * const { padding, contentOffsetY } = useChatKeyboard(ref, {\n * inverted: false,\n * keyboardLiftBehavior: \"always\",\n * });\n * ```\n */\nfunction useChatKeyboard(\n scrollViewRef: AnimatedRef<Reanimated.ScrollView>,\n options: UseChatKeyboardOptions,\n): UseChatKeyboardReturn {\n const { inverted, keyboardLiftBehavior, freeze, offset } = options;\n\n const padding = useSharedValue(0);\n const currentHeight = useSharedValue(0);\n const offsetBeforeScroll = useSharedValue(0);\n const targetKeyboardHeight = useSharedValue(0);\n const closing = useSharedValue(false);\n\n const {\n layout,\n size,\n offset: scroll,\n onLayout,\n onContentSizeChange,\n } = useScrollState(scrollViewRef);\n\n const clampScrollIfNeeded = (effective: number) => {\n \"worklet\";\n\n const maxScroll = Math.max(\n size.value.height - layout.value.height + effective,\n 0,\n );\n\n if (scroll.value > maxScroll) {\n scrollTo(scrollViewRef, 0, maxScroll, false);\n }\n };\n\n useKeyboardHandler(\n {\n onStart: (e) => {\n \"worklet\";\n\n if (freeze) {\n return;\n }\n\n if (e.height > 0) {\n // eslint-disable-next-line react-compiler/react-compiler\n targetKeyboardHeight.value = e.height;\n closing.value = false;\n } else {\n closing.value = true;\n }\n\n const effective = getEffectiveHeight(\n e.height,\n targetKeyboardHeight.value,\n offset,\n );\n\n const atEnd = isScrollAtEnd(\n scroll.value,\n layout.value.height,\n size.value.height,\n inverted,\n );\n\n if (inverted && e.duration === -1) {\n // Android inverted: skip post-interactive snap-back events\n // (duration === -1 means the keyboard is re-establishing its\n // position after an interactive gesture, not a real animation)\n return;\n } else if (e.height > 0) {\n // Android: keyboard opening — set padding + capture scroll position\n padding.value = effective;\n offsetBeforeScroll.value = scroll.value;\n\n if (!inverted && keyboardLiftBehavior === \"whenAtEnd\" && !atEnd) {\n // Sentinel: don't scroll in onMove (non-inverted only)\n offsetBeforeScroll.value = -1;\n }\n } else {\n // Android: keyboard closing — re-capture scroll position\n if (inverted) {\n offsetBeforeScroll.value = scroll.value;\n } else {\n // Preserve \"whenAtEnd\" sentinel: if open didn't shift, close shouldn't either\n if (offsetBeforeScroll.value !== -1) {\n // Non-inverted: subtract padding to get the \"natural\" position\n // so onMove smoothly scrolls back from where the user is now\n offsetBeforeScroll.value = scroll.value - padding.value;\n }\n }\n }\n },\n onMove: (e) => {\n \"worklet\";\n\n if (freeze) {\n return;\n }\n\n currentHeight.value = e.height;\n\n if (inverted) {\n // Skip post-interactive snap-back (duration === -1)\n if (e.duration === -1) {\n return;\n }\n\n const effective = getEffectiveHeight(\n e.height,\n targetKeyboardHeight.value,\n offset,\n );\n\n // Check if we should shift content based on position when keyboard started\n const wasAtEnd = isScrollAtEnd(\n offsetBeforeScroll.value,\n layout.value.height,\n size.value.height,\n inverted,\n );\n\n // \"never\" at end: scroll along when keyboard closes to avoid jump\n if (\n keyboardLiftBehavior === \"never\" &&\n wasAtEnd &&\n effective < padding.value\n ) {\n padding.value = effective;\n scrollTo(scrollViewRef, 0, 0, false);\n\n return;\n }\n\n if (!shouldShiftContent(keyboardLiftBehavior, wasAtEnd)) {\n // Closing, not shifting: reduce padding to avoid gap\n if (closing.value && effective < padding.value) {\n padding.value = effective;\n clampScrollIfNeeded(effective);\n }\n\n return;\n }\n\n // Persistent: don't let shift decrease\n if (keyboardLiftBehavior === \"persistent\") {\n const currentShift =\n offsetBeforeScroll.value + padding.value - scroll.value;\n\n if (effective < currentShift) {\n // When at end, allow scrolling back (snap to end + reduce padding)\n if (wasAtEnd) {\n padding.value = effective;\n scrollTo(scrollViewRef, 0, 0, false);\n } else if (closing.value) {\n // Not at end: reduce padding to avoid gap\n padding.value = effective;\n clampScrollIfNeeded(effective);\n }\n\n return;\n }\n }\n\n const target = offsetBeforeScroll.value + padding.value - effective;\n\n scrollTo(scrollViewRef, 0, target, false);\n } else {\n const effective = getEffectiveHeight(\n e.height,\n targetKeyboardHeight.value,\n offset,\n );\n\n // \"never\" closing: scroll along when at end to avoid jump\n if (\n keyboardLiftBehavior === \"never\" &&\n closing.value &&\n effective < padding.value\n ) {\n const wasAtEnd = isScrollAtEnd(\n offsetBeforeScroll.value + padding.value,\n layout.value.height,\n size.value.height,\n false,\n );\n\n if (wasAtEnd) {\n const target = clampedScrollTarget(\n offsetBeforeScroll.value,\n effective,\n size.value.height,\n layout.value.height,\n );\n\n scrollTo(scrollViewRef, 0, target, false);\n } else {\n // Clamp to valid range as padding shrinks\n clampScrollIfNeeded(effective);\n }\n\n return;\n }\n\n if (!shouldShiftContent(keyboardLiftBehavior, true)) {\n return;\n }\n\n // \"whenAtEnd\" sentinel check\n if (offsetBeforeScroll.value === -1) {\n if (closing.value) {\n // Keyboard didn't shift on open; ensure valid position on close\n clampScrollIfNeeded(effective);\n }\n\n return;\n }\n\n // \"persistent\" closing: maintain position, clamped to valid range\n if (keyboardLiftBehavior === \"persistent\" && closing.value) {\n const keepAt = offsetBeforeScroll.value + padding.value;\n const maxScroll = Math.max(\n size.value.height - layout.value.height + effective,\n 0,\n );\n\n scrollTo(scrollViewRef, 0, Math.min(keepAt, maxScroll), false);\n\n return;\n }\n\n const target = clampedScrollTarget(\n offsetBeforeScroll.value,\n effective,\n size.value.height,\n layout.value.height,\n );\n\n scrollTo(scrollViewRef, 0, target, false);\n }\n },\n onEnd: (e) => {\n \"worklet\";\n\n if (freeze) {\n return;\n }\n\n const effective = getEffectiveHeight(\n e.height,\n targetKeyboardHeight.value,\n offset,\n );\n\n padding.value = effective;\n },\n },\n [inverted, keyboardLiftBehavior, freeze, offset],\n );\n\n return {\n padding,\n currentHeight,\n contentOffsetY: undefined,\n onLayout,\n onContentSizeChange,\n };\n}\n\nexport { useChatKeyboard };\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,cAAc,QAAQ,yBAAyB;AAElE,SAASC,kBAAkB,QAAQ,gBAAgB;AACnD,OAAOC,cAAc,MAAM,4BAA4B;AAEvD,SACEC,mBAAmB,EACnBC,kBAAkB,EAClBC,aAAa,EACbC,kBAAkB,QACb,WAAW;AAMlB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,eAAeA,CACtBC,aAAiD,EACjDC,OAA+B,EACR;EACvB,MAAM;IAAEC,QAAQ;IAAEC,oBAAoB;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGJ,OAAO;EAElE,MAAMK,OAAO,GAAGd,cAAc,CAAC,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,EAAE,KAAK,CAAC;UAE9D;QACF;QAEA,MAAMY,MAAM,GAAGnC,mBAAmB,CAChCa,kBAAkB,CAACa,KAAK,EACxBJ,SAAS,EACTL,IAAI,CAACS,KAAK,CAACC,MAAM,EACjBX,MAAM,CAACU,KAAK,CAACC,MACf,CAAC;QAED/B,QAAQ,CAACS,aAAa,EAAE,CAAC,EAAE8B,MAAM,EAAE,KAAK,CAAC;MAC3C;IACF,CAAC;IACDG,KAAK,EAAGT,CAAC,IAAK;MACZ,SAAS;;MAET,IAAIpB,MAAM,EAAE;QACV;MACF;MAEA,MAAMa,SAAS,GAAGrB,kBAAkB,CAClC4B,CAAC,CAACF,MAAM,EACRb,oBAAoB,CAACY,KAAK,EAC1BhB,MACF,CAAC;MAEDC,OAAO,CAACe,KAAK,GAAGJ,SAAS;IAC3B;EACF,CAAC,EACD,CAACf,QAAQ,EAAEC,oBAAoB,EAAEC,MAAM,EAAEC,MAAM,CACjD,CAAC;EAED,OAAO;IACLC,OAAO;IACPC,aAAa;IACb2B,cAAc,EAAEC,SAAS;IACzBrB,QAAQ;IACRC;EACF,CAAC;AACH;AAEA,SAAShB,eAAe","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 { LayoutChangeEvent } from \"react-native\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\ntype KeyboardLiftBehavior = \"always\" | \"whenAtEnd\" | \"persistent\" | \"never\";\n\ntype UseChatKeyboardOptions = {\n inverted: boolean;\n keyboardLiftBehavior: KeyboardLiftBehavior;\n freeze: boolean;\n offset: number;\n};\n\ntype UseChatKeyboardReturn = {\n /** Extra scrollable space (= keyboard height). Used as contentInset on iOS, contentInsetBottom/contentInsetTop on Android. */\n padding: SharedValue<number>;\n /** Raw keyboard height updated every frame in onMove. Used to force Reanimated commits on Fabric. */\n currentHeight: SharedValue<number>;\n /** Absolute Y content offset for iOS (set once in onStart). `undefined` on Android. */\n contentOffsetY: SharedValue<number> | undefined;\n /** Callback to attach to ScrollView's onLayout prop to capture initial viewport dimensions. */\n onLayout: (e: LayoutChangeEvent) => void;\n /** Callback to attach to ScrollView's onContentSizeChange prop to capture initial content dimensions. */\n onContentSizeChange: (w: number, h: number) => void;\n};\n\nexport type {\n KeyboardLiftBehavior,\n UseChatKeyboardOptions,\n UseChatKeyboardReturn,\n};\n"],"mappings":"","ignoreList":[]}
@@ -33,11 +33,15 @@ const KeyboardStickyView = /*#__PURE__*/forwardRef(({
33
33
  inputRange: [0, 1],
34
34
  outputRange: [closed, opened]
35
35
  });
36
- const styles = useMemo(() => [{
37
- transform: [{
38
- translateY: enabled ? Animated.add(height, offset) : closed
39
- }]
40
- }, style], [closed, enabled, height, offset, style]);
36
+ const styles = useMemo(() => {
37
+ const disabled = Animated.add(Animated.multiply(height, 0), closed);
38
+ const active = Animated.add(height, offset);
39
+ return [{
40
+ transform: [{
41
+ translateY: enabled ? active : disabled
42
+ }]
43
+ }, style];
44
+ }, [closed, enabled, height, offset, style]);
41
45
  return /*#__PURE__*/React.createElement(Animated.View, _extends({
42
46
  ref: ref,
43
47
  style: styles
@@ -1 +1 @@
1
- {"version":3,"names":["React","forwardRef","useMemo","Animated","useKeyboardAnimation","KeyboardStickyView","children","offset","closed","opened","style","enabled","props","ref","height","progress","interpolate","inputRange","outputRange","styles","transform","translateY","add","createElement","View","_extends"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef, useMemo } from \"react\";\nimport { Animated } from \"react-native\";\n\nimport { useKeyboardAnimation } from \"../../hooks\";\n\nimport type { View, ViewProps } from \"react-native\";\n\nexport type KeyboardStickyViewProps = {\n /**\n * Specify additional offset to the view for given keyboard state.\n */\n offset?: {\n /**\n * Adds additional `translateY` when keyboard is close. By default `0`.\n */\n closed?: number;\n /**\n * Adds additional `translateY` when keyboard is open. By default `0`.\n */\n opened?: number;\n };\n\n /** Controls whether this `KeyboardStickyView` instance should take effect. Default is `true`. */\n enabled?: boolean;\n} & ViewProps;\n\n/**\n * A View component that sticks to the keyboard and moves with it when it appears or disappears.\n * The view can be configured with custom offsets for both closed and open keyboard states.\n *\n * @returns An animated View component that sticks to the keyboard.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/components/keyboard-sticky-view|Documentation} page for more details.\n * @example\n * ```tsx\n * <KeyboardStickyView offset={{ closed: 0, opened: 20 }}>\n * <Button title=\"Submit\" />\n * </KeyboardStickyView>\n * ```\n */\nconst KeyboardStickyView = forwardRef<\n View,\n React.PropsWithChildren<KeyboardStickyViewProps>\n>(\n (\n {\n children,\n offset: { closed = 0, opened = 0 } = {},\n style,\n enabled = true,\n ...props\n },\n ref,\n ) => {\n const { height, progress } = useKeyboardAnimation();\n\n const offset = progress.interpolate({\n inputRange: [0, 1],\n outputRange: [closed, opened],\n });\n\n const styles = useMemo(\n () => [\n {\n transform: [\n { translateY: enabled ? Animated.add(height, offset) : closed },\n ],\n },\n style,\n ],\n [closed, enabled, height, offset, style],\n );\n\n return (\n <Animated.View ref={ref} style={styles} {...props}>\n {children}\n </Animated.View>\n );\n },\n);\n\nexport default KeyboardStickyView;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,OAAO,QAAQ,OAAO;AAClD,SAASC,QAAQ,QAAQ,cAAc;AAEvC,SAASC,oBAAoB,QAAQ,aAAa;AAuBlD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,kBAAkB,gBAAGJ,UAAU,CAInC,CACE;EACEK,QAAQ;EACRC,MAAM,EAAE;IAAEC,MAAM,GAAG,CAAC;IAAEC,MAAM,GAAG;EAAE,CAAC,GAAG,CAAC,CAAC;EACvCC,KAAK;EACLC,OAAO,GAAG,IAAI;EACd,GAAGC;AACL,CAAC,EACDC,GAAG,KACA;EACH,MAAM;IAAEC,MAAM;IAAEC;EAAS,CAAC,GAAGX,oBAAoB,CAAC,CAAC;EAEnD,MAAMG,MAAM,GAAGQ,QAAQ,CAACC,WAAW,CAAC;IAClCC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAClBC,WAAW,EAAE,CAACV,MAAM,EAAEC,MAAM;EAC9B,CAAC,CAAC;EAEF,MAAMU,MAAM,GAAGjB,OAAO,CACpB,MAAM,CACJ;IACEkB,SAAS,EAAE,CACT;MAAEC,UAAU,EAAEV,OAAO,GAAGR,QAAQ,CAACmB,GAAG,CAACR,MAAM,EAAEP,MAAM,CAAC,GAAGC;IAAO,CAAC;EAEnE,CAAC,EACDE,KAAK,CACN,EACD,CAACF,MAAM,EAAEG,OAAO,EAAEG,MAAM,EAAEP,MAAM,EAAEG,KAAK,CACzC,CAAC;EAED,oBACEV,KAAA,CAAAuB,aAAA,CAACpB,QAAQ,CAACqB,IAAI,EAAAC,QAAA;IAACZ,GAAG,EAAEA,GAAI;IAACH,KAAK,EAAES;EAAO,GAAKP,KAAK,GAC9CN,QACY,CAAC;AAEpB,CACF,CAAC;AAED,eAAeD,kBAAkB","ignoreList":[]}
1
+ {"version":3,"names":["React","forwardRef","useMemo","Animated","useKeyboardAnimation","KeyboardStickyView","children","offset","closed","opened","style","enabled","props","ref","height","progress","interpolate","inputRange","outputRange","styles","disabled","add","multiply","active","transform","translateY","createElement","View","_extends"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef, useMemo } from \"react\";\nimport { Animated } from \"react-native\";\n\nimport { useKeyboardAnimation } from \"../../hooks\";\n\nimport type { View, ViewProps } from \"react-native\";\n\nexport type KeyboardStickyViewProps = {\n /**\n * Specify additional offset to the view for given keyboard state.\n */\n offset?: {\n /**\n * Adds additional `translateY` when keyboard is close. By default `0`.\n */\n closed?: number;\n /**\n * Adds additional `translateY` when keyboard is open. By default `0`.\n */\n opened?: number;\n };\n\n /** Controls whether this `KeyboardStickyView` instance should take effect. Default is `true`. */\n enabled?: boolean;\n} & ViewProps;\n\n/**\n * A View component that sticks to the keyboard and moves with it when it appears or disappears.\n * The view can be configured with custom offsets for both closed and open keyboard states.\n *\n * @returns An animated View component that sticks to the keyboard.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/components/keyboard-sticky-view|Documentation} page for more details.\n * @example\n * ```tsx\n * <KeyboardStickyView offset={{ closed: 0, opened: 20 }}>\n * <Button title=\"Submit\" />\n * </KeyboardStickyView>\n * ```\n */\nconst KeyboardStickyView = forwardRef<\n View,\n React.PropsWithChildren<KeyboardStickyViewProps>\n>(\n (\n {\n children,\n offset: { closed = 0, opened = 0 } = {},\n style,\n enabled = true,\n ...props\n },\n ref,\n ) => {\n const { height, progress } = useKeyboardAnimation();\n\n const offset = progress.interpolate({\n inputRange: [0, 1],\n outputRange: [closed, opened],\n });\n\n const styles = useMemo(() => {\n const disabled = Animated.add(Animated.multiply(height, 0), closed);\n const active = Animated.add(height, offset);\n\n return [\n {\n transform: [{ translateY: enabled ? active : disabled }],\n },\n style,\n ];\n }, [closed, enabled, height, offset, style]);\n\n return (\n <Animated.View ref={ref} style={styles} {...props}>\n {children}\n </Animated.View>\n );\n },\n);\n\nexport default KeyboardStickyView;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,OAAO,QAAQ,OAAO;AAClD,SAASC,QAAQ,QAAQ,cAAc;AAEvC,SAASC,oBAAoB,QAAQ,aAAa;AAuBlD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,kBAAkB,gBAAGJ,UAAU,CAInC,CACE;EACEK,QAAQ;EACRC,MAAM,EAAE;IAAEC,MAAM,GAAG,CAAC;IAAEC,MAAM,GAAG;EAAE,CAAC,GAAG,CAAC,CAAC;EACvCC,KAAK;EACLC,OAAO,GAAG,IAAI;EACd,GAAGC;AACL,CAAC,EACDC,GAAG,KACA;EACH,MAAM;IAAEC,MAAM;IAAEC;EAAS,CAAC,GAAGX,oBAAoB,CAAC,CAAC;EAEnD,MAAMG,MAAM,GAAGQ,QAAQ,CAACC,WAAW,CAAC;IAClCC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAClBC,WAAW,EAAE,CAACV,MAAM,EAAEC,MAAM;EAC9B,CAAC,CAAC;EAEF,MAAMU,MAAM,GAAGjB,OAAO,CAAC,MAAM;IAC3B,MAAMkB,QAAQ,GAAGjB,QAAQ,CAACkB,GAAG,CAAClB,QAAQ,CAACmB,QAAQ,CAACR,MAAM,EAAE,CAAC,CAAC,EAAEN,MAAM,CAAC;IACnE,MAAMe,MAAM,GAAGpB,QAAQ,CAACkB,GAAG,CAACP,MAAM,EAAEP,MAAM,CAAC;IAE3C,OAAO,CACL;MACEiB,SAAS,EAAE,CAAC;QAAEC,UAAU,EAAEd,OAAO,GAAGY,MAAM,GAAGH;MAAS,CAAC;IACzD,CAAC,EACDV,KAAK,CACN;EACH,CAAC,EAAE,CAACF,MAAM,EAAEG,OAAO,EAAEG,MAAM,EAAEP,MAAM,EAAEG,KAAK,CAAC,CAAC;EAE5C,oBACEV,KAAA,CAAA0B,aAAA,CAACvB,QAAQ,CAACwB,IAAI,EAAAC,QAAA;IAACf,GAAG,EAAEA,GAAI;IAACH,KAAK,EAAES;EAAO,GAAKP,KAAK,GAC9CN,QACY,CAAC;AAEpB,CACF,CAAC;AAED,eAAeD,kBAAkB","ignoreList":[]}
@@ -1,35 +1,68 @@
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 } from "react";
3
- import { Platform } from "react-native";
3
+ import { Platform, View } from "react-native";
4
4
  import Reanimated, { useAnimatedProps } from "react-native-reanimated";
5
5
  import { ClippingScrollView } from "../../bindings";
6
6
  import styles from "./styles";
7
- const ReanimatedClippingScrollView = Platform.OS === "android" ? Reanimated.createAnimatedComponent(ClippingScrollView) : ClippingScrollView;
7
+ const OS = Platform.OS;
8
+ const ReanimatedClippingScrollView = OS === "android" ? Reanimated.createAnimatedComponent(ClippingScrollView) : ClippingScrollView;
8
9
  const ScrollViewWithBottomPadding = /*#__PURE__*/forwardRef(({
9
10
  ScrollViewComponent,
10
11
  bottomPadding,
11
12
  contentInset,
13
+ scrollIndicatorInsets,
14
+ inverted,
15
+ contentOffsetY,
12
16
  children,
13
17
  ...rest
14
18
  }, ref) => {
15
- const animatedProps = useAnimatedProps(() => ({
16
- // iOS prop
17
- contentInset: {
18
- bottom: bottomPadding.value + ((contentInset === null || contentInset === void 0 ? void 0 : contentInset.bottom) || 0),
19
- top: contentInset === null || contentInset === void 0 ? void 0 : contentInset.top,
20
- right: contentInset === null || contentInset === void 0 ? void 0 : contentInset.right,
21
- left: contentInset === null || contentInset === void 0 ? void 0 : contentInset.left
22
- },
23
- // Android prop
24
- contentInsetBottom: bottomPadding.value
25
- }), [contentInset === null || contentInset === void 0 ? void 0 : contentInset.bottom, contentInset === null || contentInset === void 0 ? void 0 : contentInset.top, contentInset === null || contentInset === void 0 ? void 0 : contentInset.right, contentInset === null || contentInset === void 0 ? void 0 : contentInset.left]);
19
+ const animatedProps = useAnimatedProps(() => {
20
+ const insetTop = inverted ? bottomPadding.value : 0;
21
+ const insetBottom = !inverted ? bottomPadding.value : 0;
22
+ const bottom = insetBottom + ((contentInset === null || contentInset === void 0 ? void 0 : contentInset.bottom) || 0);
23
+ const top = insetTop + ((contentInset === null || contentInset === void 0 ? void 0 : contentInset.top) || 0);
24
+ const result = {
25
+ // iOS prop
26
+ contentInset: {
27
+ bottom: bottom,
28
+ top: top,
29
+ right: contentInset === null || contentInset === void 0 ? void 0 : contentInset.right,
30
+ left: contentInset === null || contentInset === void 0 ? void 0 : contentInset.left
31
+ },
32
+ scrollIndicatorInsets: {
33
+ bottom: bottom,
34
+ top: top,
35
+ right: scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.right,
36
+ left: scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.left
37
+ },
38
+ // Android prop
39
+ contentInsetBottom: insetBottom,
40
+ contentInsetTop: insetTop
41
+ };
42
+ if (contentOffsetY) {
43
+ result.contentOffset = {
44
+ x: 0,
45
+ y: contentOffsetY.value
46
+ };
47
+ }
48
+ return result;
49
+ }, [contentInset === null || contentInset === void 0 ? void 0 : contentInset.bottom, contentInset === null || contentInset === void 0 ? void 0 : contentInset.top, contentInset === null || contentInset === void 0 ? void 0 : contentInset.right, contentInset === null || contentInset === void 0 ? void 0 : contentInset.left, scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.bottom, scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.top, scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.right, scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.left, inverted, contentOffsetY]);
26
50
  return /*#__PURE__*/React.createElement(ReanimatedClippingScrollView, {
27
51
  animatedProps: animatedProps,
28
52
  style: styles.container
29
53
  }, /*#__PURE__*/React.createElement(ScrollViewComponent, _extends({
30
54
  ref: ref,
31
55
  animatedProps: animatedProps
32
- }, rest), children));
56
+ }, rest), inverted ?
57
+ /*#__PURE__*/
58
+ // The only thing it can break is `StickyHeader`, but it's already broken in FlatList and other lists
59
+ // don't support this functionality, so we can add additional view here
60
+ // The correct fix would be to add a new prop in ScrollView that allows
61
+ // to customize children extraction logic and skip custom view
62
+ React.createElement(View, {
63
+ collapsable: false,
64
+ nativeID: "container"
65
+ }, children) : children));
33
66
  });
34
67
  export default ScrollViewWithBottomPadding;
35
68
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","forwardRef","Platform","Reanimated","useAnimatedProps","ClippingScrollView","styles","ReanimatedClippingScrollView","OS","createAnimatedComponent","ScrollViewWithBottomPadding","ScrollViewComponent","bottomPadding","contentInset","children","rest","ref","animatedProps","bottom","value","top","right","left","contentInsetBottom","createElement","style","container","_extends"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef } from \"react\";\nimport { Platform } from \"react-native\";\nimport Reanimated, { useAnimatedProps } from \"react-native-reanimated\";\n\nimport { ClippingScrollView } from \"../../bindings\";\n\nimport styles from \"./styles\";\n\nimport type { ScrollViewProps } from \"react-native\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nconst ReanimatedClippingScrollView =\n Platform.OS === \"android\"\n ? Reanimated.createAnimatedComponent(ClippingScrollView)\n : ClippingScrollView;\n\ntype AnimatedScrollViewProps = React.ComponentProps<\n typeof Reanimated.ScrollView\n>;\n\nexport type AnimatedScrollViewComponent = React.ForwardRefExoticComponent<\n AnimatedScrollViewProps & React.RefAttributes<Reanimated.ScrollView>\n>;\n\ntype ScrollViewWithBottomPaddingProps = {\n ScrollViewComponent: AnimatedScrollViewComponent;\n children?: React.ReactNode;\n bottomPadding: SharedValue<number>;\n} & ScrollViewProps;\n\nconst ScrollViewWithBottomPadding = forwardRef<\n Reanimated.ScrollView,\n ScrollViewWithBottomPaddingProps\n>(\n (\n { ScrollViewComponent, bottomPadding, contentInset, children, ...rest },\n ref,\n ) => {\n const animatedProps = useAnimatedProps(\n () => ({\n // iOS prop\n contentInset: {\n bottom: bottomPadding.value + (contentInset?.bottom || 0),\n top: contentInset?.top,\n right: contentInset?.right,\n left: contentInset?.left,\n },\n // Android prop\n contentInsetBottom: bottomPadding.value,\n }),\n [\n contentInset?.bottom,\n contentInset?.top,\n contentInset?.right,\n contentInset?.left,\n ],\n );\n\n return (\n <ReanimatedClippingScrollView\n animatedProps={animatedProps}\n style={styles.container}\n >\n <ScrollViewComponent ref={ref} animatedProps={animatedProps} {...rest}>\n {children}\n </ScrollViewComponent>\n </ReanimatedClippingScrollView>\n );\n },\n);\n\nexport default ScrollViewWithBottomPadding;\n"],"mappings":";AAAA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7BQ,KAAK,EAAEnB,MAAM,CAACoB;EAAU,gBAExB1B,KAAA,CAAAwB,aAAA,CAACb,mBAAmB,EAAAgB,QAAA;IAACX,GAAG,EAAEA,GAAI;IAACC,aAAa,EAAEA;EAAc,GAAKF,IAAI,GAClED,QACkB,CACO,CAAC;AAEnC,CACF,CAAC;AAED,eAAeJ,2BAA2B","ignoreList":[]}
1
+ {"version":3,"names":["React","forwardRef","Platform","View","Reanimated","useAnimatedProps","ClippingScrollView","styles","OS","ReanimatedClippingScrollView","createAnimatedComponent","ScrollViewWithBottomPadding","ScrollViewComponent","bottomPadding","contentInset","scrollIndicatorInsets","inverted","contentOffsetY","children","rest","ref","animatedProps","insetTop","value","insetBottom","bottom","top","result","right","left","contentInsetBottom","contentInsetTop","contentOffset","x","y","createElement","style","container","_extends","collapsable","nativeID"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef } from \"react\";\nimport { Platform, View } from \"react-native\";\nimport Reanimated, { useAnimatedProps } from \"react-native-reanimated\";\n\nimport { ClippingScrollView } from \"../../bindings\";\n\nimport styles from \"./styles\";\n\nimport type { ScrollViewProps } from \"react-native\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nconst OS = Platform.OS;\nconst ReanimatedClippingScrollView =\n OS === \"android\"\n ? Reanimated.createAnimatedComponent(ClippingScrollView)\n : ClippingScrollView;\n\ntype AnimatedScrollViewProps = React.ComponentProps<\n typeof Reanimated.ScrollView\n>;\n\nexport type AnimatedScrollViewComponent = React.ForwardRefExoticComponent<\n AnimatedScrollViewProps & React.RefAttributes<Reanimated.ScrollView>\n>;\n\ntype ScrollViewWithBottomPaddingProps = {\n ScrollViewComponent: AnimatedScrollViewComponent;\n children?: React.ReactNode;\n inverted?: boolean;\n bottomPadding: SharedValue<number>;\n /** Absolute Y content offset (iOS only, for KeyboardChatScrollView). */\n contentOffsetY?: SharedValue<number>;\n} & ScrollViewProps;\n\nconst ScrollViewWithBottomPadding = forwardRef<\n Reanimated.ScrollView,\n ScrollViewWithBottomPaddingProps\n>(\n (\n {\n ScrollViewComponent,\n bottomPadding,\n contentInset,\n scrollIndicatorInsets,\n inverted,\n contentOffsetY,\n children,\n ...rest\n },\n ref,\n ) => {\n const animatedProps = useAnimatedProps(() => {\n const insetTop = inverted ? bottomPadding.value : 0;\n const insetBottom = !inverted ? bottomPadding.value : 0;\n const bottom = insetBottom + (contentInset?.bottom || 0);\n const top = insetTop + (contentInset?.top || 0);\n\n const result: Record<string, unknown> = {\n // iOS prop\n contentInset: {\n bottom: bottom,\n top: top,\n right: contentInset?.right,\n left: contentInset?.left,\n },\n scrollIndicatorInsets: {\n bottom: bottom,\n top: top,\n right: scrollIndicatorInsets?.right,\n left: scrollIndicatorInsets?.left,\n },\n // Android prop\n contentInsetBottom: insetBottom,\n contentInsetTop: insetTop,\n };\n\n if (contentOffsetY) {\n result.contentOffset = { x: 0, y: contentOffsetY.value };\n }\n\n return result;\n }, [\n contentInset?.bottom,\n contentInset?.top,\n contentInset?.right,\n contentInset?.left,\n scrollIndicatorInsets?.bottom,\n scrollIndicatorInsets?.top,\n scrollIndicatorInsets?.right,\n scrollIndicatorInsets?.left,\n inverted,\n contentOffsetY,\n ]);\n\n return (\n <ReanimatedClippingScrollView\n animatedProps={animatedProps}\n style={styles.container}\n >\n <ScrollViewComponent ref={ref} animatedProps={animatedProps} {...rest}>\n {inverted ? (\n // The only thing it can break is `StickyHeader`, but it's already broken in FlatList and other lists\n // don't support this functionality, so we can add additional view here\n // The correct fix would be to add a new prop in ScrollView that allows\n // to customize children extraction logic and skip custom view\n <View collapsable={false} nativeID=\"container\">\n {children}\n </View>\n ) : (\n children\n )}\n </ScrollViewComponent>\n </ReanimatedClippingScrollView>\n );\n },\n);\n\nexport default ScrollViewWithBottomPadding;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAASC,QAAQ,EAAEC,IAAI,QAAQ,cAAc;AAC7C,OAAOC,UAAU,IAAIC,gBAAgB,QAA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AEiB,CACO,CAAC;AAEnC,CACF,CAAC;AAED,eAAeP,2BAA2B","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { useEffect } from "react";
1
+ import { useCallback, useEffect } from "react";
2
2
  import { useEvent, useSharedValue } from "react-native-reanimated";
3
3
  import { useEventHandlerRegistration } from "../../internal";
4
4
  const NATIVE_SCROLL_EVENT_NAMES = ["onScroll", "onScrollBeginDrag", "onScrollEndDrag", "onMomentumScrollBegin", "onMomentumScrollEnd"];
@@ -27,10 +27,29 @@ const useScrollState = ref => {
27
27
  cleanup();
28
28
  };
29
29
  }, []);
30
+
31
+ // `onContentSizeChange` is synthesized in JS (from the content container's
32
+ // onLayout) and `onLayout` has a different payload shape than scroll events,
33
+ // so neither can be reliably captured via native event registration.
34
+ // Instead we expose callbacks for the consumer to attach as props.
35
+ const onLayout = useCallback(e => {
36
+ layout.value = {
37
+ width: e.nativeEvent.layout.width,
38
+ height: e.nativeEvent.layout.height
39
+ };
40
+ }, [layout]);
41
+ const onContentSizeChange = useCallback((w, h) => {
42
+ size.value = {
43
+ width: w,
44
+ height: h
45
+ };
46
+ }, [size]);
30
47
  return {
31
48
  offset,
32
49
  layout,
33
- size
50
+ size,
51
+ onLayout,
52
+ onContentSizeChange
34
53
  };
35
54
  };
36
55
  export default useScrollState;
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","useEvent","useSharedValue","useEventHandlerRegistration","NATIVE_SCROLL_EVENT_NAMES","useScrollState","ref","offset","layout","width","height","size","register","eventHandler","event","value","contentOffset","y","layoutMeasurement","contentSize","cleanup"],"sources":["useScrollState.ts"],"sourcesContent":["import { useEffect } from \"react\";\nimport { useEvent, useSharedValue } from \"react-native-reanimated\";\n\nimport { useEventHandlerRegistration } from \"../../internal\";\n\nimport type { AnimatedRef } from \"react-native-reanimated\";\nimport type Reanimated from \"react-native-reanimated\";\n\nconst NATIVE_SCROLL_EVENT_NAMES = [\n \"onScroll\",\n \"onScrollBeginDrag\",\n \"onScrollEndDrag\",\n \"onMomentumScrollBegin\",\n \"onMomentumScrollEnd\",\n];\n\ntype ScrollEvent = {\n contentOffset: {\n x: number;\n y: number;\n };\n layoutMeasurement: {\n width: number;\n height: number;\n };\n contentSize: {\n width: number;\n height: number;\n };\n};\n\nconst useScrollState = (ref: AnimatedRef<Reanimated.ScrollView>) => {\n const offset = useSharedValue(0);\n const layout = useSharedValue({ width: 0, height: 0 });\n const size = useSharedValue({ width: 0, height: 0 });\n\n const register = useEventHandlerRegistration(ref);\n\n const eventHandler = useEvent((event: ScrollEvent) => {\n \"worklet\";\n\n // eslint-disable-next-line react-compiler/react-compiler\n offset.value = event.contentOffset.y;\n layout.value = event.layoutMeasurement;\n size.value = event.contentSize;\n }, NATIVE_SCROLL_EVENT_NAMES);\n\n useEffect(() => {\n const cleanup = register(eventHandler);\n\n return () => {\n cleanup();\n };\n }, []);\n\n return { offset, layout, size };\n};\n\nexport default useScrollState;\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,QAAQ,EAAEC,cAAc,QAAQ,yBAAyB;AAElE,SAASC,2BAA2B,QAAQ,gBAAgB;AAK5D,MAAMC,yBAAyB,GAAG,CAChC,UAAU,EACV,mBAAmB,EACnB,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,CACtB;AAiBD,MAAMC,cAAc,GAAIC,GAAuC,IAAK;EAClE,MAAMC,MAAM,GAAGL,cAAc,CAAC,CAAC,CAAC;EAChC,MAAMM,MAAM,GAAGN,cAAc,CAAC;IAAEO,KAAK,EAAE,CAAC;IAAEC,MAAM,EAAE;EAAE,CAAC,CAAC;EACtD,MAAMC,IAAI,GAAGT,cAAc,CAAC;IAAEO,KAAK,EAAE,CAAC;IAAEC,MAAM,EAAE;EAAE,CAAC,CAAC;EAEpD,MAAME,QAAQ,GAAGT,2BAA2B,CAACG,GAAG,CAAC;EAEjD,MAAMO,YAAY,GAAGZ,QAAQ,CAAEa,KAAkB,IAAK;IACpD,SAAS;;IAET;IACAP,MAAM,CAACQ,KAAK,GAAGD,KAAK,CAACE,aAAa,CAACC,CAAC;IACpCT,MAAM,CAACO,KAAK,GAAGD,KAAK,CAACI,iBAAiB;IACtCP,IAAI,CAACI,KAAK,GAAGD,KAAK,CAACK,WAAW;EAChC,CAAC,EAAEf,yBAAyB,CAAC;EAE7BJ,SAAS,CAAC,MAAM;IACd,MAAMoB,OAAO,GAAGR,QAAQ,CAACC,YAAY,CAAC;IAEtC,OAAO,MAAM;MACXO,OAAO,CAAC,CAAC;IACX,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IAAEb,MAAM;IAAEC,MAAM;IAAEG;EAAK,CAAC;AACjC,CAAC;AAED,eAAeN,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["useCallback","useEffect","useEvent","useSharedValue","useEventHandlerRegistration","NATIVE_SCROLL_EVENT_NAMES","useScrollState","ref","offset","layout","width","height","size","register","eventHandler","event","value","contentOffset","y","layoutMeasurement","contentSize","cleanup","onLayout","e","nativeEvent","onContentSizeChange","w","h"],"sources":["useScrollState.ts"],"sourcesContent":["import { useCallback, useEffect } from \"react\";\nimport { useEvent, useSharedValue } from \"react-native-reanimated\";\n\nimport { useEventHandlerRegistration } from \"../../internal\";\n\nimport type { LayoutChangeEvent } from \"react-native\";\nimport type { AnimatedRef } from \"react-native-reanimated\";\nimport type Reanimated from \"react-native-reanimated\";\n\nconst NATIVE_SCROLL_EVENT_NAMES = [\n \"onScroll\",\n \"onScrollBeginDrag\",\n \"onScrollEndDrag\",\n \"onMomentumScrollBegin\",\n \"onMomentumScrollEnd\",\n];\n\ntype ScrollEvent = {\n contentOffset: {\n x: number;\n y: number;\n };\n layoutMeasurement: {\n width: number;\n height: number;\n };\n contentSize: {\n width: number;\n height: number;\n };\n};\n\nconst useScrollState = (ref: AnimatedRef<Reanimated.ScrollView>) => {\n const offset = useSharedValue(0);\n const layout = useSharedValue({ width: 0, height: 0 });\n const size = useSharedValue({ width: 0, height: 0 });\n\n const register = useEventHandlerRegistration(ref);\n\n const eventHandler = useEvent((event: ScrollEvent) => {\n \"worklet\";\n\n // eslint-disable-next-line react-compiler/react-compiler\n offset.value = event.contentOffset.y;\n layout.value = event.layoutMeasurement;\n size.value = event.contentSize;\n }, NATIVE_SCROLL_EVENT_NAMES);\n\n useEffect(() => {\n const cleanup = register(eventHandler);\n\n return () => {\n cleanup();\n };\n }, []);\n\n // `onContentSizeChange` is synthesized in JS (from the content container's\n // onLayout) and `onLayout` has a different payload shape than scroll events,\n // so neither can be reliably captured via native event registration.\n // Instead we expose callbacks for the consumer to attach as props.\n const onLayout = useCallback(\n (e: LayoutChangeEvent) => {\n layout.value = {\n width: e.nativeEvent.layout.width,\n height: e.nativeEvent.layout.height,\n };\n },\n [layout],\n );\n\n const onContentSizeChange = useCallback(\n (w: number, h: number) => {\n size.value = { width: w, height: h };\n },\n [size],\n );\n\n return { offset, layout, size, onLayout, onContentSizeChange };\n};\n\nexport default useScrollState;\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,SAAS,QAAQ,OAAO;AAC9C,SAASC,QAAQ,EAAEC,cAAc,QAAQ,yBAAyB;AAElE,SAASC,2BAA2B,QAAQ,gBAAgB;AAM5D,MAAMC,yBAAyB,GAAG,CAChC,UAAU,EACV,mBAAmB,EACnB,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,CACtB;AAiBD,MAAMC,cAAc,GAAIC,GAAuC,IAAK;EAClE,MAAMC,MAAM,GAAGL,cAAc,CAAC,CAAC,CAAC;EAChC,MAAMM,MAAM,GAAGN,cAAc,CAAC;IAAEO,KAAK,EAAE,CAAC;IAAEC,MAAM,EAAE;EAAE,CAAC,CAAC;EACtD,MAAMC,IAAI,GAAGT,cAAc,CAAC;IAAEO,KAAK,EAAE,CAAC;IAAEC,MAAM,EAAE;EAAE,CAAC,CAAC;EAEpD,MAAME,QAAQ,GAAGT,2BAA2B,CAACG,GAAG,CAAC;EAEjD,MAAMO,YAAY,GAAGZ,QAAQ,CAAEa,KAAkB,IAAK;IACpD,SAAS;;IAET;IACAP,MAAM,CAACQ,KAAK,GAAGD,KAAK,CAACE,aAAa,CAACC,CAAC;IACpCT,MAAM,CAACO,KAAK,GAAGD,KAAK,CAACI,iBAAiB;IACtCP,IAAI,CAACI,KAAK,GAAGD,KAAK,CAACK,WAAW;EAChC,CAAC,EAAEf,yBAAyB,CAAC;EAE7BJ,SAAS,CAAC,MAAM;IACd,MAAMoB,OAAO,GAAGR,QAAQ,CAACC,YAAY,CAAC;IAEtC,OAAO,MAAM;MACXO,OAAO,CAAC,CAAC;IACX,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;;EAEN;EACA;EACA;EACA;EACA,MAAMC,QAAQ,GAAGtB,WAAW,CACzBuB,CAAoB,IAAK;IACxBd,MAAM,CAACO,KAAK,GAAG;MACbN,KAAK,EAAEa,CAAC,CAACC,WAAW,CAACf,MAAM,CAACC,KAAK;MACjCC,MAAM,EAAEY,CAAC,CAACC,WAAW,CAACf,MAAM,CAACE;IAC/B,CAAC;EACH,CAAC,EACD,CAACF,MAAM,CACT,CAAC;EAED,MAAMgB,mBAAmB,GAAGzB,WAAW,CACrC,CAAC0B,CAAS,EAAEC,CAAS,KAAK;IACxBf,IAAI,CAACI,KAAK,GAAG;MAAEN,KAAK,EAAEgB,CAAC;MAAEf,MAAM,EAAEgB;IAAE,CAAC;EACtC,CAAC,EACD,CAACf,IAAI,CACP,CAAC;EAED,OAAO;IAAEJ,MAAM;IAAEC,MAAM;IAAEG,IAAI;IAAEU,QAAQ;IAAEG;EAAoB,CAAC;AAChE,CAAC;AAED,eAAenB,cAAc","ignoreList":[]}
@@ -2,4 +2,5 @@ export { default as KeyboardAvoidingView } from "./KeyboardAvoidingView";
2
2
  export { default as KeyboardStickyView } from "./KeyboardStickyView";
3
3
  export { default as KeyboardAwareScrollView } from "./KeyboardAwareScrollView";
4
4
  export { default as KeyboardToolbar, DefaultKeyboardToolbarTheme } from "./KeyboardToolbar";
5
+ export { default as KeyboardChatScrollView } from "./KeyboardChatScrollView";
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["default","KeyboardAvoidingView","KeyboardStickyView","KeyboardAwareScrollView","KeyboardToolbar","DefaultKeyboardToolbarTheme"],"sources":["index.ts"],"sourcesContent":["export { default as KeyboardAvoidingView } from \"./KeyboardAvoidingView\";\nexport { default as KeyboardStickyView } from \"./KeyboardStickyView\";\nexport { default as KeyboardAwareScrollView } from \"./KeyboardAwareScrollView\";\nexport {\n default as KeyboardToolbar,\n DefaultKeyboardToolbarTheme,\n} from \"./KeyboardToolbar\";\nexport type { KeyboardAvoidingViewProps } from \"./KeyboardAvoidingView\";\nexport type { KeyboardStickyViewProps } from \"./KeyboardStickyView\";\nexport type {\n KeyboardAwareScrollViewProps,\n KeyboardAwareScrollViewRef,\n} from \"./KeyboardAwareScrollView\";\nexport type { KeyboardToolbarProps } from \"./KeyboardToolbar\";\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,oBAAoB,QAAQ,wBAAwB;AACxE,SAASD,OAAO,IAAIE,kBAAkB,QAAQ,sBAAsB;AACpE,SAASF,OAAO,IAAIG,uBAAuB,QAAQ,2BAA2B;AAC9E,SACEH,OAAO,IAAII,eAAe,EAC1BC,2BAA2B,QACtB,mBAAmB","ignoreList":[]}
1
+ {"version":3,"names":["default","KeyboardAvoidingView","KeyboardStickyView","KeyboardAwareScrollView","KeyboardToolbar","DefaultKeyboardToolbarTheme","KeyboardChatScrollView"],"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,SAASA,OAAO,IAAIC,oBAAoB,QAAQ,wBAAwB;AACxE,SAASD,OAAO,IAAIE,kBAAkB,QAAQ,sBAAsB;AACpE,SAASF,OAAO,IAAIG,uBAAuB,QAAQ,2BAA2B;AAC9E,SACEH,OAAO,IAAII,eAAe,EAC1BC,2BAA2B,QACtB,mBAAmB;AAC1B,SAASL,OAAO,IAAIM,sBAAsB,QAAQ,0BAA0B","ignoreList":[]}
@@ -6,7 +6,7 @@ export * from "./constants";
6
6
  export * from "./module";
7
7
  export * from "./types";
8
8
  export * from "./compat";
9
- export { KeyboardAvoidingView, KeyboardStickyView, KeyboardAwareScrollView,
9
+ export { KeyboardChatScrollView, KeyboardAvoidingView, KeyboardStickyView, KeyboardAwareScrollView,
10
10
  // keyboard toolbar
11
11
  KeyboardToolbar, DefaultKeyboardToolbarTheme } from "./components";
12
12
  export { OverKeyboardView, KeyboardExtender } from "./views";