Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
"react-native-enriched-markdown": "file:deps/react-native-enriched-markdown-1.2.0-t3.16-558767d9.tgz",
"react-native-gesture-handler": "~3.3.0",
"react-native-image-viewing": "^0.2.2",
"react-native-keyboard-controller": "1.22.7",
"react-native-keyboard-controller": "1.22.8",
"react-native-nitro-modules": "0.37.1",
"react-native-pdf-jsi": "5.0.0",
"react-native-reanimated": "4.7.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ index 6481228..0dc5dd1 100644
padding,
currentHeight,
diff --git a/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js b/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js
index 827436c..fe9f371 100644
index 11e81a9..de39eac 100644
--- a/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js
+++ b/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js
@@ -32,6 +32,8 @@ function useExtraContentPadding(options) {
@@ -33,6 +33,8 @@ function useExtraContentPadding(options) {
extraContentPadding,
keyboardPadding,
blankSpace,
Expand All @@ -199,7 +199,7 @@ index 827436c..fe9f371 100644
scroll,
layout,
size,
@@ -66,8 +68,8 @@ function useExtraContentPadding(options) {
@@ -74,8 +76,8 @@ function useExtraContentPadding(options) {
}

// Compute effective delta considering blankSpace floor
Expand All @@ -210,20 +210,24 @@ index 827436c..fe9f371 100644
const effectiveDelta = currentTotal - previousTotal;
if (effectiveDelta === 0) {
// blankSpace absorbed the change
@@ -86,13 +88,11 @@ function useExtraContentPadding(options) {
const target = Math.max(scroll.value - effectiveDelta, -currentTotal);
scrollToTarget(target);
@@ -116,14 +118,15 @@ function useExtraContentPadding(options) {
if (inverted) {
target = Math.max(base - effectiveDelta, -currentTotal);
} else {
- const maxScroll = Math.max(size.value.height - layout.value.height + currentTotal, 0);
- // 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));
scrollToTarget(target);

- // Clamp at 0 as well: when the content is shorter than the viewport a
- // shrinking padding makes `effectiveDelta` negative while `base` is
- // already 0, so the target would go below the top of the content.
- target = Math.max(Math.min(base + effectiveDelta, maxScroll), 0);
+ // Clamp at the top as well: when the content is shorter than the
+ // viewport a shrinking padding makes `effectiveDelta` negative while
+ // `base` is already at the top.
+ target = Math.max(minScroll, Math.min(base + effectiveDelta, maxScroll));
}
scrollToTarget(target);
- }, [inverted, keyboardLiftBehavior]);
+ }, [inverted, keyboardLiftBehavior, adjustedInsetCompensation, adjustedStartInsetCompensation]);
}
Expand Down Expand Up @@ -430,10 +434,10 @@ index 043b973..df5a408 100644
padding,
currentHeight,
diff --git a/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js b/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js
index 3c90439..9e7ebb6 100644
index cdca47b..3ea3a7f 100644
--- a/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js
+++ b/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js
@@ -26,6 +26,8 @@ function useExtraContentPadding(options) {
@@ -27,6 +27,8 @@ function useExtraContentPadding(options) {
extraContentPadding,
keyboardPadding,
blankSpace,
Expand All @@ -442,7 +446,7 @@ index 3c90439..9e7ebb6 100644
scroll,
layout,
size,
@@ -60,8 +62,8 @@ function useExtraContentPadding(options) {
@@ -68,8 +70,8 @@ function useExtraContentPadding(options) {
}

// Compute effective delta considering blankSpace floor
Expand All @@ -453,20 +457,24 @@ index 3c90439..9e7ebb6 100644
const effectiveDelta = currentTotal - previousTotal;
if (effectiveDelta === 0) {
// blankSpace absorbed the change
@@ -80,14 +82,12 @@ function useExtraContentPadding(options) {
const target = Math.max(scroll.value - effectiveDelta, -currentTotal);
scrollToTarget(target);
@@ -110,15 +112,16 @@ function useExtraContentPadding(options) {
if (inverted) {
target = Math.max(base - effectiveDelta, -currentTotal);
} else {
- const maxScroll = Math.max(size.value.height - layout.value.height + currentTotal, 0);
- // 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));
scrollToTarget(target);

- // Clamp at 0 as well: when the content is shorter than the viewport a
- // shrinking padding makes `effectiveDelta` negative while `base` is
- // already 0, so the target would go below the top of the content.
- target = Math.max(Math.min(base + effectiveDelta, maxScroll), 0);
+ // Clamp at the top as well: when the content is shorter than the
+ // viewport a shrinking padding makes `effectiveDelta` negative while
+ // `base` is already at the top.
+ target = Math.max(minScroll, Math.min(base + effectiveDelta, maxScroll));
}
scrollToTarget(target);
- }, [inverted, keyboardLiftBehavior]);
+ }, [inverted, keyboardLiftBehavior, adjustedInsetCompensation, adjustedStartInsetCompensation]);
}
Expand Down Expand Up @@ -823,10 +831,10 @@ index f89b7c8..02e0e19 100644

type UseChatKeyboardReturn = {
diff --git a/src/components/KeyboardChatScrollView/useExtraContentPadding/index.ts b/src/components/KeyboardChatScrollView/useExtraContentPadding/index.ts
index e7584ed..dc653b0 100644
index 99cc6c6..d883e76 100644
--- a/src/components/KeyboardChatScrollView/useExtraContentPadding/index.ts
+++ b/src/components/KeyboardChatScrollView/useExtraContentPadding/index.ts
@@ -17,6 +17,10 @@ type UseExtraContentPaddingOptions = {
@@ -18,6 +18,10 @@ type UseExtraContentPaddingOptions = {
keyboardPadding: SharedValue<number>;
/** Minimum inset floor — used to absorb keyboard and extraContentPadding changes. */
blankSpace: SharedValue<number>;
Expand All @@ -837,7 +845,7 @@ index e7584ed..dc653b0 100644
/** Current vertical scroll offset. */
scroll: SharedValue<number>;
/** Visible viewport dimensions. */
@@ -52,6 +56,8 @@ function useExtraContentPadding(options: UseExtraContentPaddingOptions): void {
@@ -53,6 +57,8 @@ function useExtraContentPadding(options: UseExtraContentPaddingOptions): void {
extraContentPadding,
keyboardPadding,
blankSpace,
Expand All @@ -846,7 +854,7 @@ index e7584ed..dc653b0 100644
scroll,
layout,
size,
@@ -95,14 +101,12 @@ function useExtraContentPadding(options: UseExtraContentPaddingOptions): void {
@@ -104,14 +110,12 @@ function useExtraContentPadding(options: UseExtraContentPaddingOptions): void {
}

// Compute effective delta considering blankSpace floor
Expand All @@ -867,30 +875,28 @@ index e7584ed..dc653b0 100644
const effectiveDelta = currentTotal - previousTotal;

if (effectiveDelta === 0) {
@@ -135,22 +139,28 @@ function useExtraContentPadding(options: UseExtraContentPaddingOptions): void {

scrollToTarget(target);
@@ -170,20 +174,26 @@ function useExtraContentPadding(options: UseExtraContentPaddingOptions): void {
if (inverted) {
target = Math.max(base - effectiveDelta, -currentTotal);
} else {
+ const minScroll = -adjustedStartInsetCompensation;
const maxScroll = Math.max(
size.value.height - layout.value.height + currentTotal,
- 0,
+ minScroll,
);

- // 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.
- // shrinking padding makes `effectiveDelta` negative while `base` is
- // already 0, so the target would go below the top of the content.
- target = Math.max(Math.min(base + effectiveDelta, maxScroll), 0);
+ // 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),
- 0,
);

scrollToTarget(target);
+ // `base` is already at the top.
+ target = Math.max(minScroll, Math.min(base + effectiveDelta, maxScroll));
}

scrollToTarget(target);
},
- [inverted, keyboardLiftBehavior],
+ [
Expand Down
14 changes: 7 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ minimumReleaseAgeExclude:
- "react@19.3.0"
- "react-dom@19.3.0"
- "react-native@0.88.0"
- "react-native-keyboard-controller@1.22.7"
- "react-native-keyboard-controller@1.22.8"
- "react-native-worklets@0.13.0"
- "react-native-reanimated@4.7.1"
- "react-native-screens@4.28.0"
Expand Down Expand Up @@ -246,7 +246,7 @@ overrides:
node-pty: 1.2.0-beta.15
react-native-gesture-handler: 3.3.0
react-native-reanimated: 4.7.1
react-native-keyboard-controller: 1.22.7
react-native-keyboard-controller: 1.22.8
react-native-pdf-jsi: 5.0.0
react-native-webview: 14.0.1
"@expo/ui": 58.0.20
Expand Down Expand Up @@ -380,7 +380,7 @@ patchedDependencies:
# Screens v5 stack, split and tab screens leave at once, like legacy screens. Exiting animations
# inside one otherwise hold its removal for a later mount, after its stack has moved on.
react-native-reanimated@4.7.1: patches/react-native-reanimated@4.7.1.patch
react-native-keyboard-controller@1.22.7: patches/react-native-keyboard-controller@1.22.7.patch
react-native-keyboard-controller@1.22.8: patches/react-native-keyboard-controller@1.22.8.patch
react-native-pdf-jsi@5.0.0: patches/react-native-pdf-jsi@5.0.0.patch
# Android: a nested WebView hands a vertical drag to its scrolling parent at the page's edge.
react-native-webview@14.0.1: patches/react-native-webview@14.0.1.patch
Expand Down
Loading