Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54408
Follows from the parent commit. This will prevent 3P CDP clients from using the `Tracing` or `Network` domains when we are in an unsupported multi React Native Host setup.
Changelog: [Internal]
Reviewed By: hoxyq
Differential Revision: D86201688
fbshipit-source-id: 052d563a371fd77c1a05ad8518e222d6bc1eb372
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54407
Introduces a new `InspectorSystemState` object and `ReactNativeApplication.systemStateChanged` CDP event, used to assert whether more than one React Native Host has been registered for the current app lifetime.
This will be used to disable the Performance and Network features in React Native DevTools when the debugger backend is in this currently unsupported state. We intend to implement host lifecycle correctness across all features soon.
Changelog: [Internal]
Reviewed By: cipolleschi
Differential Revision: D86201689
fbshipit-source-id: b8525359fc01eb7ae666879f2c0fd4c94f0af81a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54479
Fixes failing CI jobs on `0.83-stable`, e.g. https://github.com/facebook/react-native/actions/runs/19234912061/job/54982161510.
**Changes**
- Simplify main package `package.json` file read with existing `getWorkspaceRoot` util.
- Fix test by mocking `getWorkspaceRoot` (previously: read the real filesystem and caused test breakage outside `main`).
- Add additional `RC0 → RC1` test case.
Changelog: [Internal]
Reviewed By: cipolleschi
Differential Revision: D86674348
fbshipit-source-id: 0b8feb4cbf7b1ac7cf4cc560f066a0a10aec1b5f
Summary:
When RCT_SYMBOLICATE_PREBUILT_FRAMEWORKS is enabled, source file paths in dSYMs were incorrectly resolved with extra path segments:
double node_modules (e.g., /path/node_modules/node_modules/...)
The root cause was using File.expand_path(@react_native_path) without the correct base directory. The path was first expanded without a base (causing double node_modules), then fixed to use project_pods_root (ios/Pods/), which still resulted in incorrect paths with an extra ios/ folder.
Fixed by expanding the path relative to Pod::Config.instance.installation_root, which correctly points to the ios/ directory, allowing relative paths like ../node_modules/react-native to resolve properly to the project root's node_modules directory.
## Changelog:
[IOS] [FIXED] - Fix incorrect source path resolution in dSYM remapping in precompiled framework scripts
Pull Request resolved: https://github.com/facebook/react-native/pull/54470
Test Plan:
```
rm -rf ./Pods
pod cache clean --all
RCT_USE_RN_DEP=1 RCT_USE_PREBUILT_RNCORE=1 RCT_SYMBOLICATE_PREBUILT_FRAMEWORKS=1 bundle exec pod install
```
✅ Tested with RN-Tester
✅ Tested in 0.83.rc0 project
Reviewed By: huntie
Differential Revision: D86667786
Pulled By: cipolleschi
fbshipit-source-id: cd6279d02d5ed7188e282e4491c05de35f17a8f1
Summary:
OSS community shared with me that we have a circular dependency in React-utils.podspec that prevent them from building with JSC.
While fixing it, I realized that the dynamic framework build was broken. So I fixed them both.
## Changelog:
[iOS][Fixed] - Fixed build with dynamic frameworks
Pull Request resolved: https://github.com/facebook/react-native/pull/54421
Test Plan: Build RNTester locally with USE_FRAMEWORKS=dynamic
Reviewed By: javache
Differential Revision: D86309592
Pulled By: cipolleschi
fbshipit-source-id: f2995332ae135ce951480b353df7d597ff8a85ec
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54419
Changelog: [Internal]
React Native uses `files` field in `package.json` to list everything that should end up in the apckage. `.hermesv1version` file was missing from that list, which is fixed by this diff.
Reviewed By: huntie, cipolleschi
Differential Revision: D86295805
fbshipit-source-id: 8a17191f26f9536884e4aaf09447121c020d1212
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54385
Changelog: [Internal]
`test-release-local` shouldn't be changing the hermes version stored in `version.properties` as this script should be called on a cut branch with hermes already bumped.
Reviewed By: cipolleschi
Differential Revision: D86105703
fbshipit-source-id: 5a1edd9f7a6cd756521749c2b0023ea683dadf82
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54363
The calculus for active scroll maintainVisibleContentPosition is not isomorphic between ReactHorizontalScrollView and ReactScrollView. Additiionally, it doesn't make sense that we would use an x-offset in a y-offset calculation. This fixes a likely bug where the OverScroller's x-offset is used to compute the scroll animation update in ReactScrollView.recreateFlingAnimation.
## Changelog
[Android][Fixed] - Issue with restarting scroll in maintainVisibleContentPosition
Reviewed By: javache
Differential Revision: D86021007
fbshipit-source-id: 0d7febcbccd59df534bacbba7f1b5bb5085fa95f
Summary:
While integrating nightlies in the main Expo repo, I noticed an issue where iOS builds would fail in release mode when setting `RCT_USE_RN_DEP=1`. The error was thrown by a failure in the `replace_dependencies_version` script given that during the pod install phase, we were not downloading the release artifacts for nightlies, only the debug ones.
## Changelog:
[IOS] [FIXED] - Fix using iOS nightly prebuilds in release mode
Pull Request resolved: https://github.com/facebook/react-native/pull/54369
Test Plan:
1. run `RCT_DEPS_VERSION=nightly pod install`
2. Build the app in release mode
Reviewed By: javache
Differential Revision: D86089167
Pulled By: cipolleschi
fbshipit-source-id: ea9a608926ed0a9145e3e305e8a3210364e1d36c
Summary:
Setting `ENV['RCT_USE_PREBUILT_RNCORE'] = '1'` when running nightlies on iOS will result in the following error:
<img height="608" alt="image" src="https://github.com/user-attachments/assets/130112d7-d4d8-4934-be56-c020a4b204a6" />
The reason for this happening is that we precompile the iOS artifacts on CI using whatever version is set on main (by default version 1000). This works fine when using RCs and stable versions because before the publishing step we do a release commit (e.g https://github.com/facebook/react-native/commit/57ff54492f4a5a0e9d331e880b3c2264a2bd81f7), which updates the react-native version.
This can be easily mitigated by invoking the `set-rn-artifacts-version` CLI right before building the iOS prebuilds.
## Changelog:
[IOS] [FIXED] - Fix iOS version mismatch when using nightly prebuilds
Pull Request resolved: https://github.com/facebook/react-native/pull/54370
Test Plan: Run `node ./scripts/releases/set-rn-artifacts-version.js --build-type` locally
Reviewed By: javache
Differential Revision: D86089144
Pulled By: cipolleschi
fbshipit-source-id: a5c296ea8e022e562f7898803ab37dc61ffd67b6
Summary:
Following the [RFC](https://github.com/react-native-community/discussions-and-proposals/pull/933), this PR adds new `setBundleSource` methods to `ReactHost` for modifying bundle URL at runtime. The first one with signature:
```Kotlin
public fun setBundleSource(debugServerHost: String, moduleName: String, queryBuilder: (Map<String, String>) -> Map<String, String> = { it })
```
takes debugServerHost (set in packager connection settings), moduleName (set in DevSupportManager's jsAppBundleName), and queryBuilder (set in packager connection settings). Before updating settings, the packager connection is closed to reset the packager client, which will be newly created during reload with updated configuration.
The second one for loading bundle from the file takes single `filePath` argument:
```Kotlin
public fun setBundleSource(filePath: String)
```
It sets `customBundleFilePath` in `DevSupportManager` which has priority over other methods of loading the bundle in `jsBundleLoader` and reloads `ReactHost`.
## Changelog:
[ANDROID][ADDED] - added new `setBundleSource` method to `ReactHost` for changing bundle URL at runtime.
Pull Request resolved: https://github.com/facebook/react-native/pull/54139
Test Plan:
Started with running two Metro instances on ports `8081` and `8082` (first with white background, second with blue). Created a native button that toggles `debugServerHost` port and invokes `setBundleSource`.
https://github.com/user-attachments/assets/7afe2cbc-6fef-44bc-930c-e9f9c4edd2bd
For setting bundle file path, generated JS bundle with different background comparing to the one serving by Metro. Moved file to the `app/files` directory in android emulator and configured native button to invoke a `setBundleSource(filePath)`.
https://github.com/user-attachments/assets/5e59d7b7-c6ae-475c-94e3-50d4ac69cf24
<details>
<summary>code:</summary>
Changing debug server host:
`RNTesterActivity.kt`:
```Kotlin
package com.facebook.react.uiapp
import android.content.res.Configuration
import android.graphics.Color
import android.os.Bundle
import android.view.View
import android.widget.Button
import android.widget.FrameLayout
import androidx.core.graphics.drawable.toDrawable
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.facebook.common.logging.FLog
import com.facebook.react.FBRNTesterEndToEndHelper
import com.facebook.react.ReactActivity
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
import com.facebook.react.defaults.DefaultReactActivityDelegate
import java.io.FileDescriptor
import java.io.PrintWriter
internal class RNTesterActivity : ReactActivity() {
private var activePort = "8081"
class RNTesterActivityDelegate(val activity: ReactActivity, mainComponentName: String) :
DefaultReactActivityDelegate(activity, mainComponentName, fabricEnabled) {
private val PARAM_ROUTE = "route"
private lateinit var initialProps: Bundle
override fun onCreate(savedInstanceState: Bundle?) {
// Get remote param before calling super which uses it
val bundle = activity.intent?.extras
if (bundle != null && bundle.containsKey(PARAM_ROUTE)) {
val routeUri = "rntester://example/${bundle.getString(PARAM_ROUTE)}Example"
initialProps = Bundle().apply { putString("exampleFromAppetizeParams", routeUri) }
}
FBRNTesterEndToEndHelper.onCreate(activity.application)
super.onCreate(savedInstanceState)
}
override fun getLaunchOptions() =
if (this::initialProps.isInitialized) initialProps else Bundle()
}
private fun getButtonText(): String {
return "Port: $activePort"
}
private fun setupPortButton(onClick: () -> Unit) {
val portButton = Button(this).apply {
text = getButtonText()
setBackgroundColor(Color.rgb(0, 123, 255)) // Blue background
setTextColor(Color.WHITE)
setPadding(32, 16, 32, 16)
textSize = 16f
elevation = 8f
}
// Get the root view and add button to it
val rootView = this.findViewById<FrameLayout>(android.R.id.content)
val layoutParams = FrameLayout.LayoutParams(
FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT
).apply {
gravity = android.view.Gravity.TOP or android.view.Gravity.CENTER_HORIZONTAL
topMargin = 200 // 50dp from top
}
rootView.addView(portButton, layoutParams)
portButton.setOnClickListener {
onClick()
portButton.text = getButtonText()
}
}
// set background color so it will show below transparent system bars on forced edge-to-edge
private fun maybeUpdateBackgroundColor() {
val isDarkMode =
resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK ==
Configuration.UI_MODE_NIGHT_YES
val color =
if (isDarkMode) {
Color.rgb(11, 6, 0)
} else {
Color.rgb(243, 248, 255)
}
window?.setBackgroundDrawable(color.toDrawable())
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
fullyDrawnReporter.addReporter()
maybeUpdateBackgroundColor()
reactDelegate?.reactHost?.let {
setupPortButton {
activePort = if (activePort == "8081") "8082" else "8081"
reactHost.setBundleSource("10.0.2.2:$activePort", "js/RNTesterApp.android")
// reactHost.setBundleSource("/data/user/0/com.facebook.react.uiapp/files/android.bundle")
}
}
// register insets listener to update margins on the ReactRootView to avoid overlap w/ system
// bars
reactDelegate?.reactRootView?.let { rootView ->
val insetsType: Int =
WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout()
val windowInsetsListener = { view: View, windowInsets: WindowInsetsCompat ->
val insets = windowInsets.getInsets(insetsType)
(view.layoutParams as FrameLayout.LayoutParams).apply {
setMargins(insets.left, insets.top, insets.right, insets.bottom)
}
WindowInsetsCompat.CONSUMED
}
ViewCompat.setOnApplyWindowInsetsListener(rootView, windowInsetsListener)
}
}
override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
// update background color on UI mode change
maybeUpdateBackgroundColor()
}
override fun createReactActivityDelegate() = RNTesterActivityDelegate(this, mainComponentName)
override fun getMainComponentName() = "RNTesterApp"
override fun dump(
prefix: String,
fd: FileDescriptor?,
writer: PrintWriter,
args: Array<String>?,
) {
FBRNTesterEndToEndHelper.maybeDump(prefix, writer, args)
}
}
```
</detail>
Reviewed By: vzaidman
Differential Revision: D84713639
Pulled By: coado
fbshipit-source-id: e332751670df24a9994448c6972f55e656c1d7c1
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54358
Improved the performance of getHashMapFromPropsReadableMap by replacing the iterator-based approach with direct key lookups. The function now directly checks for "transform" and "opacity" keys using hasKey() and getType() instead of iterating through all entries in the ReadableMap.
This optimization reduces the time complexity from O(n) to O(1) for the two specific keys we need, eliminating unnecessary iterations through irrelevant entries. Additionally, the ArrayList for transform is now pre-sized with the correct capacity to avoid reallocations.
Changelog: [Internal]
Reviewed By: christophpurrer
Differential Revision: D85967272
fbshipit-source-id: 7da60aa6383dd8b5b830f201d5bc66c7ab984572
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54349
Added comprehensive KDoc documentation to the ComponentNameResolverBinding object and its JNI method for installing component name resolvers into the JavaScript runtime.
changelog: [internal] internal
Reviewed By: lenaic
Differential Revision: D85926888
fbshipit-source-id: 253577d4c5d48bee22acb5666680becd4e632879
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54345
Added comprehensive KDoc documentation to the `FloatUtil` class and its public methods to improve code readability and developer experience.
The documentation explains:
- The purpose of epsilon-based floating-point comparison and why it's necessary
- The role of the EPSILON constant in determining equality
- Special case handling for NaN values (both considered equal when both are NaN)
- Null value handling in the nullable overload
- Method parameters and return values
This documentation will help developers understand the rationale behind using this utility instead of direct float equality comparisons, which can be unreliable due to floating-point precision issues.
changelog: [internal] internal
Reviewed By: lenaic
Differential Revision: D85923748
fbshipit-source-id: d054099de3d9903801aadca4cfcd3127bb6d5297
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54360
## Changelog:
[General] [Fixed] - Fixing an issue with the error LogBox formatting on windows causing text to wrap
Reviewed By: rickhanlonii, yannickl
Differential Revision: D76845667
fbshipit-source-id: 4b1ce705396f9818cbe9be80d521478b5eba632b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54357
Changelog: [Internal] - Ignore whether ScrollView enables subview clipping and just use the drawing rect for forwarding a clippingRect for VirtualView
Reviewed By: yungsters
Differential Revision: D85817030
fbshipit-source-id: e89298d106ec993ce1ca63131da002e0685c34dd
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54353
Changelog: [internal]
We have support for the network track in performance traces so we no longer need this custom integration.
Reviewed By: huntie
Differential Revision: D85946500
fbshipit-source-id: 4efa132a6524af6595ddf9f8c2b5651959fa1f94
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54354
Changelog: [internal]
This just renames the tracks for network, etc. to go under a "⚛ Native" track group.
Reviewed By: huntie
Differential Revision: D85946501
fbshipit-source-id: f7ea65bfd84ed4965749f7e22091bcaff38a5bc3
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54355
Changelog: [internal]
Small refactor to make sure profiling timespans don't break if there's an exception in one of the listeners.
Reviewed By: huntie
Differential Revision: D85951560
fbshipit-source-id: 162672a7e644893f46a3b0100284bc4125a83757
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54266
Introduces the concept of **Performance Issues**, an experimental performance signals concept for React Native.
**Design**
Performance Issues are an **experimental** user space API via the User Timings `detail` object.
```
performance.measure({
start,
end,
detail: {
devtools: {
...
},
rnPerfIssue: {
name: 'React: Cascading Update',
severity: 'warning', // 'info' | 'warning' | 'error',
description:
'A cascading update is a update that is triggered by a previous update. This can lead to performance issues and should be avoided.',
learnMoreUrl:
'https://react.dev/reference/dev-tools/react-performance-tracks#cascading-updates',
}
}
});
```
When `rnPerfIssue` is present, we eagerly report an the event over CDP, regardless of an active performance trace, via the `"__react_native_perf_issues_reporter"` runtime binding.
**This diff**
- Updates the V2 Perf Monitor UI (Android) to display Performance Issues as a count.
- (UI parts of this diff, including `HostTarget::installPerfIssuesBinding` are reinstated from the previous INP design, removed in D82208400).
Changelog: [Internal]
Reviewed By: hoxyq
Differential Revision: D85448199
fbshipit-source-id: 0cee0eff275219fa46ccf788a6208889d3a0506e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54265
Introduces the concept of **Performance Issues**, an experimental performance signals concept for React Native.
**Design**
Performance Issues are an **experimental** user space API via the User Timings `detail` object.
```
performance.measure({
start,
end,
detail: {
devtools: {
...
},
rnPerfIssue: {
name: 'React: Cascading Update',
severity: 'warning', // 'info' | 'warning' | 'error',
description:
'A cascading update is a update that is triggered by a previous update. This can lead to performance issues and should be avoided.',
learnMoreUrl:
'https://react.dev/reference/dev-tools/react-performance-tracks#cascading-updates',
}
}
});
```
When `rnPerfIssue` is present, we eagerly report an the event over CDP, regardless of an active performance trace, via the `"__react_native_perf_issues_reporter"` runtime binding.
**This diff**
- Adds a `perfIssuesEnabled` feature flag.
- Initial implementation of the above API.
- Initially reports a "Cascading Render" issue, aligning 1:1 with the corresponding React performance track event (note: to be added in the React codebase, see https://github.com/facebook/react/pull/34961).
This feature is gated by the `perfMonitorV2Enabled` feature flag.
Changelog: [Internal]
Reviewed By: hoxyq
Differential Revision: D85448200
fbshipit-source-id: e5aed5138682331e1cd3a713a5f09fb6745138bc
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54343
Fixed NotWrittenPrivateField lint warnings in ReactHorizontalScrollView.java by marking three private static fields as final:
- DEBUG_MODE: Changed from `private static boolean` to `private static final boolean`
- TAG: Changed from `private static String` to `private static final String`
- NO_SCROLL_POSITION: Changed from `private static int` to `private static final int`
These fields are initialized once and never modified, making them compile-time constants. Marking them as final follows Java best practices and prevents potential issues with Redex code optimization.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D85904890
fbshipit-source-id: f83a19392a2418d8415936421f1e021316643056
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54342
`-Wswitch-enum` was introduced in 2024 and is beneficial because it will err when switch statement is missing a case for an enum, even with `default:` present. This helps alert developers when they add an enum value of all the switch statements that need updating.
These diffs are to help progress the codebase so that we can enable `-Wswitch-enum` by default in `fbobjc`
## Changelog:
[General] [Fixed] - Add missing value to switch for `-Wswitch-enum` builds
Differential Revision: D85835952
fbshipit-source-id: e56c45895a63325e565315a39ea59df769c4a3ad