Repository navigation
feat: merge React Native 0.88.0-rc.4 into the 0.87 stack - #44
Draft
sethwebster wants to merge 569 commits into
Draft
sethwebster wants to merge 569 commits into
sethwebster wants to merge 569 commits into
Conversation
…eact#57936) Summary: Pull Request resolved: react#57936 `react/cxxstableapi` is a header-only module — the stable API guards are pure preprocessor headers with no compilable source. Under `use_frameworks!`, CocoaPods emits a `PBXAggregateTarget` for a pod with no compilable sources, and an aggregate target produces no `.framework`, so pods depending on `React-cxxstableapi` cannot resolve the guard headers. Add an anchor translation unit so the pod has one source and CocoaPods emits a real framework target instead, and widen the podspec's build-from-source glob to pick it up. The prebuilt glob stays headers-only, since prebuilt pods do not generate frameworks. This mirrors the existing `CSSDummy.cpp` anchor for the header-only `React-renderercss` pod. Also register `react/cxxstableapi` as a subdirectory of the Fantom tester CMake build so the guard headers resolve there. Changelog: [Internal] Reviewed By: cortinico Differential Revision: D115859623 fbshipit-source-id: 47e63560e1478ad507d1f28f053b925438232ea4
Summary: Pull Request resolved: react#57947 Original commit changeset: f7475fa8fcd3 Original Phabricator Diff: D115871650 ## Changelog: [Internal] - Reviewed By: cortinico Differential Revision: D115880037 fbshipit-source-id: 0d4e121e37d087e94fa0e47642cd4fd8c3e07309
Summary: Pull Request resolved: react#57948 Original commit changeset: 20a5feb21ec1 Original Phabricator Diff: D115732295 ## Changelog: [Internal] - Reviewed By: cortinico Differential Revision: D115880038 fbshipit-source-id: c3ccc0f46be029ec13866465df02d73d3b36413e
Summary: While looking into something I saw this processColor function , for every color we are calculating normalise Color even though it would have been done earlier. This is a simple approach. Maybe we can add things like LRU. With some simple scripts(Rendering around 1000 cells) I found around 13% faster . ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [GENERAL][FIXED] - use cached results for already normalised colors Pull Request resolved: react#57896 Test Plan: Tested in RN tester. Reviewed By: christophpurrer Differential Revision: D115779590 Pulled By: Abbondanzo fbshipit-source-id: a915bc641fbaff1055c18ac1efa20552a725102f
Summary: Pull Request resolved: react#57954 Changelog: [Internal] - Update `react-native/debugger-frontend` from 571dc30...dbc1c52 Resyncs `react-native/debugger-frontend` from GitHub - see `rn-chrome-devtools-frontend` [changelog](react/react-native-devtools-frontend@571dc30...dbc1c52). ### Changelog | Commit | Author | Date/Time | Subject | | ------ | ------ | --------- | ------- | | [dbc1c525f](react/react-native-devtools-frontend@dbc1c525f) | Alex Hunt (hello@alexhunt.dev) | 2026-08-13T17:58:45+01:00 | [Enable "Capture screenshot" command for React Native targets (microsoft#252)](react/react-native-devtools-frontend@dbc1c525f) | | [e06f16d4e](react/react-native-devtools-frontend@e06f16d4e) | Nicola Corti (corti.nico@gmail.com) | 2026-06-10T14:11:47+01:00 | [Bump remaining vulnerable dev dependencies (microsoft#260)](react/react-native-devtools-frontend@e06f16d4e) | | [950f4a8e3](react/react-native-devtools-frontend@950f4a8e3) | Nicola Corti (corti.nico@gmail.com) | 2026-06-04T14:46:30+01:00 | [Bump vulnerable dev dependencies (microsoft#259)](react/react-native-devtools-frontend@950f4a8e3) | | [af53aca17](react/react-native-devtools-frontend@af53aca17) | Alex Hunt (hello@alexhunt.dev) | 2026-04-20T15:00:21+01:00 | [Disable inapplicable commands for React Native targets (microsoft#251)](react/react-native-devtools-frontend@af53aca17) | Reviewed By: hoxyq Differential Revision: D115891642 fbshipit-source-id: fcf1353aa4a4f45fe246fbc1ac6afa6837213ae1
Summary: Pull Request resolved: react#57925 Add RNTester screenshot coverage for single-line and multiline `TextInput` placeholders on Android and iOS. The test verifies that a long single-line placeholder is ellipsized while a multiline placeholder wraps. Changelog: [Internal] Reviewed By: christophpurrer Differential Revision: D115731487 fbshipit-source-id: bf13562b181f9c104056638c7cfa1d57416a3364
…react#57932) Summary: Pull Request resolved: react#57932 Changelog: [Internal] Reviewed By: gkz Differential Revision: D115802149 fbshipit-source-id: aa4c730e47ab9b362f7a6e1a16c8127117b09c08
Summary: Closes react#57755. `RCTScrollViewComponentView` remained subscribed to keyboard notifications while pooled with `_automaticallyAdjustKeyboardInsets` still enabled. A late notification could therefore restore keyboard insets after `prepareForRecycle` had cleared them. Disarm keyboard inset adjustment during recycling, then always synchronize the flag from the incoming props so a recycled view is correctly re-armed when the next ScrollView opts in. ## Changelog: [IOS] [FIXED] - Prevent recycled ScrollViews from retaining automatic keyboard inset behavior. Pull Request resolved: react#57811 Test Plan: - Added `RCTScrollViewComponentViewTests.testAutomaticallyAdjustKeyboardInsetsAcrossRecycling`, covering enabled behavior, ignored keyboard notifications while recycled, and re-enabling after remount. - `/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang-format --dry-run --Werror packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm packages/react-native/React/Tests/Mounting/RCTScrollViewComponentViewTests.mm` - `git diff --check` The full native XCTest suite was not run locally because this sparse checkout does not include a bootstrapped RNTester/CocoaPods workspace. Reviewed By: christophpurrer Differential Revision: D114719614 Pulled By: fabriziocucci fbshipit-source-id: e8e035fe8a74909b2281fc8d52af0e034f2bafe4
…fe (react#57865) Summary: `-[RCTViewComponentView unmountChildComponentView:index:]` bounds-checks the `RCTAssert` *condition*, but the failure message it formats afterwards calls `-objectAtIndex:` on the same out-of-range `index`: ```objc RCTAssert( (self.currentContainerView.subviews.count > index) && // guarded [self.currentContainerView.subviews objectAtIndex:index] == childComponentView, @"... tag at index: %@)", ..., @([[self.currentContainerView.subviews objectAtIndex:index] tag])); // not guarded ``` So the exact situation the assert exists to report — a shadow-tree/native child-index mismatch — raises `NSRangeException` *while being reported*, instead of being reported. That is normally invisible, because a source Release build strips `RCTAssert` and the mismatch is harmless: `index` is used only inside the asserts, and the real work, `[childComponentView removeFromSuperview]`, never needed it. But the prebuilt `React.framework` published to Maven Central is built with assertions enabled (react#57454), so this is live in App Store builds — we hit it on RN 0.81.5 via Expo SDK 54, symbolicated against the published `reactnative-core-dSYM-release` artifact: ``` NSRangeException: *** -[__NSArrayM objectAtIndex:]: index 13 beyond bounds [0 .. 8] -[RCTViewComponentView unmountChildComponentView:index:] (RCTViewComponentView.mm:163) RCTPerformMountInstructions(...) (RCTMountingManager.mm:97) -[RCTMountingManager performTransaction:] (RCTMountingManager.mm:258) -[RCTMountingManager initiateTransaction:] (RCTMountingManager.mm:247) ``` This is the second of the two fixes suggested in react#57454 and stands on its own for any build with assertions enabled. The change also reads `self.currentContainerView` once instead of four times. That getter is not a plain accessor — it creates or tears down `_containerView` and reparents subviews — so re-invoking it inside an assert's arguments is worth avoiding regardless. The hoisted locals and the assert sit inside `#ifndef NS_BLOCK_ASSERTIONS`, matching the existing guard at `RCTViewComponentView.mm:335`. Without it the locals are unused once assertions are compiled out, which is a `-Werror,-Wunused-variable` build failure, and the hoist would otherwise make that side-effecting getter run on every unmount in a Release build where it previously did not run at all. With the guard it is read once per unmount in Debug and not at all in Release. ## Changelog: [IOS] [FIXED] - Report a `RCTViewComponentView` child-index mismatch instead of raising `NSRangeException` while formatting the assert message Pull Request resolved: react#57865 Test Plan: I don't have a macOS build environment, so I have not compiled this — flagging that plainly. What backs the change: - Five App Store crash reports (RN 0.81.5, iOS 26.5.2 / 26.6, three device models) all symbolicate to the message argument on this line, never to the guarded condition. - `strings` on `react-native-artifacts-0.81.5-reactnative-core-release.tar.gz` shows both `Attempt to unmount…` format strings present, confirming the call sites are compiled into the release artifact — same check react#57454 reports for 0.85.3 and 0.86.0, so the artifact defect reaches at least as far back as 0.81. - Behaviour is unchanged whenever the assert passes; when it fails, the message now prints `out of bounds` in place of a tag that cannot be read. Happy to rework this if you would rather the assert drop the `tag at index` field entirely, or if fixing the artifact build flags is considered sufficient on its own. ## Added on import: build, tests, and answers to the open questions Compiled and tested, which the author could not do. ``` buck2 test fbsource//xplat/js/react-native-github:MountingTestsApple → Pass 19. Fail 0. ``` Adds `React/Tests/Mounting/RCTViewComponentViewUnmountTests.mm`, picked up by the existing `MountingTestsApple` glob. Restoring the pre-fix `RCTViewComponentView.mm` and re-running fails exactly the out-of-bounds case: ``` ✗ RCTViewComponentViewUnmountTests/testUnmountWithOutOfBoundsIndexReportsRatherThanRaisingRangeException Tests finished: Pass 18. Fail 1. ``` The second case, `testUnmountWithInBoundsMismatchStillReportsTagAtIndex`, passes against both old and new code on purpose: it pins that the in-bounds mismatch path still reports the real tag rather than the new `out of bounds` placeholder. ### Why the test is shaped the way it is Two non-obvious constraints, both of which broke a more natural first attempt: 1. `RCT_NSASSERT` is defined as `RCT_DEBUG`, so in a debug build a failing `RCTAssert` calls the custom handler **and then** raises through `NSAssertionHandler`. Every failing assert throws, fixed or not, so `XCTAssertNoThrow` cannot be the assertion. The discriminator is that pre-fix the message arguments raise `NSRangeException` at the call site *before* `_RCTAssertFormat` runs, so the handler never fires at all. The test asserts the handler ran and that whatever escaped was not `NSRangeException`. 2. `RCTPerformBlockWithAssertFunction` calls `block()` between pushing and popping its handler with no `try`/`finally`, so an exception escaping the block leaks the handler into every later test in the process. The raise is therefore caught inside the block. ### Other checks - `index` is `NSInteger` (`RCTComponentViewProtocol.h:64`), so the added `index >= 0` is meaningful rather than tautological. The previous `count > index` relied on a negative index promoting to a large `NSUInteger` and failing the unsigned comparison, which was correct by accident. - The `NSNumber *` / `NSString *` ternary in the message compiles without warning. - `arc lint -e extra` on the new test reports only a `NULLSAFECLANG` infrastructure failure that self-identifies as "not a code issue". The 55 pre-existing CLANGTIDY warnings in `RCTViewComponentView.mm` are untouched and are not attributed to this diff. ### NOTE: on the author's two questions **Is fixing the artifact build flags sufficient on its own?** No. react#57454 is the right root-cause fix and should still happen, but this change is worth having independently: the assert is broken *as an assert*. In any build where assertions are compiled in, including local Debug, the assert that exists to report an index mismatch raises while reporting it, so the diagnostic is unavailable exactly when it is needed. Fixing the artifact flags would hide that from production without repairing it. **Should the `tag at index` field be dropped instead?** Recommend keeping it. It is the field that tells you which view actually occupies the slot, which is the useful part of the diagnostic, and the second test above locks in that it still appears when the index is in bounds. ### Release-build guard (added after the first sanity-check failure) The first import version failed the sanity check with: ``` error: unused variable 'isIndexInBounds' [-Werror,-Wunused-variable] ``` `NS_BLOCK_ASSERTIONS` makes `RCTAssert` expand to `do {} while(false)`, so with assertions compiled out the hoisted locals have no remaining use. The hoisted lines and the assert are now wrapped in `#ifndef NS_BLOCK_ASSERTIONS`, which is the idiom this same file already uses at `RCTViewComponentView.mm:335` for a local pulled out of an assert. That also restores a property the hoist had quietly removed. Before this diff the four `self.currentContainerView` reads sat inside the macro arguments and disappeared entirely in a Release build. Hoisting them out made the getter run on every unmount in Release, and that getter is not a plain accessor: it can allocate `_containerView`, reparent every subview into it and move `clipsToBounds` and `layer.mask`, or in the other branch tear the container down and nil it. With the guard the getter is read once per unmount in Debug and not at all in Release, which is better than both the original and the unguarded version. Verified locally by defining `NS_BLOCK_ASSERTIONS` at the top of the file to simulate a Release build, against `RCTFabricComponentViewsBaseApple`, which is the target that owns this file: | State | Result | |---|---| | Unguarded, assertions off | `error: unused variable 'isIndexInBounds'`, BUILD FAILED | | Guarded, assertions off | exit 0 | | Guarded, assertions on (debug) | Pass 19. Fail 0. | Reviewed By: christophpurrer Differential Revision: D115424016 Pulled By: fabriziocucci fbshipit-source-id: b825f145c1867a230c0c6cd12a41950a83468ed2
Summary: Pull Request resolved: react#57958 Changelog: [Internal] Reviewed By: gkz Differential Revision: D115933669 fbshipit-source-id: beb16a462472effcdcc2f9aea3d1baae5fd075b8
…#57928) Summary: `react-native spm add`'s Release builds crash on launch with: ``` Compiling JS failed: Wrong bytecode version. Expected 99 but got 98 ``` This happens because the SwiftPM integration resolves the Hermes **runtime** (the downloaded `hermes-engine.xcframework`) and the Hermes **compiler** (the `hermesc` binary that turns the JS bundle into bytecode) from two independent, unsynced sources: - `download-spm-artifacts.js`'s `resolveHermesArtifact()` picked the runtime by querying the `hermes-compiler` package's `latest-v1` dist-tag on the npm registry **live, at build time**. - `generate-spm-xcodeproj.js`'s `resolveHermesCliPathSetting()` (and `react-native-xcode.sh`, for the CocoaPods-free fallback) points `HERMES_CLI_PATH` at the `hermes-compiler` package **already installed in this project's own `node_modules`** — whatever got pinned the last time `npm install` ran. If the `latest-v1` dist-tag advances on npm between `npm install` and the Release build (which happens routinely as new Hermes builds are published), the downloaded VM and the locally pinned `hermesc` fall out of sync and the app crashes at launch. `react-native-xcode.sh` already documents this exact invariant ("react native pins the hermes-compiler version, so the compiler's bytecode version always matches the prebuilt hermes VM artifacts") — SwiftPM's artifact download just wasn't honoring it. This PR makes `resolveHermesArtifact()` read the pinned `hermes-compiler` version from `node_modules` first (the same `require.resolve` lookup already used for `HERMES_CLI_PATH`), so the runtime download and the compiler always agree. It falls back to the previous `latest-v1` npm lookup only when `hermes-compiler` isn't locally resolvable (e.g. `USE_HERMES=false` apps that never installed it). Explicit `HERMES_VERSION` overrides (`nightly`, `latest-v1`, a literal version) are unchanged. Fixes react#57917. ## Changelog: [IOS] [FIXED] - Fix Hermes runtime/compiler version mismatch causing "Wrong bytecode version" crashes in SwiftPM Release builds Pull Request resolved: react#57928 Test Plan: Added unit tests covering the new local-resolution path, the fallback when `hermes-compiler` isn't installed, and confirming existing `HERMES_VERSION` overrides still take precedence over the local pin. ``` $ node_modules/.bin/jest packages/react-native/scripts/spm/__tests__/download-spm-artifacts-test.js Test Suites: 1 passed, 1 total Tests: 70 passed, 70 total $ node_modules/.bin/flow check packages/react-native/scripts/spm/download-spm-artifacts.js No errors! $ node_modules/.bin/eslint packages/react-native/scripts/spm/download-spm-artifacts.js packages/react-native/scripts/spm/__tests__/download-spm-artifacts-test.js (no output — clean) $ node_modules/.bin/prettier --check packages/react-native/scripts/spm/download-spm-artifacts.js packages/react-native/scripts/spm/__tests__/download-spm-artifacts-test.js All matched files use Prettier code style! ``` Reproduced the crash and confirmed the fix end-to-end using the public reproducer linked from the issue (https://github.com/marandaneto/react-native-087-swiftpm-hermes-bytecode-repro): - Before the fix: `npm run reproduce` builds successfully but launching the app in the iOS Simulator crashes with `Compiling JS failed: Wrong bytecode version. Expected 99 but got 98`. - After applying the equivalent fix to the reproducer's installed `react-native` copy: the log shows `Using locally pinned hermes-compiler: 250829098.0.16`, and both the debug and release Hermes runtime artifacts resolve to that exact version — matching the `hermesc` used for `HERMES_CLI_PATH`. `xcodebuild ... -configuration Release` succeeds, and the app installs and launches cleanly on an iPhone 17 Pro (iOS 26.5) simulator with no crash. Reviewed By: cortinico Differential Revision: D115859923 Pulled By: cipolleschi fbshipit-source-id: 1b65a7aa28f502374a3553c1849b8ff29b5afd10
Summary: Pull Request resolved: react#57952 Implement Idle frame spans in React Native DevTools, by emitting synthetic `NeedsBeginFrameChanged` + `BeginFrame` events. **Definition** An idle frame is emitted whenever the gap between two consecutive frames exceeds one vsync interval, derived from the display's refresh rate (`CADisplayLink.duration` on iOS, `Display.refreshRate` on Android, falling back to 60 Hz). ``` frame N gap > 1 vsync frame N+1 +------------+ +--------------------------------+ +------------+ | BeginFrame | | NeedsBeginFrameChanged | | BeginFrame | | DrawFrame | | BeginFrame (no DrawFrame) | | DrawFrame | +------------+ +--------------------------------+ +------------+ rendered as an "Idle frame" ``` **Implementation notes** - Drop frames that begin before the recording start — Android `FrameMetrics` can deliver frames from app startup, and the first iOS `CADisplayLink` callback reports the previous vsync. - Sort frames by begin timestamp before serializing, since async screenshot encoding can deliver them out of order and break gap detection. - iOS: skip the frame event when the screenshot is unchanged, letting the gap render as an idle frame. Changelog: [Internal] Reviewed By: hoxyq Differential Revision: D97502569 fbshipit-source-id: 7cb19e0a462ad878f0b44b66f6b5de3f76426ffe
Summary: Pull Request resolved: react#57953 Changelog: [Internal] Reviewed By: hoxyq Differential Revision: D111901168 fbshipit-source-id: 90f8b0432fbec5b144fa4e0fa9e7bd4ad12ce445
Summary: Pull Request resolved: react#57848 Adds a React Native-owned Babel plugin that inlines `Platform.OS` and `Platform.select(...)`, from `react-native/babel-preset` at the front of the preset's plugin list (importantly, before the preset lowers ES modules to CommonJS). Metro already inlines `Platform`, but its matcher (`metro-transform-plugins`' `inline-plugin` via `createInlinePlatformChecks`) runs *after* ESM has been lowered to CommonJS. By then a genuine `import {Platform} from 'react-native'` has become `_reactNative.Platform.OS` and provenance is obscured and fragile to track. Metro compensates by matching on the local identifier spelling - so `Platform.OS` inlines whether or not `Platform` is actually React Native's, and a genuine deep or RN-relative import may be missed entirely. `Platform` inlining is in any case much more of an RN concern than a Metro one - it has to be aware of RN APIs and module names, and even the module’s path. This plugin recognises: - `import {Platform} from 'react-native'` (including aliased imports) - `import * as RN from 'react-native'`, uses of `RN.Platform` - `import P from 'react-native/Libraries/Utilities/Platform'` - the equivalent `require` forms, plus destructuring and immutable aliases - RN's internal relative imports, e.g. `../../Utilities/Platform` …and deliberately does *not* recognise anything it cannot prove - a bare `Platform.OS` global, `React.Platform.OS`, or a same-named import from another package. Metro's late matcher is left fully enabled and remains responsible for those historical forms, so this change is purely additive: it inlines genuine imports Metro was missing, and changes nothing Metro already handled. Metro’s plugin will be deprecated and removed in future. Notable details: - Relative RN imports are resolved lexically, with no filesystem access and no platform-extension resolution — the identity we need is the extension-less module `<rn-root>/Libraries/Utilities/Platform`, and Metro picks `Platform.ios.js` / `Platform.android.js` later. The RN package root is identified by directory name, which covers `node_modules/react-native`, `packages/react-native` and pnpm layouts alike, and rejects `react-native-web` and friends (who would be expected to adjust the paths in their forks) - Imports are left in place. Removing them would change dependency collection, so it is handled separately. - A no-platform build (`null`, or the empty string that RN's Jest preprocessor passes) is a no-op — inlining `Platform.OS` to `""` would be wrong. - The plugin source is added to the preset's `getCacheKey` so edits invalidate Metro's transform cache. Changelog: [General][Changed] - Inline `Platform.OS` and `Platform.select(...)` for React Native `Platform` imports during the Babel preset, covering some cases that were previously left un-inlined. Reviewed By: huntie Differential Revision: D114647943 fbshipit-source-id: b44f38bd22970abba6e7d75c00fdbb27159c17a6
Summary: Pull Request resolved: react#57929 Allow `fontVariationSettings` to accept either the existing CSS-compatible string or an object keyed by four-character OpenType axis tags. Normalize the object at the shared style boundary so Text and TextInput retain the existing native string representation on every platform. Object serialization is deterministic, supports fractional finite values, and preserves the current unset versus explicit-clear behavior. Changelog: [General][Added] - Add object syntax for `fontVariationSettings` Reviewed By: Abbondanzo Differential Revision: D115640672 fbshipit-source-id: e2dbb2498ec213686a3547c8f74c2ade417ef88a
…lt on via `@react-native/metro-babel-transformer`) (react#57973) Summary: Pull Request resolved: react#57973 `react-native/babel-preset` inlines `Platform.OS` and `Platform.select(...)` whenever it is handed a `platform` (since yesterday - react#57848 ), but this is over-zealous - `platform` is a pre-existing transform option whose intent is to set the transform target. In some cases (eg, to allow `Platform` mocking from tests), we don't want `Platform` inlining, even though `platform` may already be passed for other reasons. Gate the inlining behind a separate `inlinePlatform` opt-in, resolved as `options.inlinePlatform ?? babel.caller(...) ?? false`, mirroring how `platform` and `unstable_transformProfile` are already resolved. Metro already models this as a distinct transform option, so both Babel transformers pass it straight through. The caller channel covers the case where the preset is named in a `babel.config.js` and so receives no preset options at all. Bundling is unaffected: Metro sets `inlinePlatform` on every transform, so `Platform` continues to be inlined through `react-native/metro-babel-transformer`. Changelog: [General][Changed] - `Platform.OS` and `Platform.select(...)` inlining in `react-native/babel-preset` now requires the `inlinePlatform` option in addition to `platform` Reviewed By: GijsWeterings Differential Revision: D116281656 fbshipit-source-id: 0230cd74f38661862396391da62cf81b34773b85
…) (react#57955) Summary: Fixes react#53542 **Problem:** `maintainVisibleContentPosition` fails when FlatList data is updated rapidly with prepends in quick succession (e.g., chat receiving messages). After 2 prepends before native scroll drains, render window stays frozen, `onViewableItemsChanged` suppressed, `onEndReached` never fires. **Root cause:** `pendingScrollUpdateCount` assumption is structurally unsound – it increments by 1 per prepend in `getDerivedStateFromProps` (0→1→2) but native scroll events are dispatched as unique events that coalesce. Verified in C++: - `ScrollViewEventEmitter.cpp:13` – `onScroll` dispatched with `dispatchUniqueEvent("scroll", ...)` - `EventQueue.cpp:29-50` – unique event whose target+type matches existing replaces in place (line 49) instead of appending So N scroll events emitted before queue flush deliver exactly 1 to JS. Single coalesced event drains 2→1 leaving blocked. Also leak when JS predicate fires (old key found at new index) but native declines to adjust (tag recycled, view deleted, delta ≤0.5, clamped). **Fix (1 file, 2 lines core):** Clamp pending to at most 1 and drain to 0 on any scroll: - `pendingScrollUpdateCount: 1` instead of `prev+1` – prevents accumulation during rapid prepends - `setState({pendingScrollUpdateCount: 0})` instead of `-1` – single coalesced scroll unblocks This turns "stuck at N" into unblocked after next scroll, fixing frozen window / viewability / onEndReached for rapid updates. For leak path where native declines (no scroll ever), flag would still be stranded at 1 – addressed by boolean rename + escape hatch in follow-up, but this PR already strictly improves and matches existing tests that drain 0→1→0. ## Changelog: [GENERAL] [FIXED] - Fix maintainVisibleContentPosition with rapid data updates (react#53542) Pull Request resolved: react#57955 Test Plan: **Jest (VirtualizedList):** ```bash yarn jest --watchman=false packages/virtualized-lists/Lists/__tests__/VirtualizedList-test.js --no-coverage --ci # Before: new coalesced test fails with pending 1 # After: 83 passed (82 existing + 1 new rapid prepends with coalesced scroll), 1 skipped, 59 snapshots ``` **New test ( regression for react#53542 ):** - Simulates 2 rapid prepends WITHOUT intermediate scroll (5 + 3 items) - Only 1 coalesced scroll event (delta 8*ITEM_HEIGHT) - Asserts `pendingScrollUpdateCount === 0` (fails on main with 1) and `firstVisibleItemKey` not null **Existing MVCP tests still pass:** - `handles maintainVisibleContentPosition` - `handles multiple rapid prepends` (separate scroll per prepend) - `delta stays bounded` - `minIndexForVisible >0` and `inverted` **Lint:** ```bash yarn lint # Done (max-warnings 0) ``` Closes react#53542 Reviewed By: javache Differential Revision: D115907610 Pulled By: fabriziocucci fbshipit-source-id: 0cd59b35d7c43803a000b93779cd84c9c4202053
Summary: Pull Request resolved: react#57976 The `ReactAndroid` JNI gtests in `react/fabric/test` and `react/jni/test` were configured as plain host C++ tests, but they link against the Android-only JNI libraries. The resulting binary is an Android aarch64 ELF that needs `/system/bin/linker64` and so cannot run on a Linux host: ``` qemu-aarch64: Could not open '/system/bin/linker64': No such file or directory Test failed to produce the expected output! ... IO error: No result xml files found. ``` They were not failing their assertions — they were never executing. The runner enumerated case names statically out of the binary without running it, so all 6 cases across the two targets were known and reported as failing, with no stack traces at all. The absence of stack traces was itself the tell: the process never started, so no gtest XML was ever produced. Both targets move to the established pattern for gtests against Android-only native libs: build them as Android instrumentation tests, packaged into an APK and run on a device or emulator. `FabricMountingManagerTest` can drop its deliberate leak as a result. It previously allocated the manager with a no-op deleter, because `~FabricMountingManager()` calls `jni::ThreadScope::WithClassLoader`, which throws without an attached `JavaVM`. Under instrumentation the gtest runs inside a native method registered via fbjni `makeNativeMethod`, so `cachedOrNull()` is non-null and the closure runs inline — destruction is safe. The fixture now holds a default-constructed (null) `jni::global_ref` member and returns a `std::unique_ptr`; releasing a null `global_ref` is a no-op. All four test bodies are byte-identical. `ModuleRegistryBuilderTest.cpp` is a comment-only correction. Changelog: [Internal] Differential Revision: D116286866 fbshipit-source-id: a283deae18e42b0caad330bd3a27307428cfcec4
Summary: Pull Request resolved: react#57850 React ref callbacks may return only `void` or a cleanup function. Align `TRefCallbackFor` and the related shared callback-ref helpers directly with the core Flow React ref types, then update consumers whose callbacks returned incompatible values. This keeps the contracts canonical and avoids introducing a parallel restricted variant. Changelog: [Internal] - Align ref helper types with the React callback contract. Reviewed By: SamChou19815 Differential Revision: D115064072 fbshipit-source-id: b308ac2b9a453b494c64bdf3d37873b69040ce4c
…eact#57975) Summary: Pull Request resolved: react#57975 `HighResDuration::fromDOMHighResTimeStamp` and `HighResTimeStamp::fromDOMHighResTimeStamp` converted milliseconds back to nanoseconds with `static_cast<int64_t>(units * 1e6)`, which truncates toward zero. `toDOMHighResTimeStamp()` divides the nanosecond count by 1e6 (one rounding) and multiplying back by 1e6 rounds again, so the product frequently lands a hair below the original integer (e.g. `537648854729249.97`). Truncation then chops off a whole nanosecond, so `fromDOMHighResTimeStamp(toDOMHighResTimeStamp(x)) != x` for roughly 2% of random `now()` values. That is the source of an intermittent `BridgingTest/highResTimeStampTest` failure, which reported: ``` Expected equality of these values: timestamp Which is: 8-byte object <22-02 00-21 FD-E8 01-00> bridging::fromJs<HighResTimeStamp>( rt, bridging::toJs(rt, timestamp), invoker) Which is: 8-byte object <21-02 00-21 FD-E8 01-00> ``` Round to the nearest nanosecond instead of truncating. Nanosecond values below 2^53 are exactly representable in a double, so the round trip is now exact for every value below 2.25e15 ns (26 days of monotonic clock); beyond that the double's ULP exceeds 0.5 ns and residual error is at most 2 ns, which is a floor of the DOM representation itself. Rounding is also the correct semantic independently of the round trip — truncation gives a systematic downward bias and is asymmetric across zero, which affects the other callers (`RCTHighResTimeStampFromSeconds` for touch timestamps, `RuntimeTargetConsole` `console.timeStamp`, and `PerformanceTracer`). The rounding is `std::llround`, which costs both overloads their `constexpr`: `<cmath>` rounding functions do not become usable in a constant expression until C++23 (P0533), and this header is compiled as C++20 everywhere (`-std=c++20` in `rn_defs.bzl`, `react-native-flags.cmake`, the podspecs and `Package.swift`). Both carry a `TODO` to restore `constexpr` once the C++23 rollout reaches them. Dropping it is safe here. All 14 call sites are plain runtime calls — none is in a constant-expression context, none assigns to a `constexpr` variable or feeds a `static_assert` — and both functions are defined inside the class body, so they stay implicitly `inline` and neither linkage nor ABI changes. `fromDOMHighResTimeStamp` converts a `double` arriving from JS, so constant-evaluating it was never meaningful in the first place. This does narrow the published API surface, so the C++ API snapshots are regenerated: the only change across all nine `.api` files is the `constexpr` keyword dropping off these two declarations, 18 lines in total. `HighResTimeStamp::fromDOMHighResTimeStamp` now delegates to `HighResDuration`'s so there is a single implementation. `highResTimeStampTest` previously asserted on `HighResTimeStamp::now()`, whose magnitude is host-uptime-dependent, so it only tripped the bug on about 2% of runs. It now round-trips five fixed nanosecond values (including the exact value from the failing run), which exercises the bug on every run. No test was skipped, disabled, or loosened. Changelog: [General][Fixed] - Round instead of truncate when converting a `DOMHighResTimeStamp` back to nanoseconds, so `HighResTimeStamp` and `HighResDuration` round trips are exact Reviewed By: javache Differential Revision: D116286868 fbshipit-source-id: 1adafd1b57b1185f51f08fa4dc55d96b88c176cd
…back is absent (react#57893) Summary: Pull Request resolved: react#57893 The codegen'd TurboModule `emitOn<Event>` methods invoked their `EventEmitterCallback` without checking it was set. That callback is installed by the generated `*SpecJSI` constructor, which runs when JS first looks the module up — so a native module that emits before that point invoked an empty `std::function` on iOS (`std::bad_function_call`) or a null field on Android (NPE). Native code commonly holds the module instance and pushes events well before any JS surface mounts, so call sites had to wrap every emit in a try/catch to stay crash-free. Both generators now read the callback into a local and no-op when it is absent: - ObjC++ (`serializeEventEmitter.js`): copies `_eventEmitterCallback`, calls it only if non-empty. - Java (`GenerateModuleJavaSpec.js`): copies the `Nullable CxxCallbackImpl` field and null-checks it. The local is for readability, not synchronization: the callback is installed once and never cleared, and Java reference reads are already atomic. The `setEventEmitterCallback` lambdas had a separate lifetime bug: they captured `eventEmitterMap_` by reference and looked events up with `operator[]`. The Java/ObjC module owns the callback and can outlive the C++ `*SpecJSI` that installed it, so a stale callback dereferenced a dangling map; and `operator[]` silently default-inserted a null `shared_ptr` for an unknown event name, which the next line dereferenced. They now capture a copy of the map and use a checked `find` (`serializeModule.js`, `JavaTurboModule.cpp`). Every emitter is registered before the callback is installed, so the copy is complete. Note the scope of the guarantee: it covers the ObjC++ and Java generators, which route through an `EventEmitterCallback`. A C++-only TurboModule (`<Module>CxxSpec`, from `GenerateModuleH.js`) has no callback to check — it emits through `eventEmitterMap_` entries its own constructor registers — so the "emit unconditionally" guidance is about the callback, not about emitting before construction finishes. Changelog: [General][Fixed] - TurboModule event emitters no longer throw when an event is emitted before the emitter callback is installed Reviewed By: javache Differential Revision: D115130767 fbshipit-source-id: 7d7b9a706b8983968e3e1207b22c66322f04a223
Summary: Android TurboModules mapped a JS `ArrayBuffer` to `java.nio.ByteBuffer`, copying every argument into a direct buffer — and `ByteBuffer` carries no ownership contract, so there was no way to express aliased or borrowed bytes for synchronous in-place access. This adds `ArrayBuffer` (`packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ArrayBuffer.kt`) as the Java representation of an `ArrayBuffer`. It carries an `isOwningBytes` flag: an owning buffer can be stored and returned to JS, a non-owning one aliases bytes valid only for the synchronous call that produced it. Codegen now emits `ArrayBuffer` for `ArrayBufferTypeAnnotation` params (was `ByteBuffer`) and returns (was `ByteBuffer`). ## Changelog: [ANDROID] [ADDED] - Add `ArrayBuffer`, the Java representation of a JS `ArrayBuffer` for TurboModules, with an explicit byte-ownership contract Pull Request resolved: react#57897 Test Plan: - Codegen Java spec and JNI C++ snapshot tests updated for `ArrayBuffer` param/return signatures. - `SampleTurboModule` doubles its sync argument in place and returns the same buffer, covering the zero-copy path end to end; `createNativeBuffer` allocates via `ArrayBuffer`. - C++ API snapshots regenerated. Reviewed By: javache Differential Revision: D115755247 Pulled By: christophpurrer fbshipit-source-id: de067789ad145b7202da721a02f838358c82f4d8
…57982) Summary: Pull Request resolved: react#57982 Changelog: [ANDROID][FIXED] Enforce the ArrayBuffer borrow contract for Java TurboModules Follow-up hardening for the Android `ArrayBuffer` TurboModule type. Three problems: **1. Borrowed JS-heap bytes outlived the call that lent them.** For a synchronous method, `convertJSIArgsToJNIArgs` hands the module a `ByteBuffer` aliasing the JS `ArrayBuffer`'s bytes without copying. Nothing stopped a module from stashing that `ArrayBuffer` in a field and reading it later, after the JS heap may have moved, freed, or reused the memory — a use-after-free that reads as intermittent data corruption rather than a crash. The borrow is now explicitly scoped to the call frame. `JNIArgs` records every borrowed `ArrayBuffer` and revokes it in its destructor — including when the call throws — via the new `JArrayBuffer::invalidate`, which drops the C++ side's reference to the bytes. `ArrayBuffer.bytes` and `ArrayBuffer.size` then throw, with a message pointing at `ArrayBuffer.arrayBufferWithCopiedBytes`, and `JArrayBuffer::toJSBuffer` throws rather than aliasing revoked memory. Modules that need the bytes past the call copy them; modules that don't keep the zero-copy fast path. Revocation lives entirely on the C++ side: the peer is the single source of truth, and Kotlin asks it through `isBytesValid`. The destructor runs while the stack unwinds, possibly with a Java exception pending, so it resolves each peer pointer at borrow time — the `global_ref` alongside it keeps the Java object, and therefore the peer, alive — and calls only the `noexcept` `JArrayBuffer::invalidate`. No JNI calls are made from the destructor, which is what lets it stay `noexcept` honestly. **2. Argument conversion aborted under runtimes that refuse `tryGetMutableBuffer`.** `jsi::Runtime::tryGetMutableBuffer` and `detached` are not universally implemented: tracing and replay runtimes throw from `tryGetMutableBuffer`, and `detached` throws a `JSINativeException` if the JS-side property isn't a bool. `ArrayBuffer` argument conversion is not wrapped in a try/catch, so either throw propagated out of a JNI frame. Both calls now go through exception-tolerant helpers in `react/bridging/ArrayBuffer.h`; a runtime that refuses to answer is treated as "no native buffer available", which selects the copy path. Routing `AsyncArrayBuffer::acquire` and `::borrow` through the same helper fixes the identical latent bug on the shared C++/ObjC path. **3. A wrong return type from a module crashed instead of raising a JS error.** The `ArrayBufferKind` return path cast the returned `jobject` to `JArrayBuffer` unconditionally. A module returning any other object type produced undefined behavior. The cast is now guarded by an `isInstanceOf` check that throws a `jsi::JSError` naming the offending module and method. Also in this change: - `JByteBufferMutableBuffer::data()` reports null for a zero-capacity direct buffer instead of calling `getDirectBytes()`, which throws for one. That made `createArrayBuffer` throw for an empty `ArrayBuffer`. - Dropped two dead zero-size branches in `JArrayBuffer`: `JByteBuffer::wrapBytes` already routes `size == 0` to an empty buffer. - `JArrayBuffer.cpp` reuses the shared `detail::OwnedBytesBuffer` from `react/bridging/ArrayBuffer.h` instead of a second local copy. - `ArrayBuffer.kt` KDoc corrected: the returned JS `ArrayBuffer` is a new object over the same bytes rather than the identical one, `size` is the capacity and not a view's remaining bytes, and `arrayBufferWithOwnedBytes` documents the caller's lifetime obligation. - `ArrayBuffer.kt` moves from the `bridge` target to `native-types`, alongside the other JNI-backed bridge types. Changelog: [Android][Breaking] - TurboModule methods taking or returning an `ArrayBuffer` now use `com.facebook.react.bridge.ArrayBuffer` instead of `java.nio.ByteBuffer`, and an `ArrayBuffer` argument must not be retained past the method that receives it unless its bytes are copied with `ArrayBuffer.arrayBufferWithCopiedBytes()`. Reviewed By: javache Differential Revision: D115794808 fbshipit-source-id: 26f5d863469cc14a3f1bffc2cbc3302f3e983ecb
Summary: iOS TurboModules mapped a JS `ArrayBuffer` to `NSData` on arguments and `NSMutableData` on returns, so every crossing copied — and `NSMutableData` cannot alias foreign memory, so there was no way to express "these bytes live somewhere else". This adds `RCTArrayBuffer` (`packages/react-native/React/Base/`) as the ObjC representation of an `ArrayBuffer`. It carries an `isOwningBytes` flag: an owning buffer can be stored and read from any thread, a non-owning one aliases bytes valid only for the synchronous call that produced it. Codegen now emits `RCTArrayBuffer *` for `ArrayBufferTypeAnnotation` params (was `NSData *`) and returns (was `NSMutableData *`). ## Changelog: [IOS] [BREAKING] - Add `RCTArrayBuffer`, the ObjC representation of a JS `ArrayBuffer` for TurboModules, with an explicit byte-ownership contract Pull Request resolved: react#57879 Test Plan: - `RCTTurboModuleArrayBufferTests` — 9 tests over the sync in-place path, `isOwningBytes` on a sync argument, returning one's own argument, the void/Promise copy paths, nesting, and a zero-length round trip. - `RCTTurboModuleTests.mm` adds `testNativeBackedArrayBufferIsAliasedAndKeepsBackingStoreAlive`. - `RCTSampleTurboModule` doubles its argument in place and returns the same buffer, covering the path end to end. - Codegen and C++ API snapshots regenerated. Reviewed By: cipolleschi Differential Revision: D115629409 Pulled By: christophpurrer fbshipit-source-id: a7ee6eadf99fd5f9f82fd2a95b0d3ff1369f4ddf
) (react#57357) Summary: Roll umbrella with umbrella guards for headers under `react/renderer/components/view` subtree. Initially, we assume that the entire target is public, so each header within includes a public umbrella guard. Changelog: [Internal] Pulled By: coado Pull Request resolved: react#57357 coado Test Plan: Signals, Test locally in `rn-tester` by building on iOS (cocoapods and swiftPM) and Android with `RN_STRICT_API` turned on. Then directly include guarded headers in `NativeCxxModuleExample.h` to see if build fails and then change to umbrella include to see if it passes. Reviewed By: cipolleschi Differential Revision: D109847184 fbshipit-source-id: 852c0213313f45d9a7c6ac3c94ef7cc2166608af
Summary: Pull Request resolved: react#57946 Refresh the root `README.md`. This is generally simplified and aligned closer with the React repo's headings/structure. **Changes** - **Rewrite intro** and add banner logo. - Drop Contents, Requirements, and Upgrading sections. - Extend set of website docs links. - **Add inline starting guidance for Expo**. - Drop emojis. - Inline markdown links. - Fix badge styling (underline bleed). - Drop Bluesky badge. - Add download count badge. - Facebook → Meta. Changelog: [Internal] Reviewed By: vzaidman Differential Revision: D115879599 fbshipit-source-id: de5a254ac2724751d6527badf0b851bd4d2b73dc
Summary: Pull Request resolved: react#57949 Changelog: [Internal] Reviewed By: vzaidman Differential Revision: D115886097 fbshipit-source-id: 6ce920da1e2de8a7dbd26cb824abdbbc7186afe6
Summary: Pull Request resolved: react#57363 This diff rolls umbrella guards for `react/renderer/components/text` and `react/renderer/components/textinput`. Initially, we consider `text` component target as `public` and `textinput` as `for frameworks`, so the umbrella is added only to the `text` target. This diff also adds missing `components/text/platform/android/` to the prefab as otherwise the Text umbrella cannot be properly resolved on Android. Changelog: [Internal] Reviewed By: cipolleschi Differential Revision: D109849283 fbshipit-source-id: 14fcab2a8ee437b94f7d131b8a373afc8b7d4f18
…t#57744) Summary: Two bugs in `addArrayStringValues`, which adds members to an array build setting (`HEADER_SEARCH_PATHS`, `OTHER_LDFLAGS`, `FRAMEWORK_SEARCH_PATHS`, `LD_RUNPATH_SEARCH_PATHS`). Both hit real projects; neither was visible from the existing fixture. **1. A promoted scalar was never restored.** A setting that already exists as a scalar gets promoted to a `( … )` array, but that was recorded as a plain member-append — so `deinit` stripped the members and left the array shell plus its injected `"$(inherited)"` behind. Stock Xcode projects hit this: the app template sets `LD_RUNPATH_SEARCH_PATHS = "$(inherited) executable_path/Frameworks";` as a target-level scalar. Fixed by pinning the pre-injection value in `.spm-injected.json` and restoring it in place. It is stored raw (a bare scalar's token runs to the `;`, carrying whitespace that must come back), recorded only if the merge actually changed the field, and not restored if the field is gone. **2. A one-line array was corrupted.** The append anchored on `lastIndexOf('\n', tokenEnd - 1)`, which assumes multi-line. With no newline in the value that lands on the *previous* line, so members were spliced above the field, outside the array: ``` { "/new", ← bare entry in the dict body: invalid pbxproj HEADER_SEARCH_PATHS = ("/vendor", ); ← member never added } ``` The result is a project Xcode cannot open, and `deinit` could not remove the stray line. Xcode writes multi-line arrays, but hand-edited projects and other generators (XcodeGen, Tuist) emit compact ones. Fixed by splicing inline ahead of the `)`; removal gained matching delimiter-anchored patterns, so the span removed is the span inserted. The dedupe parse was also quote-blind — a member holding a quoted comma parsed as two tokens — and is now quote-aware. **Tradeoff:** reversing a promotion rewrites the whole field, so members hand-added to a promoted array afterwards are lost. **Rebase note:** `main` has since grown an overlapping guard (`buildSettingValueTokens`) that skips the append when every value is already present, avoiding the *no-op* promotion. It is kept and complements this change: main still promotes irreversibly when there *is* a fresh value to add to a scalar, which is what the restore here covers. The two records stay mutually exclusive per key, pinned by a test. ## Changelog: [Internal] [Fixed] - SwiftPM: `spm deinit` restores a promoted scalar build setting, and `spm add` no longer corrupts a one-line array Pull Request resolved: react#57744 Test Plan: `yarn jest packages/react-native/scripts` → **963 tests, 32 suites** green; eslint, prettier and flow clean. Written red first: byte-identical `add` → `deinit` round-trips for each pre-existing shape (absent, multi-line, bare and quoted scalars, and the one-line forms), plus `add` → `update` → `deinit`. The multi-line path is unchanged byte-for-byte, verified by a differential harness over 48 add/remove cases against the previous implementation. Re-verified after the rebase on the committed `HelloWorld.xcodeproj`, driving the real `injectSpmIntoExistingXcodeproj` / `removeSpmInjection`. On `main` a one-line `HEADER_SEARCH_PATHS` gains a bare `"…/autolinking/headers",` entry above the field and never receives the member; with this change it lands inside the array, and a pre-existing scalar comes back exactly. Reviewed By: fabriziocucci Differential Revision: D114317839 Pulled By: cipolleschi fbshipit-source-id: 08bc81f80855721bf2123143063462109a99ac25
Summary: Pull Request resolved: react#57849 Ref callbacks commonly used expression bodies that returned assignment or collection method results. Use block bodies so these callbacks return `void`, matching React's ref contract. Changelog: [Internal] - Make callback refs return `void` explicitly. Reviewed By: SamChou19815 Differential Revision: D115064073 fbshipit-source-id: ad8fcdb1a94421a700e958c6e4ae981bf350d1ed
…ents (react#58518) Summary: `findFilesWithExtension` walks a library's directory looking for `.mm` files that declare a Fabric component. The walk descends into every subdirectory, `node_modules` included, resolves symlinks through `statSync`, and keeps no visited set. This got broken after react#57790 because `parseiOSAnnotations` now enters every library that declares a `codegenConfig` without an `ios` key into its map with an empty `components` object, so nothing removes it from `librariesToCrawl`. Previously such libraries were filtered before crawling. An app that declares `codegenConfig` with `"type": "all"` and no `ios` key now gets treated as a component library, so the walk covers the entire project. What we notice in the [expo repo](expo/expo#50134) is that under pnpm, the traversal never terminates. Workspace packages link into each other's `node_modules` and form cycles. Because symlinks are followed, the walk only stops once paths hit the 1023 byte limit. CocoaPods progress stops right after the "Using React Native Core and React Native Dependencies prebuilt versions" line while a `generate-codegen-artifacts.js` child sits at 100% CPU. Under npm and yarn, the walk completes but with the wrong result. In those cases, `node_modules` holds real directories, but the walk covers the whole dependency tree. Crawling one app of roughly 1100 packages turned up 382 `.mm` files, 43 of which declare a component, among them React core views such as `RCTImageComponentView` and `RCTScrollViewComponentView` from `react-native-macos`. Each one is written into the app's entry in `RCTThirdPartyComponentsProvider.mm`. The existing `/react-native/` path filter does not exclude them, since it requires a trailing separator and `react-native-macos` has none. ## Changelog: [IOS] [FIXED] - Codegen no longer crawls `node_modules` or follows symlinks when discovering components Pull Request resolved: react#58518 Test Plan: Two cases added to `packages/react-native/scripts/codegen/__tests__/generate-artifacts-executor-test.js`. The three existing `findFilesWithExtension` mocks move from `statSync` to `lstatSync`. The symlink case builds a link pointing back at its own parent, so the pre-fix walk never terminates. **Negative control:** with the `generateRCTThirdPartyComponents.js` change reverted and the tests left in place, both new cases fail. All 24 existing snapshots pass unchanged, so the change is additive for projects that already declare an `ios` config. Measured by crawling the app directory of two real projects: | Project | Before | After | | --- | --- | --- | | `apps/bare-expo`, pnpm | 116,800 reads in 30s, still running | 34 files, 1.1s | | yarn app, ~1100 packages | 382 files, 5.8s | 8 files, 0.3s | Reviewed By: fabriziocucci Differential Revision: D120122552 Pulled By: vzaidman fbshipit-source-id: 233b8dc338b92372a34a0855f12a549e52513200 (cherry picked from commit 39751d8)
Summary: An autolinked library's SwiftPM target name is also its header import prefix, so deriving it from the npm package name was wrong for most of the ecosystem (`react-native-svg` publishes `RNSVG`, not `ReactNativeSvg`) and wrong silently — no error, just headers nobody can import under the expected name. ## How: This PR reads the podspec file on scaffolding, and will use the name from the podspec if available. In addition it deprecates the react-native.config.js `spm` section in favor of the library's `package.json` file. ### Configuration A package's SwiftPM settings now live in `swiftpmConfig` in its `package.json`, following `codegenConfig`'s conventions: `name`, `dependencies`, `autolinkingPlugin` and `scaffold` for a library, `modules` and `denyPlugins` for an app. The `spm` block in react-native.config.js is deprecated — still read, so nothing breaks, but it warns once per file and package.json wins field by field. ### Resolving A name resolves from `swiftpmConfig.name`, then the deprecated `spm.name`, then the podspec's `header_dir` or name, then the npm name. The podspec is thereby transitional rather than permanent: `spm scaffold` records the name it derived as `swiftpmConfig.name` in the library's package.json, so the next run needs no podspec to name it. It never overwrites a name the library already declares, never records a name guessed from the npm name, and reports what it did. ### Failsafety A prefix Swift cannot spell is normalized to the identifier SwiftPM would compile it as, with a warning. A reserved name or two deps landing on one name is a hard error naming swiftpmConfig.name as the fix; the scope-borrowing that auto-corrected collisions is removed, since a name the build invents is a name no #import can predict. Collision checks key on SwiftPM's c99 name, so react-native-svg and react_native_svg no longer pass and then compile as one module. ### Implementation Name resolution reads the two podspec fields it needs with the regex parser, so it adds no `pod ipc spec` spawn, and the full read is memoized on the resolved path so one run reads a podspec once across name resolution, header search paths and scaffolding. `rn-tester` and the Apple test library move to the new location. ## Changelog: [IOS] [FIXED] - Read SwiftPM name from podspec and store in package.json when scaffolding Pull Request resolved: react#58290 Test Plan: ✅ Unit tests Reviewed By: cortinico Differential Revision: D119159904 Pulled By: cipolleschi fbshipit-source-id: 59a7c62ecb601498060a5721f362dae8c5cc92de (cherry picked from commit 1cfc5f2)
Summary: SPM setup scripts start with `set -euo pipefail`, but every one of them runs under `/bin/sh`. On a machine where `/bin/sh` isn't bash (e.g. dash), that fails immediately with `set: Illegal option -o pipefail`, so no SwiftPM build gets past the first build phase. Two spots in `generate-spm-xcodeproj.js`: - `shellScriptPhase` hardcodes `shellPath: '/bin/sh'` for every `PBXShellScriptBuildPhase` it builds (Sync SPM Autolinking, Embed React Native Flavored Frameworks, plugin-contributed phases), while their bodies are bash-only. Now sets `shellPath: '/bin/bash'`, and refreshes it on an already-injected project too. - The "Sync SPM Autolinking" scheme pre-action runs the same kind of script, but a scheme pre-action ignores a build phase's `shellPath` entirely — Xcode reads the shell from the `ActionContent`'s own `shellToInvoke` attribute instead (default `/bin/sh`). Now sets `shellToInvoke = "/bin/bash"` on both scheme creation and when adding/refreshing the pre-action on an existing scheme. Fixes react#58359 ## Changelog: [IOS] [FIXED] - SwiftPM: run generated build scripts under bash instead of /bin/sh, so they don't break on a host where /bin/sh isn't bash Pull Request resolved: react#58362 Test Plan: `yarn test packages/react-native/scripts/spm` — 838 passed, including new cases for the refreshed `shellPath`/`shellToInvoke` on a project injected before this fix, and a scheme injected before the attribute existed. Reviewed By: cortinico Differential Revision: D119328611 Pulled By: cipolleschi fbshipit-source-id: 2039a5c3c0224ca17d096f4837380b0977f4b539 (cherry picked from commit 25f48bd)
…t#58379) Summary: The SwiftPM manifests React Native generates — the `Autolinked` aggregate, the per-dependency synth packages, and the scaffolded community packages — hardcoded `platforms: [.iOS(.v15)]`. SwiftPM refuses to link a product whose minimum platform is above the depending target's, so any self-managed package with a higher floor could not be autolinked. Every Expo package declares iOS 16.4, so a stock Expo app on 0.87.1 fails at build time with: ``` error: The package product 'Expo' requires minimum platform version 16.4 for the iOS platform, but this target supports 15.0 (in target 'AutolinkedAggregate' from project 'Autolinked') ``` The app itself is correct (`IPHONEOS_DEPLOYMENT_TARGET = 16.4`); the only disagreement was the generated manifests. The floor is now the app's own `IPHONEOS_DEPLOYMENT_TARGET`, read from the injected `.xcodeproj`: - Target selection: the injection marker's `targetUuid`, else the application target named by `--product-name`, else every application target. - Per configuration: the target's own value, else the project-level configuration of the same name. The lowest value wins, since one manifest floor has to hold for every configuration. - Clamped to React Native's minimum (15.1, `min_ios_version_supported`) and emitted in string form (`.iOS("16.4")`), because the `.vNN` enum form cannot express a minor version. `setup-apple-spm.js` resolves the value once per `add`/`update`/`sync`/`scaffold` run, logs it (`iOS deployment target: 16.4 (from MyApp.xcodeproj)`), and passes it to the generator, the sync script, and the scaffolder via a new `--ios-deployment-target` flag. The flag value is sanitized at the generator boundary as well. `SCAFFOLDER_VERSION` is bumped to 20 so existing scaffolds regenerate with the new floor. A floor set in an `.xcconfig` the configuration is based on is honored, including `#include` chains (target literal → target xcconfig → project literal → project xcconfig). A floor supplied through a build-setting variable (`$(MY_FLOOR)`) is not resolved and falls back to the minimum; the log line says so. `spm add` and `spm update` also refresh the `platforms:` element of existing scaffolded manifests (those carrying the scaffolder marker, including the pre-v20 `.iOS(.v15)` form, over the same expanded dependency set the scaffolder uses, transitive SwiftPM dependencies included) without creating new scaffolds or touching anything else in them. Known limitation, documented in `scripts/spm/__docs__/spm-scripts.md`: the project file is not one of the auto-sync build phase's staleness inputs, so a deployment target changed after `spm add` takes effect on the next `spm update`. The default floor moves from 15.0 to 15.1 for apps without a readable project setting; React Native already requires 15.1 for the app target, so this is not observable. ## Changelog: [IOS] [FIXED] - SwiftPM: generated manifests derive their iOS platform floor from the app's `IPHONEOS_DEPLOYMENT_TARGET` instead of hardcoding iOS 15, so dependencies with a higher minimum (e.g. Expo, 16.4) can be autolinked Pull Request resolved: react#58379 Test Plan: Unit tests were written first and seen failing, then made green: ``` yarn jest --no-cache -i packages/react-native/scripts/spm Test Suites: 37 passed, 37 total Tests: 1733 passed, 1733 total ``` New/updated coverage: `ios-deployment-target-test.js` (pbxproj reading: target-level, project-level fallback, xcconfig chain with `#include` and `<group>` anchoring, minimum across configurations, marker/`--product-name`/all-targets selection, invalid values, clamping, unreadable project), `scaffold-package-swift-test.js` (emitted floor, refresh of existing scaffolded manifests), `generate-spm-autolinking-test.js` (aggregate and synth templates, `--ios-deployment-target` through `main()`), `scaffold-package-swift-test.js`, `sync-spm-autolinking-test.js` (flag forwarding), `setup-apple-spm-test.js` (resolution and log line). ESLint (`--max-warnings 0`), Prettier, and Flow are clean on the touched files. Not run here: an end-to-end Xcode build of an Expo app on this branch. The failing scenario and the fix were verified by the Expo team against 0.87.1 with the same manifest change patched in locally (build proceeds past SwiftPM resolution into compiling `Expo`). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Reviewed By: cortinico Differential Revision: D119653699 Pulled By: cipolleschi fbshipit-source-id: 7c69dd4d97bed719f7bbd28fb0832cdf2f151f55 (cherry picked from commit 92564f3)
getCacheKey only hashes package contents when the version ends in -main; published releases short-circuit to the version string. The test asserted only the main-build property, so it failed on every release branch. Assert the correct property for each case.
#publish-packages-to-npm&next
Relocating the hand-written declarations under types_DEPRECATED/ (react#57513) changed where the react-native-legacy-deep-imports export condition points for ./Libraries/*. It used to resolve to ./Libraries/*.d.ts, beside the real .js, so TypeScript's extension substitution still found modules with no hand-written declaration. It now resolves into types_DEPRECATED/, which contains no .js files, so those specifiers stop resolving. Reported against 0.88.0-rc.0 with react-native/Libraries/Core/InitializeCore. Add the old location as a second entry so the condition falls back to it. Modules that do have a declaration keep resolving to types_DEPRECATED/ because that entry is still first. This is applied to 0.88-stable only. 0.88 is a non-breaking release, so the regression must not ship in it. main intentionally keeps the current behaviour pending a deliberate decision on retiring deep imports.
## Summary: Bump minimum Metro version to 0.87.1, within the same semver range, to ensure upgraders get the same version as fresh projects would. Mostly fixes, including a couple of `Platform` inlining corrections. It also replaces the `image-size` dependency to clear CVE alerts. Metro release notes: https://github.com/react/metro/releases/tag/v0.87.1 ## Changelog: [General] [Changed] - Bump Metro minimum to 0.87.1 ## Test Plan: ``` yarn install --frozen-lockfile --ignore-scripts yarn flow-check yarn test packages/metro-config packages/community-cli-plugin packages/dev-middleware ``` (cherry picked from commit 18a22b1)
This reverts commit 11f9a7f. # Conflicts: # packages/react-native/ReactCommon/react/nativemodule/core/iostests/RCTTurboModuleTests.mm # packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm
…react#58063)" This reverts commit ab2ea64.
#publish-packages-to-npm&next
…jectMap corruption in SurfaceMountingManager (react#58389) Summary: since react#56646 the view registry is a `MutableIntObjectMap`; `androidx.collection` 1.4.0 to 1.4.2 corrupt `ScatterMap` and its primitive variants after remove-heavy sequences, fixed in 1.4.3 (https://issuetracker.google.com/issues/352560465). Apps resolve 1.4.0 or 1.4.2 and lose registry entries; RN then drops mount instructions and can leave stale views. Fixes react#58388. ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> `[ANDROID] [FIXED] - Bump androidx.collection to 1.4.4 to fix view registry entries getting lost in SurfaceMountingManager` Pull Request resolved: react#58389 Test Plan: Reproducer: https://github.com/pawicao/rn-android-view-registry-corruption - RN 0.87.1 app resolving androidx.collection 1.4.2: 91 `Unable to find viewState` soft exceptions on 45 tags over two 40-round runs on a Pixel 9a, and a stale view left on screen. - Same screen with androidx.collection pinned to 1.4.4: none over 120 rounds. Reviewed By: cortinico Differential Revision: D119149754 Pulled By: javache fbshipit-source-id: afb13330bac575218a07a030bb1bcd5bf7e00824 (cherry picked from commit d6a5f15)
…#57940) Summary: Fixes react#57933. `react-native/virtualized-lists` is published separately and imported `ReactNativeFeatureFlags` through `react-native/src/private/featureflags/ReactNativeFeatureFlags`, which is not listed in `react-native`'s `"exports"`. Metro therefore warned and fell back to file-based resolution whenever an app rendered a virtualized list. Thanks huntie for the patch and the direction — this PR now applies it instead of the original approach: - `ReactNativeFeatureFlags` is exposed on the existing private package boundary, `react-native/react-private-interface` (both the runtime getter and the `.js.flow` re-export); - `VirtualizedList.js` and `VirtualizeUtils.js` import it from there. No new `src/private/*` subpath is exported, and the feature-flag singleton is unchanged. Per your review, the `scripts/monorepo-tests/__tests__/check-packages-test.js` and `scripts/shared/monorepoUtils.js` changes have been dropped — the PR is now just the patch above. Happy to look at enabling `react-native/no-deep-imports` on `virtualized-lists` as a follow-up if that's wanted. `VirtualizeUtils.js` is included alongside `VirtualizedList.js` because it carried the same runtime deep import. The remaining occurrences are out of scope: the four in `react-native/jest-preset` are all `import type` and are erased before resolution, and the one in `VirtualizeUtils-test.js` is not shipped (`virtualized-lists` excludes `**/__tests__/**` from `files`). ## Changelog: [GENERAL] [FIXED] - Fix the Metro package-exports warning caused by `react-native/virtualized-lists` importing an unexported React Native subpath. Pull Request resolved: react#57940 Test Plan: No new test is added. The existing `virtualized-lists` suites already cover this route, because `VirtualizeUtils`/`VirtualizedList` read the flags at runtime through the new boundary. Counterfactual — dropping only the `ReactNativeFeatureFlags` getter and its `import typeof` from `react-private-interface.js`, keeping the two `virtualized-lists` imports: ```text TypeError: Cannot read properties of undefined (reading 'fixVirtualizeListCollapseWindowSize') 182 | let lastWillAddMore; 183 | > 184 | if (ReactNativeFeatureFlags.fixVirtualizeListCollapseWindowSize()) { | ^ at computeWindowedRenderLimits (packages/virtualized-lists/Lists/VirtualizeUtils.js:184:32) at Object.<anonymous> (packages/virtualized-lists/Lists/__tests__/VirtualizeUtils-test.js:261:47) Test Suites: 2 failed, 6 passed, 8 total Tests: 20 failed, 1 skipped, 151 passed, 172 total ``` Restoring the getter makes it green again. ```text $ yarn jest packages/virtualized-lists scripts/monorepo-tests packages/react-native/Libraries/ReactPrivate --runInBand Test Suites: 9 passed, 9 total Tests: 1 skipped, 176 passed, 177 total Snapshots: 69 passed, 69 total $ yarn flow-check Found 0 errors $ yarn lint $ eslint --max-warnings 0 . Done in 10.23s. ``` Reviewed By: javache Differential Revision: D119164284 Pulled By: cortinico fbshipit-source-id: 1e8ae3b85ae7fb28c55f207f887a97aad85b563c (cherry picked from commit a506ed6)
Summary: Building an app in Xcode fails when it autolinks a library that ships its own `Package.swift`, with one error per such library: ``` Missing package product 'reactnativeskia_ReactNativeSkia.ReactNativeSkia' Missing package product 'reactnativesafeareacontext_ReactNativeSafeAreaContext.ReactNativeSafeAreaContext' ``` The same project builds fine from the command line. Two problems combine. **The sync destroys package roots Xcode has already loaded.** Autolinking writes one symlink per self-managed library into `build/generated/autolinking/libs/<Name>`, and Xcode treats each as a local Swift package root. The generator deleted that whole directory and recreated it on every run, even when the generated output was byte-for-byte identical. Measured on a real app, across one no-op sync: the `libs/` inode changed from 1913513750 to 1913930645, `libs/ReactNativeSkia` from 1913513937 to 1913930649, while the generated `Package.swift` kept the same MD5. Recreating a package root that Xcode has already resolved is what produces the error above. **Xcode's own bookkeeping made the sync run every time.** The "Sync SPM Autolinking" build phase re-syncs when a watched input looks newer than its stamp, and it checked each library's whole directory with `find <dir> -newer <stamp>`. Xcode writes its per-user scheme state inside that directory, at `<lib>/.swiftpm/xcode/xcuserdata/<user>.xcuserdatad/xcschemes/xcschememanagement.plist`. So Xcode's own write marked the next build stale, which triggered the destructive re-sync, which broke that build. `xcodebuild` does not write that file, which is why command-line builds were never affected. This change makes the `libs/` tree idempotent — unchanged entries keep their inode, and entries that are no longer autolinked are pruned instead of wiped — and makes the staleness check skip `.swiftpm`. ### How to verify In an app that autolinks a library shipping its own `Package.swift`, build in Xcode twice in a row. Both builds should succeed. Before this change the second build fails with `Missing package product`. ## Changelog: [IOS][FIXED] - Stop SwiftPM autolinking from recreating library package roots on every sync, which broke Xcode builds of apps using libraries that ship their own Package.swift Pull Request resolved: react#58597 Test Plan: **Unit tests.** `yarn test packages/react-native/scripts/spm` — 21 suites, 1009 tests pass. New tests, written and seen failing before the fix: - Two consecutive generation runs over an unchanged self-managed dependency keep both the `libs/` inode and each entry's inode. Failed before the fix with the same inode churn measured on the real app. - A dependency removed between two runs leaves no symlink under `libs/`. - The emitted staleness snippet is extracted from the generated script and executed under `/bin/bash -c` with `set -euo pipefail` against a temporary tree. A write under `.swiftpm/` is ignored; a real source change is still detected. **Real app.** A React Native 0.87.1 app on Xcode 27 autolinking `shopify/react-native-skia` and `react-native-safe-area-context`, both self-managed. Before: `xcodebuild` succeeded, Xcode failed in about 5 seconds with the two errors above, on nearly every build. **Not run:** the full CI matrix, and no Android-side check — this touches iOS SwiftPM tooling only. ## Scope Deliberately minimal. One case still re-syncs: the first time Xcode creates `.swiftpm` inside a library, that bumps the library directory's own mtime, so the build after a fresh checkout reports stale once per library. That is harmless now that the sync is idempotent. One related item is left alone: the aggregate `Package.swift` is still rewritten on every sync even when its content is unchanged, which bumps its mtime and can make Xcode re-resolve. That is wasteful but not destructive, and it is no longer reached on an ordinary IDE build now that `.swiftpm` writes do not mark the sync stale. Reviewed By: cipolleschi Differential Revision: D120740029 Pulled By: shwanton fbshipit-source-id: 3783d4cee4791ab13517d8f0dcac71f752cb7c1b (cherry picked from commit 97cc934)
Summary: The iOS prebuild (`node scripts/ios-prebuild`) stages React Native's headers into `packages/react-native/.build/headers` as hard links, and skipped any target that already existed. When changing the original source files, these hard links can become stale and errors like this can occur: ``` Libraries/LinkingIOS/RCTLinkingManager.mm:91:7: error: use of undeclared identifier 'RCTIsSceneDelegateApp' ``` This is a problem that contributors will see - not regular users, but the fix helps with strange error messages. ## Changelog: [INTERNAL] [FIXED] - Repair stale staged headers in the iOS prebuild instead of compiling against a previous checkout's copies Pull Request resolved: react#58596 Test Plan: ✅ New unit tests, 16 cases in `packages/react-native/scripts/ios-prebuild/__tests__/setup-test.js`, using real temporary directories rather than an `fs` mock, since the defect is about inodes. End to end on an Xcode 27 checkout: - Replaced a staged header with a copy, so it kept the same contents but a different inode. `node scripts/ios-prebuild -s -f Debug` restored it to the source inode and logged `Linked React/Base → .build/headers/React`. The previous code skipped it. - Ran setup a second time with nothing changed: no file was relinked, and nothing was logged. - Confirmed the three colliding targets still resolve to the same source as before the change, by inode. - `node scripts/ios-prebuild -b -f Debug -p ios-simulator` → `** BUILD SUCCEEDED **`. Reviewed By: cipolleschi Differential Revision: D120740409 Pulled By: shwanton fbshipit-source-id: 41c1eb112c3395d6c7158d7151be7fdd92a21cef (cherry picked from commit b935e74)
The revert of the NSData argument path moved codegen back to NSMutableData but did not refresh the recorded snapshots, leaving Validate C++ API Snapshots red on the release branch. Changelog: [Internal]
Picks up two fixes released in hermes-v260318099.0.4: - Avoid reserve() in ConsecutiveStringStorage. Lazy compilation appends to the string storage on every newly compiled function, and reserve() on libc++ sizes to exactly the requested capacity rather than growing geometrically, so repeated appends were quadratic. - Re-land of the VariableScope rescan optimization. See reactwg/react-native-releases#1430
#publish-packages-to-npm&next
Summary: JSI drops `undefined` keys, so reseting `disabled` from `true` to `undefined` on Touchables/Pressables never runs `setEnabled(true)` There is props diffing feature flag that fixes this, which is off by default Also added safety check against explicit `null` & reset on recycling Fixes react#56777 and supersedes react#58795 ## Changelog: [ANDROID] [FIXED] - Properly enable Pressable after `disabled` prop resets from `true` Pull Request resolved: react#58799 Test Plan: Added BaseViewManagerTest as well as videos of testing it on Pressable: https://github.com/user-attachments/assets/e9a7dcd2-46d5-4cdc-88a3-728bff22e76b https://github.com/user-attachments/assets/043150ae-64f2-47c9-b13c-abfec5b61747 Reviewed By: javache Differential Revision: D122872380 Pulled By: zeyap fbshipit-source-id: f3f1cad378f36f006bbb6c7f3f2e4f9aa8e61541 (cherry picked from commit 357b699)
Summary: react-native-web and Nativewind extend React Native's types with module augmentation. react#58062 made the props and style types interfaces, which cleared the duplicate identifier errors. Two things still can't be extended. **Styles:** `ViewStyle` is an interface derived from `____ViewStyle_Internal`, but `ViewProps['style']` reads the base, so augmenting `ViewStyle` doesn't reach it: ```ts declare module 'react-native' { interface ViewStyle { transitionDuration?: string } } <View style={{ transitionDuration: '1s' }} />; // error StyleSheet.create({ box: { transitionDuration: '1s' } }); // error ``` `____ViewStyle_Internal` is now named `ViewStyle`, and the same for Text and Image. `StyleSheet` re-exports each name unchanged, so the interface and the base are one symbol. **Props written as inline object literals:** The transform copies them into the interface body, where a second declaration is a merge conflict rather than an override, so the augmentation is silently ignored. Eleven of the 24 annotated types are affected. Each now moves its inline members into a private `<Name>Core` alias, so they reach the interface through the extends clause and are inherited, like everything from `ViewProps` already was: ```ts // before declare interface KeyboardAvoidingViewProps extends Readonly<ViewProps> { readonly enabled?: boolean } // after declare interface KeyboardAvoidingViewProps extends Readonly< ViewProps & KeyboardAvoidingViewPropsCore > {} ``` That costs 11 new names in the API snapshot, one per affected type. `PressableProps` set the precedent with `PressableBaseProps`. `ImagePropsBase` and `ImageBackgroundProps` declare members that shadow keys of the type they spread, and a Flow spread of an optional property unions the two types instead of replacing the member, so those keys get an explicit `Omit`. Caveat: an augmented member has to be assignable to the inherited one. Adding a key is clean and narrowing works, but widening raises `TS2430` on the declaration file, which `skipLibCheck: true` silences. [GENERAL] [CHANGED] - Allow module augmentation to extend generated props and style types Pull Request resolved: react#58168 Test Plan: `yarn build-types`: all 24 annotated types now emit an empty interface body. `ViewStyle`, `TextStyle` and `ImageStyle` are unchanged; the props types gain the 11 `<Name>Core` aliases. Compiled augmentations with `skipLibCheck: false`. Styles: the two lines above pass here and report `TS2353` on `main`. Props: adding a key and narrowing an existing one on each of the 11 types passes here and reports `TS2717` on `main`. `yarn flow-check`, `yarn test-generated-typescript`, `yarn format-check` and `yarn lint`: clean, apart from 3 Flow errors in `packages/react-native-codegen/lib` already on `main`. `yarn jest packages/react-native/Libraries packages/react-native/src scripts/js-api`: 632 tests pass, no snapshot changed. Reviewed By: christophpurrer Differential Revision: D117876097 Pulled By: cortinico fbshipit-source-id: c0797f14d95a01662930f7158738ea79e1bf1a30 (cherry picked from commit 447ccd1)
#publish-packages-to-npm&next
Merge upstream v0.88.0-rc.4 on top of the 0.87 release stack (microsoft#3107). Resolve 181 conflicts, keeping macOS changes on upstream 0.88 code: SwiftPM/prebuild scripts, podspecs, Fabric and core modules, typings (moved to types_DEPRECATED), RNTester macOS targets. Verified: flow-check, full jest (248 suites), lint, build-types validate, featureflags and cxx-api snapshots, ruby tests, RNTester macOS/iOS/visionOS Debug builds.
This was referenced Oct 10, 2026
Upstream 0.88 defaults RCT_USE_PREBUILT_RNCORE and RCT_USE_RN_DEP to 1,
pulling upstream React Native's prebuilt core from Maven. Those binaries
have no macOS slice and none of this fork's changes, so a macOS app
fails to build ('React/RCTBridgeModule.h' file not found). Default both
to 0; consumers can still opt in with 1.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This merges upstream
v0.88.0-rc.4onto the tip of the 0.87 release stack (microsoft#3107,1a9971c257), as a candidate next layer for the tracker in microsoft#3098. The common ancestor is the 0.87 fork point on upstreammain(ce057d6554), so this brings in the 567 upstream commits from 0.87.1 to 0.88.0-rc.4.Conflict resolution
181 conflicting files. The rule for each file was upstream 0.88 as the base, with every RNM change re-applied on top (
[macOS]tags,TARGET_OS_OSXguards). Notable decisions:SwiftPM and ios-prebuild scripts (add/add): the 0.87 stack's "Apple foundations" layer backported upstream SwiftPM work that 0.88 now ships itself. I took upstream's files and re-applied only the macOS-specific hunks:
react-native-macosbeforereact-nativeinresolveReactNativeRoot.HERMES_CLI_PATH: dropped the bakedHERMES_CLI_PATHsetting, following upstream [iOS][swiftpm] stop baking an absolute HERMES_CLI_PATH into the app pbxproj react/react-native#58292, which removed it deliberately.Typings: upstream moved
types/index.d.tstotypes_DEPRECATED/index.d.ts. I ported the macOSvirtualized-listsre-export and thePlatformColorValueTypesMacOSre-export there. I also movedPlatformColorValueTypesMacOS.d.tsnext to them and repointedmacos.d.tsand__typetests__/macos-public-api.ts.ReactNativeApi.d.ts: regenerated withyarn build-types, not hand-merged. The macOS exports are intact.Native: every RNM change was carried onto upstream 0.88 code in:
RCTViewComponentView,RCTDeviceInfo,RCTUtils,RCTFontUtils;DevSettings,AppDelegate.Following upstream, the Linking and PushNotification macOS methods are now spec methods rather than
RCT_EXPORT_METHOD.New in 0.88, needed for macOS:
ReactCommon/react/renderer/components/view/HostPlatformViewEvents.h, because upstream'sReact/View.humbrella includes it underTARGET_OS_OSX;#if !TARGET_OS_OSXguards on the UIScene-only methods inRCTReactNativeFactory.h/.mm;SceneDelegateis kept out of the macOS target;osxplatforms on the new upstream pods (React-cxxstableapi,React-resizeobservernativemodule).react_native_pods.rbdefaultsRCT_USE_PREBUILT_RNCOREandRCT_USE_RN_DEPto 0 (41e34559a3). Upstream 0.88 defaults them to 1, which pulls upstream React Native's prebuilt core from Maven. That core has no macOS slice and none of this fork's changes, so a macOS app fails with'React/RCTBridgeModule.h' file not found. Consumers can still opt in with 1.Toolchain:
hermes-parser/hermes-estreetoflow-parser/flow-estree0.327, and updated the.yarnrc.ymlpackageExtensions;yarn.lockwith Yarn 4.12;.changeset/config.jsonnow has baseorigin/0.88-stable.Kept RNM's deletion of
ECOSYSTEM.md. Deleted thereact-native-manifestESLint rule, following upstream (Consolidate package checks into one Jest test react/react-native#57509).Verification
All run on the merge commit:
yarn flow-check: 0 errorsyarn jest(whole repo): 248/248 suites, 6,350 tests (1 pre-existing skip), 1,679 snapshotsyarn lintyarn build-types --validateyarn test-typescript-legacyyarn test-generated-typescript, includingmacos-public-apiyarn featureflags --verify-unchangedcxx-api-validate: 9/9 snapshotsformat-checklint-markdownconstraintsrun_ruby_tests.shandhermes-utils-test.rbpod installwith a regeneratedPodfile.lockyarn build, and annpm publish --dry-runover the workspacesDownstream: an Expo SDK 58 app (Spark, a desktop framework, with a real mail client on it) builds and runs on tarballs packed from this branch. It needed three Expo-side changes, because Expo 58's macOS code assumes RNM before 0.84. Those are filed with Expo separately.
Known gaps, not done here
community-cli-plugindev server: 0.88's newloadCommunityMiddleware.jscallsrequire('@react-native-community/cli'), which doesn't resolve from that package undernodeLinker: pnpm. RNTester's dev server then runs without/statusand/symbolicate. The Flow error is suppressed with a[macOS]$FlowFixMe, but the runtime problem isn't fixed. It probably needs apackageExtensionsentry or a dependency change.microsoft-prebuild-macos-core.yml);react-native-macos-init/ verdaccio job;yarn change:checkneeds anorigin/0.88-stablebranch first.codegen-typescript-test:private/react-native-codegen-typescript-testyarn buildfails. That's pre-existing: the package has no@types/node, and itsrimrafglob is unquoted.