12676 Commits
Author SHA1 Message Date
React Native Bot a98aa814cf Release 0.83.0
#publish-packages-to-npm&latest
2025-12-10 17:11:58 +00:00
React Native Bot 1c511e1e4f [LOCAL] Bump Podfile.lock 2025-12-08 14:36:23 +00:00
React Native Bot 015b567ab7 Release 0.83.0-rc.5
#publish-packages-to-npm&next
2025-12-08 12:32:29 +00:00
Alex Hunt 8a9a3592a7 Fix multipart/form-data request payload previews on Android (#54804)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54804

Resolves https://github.com/facebook/react-native/issues/54796#issuecomment-3616644916.

Fixes a bug where for `multipart/form-data` requests on Android, request payload previews were not using a correctly serialized preview string in React Native DevTools.

Changelog: [Internal]

Reviewed By: vzaidman

Differential Revision: D88495615

fbshipit-source-id: 757487b3588372404fa45f980e0bcfae5c7c6457
2025-12-08 10:24:49 +00:00
Alex Hunt 75f4c83828 Fix remaining missing debugger build flags for open source builds (#54770) 2025-12-05 17:55:29 +00:00
Alex Hunt 30cbe978da Exclude legacy Hermes targets from single host assertion (#54790) 2025-12-05 17:52:32 +00:00
React Native Bot 6227d99c57 [LOCAL] Bump Podfile.lock 2025-12-03 16:37:57 +00:00
React Native Bot c8dd7d4973 Release 0.83.0-rc.4
#publish-packages-to-npm&next
2025-12-03 14:22:19 +00:00
Tommy Nguyen 45281ba48f Fix 'hermes-compiler' not being resolved correctly (#54667)
Summary:
Fixed `hermes-compiler` not being resolved correctly when your repo is set up as a monorepo using pnpm.

## Changelog:

[GENERAL] [FIXED] - Fixed `hermes-compiler` not being resolved correctly when your repo is set up as a monorepo using pnpm.

Pull Request resolved: https://github.com/facebook/react-native/pull/54667

Test Plan: n/a

Reviewed By: cortinico

Differential Revision: D87873273

Pulled By: cipolleschi

fbshipit-source-id: 4d60a00ae579bc4a671d6536de4dd02bdefef6c8
2025-12-02 17:48:29 +00:00
Dawid Malecki 53d4634b60 Fix: loading bundle using debug_http_host preferences (#54687)
Summary:
In https://github.com/facebook/react-native/issues/54139 I have removed checking shared preferences for `debug_http_host`. The diff reverts this removal because it is used for changing the bundle source before the app starts.

## Changelog:

[ANDROID][FIXED] - revert removal of checking shared preferences for `debug_http_host`.

Pull Request resolved: https://github.com/facebook/react-native/pull/54687

Test Plan:
I have run the `rn-tester` app and swapped a default prefs file on Android emulator located in:  `/data/data/com.facebook.react.uiapp/shared_prefs/com.facebook.react.uiapp_preferences.xml` with one that had updated port in `debug_http_host` setting to `8082`:

```xml
<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<map>
    <boolean name="fps_debug" value="true" />
    <string name="debug_http_host">10.0.2.2:8082</string>
    <boolean name="inspector_debug" value="true" />
</map>
```

Then, I have run the app and checked if the bundle is loaded from the Metro instance invoked using `yarn start --port 8082`.

Reviewed By: cortinico

Differential Revision: D87869540

Pulled By: coado

fbshipit-source-id: 9a76990b097ad7ff24cbbc5202ca935053de23e5
2025-12-02 17:48:16 +00:00
Phil Pluckthun f8207d6c75 Update generate-artifacts-executor script to account for optional output path (#54609)
Summary:
The argument for the output path to this CLI has always been optional, but the types didn't reflect this, which caused a few regressions in recent changes (e.g. https://github.com/facebook/react-native/issues/53503)

There's several code paths where the `baseOutputPath` can be altered or derived in different ways, which wasn't respected in logic before the main codegen output block or in `generateReactCodegenPodspec`.

When applied, this PR alters the `baseOutputPath` logic to use a default by `computeBaseOutputPath` extracted from `computeOutputPath` and have an added `process.env.RCT_SCRIPT_OUTPUT_DIR` override, which was previously only applied to `readReactNativeConfig`

This should restore:
- `react-native codegen` being run without an `--outputPath` argument
- codegen running with a `package.json:codegenConfig.outputDir` override

Resolves https://github.com/facebook/react-native/issues/54473

## Changelog:

[GENERAL] [FIXED] - Ensure codegen CLI supports unspecified `--outputPath` argument and respects `codegenConfig.outputDir` configurations

Pull Request resolved: https://github.com/facebook/react-native/pull/54609

Test Plan: - Manually run `react-native codegen` in `rn-tester`

Reviewed By: cipolleschi

Differential Revision: D87456501

Pulled By: cortinico

fbshipit-source-id: 997e99af1f99227eb70955478643b28b1a90df61
2025-12-02 17:47:50 +00:00
Tommy Nguyen ad5e2680c8 Fix exception in codegen when dependency is not found (#54665)
Summary:
Fixed an `ENOENT` exception when a dependency does not export `package.json`, and your repo is set up as a monorepo using pnpm.

> [!NOTE]
>
> This does not fix the actual search algorithm. We shouldn't be using `require.main.paths` here because it does not point to the correct starting point, the project root.
>
> This change only fixes the case where we cannot find `package.json` at all.

## Changelog:

[GENERAL] [FIXED] - Fixed an `ENOENT` exception when a dependency does not export `package.json`, and your repo is set up as a monorepo using pnpm

Pull Request resolved: https://github.com/facebook/react-native/pull/54665

Test Plan:
**Before:**

```
% node node_modules/react-native/scripts/generate-codegen-artifacts.js -p . -o ios -t ios
[Codegen] Analyzing package.json
[Codegen] Could not find generated autolinking output at: /~/packages/app/example/ios/build/generated/autolinking/autolinking.json
[Codegen] Searching for codegen-enabled libraries in the app.
[Codegen] The "codegenConfig" field is not defined in package.json. Assuming there is nothing to generate at the app level.
[Codegen] Could not find generated autolinking output at: /~/packages/app/example/ios/build/generated/autolinking/autolinking.json
[Codegen] Searching for codegen-enabled libraries in the project dependencies.
[Codegen] Found react-native-webapis/web-storage
[Codegen] Found react-native
[Codegen] Found react-native-safe-area-context
Trying to find `package.json` for `webdriverio` in [
  '/~/node_modules/.store/react-native-virtual-a5dea7d647/package/scripts/node_modules',
  '/~/node_modules/.store/react-native-virtual-a5dea7d647/package/node_modules',
  '/~/node_modules/.store/react-native-virtual-a5dea7d647/node_modules',
  '/~/node_modules/.store/node_modules',
  '/~/node_modules',
  '/node_modules'
]
[Codegen] Error: ENOENT: no such file or directory, open ''
[Codegen] Done.
```

**After:**

```
% node node_modules/react-native/scripts/generate-codegen-artifacts.js -p . -o ios -t ios
[Codegen] Analyzing package.json
[Codegen] Could not find generated autolinking output at: /~/packages/app/example/ios/build/generated/autolinking/autolinking.json
[Codegen] Searching for codegen-enabled libraries in the app.
[Codegen] The "codegenConfig" field is not defined in package.json. Assuming there is nothing to generate at the app level.
[Codegen] Could not find generated autolinking output at: /~/packages/app/example/ios/build/generated/autolinking/autolinking.json
[Codegen] Searching for codegen-enabled libraries in the project dependencies.
[Codegen] Found react-native-webapis/web-storage
[Codegen] Found react-native
[Codegen] Found react-native-safe-area-context
Trying to find package.json for webdriverio in [
  '/~/node_modules/.store/react-native-virtual-a5dea7d647/package/scripts/node_modules',
  '/~/node_modules/.store/react-native-virtual-a5dea7d647/package/node_modules',
  '/~/node_modules/.store/react-native-virtual-a5dea7d647/node_modules',
  '/~/node_modules/.store/node_modules',
  '/~/node_modules',
  '/node_modules'
]
[Codegen] Searching for codegen-enabled libraries in react-native.config.js
[Codegen] Processing RNWWebStorageSpec
[Codegen] Searching for podspec in the project dependencies.
[Codegen] Supported Apple platforms: ios, macos, visionos for RNWWebStorageSpec
[Codegen] Processing FBReactNativeSpec
[Codegen] Searching for podspec in the project dependencies.
[Codegen] Processing safeareacontext
[Codegen] Searching for podspec in the project dependencies.
[Codegen] Supported Apple platforms: ios, macos, tvos, visionos for safeareacontext
[Codegen] Generating Native Code for RNWWebStorageSpec - ios
[Codegen] Generated artifacts: ios/build/generated/ios/ReactCodegen
[Codegen] [Codegen - FBReactNativeSpec] Skipping iOS code generation for FBReactNativeSpec as it has been generated already.
[Codegen] Generating Native Code for safeareacontext - ios
[Codegen] Generated artifacts: ios/build/generated/ios/ReactCodegen
[Codegen] Generating RCTThirdPartyComponentsProvider.h
[Codegen] Generated artifact: ios/build/generated/ios/ReactCodegen/RCTThirdPartyComponentsProvider.h
[Codegen] Generating RCTThirdPartyComponentsProvider.mm
[Codegen] Generated artifact: ios/build/generated/ios/ReactCodegen/RCTThirdPartyComponentsProvider.mm
[Codegen] Generating RCTModulesProvider.h
[Codegen] Generated artifact: ios/build/generated/ios/ReactCodegen/RCTModuleProviders.h
[Codegen] Generating RCTModuleProviders.mm
[Codegen] Generated artifact: ios/build/generated/ios/ReactCodegen/RCTModuleProviders.mm
[Codegen] Generating RCTAppDependencyProvider
[Codegen] Generated artifact: ios/build/generated/ios/ReactAppDependencyProvider/RCTAppDependencyProvider.h
[Codegen] Generated artifact: ios/build/generated/ios/ReactAppDependencyProvider/RCTAppDependencyProvider.mm
[Codegen] Generated podspec: ios/build/generated/ios/ReactAppDependencyProvider/ReactAppDependencyProvider.podspec
[Codegen] Generated podspec: ios/build/generated/ios/ReactCodegen/ReactCodegen.podspec
[Codegen] Generating Package.swift
[Codegen] Generated artifact: ios/build/generated/ios/Package.swift
[Codegen] Done.
```

Reviewed By: cipolleschi

Differential Revision: D87872496

Pulled By: cortinico

fbshipit-source-id: b9da0e1808248cb806a2a8a0ee575566ce027067
2025-12-02 17:47:03 +00:00
Christian Falch 2bc6b00832 Fixed symbol mapping to slices (#54641)
Summary:
Previously the symbolication support when using the precompiled React.XCFramework copied the symbol bundles to the wrong folder in the framework, causing Xcode to not find the symbols.

This commit fixes this by copying symbols to the correct slice folders instead of in the root of the framework folder.

Note:
Running `pod cache clean --all` and `rm -rf Pods` in the iOS folder followed by a clean rebuild in Xcode might be a good thing to ensure you're using the correct binaries when compiling.

## Changelog:

[IOS] [FIXED] - Fixed copying symbol bundles into correct slice folder

Pull Request resolved: https://github.com/facebook/react-native/pull/54641

Test Plan:
```
npx react-native-community/cli init Next --version next --skip-install
cd Next
yarn
cd ios
bundle install
RCT_USE_RN_DEP=1 RCT_USE_PREBUILT_RNCORE=1 RCT_SYMBOLICATE_PREBUILT_FRAMEWORKS=1 bundle exec pod install
```

Run Xcode and observe that you are not able to step into React Native source code.

After this fix, you should be able to step into the source code of React Native.

Reviewed By: cortinico

Differential Revision: D87919202

Pulled By: cipolleschi

fbshipit-source-id: 029bca3e182c170562e358beb50592d5b91d8e8b
2025-12-02 17:46:25 +00:00
Alex Hunt 3341bb57b1 Enable RNDT standalone shell by default (#54754)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54754

Enables the standalone app shell for React Native DevTools by default.

We preserve + document this flag as an opt-out (allowing Frameworks to override this behaviour if needed).

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D88161573

fbshipit-source-id: 64ee191dcead4e639bb3067bc9e715b1c8cdf80d
2025-12-02 17:45:34 +00:00
Alex Hunt 83a3741c54 [LOCAL] Fix root gitignore, add remaining debugger-frontend assets 2025-12-02 17:21:37 +00:00
Alex Hunt fccbc53733 [LOCAL] Update debugger-frontend from e1dd7af...7d3b734
Local sync from 0.83-stable branch
2025-12-02 17:05:48 +00:00
React Native Bot 8713f2ab5f [LOCAL] Bump Podfile.lock 2025-11-24 16:34:22 +00:00
React Native Bot 67e9b5743d Release 0.83.0-rc.3
#publish-packages-to-npm&next
2025-11-24 14:16:17 +00:00
Riccardo Cipolleschi 0574090941 [LOCAL] Bump Hermes-v1 2025-11-24 11:04:46 +00:00
Riccardo Cipolleschi eb78fbae27 [LOCAL] Enable Network panel on Android and iOS (#54617) 2025-11-24 11:02:55 +00:00
React Native Bot d7e36db485 [LOCAL] Bump Podfile.lock 2025-11-17 17:32:01 +00:00
React Native Bot 137c339e61 Release 0.83.0-rc.2
#publish-packages-to-npm&next
2025-11-17 15:13:27 +00:00
Riccardo Cipolleschi 66469b58d8 Enable network event reporting and CDP Network domain support on the 0.83-stable branch.
Changelog: [General][Added] - React Native DevTools: Enable Network inspection features
2025-11-17 10:30:07 +00:00
Luna Wei 5119db44ce Gate with feature flag for canary (#54454)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54454

Changelog: [Internal] - Add feature flag around IntersectionObserver for canary

Reviewed By: rubennorte, cipolleschi

Differential Revision: D86547485

fbshipit-source-id: 0c6d84e276d1f6337a8da0bea141cc371010cd75
2025-11-17 10:26:37 +00:00
Riccardo Cipolleschi 5777a4e6e9 [LOCAL] Bump Podfile.lock 2025-11-17 10:14:17 +00:00
React Native Bot 90d66d55a8 Release 0.83.0-rc.1
#publish-packages-to-npm&next
2025-11-11 16:19:42 +00:00
Alex Hunt 19359ed095 Update debugger-frontend from 7aa57d1...e1dd7af
Local sync from 0.83-stable branch
2025-11-11 11:34:06 +00:00
Alex Hunt 6fd2cc27f8 Update Network and Tracing handlers to error under multiple hosts (#54408)
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
2025-11-11 11:25:35 +00:00
Alex Hunt 74d687c213 Add single host inspector state assertion over CDP (#54407)
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
2025-11-11 11:24:34 +00:00
Christian Falch f81fc0a16e fix wrong symbolication mapping (#54470)
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
2025-11-10 15:52:41 +00:00
Riccardo Cipolleschi 175b7f987f Fix Dynamic framework build and resolve circular dependency for JSC (#54421)
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
2025-11-10 14:25:14 +00:00
Jakub Piasecki 5f8a2c1c06 Include .hermesv1version file in the NPM package (#54419)
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
2025-11-10 14:24:56 +00:00
Riccardo Cipolleschi 79302df4de [LOCAL] Bump HermesV1 versions (#54469) 2025-11-10 14:20:33 +00:00
Alex Hunt 29d07cb079 [LOCAL] Update lockfiles 2025-11-05 13:22:55 +00:00
React Native Bot 364e7a41db Release 0.83.0-rc.0
#publish-packages-to-npm&next
2025-11-04 17:15:16 +00:00
Alex Hunt e30710c3a2 Fix Hermes version tags 2025-11-03 17:14:43 +00:00
Alex Hunt de3c15fec1 Bump Hermes version 2025-11-03 16:28:41 +00:00
Eric Rozell a034841fd6 Fix likely bug in maintainVisibleContentPosition (#54363)
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
2025-11-03 06:06:09 -08:00
Gabriel Donadel 19d87c874e fix: iOS nightly prebuilds in release mode (#54369)
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
2025-11-03 03:37:45 -08:00
Dawid Malecki 005d705aff Android: Add setBundleSource method to ReactHost for changing bundle URL at runtime (#54139)
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
2025-11-03 02:11:31 -08:00
Nick Lefever 54047f891f Optimize getHashMapFromPropsReadableMap in SurfaceMountingManager (#54358)
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
2025-11-02 17:02:05 -08:00
Zeya Peng d8e6a985a3 Avoid acquiring multiple locks in async node creation (#54359)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54359

## Changelog:

[Internal] [Changed] [react-native][cxx animated] Avoid acquiring multiple locks in async node creation

Reviewed By: christophpurrer

Differential Revision: D85969336

fbshipit-source-id: bfc05d5b8b36318aec21e1ad966e21108978afd0
2025-11-01 14:10:55 -07:00
Pieter De Baets 693e9628e8 Mark mOnViewAttachMountItems as final in SurfaceMountingManager.java (#54344)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54344

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D85904478

fbshipit-source-id: 961d12bf1cbf04b9087a518531b20d87be3ccb63
2025-10-31 15:50:52 -07:00
David Vacca 0e3a210be1 Add comprehensive KDoc documentation to FilterHelper (#54350)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54350

Added comprehensive KDoc documentation to the FilterHelper object and its primary public method for parsing and applying CSS filter effects on Android S+ (API 31+).

changelog: [internal] internal

Reviewed By: lenaic

Differential Revision: D85926889

fbshipit-source-id: e20bb0697753e710d66acc3ef4078ab009d6dc5d
2025-10-31 14:42:30 -07:00
David Vacca b8f9d982f5 Add KDoc documentation to ComponentNameResolverBinding (#54349)
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
2025-10-31 14:42:30 -07:00
David Vacca 7d7d843666 Add KDoc documentation to ComponentNameResolver interface (#54348)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54348

Added comprehensive KDoc documentation to the ComponentNameResolver interface and its property providing access to registered component names.

changelog: [internal] internal

Reviewed By: lenaic

Differential Revision: D85926887

fbshipit-source-id: ae12629e27f88555c7876d3343a146b1b5c3dec0
2025-10-31 14:42:30 -07:00
David Vacca 89bcc02a07 Add KDoc documentation to BlendModeHelper (#54347)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54347

Added comprehensive KDoc documentation to the BlendModeHelper object and its public method for parsing CSS mix-blend-mode properties on Android Q+.

changelog: [internal] internal

Reviewed By: lenaic

Differential Revision: D85926891

fbshipit-source-id: bcafa6b02281d5265f59b34641847bc3b19d6604
2025-10-31 14:42:30 -07:00
David Vacca ad0210c535 Add comprehensive KDoc documentation to BackgroundStyleApplicator (#54346)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54346

Added comprehensive KDoc documentation to the BackgroundStyleApplicator class and all 25 public methods covering backgrounds, borders, outlines, and box shadows.

changelog: [internal] internal

Reviewed By: lenaic

Differential Revision: D85926890

fbshipit-source-id: 5a398bf8d57d6b6dff6b012ac225bc96d56e2573
2025-10-31 14:42:30 -07:00
David Vacca cc2101d063 Add KDoc documentation to FloatUtil class (#54345)
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
2025-10-31 14:42:30 -07:00
Gianni Moschini e2b62bc435 fix code snippet text container in AnsiHiglight (#54360)
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
2025-10-31 13:24:51 -07:00