Skip to content
TypeScript

fix(mobile): iOS threads no longer jump to the top (#14808)

Noé1945ce82c0d6
diff --git a/apps/mobile/package.json b/apps/mobile/package.json
index d1bd5c81089..b5f0d49d2bc 100644
--- a/apps/mobile/package.json
+++ b/apps/mobile/package.json
@@ -114,7 +114,7 @@
"react-native": "0.88.0-rc.3",
"react-native-gesture-handler": "~3.2.1",
"react-native-image-viewing": "^0.2.2",
- "react-native-keyboard-controller": "1.22.4",
+ "react-native-keyboard-controller": "1.22.6",
"react-native-nitro-markdown": "^0.5.0",
"react-native-nitro-modules": "0.35.9",
"react-native-reanimated": "4.7.0",
diff --git a/patches/[email protected] b/patches/[email protected]
similarity index 88%
rename from patches/[email protected]
rename to patches/[email protected]
index 01c1760bf33..8b9170240d4 100644
--- a/patches/[email protected]
+++ b/patches/[email protected]
@@ -1,8 +1,8 @@
diff --git a/lib/commonjs/components/KeyboardChatScrollView/index.js b/lib/commonjs/components/KeyboardChatScrollView/index.js
-index 5617394..4f2222a 100644
+index 0b78ff3..98b3b6c 100644
--- a/lib/commonjs/components/KeyboardChatScrollView/index.js
+++ b/lib/commonjs/components/KeyboardChatScrollView/index.js
-@@ -27,9 +27,12 @@ const KeyboardChatScrollView = /*#__PURE__*/(0, _react.forwardRef)(({
+@@ -28,9 +28,12 @@ const KeyboardChatScrollView = /*#__PURE__*/(0, _react.forwardRef)(({
offset = 0,
extraContentPadding = ZERO_CONTENT_PADDING,
blankSpace = ZERO_BLANK_SPACE,
@@ -15,17 +15,16 @@ index 5617394..4f2222a 100644
onEndVisible,
...rest
}, ref) => {
-@@ -51,13 +54,17 @@ const KeyboardChatScrollView = /*#__PURE__*/(0, _react.forwardRef)(({
- freeze: freezeSV,
+@@ -54,6 +57,8 @@ const KeyboardChatScrollView = /*#__PURE__*/(0, _react.forwardRef)(({
offset,
blankSpace,
-- extraContentPadding
-+ extraContentPadding,
+ extraContentPadding,
+ adjustedInsetCompensation,
-+ adjustedStartInsetCompensation
++ adjustedStartInsetCompensation,
+ initialContentOffsetY: (_rest$contentOffset = rest.contentOffset) === null || _rest$contentOffset === void 0 ? void 0 : _rest$contentOffset.y
});
(0, _useExtraContentPadding.useExtraContentPadding)({
- scrollViewRef,
+@@ -61,6 +66,8 @@ const KeyboardChatScrollView = /*#__PURE__*/(0, _react.forwardRef)(({
extraContentPadding,
keyboardPadding: padding,
blankSpace,
@@ -34,19 +33,19 @@ index 5617394..4f2222a 100644
scroll,
layout,
size,
-@@ -88,10 +95,26 @@ const KeyboardChatScrollView = /*#__PURE__*/(0, _react.forwardRef)(({
+@@ -91,10 +98,26 @@ const KeyboardChatScrollView = /*#__PURE__*/(0, _react.forwardRef)(({
// a bug for you, please open an issue.
- const totalPadding = (0, _reactNativeReanimated.useDerivedValue)(() => Math.min(layout.value.height, Math.max(blankSpace.value, padding.value + extraContentPadding.value)));
+ const totalPadding = (0, _reanimated.useDerivedValue)(() => Math.min(layout.value.height, Math.max(blankSpace.value, padding.value + extraContentPadding.value)));
+ // iOS applies the destination contentInset and contentOffset together at
+ // keyboard-animation start. Keep that native target behavior, but report
+ // the presentation height so virtualized-list layout follows the keyboard.
-+ const reportedPadding = (0, _reactNativeReanimated.useDerivedValue)(() => _reactNative.Platform.OS === "ios" ? Math.min(layout.value.height, Math.max(blankSpace.value, currentHeight.value + extraContentPadding.value)) : totalPadding.value);
++ const reportedPadding = (0, _reanimated.useDerivedValue)(() => _reactNative.Platform.OS === "ios" ? Math.min(layout.value.height, Math.max(blankSpace.value, currentHeight.value + extraContentPadding.value)) : totalPadding.value);
+
+ // Mirror the effective bottom padding (keyboard + composer + blank floor)
+ // to the consumer - a virtualized list needs it in its own scroll math or
+ // its end/maintain targets point at the under-the-keyboard resting offset.
-+ (0, _reactNativeReanimated.useAnimatedReaction)(() => reportedPadding.value, (current, previous) => {
++ (0, _reanimated.useAnimatedReaction)(() => reportedPadding.value, (current, previous) => {
+ if (onContentInsetChange && current !== previous) {
+ (0, _reactNativeReanimated.runOnJS)(onContentInsetChange)({
+ bottom: current
@@ -57,8 +56,8 @@ index 5617394..4f2222a 100644
// Scroll indicator inset = keyboard + extraContentPadding (excludes blankSpace).
// Apps that render into the unsafe area can supply a negative
// scrollIndicatorInsets adjustment at the application layer.
-- const indicatorPadding = (0, _reactNativeReanimated.useDerivedValue)(() => padding.value + extraContentPadding.value);
-+ const indicatorPadding = (0, _reactNativeReanimated.useDerivedValue)(() => padding.value);
+- const indicatorPadding = (0, _reanimated.useDerivedValue)(() => padding.value + extraContentPadding.value);
++ const indicatorPadding = (0, _reanimated.useDerivedValue)(() => padding.value);
const onLayout = (0, _react.useCallback)(e => {
onLayoutInternal(e);
onLayoutProp === null || onLayoutProp === void 0 || onLayoutProp(e);
@@ -89,7 +88,7 @@ index 4d33b3f..6a787d3 100644
//# sourceMappingURL=helpers.js.map
\ No newline at end of file
diff --git a/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js b/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js
-index cecee07..533a9e9 100644
+index 6481228..0dc5dd1 100644
--- a/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js
+++ b/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js
@@ -32,7 +32,9 @@ function useChatKeyboard(scrollViewRef, options) {
@@ -188,10 +187,10 @@ index cecee07..533a9e9 100644
padding,
currentHeight,
diff --git a/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js b/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js
-index 54a1c57..00c2941 100644
+index 0215bef..5307446 100644
--- a/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js
+++ b/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js
-@@ -31,6 +31,8 @@ function useExtraContentPadding(options) {
+@@ -32,6 +32,8 @@ function useExtraContentPadding(options) {
extraContentPadding,
keyboardPadding,
blankSpace,
@@ -200,7 +199,7 @@ index 54a1c57..00c2941 100644
scroll,
layout,
size,
-@@ -50,8 +52,13 @@ function useExtraContentPadding(options) {
+@@ -51,8 +53,13 @@ function useExtraContentPadding(options) {
// otherwise the native ScrollView clamps to the old range.
requestAnimationFrame(() => {
// check that view is still mounted and ref is actual
@@ -216,7 +215,7 @@ index 54a1c57..00c2941 100644
return;
}
(0, _reactNativeReanimated.scrollTo)(scrollViewRef, 0, target, false);
-@@ -70,8 +77,8 @@ function useExtraContentPadding(options) {
+@@ -71,8 +78,8 @@ function useExtraContentPadding(options) {
}
// Compute effective delta considering blankSpace floor
@@ -227,12 +226,15 @@ index 54a1c57..00c2941 100644
const effectiveDelta = currentTotal - previousTotal;
if (effectiveDelta === 0) {
// blankSpace absorbed the change
-@@ -90,10 +97,11 @@ function useExtraContentPadding(options) {
+@@ -91,13 +98,11 @@ function useExtraContentPadding(options) {
const target = Math.max(scroll.value - effectiveDelta, -currentTotal);
scrollToTarget(target);
} else {
- const maxScroll = Math.max(size.value.height - layout.value.height + currentTotal, 0);
-- const target = Math.min(scroll.value + effectiveDelta, maxScroll);
+- // Clamp at 0 as well: when the content is shorter than the viewport a
+- // shrinking padding makes `effectiveDelta` negative while `scroll.value`
+- // is already 0, so the target would go below the top of the content.
+- const target = Math.max(Math.min(scroll.value + effectiveDelta, maxScroll), 0);
+ const minScroll = -adjustedStartInsetCompensation;
+ const maxScroll = Math.max(size.value.height - layout.value.height + currentTotal, minScroll);
+ const target = Math.max(minScroll, Math.min(scroll.value + effectiveDelta, maxScroll));
@@ -244,20 +246,23 @@ index 54a1c57..00c2941 100644
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/lib/module/components/KeyboardChatScrollView/index.js b/lib/module/components/KeyboardChatScrollView/index.js
-index d085394..a57c2f9 100644
+index e0c8391..8df802a 100644
--- a/lib/module/components/KeyboardChatScrollView/index.js
+++ b/lib/module/components/KeyboardChatScrollView/index.js
-@@ -1,7 +1,7 @@
+@@ -1,9 +1,9 @@
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); }
import React, { forwardRef, useCallback, useMemo } from "react";
-import { StyleSheet } from "react-native";
--import { makeMutable, useAnimatedRef, useAnimatedStyle, useDerivedValue } from "react-native-reanimated";
+-import { makeMutable, useAnimatedRef } from "react-native-reanimated";
+import { Platform, StyleSheet } from "react-native";
-+import { makeMutable, runOnJS, useAnimatedReaction, useAnimatedRef, useAnimatedStyle, useDerivedValue } from "react-native-reanimated";
++import { makeMutable, runOnJS, useAnimatedRef } from "react-native-reanimated";
import Reanimated from "react-native-reanimated";
+-import { useAnimatedStyle, useDerivedValue } from "../../reanimated";
++import { useAnimatedReaction, useAnimatedStyle, useDerivedValue } from "../../reanimated";
import useCombinedRef from "../hooks/useCombinedRef";
import ScrollViewWithBottomPadding from "../ScrollViewWithBottomPadding";
-@@ -20,9 +20,12 @@ const KeyboardChatScrollView = /*#__PURE__*/forwardRef(({
+ import { useChatKeyboard } from "./useChatKeyboard";
+@@ -21,9 +21,12 @@ const KeyboardChatScrollView = /*#__PURE__*/forwardRef(({
offset = 0,
extraContentPadding = ZERO_CONTENT_PADDING,
blankSpace = ZERO_BLANK_SPACE,
@@ -270,17 +275,16 @@ index d085394..a57c2f9 100644
onEndVisible,
...rest
}, ref) => {
-@@ -44,13 +47,17 @@ const KeyboardChatScrollView = /*#__PURE__*/forwardRef(({
- freeze: freezeSV,
+@@ -47,6 +50,8 @@ const KeyboardChatScrollView = /*#__PURE__*/forwardRef(({
offset,
blankSpace,
-- extraContentPadding
-+ extraContentPadding,
+ extraContentPadding,
+ adjustedInsetCompensation,
-+ adjustedStartInsetCompensation
++ adjustedStartInsetCompensation,
+ initialContentOffsetY: (_rest$contentOffset = rest.contentOffset) === null || _rest$contentOffset === void 0 ? void 0 : _rest$contentOffset.y
});
useExtraContentPadding({
- scrollViewRef,
+@@ -54,6 +59,8 @@ const KeyboardChatScrollView = /*#__PURE__*/forwardRef(({
extraContentPadding,
keyboardPadding: padding,
blankSpace,
@@ -289,7 +293,7 @@ index d085394..a57c2f9 100644
scroll,
layout,
size,
-@@ -81,10 +88,26 @@ const KeyboardChatScrollView = /*#__PURE__*/forwardRef(({
+@@ -84,10 +91,26 @@ const KeyboardChatScrollView = /*#__PURE__*/forwardRef(({
// a bug for you, please open an issue.
const totalPadding = useDerivedValue(() => Math.min(layout.value.height, Math.max(blankSpace.value, padding.value + extraContentPadding.value)));
@@ -343,7 +347,7 @@ index 295e221..2f7b87e 100644
//# sourceMappingURL=helpers.js.map
\ No newline at end of file
diff --git a/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js b/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js
-index 407275d..19427d7 100644
+index 043b973..df5a408 100644
--- a/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js
+++ b/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js
@@ -25,7 +25,9 @@ function useChatKeyboard(scrollViewRef, options) {
@@ -442,10 +446,10 @@ index 407275d..19427d7 100644
padding,
currentHeight,
diff --git a/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js b/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js
-index 5885415..8b3c4f0 100644
+index 5a9b91d..a11bfdb 100644
--- a/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js
+++ b/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js
-@@ -25,6 +25,8 @@ function useExtraContentPadding(options) {
+@@ -26,6 +26,8 @@ function useExtraContentPadding(options) {
extraContentPadding,
keyboardPadding,
blankSpace,
@@ -454,7 +458,7 @@ index 5885415..8b3c4f0 100644
scroll,
layout,
size,
-@@ -44,8 +46,13 @@ function useExtraContentPadding(options) {
+@@ -45,8 +47,13 @@ function useExtraContentPadding(options) {
// otherwise the native ScrollView clamps to the old range.
requestAnimationFrame(() => {
// check that view is still mounted and ref is actual
@@ -470,7 +474,7 @@ index 5885415..8b3c4f0 100644
return;
}
scrollTo(scrollViewRef, 0, target, false);
-@@ -64,8 +71,8 @@ function useExtraContentPadding(options) {
+@@ -65,8 +72,8 @@ function useExtraContentPadding(options) {
}
// Compute effective delta considering blankSpace floor
@@ -481,12 +485,15 @@ index 5885415..8b3c4f0 100644
const effectiveDelta = currentTotal - previousTotal;
if (effectiveDelta === 0) {
// blankSpace absorbed the change
-@@ -84,11 +91,12 @@ function useExtraContentPadding(options) {
+@@ -85,14 +92,12 @@ function useExtraContentPadding(options) {
const target = Math.max(scroll.value - effectiveDelta, -currentTotal);
scrollToTarget(target);
} else {
- const maxScroll = Math.max(size.value.height - layout.value.height + currentTotal, 0);
-- const target = Math.min(scroll.value + effectiveDelta, maxScroll);
+- // Clamp at 0 as well: when the content is shorter than the viewport a
+- // shrinking padding makes `effectiveDelta` negative while `scroll.value`
+- // is already 0, so the target would go below the top of the content.
+- const target = Math.max(Math.min(scroll.value + effectiveDelta, maxScroll), 0);
+ const minScroll = -adjustedStartInsetCompensation;
+ const maxScroll = Math.max(size.value.height - layout.value.height + currentTotal, minScroll);
+ const target = Math.max(minScroll, Math.min(scroll.value + effectiveDelta, maxScroll));
@@ -524,10 +531,10 @@ index 2b51cc4..3acec1f 100644
-export declare const computeIOSContentOffset: (relativeScroll: number, keyboardHeight: number, contentHeight: number, layoutHeight: number, inverted: boolean, totalPaddingForMaxScroll?: number) => number;
+export declare const computeIOSContentOffset: (relativeScroll: number, keyboardHeight: number, contentHeight: number, layoutHeight: number, inverted: boolean, totalPaddingForMaxScroll?: number, startInsetCompensation?: number) => number;
diff --git a/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/types.d.ts b/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/types.d.ts
-index aff9b5a..fdd8395 100644
+index 8d358bc..911f3d9 100644
--- a/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/types.d.ts
+++ b/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/types.d.ts
-@@ -9,6 +9,10 @@ type UseChatKeyboardOptions = {
+@@ -11,6 +11,10 @@ type UseChatKeyboardOptions = {
blankSpace: SharedValue<number>;
/** Extra content padding shared value — needed on iOS to correctly clamp contentOffset. */
extraContentPadding: SharedValue<number>;
@@ -554,21 +561,27 @@ index ec73f70..45b3874 100644
scroll: SharedValue<number>;
/** Visible viewport dimensions. */
diff --git a/src/components/KeyboardChatScrollView/index.tsx b/src/components/KeyboardChatScrollView/index.tsx
-index 554b38c..725d546 100644
+index 935bc71..d411dc4 100644
--- a/src/components/KeyboardChatScrollView/index.tsx
+++ b/src/components/KeyboardChatScrollView/index.tsx
-@@ -1,7 +1,9 @@
+@@ -1,9 +1,13 @@
import React, { forwardRef, useCallback, useMemo } from "react";
-import { StyleSheet } from "react-native";
+-import { makeMutable, useAnimatedRef } from "react-native-reanimated";
+import { Platform, StyleSheet } from "react-native";
- import {
- makeMutable,
-+ runOnJS,
++import { makeMutable, runOnJS, useAnimatedRef } from "react-native-reanimated";
+ import Reanimated from "react-native-reanimated";
+
+-import { useAnimatedStyle, useDerivedValue } from "../../reanimated";
++import {
+ useAnimatedReaction,
- useAnimatedRef,
- useAnimatedStyle,
- useDerivedValue,
-@@ -39,9 +41,12 @@ const KeyboardChatScrollView: React.ForwardRefExoticComponent<
++ useAnimatedStyle,
++ useDerivedValue,
++} from "../../reanimated";
+ import useCombinedRef from "../hooks/useCombinedRef";
+ import ScrollViewWithBottomPadding from "../ScrollViewWithBottomPadding";
+
+@@ -35,9 +39,12 @@ const KeyboardChatScrollView: React.ForwardRefExoticComponent<
offset = 0,
extraContentPadding = ZERO_CONTENT_PADDING,
blankSpace = ZERO_BLANK_SPACE,
@@ -581,16 +594,16 @@ index 554b38c..725d546 100644
onEndVisible,
...rest
},
-@@ -68,6 +73,8 @@ const KeyboardChatScrollView: React.ForwardRefExoticComponent<
+@@ -64,6 +71,8 @@ const KeyboardChatScrollView: React.ForwardRefExoticComponent<
offset,
blankSpace,
extraContentPadding,
+ adjustedInsetCompensation,
+ adjustedStartInsetCompensation,
+ initialContentOffsetY: rest.contentOffset?.y,
});
- useExtraContentPadding({
-@@ -75,6 +82,8 @@ const KeyboardChatScrollView: React.ForwardRefExoticComponent<
+@@ -72,6 +81,8 @@ const KeyboardChatScrollView: React.ForwardRefExoticComponent<
extraContentPadding,
keyboardPadding: padding,
blankSpace,
@@ -599,7 +612,7 @@ index 554b38c..725d546 100644
scroll,
layout,
size,
-@@ -112,13 +121,40 @@ const KeyboardChatScrollView: React.ForwardRefExoticComponent<
+@@ -109,13 +120,40 @@ const KeyboardChatScrollView: React.ForwardRefExoticComponent<
),
);
@@ -697,7 +710,7 @@ index 37eacd1..3d77ab2 100644
+ );
};
diff --git a/src/components/KeyboardChatScrollView/useChatKeyboard/index.ios.ts b/src/components/KeyboardChatScrollView/useChatKeyboard/index.ios.ts
-index 129a74b..168ce1a 100644
+index 1ae9b81..208505b 100644
--- a/src/components/KeyboardChatScrollView/useChatKeyboard/index.ios.ts
+++ b/src/components/KeyboardChatScrollView/useChatKeyboard/index.ios.ts
@@ -43,6 +43,8 @@ function useChatKeyboard(
@@ -827,10 +840,10 @@ index 129a74b..168ce1a 100644
return {
diff --git a/src/components/KeyboardChatScrollView/useChatKeyboard/types.ts b/src/components/KeyboardChatScrollView/useChatKeyboard/types.ts
-index 02abf5c..4ee0ddd 100644
+index f89b7c8..02e0e19 100644
--- a/src/components/KeyboardChatScrollView/useChatKeyboard/types.ts
+++ b/src/components/KeyboardChatScrollView/useChatKeyboard/types.ts
-@@ -11,6 +11,10 @@ type UseChatKeyboardOptions = {
+@@ -13,6 +13,10 @@ type UseChatKeyboardOptions = {
blankSpace: SharedValue<number>;
/** Extra content padding shared value — needed on iOS to correctly clamp contentOffset. */
extraContentPadding: SharedValue<number>;
@@ -842,10 +855,10 @@ index 02abf5c..4ee0ddd 100644
type UseChatKeyboardReturn = {
diff --git a/src/components/KeyboardChatScrollView/useExtraContentPadding/index.ts b/src/components/KeyboardChatScrollView/useExtraContentPadding/index.ts
-index c9c93f3..02f95c0 100644
+index de7d6f7..631cdfb 100644
--- a/src/components/KeyboardChatScrollView/useExtraContentPadding/index.ts
+++ b/src/components/KeyboardChatScrollView/useExtraContentPadding/index.ts
-@@ -16,6 +16,10 @@ type UseExtraContentPaddingOptions = {
+@@ -17,6 +17,10 @@ type UseExtraContentPaddingOptions = {
keyboardPadding: SharedValue<number>;
/** Minimum inset floor — used to absorb keyboard and extraContentPadding changes. */
blankSpace: SharedValue<number>;
@@ -856,7 +869,7 @@ index c9c93f3..02f95c0 100644
/** Current vertical scroll offset. */
scroll: SharedValue<number>;
/** Visible viewport dimensions. */
-@@ -51,6 +55,8 @@ function useExtraContentPadding(options: UseExtraContentPaddingOptions): void {
+@@ -52,6 +56,8 @@ function useExtraContentPadding(options: UseExtraContentPaddingOptions): void {
extraContentPadding,
keyboardPadding,
blankSpace,
@@ -865,7 +878,7 @@ index c9c93f3..02f95c0 100644
scroll,
layout,
size,
-@@ -72,8 +78,13 @@ function useExtraContentPadding(options: UseExtraContentPaddingOptions): void {
+@@ -73,8 +79,13 @@ function useExtraContentPadding(options: UseExtraContentPaddingOptions): void {
// otherwise the native ScrollView clamps to the old range.
requestAnimationFrame(() => {
// check that view is still mounted and ref is actual
@@ -881,7 +894,7 @@ index c9c93f3..02f95c0 100644
return;
}
scrollTo(scrollViewRef, 0, target, false);
-@@ -99,14 +110,12 @@ function useExtraContentPadding(options: UseExtraContentPaddingOptions): void {
+@@ -100,14 +111,12 @@ function useExtraContentPadding(options: UseExtraContentPaddingOptions): void {
}
// Compute effective delta considering blankSpace floor
@@ -902,7 +915,7 @@ index c9c93f3..02f95c0 100644
const effectiveDelta = currentTotal - previousTotal;
if (effectiveDelta === 0) {
-@@ -139,16 +148,25 @@ function useExtraContentPadding(options: UseExtraContentPaddingOptions): void {
+@@ -140,22 +149,28 @@ function useExtraContentPadding(options: UseExtraContentPaddingOptions): void {
scrollToTarget(target);
} else {
@@ -911,12 +924,18 @@ index c9c93f3..02f95c0 100644
size.value.height - layout.value.height + currentTotal,
- 0,
+ minScroll,
-+ );
-+ const target = Math.max(
+ );
+- // Clamp at 0 as well: when the content is shorter than the viewport a
+- // shrinking padding makes `effectiveDelta` negative while `scroll.value`
+- // is already 0, so the target would go below the top of the content.
++ // Clamp at the top as well: when the content is shorter than the
++ // viewport a shrinking padding makes `effectiveDelta` negative while
++ // `scroll.value` is already at the top.
+ const target = Math.max(
+ minScroll,
-+ Math.min(scroll.value + effectiveDelta, maxScroll),
+ Math.min(scroll.value + effectiveDelta, maxScroll),
+- 0,
);
-- const target = Math.min(scroll.value + effectiveDelta, maxScroll);
scrollToTarget(target);
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 092af1eaeeb..f21be615171 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -111,7 +111,7 @@ patchedDependencies:
[email protected]: 94de7964c5a67ab40e6b79d9bdf4b7bfc50ae97b70722ee8e5a35105ca83386b
[email protected]: f2fe901c61cde17986240002d05c172d5d0272d83ffaab8d0ebeb922763be414
[email protected]: d518a937e3cb2df5e7d67f1ab6b265c74a8639e4572d1b032b7b747e9b1c01a9
- [email protected]: c631278492f0113f42fa8bed43c7d8ed5779424dd12af0cefc55132c2ee1d84c
+ [email protected]: 6e448411781347cd0b87868ee279117514a399801c18f233ddca4fa3935be75d
[email protected]: 642b47830730acff3761fe29cf54271d18b493c0070c750097850b7ea032e00c
[email protected]: daf4a639ce3f951af630a3711e4082d58e3a11e5a79f45efb0b59925327ebde2
[email protected]: cc1301436ee62c39860acc9ee1a1e60b7d47e6abd211c42effa62c056d165483
@@ -448,8 +448,8 @@ importers:
specifier: ^0.2.2
react-native-keyboard-controller:
- specifier: 1.22.4
+ specifier: 1.22.6
react-native-nitro-markdown:
specifier: ^0.5.0
@@ -9561,8 +9561,8 @@ packages:
react: '*'
react-native: '*'
- resolution: {integrity: sha512-2by3oJBQqKH9UAydlBeiEpivxIyTbt345bmverLym7vbEp4NXckWQLF0STnVuXYccRak5/sd3wMYDJPhv/9+3g==}
+ resolution: {integrity: sha512-gwJAI3Bhbqs/Ja3uaeBz7EFQSFcem8q4wsXkrC9sy1CL14gjWhBICLu2Ecn7HmezpIu33uhLbirLGyqSawxRtg==}
peerDependencies:
react: '*'
react-native: '*'
@@ -20049,7 +20049,7 @@ snapshots:
react: 19.3.0
dependencies:
react: 19.3.0
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index 3c0ef065701..5bd65fcacbb 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -143,7 +143,7 @@ minimumReleaseAgeExclude:
@@ -260,7 +260,7 @@ patchedDependencies:
# Link http(s) URLs with a port or a single-label host. md4c otherwise requires a dotted host and stops at ':'.