Skip to content

Commit b634fa1

Browse files
coadofacebook-github-bot
authored andcommitted
Add explicit type for _memoizedRenderer and change React and View import in FlatList (#48798)
Summary: Pull Request resolved: #48798 Changelog: [General][Changed] - Added explicit type for _memoizedRenderer and changed React and View import in FlatList Reviewed By: cortinico Differential Revision: D68417026 fbshipit-source-id: 0af75381f6f8c33be10add940f0791b059de3473
1 parent 4f99f0b commit b634fa1

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

packages/react-native/Libraries/Lists/FlatList.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@ import type {
1919

2020
import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNativeFeatureFlags';
2121
import {type ScrollResponderType} from '../Components/ScrollView/ScrollView';
22+
import View from '../Components/View/View';
2223
import {
2324
VirtualizedList,
2425
keyExtractor as defaultKeyExtractor,
2526
} from '@react-native/virtualized-lists';
2627
import memoizeOne from 'memoize-one';
28+
import React from 'react';
2729

28-
const View = require('../Components/View/View');
2930
const StyleSheet = require('../StyleSheet/StyleSheet');
3031
const deepDiffer = require('../Utilities/differ/deepDiffer');
3132
const Platform = require('../Utilities/Platform');
3233
const invariant = require('invariant');
33-
const React = require('react');
3434

3535
type RequiredProps<ItemT> = {
3636
/**
@@ -672,8 +672,7 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
672672
: {renderItem: renderProp};
673673
};
674674

675-
// $FlowFixMe[missing-local-annot]
676-
_memoizedRenderer = memoizeOne(this._renderer);
675+
_memoizedRenderer: ReturnType<typeof memoizeOne> = memoizeOne(this._renderer);
677676

678677
render(): React.Node {
679678
const {

packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5691,9 +5691,7 @@ declare module.exports: FillRateHelper;
56915691
`;
56925692

56935693
exports[`public API should not change unintentionally Libraries/Lists/FlatList.js 1`] = `
5694-
"declare const View: $FlowFixMe;
5695-
declare const React: $FlowFixMe;
5696-
type RequiredProps<ItemT> = {
5694+
"type RequiredProps<ItemT> = {
56975695
data: ?$ReadOnly<$ArrayLike<ItemT>>,
56985696
};
56995697
type OptionalProps<ItemT> = {
@@ -5782,7 +5780,7 @@ declare class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
57825780
}) => void
57835781
): void;
57845782
_renderer: $FlowFixMe;
5785-
_memoizedRenderer: $FlowFixMe;
5783+
_memoizedRenderer: ReturnType<typeof memoizeOne>;
57865784
render(): React.Node;
57875785
}
57885786
declare module.exports: FlatList;

0 commit comments

Comments
 (0)