mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add missing VirtualizedList Imperative Types
Summary: Adds some imperative VirtualizedList methods to the TS types which are documented on the website and are public enough. Also explicitly add `viewOffset` to `scrollToItem` since `scrollToItem` params are indefinite in flow and are passed to `scrollToIndex` (which supports the prop). Changelog: [General][Fixed] - Add missing VirtualizedList Imperative Types Reviewed By: GijsWeterings Differential Revision: D42047674 fbshipit-source-id: 60f7b35b049853d9fcb724918b3a0008a75ea573
This commit is contained in:
committed by
Facebook GitHub Bot
parent
8d6e2f86f5
commit
621969b8d8
Vendored
+1
@@ -206,6 +206,7 @@ export class FlatList<ItemT = any> extends React.Component<
|
||||
scrollToItem: (params: {
|
||||
animated?: boolean | null | undefined;
|
||||
item: ItemT;
|
||||
viewOffset?: number | undefined;
|
||||
viewPosition?: number | undefined;
|
||||
}) => void;
|
||||
|
||||
|
||||
@@ -334,6 +334,7 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
|
||||
scrollToItem(params: {
|
||||
animated?: ?boolean,
|
||||
item: ItemT,
|
||||
viewOffset?: number,
|
||||
viewPosition?: number,
|
||||
...
|
||||
}) {
|
||||
|
||||
Vendored
+14
-1
@@ -11,7 +11,12 @@ import type * as React from 'react';
|
||||
import type {LayoutChangeEvent} from '../../types';
|
||||
import {StyleProp} from '../StyleSheet/StyleSheet';
|
||||
import {ViewStyle} from '../StyleSheet/StyleSheetTypes';
|
||||
import type {ScrollViewProps} from '../Components/ScrollView/ScrollView';
|
||||
import type {
|
||||
ScrollResponderMixin,
|
||||
ScrollView,
|
||||
ScrollViewProps,
|
||||
} from '../Components/ScrollView/ScrollView';
|
||||
import type {View} from '../Components/View/View';
|
||||
|
||||
export interface ViewToken {
|
||||
item: any;
|
||||
@@ -98,6 +103,7 @@ export class VirtualizedList<ItemT> extends React.Component<
|
||||
scrollToItem: (params: {
|
||||
animated?: boolean | undefined;
|
||||
item: ItemT;
|
||||
viewOffset?: number | undefined;
|
||||
viewPosition?: number | undefined;
|
||||
}) => void;
|
||||
|
||||
@@ -113,6 +119,13 @@ export class VirtualizedList<ItemT> extends React.Component<
|
||||
}) => void;
|
||||
|
||||
recordInteraction: () => void;
|
||||
|
||||
getScrollRef: () =>
|
||||
| React.ElementRef<typeof ScrollView>
|
||||
| React.ElementRef<typeof View>
|
||||
| null;
|
||||
|
||||
getScrollResponder: () => ScrollResponderMixin | null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -263,6 +263,7 @@ export default class VirtualizedList extends StateSafePureComponent<
|
||||
scrollToItem(params: {
|
||||
animated?: ?boolean,
|
||||
item: Item,
|
||||
viewOffset?: number,
|
||||
viewPosition?: number,
|
||||
...
|
||||
}) {
|
||||
|
||||
Reference in New Issue
Block a user