Commit Graph
30266 Commits
Author SHA1 Message Date
Moti ZilbermanandFacebook GitHub Bot 461edd248a Allow ConnectFunc to reject connections by returning nullptr (#42387)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42387

Changelog: [Internal]

Documents that it's legal for a Page's connection function to return null, and adds new logic to `InspectorPackagerConnection` (NOTE: to the C++ implementation *only*) to handle this case without crashing.

The legacy RN CDP backend (`ConnectionDemux`) has a case similar to this that causes crashes depending on the timing of connection requests.

Reviewed By: cortinico

Differential Revision: D52905490

fbshipit-source-id: 2102adc859d1509647a31f92737a1e164781fadf
2024-01-19 12:26:15 -08:00
Moti ZilbermanandFacebook GitHub Bot eb947279f0 Inject log with CDP integration name if provided (#42384)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42384

Changelog: [Internal]

Similar to D52894171, adds a console log message identifying the specific CDP backend integration, based on an optional `SessionMetadata` object passed to `PageTarget::connect()`. This is helpful during development+rollout as we will have 4+ such call sites (iOS/Android, Bridge/Bridgeless).

Reviewed By: huntie

Differential Revision: D52905488

fbshipit-source-id: d26aae1d07c2c42965498a81f03d826de98fa222
2024-01-19 12:26:15 -08:00
Moti ZilbermanandFacebook GitHub Bot 2e47770688 Inject log to easily identify modern CDP backend (#42383)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42383

Changelog: [Internal]

During development / experimental rollout of the modern CDP backend, it can be helpful to have a user-visible message that makes it clear that the new backend is in use. Here, we add one using the [`Log.entryAdded`](https://chromedevtools.github.io/devtools-protocol/tot/Log/#type-LogEntry) CDP event. We also add some styling using [ANSI escape sequences](https://developer.chrome.com/docs/devtools/console/format-style#style-ansi) to make the message stand out from normal application logs.

We could have used [`Runtime.consoleAPICalled`](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#event-consoleAPICalled) instead, but:

1. `Runtime.consoleAPICalled` requires an `executionContextId` which is not available at the `Page` level (it is a concept that's managed closer to the instance/VM), and it's slightly cleaner if we don't have to send a fake context ID.
2. It's slightly easier to follow the CDP dispatching logic / grep for relevant code if we use `Log` for "system logs" (from the Page) and reserve `Runtime` for real application logs from the instance/VM.

NOTE: We'll probably want to remove this before the stable release.

Reviewed By: huntie

Differential Revision: D52894171

fbshipit-source-id: 3208e01f2ee31acef2e8cd58767f40ad724c9a39
2024-01-19 12:26:15 -08:00
Moti ZilbermanandFacebook GitHub Bot 7886abd243 Add stub page target implementation to jsinspector-modern (#42397)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42397

Changelog: [Internal]

Adds a stub `PageTarget` class to serve as the entry point to the modern CDP backend in React Native.

The primary method exposed by `PageTarget` is `connect()` which is designed to fit directly as a connection callback passed to `InspectorPackagerConnection::addPage()`. This constructs a `PageTargetSession` containing a `PageAgent` where the actual CDP message handling/routing will occur. For now, `PageAgent` implements no CDP methods, and always responds with a "not implemented" error.

Basic unit tests are included, though we might want to migrate to a more integration-style test suite (with fewer mocks and real bindings to RN) once we've implemented more of the protocol.

## What is a Page

In Chrome's implementation of CDP, a Page represents a single browser tab. A Chrome DevTools session connects to one Page at a time (though it can potentially inspect multiple JavaScript contexts owned by that Page, such as those found in frames and workers).

In our system, a Page will correspond 1:1 to React Native's concept of a *Host* (implemented as `RCTHost`, `RCTBridge`, `ReactHostImpl` or `ReactInstanceManager`, depending on the platform). In all cases, the Host is the object that has a stable identity across reloads, and manages the lifetime of an *Instance* where the JSVM and other application state lives. There can be multiple Hosts in a React Native process, though this is somewhat unusual; those would be treated as independent "tabs" from the perspective of the debugger.

NOTE: The concepts of Target, Session and Agent are new (to this codebase) and are *broadly* inspired by the [corresponding Chromium / V8 concepts](https://chromium.googlesource.com/chromium/src/+/master/third_party/blink/public/devtools_protocol/#Agents_Targets-and-Sessions), though some details differ.

## Next steps

Each core platform implementation in React Native (iOS Bridgeless, iOS Bridge, Android Bridgeless, Android Bridge), as well as out-of-tree platforms that want to support the new debugger, will need to create and register a `PageTarget` instance. We'll do this piecemeal in subsequent diffs.

We'll also gradually add APIs and logic to `PageTarget` / `PageAgent` to allow us to implement some "interesting" CDP methods - some of them directly (e.g. handling reload commands) and others by dispatching to nested agents (e.g. a JS debugging agent powered by Hermes).

Reviewed By: huntie

Differential Revision: D50936932

fbshipit-source-id: ebe5856d7badb361d4971dd9aabeb9982f8aed1b
2024-01-19 12:26:15 -08:00
szymonrybczakandFacebook GitHub Bot 965f2eb1fb feat(template): add Yarn files to .gitignore (#42313)
Summary:
Recently inside React Native Community CLI we added bumping Yarn version inside `init` command, more information here: https://github.com/react-native-community/cli/pull/2134. In this Pull Request I added required rules in `.gitignore` for new projects created.

## Changelog:

[GENERAL] [ADDED] - Add Yarn files to `.gitignore` in template

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

Test Plan:
1. Follow [Contributing guide](https://github.com/react-native-community/cli/blob/main/CONTRIBUTING.md) from React Native Community CLI repository to setup locally newest version of CLI.
2. Run this command:

```sh
node /path/to/react-native-cli/packages/cli/build/bin.js init --template path/to/template
```
3. Appropriate should be ignored.

Reviewed By: NickGerleman

Differential Revision: D52907962

Pulled By: cortinico

fbshipit-source-id: f12dce8836e7e94257f8c690434b11227aa46446
2024-01-19 11:54:10 -08:00
Nick GerlemanandFacebook GitHub Bot 40c4552d02 Simplify Edge Resolution (#42254)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42254

X-link: https://github.com/facebook/yoga/pull/1550

This change aims to simplify how we resolve edges. This operation happens many, many times, and has gotten complex and slow when paired with StyleValuePool.

This starts reshaping so that `yoga::Style` can resolve a style prop for a given edge. This is closer to the ideal computed style API to avoid recalcing this so many times, but doesn't address that.

This relies on removing the errata related to row-reverse, and cleans up the removal started in the last change.

This has no measurable perf effect under CompactValue, but has a >10% uplift in perf when using StyleValueHandle, where we can trivially check if a handle points to a defined value without resolving it, but only within `yoga::Style` since we don't expose the handle outside of it.

More quantifiably, we go from 2.35 million StyleValuePool reads to 993k. The rest are checks on the handle.

Reviewed By: joevilches

Differential Revision: D52605596

fbshipit-source-id: 0b366963a899e376f99ce3d75cd5f14a25d60cec
2024-01-19 11:28:06 -08:00
Nick GerlemanandFacebook GitHub Bot 0e4a3da5d9 yoga::Node::getStyle() to yoga::Node::style() (#42314)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42314

X-link: https://github.com/facebook/yoga/pull/1555

The next diff moves a bunch of methods to `yoga::Style`. This renames the function to be a tad bit shorter, for more readable callsites. It also makes it more consistent with style property getters.

Changelog: [Internal]

Reviewed By: rozele

Differential Revision: D52803393

fbshipit-source-id: 557df34a9f0fb0ee42ad23b1fda99c1e0eb1d4e3
2024-01-19 11:28:06 -08:00
Fabrizio CucciandFacebook GitHub Bot 9bd69d329a Drop stale comment in VirtualizedList (#42395)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42395

T46547044 has been closed and apparently `React.warn` was removed in [#16126](https://github.com/facebook/react/pull/16126).

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D52907508

fbshipit-source-id: a3621d876f904339791ab184a904e81f7a50b988
2024-01-19 10:38:46 -08:00
Oskar KwaśniewskiandFacebook GitHub Bot 3d09b6f850 fix: isVision return false for Platform.android.js (#42381)
Summary:
This PR is a follow up for https://github.com/facebook/react-native/issues/42243 it looks like we need to return `false` for the Platform.android.js to make flow happy.

This is the error we were getting in `react-native-visionos` CI/CD:
![CleanShot 2024-01-19 at 13 01 19@2x](https://github.com/facebook/react-native/assets/52801365/218078b3-44d4-4dc0-bee7-f5d2e08eca50)

## Changelog:

[INTERNAL] [FIXED] - Add `isVision` interface idiom for Platform.android.js

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

Test Plan: CI Green

Reviewed By: cortinico

Differential Revision: D52905993

Pulled By: NickGerleman

fbshipit-source-id: 125d33b63e9114cb6276b554e426f32e0c406ea8
2024-01-19 10:19:38 -08:00
Frieder BluemleandFacebook GitHub Bot b9621976bc Remove ineffective excludes from typescript-config (#42375)
Summary:
This removes the 4 ineffective and redundant entries from the `exclude` list in `tsconfig.json` (`typescript-config` package).

These entries have no effect as they are relative to the typescript-config package. Explained in detail here: https://github.com/tsconfig/bases/issues/207

A newly generated RN app shows this config:

```
$ yarn tsc --showConfig | grep -A 5 exclude
    "exclude": [
        "node_modules/tsconfig/react-native/node_modules",
        "node_modules/tsconfig/react-native/babel.config.js",
        "node_modules/tsconfig/react-native/metro.config.js",
        "node_modules/tsconfig/react-native/jest.config.js"
    ]
```

Clearly, none of these files exist, therefore to remove ambiguity and reduce the complexity of the config, they should be removed.

## Changelog:

[GENERAL] [REMOVED] - Remove ineffective excludes from typescript-config

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

Test Plan:
- Create new RN app (`npx react-native init`), install dependencies, run `yarn tsc`
- It works
- Recreate config, but _without_ the `exclude` section
- Everything works exactly the same

Reviewed By: huntie

Differential Revision: D52904713

Pulled By: NickGerleman

fbshipit-source-id: d1d6f65b164053f9a1e611022178ced032a38aef
2024-01-19 09:59:10 -08:00
Nick GerlemanandFacebook GitHub Bot 90df90efca Fix missing assignment in Node move constructor (#42275)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42275

X-link: https://github.com/facebook/yoga/pull/1554

Adds recently added field missing from move constructor

Reviewed By: joevilches

Differential Revision: D52767525

fbshipit-source-id: ec68452b058178967650bbef736562caafbf4a36
2024-01-19 09:46:08 -08:00
Moti ZilbermanandFacebook GitHub Bot 2c4756c8a3 Report Inspector page type to client (#42390)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42390

Changelog: [Internal]

Add an optional mechanism for inspector pages to be registered with the "modern" or "legacy" type (defaulting to legacy). This is aligned with the inspector-proxy implementation of the `type` property in D50967795.

NOTE: This mechanism is experimental, only takes effect if `InspectorPackagerConnection.cpp` is in use, and will likely evolve before the RN 0.74 branch cut.

Reviewed By: huntie

Differential Revision: D50967794

fbshipit-source-id: e7521267dfc0b0811c4d369e63f4f1756ce22d60
2024-01-19 09:26:16 -08:00
Moti ZilbermanandFacebook GitHub Bot 9535526c14 Fix inspector "disconnect" event type and add tests (#42340)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42340

The experimental C++ implementation of `InspectorPackagerConnection` currently sends malformed `'disconnect'` events. This diff fixes that and adds tests. (See https://github.com/facebook/react-native/blob/dd5474f1e96e1c1e2f00ba3655ef86590d39b0fd/packages/dev-middleware/src/inspector-proxy/types.js#L40-L43 for the definition of the proxy protocol.)

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D52842515

fbshipit-source-id: 97152f870de2c8eec0dd11e4239afc07a44f631d
2024-01-19 09:26:16 -08:00
Moti ZilbermanandFacebook GitHub Bot 62117b304e Make RemoteConnectionImpl thread-safe (#42380)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42380

Changelog: [Internal]

Makes it explicitly legal to call `IRemoteConnection`'s methods from any thread when used as part of the C++ implementation of `InspectorPackagerConnection`.

Implementation details:

* This relies on `InspectorPackagerConnectionDelegate::scheduleCallback` being thread-safe and handling any necessary synchronisation (which is already required for the existing `reconnect()` use case).
* We add *very basic* tracking of *sessions* within `InspectorPackagerConnection` to make sure events don't leak from one `RemoteConnection` instance to the next.
  * In the future we'll want to build on this to properly allow multiple concurrent sessions to a single page. That's not the primary goal here though.

Reviewed By: rubennorte

Differential Revision: D52807388

fbshipit-source-id: 6900386a1f047c99f15dc91597f308c82adf5281
2024-01-19 09:26:16 -08:00
Nicola CortiandFacebook GitHub Bot fd0ca4dd62 Undo move of CallInvokerHolder to .internal (#42362)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42362

This undos a change of CallInvokerHolder bringing it back in the public package: https://github.com/facebook/react-native/commit/b7191cde4e36

The problem is that if a developer wants to use the C++ CallInvokerHolder to schedule work on the JS thread from C++, they're forced to import the `.internal`
Java/Kotlin class.

Plus this is going to be a massive breaking change for the ecosystem:
https://github.com/search?type=code&q=%2Fimport.*CallInvokerHolderImpl%2F

So unless we come with a clear deprecation/replacement path, I'm undoing this change for now.

Changelog:
[Internal] [Changed] - Undo move of CallInvokerHolder to `.internal`

Reviewed By: cipolleschi

Differential Revision: D52873256

fbshipit-source-id: 900c3170ed2100ec706b03112bc23a0ba0171bcc
2024-01-19 06:18:28 -08:00
Nicola CortiandFacebook GitHub Bot 26ecd3817c Convert InteropEvent and InteropEventEmitter to Kotlin (#42358)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42358

Just converting those two classes to Kotlin as I was going over them.

Changelog:
[Internal] [Changed] - Convert InteropEvent and InteropEventEmitter to Kotlin

Reviewed By: javache

Differential Revision: D52869490

fbshipit-source-id: 2d585dd3d21dc89c5e55de645e9519d36f67b849
2024-01-19 05:00:28 -08:00
Alex HuntandFacebook GitHub Bot e2a02f0558 Add changelogs for 0.72.10 and 0.72.9 (#42365)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42365

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D52876241

fbshipit-source-id: 9cc0e6c289062b815a821410ded51f0ec62b5f1a
2024-01-19 04:56:10 -08:00
Moti ZilbermanandFacebook GitHub Bot 46d18885cc Use Folly Executors for scheduleCallback in tests (#42379)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42379

Changelog: [Internal]

Creates the `InspectorPackagerConnectionTestAsync` fixture class to help with testing edge cases that rely on how scheduled callbacks interleave with other API calls. We use [`folly::ManualExecutor`](https://github.com/facebook/folly/blob/main/folly/executors/ManualExecutor.h) for async tests and [`folly::QueuedImmediateExecutor`](https://github.com/facebook/folly/blob/main/folly/executors/QueuedImmediateExecutor.h) for the rest.

Reviewed By: huntie

Differential Revision: D52807387

fbshipit-source-id: 8c41e70c6bacb91a1b866377ed14f9e14631bbf0
2024-01-19 04:19:23 -08:00
Christoph PurrerandFacebook GitHub Bot ea0e826c28 iOS Add React-debug to ReactCommon.podspec (#42376)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42376

Changelog: [IOS] [FIXED] - iOS Add React-debug to ReactCommon.podspec

Fixes the CocoaPod build broken due to: https://github.com/facebook/react-native/commit/dd5474f1e96e1c1e2f00ba3655ef86590d39b0fd

Reviewed By: philIip, cipolleschi

Differential Revision: D52899067

fbshipit-source-id: 8337df1602a030e26fcb560fe5c0eb34a9934e6e
2024-01-19 02:01:11 -08:00
Samuel SuslaandFacebook GitHub Bot 565dec4d20 remove gating for rtl swapping fix + clean Paragraph Yoga node (#42297)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42297

changelog: [internal]

Reviewed By: fkgozali

Differential Revision: D52728092

fbshipit-source-id: 6d05e5b72a350847030e0655aa914b64a4681752
2024-01-19 01:36:05 -08:00
Eric RozellandFacebook GitHub Bot 1d89fad824 Ignore TM specs with out-of-tree platform suffix (#42360)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42360

In cases where you merge out-of-tree platforms like react-native-windows with react-native mobile JS files, codegen awareness of the Windows suffix is useful. This helps prevent the creation of generated code for iOS and Android in mixed out-of-tree platform folders.

## Changelog

[Internal]

Reviewed By: mdvacca

Differential Revision: D52873212

fbshipit-source-id: ad6b1471e63d68057f54c79141123fb15f8aab5e
2024-01-18 22:52:24 -08:00
Joe VilchesandFacebook GitHub Bot 08eb985c33 Rename AbsolutePositioning errata (#42318)
Summary:
X-link: https://github.com/facebook/yoga/pull/1558

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

AbsolutePositioning -> AbsolutePositioningCatchAll

A bit more clear. This errata is for various issues with positioning absolute nodes. There really isn't a clear description as to what specifically this enables/disables, so I just opted to say "catch all" to indicate that this controls various bugs

Reviewed By: NickGerleman

Differential Revision: D52820117

fbshipit-source-id: 80b77832baf65e68e57ca523c418422dd346ef0f
2024-01-18 21:22:05 -08:00
Joe VilchesandFacebook GitHub Bot dc2e552a94 Add static zIndex example and e2e test to Catalyst (#42317)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42317

Added a complicated zIndex test and corresponding screenshot test for it.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D52439963

fbshipit-source-id: 54bc8cfc9aa2e3c985279fe43027b3db88057c68
2024-01-18 21:22:05 -08:00
Joe VilchesandFacebook GitHub Bot 690660a620 Add 'static' as position option in style sheets (#42316)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42316

We need to change the typing to allow for 'static'. An issue here is that Paper will not have `static` due to missing z-index logic. Unfortunately, we cannot create a fabric-only version of the typing as we cannot have conditional elements of the same name in ts. To remedy this we took out the parsing of the string 'static' in Paper. Instead we will just emit a warning and default to `relative`.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D51431524

fbshipit-source-id: 0444b2f8432f172b2e8a084b307b0e624dba8085
2024-01-18 21:22:05 -08:00
Joe VilchesandFacebook GitHub Bot 56b9b990de Remove static-behaves-like-relative errata (#42315)
Summary:
X-link: https://github.com/facebook/yoga/pull/1556

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

Since we aim to ship static to all users of yoga (not just XPR), we need to remove the errata that is gating most of the features. This should be a non breaking change. To ensure that, I added a new errata which, if on, will use the inner size of the containing node as the containing block. This is how it has been for a while and resolving this is risky and time consuming so for the time being we will stick with that.

Reviewed By: NickGerleman

Differential Revision: D52706161

fbshipit-source-id: 30a93f29cb0d97b20b2947eaa21f36cdc78c4961
2024-01-18 21:22:05 -08:00
Joe VilchesandFacebook GitHub Bot 86d04f8bc9 Hardcode AbsolutePercentageAgainstPaddingEdge experimental feature to false (#42253)
Summary:
X-link: https://github.com/facebook/yoga/pull/1549

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

This experimental feature is always false, and with the next diff I will be deleting the branch that actually calls into this. Separating this diff out to simplify the review process.

Reviewed By: NickGerleman

Differential Revision: D52705765

fbshipit-source-id: 705f4aa297eae730af9b44753eb01c9dec385dcf
2024-01-18 21:22:05 -08:00
Pieter VanderwerffandFacebook GitHub Bot c33ac4b3d8 Deploy 0.227.0 to xplat
Summary: Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D52893857

fbshipit-source-id: 2a4edd77d91d4d6206d59f57afe6feee6fffc8a8
2024-01-18 19:54:35 -08:00
Moti ZilbermanandFacebook GitHub Bot 196e0b6951 Clarify threading assumptions in RCTCxxInspectorWebSocketAdapter (#42311)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42311

Changelog: [Internal]

TSIA, comment-only change

Reviewed By: huntie

Differential Revision: D52804603

fbshipit-source-id: 0e8c82e81f091111267720a68b0ad8d87290e46a
2024-01-18 15:26:13 -08:00
Moti ZilbermanandFacebook GitHub Bot c9b493bc72 Constify InspectorPackagerConnection members that are immutable (#42366)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42366

Changelog: [Internal]

Just codifying the constness of some members.

Reviewed By: hoxyq

Differential Revision: D52786333

fbshipit-source-id: 772c6f91c50f9b67cabf347300af4da6b42ca2e0
2024-01-18 15:26:13 -08:00
Moti ZilbermanandFacebook GitHub Bot a064a2a05e Close inspector connections immediately when a page is removed (#42308)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42308

Changelog: [Internal]

Guarantees cleanup of `ILocalConnection` when the associated page is unregistered from `IInspector`.

NOTE: This only applies to the C++ version of `InspectorPackagerConnection`. The legacy pure-Java and pure-ObjC implementations are of this class are unchanged.

In the upcoming modern CDP backend architecture, this will help guarantee the validity of Target references (specifically PageTarget) held by Agents (specifically PageAgent), without introducing unnecessary shared ownership and dynamism.

Reviewed By: hoxyq

Differential Revision: D52786331

fbshipit-source-id: 162425d6435246a95ac9c076bc5c59a34f331f16
2024-01-18 15:26:13 -08:00
Moti ZilbermanandFacebook GitHub Bot f30f867173 Refactor InspectorImpl internal page data structure (#42304)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42304

Changelog: [Internal]

Light refactor of `InspectorImpl`'s storage from two separate maps (one of them with tuples for values!) to a single map of objects.

Reviewed By: hoxyq

Differential Revision: D52786335

fbshipit-source-id: a49466ed7189fd032e486319bbdf77097a30885f
2024-01-18 09:26:57 -08:00
Moti ZilbermanandFacebook GitHub Bot 0ea8e1dd8f Automatically enable C++ InspectorPackagerConnection if using modern CDP backend (#42301)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42301

Changelog: [Internal]

To simplify testing and rolling out the modern CDP backend in React Native, let's require the use of the C++ version of `InspectorPackagerConnection` whenever the modern CDP backend is in use, regardless of the `InspectorPackagerConnection` rollout setting.

Reviewed By: hoxyq

Differential Revision: D52786334

fbshipit-source-id: 5c12794e3faa2c094a23f69a5677f66905d1763e
2024-01-18 09:26:57 -08:00
Pieter De BaetsandFacebook GitHub Bot 3cd85dc933 Fix RemoveDeleteTree and subview clipping compatibility (#42355)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42355

`RemoveDeleteTreeUIFrameCallback` operated directly on the view to clean up its children, which does not correctly account for subviews which have been clipped because they're outside the visible frame.

Changelog: [Android][Added] Added `removeAllViews` to IViewGroupManager.

Reviewed By: jehartzog, sammy-SC

Differential Revision: D52834835

fbshipit-source-id: fb7f07a17d07467eecd3ce9721afc2f3abcc0caa
2024-01-18 07:58:49 -08:00
Moti ZilbermanandFacebook GitHub Bot ca2dde5906 Support launching experimental debugger for modern CDP targets (#42302)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42302

Changelog: [Internal][Added] Support launching experimental debugger frontend for CDP targets marked as "modern"

See the definition of "modern" targets in D50967795.

Reviewed By: hoxyq

Differential Revision: D52786332

fbshipit-source-id: 13718e9ddf3ec050049ef7ec9a77f6cf1a7f82ee
2024-01-18 07:52:51 -08:00
Moti ZilbermanandFacebook GitHub Bot 716c728c7a Distinguish between modern/legacy targets, conditionally disable hacks (#42303)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42303

Changelog: [Internal]

Adds a coarse-grained mechanism to `inspector-proxy` for distinguishing between legacy and modern debug targets. The guiding principles are:

1. `inspector-proxy` does not interfere in the CDP message stream between the debugger frontend and a modern target, or in the lifecycle of a target.
2. Legacy runtimes (current React Native, React Native Desktop, etc) that rely on `inspector-proxy`'s existing invasive semantics must continue to work seamlessly for now. We'll decide on the right time to deprecate/remove this legacy code in the future.

NOTE: This is an experimental addition to the proxy protocol that may be replaced at any time.

Reviewed By: hoxyq

Differential Revision: D50967795

fbshipit-source-id: bb9c39a8fe755ef3661e2c61507dd324d8dc8894
2024-01-18 07:52:51 -08:00
Tommy NguyenandFacebook GitHub Bot 8474e239df Assert DefaultComponentsRegistry::registerComponentDescriptorsFromEntryPoint is set (#42312)
Summary:
Assert `DefaultComponentsRegistry::registerComponentDescriptorsFromEntryPoint` is set. For full context, see https://github.com/facebook/react-native/issues/42244.

## Changelog:

[ANDROID] [FIXED] - Assert `DefaultComponentsRegistry::registerComponentDescriptorsFromEntryPoint` is set

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

Test Plan: n/a

Reviewed By: javache

Differential Revision: D52835542

Pulled By: cortinico

fbshipit-source-id: be323953fc47a3a3b746c7abdd614f96d232af34
2024-01-18 05:27:56 -08:00
Szymon RybczakandFacebook GitHub Bot 31a162f48c feat: add --custom-resolver-options to bundle command (#42333)
Summary:
Added `--custom-resolver-options` to `--bundle` command. This options is also [available](https://github.com/facebook/metro/blob/main/docs/CLI.md#options) in Metro's CLI.

## Changelog:

[INTERNAL] [ADDED] - Add `--resolver-options` to `bundle` command

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

Test Plan:
1. Build all packages by running `yarn build` in the root
2. Go to `packages/rn-tester` and run `npx react-native bundle --custom-resolver-options key=value` and the options should be passed to the Config.

Reviewed By: blakef

Differential Revision: D52869452

Pulled By: huntie

fbshipit-source-id: 9a2c2d94b72cfb47477cf58b9c0472c5a8551c84
2024-01-18 04:51:39 -08:00
Moti ZilbermanandFacebook GitHub Bot 8ac08c8d18 Deduplicate pages by ID within each device (#42282)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42282

Changelog: [Internal] `inspector-proxy` now assumes each app will report pages with locally unique IDs.

In order to simplify some upcoming logic changes in `inspector-proxy`, in this diff we begin to enforce the assumption that each app ( = platform-specific implementation of `InspectorPackagerConnection`) assigns a locally unique ID to each inspector page. The inspector proxy will silently drop page descriptors that have conflicting IDs, and log a message to `debug()`.

NOTE: As an implementation detail, integrators may use `DEBUG=Metro:InspectorProxy` to see debug messages from `inspector-proxy`.

Reviewed By: huntie

Differential Revision: D50969752

fbshipit-source-id: a4e6faa91d97594fc5343ce4bee66233523cd175
2024-01-17 22:53:42 -08:00
Luna WeiandFacebook GitHub Bot 67532e07ce 0.70.15 changelog (#42320)
Summary:
## Changelog:

[INTERNAL] - Add 0.70.15 changelog

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

Reviewed By: christophpurrer

Differential Revision: D52821181

Pulled By: lunaleaps

fbshipit-source-id: a6893c3b140e9ee05d87549a3e91bdf8c9c8f394
2024-01-17 10:55:00 -08:00
Christoph PurrerandFacebook GitHub Bot dd5474f1e9 Add util function to determine TurboModuleValueKind (#42271)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42271

Changelog: [Internal]

Adds a util function to determine the `TurboModuleMethodValueKind` based on the `jsi:Value` type

Reviewed By: javache

Differential Revision: D52761045

fbshipit-source-id: de937cda67198aad962e63f41ccd42be6c00c0b8
2024-01-17 08:53:58 -08:00
Saad NajmiandFacebook GitHub Bot 6801fc3f9b Remove an early return to suppress a deprecated API warning for UIMenuController (#42277)
Summary:
`UIMenuController` is deprecated as of iOS 16. https://github.com/facebook/react-native/commit/e08a1973f67d85acc157111c749c43572469e4c2 migrated a usage into an `available` check. However, it does not properly fall back to the deprecated API in the "else" block of the availability check, instead it uses an early return. It seems this means Xcode still sees the API as used, and spits out a deprecated warning. Let's just refactor the code so we don't have that anymore.

## Changelog:

[IOS] [FIXED] -  Remove an early return to suppress a deprecated API warning for `UIMenuController`

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

Test Plan: CI should pass.

Reviewed By: cipolleschi

Differential Revision: D52785488

Pulled By: sammy-SC

fbshipit-source-id: 0b47e8aa8d7c94728e3d68332fbb8f97f8ded34e
2024-01-17 08:50:25 -08:00
Gijs WeteringsandFacebook GitHub Bot 17824fd56c update ReactAndroid.api for D52802644 (#42336)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42336

D52802644 land raced with D52800160

Changelog:
[Android] [Removed] - Remove deprecated DefaultNewArchitectureEntryPoint.load overload

Reviewed By: christophpurrer

Differential Revision: D52836926

fbshipit-source-id: 88aa74f6f100686d7e6f4fc4de3966bbe1784756
2024-01-17 08:13:21 -08:00
Moti ZilbermanandFacebook GitHub Bot 7a69fe424d Migrate to private member syntax (#42299)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42299

Changelog: [Internal]

TSIA

Reviewed By: hoxyq

Differential Revision: D52798108

fbshipit-source-id: 9ba980b9fb439b1aeee3eb1b08535b95556d72bb
2024-01-17 08:03:34 -08:00
Moti ZilbermanandFacebook GitHub Bot 8e70acc235 Remove linting step from dangerfile (#42332)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42332

Changelog: [Internal]

TSIA - the Danger ESLint plugin we use is outdated and there have been issues with its reliability. We already have [linting jobs on CircleCI](https://github.com/facebook/react-native/blob/6c8dfc89566d27c36f9ca3828bcf3a63dfcb6942/.circleci/configurations/jobs.yml#L5-L74) that overlap with this functionality.

Reviewed By: cortinico

Differential Revision: D52834693

fbshipit-source-id: f2b6cb9c4c560f5c3e66514da1779f14d908ae97
2024-01-17 07:52:58 -08:00
Nicola CortiandFacebook GitHub Bot 6c8dfc8956 Remove deprecated DefaultNewArchitectureEntryPoint.load overload (#42328)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42328

This method was deprecated in 0.72. We're going to remove it in 0.74
Technically a breaking change, but users should not be using this method at all at this point.

Changelog:
[Android] [Removed] - Remove deprecated DefaultNewArchitectureEntryPoint.load overload

Reviewed By: mdvacca

Differential Revision: D52802644

fbshipit-source-id: f7c1db783959d93b81407847377f805d7ee2602d
2024-01-17 03:53:43 -08:00
Nicola CortiandFacebook GitHub Bot c9ff7d9f1b - Prevent illegal configurations of ReactFeatureFlags in DefaultNewArchitectureEntrypoint (#42329)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42329

As the title says, this checks against illegal configurations of ReactFeatureFlags in DefaultNewArchitectureEntrypoint
and let the app crash if the user specified and illegal configuration

Changelog:
[Internal] [Changed] - Prevent illegal configurations of ReactFeatureFlags in DefaultNewArchitectureEntrypoint

Reviewed By: mdvacca

Differential Revision: D52802609

fbshipit-source-id: 7bc0a08c17430d7fd2448f65838ce47fad738883
2024-01-17 03:53:43 -08:00
Gijs WeteringsandFacebook GitHub Bot a5fbe28c29 Update ReactAndroid.api with changes after fixing react-native-android-breaking-change-detector (#42327)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42327

This diff is the result of running

`buck2 run //xplat/js/scripts/rn-api:generate-rn-api-metadata`

After this lands, `react-native-android-breaking-change-detector` will actually be green again, after the previous diff fixed the infra setup.

 Changelog: [General][Fix] Update stale ReactAndroid.api values after CI breakage

Reviewed By: cortinico, mdvacca

Differential Revision: D52800160

fbshipit-source-id: b96533baa1cb704ad43482d7a52db50e6dce9821
2024-01-17 03:29:07 -08:00
Oskar KwaśniewskiandFacebook GitHub Bot 258d8e51b4 iOS: Introduce vision interfaceIdiom (#42243)
Summary:
This PR introduces the `vision` interfaceIdiom to check if the app runs on visionOS.

An update to the documentation should follow this change.

## Changelog:

[IOS] [ADDED] - Introduce `vision` interfaceIdiom

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

Test Plan: This change has been used in `react-native-visionos` and the interfaceIdiom changes **only** when running in the non-compatibility mode. But it's still useful to have this upstream if at some point React native would compile to visionOS natively

Reviewed By: cortinico

Differential Revision: D52730028

Pulled By: cipolleschi

fbshipit-source-id: 711c5c2c6c7fe05b3ff8da7383b5e63e9e04acfa
2024-01-16 10:41:03 -08:00
Nick GerlemanandFacebook GitHub Bot 8211cb8986 Remove YGNodeSetPrintFunc and related (#42274)
Summary:
X-link: https://github.com/facebook/yoga/pull/1553

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

Separate from `YGConfigSetPrintTreeFlag` we have a public API `YGNodeSetPrintFunc` which sets a function called, if you manually change a constant in source code during debugging.

This is not debug-only, is exposed as part of the public API (without a way to turn it on from the public API), and takes up a pointer per node doing nothing.

I'm not aware of anyone recently using the capability, and the tracing/event related work done since then would be more powerful for this anyway.

Remove the API.

Changelog: [Internal]

Reviewed By: rozele

Differential Revision: D52767445

fbshipit-source-id: f72927b47cffa4fe6fe886b42f07cc1ba55f141e
2024-01-16 10:07:19 -08:00
Bernhard Owen JosephusandFacebook GitHub Bot 314cfa8c91 Send Modal onDismiss event on iOS (Fabric) and Android (#42014)
Summary:
1. Modal onDismiss is not working on iOS (Fabric).
2. Modal onDismiss is currently only available on iOS. On Android, we don't have a way to know when exactly a modal is dismissed.

Currently, the onDismiss is emitted using a device event as a workaround to the RCTModalHostView unable to receive the component event as it's already unmounted when visible is false.

This PR removes the workaround and keeps RCTModalHostView mounted until the onDismiss event is emitted from the host and sends the onDismiss event on Android.

bypass-github-export-checks

## Changelog:
[ANDROID] [ADDED] - Added support for Modal onDismiss prop
[IOS] [FIXED] - Fix onDismiss is not working on Fabric
[General][Breaking] - The public API of Modal has changed. We don't have anymore a NativeModalManger turbomodule; RCTModalHostViewNtiveComponent's Prop does not require to pass an identifier anymore.

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

Test Plan:
1. Run rn-tester
2. Open the Modal example
3. The second example shows the counter for the show and dismiss count
4. Show and dismiss the modal and verify the count is incremented correctly

https://github.com/facebook/react-native/assets/50919443/108bfb26-c8f6-43b2-ac40-f0b46e48771b

Reviewed By: javache, sammy-SC

Differential Revision: D52445670

Pulled By: cipolleschi

fbshipit-source-id: f419164032c3bef67387200778b274299bf0659f
2024-01-16 09:31:34 -08:00