Skip to content

Commit

Permalink
[flow] Eliminate a few React.Element type that will be synced to reac…
Browse files Browse the repository at this point in the history
…t-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`

DiffTrain build for commit 85fb95c.
  • Loading branch information
SamChou19815 committed Aug 16, 2024
1 parent 220e25c commit 99d43a1
Show file tree
Hide file tree
Showing 15 changed files with 53 additions and 48 deletions.
2 changes: 1 addition & 1 deletion compiled-rn/VERSION_NATIVE_FB
Original file line number Diff line number Diff line change
@@ -1 +1 @@
19.0.0-native-fb-7e8a06cf-20240815
19.0.0-native-fb-85fb95cd-20240816
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<709784b8044777eadcd1169a6cb4e85c>>
* @generated SignedSource<<7279cc9cb0c567689cd8628192884a45>>
*/

"use strict";
Expand Down Expand Up @@ -14925,11 +14925,11 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.0.0-native-fb-7e8a06cf-20240815",
version: "19.0.0-native-fb-85fb95cd-20240816",
rendererPackageName: "react-test-renderer",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getInstanceFromNode,
reconcilerVersion: "19.0.0-native-fb-7e8a06cf-20240815"
reconcilerVersion: "19.0.0-native-fb-85fb95cd-20240816"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -15074,5 +15074,5 @@ __DEV__ &&
flushSyncWorkAcrossRoots_impl(!0));
}
};
exports.version = "19.0.0-native-fb-7e8a06cf-20240815";
exports.version = "19.0.0-native-fb-85fb95cd-20240816";
})();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<35e0b6f59493e93296e377a87335df79>>
* @generated SignedSource<<f93ded983c0e058b6160eeea8002fb2b>>
*/

"use strict";
Expand Down Expand Up @@ -9311,14 +9311,14 @@ function wrapFiber(fiber) {
}
var internals$jscomp$inline_1206 = {
bundleType: 0,
version: "19.0.0-native-fb-7e8a06cf-20240815",
version: "19.0.0-native-fb-85fb95cd-20240816",
rendererPackageName: "react-test-renderer",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: function (mockNode) {
mockNode = nodeToInstanceMap.get(mockNode);
return void 0 !== mockNode ? mockNode.internalInstanceHandle : null;
},
reconcilerVersion: "19.0.0-native-fb-7e8a06cf-20240815"
reconcilerVersion: "19.0.0-native-fb-85fb95cd-20240816"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1207 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -9454,4 +9454,4 @@ exports.unstable_batchedUpdates = function (fn, a) {
flushSyncWorkAcrossRoots_impl(!0));
}
};
exports.version = "19.0.0-native-fb-7e8a06cf-20240815";
exports.version = "19.0.0-native-fb-85fb95cd-20240816";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<5f2ca724c7c6335f8cf5b28a36cf936b>>
* @generated SignedSource<<50157bb7f5e72acdd5d8b76294beb6ab>>
*/

"use strict";
Expand Down Expand Up @@ -9924,14 +9924,14 @@ function wrapFiber(fiber) {
}
var internals$jscomp$inline_1115 = {
bundleType: 0,
version: "19.0.0-native-fb-7e8a06cf-20240815",
version: "19.0.0-native-fb-85fb95cd-20240816",
rendererPackageName: "react-test-renderer",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: function (mockNode) {
mockNode = nodeToInstanceMap.get(mockNode);
return void 0 !== mockNode ? mockNode.internalInstanceHandle : null;
},
reconcilerVersion: "19.0.0-native-fb-7e8a06cf-20240815",
reconcilerVersion: "19.0.0-native-fb-85fb95cd-20240816",
getLaneLabelMap: function () {
for (
var map = new Map(), lane = 1, index$148 = 0;
Expand Down Expand Up @@ -10082,4 +10082,4 @@ exports.unstable_batchedUpdates = function (fn, a) {
flushSyncWorkAcrossRoots_impl(!0));
}
};
exports.version = "19.0.0-native-fb-7e8a06cf-20240815";
exports.version = "19.0.0-native-fb-85fb95cd-20240816";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<340eac70a970c418f335628535538be3>>
* @generated SignedSource<<2697e41c55d1866d04836c51a06c52bf>>
*/

"use strict";
Expand Down Expand Up @@ -1705,7 +1705,7 @@ __DEV__ &&
exports.useTransition = function () {
return resolveDispatcher().useTransition();
};
exports.version = "19.0.0-native-fb-7e8a06cf-20240815";
exports.version = "19.0.0-native-fb-85fb95cd-20240816";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<f9c75d83123822d0402c69efbfb87dfe>>
* @generated SignedSource<<e8846187b700366c72c3aeea8e79b0b1>>
*/

"use strict";
Expand Down Expand Up @@ -580,4 +580,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-native-fb-7e8a06cf-20240815";
exports.version = "19.0.0-native-fb-85fb95cd-20240816";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<a84757798efc294e9c41e96a3f6dc537>>
* @generated SignedSource<<773244388c4236148bc51141ce2815c7>>
*/

"use strict";
Expand Down Expand Up @@ -584,7 +584,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-native-fb-7e8a06cf-20240815";
exports.version = "19.0.0-native-fb-85fb95cd-20240816";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7e8a06cf4c628be45171da52c1a8e97f9869b7ee
85fb95cdffdd95f2f908ee71974cae06b1c866e1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<72d78919ee72618db0d4a8cd8b3bfb26>>
* @generated SignedSource<<78375cf6fe95ac987318d3ca5093a46d>>
*/

"use strict";
Expand Down Expand Up @@ -16916,11 +16916,11 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.0.0-native-fb-7e8a06cf-20240815",
version: "19.0.0-native-fb-85fb95cd-20240816",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getInstanceFromNode,
reconcilerVersion: "19.0.0-native-fb-7e8a06cf-20240815"
reconcilerVersion: "19.0.0-native-fb-85fb95cd-20240816"
};
null !== extraDevToolsConfig &&
(internals.rendererConfig = extraDevToolsConfig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<9bb282155807973f9b66c87edc348406>>
* @generated SignedSource<<7dc17b736e49db59c513530d9e7caf39>>
*/

"use strict";
Expand Down Expand Up @@ -10816,11 +10816,11 @@ batchedUpdatesImpl = function (fn, a) {
var roots = new Map(),
internals$jscomp$inline_1144 = {
bundleType: 0,
version: "19.0.0-native-fb-7e8a06cf-20240815",
version: "19.0.0-native-fb-85fb95cd-20240816",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getInstanceFromNode,
reconcilerVersion: "19.0.0-native-fb-7e8a06cf-20240815"
reconcilerVersion: "19.0.0-native-fb-85fb95cd-20240816"
};
null !== extraDevToolsConfig &&
(internals$jscomp$inline_1144.rendererConfig = extraDevToolsConfig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<552cec6ba214a5af386fd4fc2752f29f>>
* @generated SignedSource<<a1fd10fcd0f1d5cb3064389dafb8077c>>
*/

"use strict";
Expand Down Expand Up @@ -11519,11 +11519,11 @@ batchedUpdatesImpl = function (fn, a) {
var roots = new Map(),
internals$jscomp$inline_1226 = {
bundleType: 0,
version: "19.0.0-native-fb-7e8a06cf-20240815",
version: "19.0.0-native-fb-85fb95cd-20240816",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getInstanceFromNode,
reconcilerVersion: "19.0.0-native-fb-7e8a06cf-20240815"
reconcilerVersion: "19.0.0-native-fb-85fb95cd-20240816"
};
null !== extraDevToolsConfig &&
(internals$jscomp$inline_1226.rendererConfig = extraDevToolsConfig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<f957ea4381c374ddc6829a72b97b9287>>
* @generated SignedSource<<528e1afc1c07a6cea073bed94bb04d76>>
*/

"use strict";
Expand Down Expand Up @@ -17067,11 +17067,11 @@ __DEV__ &&
shouldSuspendImpl = newShouldSuspendImpl;
};
var isomorphicReactPackageVersion = React.version;
if ("19.0.0-native-fb-7e8a06cf-20240815" !== isomorphicReactPackageVersion)
if ("19.0.0-native-fb-85fb95cd-20240816" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-native-renderer" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-native-renderer: 19.0.0-native-fb-7e8a06cf-20240815\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-native-renderer: 19.0.0-native-fb-85fb95cd-20240816\nLearn more: https://react.dev/warnings/version-mismatch")
);
if (
"function" !==
Expand All @@ -17097,11 +17097,11 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.0.0-native-fb-7e8a06cf-20240815",
version: "19.0.0-native-fb-85fb95cd-20240816",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getInstanceFromTag,
reconcilerVersion: "19.0.0-native-fb-7e8a06cf-20240815"
reconcilerVersion: "19.0.0-native-fb-85fb95cd-20240816"
};
null !== extraDevToolsConfig &&
(internals.rendererConfig = extraDevToolsConfig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<41b429710fd5163112ce35bf5ab230ee>>
* @generated SignedSource<<19c5e85e3a573ba12d0956cf112563c5>>
*/

"use strict";
Expand Down Expand Up @@ -10926,11 +10926,11 @@ function updateContainer(element, container, parentComponent, callback) {
return lane;
}
var isomorphicReactPackageVersion = React.version;
if ("19.0.0-native-fb-7e8a06cf-20240815" !== isomorphicReactPackageVersion)
if ("19.0.0-native-fb-85fb95cd-20240816" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-native-renderer" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-native-renderer: 19.0.0-native-fb-7e8a06cf-20240815\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-native-renderer: 19.0.0-native-fb-85fb95cd-20240816\nLearn more: https://react.dev/warnings/version-mismatch")
);
if (
"function" !==
Expand Down Expand Up @@ -10979,11 +10979,11 @@ batchedUpdatesImpl = function (fn, a) {
var roots = new Map(),
internals$jscomp$inline_1215 = {
bundleType: 0,
version: "19.0.0-native-fb-7e8a06cf-20240815",
version: "19.0.0-native-fb-85fb95cd-20240816",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getInstanceFromTag,
reconcilerVersion: "19.0.0-native-fb-7e8a06cf-20240815"
reconcilerVersion: "19.0.0-native-fb-85fb95cd-20240816"
};
null !== extraDevToolsConfig &&
(internals$jscomp$inline_1215.rendererConfig = extraDevToolsConfig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<54211e54371961fffc4b3136d1d4d4cd>>
* @generated SignedSource<<800206b7e549369564a7c9aabbc54fe6>>
*/

"use strict";
Expand Down Expand Up @@ -11630,11 +11630,11 @@ function updateContainer(element, container, parentComponent, callback) {
return lane;
}
var isomorphicReactPackageVersion = React.version;
if ("19.0.0-native-fb-7e8a06cf-20240815" !== isomorphicReactPackageVersion)
if ("19.0.0-native-fb-85fb95cd-20240816" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-native-renderer" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-native-renderer: 19.0.0-native-fb-7e8a06cf-20240815\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-native-renderer: 19.0.0-native-fb-85fb95cd-20240816\nLearn more: https://react.dev/warnings/version-mismatch")
);
if (
"function" !==
Expand Down Expand Up @@ -11683,11 +11683,11 @@ batchedUpdatesImpl = function (fn, a) {
var roots = new Map(),
internals$jscomp$inline_1297 = {
bundleType: 0,
version: "19.0.0-native-fb-7e8a06cf-20240815",
version: "19.0.0-native-fb-85fb95cd-20240816",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getInstanceFromTag,
reconcilerVersion: "19.0.0-native-fb-7e8a06cf-20240815"
reconcilerVersion: "19.0.0-native-fb-85fb95cd-20240816"
};
null !== extraDevToolsConfig &&
(internals$jscomp$inline_1297.rendererConfig = extraDevToolsConfig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -222,7 +227,7 @@ export type ReactNativeType = {
eventType: string,
): void,
render(
element: Element<ElementType>,
element: MixedElement,
containerTag: number,
callback: ?() => void,
options: ?RenderRootOptions,
Expand Down Expand Up @@ -257,7 +262,7 @@ export type ReactFabricType = {
eventType: string,
): void,
render(
element: Element<ElementType>,
element: MixedElement,
containerTag: number,
callback: ?() => void,
concurrentRoot: ?boolean,
Expand Down

0 comments on commit 99d43a1

Please sign in to comment.