diff --git a/packages/react-native/Libraries/Components/ScrollView/ScrollView.d.ts b/packages/react-native/Libraries/Components/ScrollView/ScrollView.d.ts index 2e26db757500d6..b79b1d88137ce3 100644 --- a/packages/react-native/Libraries/Components/ScrollView/ScrollView.d.ts +++ b/packages/react-native/Libraries/Components/ScrollView/ScrollView.d.ts @@ -12,6 +12,7 @@ import {Constructor} from '../../../types/private/Utilities'; import {Insets} from '../../../types/public/Insets'; import {ColorValue, StyleProp} from '../../StyleSheet/StyleSheet'; import {ViewStyle} from '../../StyleSheet/StyleSheetTypes'; +import {LayoutChangeEvent} from '../../Types/CoreEventTypes'; import { NativeSyntheticEvent, NativeTouchEvent, @@ -29,6 +30,14 @@ export interface PointProp { export interface ScrollResponderEvent extends NativeSyntheticEvent {} +export type StickyHeaderOnLayoutEventContext< + T extends Record, +> = { + index: number; + key: string; + itemProps: T; +}; + interface SubscribableMixin { /** * Special form of calling `addListener` that *guarantees* that a @@ -661,6 +670,13 @@ export interface ScrollViewProps */ onContentSizeChange?: ((w: number, h: number) => void) | undefined; + onStickyHeaderLayout?: + | (( + event: LayoutChangeEvent, + context: StickyHeaderOnLayoutEventContext>, + ) => void) + | undefined; + /** * Fires at most once per frame during scrolling. */ diff --git a/packages/react-native/Libraries/Components/ScrollView/ScrollView.js b/packages/react-native/Libraries/Components/ScrollView/ScrollView.js index aff1460fa473e1..4b5303f6d6d10d 100644 --- a/packages/react-native/Libraries/Components/ScrollView/ScrollView.js +++ b/packages/react-native/Libraries/Components/ScrollView/ScrollView.js @@ -371,6 +371,12 @@ type StickyHeaderComponentType = component( ...ScrollViewStickyHeaderProps ); +export type StickyHeaderOnLayoutEventContext = $ReadOnly<{ + index: number, + key: React.Key, + itemProps: T, +}>; + export type ScrollViewProps = $ReadOnly<{ ...ViewProps, ...ScrollViewPropsIOS, @@ -530,6 +536,10 @@ export type ScrollViewProps = $ReadOnly<{ * which this ScrollView renders. */ onContentSizeChange?: (contentWidth: number, contentHeight: number) => void, + onStickyHeaderLayout?: ( + event: LayoutChangeEvent, + context: StickyHeaderOnLayoutEventContext<{...}>, + ) => void, onKeyboardDidShow?: (event: KeyboardEvent) => void, onKeyboardDidHide?: (event: KeyboardEvent) => void, onKeyboardWillShow?: (event: KeyboardEvent) => void, @@ -1120,11 +1130,19 @@ class ScrollView extends React.Component { return; } + this.props.onStickyHeaderLayout && + this.props.onStickyHeaderLayout(event, { + key, + index, + itemProps: childArray[index].props, + }); + const layoutY = event.nativeEvent.layout.y; this._headerLayoutYs.set(key, layoutY); const indexOfIndex = stickyHeaderIndices.indexOf(index); const previousHeaderIndex = stickyHeaderIndices[indexOfIndex - 1]; + if (previousHeaderIndex != null) { const previousHeader = this._stickyHeaderRefs.get( this._getKeyForIndex(previousHeaderIndex, childArray), diff --git a/packages/react-native/Libraries/Lists/__tests__/__snapshots__/FlatList-test.js.snap b/packages/react-native/Libraries/Lists/__tests__/__snapshots__/FlatList-test.js.snap index 54d4c1a96d00bd..4c8f2cf3442a7d 100644 --- a/packages/react-native/Libraries/Lists/__tests__/__snapshots__/FlatList-test.js.snap +++ b/packages/react-native/Libraries/Lists/__tests__/__snapshots__/FlatList-test.js.snap @@ -21,6 +21,7 @@ exports[`FlatList ignores invalid data 1`] = ` onScrollShouldSetResponder={[Function]} onStartShouldSetResponder={[Function]} onStartShouldSetResponderCapture={[Function]} + onStickyHeaderLayout={[Function]} onTouchCancel={[Function]} onTouchEnd={[Function]} onTouchMove={[Function]} @@ -96,6 +97,7 @@ exports[`FlatList renders all the bells and whistles 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} refreshControl={ , ...ScrollViewStickyHeaderProps ); +export type StickyHeaderOnLayoutEventContext = $ReadOnly<{ + index: number, + key: React.Key, + itemProps: T, +}>; export type ScrollViewProps = $ReadOnly<{ ...ViewProps, ...ScrollViewPropsIOS, @@ -1892,6 +1897,10 @@ export type ScrollViewProps = $ReadOnly<{ onScrollBeginDrag?: ?(event: ScrollEvent) => void, onScrollEndDrag?: ?(event: ScrollEvent) => void, onContentSizeChange?: (contentWidth: number, contentHeight: number) => void, + onStickyHeaderLayout?: ( + event: LayoutChangeEvent, + context: StickyHeaderOnLayoutEventContext<{ ... }> + ) => void, onKeyboardDidShow?: (event: KeyboardEvent) => void, onKeyboardDidHide?: (event: KeyboardEvent) => void, onKeyboardWillShow?: (event: KeyboardEvent) => void, diff --git a/packages/virtualized-lists/Lists/VirtualizedList.js b/packages/virtualized-lists/Lists/VirtualizedList.js index 42ad202c090faa..88cd6aa8cfd799 100644 --- a/packages/virtualized-lists/Lists/VirtualizedList.js +++ b/packages/virtualized-lists/Lists/VirtualizedList.js @@ -10,14 +10,18 @@ import type {CellMetricProps, ListOrientation} from './ListMetricsAggregator'; import type {ViewToken} from './ViewabilityHelper'; +import type {Props as CellRendererProps} from './VirtualizedListCellRenderer'; import type { Item, - VirtualizedListProps, - ListRenderItemInfo, ListRenderItem, + ListRenderItemInfo, Separators, + VirtualizedListProps, } from './VirtualizedListProps'; -import type {ScrollResponderType} from 'react-native/Libraries/Components/ScrollView/ScrollView'; +import type { + ScrollResponderType, + StickyHeaderOnLayoutEventContext, +} from 'react-native/Libraries/Components/ScrollView/ScrollView'; import type {ViewStyleProp} from 'react-native/Libraries/StyleSheet/StyleSheet'; import type { LayoutChangeEvent, @@ -791,9 +795,9 @@ class VirtualizedList extends StateSafePureComponent< for (let ii = first; ii <= last; ii++) { const item = getItem(data, ii); const key = VirtualizedList._keyExtractor(item, ii, this.props); - + const isSticky = stickyIndicesFromProps.has(ii + stickyOffset); this._indicesToKeys.set(ii, key); - if (stickyIndicesFromProps.has(ii + stickyOffset)) { + if (isSticky) { stickyHeaderIndices.push(cells.length); } @@ -819,9 +823,10 @@ class VirtualizedList extends StateSafePureComponent< this._cellRefs[key] = ref; }} renderItem={renderItem} - {...(shouldListenForLayout && { - onCellLayout: this._onCellLayout, - })} + {...(shouldListenForLayout && + !isSticky && { + onCellLayout: this._onCellLayout, + })} />, ); prevCellKey = key; @@ -1072,6 +1077,7 @@ class VirtualizedList extends StateSafePureComponent< ...this.props, onContentSizeChange: this._onContentSizeChange, onLayout: this._onLayout, + onStickyHeaderLayout: this._onStickyHeaderLayout, onScroll: this._onScroll, onScrollBeginDrag: this._onScrollBeginDrag, onScrollEndDrag: this._onScrollEndDrag, @@ -1394,6 +1400,19 @@ class VirtualizedList extends StateSafePureComponent< this._maybeCallOnEdgeReached(); }; + _onStickyHeaderLayout = ( + e: LayoutChangeEvent, + { + key: _key, + index: _index, + itemProps, + }: StickyHeaderOnLayoutEventContext>, + ) => { + // Key and index provided in event are relative to current window. + const {index: cellIndex, cellKey} = itemProps; + this._onCellLayout(e, cellKey, cellIndex); + }; + _onLayoutEmpty = (e: LayoutChangeEvent) => { this.props.onLayout && this.props.onLayout(e); }; diff --git a/packages/virtualized-lists/Lists/__tests__/__snapshots__/VirtualizedList-test.js.snap b/packages/virtualized-lists/Lists/__tests__/__snapshots__/VirtualizedList-test.js.snap index 7790f8581bdb85..00d05116d8a49b 100644 --- a/packages/virtualized-lists/Lists/__tests__/__snapshots__/VirtualizedList-test.js.snap +++ b/packages/virtualized-lists/Lists/__tests__/__snapshots__/VirtualizedList-test.js.snap @@ -52,6 +52,7 @@ exports[`VirtualizedList forwards correct stickyHeaderIndices when ListHeaderCom onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={ @@ -209,6 +210,7 @@ exports[`VirtualizedList forwards correct stickyHeaderIndices when all in initia onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={ @@ -360,6 +362,7 @@ exports[`VirtualizedList forwards correct stickyHeaderIndices when partially in onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={ @@ -444,6 +447,7 @@ exports[`VirtualizedList handles nested lists 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -474,6 +478,7 @@ exports[`VirtualizedList handles nested lists 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -524,6 +529,7 @@ exports[`VirtualizedList handles nested lists 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -593,6 +599,7 @@ exports[`VirtualizedList handles separators correctly 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -670,6 +677,7 @@ exports[`VirtualizedList handles separators correctly 2`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -747,6 +755,7 @@ exports[`VirtualizedList handles separators correctly 3`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -884,6 +893,7 @@ exports[`VirtualizedList keeps sticky headers above viewport visualized 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={ @@ -1023,6 +1033,7 @@ exports[`VirtualizedList renders all the bells and whistles 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} refreshControl={ @@ -1493,6 +1511,7 @@ exports[`VirtualizedList renders sticky headers in viewport on batched render 1` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={ @@ -1575,6 +1594,7 @@ exports[`VirtualizedList test getItem functionality where data is not an Array 1 onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -1612,6 +1632,7 @@ exports[`VirtualizedList warns if both renderItem or ListItemComponent are speci onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -1710,6 +1731,7 @@ exports[`adjusts render area with non-zero initialScrollIndex 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -1910,6 +1932,7 @@ exports[`clamps render area when items removed for initialScrollIndex > 0 and sc onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -2048,6 +2071,7 @@ exports[`constrains batch render region when an item is removed 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -2175,6 +2199,7 @@ exports[`discards intitial render if initialScrollIndex != 0 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -2317,6 +2342,7 @@ exports[`does not adjust render area until content area layed out 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -2452,6 +2478,7 @@ exports[`does not move render area when initialScrollIndex is > 0 and offset not onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -2564,6 +2591,7 @@ exports[`does not over-render when there is less than initialNumToRender cells 1 onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -2678,6 +2706,7 @@ exports[`eventually renders all items when virtualization disabled 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -2817,6 +2846,7 @@ exports[`expands first in viewport to render up to maxToRenderPerBatch on initia onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -2934,6 +2964,7 @@ exports[`expands render area by maxToRenderPerBatch on tick 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -3054,6 +3085,7 @@ exports[`gracefully handles negative initialScrollIndex 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -3225,6 +3257,7 @@ exports[`handles maintainVisibleContentPosition 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -3394,6 +3427,7 @@ exports[`handles maintainVisibleContentPosition 2`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -3578,6 +3612,7 @@ exports[`handles maintainVisibleContentPosition 3`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -3740,6 +3775,7 @@ exports[`handles maintainVisibleContentPosition when anchor moves before minInde onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -3876,6 +3912,7 @@ exports[`handles maintainVisibleContentPosition when anchor moves before minInde onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -3972,6 +4009,7 @@ exports[`initially renders nothing when initialNumToRender is 0 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -4065,6 +4103,7 @@ exports[`keeps viewport above last focused rendered 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -4263,6 +4302,7 @@ exports[`keeps viewport below last focused rendered 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -4446,6 +4486,7 @@ exports[`renders a zero-height tail spacer on initial render if getItemLayout no onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -4536,6 +4577,7 @@ exports[`renders full tail spacer if all cells measured 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -4647,6 +4689,7 @@ exports[`renders initialNumToRender cells when virtualization disabled 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -4746,6 +4789,7 @@ exports[`renders items before initialScrollIndex on first batch tick when virtua onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -4842,6 +4886,7 @@ exports[`renders new items when data is updated with non-zero initialScrollIndex onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -4925,6 +4970,7 @@ exports[`renders no spacers up to initialScrollIndex on first render when virtua onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -4998,6 +5044,7 @@ exports[`renders offset cells in initial render when initialScrollIndex set 1`] onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -5100,6 +5147,7 @@ exports[`renders tail spacer up to last measured index if getItemLayout not defi onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -5209,6 +5257,7 @@ exports[`renders tail spacer up to last measured with irregular layout when getI onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -5310,6 +5359,7 @@ exports[`renders windowSize derived region at bottom 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -5423,6 +5473,7 @@ exports[`renders windowSize derived region at top 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -5520,6 +5571,7 @@ exports[`renders windowSize derived region in middle 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -5655,6 +5707,7 @@ exports[`renders zero-height tail spacer on batch render if cells not yet measur onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -5750,6 +5803,7 @@ exports[`retains batch render region when an item is appended 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -5896,6 +5950,7 @@ exports[`retains initial render region when an item is appended 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -6014,6 +6069,7 @@ exports[`retains intitial render if initialScrollIndex == 0 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -6203,6 +6259,7 @@ exports[`unmounts sticky headers moved below viewport 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={ @@ -6341,6 +6398,7 @@ exports[`virtualizes away last focused index if item removed 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -6531,6 +6589,7 @@ exports[`virtualizes away last focused item if focus changes to a new cell 1`] = onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} diff --git a/packages/virtualized-lists/Lists/__tests__/__snapshots__/VirtualizedSectionList-test.js.snap b/packages/virtualized-lists/Lists/__tests__/__snapshots__/VirtualizedSectionList-test.js.snap index 8de2c76b838233..300f750c35271d 100644 --- a/packages/virtualized-lists/Lists/__tests__/__snapshots__/VirtualizedSectionList-test.js.snap +++ b/packages/virtualized-lists/Lists/__tests__/__snapshots__/VirtualizedSectionList-test.js.snap @@ -27,6 +27,7 @@ exports[`VirtualizedSectionList handles nested lists 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -68,6 +69,7 @@ exports[`VirtualizedSectionList handles nested lists 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -134,6 +136,7 @@ exports[`VirtualizedSectionList handles nested lists 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -237,6 +240,7 @@ exports[`VirtualizedSectionList handles separators correctly 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -371,6 +375,7 @@ exports[`VirtualizedSectionList handles separators correctly 2`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -505,6 +510,7 @@ exports[`VirtualizedSectionList handles separators correctly 3`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -640,6 +646,7 @@ exports[`VirtualizedSectionList handles separators correctly 4`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} renderItem={[Function]} scrollEventThrottle={0.0001} stickyHeaderIndices={Array []} @@ -789,6 +796,7 @@ exports[`VirtualizedSectionList renders all the bells and whistles 1`] = ` onScroll={[Function]} onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} + onStickyHeaderLayout={[Function]} refreshControl={