Break runtime cycle between VirtualizedList and VirtualizedListContext

Summary:
Breaks the runtime dependency cycle introduced in D40259791 (https://github.com/facebook/react-native/commit/971599317b7bdf1152157206f9503a23ac8c4162) by converting a value import to a type import. (Unlike runtime dependency cycles, type-level cycles are OK as long as they are reasonably small.)

Changelog:
[General][Fixed] - Fix require cycle warning in VirtualizedList

Reviewed By: javache

Differential Revision: D40412019

fbshipit-source-id: 33bf3af12be64a1932549a0d11f2ce8b3c483218
This commit is contained in:
Moti Zilberman
2022-10-17 06:58:15 -07:00
committed by Facebook GitHub Bot
parent 9fb3700d35
commit 49cb7f28c8
+5 -4
View File
@@ -8,7 +8,8 @@
* @format
*/
import VirtualizedList from './VirtualizedList';
import typeof VirtualizedList from './VirtualizedList';
import * as React from 'react';
import {useContext, useMemo} from 'react';
@@ -25,13 +26,13 @@ type Context = $ReadOnly<{
zoomScale: number,
},
horizontal: ?boolean,
getOutermostParentListRef: () => React.ElementRef<typeof VirtualizedList>,
getOutermostParentListRef: () => React.ElementRef<VirtualizedList>,
registerAsNestedChild: ({
cellKey: string,
ref: React.ElementRef<typeof VirtualizedList>,
ref: React.ElementRef<VirtualizedList>,
}) => void,
unregisterAsNestedChild: ({
ref: React.ElementRef<typeof VirtualizedList>,
ref: React.ElementRef<VirtualizedList>,
}) => void,
}>;