TypeScript
fix(mobile): upgrade react-native-keyboard-controller to 1.22.8 for the Duo fold composer (#25141)
Julius Marminge44df3360165b
diff --git a/apps/mobile/package.json b/apps/mobile/package.jsonindex b595178d8d3..9b28ed178b6 100644--- a/apps/mobile/package.json+++ b/apps/mobile/package.json@@ -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",diff --git a/patches/[email protected] b/patches/[email protected]similarity index 94%rename from patches/[email protected]rename to patches/[email protected]index 7fde383a42a..3f307d3202c 100644--- a/patches/[email protected]+++ b/patches/[email protected]@@ -187,10 +187,10 @@ index 6481228..0dc5dd1 100644padding,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,@@ -199,7 +199,7 @@ index 827436c..fe9f371 100644scroll,layout,size,-@@ -66,8 +68,8 @@ function useExtraContentPadding(options) {+@@ -74,8 +76,8 @@ function useExtraContentPadding(options) {}// Compute effective delta considering blankSpace floor@@ -210,20 +210,24 @@ index 827436c..fe9f371 100644const 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]);}@@ -430,10 +434,10 @@ index 043b973..df5a408 100644padding,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,@@ -442,7 +446,7 @@ index 3c90439..9e7ebb6 100644scroll,layout,size,-@@ -60,8 +62,8 @@ function useExtraContentPadding(options) {+@@ -68,8 +70,8 @@ function useExtraContentPadding(options) {}// Compute effective delta considering blankSpace floor@@ -453,20 +457,24 @@ index 3c90439..9e7ebb6 100644const 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]);}@@ -823,10 +831,10 @@ index f89b7c8..02e0e19 100644type 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>;@@ -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,@@ -846,7 +854,7 @@ index e7584ed..dc653b0 100644scroll,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@@ -867,9 +875,9 @@ index e7584ed..dc653b0 100644const 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(@@ -877,20 +885,18 @@ index e7584ed..dc653b0 100644- 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],+ [diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 5965e7456bd..6352b1a7f85 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -272,7 +272,7 @@ overrides:node-pty: 1.2.0-beta.15react-native-gesture-handler: 3.3.0react-native-reanimated: 4.7.1- react-native-keyboard-controller: 1.22.7+ react-native-keyboard-controller: 1.22.8react-native-pdf-jsi: 5.0.0react-native-webview: 14.0.1'@expo/ui': 58.0.20@@ -373,7 +373,7 @@ patchedDependencies:[email protected]: f1e680afec85f650699ea756f91f469844ec4c976f4f168492a45c6b3f67d651[email protected]: abe20e1d1c23549297cbbc818e14fe479b41455930d9663135d6b40fe359b626[email protected]: 419f35ee91eac88ced9438058281db5eb09d9c799d8974c1172926068c9448cf- [email protected]: f28d08f1233e3cce8b9324b4357d2b10f1ee040b8051bc87235b0fb95069b9bb+ [email protected]: 6eb6c847ac693b636ec97c83575acd44b77e92ad0d2c776de0cb4e78e8fb9d4f[email protected]: 6f52854210f61bef499850ebd498229a111bc34ec5b2a4925e644f2f48f42760[email protected]: 95ee26e5fcab5f50bc4b4c47b3f7e6278a0b20850205efb9f6ee7e70a22d2b59[email protected]: 81caa279ec3dc1f81209062133b66e8f824e13f106cca57f1fa732a72c2ab378@@ -748,8 +748,8 @@ importers:specifier: 0.2.2version: 0.2.2(patch_hash=419f35ee91eac88ced9438058281db5eb09d9c799d8974c1172926068c9448cf)([email protected](@babel/[email protected]([email protected]))(@react-native/[email protected](@babel/[email protected]([email protected]))([email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])react-native-keyboard-controller:- specifier: 1.22.7- version: 1.22.7(patch_hash=f28d08f1233e3cce8b9324b4357d2b10f1ee040b8051bc87235b0fb95069b9bb)(e2a826d844fe10cdcbda558127861778)+ specifier: 1.22.8+ version: 1.22.8(patch_hash=6eb6c847ac693b636ec97c83575acd44b77e92ad0d2c776de0cb4e78e8fb9d4f)(e2a826d844fe10cdcbda558127861778)react-native-nitro-modules:specifier: 0.37.1version: 0.37.1([email protected](@babel/[email protected]([email protected]))(@react-native/[email protected](@babel/[email protected]([email protected]))([email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])@@ -10704,8 +10704,8 @@ packages:react: '*'react-native: '*'- resolution: {integrity: sha512-IBR9z6Nl/iDLRfiv1zN9QQroOXAwYMugeAjVDb+CFbRBNC8fayXlHTBbshVcWc4j95Itsv+1/FgwfxKnIn1Vmg==}+ resolution: {integrity: sha512-1eJk1bPMyRq+MlKxak1p0tyZ3sOF3KWi4ilVCYm1u7RSGJ4bVXu0Kn6lKzByrc/vH+m0LqWNhGNuUDyOJ/Lwhw==}peerDependencies:react: '*'react-native: '*'@@ -21307,7 +21307,7 @@ snapshots:react: 19.3.0react-native: 0.88.0(@babel/[email protected]([email protected]))(@react-native/[email protected](@babel/[email protected]([email protected]))([email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected])([email protected])- [email protected](patch_hash=f28d08f1233e3cce8b9324b4357d2b10f1ee040b8051bc87235b0fb95069b9bb)(e2a826d844fe10cdcbda558127861778):+ [email protected](patch_hash=6eb6c847ac693b636ec97c83575acd44b77e92ad0d2c776de0cb4e78e8fb9d4f)(e2a826d844fe10cdcbda558127861778):dependencies:react: 19.3.0react-native: 0.88.0(@babel/[email protected]([email protected]))(@react-native/[email protected](@babel/[email protected]([email protected]))([email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected])([email protected])diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yamlindex d2094740bf3..1d120a121a9 100644--- a/pnpm-workspace.yaml+++ b/pnpm-workspace.yaml@@ -185,7 +185,7 @@ minimumReleaseAgeExclude:- - "[email protected]"+ - "[email protected]"@@ -246,7 +246,7 @@ overrides:node-pty: 1.2.0-beta.15react-native-gesture-handler: 3.3.0react-native-reanimated: 4.7.1- react-native-keyboard-controller: 1.22.7+ react-native-keyboard-controller: 1.22.8react-native-pdf-jsi: 5.0.0react-native-webview: 14.0.1"@expo/ui": 58.0.20@@ -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.[email protected]: patches/[email protected]- [email protected]: patches/[email protected]+ [email protected]: patches/[email protected][email protected]: patches/[email protected]# Android: a nested WebView hands a vertical drag to its scrolling parent at the page's edge.[email protected]: patches/[email protected]