From a0d1585cdb5ae86e5d4e5bc51fdfa9ae7e049b4b Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Tue, 20 Sep 2022 05:21:08 -0700 Subject: [PATCH] Move VirtualizedList_EXPERIMENTAL to ES6 import/export Summary: VirtualizedList uses a combination of ES6 and CommonJS imports/exports. This moves fully to ES6 imports and exports, in the experimental version (which should soon replace the original). Changelog: [Internal][Changed] - Move VirtualizedList_EXPERIMENTAL to ES6 import/export Reviewed By: rshest Differential Revision: D39648806 fbshipit-source-id: a5da40f62a6010cd5b9894b02a91af86d3a8b995 --- .../Lists/VirtualizedList_EXPERIMENTAL.js | 55 ++++++++++--------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/Libraries/Lists/VirtualizedList_EXPERIMENTAL.js b/Libraries/Lists/VirtualizedList_EXPERIMENTAL.js index 835a9ebad06..64b91b93940 100644 --- a/Libraries/Lists/VirtualizedList_EXPERIMENTAL.js +++ b/Libraries/Lists/VirtualizedList_EXPERIMENTAL.js @@ -24,34 +24,34 @@ import type { export type {RenderItemProps, RenderItemType, Separators}; +import * as React from 'react'; +import invariant from 'invariant'; + +import RefreshControl from '../Components/RefreshControl/RefreshControl'; +import ScrollView from '../Components/ScrollView/ScrollView'; +import View from '../Components/View/View'; +import Batchinator from '../Interaction/Batchinator'; +import {findNodeHandle} from '../ReactNative/RendererProxy'; +import flattenStyle from '../StyleSheet/flattenStyle'; +import StyleSheet from '../StyleSheet/StyleSheet'; +import clamp from '../Utilities/clamp'; +import infoLog from '../Utilities/infoLog'; + +import {CellRenderMask} from './CellRenderMask'; +import ChildListCollection from './ChildListCollection'; +import StateSafePureComponent from './StateSafePureComponent'; +import FillRateHelper from './FillRateHelper'; +import ViewabilityHelper from './ViewabilityHelper'; +import { + computeWindowedRenderLimits, + keyExtractor as defaultKeyExtractor, +} from './VirtualizeUtils'; +import CellRenderer from './VirtualizedListCellRenderer'; import { VirtualizedListCellContextProvider, VirtualizedListContext, VirtualizedListContextProvider, } from './VirtualizedListContext.js'; -import { - computeWindowedRenderLimits, - keyExtractor as defaultKeyExtractor, -} from './VirtualizeUtils'; -import * as React from 'react'; - -import {CellRenderMask} from './CellRenderMask'; -import ChildListCollection from './ChildListCollection'; -import clamp from '../Utilities/clamp'; -import StateSafePureComponent from './StateSafePureComponent'; -import CellRenderer from './VirtualizedListCellRenderer'; - -const RefreshControl = require('../Components/RefreshControl/RefreshControl'); -const ScrollView = require('../Components/ScrollView/ScrollView'); -const View = require('../Components/View/View'); -const Batchinator = require('../Interaction/Batchinator'); -const {findNodeHandle} = require('../ReactNative/RendererProxy'); -const flattenStyle = require('../StyleSheet/flattenStyle'); -const StyleSheet = require('../StyleSheet/StyleSheet'); -const infoLog = require('../Utilities/infoLog'); -const FillRateHelper = require('./FillRateHelper'); -const ViewabilityHelper = require('./ViewabilityHelper'); -const invariant = require('invariant'); const ON_END_REACHED_EPSILON = 0.001; @@ -150,8 +150,12 @@ function findLastWhere( * - As an effort to remove defaultProps, use helper functions when referencing certain props * */ -class VirtualizedList extends StateSafePureComponent { +export default class VirtualizedList extends StateSafePureComponent< + Props, + State, +> { static contextType: typeof VirtualizedListContext = VirtualizedListContext; + displayName: 'VirtualizedList_EXPERIMENTAL'; // scrollToEnd may be janky without getItemLayout prop scrollToEnd(params?: ?{animated?: ?boolean, ...}) { @@ -1876,6 +1880,3 @@ const styles = StyleSheet.create({ borderWidth: 2, }, }); - -VirtualizedList.displayName = 'VirtualizedList_EXPERIMENTAL'; -module.exports = VirtualizedList;