Commit Graph
30624 Commits
Author SHA1 Message Date
Samuel SuslaandFacebook GitHub Bot cb307b9b02 add synchronisation to Animated when used with setNativeProps (#43083)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43083

changelog: [internal]

See code comments for details.

Reviewed By: yungsters

Differential Revision: D53818488

fbshipit-source-id: 71a1636a635c4c6599313b0c44be7215e9bdbcb5
2024-02-19 02:24:46 -08:00
Riccardo CipolleschiandFacebook GitHub Bot 475a156310 Make React-jsiinspector depends on hermes-engine to fix Dynamic Frameworks (#43081)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43081

When Hermes i used, it is hermes that provides JSI to React Native and not React-jsi.
This is required to fix the ODR violatons.
Dynamic frameworks requires that all the dependencies are declared explicitly, and missing the `hermes-engine` dependency was breaking the dependency graph.

## Changelog
[Internal] - Make JSIInspector depends o hermes-engine

Reviewed By: motiz88

Differential Revision: D53901016

fbshipit-source-id: a511719647e6203d082696fd572593fd851a1dde
2024-02-18 11:23:47 -08:00
Luna WeiandFacebook GitHub Bot 8ff05b5a18 Remove release-branch-cutoff from yarn bump-all-updated-packages (#43040)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43040

Changelog: [Internal] Remove release-branch-cutoff option as its been replaced by `yarn set-version --skip-react-native-version`

Reviewed By: huntie

Differential Revision: D53742450

fbshipit-source-id: 726479698ec4f4f61d9a1ddde95e246e033f864c
2024-02-16 15:57:37 -08:00
Ingrid WangandFacebook GitHub Bot fdf4ec3297 Remove unused handler on PushNotificationIOS.removeEventListener (#43037)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43037

Changelog:
[iOS][Breaking] Removing unused `handler` param on  PushNotificationIOS.removeEventListener

Reviewed By: philIip

Differential Revision: D53781102

fbshipit-source-id: a3372d0ccb4addf9983c143fb1a3e206f6aae103
2024-02-16 15:22:49 -08:00
Ingrid WangandFacebook GitHub Bot 1bd45768e3 Update docs on PushNotificationIOS (#43038)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43038

Changelog:

[Internal] Documentation edits

Reviewed By: philIip

Differential Revision: D53782268

fbshipit-source-id: b13ce5e64f9fc106d29f9b04fb6b7ba3e2ae0b2c
2024-02-16 15:22:49 -08:00
Ingrid WangandFacebook GitHub Bot 713ded1d5f Tweak documentation for soundName property (#43004)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43004

Changelog: [Internal]

Reviewed By: philIip

Differential Revision: D53734570

fbshipit-source-id: e2233b4a2f1bcb48af5d56319d215eb0ccceaa4e
2024-02-16 15:22:49 -08:00
Moti ZilbermanandFacebook GitHub Bot da03d7b829 Implement Runtime.addBinding (global bindings only) (#43065)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43065

Changelog: [Internal]

Implements support for [`Runtime.addBinding`](https://cdpstatus.reactnative.dev/devtools-protocol/tot/Runtime#method-addBinding) in the new RN CDP backend.

This implementation is mostly complete and matches Chrome's behaviour, but does not include the ability to target bindings by execution context (the optional `executionContextId` and `executionContextName` params) - that will come in a separate diff for ease of review/landing.

Incidentally, this diff also introduces the `JsiIntegrationPortableTest::expectMessageFromPage` helper, which allows us to "asynchronously" extract the contents of an expected message. For consistency and clarity, we refactor all the other `EXPECT_CALL(this->fromPage(), onMessage(JsonEq(...)))` assertions to use it as well.

Reviewed By: huntie

Differential Revision: D53266709

fbshipit-source-id: 046326acdf5dacc18e179e43589cdd2d012f353a
2024-02-16 11:16:41 -08:00
Moti ZilbermanandFacebook GitHub Bot 828ad04cef Assign auto-incrementing execution context IDs (#43064)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43064

Changelog: [Internal]

Aligns React Native's CDP backend with V8's behaviour of assigning a sequential ID (here unique within a given PageTarget) to each execution context.

Reviewed By: huntie

Differential Revision: D53776531

fbshipit-source-id: 950599c323f416e8180e42281d94ae9c00f15fb0
2024-02-16 11:16:41 -08:00
Moti ZilbermanandFacebook GitHub Bot e34e7d75b3 Lift execution context management out of Runtime (#43063)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43063

Changelog: [Internal]

Moves the responsibility for managing CDP execution contexts out of the Runtime and into the Instance.

This includes the responsibilities to:
1. Assign execution context IDs/names
2. Emit events when execution contexts are created/destroyed
3. Route CDP messages to the correct Runtime

**Re 1:** We currently assign a *constant* execution context ID, which diverges from V8's implementation but is in line with what Hermes has done so far. I'll follow up separately to assign (locally) unique IDs, since this diff is long enough already.

**Re 3:** Right now, the message routing responsibility is mostly theoretical: only one Runtime exists at a time and "routing" can be done by RuntimeAgent simply deciding whether or not to act on a message (since it receives all messages by default and knows its own `ExecutionContextDescription`). True multi-Runtime / multi-context support is firmly a future concern, and we can revisit this ( = probably hoist more logic into Instance) when we get there.

In the `ExecutionContextNotifications` integration test we can see that a few minor bugs in the current Hermes-based implementation are fixed, and also that execution context management is now engine-agnostic (so we can use `JsiIntegrationPortableTest` instead of `JsiIntegrationHermesTest`).

Reviewed By: huntie

Differential Revision: D53759776

fbshipit-source-id: 50ac126789c95b25f845780df2c3346ec345d5d5
2024-02-16 11:16:41 -08:00
Alex HuntandFacebook GitHub Bot 98ea5ea29b Refactor set-version to use new getPackages util (#43072)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43072

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53851089

fbshipit-source-id: 6305f7404a43a8da8bfe84137921437423be7985
2024-02-16 10:41:04 -08:00
Riccardo CipolleschiandFacebook GitHub Bot 5164e83c3b Fix the compiler flags for libraries (#43071)
Summary:
While looking at another issue, I realized that in some cases the script was adding the same flags twice and it was leaving the RCT_NEW_ARCH_ENABLED behind.

## Changelog:
[iOS][Fixed] - Pass the right flags to libraries

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

Test Plan: Fixed Unit tests

Reviewed By: huntie

Differential Revision: D53860576

Pulled By: cipolleschi

fbshipit-source-id: 1f6f4852df8d316293b93d7c5fbef09a249893a5
2024-02-16 10:39:01 -08:00
Riccardo CipolleschiandFacebook GitHub Bot f61f87c5ef Make the addUIBlock's Dictionary works correctly (#43060)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43060

When inestigating the reason why [`react-native-view-shot`]() ws not working, we realized that there are many libraries that follows this pattern:

```objc
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
    if (UIView *view = viewRegistry[reactTag]) {
      //do something with the View
    }
  }];
```
The problem is that, with the New Architecture, that view registry is usually empty, because the components are registered and tracked in another place.
This make many libraries stop working when used with the New Architecture.

This change introduces a class that behaves like a dictionary but that forward the calls to retrieve the view to the right place, in order to get the view that is needed.

Noticably, this approach allow us also to remove some shenanigans we were applying to make sure that the interop layer could access the views wrapped in it, so the current solution is more general and should work in multiple situations.

## Changelog
[iOS][Fixed] - Make sure that `addUIBlock` provides a Dictionary-look-alike object that returns the right views when queried.

Reviewed By: sammy-SC

Differential Revision: D53826203

fbshipit-source-id: 08d359676d69777b88fa9b18dc141187ac42dbce
2024-02-16 09:39:44 -08:00
Nicola CortiandFacebook GitHub Bot 906985b097 Back out "Update RNGP to handle cxxModule in codegenConfig" (#43050)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43050

Original commit changeset: 702f09ccf793

Original Phabricator Diff: D53669912

Changelog:
[Internal] [Changed] - Back out "[RN][Android][TmCxxAutolinking] Update RNGP to handle cxxModule in codegenConfig"

Reviewed By: cipolleschi

Differential Revision: D53812110

fbshipit-source-id: a7583c0cb8354bf31723794fbbb4ca5de8f1790a
2024-02-16 09:20:02 -08:00
Nicola CortiandFacebook GitHub Bot 2697b9af5c Back out "Add cxxModule to RN-Tester's codegenConfig" (#43051)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43051

Original commit changeset: 97b9985b94ef

Original Phabricator Diff: D53669913

Changelog:
[Internal] [Changed] - Back out "[RN][Android][TmCxxAutolinking] Add cxxModule to RN-Tester's codegenConfig"

Reviewed By: cipolleschi

Differential Revision: D53812108

fbshipit-source-id: 5c5dfbaf95685953ef20cf35061a72afffe00ed3
2024-02-16 09:20:02 -08:00
Riccardo CipolleschiandFacebook GitHub Bot 267ea2661a Convert RCTConvert to mm in preparation for DisplayP3 changes
Summary:
This is a preliminary change which converts RCTConvert to an objectiveC++ file. This is required by the next diffs in the stack.

## Changelog
[iOS][Changed] - Make RCTConvert an Objective-C++ (`.mm`) file in prep for DisplayP3 changes

Reviewed By: javache

Differential Revision: D53520228

fbshipit-source-id: cf45c42955401b4e14fe68221129077817b2598e
2024-02-16 09:15:49 -08:00
Riccardo CipolleschiandFacebook GitHub Bot eca78c30c7 Add hermes commit to github action cache (#43067)
Summary:
The test_ios_rntester-Hermes which runs in github actions was created to make sure that recent commits on Hermes/main won't be breaking React Native
However, we discovered that the job was using a cached version of hermes and it was't really downloading the latest hermes every time.

With this change, the cocoapods cache will be invalidated whenever there is a commit on hermes/main, forcing the job to reinstall the dependencies when that happens.

bypass-github-export-checks

## Changelog:
[internal] - Fixed GH Action job to properly refetch newest version on Hermes when it changes.

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

Test Plan:
Github Actions must be green and the action should show that a new version of Hermes is downloaded.

The commit is downloaded here:
 {F1457505882}

And it is used here, notice the last hash:
 {F1457505989}

Reviewed By: motiz88

Differential Revision: D53853963

Pulled By: cipolleschi

fbshipit-source-id: 7a65dd72a21b6da12b826273d1c92bb90b678652
2024-02-16 06:59:10 -08:00
Alex HuntandFacebook GitHub Bot 80ec096e7c Create shared consts module for scripts
Summary:
Tidy up, removes risk of breakage when relocating inner modules.

Changelog: [Internal]

Reviewed By: lunaleaps

Differential Revision: D53813025

fbshipit-source-id: 43dc4a57191363546d6858cff311e260d416192f
2024-02-16 03:21:25 -08:00
Alex HuntandFacebook GitHub Bot a80674fc7c Relocate run-ci-e2e-tests script, add Flow (#43053)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43053

- Relocate under `scripts/e2e/` (also move util used only by this cript).
- Type as Flow (to catch trivial errors). Some cleanup of `log()` calls as errors.

Changelog: [Internal]

Reviewed By: lunaleaps

Differential Revision: D53813023

fbshipit-source-id: 05caf415ec0bf3739a6f7fec3afd385a195f42e9
2024-02-15 14:51:48 -08:00
Alex HuntandFacebook GitHub Bot fb446598f9 Rename E2E template init script, relocate Verdaccio config + storage (#43001)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43001

More understandable name: ~"React Native init, for E2E testing". Also relocates Verdaccio config and storage location under `scripts/e2e/` (resolving TODO comment).

The intent is for the `scripts/e2e/` dir to also group the existing E2E testing-related scripts — although I will stop here for the current release-related work.

Changelog: [Internal]

Reviewed By: lunaleaps

Differential Revision: D53609332

fbshipit-source-id: fb2f6502a18c4a4ac2368b46af1e3ee42edbadd6
2024-02-15 14:51:48 -08:00
Alex HuntandFacebook GitHub Bot e4135e9be5 Update test-e2e-local to use source monorepo packages for RNTestProject (#42899)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42899

Updates the `test-e2e-local` script to bootstrap `/tmp/RNTestProject/` using the currently checked out repository as the source of truth for all monorepo packages (previously we only did this for the `react-native` package).

This enables release testers to validate a release **before** physically publishing new dependency versions via `yarn bump-all-updated-packages`.

We are able to reuse the `scripts/template/initialize.js` script that is currently used for E2E validation in CI. This sets up a local Verdaccio server during project install.

NOTE: The time taken for `Build packages` + Verdaccio isn't ideal, I may explore a way to reuse the published package state in a future diff. Until then, this extra time (~1 min) will still be much less pain than the `bump-all-updated-packages` + commit process loop.

Changelog:
[Internal] - Update test-e2e-local to use source monorepo packages for RNTestProject

Reviewed By: lunaleaps

Differential Revision: D53484510

fbshipit-source-id: 600a8a3257a4947d7738ab9d908d6549c38545e6
2024-02-15 13:04:00 -08:00
David VaccaandFacebook GitHub Bot 15700626cc Enable FabricPendingEventQueue by default in RN OSS (#43029)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43029

Enable FabricPendingEventQueue by default in RN OSS

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D53766819

fbshipit-source-id: 53529b10a3880702867793c3eeae216a2c3f4cea
2024-02-15 11:49:19 -08:00
Oskar KwaśniewskiandFacebook GitHub Bot c5f48ac612 feat: make __gitignore file work for OOT platforms (#42963)
Summary:
This PR makes `__gitignore` file universal for Apple OOT platforms.

## Changelog:

[GENERAL] [CHANGED] - Make template's .gitignore file universal for OOT platforms

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

Test Plan: CI Green

Reviewed By: NickGerleman

Differential Revision: D53674632

Pulled By: yungsters

fbshipit-source-id: cb510d9bd2ee6f1c39b77a842e7947b67def552a
2024-02-15 11:44:42 -08:00
Luna WeiandFacebook GitHub Bot d6a440ee8b Remove process.exit calls from publish-npm and throw errors instead (#43039)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43039

Changelog: [Internal] - `publish-npm.js` is a [script we call in our CI](https://www.internalfb.com/code/fbsource/[c0b8566ac0d66c2c0282eeb597bfb54bedf757c6]/xplat/js/react-native-github/.circleci/configurations/jobs.yml?lines=1243) to publish the react-native package and others.

Currently, the script leverages `exit/process.exit` to terminate early in a couple of places which makes the code hard to test because our tests don't truly early exit when `exit/process.exit` is called.

This change removes any explicit `exit` calls and instead leverages the uncaught error to terminate the process and set the non-zero exit code. This makes our tests more accurate to the real control flow of the script.

I've also updated the tests to better capture what we're actually testing by mocking at a higher level.

Reviewed By: cipolleschi

Differential Revision: D53792754

fbshipit-source-id: 9293bb9a95430c50052db36c0e6f6c1ba348107f
2024-02-15 11:18:05 -08:00
Oskar KwaśniewskiandFacebook GitHub Bot 209140046b fix: PerfMonitor option not showing on iOS (Bridgeless) (#42891)
Summary:
This PR fixes PerfMonitor option not showing on iOS when running bridgeless. The `initialize` method is not called in bridgeless which causes this option to not be added. I've converted this approach to work for both bridgeless and non-bridgeless.

bypass-github-export-checks

## Changelog:

[IOS] [FIXED] - Perf Monitor option not showing in Bridgeless

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

Test Plan: Run RNTester, open Perf monitor

Reviewed By: RSNara

Differential Revision: D53518507

Pulled By: cipolleschi

fbshipit-source-id: c16d41006c5a3f96d53d4f76fd317941a1eb839f
2024-02-15 09:11:41 -08:00
Alex HuntandFacebook GitHub Bot 24f7bd7445 Remove .npmrc write from setupVerdaccio util (#42941)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42941

I noticed that programatically running `npm set registry <value>` would fail within the repo root dir (intended run location) (`node` version `18.18.2`).

```
npm ERR! This command does not support workspaces.
```

It turns out this is no longer supported from npm 9.x: https://github.com/npm/cli/issues/6099. **Note**: The workaround discussed in this thread is incompatible/nontrivial with `npx`, so I've opted to remove this behaviour.

**Changes**

- Remove `npm set registry http://localhost:4873` call.
    - This is non-breaking due to the [explicit `--registry` arg already present in `run-e2e-ci-tests.js`](https://github.com/facebook/react-native/blob/b366b4b42e0f91eb2b1850c404fadd0f0322fc61/scripts/run-ci-e2e-tests.js#L102). The previous `.npmrc` config value is unnecessary, and probably was being ignored (will be validated for this PR in CircleCI run).
- Add comment against remaining `.npmrc` write, convert to `fs` call.
- Remove unused params on `setupVerdaccio` (moved to constants which will be exported and referenced in the next diff).

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53609308

fbshipit-source-id: 77d3666b42963cd61f6d3fd0be00cdc19bbb1ec8
2024-02-15 09:06:44 -08:00
Alex HuntandFacebook GitHub Bot afc61ab643 Fix test-e2e-local when building artifacts locally (#43043)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43043

Restores behaviour of `yarn test-e2e-local` when we are not using `--circleciToken`. The `npm pack` logic (necessary for the subsequent `updateTemplatePackage` call before initing `RNTestProject`) was deleted in https://github.com/facebook/react-native/pull/41172 / D50651448.

https://github.com/facebook/react-native/commit/4eed12b7df5d9731e556b77d701c87dcf91d3a1f#diff-56f57bf0eac99b0fda1b2938aceb8d9b663db82c07cb405bd53a01c8689710ffL224-L240

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53806191

fbshipit-source-id: 918306d5dea90266292728cda9c0e243e5c37eba
2024-02-15 09:06:44 -08:00
Samuel SuslaandFacebook GitHub Bot ca980447f0 remove feature flag enableOnDemandReactChoreographer (#43044)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43044

changelog: [internal]

Reviewed By: javache

Differential Revision: D53758129

fbshipit-source-id: bd921553e2aeaadac56624a100f5f27310995c98
2024-02-15 08:09:27 -08:00
Riccardo CipolleschiandFacebook GitHub Bot ab5e2e8099 Fix forwarding touches to components in the Interop Layer
Summary:
When analyzing the `hitTest:withEvent` function, I realized that we were not forwarding the touches to the legacy view.

The previous algorithm was returning the InteropLegacyWrapper view itself when the touches were happening in the legacy view, preventing the handlers attached to the legacy view to fire.

With this change, if the legacy view receives a touch, it can handle it.

## Changelog
[iOS][Fixed] - Make sure to forward touches to the wrapped component in the InteropLayer.

Reviewed By: sammy-SC

Differential Revision: D53806218

fbshipit-source-id: 87b0aa6e900935092e6f5e1533b871c1d224b718
2024-02-15 07:54:46 -08:00
Pieter De BaetsandFacebook GitHub Bot 53e3f364cf Fix incorrect cast in RemoveDeleteTree (#43018)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43018

Assuming that if View is a ViewGroup, its ViewManager is a ViewGroupManager is incorrect. Custom ViewManagers may use ViewGroups internally to represent complex views exposed to JS.

Type-check the ViewManager instead to avoid the crash seen in T178300877

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D53586565

fbshipit-source-id: 49408098cebc7f76d8be0e585187ba9b6ca52049
2024-02-15 05:39:23 -08:00
Pieter De BaetsandFacebook GitHub Bot 5a5c9eb96c Remove ReactViewManagerWrapper
Summary:
This was introduced to support MapBuffer-based view managers (D33735245), but that experiment has been removed from the codebase (D53072714).

This indirection is preventing a proper fix for a crash we're seeing with RemoveDeleteTree (T178300877)

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D53586567

fbshipit-source-id: d391ca56b23fc3dd57429c5ad8a7a405e97a81f2
2024-02-15 05:39:23 -08:00
Riccardo CipolleschiandFacebook GitHub Bot a3998f8d15 Generate the RCTModulesConformingToProtocolsProvider only for react-native core (#43046)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43046

This fixes a problem where RCTModulesConformingToProtocolsProvider was generated also in Library space.

## Changelog:
[iOS][Fixed] - Generate the RCTModulesConformingToProtocolsProvider only once in user space

## Facebook
See comment [here](https://www.internalfb.com/diff/D53441411?dst_version_fbid=750944970297544&transaction_fbid=719673583317629)

Reviewed By: dmytrorykun

Differential Revision: D53807045

fbshipit-source-id: 2c4a15c3c7943cfcc1f5ea5dd5ab47c3a31e6596
2024-02-15 04:17:35 -08:00
Moti ZilbermanandFacebook GitHub Bot 59d46e83ef Recreate jsi::Runtime during reload operation in JsiIntegrationTest
Summary:
Changelog: [Internal]

Fixes a small omission in D53756996 that will come into play in future diffs.

bypass-github-export-checks

Reviewed By: robhogan

Differential Revision: D53771004

fbshipit-source-id: 4c94db37ef51793420e126a81c5d6c0543493ec7
2024-02-15 01:47:30 -08:00
sebmarkbageandFacebook GitHub Bot 0f134fd091 Remove __self and __source location from elements (#28265)
Summary:
Changelog: [Internal]

Along with all the places using it like the `_debugSource` on Fiber.
This still lets them be passed into `createElement` (and JSX dev
runtime) since those can still be used in existing already compiled code
and we don't want that to start spreading to DOM attributes.

We used to have a DEV mode that compiles the source location of JSX into
the compiled output. This was nice because we could get the actual call
site of the JSX (instead of just somewhere in the component). It had a
bunch of issues though:

- It only works with JSX.
- The way this source location is compiled is different in all the
pipelines along the way. It relies on this transform being first and the
source location we want to extract but it doesn't get preserved along
source maps and don't have a way to be connected to the source hosted by
the source maps. Ideally it should just use the mechanism other source
maps use.
- Since it's expensive it only works in DEV so if it's used for
component stacks it would vary between dev and prod.
- It only captures the callsite of the JSX and not the stack between the
component and that callsite. In the happy case it's in the component but
not always.

Instead, we have another zero-cost trick to extract the call site of
each component lazily only if it's needed. This ensures that component
stacks are the same in DEV and PROD. At the cost of worse line number
information.

The better way to get the JSX call site would be to get it from `new
Error()` or `console.createTask()` inside the JSX runtime which can
capture the whole stack in a consistent way with other source mappings.
We might explore that in the future.

This removes source location info from React DevTools and React Native
Inspector. The "jump to source code" feature or inspection can be made
lazy instead by invoking the lazy component stack frame generation. That
way it can be made to work in prod too. The filtering based on file path
is a bit trickier.

When redesigned this UI should ideally also account for more than one
stack frame.

With this change the DEV only Babel transforms are effectively
deprecated since they're not necessary for anything.

DiffTrain build for commit https://github.com/facebook/react/commit/37d901e2b81e12d40df7012c6f8681b8272d2555.

Reviewed By: kassens

Differential Revision: D53543159

Pulled By: tyao1

fbshipit-source-id: 8e5509a16ea8d3234881e2305149326fb31e3845
2024-02-14 20:32:48 -08:00
Phillip PanandFacebook GitHub Bot 16276ce0f6 build backwards compat API for runtime pointer (#43012)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43012

Changelog: [iOS][Added]

This implements the functionality to give access to the jsi::Runtime in iOS in bridgeless. In bridge, this value is a private selector on RCTBridge that is exposed via category. We build this into the backwards compatible RCTBridgeProxy here.

This should work out of the box in bridgeless if you are already retrieveing the pointer via the bridge. However, we recommend users to eventually migrate towards C++ TurboModule or the RuntimeExecutor if possible. This will be removed in the future.

Reviewed By: RSNara

Differential Revision: D53646413

fbshipit-source-id: a5584f22d433a580d537b8780a3bcd503680acb8
2024-02-14 19:01:02 -08:00
Phillip PanandFacebook GitHub Bot 315be8290d build backwards compat API for runtime pointer (#43013)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43013

Changelog: [Android][Added]

This is a pre-deprecated API to give access to the jsi::Runtime in Android in bridgeless. In bridge, this value is exposed via the ReactContext, but is not implemented in the BridgelessReactContext. We do that here.

This should work out of the box in bridgeless if you are already retrieveing the pointer via ReactContext. However, we recommend users to eventually migrate towards C++ TurboModule or the RuntimeExecutor if possible. This will be removed in the future.

Reviewed By: RSNara

Differential Revision: D53645247

fbshipit-source-id: b98657560c43a625bdf947d19d186952c9b44364
2024-02-14 19:01:02 -08:00
Zhengwei LiuandFacebook GitHub Bot 45b1aef291 introduce experimental props endDraggingSensitivityMultiplier and endDraggingSensitivityVelocityMultiplier to ScrollView
Summary:
changelog: [internal]

Adding experimental props to control scroll speed on iOS.

Reviewed By: cipolleschi

Differential Revision: D53757152

fbshipit-source-id: 5848780ffcc91242494d371731cc0efce87b3159
2024-02-14 18:24:46 -08:00
Luna WeiandFacebook GitHub Bot 1bdbd9bc90 Add 0.73.4 changelog
Summary:
Changelog: [Internal] - Add 0.73.4 changelog

bypass-github-export-checks

Reviewed By: christophpurrer, cortinico

Differential Revision: D53738097

fbshipit-source-id: 299c16a9e0dfc5ed0e6d7c0b9901388b6852ca99
2024-02-14 16:49:13 -08:00
Thomas NardoneandFacebook GitHub Bot 1c4ed12370 Fix Win build (#43025)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43025

Changelog:
[General][Fixed] - Fix JSExecutor build error on Windows

Reviewed By: motiz88, cipolleschi

Differential Revision: D53762452

fbshipit-source-id: bea7295d9261fa013d14231dfba66cb4369a8916
2024-02-14 14:58:45 -08:00
Luna WeiandFacebook GitHub Bot b8ad91732f fix nightlies dont exit early (#43035)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43035

Changelog: [Internal] - We early-exited because of poor copy-pasta and the fact that our tests don't properly emulate the behavior of mock `exit`

Will try and clean this up in next diff but want to quickly fix so it unbreaks nightlies

Reviewed By: yungsters

Differential Revision: D53779109

fbshipit-source-id: ff56e498344fcb4851729d98625b6c7010c73795
2024-02-14 14:32:21 -08:00
Moti ZilbermanandFacebook GitHub Bot 7b00a92a3b Add CDP-JSI integration tests (#43027)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43027

Changelog: [Internal]

Adds a test suite for the integration between the modern RN CDP backend and Hermes (plus potentially other JS engines), mocking out the rest of RN.

For simplicity, everything is single-threaded and "async" work is actually done through a queued immediate executor ( = run immediately and finish all queued sub-tasks before returning).

The main limitation of the simpler threading model is that we can't cover breakpoints etc - since pausing during JS execution would prevent the test from making progress. Such functionality is better suited for a full RN+CDP integration test (using RN's own thread management) as well as for each engine's unit tests.

## Types of tests in this diff

* `TEST_F(JsiIntegrationHermesTest, ...)` - tests specific to the Hermes integration.
* `TYPED_TEST(JsiIntegrationPortableTest, ...)` - tests that should pass on all engines.
  * These use gtest's [typed tests](https://google.github.io/googletest/advanced.html#typed-tests) feature.
  * This is a good fit for testing CDP features that have no strict dependency on Hermes (like the upcoming `Runtime.addBinding` support). **Long term**, aspirationally, all tests should be in this category, covering a consistent baseline of CDP features needed for debugging with any supported engine.
  * The first "non-Hermes" engine we test against (`GenericEngineAdapter`) is actually Hermes in disguise, minus any Hermes-specific CDP handling. We could conceivably add more engines here, as long as we have the ability to build them (and their JSI bindings) as part of building the tests.

bypass-github-export-checks

Reviewed By: huntie

Differential Revision: D53756996

fbshipit-source-id: fbafb088abd4263ec841bf848185637ec126c6d1
2024-02-14 10:44:41 -08:00
Edmond ChuiandFacebook GitHub Bot 032208d81a Update tests for URL assertions
Summary:
Changelog: [Internal]

Update tests to be more resilient against prod changes; and make it easier to read the actual vs expected values upon failure.

Reviewed By: motiz88

Differential Revision: D53762409

fbshipit-source-id: d627d5041295f645ed00aa5d0645419a9ac4a7f8
2024-02-14 10:37:13 -08:00
Phillip PanandFacebook GitHub Bot cc147ceb79 add example for capturing initial notification in push notification manager (#42687)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42687

Changelog: [Internal]

adding an example for if you want to use `getInitialNotification`.

Reviewed By: ingridwang

Differential Revision: D52931618

fbshipit-source-id: 7552c358e5bc98228b7ae74ea1adf450f7b075e6
2024-02-14 10:32:11 -08:00
Phillip PanandFacebook GitHub Bot 75e6137add store initial notification in static instead of property
Summary:
Changelog: [Internal]

I'm updating this API to match the semantics of the other new APIs, namely that they're static methods that don't depend on the instance of the native module. This should help streamline our documentation. Instead of capturing the launch notification as an ivar, we capture it in a static variable that we clear out when the object gets cleared or is invalidated, which is similar to an ivar / property.

Reviewed By: ingridwang

Differential Revision: D53743761

fbshipit-source-id: b6ff048ef8d653e8f4be19194a2211792a542252
2024-02-14 10:32:11 -08:00
Phillip PanandFacebook GitHub Bot 2740491e32 resolve getInitialNotification for local notifications with notification schema
Summary:
Changelog: [Internal]

In the past, local notifications were stored in the launch options as UILocalNotification, whereas remote notifications were stored as NSDict. This means that we had different handling in PushNotificationIOS.js. This condition was not handling the differences in local and remote notifications that JS expected, which I'm fixing here.

Reviewed By: ingridwang

Differential Revision: D53734086

fbshipit-source-id: 73ef436a232c16de3b72f7236db94012aafdc434
2024-02-14 10:32:11 -08:00
Moti ZilbermanandFacebook GitHub Bot 3020747101 Add missing react_render_core -> runtimeexecutor CMake dep (#43028)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43028

Changelog: [Internal]

Should fix an OSS Android build failure introduced in the stack of D53671483. (Apparently CMake doesn't propagate transitive header dependencies?)

Reviewed By: robhogan

Differential Revision: D53767182

fbshipit-source-id: 3251153b6f6ef1a51f73e1bf939f7e308ca0611d
2024-02-14 10:26:09 -08:00
Ruslan LesiutinandFacebook GitHub Bot ca141d94eb refactor: remove source usages from getInspectorData
Summary:
Changelog: [Internal]

Required for landing D53543159.

2 reasons for landing this:
1. Inspector is technically deprecated and will be removed once React DevTools are shipped with Chrome DevTools for RN debugging.
2. Long-term solution for source fetching is lazy loading based on component stacks - https://github.com/facebook/react/pull/28265

Reviewed By: kassens

Differential Revision: D53757524

fbshipit-source-id: cbb2aab79ba40ea66da5c1ddde95d3fe374b6006
2024-02-14 10:12:14 -08:00
Moti ZilbermanandFacebook GitHub Bot 266122248f RuntimeTarget refactor - introduce WeakList for Target→Agent refs
Summary:
Changelog: [Internal]

Replaces the copypasta'd `PageTarget::forEachSession`, `InstanceTarget::forEachAgent` and `RuntimeTarget::forEachAgent` with a shared utility class for managing a list of `weak_ptr`s.

In a `WeakList`, elements can only be added (`insert`), iterated over (`forEach`), and counted (`size`, `empty`). Conceptually, elements are automatically removed from the list as soon as they're destroyed, but internally, space is reclaimed *lazily*: the next time we have a reason to iterate over the underlying list, we delete any pointers that are found to be null.

## Naming

This is almost a WeakSet, but we don't bother checking for duplicates, hence "WeakList".

Reviewed By: hoxyq

Differential Revision: D53671483

fbshipit-source-id: 460bfbaa2b8e821281dc352fed0946f99352c9fc
2024-02-14 07:13:19 -08:00
Moti ZilbermanandFacebook GitHub Bot d4468fb1e4 RuntimeTarget refactor - Add this-scoped async executors to all Targets
Summary:
Changelog: [Internal]

# This diff

1. Provides all Targets with an `executorFromThis()` method, which can be used from within a Target to access a *`this`-scoped main thread executor* = a `std::function` that will execute a callback asynchronously iff the current Target isn't destroyed first.
2. Refactors how (all) Target objects are constructed and retained, from a plain constructor to `static shared_ptr create()`. This is because `executorFromThis()` relies internally on `enable_shared_from_this` plus two-phase construction to populate the executor.
3. Creates utilities for deriving scoped executors from other executors and `shared_ptr`s.

The concept is very much like `RuntimeExecutor` in reverse: the #1 use case is moving from the JS thread back to the main thread - where "main thread" is defined loosely as "anywhere it's legal to call methods on Target/Agent objects, access session state, etc". The actual dispatching mechanism is left up to the owner of each `PageTarget` object; for now we only have an iOS integration, where we use `RCTExecuteOnMainQueue`.

Coupling the ownership/lifetime semantics with task scheduling is helpful, because it avoids the footgun of accidentally/nondeterministically moving `shared_ptr`s (and destructors!) to a different thread/queue .

# This stack
I'm refactoring the way the Runtime concept works in the modern CDP backend to bring it in line with the Page/Instance concepts.

Overall, this will let us:

* Integrate with engines that require us to instantiate a shared Target-like object (e.g. Hermes AsyncDebuggingAPI) in addition to an per-session Agent-like object.
* Access JSI in a CDP context (both at target setup/teardown time and during a CDP session) to implement our own engine-agnostic functionality (`console` interception, `Runtime.addBinding`, etc).
* Manage CDP execution contexts natively in RN, and (down the line) enable first-class debugging support for multiple Runtimes in an Instance.

The core diffs in this stack:

* ~~Introduce a `RuntimeTarget` class similar to `{Page,Instance}Target`. ~~
* ~~Make runtime registration explicit (`InstanceTarget::registerRuntime` similar to `PageTarget::registerInstance`). ~~
* ~~Rename the existing `RuntimeAgent` interface to `RuntimeAgentDelegate`.~~
* ~~Create a new concrete `RuntimeAgent` class similar to `{Page,Instance}Agent`.~~
* ~~Provide `RuntimeTarget` and `RuntimeAgent` with primitives for safe JSI access, namely a `RuntimeExecutor` for scheduling work on the JS thread.~~
  * Provide RuntimeTarget with mechanism for scheduling work on the "main" thread from the JS thread, for when we need to do more than just send a CDP message (which we can already do with the thread-safe `FrontendChannel`) in response to a JS event. *← This diff*

## Architecture diagrams

Before this stack:
https://pxl.cl/4h7m0

After this stack:
https://pxl.cl/4h7m7

Reviewed By: hoxyq

Differential Revision: D53356953

fbshipit-source-id: 152c784eb64e9b217fc2966743b33f61bd8fd97e
2024-02-14 07:13:19 -08:00
Moti ZilbermanandFacebook GitHub Bot b3a7a13ff8 RuntimeTarget refactor - Add RuntimeExecutor to RuntimeTarget
Summary:
Changelog: [Internal]

I'm refactoring the way the Runtime concept works in the modern CDP backend to bring it in line with the Page/Instance concepts.

Overall, this will let us:

* Integrate with engines that require us to instantiate a shared Target-like object (e.g. Hermes AsyncDebuggingAPI) in addition to an per-session Agent-like object.
* Access JSI in a CDP context (both at target setup/teardown time and during a CDP session) to implement our own engine-agnostic functionality (`console` interception, `Runtime.addBinding`, etc).
* Manage CDP execution contexts natively in RN, and (down the line) enable first-class debugging support for multiple Runtimes in an Instance.

The core diffs in this stack will:

* ~~Introduce a `RuntimeTarget` class similar to `{Page,Instance}Target`. ~~
* ~~Make runtime registration explicit (`InstanceTarget::registerRuntime` similar to `PageTarget::registerInstance`). ~~
* ~~Rename the existing `RuntimeAgent` interface to `RuntimeAgentDelegate`.~~
* ~~Create a new concrete `RuntimeAgent` class similar to `{Page,Instance}Agent`.~~
* Provide `RuntimeTarget` and `RuntimeAgent` with primitives for safe JSI access, namely a `RuntimeExecutor` for scheduling work on the JS thread. *← This diff*
  * We'll likely develop a similar mechanism for scheduling work on the "main" thread from the JS thread, for when we need to do more than just send a CDP message (which we can already do with the thread-safe `FrontendChannel`) in response to a JS event.

## Architecture diagrams

Before this stack:
https://pxl.cl/4h7m0

After this stack:
https://pxl.cl/4h7m7

Reviewed By: hoxyq

Differential Revision: D53266710

fbshipit-source-id: df3a181fcc8e033c37a7f4f430f23a29b326b56a
2024-02-14 07:13:19 -08:00
Edmond ChuiandFacebook GitHub Bot 496724fbdb Remove URI encoding
Summary:
Changelog: [Internal]

Fixed double-encoding for the websocket url.
`URLSearchParams` already encode the values, passing a pre-encoded `encodeUriComponent` string will cause it to double-encode, making the value unreadable when decoding once.

Missed these lines while splitting the initial diff stack.
Added tests now.

Reviewed By: motiz88

Differential Revision: D53721568

fbshipit-source-id: cfaaa7eb50c40364c904e9ffc5698201df8ab22b
2024-02-14 05:20:46 -08:00