mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
[flow] Eliminate a few React.Element type that will be synced to react-native (#30719)
## 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`
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
import type {ReactPortal, ReactNodeList} from 'shared/ReactTypes';
|
||||
import type {ElementRef, Element, ElementType} from 'react';
|
||||
import type {ElementRef, ElementType, MixedElement} from 'react';
|
||||
import type {FiberRoot} from 'react-reconciler/src/ReactInternalTypes';
|
||||
import type {RenderRootOptions} from './ReactNativeTypes';
|
||||
|
||||
@@ -117,7 +117,7 @@ function nativeOnCaughtError(
|
||||
}
|
||||
|
||||
function render(
|
||||
element: Element<ElementType>,
|
||||
element: MixedElement,
|
||||
containerTag: number,
|
||||
callback: ?() => void,
|
||||
options: ?RenderRootOptions,
|
||||
|
||||
+8
-3
@@ -9,7 +9,12 @@
|
||||
* @flow strict
|
||||
*/
|
||||
|
||||
import type {ElementRef, ElementType, Element, AbstractComponent} from 'react';
|
||||
import type {
|
||||
ElementRef,
|
||||
ElementType,
|
||||
MixedElement,
|
||||
AbstractComponent,
|
||||
} from 'react';
|
||||
|
||||
export type MeasureOnSuccessCallback = (
|
||||
x: number,
|
||||
@@ -221,7 +226,7 @@ export type ReactNativeType = {
|
||||
eventType: string,
|
||||
): void,
|
||||
render(
|
||||
element: Element<ElementType>,
|
||||
element: MixedElement,
|
||||
containerTag: number,
|
||||
callback: ?() => void,
|
||||
options: ?RenderRootOptions,
|
||||
@@ -256,7 +261,7 @@ export type ReactFabricType = {
|
||||
eventType: string,
|
||||
): void,
|
||||
render(
|
||||
element: Element<ElementType>,
|
||||
element: MixedElement,
|
||||
containerTag: number,
|
||||
callback: ?() => void,
|
||||
concurrentRoot: ?boolean,
|
||||
|
||||
@@ -15,6 +15,7 @@ export type AbstractComponent<
|
||||
> = React$AbstractComponent<Config, Instance>;
|
||||
export type ElementType = React$ElementType;
|
||||
export type Element<+C> = React$Element<C>;
|
||||
export type MixedElement = React$Element<ElementType>;
|
||||
export type Key = React$Key;
|
||||
export type Ref<C> = React$Ref<C>;
|
||||
export type Node = React$Node;
|
||||
|
||||
Reference in New Issue
Block a user