Open History to see the last commit
1diff --git a/lib/commonjs/components/KeyboardChatScrollView/index.js b/lib/commonjs/components/KeyboardChatScrollView/index.js
2index 5617394..4f2222a 100644
3--- a/lib/commonjs/components/KeyboardChatScrollView/index.js
4+++ b/lib/commonjs/components/KeyboardChatScrollView/index.js
5@@ -27,9 +27,12 @@ const KeyboardChatScrollView = /*#__PURE__*/(0, _react.forwardRef)(({
6 offset = 0,
7 extraContentPadding = ZERO_CONTENT_PADDING,
8 blankSpace = ZERO_BLANK_SPACE,
9+ adjustedInsetCompensation = 0,
10+ adjustedStartInsetCompensation = 0,
11 applyWorkaroundForContentInsetHitTestBug = false,
12 onLayout: onLayoutProp,
13 onContentSizeChange: onContentSizeChangeProp,
14+ onContentInsetChange,
15 onEndVisible,
16 ...rest
17 }, ref) => {
18@@ -51,13 +54,17 @@ const KeyboardChatScrollView = /*#__PURE__*/(0, _react.forwardRef)(({
19 freeze: freezeSV,
20 offset,
21 blankSpace,
22- extraContentPadding
23+ extraContentPadding,
24+ adjustedInsetCompensation,
25+ adjustedStartInsetCompensation
26 });
27 (0, _useExtraContentPadding.useExtraContentPadding)({
28 scrollViewRef,
29 extraContentPadding,
30 keyboardPadding: padding,
31 blankSpace,
32+ adjustedInsetCompensation,
33+ adjustedStartInsetCompensation,
34 scroll,
35 layout,
36 size,
37@@ -88,10 +95,26 @@ const KeyboardChatScrollView = /*#__PURE__*/(0, _react.forwardRef)(({
38 // a bug for you, please open an issue.
39 const totalPadding = (0, _reactNativeReanimated.useDerivedValue)(() => Math.min(layout.value.height, Math.max(blankSpace.value, padding.value + extraContentPadding.value)));
41+ // iOS applies the destination contentInset and contentOffset together at
42+ // keyboard-animation start. Keep that native target behavior, but report
43+ // the presentation height so virtualized-list layout follows the keyboard.
44+ const reportedPadding = (0, _reactNativeReanimated.useDerivedValue)(() => _reactNative.Platform.OS === "ios" ? Math.min(layout.value.height, Math.max(blankSpace.value, currentHeight.value + extraContentPadding.value)) : totalPadding.value);
45+
46+ // Mirror the effective bottom padding (keyboard + composer + blank floor)
47+ // to the consumer - a virtualized list needs it in its own scroll math or
48+ // its end/maintain targets point at the under-the-keyboard resting offset.
49+ (0, _reactNativeReanimated.useAnimatedReaction)(() => reportedPadding.value, (current, previous) => {
50+ if (onContentInsetChange && current !== previous) {
51+ (0, _reactNativeReanimated.runOnJS)(onContentInsetChange)({
52+ bottom: current
53+ });
54+ }
55+ }, [onContentInsetChange]);
56+
57 // Scroll indicator inset = keyboard + extraContentPadding (excludes blankSpace).
58 // Apps that render into the unsafe area can supply a negative
59 // scrollIndicatorInsets adjustment at the application layer.
60- const indicatorPadding = (0, _reactNativeReanimated.useDerivedValue)(() => padding.value + extraContentPadding.value);
61+ const indicatorPadding = (0, _reactNativeReanimated.useDerivedValue)(() => padding.value);
62 const onLayout = (0, _react.useCallback)(e => {
63 onLayoutInternal(e);
64 onLayoutProp === null || onLayoutProp === void 0 || onLayoutProp(e);
65diff --git a/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/helpers.js b/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/helpers.js
66index 4d33b3f..6a787d3 100644
67--- a/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/helpers.js
68+++ b/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/helpers.js
69@@ -206,7 +206,7 @@ const clampedScrollTarget = (offsetBeforeScroll, keyboardHeight, contentHeight,
70 * ```
71 */
72 exports.clampedScrollTarget = clampedScrollTarget;
73-const computeIOSContentOffset = (relativeScroll, keyboardHeight, contentHeight, layoutHeight, inverted, totalPaddingForMaxScroll) => {
74+const computeIOSContentOffset = (relativeScroll, keyboardHeight, contentHeight, layoutHeight, inverted, totalPaddingForMaxScroll, startInsetCompensation = 0) => {
75 "worklet";
77 const paddingForMax = totalPaddingForMaxScroll !== undefined ? totalPaddingForMaxScroll : keyboardHeight;
78@@ -214,8 +214,9 @@ const computeIOSContentOffset = (relativeScroll, keyboardHeight, contentHeight,
79 const maxScroll = Math.max(contentHeight - layoutHeight, 0);
80 return Math.max(Math.min(relativeScroll - keyboardHeight, maxScroll), -paddingForMax);
81 }
82- const maxScroll = Math.max(contentHeight - layoutHeight + paddingForMax, 0);
83- return Math.min(Math.max(keyboardHeight + relativeScroll, 0), maxScroll);
84+ const minScroll = -startInsetCompensation;
85+ const maxScroll = Math.max(contentHeight - layoutHeight + paddingForMax, minScroll);
86+ return Math.min(Math.max(keyboardHeight + relativeScroll, minScroll), maxScroll);
87 };
88 exports.computeIOSContentOffset = computeIOSContentOffset;
89 //# sourceMappingURL=helpers.js.map
90\ No newline at end of file
91diff --git a/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js b/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js
92index cecee07..533a9e9 100644
93--- a/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js
94+++ b/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js
95@@ -32,7 +32,9 @@ function useChatKeyboard(scrollViewRef, options) {
96 freeze,
97 offset,
98 blankSpace,
99- extraContentPadding
100+ extraContentPadding,
101+ adjustedInsetCompensation,
102+ adjustedStartInsetCompensation
103 } = options;
104 const padding = (0, _reactNativeReanimated.useSharedValue)(0);
105 const currentHeight = (0, _reactNativeReanimated.useSharedValue)(0);
106@@ -59,6 +61,9 @@ function useChatKeyboard(scrollViewRef, options) {
107 targetKeyboardHeight.value = e.height;
108 }
109 const effective = (0, _helpers.getEffectiveHeight)(e.height, targetKeyboardHeight.value, offset);
110+ if (e.duration === 0) {
111+ currentHeight.value = effective;
112+ }
113 const atEnd = (0, _helpers.isScrollAtEnd)(scroll.value, layout.value.height, size.value.height, inverted);
115 // Scale minimum padding absorption by how much of it is visible.
116@@ -67,7 +72,7 @@ function useChatKeyboard(scrollViewRef, options) {
117 const visiblePadding = visibleFraction * blankSpace.value;
118 const minimumPaddingAbsorbed = Math.max(0, visiblePadding - extraContentPadding.value);
119 const scrollEffective = (0, _helpers.getScrollEffective)(effective, minimumPaddingAbsorbed);
120- const actualTotalPadding = Math.max(blankSpace.value, effective + extraContentPadding.value);
121+ const actualTotalPadding = Math.max(blankSpace.value, effective + extraContentPadding.value) + adjustedInsetCompensation;
123 // `onInteractive` owns the native scroll offset. When its final
124 // keyboardWillHide event arrives, consume the marker so this
125@@ -87,8 +92,8 @@ function useChatKeyboard(scrollViewRef, options) {
126 const maxScroll = Math.max(size.value.height - layout.value.height, 0);
127 contentOffsetY.value = Math.max(-actualTotalPadding, Math.min(scroll.value, maxScroll));
128 } else {
129- const maxScroll = Math.max(size.value.height - layout.value.height + actualTotalPadding, 0);
130- contentOffsetY.value = Math.max(0, Math.min(scroll.value, maxScroll));
131+ const maxScroll = Math.max(size.value.height - layout.value.height + actualTotalPadding, -adjustedStartInsetCompensation);
132+ contentOffsetY.value = Math.max(-adjustedStartInsetCompensation, Math.min(scroll.value, maxScroll));
133 }
134 return;
135 }
136@@ -102,8 +107,8 @@ function useChatKeyboard(scrollViewRef, options) {
137 const maxScroll = Math.max(size.value.height - layout.value.height, 0);
138 contentOffsetY.value = Math.max(-actualTotalPadding, Math.min(scroll.value, maxScroll));
139 } else {
140- const maxScroll = Math.max(size.value.height - layout.value.height + actualTotalPadding, 0);
141- contentOffsetY.value = Math.max(0, Math.min(scroll.value, maxScroll));
142+ const maxScroll = Math.max(size.value.height - layout.value.height + actualTotalPadding, -adjustedStartInsetCompensation);
143+ contentOffsetY.value = Math.max(-adjustedStartInsetCompensation, Math.min(scroll.value, maxScroll));
144 }
145 return;
146 }
147@@ -129,17 +134,25 @@ function useChatKeyboard(scrollViewRef, options) {
148 contentOffsetY.value = scroll.value;
149 return;
150 }
151- contentOffsetY.value = (0, _helpers.computeIOSContentOffset)(relativeScroll, scrollEffective, size.value.height, layout.value.height, inverted, actualTotalPadding);
152+ contentOffsetY.value = (0, _helpers.computeIOSContentOffset)(relativeScroll, scrollEffective, size.value.height, layout.value.height, inverted, actualTotalPadding, adjustedStartInsetCompensation);
153 },
154- onInteractive: () => {
155+ onMove: e => {
156 "worklet";
158- isInteractiveDismissal.value = true;
159+ if (freeze.value) {
160+ return;
161+ }
162+ currentHeight.value = (0, _helpers.getEffectiveHeight)(e.height, targetKeyboardHeight.value, offset);
163 },
164- onMove: () => {
165+ onInteractive: e => {
166 "worklet";
168- // iOS doesn't need per-frame updates (contentOffset handles it)
169+ isInteractiveDismissal.value = true;
170+
171+ if (freeze.value) {
172+ return;
173+ }
174+ currentHeight.value = (0, _helpers.getEffectiveHeight)(e.height, targetKeyboardHeight.value, offset);
175 },
176 onEnd: e => {
177 "worklet";
178@@ -148,9 +161,10 @@ function useChatKeyboard(scrollViewRef, options) {
179 return;
180 }
181 const effective = (0, _helpers.getEffectiveHeight)(e.height, targetKeyboardHeight.value, offset);
182+ currentHeight.value = effective;
183 padding.value = effective;
184 }
185- }, [inverted, keyboardLiftBehavior, offset, extraContentPadding]);
186+ }, [inverted, keyboardLiftBehavior, offset, extraContentPadding, adjustedInsetCompensation, adjustedStartInsetCompensation]);
187 return {
188 padding,
189 currentHeight,
190diff --git a/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js b/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js
191index 54a1c57..19b44fc 100644
192--- a/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js
193+++ b/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js
194@@ -31,6 +31,8 @@ function useExtraContentPadding(options) {
195 extraContentPadding,
196 keyboardPadding,
197 blankSpace,
198+ adjustedInsetCompensation,
199+ adjustedStartInsetCompensation,
200 scroll,
201 layout,
202 size,
203@@ -70,8 +72,8 @@ function useExtraContentPadding(options) {
204 }
206 // Compute effective delta considering blankSpace floor
207- const previousTotal = Math.max(blankSpace.value, keyboardPadding.value + previous);
208- const currentTotal = Math.max(blankSpace.value, keyboardPadding.value + current);
209+ const previousTotal = Math.max(blankSpace.value, keyboardPadding.value + previous) + adjustedInsetCompensation;
210+ const currentTotal = Math.max(blankSpace.value, keyboardPadding.value + current) + adjustedInsetCompensation;
211 const effectiveDelta = currentTotal - previousTotal;
212 if (effectiveDelta === 0) {
213 // blankSpace absorbed the change
214@@ -90,10 +92,11 @@ function useExtraContentPadding(options) {
215 const target = Math.max(scroll.value - effectiveDelta, -currentTotal);
216 scrollToTarget(target);
217 } else {
218- const maxScroll = Math.max(size.value.height - layout.value.height + currentTotal, 0);
219- const target = Math.min(scroll.value + effectiveDelta, maxScroll);
220+ const minScroll = -adjustedStartInsetCompensation;
221+ const maxScroll = Math.max(size.value.height - layout.value.height + currentTotal, minScroll);
222+ const target = Math.max(minScroll, Math.min(scroll.value + effectiveDelta, maxScroll));
223 scrollToTarget(target);
224 }
225- }, [inverted, keyboardLiftBehavior]);
226+ }, [inverted, keyboardLiftBehavior, adjustedInsetCompensation, adjustedStartInsetCompensation]);
227 }
228 //# sourceMappingURL=index.js.map
229\ No newline at end of file
230diff --git a/lib/module/components/KeyboardChatScrollView/index.js b/lib/module/components/KeyboardChatScrollView/index.js
231index d085394..a57c2f9 100644
232--- a/lib/module/components/KeyboardChatScrollView/index.js
233+++ b/lib/module/components/KeyboardChatScrollView/index.js
234@@ -1,7 +1,7 @@
235 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); }
236 import React, { forwardRef, useCallback, useMemo } from "react";
237-import { StyleSheet } from "react-native";
238-import { makeMutable, useAnimatedRef, useAnimatedStyle, useDerivedValue } from "react-native-reanimated";
239+import { Platform, StyleSheet } from "react-native";
240+import { makeMutable, runOnJS, useAnimatedReaction, useAnimatedRef, useAnimatedStyle, useDerivedValue } from "react-native-reanimated";
241 import Reanimated from "react-native-reanimated";
242 import useCombinedRef from "../hooks/useCombinedRef";
243 import ScrollViewWithBottomPadding from "../ScrollViewWithBottomPadding";
244@@ -20,9 +20,12 @@ const KeyboardChatScrollView = /*#__PURE__*/forwardRef(({
245 offset = 0,
246 extraContentPadding = ZERO_CONTENT_PADDING,
247 blankSpace = ZERO_BLANK_SPACE,
248+ adjustedInsetCompensation = 0,
249+ adjustedStartInsetCompensation = 0,
250 applyWorkaroundForContentInsetHitTestBug = false,
251 onLayout: onLayoutProp,
252 onContentSizeChange: onContentSizeChangeProp,
253+ onContentInsetChange,
254 onEndVisible,
255 ...rest
256 }, ref) => {
257@@ -44,13 +47,17 @@ const KeyboardChatScrollView = /*#__PURE__*/forwardRef(({
258 freeze: freezeSV,
259 offset,
260 blankSpace,
261- extraContentPadding
262+ extraContentPadding,
263+ adjustedInsetCompensation,
264+ adjustedStartInsetCompensation
265 });
266 useExtraContentPadding({
267 scrollViewRef,
268 extraContentPadding,
269 keyboardPadding: padding,
270 blankSpace,
271+ adjustedInsetCompensation,
272+ adjustedStartInsetCompensation,
273 scroll,
274 layout,
275 size,
276@@ -81,10 +88,26 @@ const KeyboardChatScrollView = /*#__PURE__*/forwardRef(({
277 // a bug for you, please open an issue.
278 const totalPadding = useDerivedValue(() => Math.min(layout.value.height, Math.max(blankSpace.value, padding.value + extraContentPadding.value)));
280+ // iOS applies the destination contentInset and contentOffset together at
281+ // keyboard-animation start. Keep that native target behavior, but report
282+ // the presentation height so virtualized-list layout follows the keyboard.
283+ const reportedPadding = useDerivedValue(() => Platform.OS === "ios" ? Math.min(layout.value.height, Math.max(blankSpace.value, currentHeight.value + extraContentPadding.value)) : totalPadding.value);
284+
285+ // Mirror the effective bottom padding (keyboard + composer + blank floor)
286+ // to the consumer - a virtualized list needs it in its own scroll math or
287+ // its end/maintain targets point at the under-the-keyboard resting offset.
288+ useAnimatedReaction(() => reportedPadding.value, (current, previous) => {
289+ if (onContentInsetChange && current !== previous) {
290+ runOnJS(onContentInsetChange)({
291+ bottom: current
292+ });
293+ }
294+ }, [onContentInsetChange]);
295+
296 // Scroll indicator inset = keyboard + extraContentPadding (excludes blankSpace).
297 // Apps that render into the unsafe area can supply a negative
298 // scrollIndicatorInsets adjustment at the application layer.
299- const indicatorPadding = useDerivedValue(() => padding.value + extraContentPadding.value);
300+ const indicatorPadding = useDerivedValue(() => padding.value);
301 const onLayout = useCallback(e => {
302 onLayoutInternal(e);
303 onLayoutProp === null || onLayoutProp === void 0 || onLayoutProp(e);
304diff --git a/lib/module/components/KeyboardChatScrollView/useChatKeyboard/helpers.js b/lib/module/components/KeyboardChatScrollView/useChatKeyboard/helpers.js
305index 295e221..2f7b87e 100644
306--- a/lib/module/components/KeyboardChatScrollView/useChatKeyboard/helpers.js
307+++ b/lib/module/components/KeyboardChatScrollView/useChatKeyboard/helpers.js
308@@ -193,7 +193,7 @@ export const clampedScrollTarget = (offsetBeforeScroll, keyboardHeight, contentH
309 * computeIOSContentOffset(100, 300, 1000, 800, false); // 400
310 * ```
311 */
312-export const computeIOSContentOffset = (relativeScroll, keyboardHeight, contentHeight, layoutHeight, inverted, totalPaddingForMaxScroll) => {
313+export const computeIOSContentOffset = (relativeScroll, keyboardHeight, contentHeight, layoutHeight, inverted, totalPaddingForMaxScroll, startInsetCompensation = 0) => {
314 "worklet";
316 const paddingForMax = totalPaddingForMaxScroll !== undefined ? totalPaddingForMaxScroll : keyboardHeight;
317@@ -201,7 +201,8 @@ export const computeIOSContentOffset = (relativeScroll, keyboardHeight, contentH
318 const maxScroll = Math.max(contentHeight - layoutHeight, 0);
319 return Math.max(Math.min(relativeScroll - keyboardHeight, maxScroll), -paddingForMax);
320 }
321- const maxScroll = Math.max(contentHeight - layoutHeight + paddingForMax, 0);
322- return Math.min(Math.max(keyboardHeight + relativeScroll, 0), maxScroll);
323+ const minScroll = -startInsetCompensation;
324+ const maxScroll = Math.max(contentHeight - layoutHeight + paddingForMax, minScroll);
325+ return Math.min(Math.max(keyboardHeight + relativeScroll, minScroll), maxScroll);
326 };
327 //# sourceMappingURL=helpers.js.map
328\ No newline at end of file
329diff --git a/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js b/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js
330index 407275d..19427d7 100644
331--- a/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js
332+++ b/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js
333@@ -25,7 +25,9 @@ function useChatKeyboard(scrollViewRef, options) {
334 freeze,
335 offset,
336 blankSpace,
337- extraContentPadding
338+ extraContentPadding,
339+ adjustedInsetCompensation,
340+ adjustedStartInsetCompensation
341 } = options;
342 const padding = useSharedValue(0);
343 const currentHeight = useSharedValue(0);
344@@ -52,6 +54,9 @@ function useChatKeyboard(scrollViewRef, options) {
345 targetKeyboardHeight.value = e.height;
346 }
347 const effective = getEffectiveHeight(e.height, targetKeyboardHeight.value, offset);
348+ if (e.duration === 0) {
349+ currentHeight.value = effective;
350+ }
351 const atEnd = isScrollAtEnd(scroll.value, layout.value.height, size.value.height, inverted);
353 // Scale minimum padding absorption by how much of it is visible.
354@@ -60,7 +65,7 @@ function useChatKeyboard(scrollViewRef, options) {
355 const visiblePadding = visibleFraction * blankSpace.value;
356 const minimumPaddingAbsorbed = Math.max(0, visiblePadding - extraContentPadding.value);
357 const scrollEffective = getScrollEffective(effective, minimumPaddingAbsorbed);
358- const actualTotalPadding = Math.max(blankSpace.value, effective + extraContentPadding.value);
359+ const actualTotalPadding = Math.max(blankSpace.value, effective + extraContentPadding.value) + adjustedInsetCompensation;
361 // `onInteractive` owns the native scroll offset. When its final
362 // keyboardWillHide event arrives, consume the marker so this
363@@ -80,8 +85,8 @@ function useChatKeyboard(scrollViewRef, options) {
364 const maxScroll = Math.max(size.value.height - layout.value.height, 0);
365 contentOffsetY.value = Math.max(-actualTotalPadding, Math.min(scroll.value, maxScroll));
366 } else {
367- const maxScroll = Math.max(size.value.height - layout.value.height + actualTotalPadding, 0);
368- contentOffsetY.value = Math.max(0, Math.min(scroll.value, maxScroll));
369+ const maxScroll = Math.max(size.value.height - layout.value.height + actualTotalPadding, -adjustedStartInsetCompensation);
370+ contentOffsetY.value = Math.max(-adjustedStartInsetCompensation, Math.min(scroll.value, maxScroll));
371 }
372 return;
373 }
374@@ -95,8 +100,8 @@ function useChatKeyboard(scrollViewRef, options) {
375 const maxScroll = Math.max(size.value.height - layout.value.height, 0);
376 contentOffsetY.value = Math.max(-actualTotalPadding, Math.min(scroll.value, maxScroll));
377 } else {
378- const maxScroll = Math.max(size.value.height - layout.value.height + actualTotalPadding, 0);
379- contentOffsetY.value = Math.max(0, Math.min(scroll.value, maxScroll));
380+ const maxScroll = Math.max(size.value.height - layout.value.height + actualTotalPadding, -adjustedStartInsetCompensation);
381+ contentOffsetY.value = Math.max(-adjustedStartInsetCompensation, Math.min(scroll.value, maxScroll));
382 }
383 return;
384 }
385@@ -122,17 +127,25 @@ function useChatKeyboard(scrollViewRef, options) {
386 contentOffsetY.value = scroll.value;
387 return;
388 }
389- contentOffsetY.value = computeIOSContentOffset(relativeScroll, scrollEffective, size.value.height, layout.value.height, inverted, actualTotalPadding);
390+ contentOffsetY.value = computeIOSContentOffset(relativeScroll, scrollEffective, size.value.height, layout.value.height, inverted, actualTotalPadding, adjustedStartInsetCompensation);
391 },
392- onInteractive: () => {
393+ onMove: e => {
394 "worklet";
396- isInteractiveDismissal.value = true;
397+ if (freeze.value) {
398+ return;
399+ }
400+ currentHeight.value = getEffectiveHeight(e.height, targetKeyboardHeight.value, offset);
401 },
402- onMove: () => {
403+ onInteractive: e => {
404 "worklet";
406- // iOS doesn't need per-frame updates (contentOffset handles it)
407+ isInteractiveDismissal.value = true;
408+
409+ if (freeze.value) {
410+ return;
411+ }
412+ currentHeight.value = getEffectiveHeight(e.height, targetKeyboardHeight.value, offset);
413 },
414 onEnd: e => {
415 "worklet";
416@@ -141,9 +154,10 @@ function useChatKeyboard(scrollViewRef, options) {
417 return;
418 }
419 const effective = getEffectiveHeight(e.height, targetKeyboardHeight.value, offset);
420+ currentHeight.value = effective;
421 padding.value = effective;
422 }
423- }, [inverted, keyboardLiftBehavior, offset, extraContentPadding]);
424+ }, [inverted, keyboardLiftBehavior, offset, extraContentPadding, adjustedInsetCompensation, adjustedStartInsetCompensation]);
425 return {
426 padding,
427 currentHeight,
428diff --git a/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js b/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js
429index 5885415..6e694fa 100644
430--- a/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js
431+++ b/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js
432@@ -25,6 +25,8 @@ function useExtraContentPadding(options) {
433 extraContentPadding,
434 keyboardPadding,
435 blankSpace,
436+ adjustedInsetCompensation,
437+ adjustedStartInsetCompensation,
438 scroll,
439 layout,
440 size,
441@@ -64,8 +66,8 @@ function useExtraContentPadding(options) {
442 }
444 // Compute effective delta considering blankSpace floor
445- const previousTotal = Math.max(blankSpace.value, keyboardPadding.value + previous);
446- const currentTotal = Math.max(blankSpace.value, keyboardPadding.value + current);
447+ const previousTotal = Math.max(blankSpace.value, keyboardPadding.value + previous) + adjustedInsetCompensation;
448+ const currentTotal = Math.max(blankSpace.value, keyboardPadding.value + current) + adjustedInsetCompensation;
449 const effectiveDelta = currentTotal - previousTotal;
450 if (effectiveDelta === 0) {
451 // blankSpace absorbed the change
452@@ -84,11 +86,12 @@ function useExtraContentPadding(options) {
453 const target = Math.max(scroll.value - effectiveDelta, -currentTotal);
454 scrollToTarget(target);
455 } else {
456- const maxScroll = Math.max(size.value.height - layout.value.height + currentTotal, 0);
457- const target = Math.min(scroll.value + effectiveDelta, maxScroll);
458+ const minScroll = -adjustedStartInsetCompensation;
459+ const maxScroll = Math.max(size.value.height - layout.value.height + currentTotal, minScroll);
460+ const target = Math.max(minScroll, Math.min(scroll.value + effectiveDelta, maxScroll));
461 scrollToTarget(target);
462 }
463- }, [inverted, keyboardLiftBehavior]);
464+ }, [inverted, keyboardLiftBehavior, adjustedInsetCompensation, adjustedStartInsetCompensation]);
465 }
466 export { useExtraContentPadding };
467 //# sourceMappingURL=index.js.map
468\ No newline at end of file
469diff --git a/lib/typescript/components/KeyboardChatScrollView/types.d.ts b/lib/typescript/components/KeyboardChatScrollView/types.d.ts
470index eba1514..6597d80 100644
471--- a/lib/typescript/components/KeyboardChatScrollView/types.d.ts
472+++ b/lib/typescript/components/KeyboardChatScrollView/types.d.ts
473@@ -88,6 +88,10 @@ export type KeyboardChatScrollViewProps = {
474 * Default is `undefined` (equivalent to `0` — no minimum floor).
475 */
476 blankSpace?: SharedValue<number>;
477+ /** Extra bottom inset UIKit adds beyond the raw contentInset (safe area). Offset math only. */
478+ adjustedInsetCompensation?: number;
479+ /** Leading inset UIKit adds outside raw contentInset. Offset math only. */
480+ adjustedStartInsetCompensation?: number;
481 /**
482 * Fires whenever the effective content inset changes — the static `contentInset`
483 * prop combined with the dynamic keyboard-driven padding.
484diff --git a/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/helpers.d.ts b/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/helpers.d.ts
485index 2b51cc4..3acec1f 100644
486--- a/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/helpers.d.ts
487+++ b/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/helpers.d.ts
488@@ -129,4 +129,4 @@ export declare const clampedScrollTarget: (offsetBeforeScroll: number, keyboardH
489 * computeIOSContentOffset(100, 300, 1000, 800, false); // 400
490 * ```
491 */
492-export declare const computeIOSContentOffset: (relativeScroll: number, keyboardHeight: number, contentHeight: number, layoutHeight: number, inverted: boolean, totalPaddingForMaxScroll?: number) => number;
493+export declare const computeIOSContentOffset: (relativeScroll: number, keyboardHeight: number, contentHeight: number, layoutHeight: number, inverted: boolean, totalPaddingForMaxScroll?: number, startInsetCompensation?: number) => number;
494diff --git a/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/types.d.ts b/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/types.d.ts
495index aff9b5a..fdd8395 100644
496--- a/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/types.d.ts
497+++ b/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/types.d.ts
498@@ -9,6 +9,10 @@ type UseChatKeyboardOptions = {
499 blankSpace: SharedValue<number>;
500 /** Extra content padding shared value — needed on iOS to correctly clamp contentOffset. */
501 extraContentPadding: SharedValue<number>;
502+ /** Safe-area extra beyond raw contentInset. Offset math only. */
503+ adjustedInsetCompensation: number;
504+ /** Leading inset UIKit adds beyond the raw contentInset. Offset math only. */
505+ adjustedStartInsetCompensation: number;
506 };
507 type UseChatKeyboardReturn = {
508 /** Extra scrollable space (= keyboard height). Used as contentInset on iOS, contentInsetBottom/contentInsetTop on Android. */
509diff --git a/lib/typescript/components/KeyboardChatScrollView/useExtraContentPadding/index.d.ts b/lib/typescript/components/KeyboardChatScrollView/useExtraContentPadding/index.d.ts
510index ec73f70..45b3874 100644
511--- a/lib/typescript/components/KeyboardChatScrollView/useExtraContentPadding/index.d.ts
512+++ b/lib/typescript/components/KeyboardChatScrollView/useExtraContentPadding/index.d.ts
513@@ -8,6 +8,10 @@ type UseExtraContentPaddingOptions = {
514 keyboardPadding: SharedValue<number>;
515 /** Minimum inset floor — used to absorb keyboard and extraContentPadding changes. */
516 blankSpace: SharedValue<number>;
517+ /** Safe-area extra beyond raw contentInset. Offset math only. */
518+ adjustedInsetCompensation: number;
519+ /** Leading inset UIKit adds beyond raw contentInset. Offset math only. */
520+ adjustedStartInsetCompensation: number;
521 /** Current vertical scroll offset. */
522 scroll: SharedValue<number>;
523 /** Visible viewport dimensions. */
524diff --git a/src/components/KeyboardChatScrollView/index.tsx b/src/components/KeyboardChatScrollView/index.tsx
525index 554b38c..725d546 100644
526--- a/src/components/KeyboardChatScrollView/index.tsx
527+++ b/src/components/KeyboardChatScrollView/index.tsx
528@@ -1,7 +1,9 @@
529 import React, { forwardRef, useCallback, useMemo } from "react";
530-import { StyleSheet } from "react-native";
531+import { Platform, StyleSheet } from "react-native";
532 import {
533 makeMutable,
534+ runOnJS,
535+ useAnimatedReaction,
536 useAnimatedRef,
537 useAnimatedStyle,
538 useDerivedValue,
539@@ -39,9 +41,12 @@ const KeyboardChatScrollView: React.ForwardRefExoticComponent<
540 offset = 0,
541 extraContentPadding = ZERO_CONTENT_PADDING,
542 blankSpace = ZERO_BLANK_SPACE,
543+ adjustedInsetCompensation = 0,
544+ adjustedStartInsetCompensation = 0,
545 applyWorkaroundForContentInsetHitTestBug = false,
546 onLayout: onLayoutProp,
547 onContentSizeChange: onContentSizeChangeProp,
548+ onContentInsetChange,
549 onEndVisible,
550 ...rest
551 },
552@@ -68,6 +73,8 @@ const KeyboardChatScrollView: React.ForwardRefExoticComponent<
553 offset,
554 blankSpace,
555 extraContentPadding,
556+ adjustedInsetCompensation,
557+ adjustedStartInsetCompensation,
558 });
560 useExtraContentPadding({
561@@ -75,6 +82,8 @@ const KeyboardChatScrollView: React.ForwardRefExoticComponent<
562 extraContentPadding,
563 keyboardPadding: padding,
564 blankSpace,
565+ adjustedInsetCompensation,
566+ adjustedStartInsetCompensation,
567 scroll,
568 layout,
569 size,
570@@ -112,13 +121,40 @@ const KeyboardChatScrollView: React.ForwardRefExoticComponent<
571 ),
572 );
574- // Scroll indicator inset = keyboard + extraContentPadding (excludes blankSpace).
575- // Apps that render into the unsafe area can supply a negative
576- // scrollIndicatorInsets adjustment at the application layer.
577- const indicatorPadding = useDerivedValue(
578- () => padding.value + extraContentPadding.value,
579+ // iOS applies the destination contentInset and contentOffset together at
580+ // keyboard-animation start. Keep that native target behavior, but report
581+ // the presentation height so virtualized-list layout follows the keyboard.
582+ const reportedPadding = useDerivedValue(() =>
583+ Platform.OS === "ios"
584+ ? Math.min(
585+ layout.value.height,
586+ Math.max(
587+ blankSpace.value,
588+ currentHeight.value + extraContentPadding.value,
589+ ),
590+ )
591+ : totalPadding.value,
592 );
594+ // Mirror the effective bottom padding (keyboard + composer + blank floor)
595+ // to the consumer — a virtualized list needs it in its own scroll math or
596+ // its end/maintain targets point at the under-the-keyboard resting offset.
597+ useAnimatedReaction(
598+ () => reportedPadding.value,
599+ (current, previous) => {
600+ if (onContentInsetChange && current !== previous) {
601+ runOnJS(onContentInsetChange)({ bottom: current });
602+ }
603+ },
604+ [onContentInsetChange],
605+ );
606+
607+ // Scroll indicator inset = keyboard only (excludes extraContentPadding and
608+ // blankSpace): with a floating composer the indicator track should run the
609+ // full height of the scroll view, behind the composer, like iOS Messages.
610+ // The keyboard still lifts it so it never disappears under the keyboard.
611+ const indicatorPadding = useDerivedValue(() => padding.value);
612+
613 const onLayout = useCallback(
614 (e: LayoutChangeEvent) => {
615 onLayoutInternal(e);
616diff --git a/src/components/KeyboardChatScrollView/types.ts b/src/components/KeyboardChatScrollView/types.ts
617index b7c98c8..e1012a8 100644
618--- a/src/components/KeyboardChatScrollView/types.ts
619+++ b/src/components/KeyboardChatScrollView/types.ts
620@@ -93,6 +93,17 @@ export type KeyboardChatScrollViewProps = {
621 * Default is `undefined` (equivalent to `0` — no minimum floor).
622 */
623 blankSpace?: SharedValue<number>;
624+ /**
625+ * Extra bottom inset UIKit adds on top of the raw `contentInset` this
626+ * component writes (e.g. the home-indicator safe area under
627+ * `contentInsetAdjustmentBehavior="automatic"`). Used ONLY in scroll-offset
628+ * math (max scroll / end pinning) — never written into `contentInset`.
629+ *
630+ * Default is `0`.
631+ */
632+ adjustedInsetCompensation?: number;
633+ /** Leading inset UIKit adds outside raw contentInset. Offset math only. */
634+ adjustedStartInsetCompensation?: number;
635 /**
636 * Fires whenever the effective content inset changes — the static `contentInset`
637 * prop combined with the dynamic keyboard-driven padding.
638diff --git a/src/components/KeyboardChatScrollView/useChatKeyboard/helpers.ts b/src/components/KeyboardChatScrollView/useChatKeyboard/helpers.ts
639index 37eacd1..3d77ab2 100644
640--- a/src/components/KeyboardChatScrollView/useChatKeyboard/helpers.ts
641+++ b/src/components/KeyboardChatScrollView/useChatKeyboard/helpers.ts
642@@ -245,6 +245,7 @@ export const computeIOSContentOffset = (
643 layoutHeight: number,
644 inverted: boolean,
645 totalPaddingForMaxScroll?: number,
646+ startInsetCompensation: number = 0,
647 ): number => {
648 "worklet";
650@@ -262,7 +263,14 @@ export const computeIOSContentOffset = (
651 );
652 }
654- const maxScroll = Math.max(contentHeight - layoutHeight + paddingForMax, 0);
655+ const minScroll = -startInsetCompensation;
656+ const maxScroll = Math.max(
657+ contentHeight - layoutHeight + paddingForMax,
658+ minScroll,
659+ );
661- return Math.min(Math.max(keyboardHeight + relativeScroll, 0), maxScroll);
662+ return Math.min(
663+ Math.max(keyboardHeight + relativeScroll, minScroll),
664+ maxScroll,
665+ );
666 };
667diff --git a/src/components/KeyboardChatScrollView/useChatKeyboard/index.ios.ts b/src/components/KeyboardChatScrollView/useChatKeyboard/index.ios.ts
668index 129a74b..168ce1a 100644
669--- a/src/components/KeyboardChatScrollView/useChatKeyboard/index.ios.ts
670+++ b/src/components/KeyboardChatScrollView/useChatKeyboard/index.ios.ts
671@@ -43,6 +43,8 @@ function useChatKeyboard(
672 offset,
673 blankSpace,
674 extraContentPadding,
675+ adjustedInsetCompensation,
676+ adjustedStartInsetCompensation,
677 } = options;
679 const padding = useSharedValue(0);
680@@ -80,6 +82,10 @@ function useChatKeyboard(
681 offset,
682 );
684+ if (e.duration === 0) {
685+ currentHeight.value = effective;
686+ }
687+
688 const atEnd = isScrollAtEnd(
689 scroll.value,
690 layout.value.height,
691@@ -105,10 +111,12 @@ function useChatKeyboard(
692 effective,
693 minimumPaddingAbsorbed,
694 );
695- const actualTotalPadding = Math.max(
696- blankSpace.value,
697- effective + extraContentPadding.value,
698- );
699+ // UIKit adds adjustedInsetCompensation (safe area) on top of the raw
700+ // inset; include it here so end/max-scroll targets match the real
701+ // resting offsets.
702+ const actualTotalPadding =
703+ Math.max(blankSpace.value, effective + extraContentPadding.value) +
704+ adjustedInsetCompensation;
706 // `onInteractive` owns the native scroll offset. When its final
707 // keyboardWillHide event arrives, consume the marker so this
708@@ -142,11 +150,11 @@ function useChatKeyboard(
709 } else {
710 const maxScroll = Math.max(
711 size.value.height - layout.value.height + actualTotalPadding,
712- 0,
713+ -adjustedStartInsetCompensation,
714 );
716 contentOffsetY.value = Math.max(
717- 0,
718+ -adjustedStartInsetCompensation,
719 Math.min(scroll.value, maxScroll),
720 );
721 }
722@@ -177,11 +185,11 @@ function useChatKeyboard(
723 } else {
724 const maxScroll = Math.max(
725 size.value.height - layout.value.height + actualTotalPadding,
726- 0,
727+ -adjustedStartInsetCompensation,
728 );
730 contentOffsetY.value = Math.max(
731- 0,
732+ -adjustedStartInsetCompensation,
733 Math.min(scroll.value, maxScroll),
734 );
735 }
736@@ -231,17 +239,36 @@ function useChatKeyboard(
737 layout.value.height,
738 inverted,
739 actualTotalPadding,
740+ adjustedStartInsetCompensation,
741 );
742 },
743- onInteractive: () => {
744+ onMove: (e) => {
745 "worklet";
747- isInteractiveDismissal.value = true;
748+ if (freeze.value) {
749+ return;
750+ }
751+
752+ currentHeight.value = getEffectiveHeight(
753+ e.height,
754+ targetKeyboardHeight.value,
755+ offset,
756+ );
757 },
758- onMove: () => {
759+ onInteractive: (e) => {
760 "worklet";
762- // iOS doesn't need per-frame updates (contentOffset handles it)
763+ isInteractiveDismissal.value = true;
764+
765+ if (freeze.value) {
766+ return;
767+ }
768+
769+ currentHeight.value = getEffectiveHeight(
770+ e.height,
771+ targetKeyboardHeight.value,
772+ offset,
773+ );
774 },
775 onEnd: (e) => {
776 "worklet";
777@@ -256,10 +283,18 @@ function useChatKeyboard(
778 offset,
779 );
781+ currentHeight.value = effective;
782 padding.value = effective;
783 },
784 },
785- [inverted, keyboardLiftBehavior, offset, extraContentPadding],
786+ [
787+ inverted,
788+ keyboardLiftBehavior,
789+ offset,
790+ extraContentPadding,
791+ adjustedInsetCompensation,
792+ adjustedStartInsetCompensation,
793+ ],
794 );
796 return {
797diff --git a/src/components/KeyboardChatScrollView/useChatKeyboard/types.ts b/src/components/KeyboardChatScrollView/useChatKeyboard/types.ts
798index 02abf5c..4ee0ddd 100644
799--- a/src/components/KeyboardChatScrollView/useChatKeyboard/types.ts
800+++ b/src/components/KeyboardChatScrollView/useChatKeyboard/types.ts
801@@ -11,6 +11,10 @@ type UseChatKeyboardOptions = {
802 blankSpace: SharedValue<number>;
803 /** Extra content padding shared value — needed on iOS to correctly clamp contentOffset. */
804 extraContentPadding: SharedValue<number>;
805+ /** Extra bottom inset UIKit adds beyond the raw contentInset (safe area). Offset math only. */
806+ adjustedInsetCompensation: number;
807+ /** Leading inset UIKit adds beyond the raw contentInset. Offset math only. */
808+ adjustedStartInsetCompensation: number;
809 };
811 type UseChatKeyboardReturn = {
812diff --git a/src/components/KeyboardChatScrollView/useExtraContentPadding/index.ts b/src/components/KeyboardChatScrollView/useExtraContentPadding/index.ts
813index c9c93f3..76a201d 100644
814--- a/src/components/KeyboardChatScrollView/useExtraContentPadding/index.ts
815+++ b/src/components/KeyboardChatScrollView/useExtraContentPadding/index.ts
816@@ -16,6 +16,10 @@ type UseExtraContentPaddingOptions = {
817 keyboardPadding: SharedValue<number>;
818 /** Minimum inset floor — used to absorb keyboard and extraContentPadding changes. */
819 blankSpace: SharedValue<number>;
820+ /** Extra bottom inset UIKit adds beyond the raw contentInset (safe area). Offset math only. */
821+ adjustedInsetCompensation: number;
822+ /** Leading inset UIKit adds beyond raw contentInset. Offset math only. */
823+ adjustedStartInsetCompensation: number;
824 /** Current vertical scroll offset. */
825 scroll: SharedValue<number>;
826 /** Visible viewport dimensions. */
827@@ -51,6 +55,8 @@ function useExtraContentPadding(options: UseExtraContentPaddingOptions): void {
828 extraContentPadding,
829 keyboardPadding,
830 blankSpace,
831+ adjustedInsetCompensation,
832+ adjustedStartInsetCompensation,
833 scroll,
834 layout,
835 size,
836@@ -99,14 +105,12 @@ function useExtraContentPadding(options: UseExtraContentPaddingOptions): void {
837 }
839 // Compute effective delta considering blankSpace floor
840- const previousTotal = Math.max(
841- blankSpace.value,
842- keyboardPadding.value + previous,
843- );
844- const currentTotal = Math.max(
845- blankSpace.value,
846- keyboardPadding.value + current,
847- );
848+ const previousTotal =
849+ Math.max(blankSpace.value, keyboardPadding.value + previous) +
850+ adjustedInsetCompensation;
851+ const currentTotal =
852+ Math.max(blankSpace.value, keyboardPadding.value + current) +
853+ adjustedInsetCompensation;
854 const effectiveDelta = currentTotal - previousTotal;
856 if (effectiveDelta === 0) {
857@@ -139,16 +143,25 @@ function useExtraContentPadding(options: UseExtraContentPaddingOptions): void {
859 scrollToTarget(target);
860 } else {
861+ const minScroll = -adjustedStartInsetCompensation;
862 const maxScroll = Math.max(
863 size.value.height - layout.value.height + currentTotal,
864- 0,
865+ minScroll,
866+ );
867+ const target = Math.max(
868+ minScroll,
869+ Math.min(scroll.value + effectiveDelta, maxScroll),
870 );
871- const target = Math.min(scroll.value + effectiveDelta, maxScroll);
873 scrollToTarget(target);
874 }
875 },
876- [inverted, keyboardLiftBehavior],
877+ [
878+ inverted,
879+ keyboardLiftBehavior,
880+ adjustedInsetCompensation,
881+ adjustedStartInsetCompensation,
882+ ],
883 );
884 }