From 49cb7f28c8dee19c2f3f20aaf21bbf91e85fa5e6 Mon Sep 17 00:00:00 2001 From: Moti Zilberman Date: Mon, 17 Oct 2022 06:58:15 -0700 Subject: [PATCH] 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 --- Libraries/Lists/VirtualizedListContext.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Libraries/Lists/VirtualizedListContext.js b/Libraries/Lists/VirtualizedListContext.js index 904947c428f425..bca5724498a356 100644 --- a/Libraries/Lists/VirtualizedListContext.js +++ b/Libraries/Lists/VirtualizedListContext.js @@ -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, + getOutermostParentListRef: () => React.ElementRef, registerAsNestedChild: ({ cellKey: string, - ref: React.ElementRef, + ref: React.ElementRef, }) => void, unregisterAsNestedChild: ({ - ref: React.ElementRef, + ref: React.ElementRef, }) => void, }>;