From d2778ef6e7d16cdfd1bec0bd654e98d093ef5710 Mon Sep 17 00:00:00 2001 From: eps1lon Date: Mon, 26 Feb 2024 18:23:22 +0000 Subject: [PATCH] Add support for rendering BigInt (#24580) DiffTrain build for commit https://github.com/facebook/react/commit/2f240c91ed54900adee213565cb2039e161629e9. --- .../cjs/ReactTestRenderer-dev.js | 24 ++++++----- .../cjs/ReactTestRenderer-prod.js | 4 +- .../cjs/ReactTestRenderer-profiling.js | 4 +- .../RKJSModules/vendor/react/cjs/React-dev.js | 40 +++++++++++-------- .../vendor/react/cjs/React-prod.js | 2 +- .../vendor/react/cjs/React-profiling.js | 2 +- .../Libraries/Renderer/REVISION | 2 +- .../implementations/ReactFabric-dev.fb.js | 24 ++++++----- .../ReactNativeRenderer-dev.fb.js | 24 ++++++----- 9 files changed, 75 insertions(+), 51 deletions(-) diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js index 410f86f4d472d..715eec2bca955 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<2e02ad0f633511d087c31638317ef702>> */ "use strict"; @@ -148,6 +148,7 @@ if (__DEV__) { var enableLegacyHidden = false; var enableAsyncActions = true; var alwaysThrottleRetries = true; + var enableBigIntSupport = false; // Flow magic to verify the exports of this file match the original version. var FunctionComponent = 0; var ClassComponent = 1; @@ -5538,12 +5539,14 @@ if (__DEV__) { function createChild(returnFiber, newChild, lanes, debugInfo) { if ( (typeof newChild === "string" && newChild !== "") || - typeof newChild === "number" + typeof newChild === "number" || + enableBigIntSupport ) { // Text nodes don't have keys. If the previous node is implicitly keyed // we can continue to replace it without aborting even if it is not a text // node. var created = createFiberFromText( + // $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint "" + newChild, returnFiber.mode, lanes @@ -5671,7 +5674,8 @@ if (__DEV__) { if ( (typeof newChild === "string" && newChild !== "") || - typeof newChild === "number" + typeof newChild === "number" || + enableBigIntSupport ) { // Text nodes don't have keys. If the previous node is implicitly keyed // we can continue to replace it without aborting even if it is not a text @@ -5682,7 +5686,7 @@ if (__DEV__) { return updateTextNode( returnFiber, - oldFiber, + oldFiber, // $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint "" + newChild, lanes, debugInfo @@ -5797,14 +5801,15 @@ if (__DEV__) { ) { if ( (typeof newChild === "string" && newChild !== "") || - typeof newChild === "number" + typeof newChild === "number" || + enableBigIntSupport ) { // Text nodes don't have keys, so we neither have to check the old nor // new node for the key. If both are text nodes, they match. var matchedFiber = existingChildren.get(newIdx) || null; return updateTextNode( returnFiber, - matchedFiber, + matchedFiber, // $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint "" + newChild, lanes, debugInfo @@ -6645,12 +6650,13 @@ if (__DEV__) { if ( (typeof newChild === "string" && newChild !== "") || - typeof newChild === "number" + typeof newChild === "number" || + enableBigIntSupport ) { return placeSingleChild( reconcileSingleTextNode( returnFiber, - currentFirstChild, + currentFirstChild, // $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint "" + newChild, lanes ) @@ -25727,7 +25733,7 @@ if (__DEV__) { return root; } - var ReactVersion = "18.3.0-canary-6c3b8dbfe-20240226"; + var ReactVersion = "18.3.0-canary-2f240c91e-20240226"; // Might add PROFILE later. diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js index 9d234f9bed832..faa6ccea19e07 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js @@ -9171,7 +9171,7 @@ var devToolsConfig$jscomp$inline_1014 = { throw Error("TestRenderer does not support findFiberByHostInstance()"); }, bundleType: 0, - version: "18.3.0-canary-6c3b8dbfe-20240226", + version: "18.3.0-canary-2f240c91e-20240226", rendererPackageName: "react-test-renderer" }; var internals$jscomp$inline_1195 = { @@ -9202,7 +9202,7 @@ var internals$jscomp$inline_1195 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-6c3b8dbfe-20240226" + reconcilerVersion: "18.3.0-canary-2f240c91e-20240226" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1196 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js index 99754ab39e98a..22a82de3e208e 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js @@ -9599,7 +9599,7 @@ var devToolsConfig$jscomp$inline_1056 = { throw Error("TestRenderer does not support findFiberByHostInstance()"); }, bundleType: 0, - version: "18.3.0-canary-6c3b8dbfe-20240226", + version: "18.3.0-canary-2f240c91e-20240226", rendererPackageName: "react-test-renderer" }; var internals$jscomp$inline_1236 = { @@ -9630,7 +9630,7 @@ var internals$jscomp$inline_1236 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-6c3b8dbfe-20240226" + reconcilerVersion: "18.3.0-canary-2f240c91e-20240226" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1237 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js index ff2183ee8c36a..9ad16b34b3f5a 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<44c5c601c5193aa81af150ccb4208604>> + * @generated SignedSource<<11b286062c8512965799ad8e36092d6b>> */ "use strict"; @@ -26,7 +26,7 @@ if (__DEV__) { } var dynamicFlags = require("ReactNativeInternalFeatureFlags"); - var ReactVersion = "18.3.0-canary-6c3b8dbfe-20240226"; + var ReactVersion = "18.3.0-canary-2f240c91e-20240226"; // ATTENTION // When adding new symbols to this file, @@ -490,6 +490,21 @@ if (__DEV__) { return isArrayImpl(a); } + // NOTE: There are no flags, currently. Uncomment the stuff below if we add one. + // the exports object every time a flag is read. + + var enableComponentStackLocations = + dynamicFlags.enableComponentStackLocations; + // The rest of the flags are static for better dead code elimination. + var enableDebugTracing = false; + var enableScopeAPI = false; + var enableRenderableContext = false; + var enableLegacyHidden = false; + var enableTransitionTracing = false; + // because JSX is an extremely hot path. + + var enableRefAsProp = false; + /* * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol * and Temporal.* types. See https://github.com/facebook/react/pull/22064. @@ -564,21 +579,6 @@ if (__DEV__) { } } - // NOTE: There are no flags, currently. Uncomment the stuff below if we add one. - // the exports object every time a flag is read. - - var enableComponentStackLocations = - dynamicFlags.enableComponentStackLocations; - // The rest of the flags are static for better dead code elimination. - var enableDebugTracing = false; - var enableScopeAPI = false; - var enableRenderableContext = false; - var enableLegacyHidden = false; - var enableTransitionTracing = false; - // because JSX is an extremely hot path. - - var enableRefAsProp = false; - function getWrappedName(outerType, innerType, wrapperName) { var displayName = outerType.displayName; @@ -2309,6 +2309,12 @@ if (__DEV__) { invokeCallback = true; } else { switch (type) { + case "bigint": { + break; + } + + // fallthrough for enabled BigInt support + case "string": case "number": invokeCallback = true; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js index 9134cc08e105c..bce2fce7b3391 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js @@ -598,4 +598,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactCurrentDispatcher.current.useTransition(); }; -exports.version = "18.3.0-canary-6c3b8dbfe-20240226"; +exports.version = "18.3.0-canary-2f240c91e-20240226"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js index 18c1dc1a6e9b3..6b5178d19420e 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js @@ -594,7 +594,7 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactCurrentDispatcher.current.useTransition(); }; -exports.version = "18.3.0-canary-6c3b8dbfe-20240226"; +exports.version = "18.3.0-canary-2f240c91e-20240226"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION index 3a5119457a91d..94f7d42288038 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION @@ -1 +1 @@ -6c3b8dbfed6f879440f484bd0bf801fac67ec684 +2f240c91ed54900adee213565cb2039e161629e9 diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js index 49a47c1d4a4d6..13d4ea7bed703 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<575cc3b40a7c3dee749cf6fb176a4449>> + * @generated SignedSource<<36563f58fdb8036d760d09bb1e80c450>> */ "use strict"; @@ -3248,6 +3248,7 @@ to return true:wantsResponderID| | var enableLazyContextPropagation = false; var enableLegacyHidden = false; var enableAsyncActions = false; + var enableBigIntSupport = false; // Flow magic to verify the exports of this file match the original version. var NoFlags$1 = /* */ @@ -9445,12 +9446,14 @@ to return true:wantsResponderID| | function createChild(returnFiber, newChild, lanes, debugInfo) { if ( (typeof newChild === "string" && newChild !== "") || - typeof newChild === "number" + typeof newChild === "number" || + enableBigIntSupport ) { // Text nodes don't have keys. If the previous node is implicitly keyed // we can continue to replace it without aborting even if it is not a text // node. var created = createFiberFromText( + // $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint "" + newChild, returnFiber.mode, lanes @@ -9578,7 +9581,8 @@ to return true:wantsResponderID| | if ( (typeof newChild === "string" && newChild !== "") || - typeof newChild === "number" + typeof newChild === "number" || + enableBigIntSupport ) { // Text nodes don't have keys. If the previous node is implicitly keyed // we can continue to replace it without aborting even if it is not a text @@ -9589,7 +9593,7 @@ to return true:wantsResponderID| | return updateTextNode( returnFiber, - oldFiber, + oldFiber, // $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint "" + newChild, lanes, debugInfo @@ -9704,14 +9708,15 @@ to return true:wantsResponderID| | ) { if ( (typeof newChild === "string" && newChild !== "") || - typeof newChild === "number" + typeof newChild === "number" || + enableBigIntSupport ) { // Text nodes don't have keys, so we neither have to check the old nor // new node for the key. If both are text nodes, they match. var matchedFiber = existingChildren.get(newIdx) || null; return updateTextNode( returnFiber, - matchedFiber, + matchedFiber, // $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint "" + newChild, lanes, debugInfo @@ -10552,12 +10557,13 @@ to return true:wantsResponderID| | if ( (typeof newChild === "string" && newChild !== "") || - typeof newChild === "number" + typeof newChild === "number" || + enableBigIntSupport ) { return placeSingleChild( reconcileSingleTextNode( returnFiber, - currentFirstChild, + currentFirstChild, // $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint "" + newChild, lanes ) @@ -28034,7 +28040,7 @@ to return true:wantsResponderID| | return root; } - var ReactVersion = "18.3.0-canary-6032fc8f"; + var ReactVersion = "18.3.0-canary-49d61be7"; function createPortal$1( children, diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js index ddc289adf931d..7fe821d56e045 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<50e7f5f201ab5dea1513a63712db8d3a>> + * @generated SignedSource<> */ "use strict"; @@ -2955,6 +2955,7 @@ to return true:wantsResponderID| | var enableLazyContextPropagation = false; var enableLegacyHidden = false; var enableAsyncActions = false; + var enableBigIntSupport = false; // Flow magic to verify the exports of this file match the original version. // ATTENTION // When adding new symbols to this file, @@ -9716,12 +9717,14 @@ to return true:wantsResponderID| | function createChild(returnFiber, newChild, lanes, debugInfo) { if ( (typeof newChild === "string" && newChild !== "") || - typeof newChild === "number" + typeof newChild === "number" || + enableBigIntSupport ) { // Text nodes don't have keys. If the previous node is implicitly keyed // we can continue to replace it without aborting even if it is not a text // node. var created = createFiberFromText( + // $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint "" + newChild, returnFiber.mode, lanes @@ -9849,7 +9852,8 @@ to return true:wantsResponderID| | if ( (typeof newChild === "string" && newChild !== "") || - typeof newChild === "number" + typeof newChild === "number" || + enableBigIntSupport ) { // Text nodes don't have keys. If the previous node is implicitly keyed // we can continue to replace it without aborting even if it is not a text @@ -9860,7 +9864,7 @@ to return true:wantsResponderID| | return updateTextNode( returnFiber, - oldFiber, + oldFiber, // $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint "" + newChild, lanes, debugInfo @@ -9975,14 +9979,15 @@ to return true:wantsResponderID| | ) { if ( (typeof newChild === "string" && newChild !== "") || - typeof newChild === "number" + typeof newChild === "number" || + enableBigIntSupport ) { // Text nodes don't have keys, so we neither have to check the old nor // new node for the key. If both are text nodes, they match. var matchedFiber = existingChildren.get(newIdx) || null; return updateTextNode( returnFiber, - matchedFiber, + matchedFiber, // $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint "" + newChild, lanes, debugInfo @@ -10823,12 +10828,13 @@ to return true:wantsResponderID| | if ( (typeof newChild === "string" && newChild !== "") || - typeof newChild === "number" + typeof newChild === "number" || + enableBigIntSupport ) { return placeSingleChild( reconcileSingleTextNode( returnFiber, - currentFirstChild, + currentFirstChild, // $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint "" + newChild, lanes ) @@ -28474,7 +28480,7 @@ to return true:wantsResponderID| | return root; } - var ReactVersion = "18.3.0-canary-0d6ee362"; + var ReactVersion = "18.3.0-canary-a86eeb93"; function createPortal$1( children,