From 39c338ff8d3a65ec3f7a45f0b8319f70115e2fc1 Mon Sep 17 00:00:00 2001 From: "SamChou19815 (Meta Employee)" Date: Fri, 16 Aug 2024 16:37:25 -0700 Subject: [PATCH] Eliminate a few React.Element type that will be synced to react-native (#30719) Summary: ## Summary Flow will eventually remove the specific `React.Element` type. For most of the code, it can be replaced with `React.MixedElement` or `React.Node`. When specific react elements are required, it needs to be replaced with either `React$Element` which will trigger a `internal-type` lint error that can be disabled project-wide, or use `ExactReactElement_DEPRECATED`. Fortunately in this case, this one can be replaced with just `React.MixedElement`. ## How did you test this change? `flow` DiffTrain build for commit https://github.com/facebook/react/commit/85fb95cdffdd95f2f908ee71974cae06b1c866e1. bypass-github-export-checks Reviewed By: poteto Differential Revision: D61397212 Pulled By: SamChou19815 fbshipit-source-id: c0aa5a4ed3922f88b7e557738f76f872c02a9d07 --- .../Libraries/Renderer/shims/ReactNativeTypes.js | 13 +++++++++---- .../__tests__/__snapshots__/public-api-test.js.snap | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/react-native/Libraries/Renderer/shims/ReactNativeTypes.js b/packages/react-native/Libraries/Renderer/shims/ReactNativeTypes.js index d168d771f41..cc70a909932 100644 --- a/packages/react-native/Libraries/Renderer/shims/ReactNativeTypes.js +++ b/packages/react-native/Libraries/Renderer/shims/ReactNativeTypes.js @@ -7,10 +7,15 @@ * @noformat * @nolint * @flow strict - * @generated SignedSource<<4405023a5d82ddc01db31d8eb46a7aa0>> + * @generated SignedSource<<89361333bb6b688486e35849a9c669a6>> */ -import type {ElementRef, ElementType, Element, AbstractComponent} from 'react'; +import type { + ElementRef, + ElementType, + MixedElement, + AbstractComponent, +} from 'react'; export type MeasureOnSuccessCallback = ( x: number, @@ -222,7 +227,7 @@ export type ReactNativeType = { eventType: string, ): void, render( - element: Element, + element: MixedElement, containerTag: number, callback: ?() => void, options: ?RenderRootOptions, @@ -257,7 +262,7 @@ export type ReactFabricType = { eventType: string, ): void, render( - element: Element, + element: MixedElement, containerTag: number, callback: ?() => void, concurrentRoot: ?boolean, diff --git a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap index d9e710d98d4..542cc721c82 100644 --- a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap +++ b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap @@ -7912,7 +7912,7 @@ export type ReactNativeType = { eventType: string ): void, render( - element: Element, + element: MixedElement, containerTag: number, callback: ?() => void, options: ?RenderRootOptions @@ -7945,7 +7945,7 @@ export type ReactFabricType = { eventType: string ): void, render( - element: Element, + element: MixedElement, containerTag: number, callback: ?() => void, concurrentRoot: ?boolean,