diff --git a/Libraries/Lists/FlatList.js b/Libraries/Lists/FlatList.js index 46f99c7603efa4..fa0bd25008b7e6 100644 --- a/Libraries/Lists/FlatList.js +++ b/Libraries/Lists/FlatList.js @@ -433,6 +433,7 @@ class FlatList extends React.PureComponent, void> { } } + // $FlowFixMe[missing-local-annot] componentDidUpdate(prevProps: Props) { invariant( prevProps.numColumns === this.props.numColumns, @@ -463,6 +464,7 @@ class FlatList extends React.PureComponent, void> { this._listRef = ref; }; + // $FlowFixMe[missing-local-annot] _checkProps(props: Props) { const { // $FlowFixMe[prop-missing] this prop doesn't exist, is only used for an invariant @@ -494,6 +496,7 @@ class FlatList extends React.PureComponent, void> { ); } + // $FlowFixMe[missing-local-annot] _getItem = (data: Array, index: number) => { const numColumns = numColumnsOrDefault(this.props.numColumns); if (numColumns > 1) { @@ -520,6 +523,7 @@ class FlatList extends React.PureComponent, void> { } }; + // $FlowFixMe[missing-local-annot] _keyExtractor = (items: ItemT | Array, index: number) => { const numColumns = numColumnsOrDefault(this.props.numColumns); const keyExtractor = this.props.keyExtractor ?? defaultKeyExtractor; @@ -561,6 +565,7 @@ class FlatList extends React.PureComponent, void> { changed: Array, ... }) => void, + // $FlowFixMe[missing-local-annot] ) { return (info: { viewableItems: Array, @@ -590,6 +595,7 @@ class FlatList extends React.PureComponent, void> { columnWrapperStyle: ?ViewStyleProp, numColumns: ?number, extraData: ?any, + // $FlowFixMe[missing-local-annot] ) => { const cols = numColumnsOrDefault(numColumns); @@ -651,6 +657,7 @@ class FlatList extends React.PureComponent, void> { }; }; + // $FlowFixMe[missing-local-annot] _memoizedRenderer = memoizeOne(this._renderer); render(): React.Node { diff --git a/Libraries/Lists/VirtualizedList.js b/Libraries/Lists/VirtualizedList.js index 07f705fdd28c7f..9ef2fb2b9d2cf5 100644 --- a/Libraries/Lists/VirtualizedList.js +++ b/Libraries/Lists/VirtualizedList.js @@ -182,7 +182,7 @@ class VirtualizedList extends React.PureComponent { viewOffset?: number, viewPosition?: number, ... - }) { + }): $FlowFixMe { const { data, horizontal, @@ -369,6 +369,7 @@ class VirtualizedList extends React.PureComponent { }; } + // $FlowFixMe[missing-local-annot] _getScrollMetrics = () => { return this._scrollMetrics; }; @@ -377,6 +378,7 @@ class VirtualizedList extends React.PureComponent { return this._hasMore; } + // $FlowFixMe[missing-local-annot] _getOutermostParentListRef = () => { if (this._isNestedWithSameOrientation()) { return this.context.getOutermostParentListRef(); @@ -631,6 +633,7 @@ class VirtualizedList extends React.PureComponent { _getSpacerKey = (isVertical: boolean): string => isVertical ? 'height' : 'width'; + // $FlowFixMe[missing-local-annot] _keyExtractor(item: Item, index: number) { if (this.props.keyExtractor != null) { return this.props.keyExtractor(item, index); @@ -985,6 +988,7 @@ class VirtualizedList extends React.PureComponent { > = new Map(); _offsetFromParentVirtualizedList: number = 0; _prevParentOffset: number = 0; + // $FlowFixMe[missing-local-annot] _scrollMetrics = { contentLength: 0, dOffset: 0, @@ -1016,6 +1020,7 @@ class VirtualizedList extends React.PureComponent { ); } + // $FlowFixMe[missing-local-annot] _getCellsInItemCount = (props: Props) => { const {getCellsInItemCount, data} = props; if (getCellsInItemCount) { @@ -1231,6 +1236,7 @@ class VirtualizedList extends React.PureComponent { this._headerLength = this._selectLength(e.nativeEvent.layout); }; + // $FlowFixMe[missing-local-annot] _renderDebugOverlay() { const normalize = this._scrollMetrics.visibleLength / @@ -1376,7 +1382,7 @@ class VirtualizedList extends React.PureComponent { visibleLength: number, offset: number, ... - }) => { + }): $FlowFixMe => { // Offset of the top of the nested list relative to the top of its parent's viewport const offset = metrics.offset - this._offsetFromParentVirtualizedList; // Child's visible length is the same as its parent's @@ -1653,6 +1659,7 @@ class VirtualizedList extends React.PureComponent { }); }; + // $FlowFixMe[missing-local-annot] _createViewToken = (index: number, isViewable: boolean) => { const {data, getItem} = this.props; const item = getItem(data, index); @@ -1770,6 +1777,7 @@ class CellRenderer extends React.Component< CellRendererProps, CellRendererState, > { + // $FlowFixMe[missing-local-annot] state = { separatorProps: { highlighted: false, @@ -1791,6 +1799,7 @@ class CellRenderer extends React.Component< // TODO: consider factoring separator stuff out of VirtualizedList into FlatList since it's not // reused by SectionList and we can keep VirtualizedList simpler. + // $FlowFixMe[missing-local-annot] _separators = { highlight: () => { const {cellKey, prevCellKey} = this.props; @@ -1837,6 +1846,7 @@ class CellRenderer extends React.Component< ListItemComponent: any, item: any, index: any, + // $FlowFixMe[missing-local-annot] ) { if (renderItem && ListItemComponent) { console.warn( @@ -1882,6 +1892,7 @@ class CellRenderer extends React.Component< ); } + // $FlowFixMe[missing-local-annot] render() { const { CellRendererComponent, diff --git a/Libraries/Lists/VirtualizedList_EXPERIMENTAL.js b/Libraries/Lists/VirtualizedList_EXPERIMENTAL.js index cb79424dfbecdb..f3c834e09e36f4 100644 --- a/Libraries/Lists/VirtualizedList_EXPERIMENTAL.js +++ b/Libraries/Lists/VirtualizedList_EXPERIMENTAL.js @@ -202,7 +202,7 @@ class VirtualizedList extends React.PureComponent { viewOffset?: number, viewPosition?: number, ... - }) { + }): $FlowFixMe { const { data, horizontal, @@ -389,6 +389,7 @@ class VirtualizedList extends React.PureComponent { }; } + // $FlowFixMe[missing-local-annot] _getScrollMetrics = () => { return this._scrollMetrics; }; @@ -397,6 +398,7 @@ class VirtualizedList extends React.PureComponent { return this._hasMore; } + // $FlowFixMe[missing-local-annot] _getOutermostParentListRef = () => { if (this._isNestedWithSameOrientation()) { return this.context.getOutermostParentListRef(); @@ -849,6 +851,7 @@ class VirtualizedList extends React.PureComponent { keyExtractor?: ?(item: Item, index: number) => string, ... }, + // $FlowFixMe[missing-local-annot] ) { if (props.keyExtractor != null) { return props.keyExtractor(item, index); @@ -1180,6 +1183,7 @@ class VirtualizedList extends React.PureComponent { > = new Map(); _offsetFromParentVirtualizedList: number = 0; _prevParentOffset: number = 0; + // $FlowFixMe[missing-local-annot] _scrollMetrics = { contentLength: 0, dOffset: 0, @@ -1211,6 +1215,7 @@ class VirtualizedList extends React.PureComponent { ); } + // $FlowFixMe[missing-local-annot] _getCellsInItemCount = (props: Props) => { const {getCellsInItemCount, data} = props; if (getCellsInItemCount) { @@ -1442,6 +1447,7 @@ class VirtualizedList extends React.PureComponent { this._headerLength = this._selectLength(e.nativeEvent.layout); }; + // $FlowFixMe[missing-local-annot] _renderDebugOverlay() { const normalize = this._scrollMetrics.visibleLength / @@ -1593,7 +1599,7 @@ class VirtualizedList extends React.PureComponent { visibleLength: number, offset: number, ... - }) => { + }): $FlowFixMe => { // Offset of the top of the nested list relative to the top of its parent's viewport const offset = metrics.offset - this._offsetFromParentVirtualizedList; // Child's visible length is the same as its parent's @@ -1797,6 +1803,7 @@ class VirtualizedList extends React.PureComponent { index: number, isViewable: boolean, props: FrameMetricProps, + // $FlowFixMe[missing-local-annot] ) => { const {data, getItem} = props; const item = getItem(data, index); @@ -1986,6 +1993,7 @@ class CellRenderer extends React.Component< CellRendererProps, CellRendererState, > { + // $FlowFixMe[missing-local-annot] state = { separatorProps: { highlighted: false, @@ -2007,6 +2015,7 @@ class CellRenderer extends React.Component< // TODO: consider factoring separator stuff out of VirtualizedList into FlatList since it's not // reused by SectionList and we can keep VirtualizedList simpler. + // $FlowFixMe[missing-local-annot] _separators = { highlight: () => { const {cellKey, prevCellKey} = this.props; @@ -2053,6 +2062,7 @@ class CellRenderer extends React.Component< ListItemComponent: any, item: any, index: any, + // $FlowFixMe[missing-local-annot] ) { if (renderItem && ListItemComponent) { console.warn( @@ -2098,6 +2108,7 @@ class CellRenderer extends React.Component< ); } + // $FlowFixMe[missing-local-annot] render() { const { CellRendererComponent, diff --git a/Libraries/Lists/VirtualizedSectionList.js b/Libraries/Lists/VirtualizedSectionList.js index ffeb45450f4262..f441a85c25e06e 100644 --- a/Libraries/Lists/VirtualizedSectionList.js +++ b/Libraries/Lists/VirtualizedSectionList.js @@ -237,6 +237,7 @@ class VirtualizedSectionList< return null; } + // $FlowFixMe[missing-local-annot] _keyExtractor = (item: Item, index: number) => { const info = this._subExtractor(index); return (info && info.key) || String(index); @@ -340,7 +341,7 @@ class VirtualizedSectionList< }; _renderItem = - (listItemCount: number) => + (listItemCount: number): $FlowFixMe => // eslint-disable-next-line react/no-unstable-nested-components ({ item, diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-basic.js b/packages/rn-tester/js/examples/FlatList/FlatList-basic.js index 704be0ae1c27a1..32a613892b94e7 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-basic.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-basic.js @@ -97,11 +97,14 @@ class FlatListExample extends React.PureComponent { this._listRef.scrollToIndex({viewPosition: 0.5, index: Number(text)}); }; + // $FlowFixMe[missing-local-annot] _scrollPos = new Animated.Value(0); + // $FlowFixMe[missing-local-annot] _scrollSinkX = Animated.event( [{nativeEvent: {contentOffset: {x: this._scrollPos}}}], {useNativeDriver: true}, ); + // $FlowFixMe[missing-local-annot] _scrollSinkY = Animated.event( [{nativeEvent: {contentOffset: {y: this._scrollPos}}}], {useNativeDriver: true}, @@ -271,6 +274,7 @@ class FlatListExample extends React.PureComponent { ) => { this._listRef = ref; }; + // $FlowFixMe[missing-local-annot] _getItemLayout = (data: any, index: number) => { return getItemLayout(data, index, this.state.horizontal); }; @@ -282,13 +286,16 @@ class FlatListExample extends React.PureComponent { data: state.data.concat(genItemData(100, state.data.length)), })); }; + // $FlowFixMe[missing-local-annot] _onPressCallback = () => { const {onPressDisabled} = this.state; const warning = () => console.log('onPress disabled'); const onPressAction = onPressDisabled ? warning : this._pressItem; return onPressAction; }; + // $FlowFixMe[missing-local-annot] _onRefresh = () => Alert.alert('onRefresh: nothing to refresh :P'); + // $FlowFixMe[missing-local-annot] _renderItemComponent = () => { const flatListPropKey = this.state.useFlatListItemComponent ? 'ListItemComponent' diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-multiColumn.js b/packages/rn-tester/js/examples/FlatList/FlatList-multiColumn.js index e0bf2fb4e5eeed..ca875072eda9c5 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-multiColumn.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-multiColumn.js @@ -152,7 +152,7 @@ class MultiColumnExample extends React.PureComponent< item: Item, accessibilityCollectionItem: AccessibilityCollectionItem, ... - }) => { + }): $FlowFixMe => { return (