TypeScript
fix(mobile): prevent chat from disappearing when scrolling (#10479)
Julius Marminge71297974c666
diff --git a/patches/@[email protected] b/patches/@[email protected]index 2fea500e1bd..084cf771df7 100644--- a/patches/@[email protected]+++ b/patches/@[email protected]@@ -241,7 +241,7 @@ index ce1fe00001c9e5aee6c6ea8bb2d4757d4586d002..3ccf6f16067152dfcb0c143371e2ec6a* Number of columns to render items in.* @default 1diff --git a/react-native.js b/react-native.js-index b3c5a306b293f797a8b338adfca3060c0f6db22b..24d0763aef074411eb7d17f0feb8df752a843de0 100644+index b3c5a306b293f797a8b338adfca3060c0f6db22b..ddca4bcd8a5dc5863cb65e03b6cfac0047a8ead3 100644--- a/react-native.js+++ b/react-native.js@@ -717,6 +717,15 @@ function hasActiveInitialScroll(state) {@@ -674,7 +674,19 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..24d0763aef074411eb7d17f0feb8df75contentContainerStyle: [horizontal ? { height: "100%" } : {},contentContainerStyle,-@@ -6751,7 +6950,7 @@ function createImperativeHandle(ctx, scheduleImperativeScrollCommit) {+@@ -6010,7 +6209,10 @@ var ListComponent = typedMemo(function ListComponent2({+ ],+ contentOffset: initialContentOffset !== void 0 ? horizontal ? { x: initialContentOffset, y: 0 } : { x: 0, y: initialContentOffset } : void 0,+ horizontal,+- maintainVisibleContentPosition: maintainVisibleContentPosition.size || maintainVisibleContentPosition.data ? { minIndexForVisible: 0 } : void 0,++ // Keep iOS anchored to ScrollAdjust even when JS position restoration is++ // disabled. Re-enabling native MVCP mid-drag can compare its stale anchor++ // with the 1e7 sentinel and scroll the entire list out of view.++ maintainVisibleContentPosition: Platform.OS === "ios" || maintainVisibleContentPosition.size || maintainVisibleContentPosition.data ? { minIndexForVisible: 0 } : void 0,+ onLayout,+ onScroll: onScroll2,+ ref: refScrollView,+@@ -6751,7 +6953,7 @@ function createImperativeHandle(ctx, scheduleImperativeScrollCommit) {endBuffered: state.endBuffered,getAverageItemSizes: () => getAverageItemSizes(state),indexByKey: (key) => state.indexByKey.get(key),@@ -683,7 +695,7 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..24d0763aef074411eb7d17f0feb8df75isAtStart: peek$(ctx, "isAtStart"),isEndReached: state.isEndReached,isNearEnd: peek$(ctx, "isNearEnd"),-@@ -7075,6 +7274,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -7075,6 +7277,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardeddataVersion,drawDistance = 250,contentInsetEndAdjustment,@@ -691,7 +703,7 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..24d0763aef074411eb7d17f0feb8df75estimatedItemSize = 100,estimatedListSize,extraData,-@@ -7132,10 +7332,12 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -7132,10 +7335,12 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedconst animatedPropsInternal = props.animatedPropsInternal;const anchoredEndSpaceOwner = (_a3 = props.anchoredEndSpaceOwnerInternal) != null ? _a3 : "list";const positionComponentInternal = props.positionComponentInternal;@@ -704,7 +716,7 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..24d0763aef074411eb7d17f0feb8df75stickyPositionComponentInternal: _stickyPositionComponentInternal,...restProps} = rest;-@@ -7200,7 +7402,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -7200,7 +7405,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedconst combinedRef = useCombinedRef(refScroller, refScrollView);const keyExtractor = keyExtractorProp != null ? keyExtractorProp : ((_item, index) => index.toString());const stickyHeaderIndices = stickyHeaderIndicesProp;@@ -713,7 +725,7 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..24d0763aef074411eb7d17f0feb8df75const previousContentInsetEndAdjustmentRef = React2.useRef(contentInsetEndAdjustmentResolved);const alwaysRenderIndices = React2.useMemo(() => {const indices = getAlwaysRenderIndices(alwaysRender, dataProp, keyExtractor, anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorIndex);-@@ -7341,6 +7543,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -7341,6 +7546,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedcontentContainerAlignItems: contentContainerStyle.alignItems,contentInset,contentInsetEndAdjustment: contentInsetEndAdjustmentResolved,@@ -721,7 +733,7 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..24d0763aef074411eb7d17f0feb8df75data: dataProp,dataKey,dataVersion,-@@ -7372,6 +7575,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -7372,6 +7578,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedrenderItem,rtl,snapToIndices,@@ -729,7 +741,7 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..24d0763aef074411eb7d17f0feb8df75stickyHeaderIndicesArr: stickyHeaderIndices != null ? stickyHeaderIndices : [],stickyHeaderIndicesSet: React2.useMemo(() => new Set(stickyHeaderIndices != null ? stickyHeaderIndices : []), [stickyHeaderIndices == null ? void 0 : stickyHeaderIndices.join(",")]),stickyPositionComponentInternal,-@@ -7423,6 +7627,13 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -7423,6 +7630,13 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedreturn void 0;}const resolvedOffset = (_a4 = initialScroll.contentOffset) != null ? _a4 : resolveInitialScrollOffset(ctx, initialScroll);@@ -743,7 +755,7 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..24d0763aef074411eb7d17f0feb8df75return usesBootstrapInitialScroll && ((_b2 = state.initialScrollSession) == null ? void 0 : _b2.kind) === "bootstrap" && Platform.OS === "web" ? void 0 : resolvedOffset;}, [usesBootstrapInitialScroll]);React2.useLayoutEffect(() => {-@@ -7547,6 +7758,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -7547,6 +7761,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded[dataKey,dataVersion,@@ -751,7 +763,7 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..24d0763aef074411eb7d17f0feb8df75memoizedLastItemKeys.join(","),numColumnsProp,nextScrollAxisGap,-@@ -7643,6 +7855,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -7643,6 +7858,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded() => ({getRenderedItem: (key) => getRenderedItem(ctx, key),onMomentumScrollEnd: (event) => {@@ -759,7 +771,7 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..24d0763aef074411eb7d17f0feb8df75checkFinishedScrollFallback(ctx);if (state.props.onMomentumScrollEnd) {state.props.onMomentumScrollEnd(event);-@@ -7651,6 +7864,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -7651,6 +7867,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedonScroll: (event) => onScroll(ctx, event),onScrollBeginDrag: (event) => {var _a4, _b2;@@ -768,7 +780,7 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..24d0763aef074411eb7d17f0feb8df75prepareReachedEdgeForNextUserScroll(ctx);(_b2 = (_a4 = state.props).onScrollBeginDrag) == null ? void 0 : _b2.call(_a4, event);},-@@ -7676,11 +7891,18 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -7676,11 +7894,18 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedListFooterComponent,ListFooterComponentStyle,ListHeaderComponent,@@ -788,7 +800,7 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..24d0763aef074411eb7d17f0feb8df75recycleItems,refreshControl: refreshControlElement ? stylePaddingTopState > 0 ? React2__namespace.cloneElement(refreshControlElement, {diff --git a/react-native.mjs b/react-native.mjs-index 40e87cda8c9bc79a889e5542f29af429a24b24d4..90e0d1a9dfd07d0212aae308f547b9ff7e3ad022 100644+index 40e87cda8c9bc79a889e5542f29af429a24b24d4..b8c6faf0be51cbda3e8af01f290dbe97440bc623 100644--- a/react-native.mjs+++ b/react-native.mjs@@ -696,6 +696,15 @@ function hasActiveInitialScroll(state) {@@ -1221,7 +1233,19 @@ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..90e0d1a9dfd07d0212aae308f547b9ffcontentContainerStyle: [horizontal ? { height: "100%" } : {},contentContainerStyle,-@@ -6730,7 +6929,7 @@ function createImperativeHandle(ctx, scheduleImperativeScrollCommit) {+@@ -5989,7 +6188,10 @@ var ListComponent = typedMemo(function ListComponent2({+ ],+ contentOffset: initialContentOffset !== void 0 ? horizontal ? { x: initialContentOffset, y: 0 } : { x: 0, y: initialContentOffset } : void 0,+ horizontal,+- maintainVisibleContentPosition: maintainVisibleContentPosition.size || maintainVisibleContentPosition.data ? { minIndexForVisible: 0 } : void 0,++ // Keep iOS anchored to ScrollAdjust even when JS position restoration is++ // disabled. Re-enabling native MVCP mid-drag can compare its stale anchor++ // with the 1e7 sentinel and scroll the entire list out of view.++ maintainVisibleContentPosition: Platform.OS === "ios" || maintainVisibleContentPosition.size || maintainVisibleContentPosition.data ? { minIndexForVisible: 0 } : void 0,+ onLayout,+ onScroll: onScroll2,+ ref: refScrollView,+@@ -6730,7 +6932,7 @@ function createImperativeHandle(ctx, scheduleImperativeScrollCommit) {endBuffered: state.endBuffered,getAverageItemSizes: () => getAverageItemSizes(state),indexByKey: (key) => state.indexByKey.get(key),@@ -1230,7 +1254,7 @@ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..90e0d1a9dfd07d0212aae308f547b9ffisAtStart: peek$(ctx, "isAtStart"),isEndReached: state.isEndReached,isNearEnd: peek$(ctx, "isNearEnd"),-@@ -7054,6 +7253,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -7054,6 +7256,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardeddataVersion,drawDistance = 250,contentInsetEndAdjustment,@@ -1238,7 +1262,7 @@ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..90e0d1a9dfd07d0212aae308f547b9ffestimatedItemSize = 100,estimatedListSize,extraData,-@@ -7111,10 +7311,12 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -7111,10 +7314,12 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedconst animatedPropsInternal = props.animatedPropsInternal;const anchoredEndSpaceOwner = (_a3 = props.anchoredEndSpaceOwnerInternal) != null ? _a3 : "list";const positionComponentInternal = props.positionComponentInternal;@@ -1251,7 +1275,7 @@ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..90e0d1a9dfd07d0212aae308f547b9ffstickyPositionComponentInternal: _stickyPositionComponentInternal,...restProps} = rest;-@@ -7179,7 +7381,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -7179,7 +7384,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedconst combinedRef = useCombinedRef(refScroller, refScrollView);const keyExtractor = keyExtractorProp != null ? keyExtractorProp : ((_item, index) => index.toString());const stickyHeaderIndices = stickyHeaderIndicesProp;@@ -1260,7 +1284,7 @@ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..90e0d1a9dfd07d0212aae308f547b9ffconst previousContentInsetEndAdjustmentRef = useRef(contentInsetEndAdjustmentResolved);const alwaysRenderIndices = useMemo(() => {const indices = getAlwaysRenderIndices(alwaysRender, dataProp, keyExtractor, anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorIndex);-@@ -7320,6 +7522,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -7320,6 +7525,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedcontentContainerAlignItems: contentContainerStyle.alignItems,contentInset,contentInsetEndAdjustment: contentInsetEndAdjustmentResolved,@@ -1268,7 +1292,7 @@ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..90e0d1a9dfd07d0212aae308f547b9ffdata: dataProp,dataKey,dataVersion,-@@ -7351,6 +7554,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -7351,6 +7557,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedrenderItem,rtl,snapToIndices,@@ -1276,7 +1300,7 @@ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..90e0d1a9dfd07d0212aae308f547b9ffstickyHeaderIndicesArr: stickyHeaderIndices != null ? stickyHeaderIndices : [],stickyHeaderIndicesSet: useMemo(() => new Set(stickyHeaderIndices != null ? stickyHeaderIndices : []), [stickyHeaderIndices == null ? void 0 : stickyHeaderIndices.join(",")]),stickyPositionComponentInternal,-@@ -7402,6 +7606,13 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -7402,6 +7609,13 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedreturn void 0;}const resolvedOffset = (_a4 = initialScroll.contentOffset) != null ? _a4 : resolveInitialScrollOffset(ctx, initialScroll);@@ -1290,7 +1314,7 @@ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..90e0d1a9dfd07d0212aae308f547b9ffreturn usesBootstrapInitialScroll && ((_b2 = state.initialScrollSession) == null ? void 0 : _b2.kind) === "bootstrap" && Platform.OS === "web" ? void 0 : resolvedOffset;}, [usesBootstrapInitialScroll]);useLayoutEffect(() => {-@@ -7526,6 +7737,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -7526,6 +7740,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded[dataKey,dataVersion,@@ -1298,7 +1322,7 @@ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..90e0d1a9dfd07d0212aae308f547b9ffmemoizedLastItemKeys.join(","),numColumnsProp,nextScrollAxisGap,-@@ -7622,6 +7834,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -7622,6 +7837,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded() => ({getRenderedItem: (key) => getRenderedItem(ctx, key),onMomentumScrollEnd: (event) => {@@ -1306,7 +1330,7 @@ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..90e0d1a9dfd07d0212aae308f547b9ffcheckFinishedScrollFallback(ctx);if (state.props.onMomentumScrollEnd) {state.props.onMomentumScrollEnd(event);-@@ -7630,6 +7843,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -7630,6 +7846,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedonScroll: (event) => onScroll(ctx, event),onScrollBeginDrag: (event) => {var _a4, _b2;@@ -1315,7 +1339,7 @@ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..90e0d1a9dfd07d0212aae308f547b9ffprepareReachedEdgeForNextUserScroll(ctx);(_b2 = (_a4 = state.props).onScrollBeginDrag) == null ? void 0 : _b2.call(_a4, event);},-@@ -7655,11 +7870,18 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -7655,11 +7873,18 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedListFooterComponent,ListFooterComponentStyle,ListHeaderComponent,diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 567d72e6da3..a56a22cd05e 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -91,7 +91,7 @@ patchedDependencies:'@effect/[email protected]': a16b1e870d8c29e4a98b17cc4c638a4ff471753d8ca3487f78a22b759caf951b'@expo/[email protected]': 96f1a75347e6ea02dc4b7034ace815d8ee39e18b8166ebfb573d9e58328f0dc2'@ff-labs/[email protected]': ab9ff544009e1891cfe3930105862d3699007f38922a79f3c98d90018deca368- '@legendapp/[email protected]': 03ec41339cd915ecb9a774a6b90cc2197c29038f7db67c4d2e55cd3971e5be43+ '@legendapp/[email protected]': 07ecf538deedf140bb0f3836291714960e0bbcafe0514192b59957f498d8d9d4'@pierre/[email protected]': 0ccee155b93b63d810e2c1a40c1fd676fb6fbcfa72cf6430dcedf1a3ae475ab4'@react-native-ai/[email protected]': 2d09870c2848d185cb05b53ed823a46e12dba519324d8dd8e584e28731990f9d'@react-native-menu/[email protected]': f63d256bf6a97a873b5e628eb595bd6ef0075ddd5bdd890fc920f7a6024290dd@@ -236,7 +236,7 @@ importers:version: 57.0.14(@babel/[email protected])(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected])([email protected]([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])'@legendapp/list':specifier: 'catalog:'- version: 3.3.5(patch_hash=03ec41339cd915ecb9a774a6b90cc2197c29038f7db67c4d2e55cd3971e5be43)([email protected]([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])+ version: 3.3.5(patch_hash=07ecf538deedf140bb0f3836291714960e0bbcafe0514192b59957f498d8d9d4)([email protected]([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])'@noble/curves':specifier: 'catalog:'version: 1.9.1@@ -580,7 +580,7 @@ importers:version: 0.9.0'@legendapp/list':specifier: 'catalog:'- version: 3.3.5(patch_hash=03ec41339cd915ecb9a774a6b90cc2197c29038f7db67c4d2e55cd3971e5be43)([email protected]([email protected]))([email protected])+ version: 3.3.5(patch_hash=07ecf538deedf140bb0f3836291714960e0bbcafe0514192b59957f498d8d9d4)([email protected]([email protected]))([email protected])'@lexical/react':specifier: ^0.41.0@@ -13269,7 +13269,7 @@ snapshots:dependencies:jsbi: 4.3.2- '@legendapp/[email protected](patch_hash=03ec41339cd915ecb9a774a6b90cc2197c29038f7db67c4d2e55cd3971e5be43)([email protected]([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])':+ '@legendapp/[email protected](patch_hash=07ecf538deedf140bb0f3836291714960e0bbcafe0514192b59957f498d8d9d4)([email protected]([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])':dependencies:react: 19.2.3use-sync-external-store: 1.6.0([email protected])@@ -13277,7 +13277,7 @@ snapshots:react-dom: 19.2.3([email protected])react-native: 0.86.3(@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected])- '@legendapp/[email protected](patch_hash=03ec41339cd915ecb9a774a6b90cc2197c29038f7db67c4d2e55cd3971e5be43)([email protected]([email protected]))([email protected])':+ '@legendapp/[email protected](patch_hash=07ecf538deedf140bb0f3836291714960e0bbcafe0514192b59957f498d8d9d4)([email protected]([email protected]))([email protected])':dependencies:react: 19.2.6use-sync-external-store: 1.6.0([email protected])