mirror of
https://github.com/react/react-native.git
synced 2026-09-30 17:29:41 +08:00
Expose ListViewToken type as root export (#53539)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53539 Resolves https://github.com/react-native-community/discussions-and-proposals/discussions/893#discussioncomment-14190663. Changelog: [General][Added] - `ListViewToken` is now exposed when using `"react-native-strict-api"` Reviewed By: rshest Differential Revision: D81380882 fbshipit-source-id: 1da5c50eaec2f8dc4a8cde60e7441249556053a8
This commit is contained in:
committed by
Facebook GitHub Bot
parent
46278e30e3
commit
0a0b48b5ff
+8
-8
@@ -13,8 +13,8 @@ import type {ViewStyleProp} from '../StyleSheet/StyleSheet';
|
||||
import type {
|
||||
ListRenderItem,
|
||||
ListRenderItemInfo,
|
||||
ListViewToken,
|
||||
ViewabilityConfigCallbackPair,
|
||||
ViewToken,
|
||||
VirtualizedListProps,
|
||||
} from '@react-native/virtualized-lists';
|
||||
|
||||
@@ -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) => {
|
||||
@@ -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),
|
||||
);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
'use strict';
|
||||
|
||||
export type {
|
||||
ViewToken,
|
||||
ListViewToken as ViewToken,
|
||||
ViewabilityConfig,
|
||||
ViewabilityConfigCallbackPair,
|
||||
} from '@react-native/virtualized-lists';
|
||||
|
||||
@@ -19,6 +19,7 @@ const VirtualizedListComponent: VirtualizedListType =
|
||||
export type {
|
||||
ListRenderItemInfo,
|
||||
ListRenderItem,
|
||||
ListViewToken,
|
||||
Separators,
|
||||
VirtualizedListProps,
|
||||
} from '@react-native/virtualized-lists';
|
||||
|
||||
+22
-21
@@ -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.
|
||||
*/
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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 {
|
||||
@@ -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
|
||||
@@ -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,
|
||||
@@ -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
|
||||
@@ -6068,6 +6068,7 @@ export {
|
||||
Linking, // 292de0a0
|
||||
ListRenderItem, // b5353fd8
|
||||
ListRenderItemInfo, // e8595b03
|
||||
ListViewToken, // 833d3481
|
||||
LogBox, // b58880c6
|
||||
LogData, // 89af6d4c
|
||||
MeasureInWindowOnSuccessCallback, // a285f598
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -184,6 +184,7 @@ export {default as View} from './Libraries/Components/View/View';
|
||||
export type {
|
||||
ListRenderItemInfo,
|
||||
ListRenderItem,
|
||||
ListViewToken,
|
||||
Separators,
|
||||
VirtualizedListProps,
|
||||
} from './Libraries/Lists/VirtualizedList';
|
||||
|
||||
@@ -19,7 +19,7 @@ import {typeof VirtualizedListContextResetter as VirtualizedListContextResetterT
|
||||
import {keyExtractor} from './Lists/VirtualizeUtils';
|
||||
|
||||
export type {
|
||||
ViewToken,
|
||||
ViewToken as ListViewToken,
|
||||
ViewabilityConfig,
|
||||
ViewabilityConfigCallbackPair,
|
||||
ViewabilityConfigCallbackPairs,
|
||||
|
||||
Reference in New Issue
Block a user