From 78021303d08a4fd4a878523ab4e8fac81ad59e30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Wed, 2 Dec 2026 11:29:27 -0800 Subject: [PATCH] Sync OSS Fabric renderer to restore startup initialization Summary: ## Context The previous OSS renderer refresh removed the import of `react-native/setup-env` with the legacy event pipeline. Metro only runs that initialization module before application code when it is already in the dependency graph. Its absence leaves RN globals undefined and causes app startup to fail with `ReferenceError: Property 'window' doesn't exist`. ## Changes Sync the development, production, and profiling OSS Fabric bundles from React commit `d27a4db0e22abd379013cf89a465d7d89678b8cb` (https://github.com/react/react/pull/38519), which restores `react-native/setup-env` as the first runtime import. Each generated bundle changes only by adding that require before React and updating its SignedSource signature. Preserve `flushSync` and leave dependencies, shims, the renderer revision marker, and internal renderer bundles unchanged. Verified compatibility with unmodified released React 19.3.0 and 19.3.1 and the complete released Scheduler 0.28.0 package. All six React/renderer combinations pass actual native startup and renderer behavior checks, including initialization before application entry, native view mounting, and `flushSync` return and throw-path behavior. Changelog: [General][Fixed] - Restore React Native global initialization before application startup in the OSS Fabric renderer. Differential Revision: D135716737 --- .../Libraries/Renderer/implementations/ReactFabric-dev.js | 3 ++- .../Libraries/Renderer/implementations/ReactFabric-prod.js | 3 ++- .../Renderer/implementations/ReactFabric-profiling.js | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/react-native/Libraries/Renderer/implementations/ReactFabric-dev.js b/packages/react-native/Libraries/Renderer/implementations/ReactFabric-dev.js index cd1f2bf31bc..ad3a803b138 100644 --- a/packages/react-native/Libraries/Renderer/implementations/ReactFabric-dev.js +++ b/packages/react-native/Libraries/Renderer/implementations/ReactFabric-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<002013d87e381e4dc255c509357549a6>> + * @generated SignedSource<<42489dd566b7bc738c5c2ca3ed868e26>> * * This file was sync'd from the facebook/react repository. */ @@ -16516,6 +16516,7 @@ __DEV__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); + require("react-native/setup-env"); var React = require("react"), reactPrivateInterface = require("react-native/react-private-interface"), Scheduler = require("scheduler"), diff --git a/packages/react-native/Libraries/Renderer/implementations/ReactFabric-prod.js b/packages/react-native/Libraries/Renderer/implementations/ReactFabric-prod.js index 609756330bb..c426bcc2a90 100644 --- a/packages/react-native/Libraries/Renderer/implementations/ReactFabric-prod.js +++ b/packages/react-native/Libraries/Renderer/implementations/ReactFabric-prod.js @@ -7,12 +7,13 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<7d9c6a7b1084c5ed9ccdf315b8a3383f>> + * @generated SignedSource<<6a0415f100512266db302ced15fc683a>> * * This file was sync'd from the facebook/react repository. */ "use strict"; +require("react-native/setup-env"); var React = require("react"), reactPrivateInterface = require("react-native/react-private-interface"), Scheduler = require("scheduler"), diff --git a/packages/react-native/Libraries/Renderer/implementations/ReactFabric-profiling.js b/packages/react-native/Libraries/Renderer/implementations/ReactFabric-profiling.js index 5990c424edf..3e839c07bd6 100644 --- a/packages/react-native/Libraries/Renderer/implementations/ReactFabric-profiling.js +++ b/packages/react-native/Libraries/Renderer/implementations/ReactFabric-profiling.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<46e531e7ad16e76a30aebf9f132fdd71>> + * @generated SignedSource<<1154d68c010fe819285e510bf9957567>> * * This file was sync'd from the facebook/react repository. */ @@ -17,6 +17,7 @@ "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); +require("react-native/setup-env"); var React = require("react"), reactPrivateInterface = require("react-native/react-private-interface"), Scheduler = require("scheduler"),