Commit Graph

38536 Commits

Author SHA1 Message Date
Bartłomiej Błoniarz 0d7a92b551 Add conditional return in handleRemoveView (#43389)
Summary:
I was recently working on an [issue](https://github.com/software-mansion/react-native-reanimated/issues/5715) in Reanimated where z-index of some views was broken after a Layout Animation was used. The issue was that in some cases we were calling the `removeView` function on a already removed view. On plain Android this wouldn't be an issue, since the `removeView` function ignores such calls. Unfortunately, the `ReactViewGroup.java` implementation maintains a counter of views with user defined z-index. This counter is decremented whenever a call to `removeView` is made, even if the view is not a child of this `ViewGroup`. This PR adds an additional check in the `handleRemoveView` function to unify the `removeView` behavior between Android and react-native.

## Changelog:
[ANDROID] [CHANGED] - Changed the `handleRemoveView` function in `ReactViewGroup.java` to ignore calls for `Views` that are not children of this `ViewGroup`

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

Test Plan: I tested if the `rn-tester` app behaves correctly after those changes.

Reviewed By: NickGerleman

Differential Revision: D54874780

Pulled By: javache

fbshipit-source-id: f1a34947419ef6106ee73b196ae99b7f8c2f7a77
2024-03-14 07:27:29 -07:00
Blake Friedman 47a3f52007 Add RFC-0759 deprecation logging cli init
Summary:
Implements the RFC which progressively provides warnings to users of the `npx react-native init` command as we gradually deprecate.

Changelog:
[General][Deprecated] - init cli deprecation logging

Reviewed By: cortinico

Differential Revision: D54423109

fbshipit-source-id: 679b6672bdbfc42a9b82a2aad38fd3253c6ea6a2
2024-03-14 03:37:44 -07:00
Pieter Vanderwerff 082decb76d Deploy 0.231.0 to xplat (#43475)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43475

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D54886285

fbshipit-source-id: cc4f6eeb7986a25d2bb423dac0b7d1d5a74b9703
2024-03-13 22:23:03 -07:00
Joe Vilches 50d587b67f Fix clipping children in scroll views (#43464)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43464

While working on filters I noticed that my blurred image was cropped on the scrollview. Setting `overflow: visible` for `contentContainerStyle` did not change anything. Turns out we do not call `setClipChildren(false)` like we do with [ReactViewGroup](https://www.internalfb.com/code/fbsource/[93517723586c]/xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java?lines=145).

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D54640466

fbshipit-source-id: 3f71af3170df8f75887d57643b84e64807856ca6
2024-03-13 19:30:54 -07:00
Joe Vilches 5c58811bd5 Add FilterHelper to get all RenderEffects needed to apply filters (#43357)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43357

This diff adds a class to get the needed RenderEffects to support CSS filters on Android. This diff does not add any of the plumbing for it to actually work, that comes in the next diff, but I figured this was complicated and isolated enough to be on its own.

Note that I did not add blur or drop shadow as those are a bit more involved and I plan on adding them later.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D54603892

fbshipit-source-id: 5780d7c846fdb1116e29e0a940ee02da609b01f5
2024-03-13 19:30:54 -07:00
Eric Rozell e032963727 Remove unused forward declaration of RCTMountingManager (#43453)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43453

The forward declaration for RCTMountingManager doesn't appear to be used anywhere. It can be deleted.

## Changelog

[Internal]

Reviewed By: NickGerleman

Differential Revision: D54692764

fbshipit-source-id: ba8206408fdd515387a0a6aff6a3e43c51221e57
2024-03-13 16:13:52 -07:00
Arushi Kesarwani b2e1db0fbf Support onConfigurationChanged in Bridgeless (#43463)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43463

Implement `onConfigurationChanged` in Bridgeless by adding it to ReactHostImpl

Changelog:
[Android][Breaking] Implement onConfigurationChanged in Bridgeless

Reviewed By: cortinico, RSNara

Differential Revision: D54792399

fbshipit-source-id: 6851daca815f486f4d839e128a1d740d3fec1996
2024-03-13 15:08:55 -07:00
kolyaVV 5807ada292 change: replace twitter with x (#43423)
Summary:
When users create a new app, there is an option: Follow us on Twitter with the description. Twitter is X now.
![twitter](https://github.com/facebook/react-native/assets/8622007/7565a692-0e83-4549-a688-08f3ba28c76b)

## Changelog: [Internal]
Replace the Twitter link, title, and description with X.

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

Test Plan: Set the environment for React Native app and then `npx react-native@latest init AwesomeProject`, `npm start`, and `npm run ios`

Reviewed By: cortinico

Differential Revision: D54850199

Pulled By: huntie

fbshipit-source-id: 424cb9212962d78a5b2d93d973f56498ba948136
2024-03-13 12:02:13 -07:00
Blake Friedman f855de7fed Add @react-native/core-cli-utils to build script
Summary:
Changelog: [Internal]

Use our build script for packages and to generate the TypeScript types.

bypass-github-export-checks

Reviewed By: huntie

Differential Revision: D54428870

fbshipit-source-id: 2a1666d30ac472300979b2be078a906d390e919a
2024-03-13 11:07:12 -07:00
Blake Friedman 62acc29896 Port: @react-native-community/cli#android → @react-native/core-cli-utils#android (#43289)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43289

Move react-native-community/cli build-android into core per RFC0759.  Provides:

- assemble
- build (assemble + tests)
- install

Changelog:
[General][Added] RFC-0759 Move cli Android build into core

Reviewed By: cortinico, cipolleschi

Differential Revision: D54112210

fbshipit-source-id: 2c9016dd3abd4d382a3d73abd90ba4b0eca7728c
2024-03-13 11:07:12 -07:00
Nicola Corti e9f66d9c0c Properly handle RR and CMD+M in Bridgeless Mode (#43460)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43460

Currently pressing the menu button (or CMD+M) is broken on Bridgeless mode.
Also pressing RR is not reloading the App.
That's because some Bridgeless API haven't been reimplemented correctly on Android. I'm fixing them here.

Fixes #43451

Changelog:
[Android] [Fixed] - Properly handle RR and CMD+M in Bridgeless Mode

Reviewed By: huntie

Differential Revision: D54852959

fbshipit-source-id: 8fbbdab6818da9177e6db40e45d35258c7f5e236
2024-03-13 10:55:36 -07:00
Blake Friedman 98f0893f39 Port: @react-native-community/cli#ios → @react-native/core-cli-utils#ios (#43288)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43288

Move react-native-community/cli build-ios into core per RFC0759.  This provides:

- boostrap (triggers pod install & autolinking)
- build
- install

Changelog:
[General][Added] RFC-0759 Move cli iOS build into core

Reviewed By: cortinico

Differential Revision: D54112211

fbshipit-source-id: 325ee1a2f2f38077559767264f3bee1e2837591a
2024-03-13 10:34:06 -07:00
Moti Zilberman 51e0b3a546 Integrate Hermes CDPDebugAPI with RN console polyfill (#43454)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43454

Changelog: [Internal]

1. Introduces the `RuntimeTargetDelegate::addConsoleMessage` method, which is a 1:1 wrapper around the Hermes `CDPDebugAPI` [method of the same name](https://github.com/facebook/hermes/blob/33cf8cfe781aabcad6b3d39821d815fe5317f977/API/hermes/cdp/CDPDebugAPI.h#L43-L47).
2. Installs a global `__inspectorLog` function callable from JS, matching [this existing call](https://github.com/facebook/react-native/blob/4f10f3069fff9090d700d9bcfbf49da1aa85f272/packages/polyfills/console.js#L430-L437) in React Native's `console` polyfill.

NOTE: We'll almost immediately replace `__inspectorLog` with a standalone native implementation of the `console` API that doesn't depend on the polyfill, but this is an easy way to validate the approach before tackling the full `console` spec, which requires some more C++ code and boilerplate.

Reviewed By: huntie

Differential Revision: D54494298

fbshipit-source-id: 2e04935712ff0aa31dac6c59837c47b6af6e447a
2024-03-13 10:27:29 -07:00
Rubén Norte dceda565bd Fix RN tests in preparation for D54783723 (#43458)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43458

The React sync in D54783723 was failing because some tests were relying on `console.error` being called as `console.error('Some message')` but it was refactored as `console.error('%s..', 'Some message')`, making them fail.

This fixes the tests by formatting the arguments passed to the console functions and checking against that instead.

Changelog: [internal]

Reviewed By: sammy-SC

Differential Revision: D54849485

fbshipit-source-id: 0648263614725ea3f9c95b9f9bb13005adae46eb
2024-03-13 08:51:03 -07:00
Samuel Susla 16fd5f0ff7 delete UnbatchedEventQueue (#43457)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43457

changelog: [internal]

UnbatchedEventQueue is no longer used.

Reviewed By: javache

Differential Revision: D54687451

fbshipit-source-id: 28fe2aea25d7fd98bff488197959968e24244c6e
2024-03-13 08:21:57 -07:00
Ruslan Shestopalyuk 71cf093aa3 Factor out common parts of TextInputProps between Android/iOS (#43431)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43431

## Changelog:
[Internal] -

This takes all the common props for TextInput between Android and iOS and factors them out into a single, platform independent props data structure, `BaseTextInputProps`.

This way it's both easier to manage the corresponding props, but also making this easier to be used on other platforms.

Reviewed By: sammy-SC

Differential Revision: D54764898

fbshipit-source-id: 224b01c5a67ba5d5216cd5c482bf650a1c2453d5
2024-03-13 08:15:51 -07:00
Rubén Norte 6c50418474 Remove getIsSynchronous method from RuntimeScheduler (#43441)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43441

`RuntimeScheduler::getIsSynchronous` is currently used to check if the current task is being executed on the main thread, to avoid using the background executor. This was part of a test to dispatch events synchronously in an app using background executor.

We're not running that test anymore and this method doesn't make a lot of sense in the first place (it's not checking if the current task is running on the main thread, only if the caller of the task scheduled it synchronously from whatever thread they called from), so we can remove the method.

If this is necessary in the future we should create a method that actually does something useful (like `isCurrentTaskOnMainThread()`).

Changelog: [internal]

I consider this change not to be a breaking change because runtime scheduler wasn't an official public API, and what we want to make public doesn't include this method.

Reviewed By: sammy-SC

Differential Revision: D54804805

fbshipit-source-id: 54b3a6586e08bccc201df848b942fb1fcae29f30
2024-03-13 08:07:32 -07:00
Pieter De Baets 38cbc082db Apply pointerEvents dispatch check in dispatchGenericMotionEvent (#43433)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43433

Changelog: [Android][Fixed] Views would still receive hover events when nested in a view with pointer-events: "none"

`View` calls `dispatchGenericPointerEvent` from `dispatchGenericMotionEvent` (https://android.googlesource.com/platform/frameworks/base/+/android-4.3_r2.1/core/java/android/view/View.java#7439), so this is the better method to override.

Reviewed By: markv

Differential Revision: D54799820

fbshipit-source-id: 896572b86a0e9053b0138a18ced938a9dc3e60fc
2024-03-13 04:43:12 -07:00
Alex Hunt 4f10f3069f Update test to validate Debugger domain persistence (#43446)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43446

## Context

We are migrating to the new Hermes `CDPAgent` and `CDPDebugAPI` APIs in the modern CDP server (previously `HermesCDPHandler`).

## This diff

Following D54712525, add a test case that validates `"Debugger.enable"` is persisted between reloads. This has been actioned by creating a further test group, `ModernHermesVariants`, and scoping the existing `ResolveBreakpointAfterReload` to this, with the removed second `"Debugger.enable"` message.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D54808212

fbshipit-source-id: 0775beb85a0907cca4dccbc77ec461d9515ab078
2024-03-13 01:06:50 -07:00
Arushi Kesarwani 5d711f83b5 Support onNewIntent in Bridgeless (#43401)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43401

Implement `onNewIntent` in Bridgeless by adding it to ReactHostImpl

Changelog:
[Android][Breaking] Implement `onNewIntent` in Bridgeless

Reviewed By: fkgozali, RSNara

Differential Revision: D54703159

fbshipit-source-id: fd8589d8131f4fa57188d493331dc68fb38c4520
2024-03-12 19:00:35 -07:00
Moti Zilberman 1150f21404 Persist Debugger and Runtime domain state for Hermes CDPAgent (#43443)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43443

TSIA

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D54712525

fbshipit-source-id: 34b1804088f15a2524607ebce81bceb82170feab
2024-03-12 16:45:36 -07:00
Moti Zilberman d2c5db59cd Identify Hermes CDPAgent/CDPHandler via log message (#43442)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43442

Changelog: [Internal]

TSIA

Reviewed By: huntie

Differential Revision: D54630591

fbshipit-source-id: ef3c9f871a5c7150b1b890b6afb0f07bb77968fd
2024-03-12 16:45:36 -07:00
Ruslan Shestopalyuk 3bbe193ab1 Add missing dependency from AndroidTextInput (#43448)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43448

## Changelog:
[Internal] -

This adds a stub for `TextLayoutManager.measureCachedSpannableById`, as well as a missing explicit dependency to `jni/react/jni` from the `TextInput` implementation on the Android platform.

This is required in order for certain build configurations to compile.

Reviewed By: andrewdacenko

Differential Revision: D54807518

fbshipit-source-id: 206f0edb03a4ed328a962e57d1e791614eb7f851
2024-03-12 15:24:50 -07:00
Samuel Susla 255d1cebf2 delete passthroughAnimatedPropExplicitValues from animated component (#43407)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43407

changelog: [internal]

`passthroughAnimatedPropExplicitValues` is not used. Let's remove it.

Reviewed By: yungsters

Differential Revision: D54583470

fbshipit-source-id: 9e480e4bf3216d4d6c9d7eac99a6b4d5a2e9583f
2024-03-12 15:05:51 -07:00
Fabrizio Cucci 41b6371940 Synchronize access to LongLivedObjectCollection instances (#43450)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43450

Changelog: [Internal]

This is just to make sure that all instances of `LongLivedObjectCollection` map can be safely accessed by multiple threads.

Reviewed By: RSNara

Differential Revision: D54801015

fbshipit-source-id: e0b15bfbeac9ce3a1051f83a59c5513a90ba2a4b
2024-03-12 13:18:25 -07:00
Alex Hunt eef87ca59e Implement previouslyExportedState on HermesRuntimeAgentDelegateNew (#43392)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43392

## Context

We are migrating to the new Hermes `CDPAgent` and `CDPDebugAPI` APIs in the modern CDP server (previously `HermesCDPHandler`).

## This diff

Wires up `previouslyExportedState` with `CDPAgent`, and re-enables the `ResolveBreakpointAfterReload` integration test.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D54369985

fbshipit-source-id: 5dcb4fe59b8b36b2db9f0385e8487097822e5704
2024-03-12 13:03:13 -07:00
Samuel Susla 55ed1c26ab delete EventPriority and its uses (#43437)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43437

## Changelog:
[iOS][Removed] - remove EventPriority class and always use the default EventPriority::AsynchronousBatched. This is potentially a breaking change if something in OSS sets a different priority. If a build fails because of this, simply remove the use of EventPriority.

EventPriority::AsynchronousBatched is the default and none of the other priorities are used anymore. This is the first step of removing this concept from the codebase.

Reviewed By: NickGerleman

Differential Revision: D54684311

fbshipit-source-id: 18240e5ee84f489f43b15fd9aab43f3b1b1b4963
2024-03-12 12:08:00 -07:00
Arushi Kesarwani 7b40c8ee5f Support onWindowFocusChange in Bridgeless (#43398)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43398

Implement onWindowFocusChange in Bridgeless by adding it to the ReactHostImpl

Changelog:
[Android][Breaking] Implement onWindowFocusChange in Bridgeless

Reviewed By: javache

Differential Revision: D54670119

fbshipit-source-id: 71f560e5a3bf0e853ac06955e67b8035f1ec0468
2024-03-12 11:52:52 -07:00
Pieter De Baets 9af98ccd71 Prevent OSS build breakage due to unused-local-typedef (#43449)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43449

Error:

```
react-native/packages/react-native/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp:162:5: error: unused typedef 'INVALID_REQUESTED_LOG_SEVERITY' [-Werror,-Wunused-local-typedef]
      LOG_EVERY_N(INFO, 10) << "instanceHandle is null, event of type " << type
      ^
  react-native/packages/react-native/ReactAndroid/build/third-party-ndk/glog/exported/glog/logging.h:943:30: note: expanded from macro 'LOG_EVERY_N'
                               INVALID_REQUESTED_LOG_SEVERITY);           \
                               ^
  1 error generated.
  ninja: build stopped: subcommand failed.
```

This has been fixed upstream (https://github.com/google/glog/commit/8b3023f7e4ca46e0ecf5f660dd7340c79139bc34) but we're on an older glog version, so ignore the error.

Changelog: [Internal]

Reviewed By: fabriziocucci

Differential Revision: D54811655

fbshipit-source-id: a00c23528d457ae365b0a27e680bb46afabb152f
2024-03-12 11:17:40 -07:00
Joe Vilches 3341ab7cc0 Fix bug where absolute nodes were not insetted correctly in certain cases (#43417)
Summary:
X-link: https://github.com/facebook/yoga/pull/1593

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

There was a bug where we did not position absolute nodes correctly if the static node had a different main/cross axis from the containing node. This fixes that. The change is somewhat complicated unfortunately but I tried to add sufficient comments to explain what is happening

Reviewed By: NickGerleman

Differential Revision: D54703955

fbshipit-source-id: 096c643f61d4f9bb3ee6278d675ebd69b57350d7
2024-03-12 11:08:43 -07:00
Samuel Susla 92540a618d do not synchronise native animated in paper
Summary:
## Changelog:
[General][Fixed] - Fix broken native animation in Paper

In Native Animated Paper, `scheduleUpdate` must not be called. In Fabric, the synchronisation between Fiber and Shadow trees is a must but in Paper it sets undesired state.

Reviewed By: javache

Differential Revision: D54799237

fbshipit-source-id: f6b07dc377111ed2f8253ea0c7c7e312168166e8
2024-03-12 10:19:56 -07:00
Rob Hogan 00d8f497ea Re-enable stale execution context test under new Hermes CDP Agent (#43444)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43444

Re-enable a test now that D54649943 added correct handling of stale execution context IDs.

NOTE: There's a minor difference in returned error code. The test now allows either, though note that the old implementation is more consistent with Chrome itself which returns -32000 (server error). Semantically -32600 (invalid request) seems more appropriate.

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D54805777

fbshipit-source-id: eb2baadf6b35319f5331462425eaa38b4edfab28
2024-03-12 10:04:40 -07:00
Cedric van Putten 3f41fb5d5b feature(dev-middleware): add custom message handlers to extend CDP capabilities (#43291)
Summary:
This is a proposal for the `react-native/dev-middleware` package, to allow implementers to extend the CDP capabilities of the `InspectorProxy`. It's unfortunately needed until we can move to the native Hermes CDP layer.

At Expo, we extend the CDP capabilities of this `InspectorProxy` by injecting functionality on the device level. This proposed API does the same, but without having to overwrite internal functions of both the `InspectorProxy` and `InspectorDevice`.

A good example of this is the network inspector's capabilities. This currently works through the inspection proxy, and roughly like:
- Handle any incoming `Expo(Network.receivedResponseBody)` from the _**device**_, store it, and stop event from propagating
- Handle the incoming `Network.getResponseBody` from the _**debugger**_, return the data, and stop event from propagating.

This API brings back that capability in a more structured way.

## API:

```ts
import { createDevMiddleware } from 'react-native/dev-middleware';

const { middleware, websocketEndpoints } = createDevMiddleware({
  unstable_customInspectorMessageHandler: ({ page, deviceInfo, debuggerInfo }) => {
    // Do not enable handler for page other than "SOMETHING", or for vscode debugging
    // Can also include `page.capabilities` to determine if handler is required
    if (page.title !== 'SOMETHING' || debuggerInfo.userAgent?.includes('vscode')) {
      return null;
    }

    return {
      handleDeviceMessage(message) {
        if (message.type === 'CDP_MESSAGE') {
          // Do something and stop message from propagating with return `true`
          return true;
        }
      },
      handleDebuggerMessage(message) {
        if (message.type === 'CDP_MESSAGE') {
          // Do something and stop message from propagating with return `true`
          return true;
        }
      },
    };
  },
});
```

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[GENERAL] [ADDED] - Add inspector proxy device message middleware API

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

Test Plan: See added tests and code above

Reviewed By: huntie

Differential Revision: D54804503

Pulled By: motiz88

fbshipit-source-id: ae918dcd5b7e76d3fb31db4c84717567ae60fa96
2024-03-12 09:58:51 -07:00
Rubén Norte 5833eb59e3 Implement microtasks using new JSI method (#43397)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43397

Changelog: [internal]

This migrates the Hermes-specific use of microtasks to an engine agnostic implementation based on the new JSI method to queue microtasks.

Reviewed By: sammy-SC

Differential Revision: D54687056

fbshipit-source-id: b077ba47b80f7b31c77b7e449def8a56061b0b69
2024-03-12 09:54:11 -07:00
Rubén Norte 4799d0cc5c Move spec files to specs directories in react-native/src/private (#43395)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43395

Changelog: [internal]

This moves native module specs to `specs` directory to align with the general convention.

Reviewed By: cortinico

Differential Revision: D54680056

fbshipit-source-id: 8b6ae6187e2ffa9120159b7d1fa25957677e0f4f
2024-03-12 09:54:11 -07:00
Rubén Norte 9c9c7edeb3 Allow accessing common feature flags before setting overrides for JS-only overrides (#43394)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43394

Changelog: [internal]

When we built the new feature flag system we added a constraint in the JS API to prevent calling `override` if any of the flags was already accessed from JS.

This is very restrictive because it doesn't allow us to access common flags (like `enableMicrotasks`) set up from native during the initialization of the framework because then applications wouldn't be able to set JS-only overrides.

This relaxes the constraint to disallow accessing JS-only flags before setting JS-only overrides, but accessing common (native) flags before that is ok.

Reviewed By: rshest

Differential Revision: D54687055

fbshipit-source-id: b0716f24baf7d12a5e4a61fba79e6b50ef0ad10a
2024-03-12 09:54:11 -07:00
Rubén Norte 2830066b7c Update feature flag generator to create directories for generated files before writing (#43393)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43393

Changelog: [internal]

The generator doesn't create intermediate directories, which is causing issues now that we're moving the generated native module spec to a new directory.

This fixes that.

Reviewed By: rshest

Differential Revision: D54690126

fbshipit-source-id: 1ba0d821872da7bbe1f6120ef6d0c1f800326778
2024-03-12 09:54:11 -07:00
Cedric van Putten c62be78d99 feature(dev-middleware): use userAgent query parameter as fallback when header is unset (#43364)
Summary:
At Expo, we use [Expo Tools](https://github.com/expo/vscode-expo/blob/main/src/expoDebuggers.ts) to connect the [built-in vscode-js-debug](https://github.com/microsoft/vscode-js-debug) to Hermes.

Since there are a few differences in vscode vs chrome devtools, we need to enable a couple of modifications through the [`customMessageHandler` API](https://github.com/facebook/react-native/pull/43291). Unfortunately, vscode itself doesn't set the `user-agent` header when connecting to the inspector proxy. Becuase of that, we'd need a fallback to "manually" mark the debugger as being vscode ([we use this query parameter here](https://github.com/expo/vscode-expo/blob/main/src/expoDebuggers.ts#L208)).

This PR supports setting the `user-agent` through `?userAgent=` when the header is not set.

## 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] [ADDED] - Fallback to query parameter based `user-agent` when header is unset

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

Test Plan:
- Install [Expo Tools](https://marketplace.visualstudio.com/items?itemName=expo.vscode-expo-tools)
- Start Metro with this change.
- Connect a device.
- Run the vscode command `"Expo: Debug Expo app ..."`
- Debugger should connect, and have it's user-agent marked as:
    `vscode/1.87.0 vscode-expo-tools/1.3.0`

Reviewed By: huntie

Differential Revision: D54804556

Pulled By: motiz88

fbshipit-source-id: 1ff558ba5350811ad042d08a713438e046759feb
2024-03-12 09:39:00 -07:00
Alfonso Curbelo 032873a84c Add missing commit to 0.72.12 changelog (#43434)
Summary:
## Changelog:

[INTERNAL] - Add missing commit to 0.72.12 changelog

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

Reviewed By: huntie

Differential Revision: D54805620

Pulled By: tdn120

fbshipit-source-id: c3bc31842b57c85fa584894132015f9856086876
2024-03-12 09:18:08 -07:00
Rubén Norte d456e50bb0 Add new systrace sections in MountingCoordinator (#43408)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43408

Changelog: [internal]

I think mount operations are taking longer than expected because of a debugging block (that we might remove). This adds some systrace sections to distinguish that from the overall time and confirm this only happens in debug builds.

Reviewed By: sammy-SC

Differential Revision: D54746491

fbshipit-source-id: 317b22b6dcd1ae117ed4a013180df8842bf712f0
2024-03-12 08:59:30 -07:00
Alex Hunt e2c5a36ec7 Add enableHermesCDPAgent case to ReactInstanceIntegrationTest (#43436)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43436

## Context

We are migrating to the new Hermes `CDPAgent` and `CDPDebugAPI` APIs in the modern CDP server (previously `HermesCDPHandler`).

## This diff

Expands test coverage for the Hermes `CDPAgent` implementation by enabling in `ReactInstanceIntegrationTest`.

Changelog: [Internal]

bypass-github-export-checks

Reviewed By: motiz88

Differential Revision: D54801168

fbshipit-source-id: 9b71f8e697c7ab24c1383100938b3f648774a106
2024-03-12 08:19:49 -07:00
szymonrybczak 7a00623947 Update @react-native-community/cli to 14.0.0-alpha.0 (#43415)
Summary:
Updates CLI to 14.0.0-alpha.0

## Changelog:

[GENERAL] [CHANGED] - Update `react-native-community/cli` to 14.0.0-alpha.0

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

Test Plan: CI

Reviewed By: cortinico

Differential Revision: D54760054

Pulled By: huntie

fbshipit-source-id: c4e29e2122c5de0ff60f9c52bd6f9a86ce0a5560
2024-03-12 06:18:30 -07:00
Pieter De Baets 276fdc414b Reduce logspam of missing instanceHandle (#43432)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43432

Changelog: [Internal]

Reviewed By: sammy-SC, fabriziocucci

Differential Revision: D54798889

fbshipit-source-id: 19cbac6b6bbb19242227ad9357cd9e8b86cdd331
2024-03-12 05:38:45 -07:00
Alfonso Curbelo 81d39d9e16 Changelog: 0.72.12 (#43419)
Summary:
## Changelog:
Changelog: [INTERNAL] Generated changelog

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

Reviewed By: cortinico

Differential Revision: D54799352

Pulled By: huntie

fbshipit-source-id: ad777f8804e14da4b4ed77ea0742560c1d01c7b5
2024-03-12 04:36:57 -07:00
Samuel Susla 2ed1e9ad28 remove sync events from TextInput (#43429)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43429

changelog: [internal]

these experimental props have served their purpose and can be deleted.

Reviewed By: rubennorte

Differential Revision: D54682805

fbshipit-source-id: aee5072e2aa056c862f369426617d0d51c98997f
2024-03-12 04:32:01 -07:00
Pieter De Baets 9e2bb4efc3 Fix TimingModuleTest in OSS (#43422)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43422

After my changes in D54496604, this test now requires the main looper to progress as well, to dispatch the right callback.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D54776392

fbshipit-source-id: ba272a08d4b88d1c3301618eed1a03253e615b84
2024-03-12 04:25:17 -07:00
Arushi Kesarwani bdca260679 Fix Bridgeless React Context test in OSS (#43424)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43424

https://github.com/facebook/react-native/pull/43400/ caused a `getCatalystInstanceTest` to fail in OSS due to `bridgelessReactContext` not being a Mock object.

Reviewed By: fkgozali

Differential Revision: D54781539

fbshipit-source-id: 1c784804c31d4b57fe438d49f3ee3eb7034dd7a6
2024-03-11 23:21:05 -07:00
Phillip Pan 5522d522bb support jsCallInvoker in RCTBridgeProxy (#43314)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43314

Changelog: [Internal]

making call invoker a breaking change to runtime executor in 0.74 seems to be causing a lot of discourse. let's simplify things and first add the callinvoker to the backwards compat layer

Reviewed By: cipolleschi

Differential Revision: D54404845

fbshipit-source-id: 983e86829030557033b95625dab9068492739417
2024-03-11 21:55:42 -07:00
Phillip Pan 620459a07e change import to RCTBridgeProxy to forward declaration (#43313)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43313

Changelog: [Internal]

we can simplify the build graph here

Reviewed By: cipolleschi

Differential Revision: D54404844

fbshipit-source-id: 52dfbd05106e72687b969357e274d2c4cdd9ca34
2024-03-11 21:55:42 -07:00
Fabrizio Cucci 86a52cc2dc Scope LongLivedObjectCollection per runtime [3/n] (#43410)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43410

Changelog:
[General] [Breaking] - Make `LongLivedObjectCollection::get` accept a Runtime reference as parameter.

# Context

Approach 1 as described in [RFC post](https://fb.workplace.com/groups/615693552291894/permalink/1693347124526526/).

# This diff

* Replace the `LongLivedObjectCollection` singleton with a map from `Runtime -> LongLivedObjectCollection` so that each RN instance has its own collection.
* Update MSFT fork accordingly

Reviewed By: javache, RSNara

Differential Revision: D54649209

fbshipit-source-id: ecd2ab3917843ca82388b7b9cce06c05679f2d60
2024-03-11 15:55:45 -07:00