Skip to content
Closed
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
16 changes: 8 additions & 8 deletions packages/react-native/Libraries/Lists/FlatList.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import type {ViewStyleProp} from '../StyleSheet/StyleSheet';
import type {
ListRenderItem,
ListRenderItemInfo,
ListViewToken,
ViewabilityConfigCallbackPair,
ViewToken,
VirtualizedListProps,
} from '@react-native/virtualized-lists';

Expand Down Expand Up @@ -573,7 +573,7 @@ class FlatList<ItemT = any> extends React.PureComponent<FlatListProps<ItemT>> {
return keyExtractor(items, index);
};

_pushMultiColumnViewable(arr: Array<ViewToken>, v: ViewToken): void {
_pushMultiColumnViewable(arr: Array<ListViewToken>, v: ListViewToken): void {
const numColumns = numColumnsOrDefault(this.props.numColumns);
const keyExtractor = this.props.keyExtractor ?? defaultKeyExtractor;
v.item.forEach((item, ii) => {
Expand All @@ -585,22 +585,22 @@ class FlatList<ItemT = any> extends React.PureComponent<FlatListProps<ItemT>> {

_createOnViewableItemsChanged(
onViewableItemsChanged: ?(info: {
viewableItems: Array<ViewToken>,
changed: Array<ViewToken>,
viewableItems: Array<ListViewToken>,
changed: Array<ListViewToken>,
...
}) => void,
// $FlowFixMe[missing-local-annot]
) {
return (info: {
viewableItems: Array<ViewToken>,
changed: Array<ViewToken>,
viewableItems: Array<ListViewToken>,
changed: Array<ListViewToken>,
...
}) => {
const numColumns = numColumnsOrDefault(this.props.numColumns);
if (onViewableItemsChanged) {
if (numColumns > 1) {
const changed: Array<ViewToken> = [];
const viewableItems: Array<ViewToken> = [];
const changed: Array<ListViewToken> = [];
const viewableItems: Array<ListViewToken> = [];
info.viewableItems.forEach(v =>
this._pushMultiColumnViewable(viewableItems, v),
);
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/Libraries/Lists/ViewabilityHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
'use strict';

export type {
ViewToken,
ListViewToken as ViewToken,
ViewabilityConfig,
ViewabilityConfigCallbackPair,
} from '@react-native/virtualized-lists';
Expand Down
1 change: 1 addition & 0 deletions packages/react-native/Libraries/Lists/VirtualizedList.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const VirtualizedListComponent: VirtualizedListType =
export type {
ListRenderItemInfo,
ListRenderItem,
ListViewToken,
Separators,
VirtualizedListProps,
} from '@react-native/virtualized-lists';
Expand Down
43 changes: 22 additions & 21 deletions packages/react-native/ReactNativeApi.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<db6de028840aefaf5eeb3e2cec029553>>
* @generated SignedSource<<0a0286ba0bc29af2abd2e8fd836077fb>>
*
* This file was generated by scripts/js-api/build-types/index.js.
*/
Expand Down Expand Up @@ -3089,6 +3089,13 @@ declare type ListRenderItemInfo<ItemT> = {
item: ItemT
separators: Separators
}
declare type ListViewToken = {
index: number | undefined
isViewable: boolean
item: any
key: string
section?: any
}
declare type LogBox = typeof LogBox
declare type LogData = {
readonly category: Category
Expand Down Expand Up @@ -3511,8 +3518,8 @@ declare type OptionalVirtualizedListProps = {
onStartReached?: (info: { distanceFromStart: number }) => void
onStartReachedThreshold?: number
onViewableItemsChanged?: (info: {
changed: Array<ViewToken>
viewableItems: Array<ViewToken>
changed: Array<ListViewToken>
viewableItems: Array<ListViewToken>
}) => void
persistentScrollbar?: boolean
progressViewOffset?: number
Expand Down Expand Up @@ -5679,8 +5686,8 @@ declare type ViewabilityConfig = {
declare type ViewabilityConfigCallbackPair = {
viewabilityConfig: ViewabilityConfig
onViewableItemsChanged: (info: {
changed: Array<ViewToken>
viewableItems: Array<ViewToken>
changed: Array<ListViewToken>
viewableItems: Array<ListViewToken>
}) => void
}
declare class ViewabilityHelper_default {
Expand All @@ -5705,10 +5712,10 @@ declare class ViewabilityHelper_default {
index: number,
isViewable: boolean,
props: CellMetricProps,
) => ViewToken,
) => ListViewToken,
onViewableItemsChanged: ($$PARAM_0$$: {
changed: Array<ViewToken>
viewableItems: Array<ViewToken>
changed: Array<ListViewToken>
viewableItems: Array<ListViewToken>
}) => void,
renderRange?: {
first: number
Expand Down Expand Up @@ -5793,13 +5800,6 @@ declare type ViewPropsIOS = {
}
declare type ViewStyle = ____ViewStyle_Internal
declare type ViewStyleProp = ____ViewStyleProp_Internal
declare type ViewToken = {
index: number | undefined
isViewable: boolean
item: any
key: string
section?: any
}
declare type VirtualizedList = typeof VirtualizedList
declare class VirtualizedList_default extends StateSafePureComponent_default<
VirtualizedListProps,
Expand Down Expand Up @@ -6013,8 +6013,8 @@ export {
EventSubscription, // b8d084aa
ExtendedExceptionData, // 5a6ccf5a
FilterFunction, // bf24c0e3
FlatList, // 714df8ad
FlatListProps, // e3e724ea
FlatList, // 4f1b407e
FlatListProps, // b225fb7a
FocusEvent, // 529b43eb
FontVariant, // 7c7558bb
GestureResponderEvent, // b466f6d6
Expand Down Expand Up @@ -6068,6 +6068,7 @@ export {
Linking, // 292de0a0
ListRenderItem, // b5353fd8
ListRenderItemInfo, // e8595b03
ListViewToken, // 833d3481
LogBox, // b58880c6
LogData, // 89af6d4c
MeasureInWindowOnSuccessCallback, // a285f598
Expand Down Expand Up @@ -6151,9 +6152,9 @@ export {
ScrollViewPropsIOS, // d83c9733
ScrollViewScrollToOptions, // 3313411e
SectionBase, // 0ccaedac
SectionList, // cc6dec0b
SectionList, // a1a4786b
SectionListData, // 1c80bb2e
SectionListProps, // 97fcf95a
SectionListProps, // 7fb5371e
SectionListRenderItem, // cffebb53
SectionListRenderItemInfo, // 946c2128
Separators, // 6a45f7e3
Expand Down Expand Up @@ -6218,9 +6219,9 @@ export {
ViewStyle, // c2db0e6e
VirtualViewMode, // 85a69ef6
VirtualizedList, // 4d513939
VirtualizedListProps, // 8efa6d8e
VirtualizedListProps, // be716140
VirtualizedSectionList, // 446ba0df
VirtualizedSectionListProps, // c5e64f83
VirtualizedSectionListProps, // a6899dfb
WrapperComponentProvider, // 9cf3844c
codegenNativeCommands, // e16d62f7
codegenNativeComponent, // ed4c8103
Expand Down
1 change: 1 addition & 0 deletions packages/react-native/index.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ export {default as View} from './Libraries/Components/View/View';
export type {
ListRenderItemInfo,
ListRenderItem,
ListViewToken,
Separators,
VirtualizedListProps,
} from './Libraries/Lists/VirtualizedList';
Expand Down
2 changes: 1 addition & 1 deletion packages/virtualized-lists/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {typeof VirtualizedListContextResetter as VirtualizedListContextResetterT
import {keyExtractor} from './Lists/VirtualizeUtils';

export type {
ViewToken,
ViewToken as ListViewToken,
ViewabilityConfig,
ViewabilityConfigCallbackPair,
ViewabilityConfigCallbackPairs,
Expand Down
Loading