[react-native] update Lists props to match flow Maybe Types. (#41804)

This commit is contained in:
Kelvin Chu
2020-01-23 09:58:54 -08:00
committed by Ben Lichtman
parent 365d3c585b
commit ae8cb31ff0
+16 -17
View File
@@ -52,7 +52,6 @@
/// <reference path="Devtools.d.ts" />
/// <reference path="LaunchScreen.d.ts" />
import * as PropTypes from 'prop-types';
import * as React from 'react';
type Constructor<T> = new (...args: any[]) => T;
@@ -3883,12 +3882,12 @@ export interface FlatListProps<ItemT> extends VirtualizedListProps<ItemT> {
* Remember to include separator length (height or width) in your offset calculation if you specify
* `ItemSeparatorComponent`.
*/
getItemLayout?: (data: Array<ItemT> | null, index: number) => { length: number; offset: number; index: number };
getItemLayout?: (data: Array<ItemT> | null | undefined, index: number) => { length: number; offset: number; index: number };
/**
* If true, renders items next to each other horizontally instead of stacked vertically.
*/
horizontal?: boolean;
horizontal?: boolean | null;
/**
* How many items to render in the initial batch
@@ -3898,7 +3897,7 @@ export interface FlatListProps<ItemT> extends VirtualizedListProps<ItemT> {
/**
* Instead of starting at the top with the first item, start at initialScrollIndex
*/
initialScrollIndex?: number;
initialScrollIndex?: number | null;
/**
* Used to extract a unique key for a given item at the specified index. Key is used for caching
@@ -3960,7 +3959,7 @@ export interface FlatListProps<ItemT> extends VirtualizedListProps<ItemT> {
* ```
* Provides additional metadata like `index` if you need it.
*/
renderItem: ListRenderItem<ItemT>;
renderItem: ListRenderItem<ItemT> | null | undefined;
/**
* See `ViewabilityHelper` for flow type and further documentation.
@@ -4107,7 +4106,7 @@ export interface SectionListProps<ItemT> extends VirtualizedListWithoutRenderIte
/**
* Reverses the direction of scroll. Uses scale transforms of -1.
*/
inverted?: boolean;
inverted?: boolean | null;
/**
* Used to extract a unique key for a given item at the specified index. Key is used for caching
@@ -4250,7 +4249,7 @@ export interface SectionListStatic<SectionT> extends React.ComponentClass<Sectio
* @see https://facebook.github.io/react-native/docs/virtualizedlist.html#props
*/
export interface VirtualizedListProps<ItemT> extends VirtualizedListWithoutRenderItemProps<ItemT> {
renderItem: ListRenderItem<ItemT>;
renderItem: ListRenderItem<ItemT> | null | undefined;
}
export interface VirtualizedListWithoutRenderItemProps<ItemT> extends ScrollViewProps {
@@ -4317,7 +4316,7 @@ export interface VirtualizedListWithoutRenderItemProps<ItemT> extends ScrollView
index: number;
};
horizontal?: boolean;
horizontal?: boolean | null;
/**
* How many items to render in the initial batch. This should be enough to fill the screen but not
@@ -4332,12 +4331,12 @@ export interface VirtualizedListWithoutRenderItemProps<ItemT> extends ScrollView
* always rendered and immediately renders the items starting at this initial index. Requires
* `getItemLayout` to be implemented.
*/
initialScrollIndex?: number;
initialScrollIndex?: number | null;
/**
* Reverses the direction of scroll. Uses scale transforms of -1.
*/
inverted?: boolean;
inverted?: boolean | null;
keyExtractor?: (item: ItemT, index: number) => string;
@@ -6199,7 +6198,7 @@ export interface ScrollViewProps extends ViewProps, ScrollViewPropsIOS, ScrollVi
* When true the scroll view's children are arranged horizontally in a row
* instead of vertically in a column. The default value is false.
*/
horizontal?: boolean;
horizontal?: boolean | null;
/**
* If sticky headers should stick at the bottom instead of the top of the
@@ -6584,13 +6583,13 @@ export interface ActionSheetIOSStatic {
export type ShareContent =
| {
title?: string;
message: string;
}
title?: string;
message: string;
}
| {
title?: string;
url: string;
};
title?: string;
url: string;
};
export type ShareOptions = {
dialogTitle?: string;