Commit Graph
30550 Commits
Author SHA1 Message Date
Nicola CortiandFacebook GitHub Bot 2e3508d6cb Add cxxModule to RN-Tester's codegenConfig
Summary:
This introduces the `cxxModule` field for RNTester where the local TM-CXX modules
are specified.

Changelog:
[Internal] [Changed] - Add cxxModule to RN-Tester's codegenConfig

Reviewed By: cipolleschi

Differential Revision: D53669913

fbshipit-source-id: 97b9985b94efe79566d2d06f6081e65fb66478ff
2024-02-13 09:35:39 -08:00
Phillip PanandFacebook GitHub Bot 59c5edfe63 resolve getInitialNotification with userInfo dict instead of whole notification
Summary:
Changelog: [Internal]

`getInitialNotification` only expect the user info dictionary of the dictionary, not the complete formatted notification.

Reviewed By: cipolleschi

Differential Revision: D53691569

fbshipit-source-id: 9a24629d2e50544c55ea5cd16097bd88dad950ec
2024-02-13 08:32:47 -08:00
Moti ZilbermanandFacebook GitHub Bot 19012ca9ee RuntimeTarget refactor - ensure safe destruction of Instance Agents and Targets
Summary:
Changelog: [Internal]

In D53233914 we copied PageTarget's approach for keeping track of its sessions into InstanceTarget (for keeping track of InstanceAgents). Here we complete that pattern by asserting that the agents are destroyed before their respective targets.

NOTE: We might want to encapsulate this pattern in a helper/template class at some point. For now I'm going with the explicit approach.

Reviewed By: hoxyq

Differential Revision: D53266708

fbshipit-source-id: 4a90fde6c68e87d4667c44f81f8578a7a9072474
2024-02-13 08:14:17 -08:00
Moti ZilbermanandFacebook GitHub Bot 415bb718ff RuntimeTarget refactor - Create RuntimeTarget, RuntimeTargetDelegate
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`.  *← This diff*
* Make runtime registration explicit (`InstanceTarget::registerRuntime` similar to `PageTarget::registerInstance`).   *← Also in this diff*
* 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.
  * 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: D53233914

fbshipit-source-id: 166ae3e25059bd9c9c051a0a3312a3ba78a3935a
2024-02-13 08:14:17 -08:00
Nicola CortiandFacebook GitHub Bot b366b4b42e Back out "Fix autolinking for local app Fabric components"
Summary:
Original commit changeset: 28c376fbd08c

Original Phabricator Diff: D53661231

Reviewed By: cipolleschi

Differential Revision: D53709386

fbshipit-source-id: aab2d99327460cc82591f7de5e6e0296f7695cd6
2024-02-13 07:27:54 -08:00
Moti ZilbermanandFacebook GitHub Bot 8a12cfd2d1 Fix UB in SessionState init
Summary:
Changelog: [Internal]

Specifies initial values for `SessionState`'s bool fields to avoid relying on undefined behaviour.

Reviewed By: hoxyq

Differential Revision: D53704064

fbshipit-source-id: 798365a8eed8acea3aa50083bf325a0288765097
2024-02-13 07:14:49 -08:00
Riccardo CipolleschiandFacebook GitHub Bot 46d7f8a669 Generate code to allow for linking custom Module that conforms to some protocols (#42923)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42923

This Diff implement the logic to:
- Read some lists of class names provided by libraries that conforms to some protocols we defined as extension points.
- Generate a provider in the React-Codegen podspec, whose code lives alongside the app code.
- Glue the app and the generated code together, allowing to link custom protocols

## Changelog
[iOS][Added] - Allow libraries to provide module which conforms to protocols meant to be extension points.

Reviewed By: RSNara

Differential Revision: D53441411

fbshipit-source-id: f53bc6ea0417e6122d8918df2614bcb9937a515a
2024-02-13 06:18:54 -08:00
Nicola CortiandFacebook GitHub Bot f9a5b30e5a Fix autolinking for local app Fabric components (#42962)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42962

Autolinking local app fabric component requires user to manipulate the C++ code.
This removes this requirement by generating the code necessary to register all the discovered Fabric Components.

I've updated the RN-Tester Android setup to use this mechanism also.

Changelog:
[Android] [Fixed] - Fix autolinking for local app Fabric components

Reviewed By: RSNara

Differential Revision: D53661231

fbshipit-source-id: 28c376fbd08c326f117f8d420485d63e2b4b1241
2024-02-13 05:29:24 -08:00
Nicola CortiandFacebook GitHub Bot 922fe91278 Cleanup BUCK artifacts (#42990)
Summary:
Those files are stale from Buck OSS. I'm removing them.
I'm also updating the RN-Tester instructions to be up-to-date.

## Changelog:

[INTERNAL] - Cleanup BUCK artifacts

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

Test Plan: Nothing to test

Reviewed By: NickGerleman

Differential Revision: D53705337

Pulled By: cortinico

fbshipit-source-id: 685fc346870c5f123660cb5af2e30fb64842127a
2024-02-13 05:07:54 -08:00
Dmitry RykunandFacebook GitHub Bot 6974697b04 Use paperTopLevelNameDeprecated in generated EventEmitters if defined (#42812)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42812

There is a way of defining events where you specify additional string type parameter in the EventHandler in the spec. This additional type parameter is an overridden top level event name, that can be completely unrelated to the event handler name.
More context here D16042065.

Let's say we have
```
onLegacyStyleEvent?: ?BubblingEventHandler<LegacyStyleEvent, 'alternativeLegacyName'>
```
This will produce the following entry in the view config:
```
topAlternativeLegacyName: {
  phasedRegistrationNames: {
    captured: 'onLegacyStyleEventCapture',
    bubbled: 'onLegacyStyleEvent'
  }
}
```
This means that React expects `topAlternativeLegacyName`.
But the generated EventEmitter looks like this:
```
void RNTMyNativeViewEventEmitter::onLegacyStyleEvent(OnLegacyStyleEvent $event) const {
  dispatchEvent("legacyStyleEvent", [$event=std::move($event)](jsi::Runtime &runtime) {
    auto $payload = jsi::Object(runtime);
    $payload.setProperty(runtime, "string", $event.string);
    return $payload;
  });
}
```
The native component will emit `legacyStyleEvent` (`topLegacyStyleEvent` after normalization) that React will not be able to handle.

This issue only happens on iOS because Android doesn't use EventEmitter currently.

To address this issue we'll use `paperTopLevelNameDeprecated` for the generated EventEmitters if it is defined.

Changelog: [iOS][Fixed] - Fixed support for event name override in component specs.

Reviewed By: cortinico, mdvacca, cipolleschi

Differential Revision: D53310654

fbshipit-source-id: 018d5b11d8d36e2ecf900b9d8d6fe3e2ed71f80b
2024-02-13 04:31:25 -08:00
Dmitry RykunandFacebook GitHub Bot 4d07aae7ef RNTester: add legacy style event to MyNativeViewNativeComponent (#42809)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42809

This diff adds a legacy style event to `MyNativeViewNativeComponent`.
This is a way of defining events where you specify additional string type parameter in the EventHandler in the spec. This additional type parameter is an overridden top level event name, that can be completely unrelated to the event handler name.
In this example it is `onLegacyStyleEvent` and `alternativeLegacyName`.
More context here D16042065.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D53310318

fbshipit-source-id: 4dec08c872acdfd09b9939f690fb7bc777149580
2024-02-13 02:47:53 -08:00
Alex HuntandFacebook GitHub Bot d243cd9ca9 Add Flow and document template init script, simplify args (#42898)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42898

- Add Flow, switch from `yargs` to `parseArgs` (built-in to Node.js, Flow-safe).
- Document script via `--help` output (relevant ahead of reusing this script for local release testing).
- Relocate and add Flow to `setup-verdaccio.js` util.

Also:
- Remove `--reactNativeRootPath` arg.
- Tweak other arg names.

Changelog: [Internal]

Reviewed By: lunaleaps

Differential Revision: D53484322

fbshipit-source-id: d828e5606bbff032109ecccca9c8f8e337d78626
2024-02-13 02:32:21 -08:00
Alex HuntandFacebook GitHub Bot 280f37336d Update InspectorFlags to source from ReactNativeFeatureFlags (#42665)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42665

- Replace the internals of `InspectorFlags` to use the new `ReactNativeFeatureFlags` setup.
- Remove call sites to `InspectorFlags::initFromConfig`.

After this diff, all `InspectorFlags` are configured from `ReactNativeFeatureFlags.json`.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D53049790

fbshipit-source-id: 90c2b128a9c316546c3f8f8f88e2c08a9f55ae72
2024-02-13 02:10:19 -08:00
Alex HuntandFacebook GitHub Bot ce3ce1194b Remove RCTAppSetupPrepareApp overload and InspectorFlags call (#42642)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42642

Removes call to `InspectorFlags::initFromConfig`, since this approach is being replaced with `ReactNativeFeatureFlags`. This change is separated out as it originally made a public API deprecation.

Changelog:
[iOS][Deprecated] - **Un-deprecates** `RCTAppSetupPrepareApp` (reverts #41976)

Reviewed By: motiz88

Differential Revision: D53048207

fbshipit-source-id: 8624020f1e9e19f9f1ee75af9b177e922e36c5d9
2024-02-13 02:10:19 -08:00
Nicola CortiandFacebook GitHub Bot 0575033f76 Do not invoke envinfo on windows
Summary:
CI is broken. Let's not bother attempting to fixing it as it's attempting to call `envinfo` on Windows
which no one really looks into.
Also the maintainer is unresponsive: https://github.com/tabrindle/envinfo/issues/238

Changelog:
[Internal] [Changed] - Do not invoke envinfo on windows

Reviewed By: cipolleschi

Differential Revision: D53698194

fbshipit-source-id: db90ae6e773cf0a2f72ca1fc2d5faa3f56ed2edc
2024-02-13 00:59:26 -08:00
David VaccaandFacebook GitHub Bot f32950a96d Update nullability for usages of handleTouchEvent (#42961)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42961

Update nullability for usages of handleTouchEvent

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D53652922

fbshipit-source-id: ed26bffcbc3ddcfb82605e9e5439f9a9516459fc
2024-02-12 19:20:05 -08:00
Luna WeiandFacebook GitHub Bot 8a94bf0dba Fix CircleCI template tests by excluding dry-run build types
Summary:
Changelog: [Internal] - We still use the `dry-run` build variant in template tests on CircleCI

Previous diff migrated `set-rn-version` to `set-version` for dry-run, prealpha, and nightly build types. I didn't realize that template test flow used `dry-run` builds. I thought it was just for commitlies (which are deprecated).

To properly migrate this site, I need to fix the template test flow to accept monorepo packages at the same version as the dry-run react-native version (1000-<commithash>)

For now, let's just make this change more precise, and only update the nightly flow

See this error: {F1455663616}

Template test flow doesn't fake publish the monorepo packages at this version -- they're still using the versions off of main

Reviewed By: mdvacca

Differential Revision: D53688238

fbshipit-source-id: 6b64baca7eac842f2207fe13a3046b18459228da
2024-02-12 18:42:26 -08:00
David VaccaandFacebook GitHub Bot 282127d6e0 Fix lints in FabricUIManager (#42970)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42970

Fix lints in FabricUIManager

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D53636010

fbshipit-source-id: caab6821377b1bde11d2bed9cc2ef13283b8185f
2024-02-12 15:38:15 -08:00
David VaccaandFacebook GitHub Bot 8cd6f39024 Migrate UIManagerListener to kotlin
Summary:
Migrate UIManagerListener to kotlin

changelog: [internal] internal

Reviewed By: tdn120

Differential Revision: D53672556

fbshipit-source-id: c07d206dacaec9dfcfb4b73a64efbd3e8c4848b6
2024-02-12 13:23:00 -08:00
Luna WeiandFacebook GitHub Bot 2090fe5cf8 Add support for bumping packages on main after release cut (#42958)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42958

Changelog: [Internal] - Add support to `set-version` that we can bump the monorepo packages on main

This should be used after we cut a release branch. The release crew should then run

`yarn set-version 0.next.0-main --skip-react-native-version`

This makes sure we don't update `react-native` on main branch and keep it at 1000.0.0

This essentially replaces:
`yarn bump-all-updated-packages --release-branch-cutoff`
in this step: https://reactnative.dev/contributing/release-branch-cut-and-rc0#12-bump-minor-version-of-all-monorepo-packages-in-main

The reason for this change is to consolidate all the places where we update the version to one place, set-version.

Currently we do this in many fragmented places
* bump-all-updated-packages
* set-rn-version
* get-and-update-packages (deleted in the prev diff)

In the future, I want to get rid of `skip-react-native-version` but we'll need to remove the `1000.0.0` nomenclature. This unblocks us to just use this script for now.

bypass-github-export-checks

Reviewed By: huntie

Differential Revision: D53648688

fbshipit-source-id: 4f76366f8d340ec5aeaba1d3a26eba8b18a0166c
2024-02-12 12:07:51 -08:00
Luna WeiandFacebook GitHub Bot 34abd79475 Use set-version for nightly publishes (#42903)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42903

Changelog: [Internal] - Update publish-npm to use `set-version` for nightly builds

Now that `set-version` basically does what `set-rn-version` does, this diff uses this logic for nightlies only (as dry-run/pre-alpha variants are non-functional right now)

This does not change the flow of build-type `'release'` -- that will still use `set-rn-version` via CircleCI ([job](https://fburl.com/code/6xo3ijwg), [script](https://fburl.com/code/bo8np0tb))  We will eventually replace that too but that will be later.

This allows us to delete `get-and-update-packages.js` which was a helper written specifically for updating monorepo packages for nightlies.

The purpose of this is to eventually conform all version updates to use `set-version` in all types of releases (nightlies, stable)

bypass-github-export-checks

Reviewed By: cipolleschi

Differential Revision: D53487874

fbshipit-source-id: 734b528ef5bd095ac68f86701ae105daa30c7d68
2024-02-12 12:07:51 -08:00
Alex HuntandFacebook GitHub Bot d190ccafd3 Add retry to monorepo publish script (#42964)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42964

We've seen npm publishes fail occasionally in CI as part of this script, most recently in S391653. This change adds a single retry, per package, during the execution of this script, in an attempt to reduce the chance of manual interventions after a broken pipeline.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53607808

fbshipit-source-id: 526d9c33d51ec57702efba3c199bad313c1bf2d4
2024-02-12 10:43:48 -08:00
Alex HuntandFacebook GitHub Bot 273a5177e0 Use npm as source of truth for updated packages (make publish script rerunnable) (#42944)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42944

Updates `find-and-publish-all-bumped-packages` to use the npm registry as the source of truth, similar to tools like Lerna (`lerna publish from-package`). **This enables safe reruns of the publish script**, and replaces the previous Git-diff-detection implementation.

Changelog: [Internal]

Reviewed By: lunaleaps

Differential Revision: D53607807

fbshipit-source-id: 135808b7ce36cf463c9f53a8059500b83f8b6679
2024-02-12 10:43:48 -08:00
Alex HuntandFacebook GitHub Bot b41a33ede9 Move metro-config package into monorepo build, enable TS generation (#41836)
Summary:
This adds `react-native/metro-config` to the monorepo build tool and emits the missing typescript declarations.

Right now, we do have typescript declarations on `metro-config`, but not `react-native/metro-config`. Which makes everything a bit harder extend from "[the default React Native metro config](https://github.com/facebook/react-native/pull/36502)" in Expo.

> Note, I also added the same `exports` block from `react-native/dev-middleware` for conformity.

One open question here is, why aren't we exporting _all_ helper functions from `metro-config`? To me, its a bit weird that we need both `metro-config` _and_ `react-native/metro-config` as `loadConfig` isn't exported.

## Changelog:

[INTERNAL] [FIXED] - Emit typescript declaration files for `react-native/metro-config`

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

Test Plan:
Run the build tool, and check if the typescript declarations are emitted for `react-native/metro-config`.

```
yarn build metro-config
```

Reviewed By: hoxyq

Differential Revision: D51943453

Pulled By: huntie

fbshipit-source-id: cfaffe5660053fc9a9fcbe3dacf7f6ccc2bde01b
2024-02-12 05:20:38 -08:00
Alex HuntandFacebook GitHub Bot 49c3c3412a Refactor package discovery in publish script (#42938)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42938

Substitutes the `forEachPackage` util with a replacement async `getPackages` function. This will be used further in the next diff.

The new function aims to be more erganomic/versatile than `forEachPackage` by returning a package mapping (see updated test mock). The API aligns roughly with `yarn workspaces list` and [Lerna's `detectProjects`](https://lerna.js.org/docs/api-reference/utilities#detectprojects).

This also aligns with / replaces similar attempts in our existing scripts:
- [`getPackagesToPublish`](https://github.com/facebook/react-native/blob/2ca7bec0c2a7d821ceaaf39840a6cdc5eceb8678/scripts/monorepo/get-and-update-packages.js#L56)
- [`getPublicPackages`](https://github.com/facebook/react-native/blob/2ca7bec0c2a7d821ceaaf39840a6cdc5eceb8678/scripts/releases/set-version/index.js#L19)

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53607806

fbshipit-source-id: 00ec34edadab863dc8f2f0c7852f6e835a5dddf5
2024-02-12 04:42:27 -08:00
Alex HuntandFacebook GitHub Bot 56f483ccad Update exit cases for monorepo publish script (#42937)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42937

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53607810

fbshipit-source-id: 18e79f23060ee70e96bd8ac6e9995b0a8ba300b3
2024-02-12 04:42:27 -08:00
Alex HuntandFacebook GitHub Bot b25be6687e Add Flow, add positive test case for monorepo publish step (#42936)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42936

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53607809

fbshipit-source-id: 990826fda5538af9a13e3f24978295a2f3b0c8c3
2024-02-12 04:42:27 -08:00
Edmond ChuiandFacebook GitHub Bot 7e3e7684b1 refactor URL construction (#42948)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42948

Changelog: [Internal]

Refactor URL construction for DevTools.

Next diffs in the stack will add additional URL query params.

Support for both absolute and relative `devServerUrl`s maintained.

Reviewed By: hoxyq

Differential Revision: D53620915

fbshipit-source-id: 4a64c49c3479ede2add9f39a24448787d8609172
2024-02-12 04:08:14 -08:00
Nicola CortiandFacebook GitHub Bot 54ad5b9632 Fix broken build_android due to Kotlin Explicit API mode (#42960)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42960

Fix broken build_android due to Kotlin Explicit API mode

Changelog:
[Internal] [Changed] - Fix broken build_android due to Kotlin Explicit API mode

Reviewed By: mdvacca

Differential Revision: D53656201

fbshipit-source-id: ef097afe713167567601db36846e066c331aad10
2024-02-12 04:07:15 -08:00
David VaccaandFacebook GitHub Bot 64bb50aad0 Add missing @Override annotations in FabricUIManager (#42950)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42950

Add missing Override annotations in FabricUIManager

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D53635854

fbshipit-source-id: 269fb41e5b0277b8af4e119dc119409e766dae7a
2024-02-12 02:15:49 -08:00
m-nakamura145andFacebook GitHub Bot dd4f15bf08 chore: Bump actions/checkout (#42952)
Summary:
GitHub is [planning to upgrade to Node 20](https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/). Versions prior to actions/checkout v3 use an outdated version of node, so we will upgrade to actions/checkout v4, where [Node 20 is the default](https://github.com/actions/checkout/releases/tag/v4.0.0).

## Changelog:

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

chore: Bump actions/checkout

Pick one each for the category and type tags:

[INTERNAL] [FIXED] - chore: Bump actions/checkout

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[INTERNAL] [FIXED] - chore: Bump actions/checkout

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

Reviewed By: cipolleschi

Differential Revision: D53655117

Pulled By: cortinico

fbshipit-source-id: 7c05e6ac2cb71c9d20c0b28b183cada6856f0a2d
2024-02-12 02:12:40 -08:00
David VaccaandFacebook GitHub Bot 7098d34d90 Mark classes of package views as @Nullsafe (#42858)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42858

All these classes are NullSafe, let's mark them as NullSafe(Local) to ensure lint detect errors in the future

changelog: [internal] internal

Reviewed By: cortinico, rshest

Differential Revision: D53393471

fbshipit-source-id: 3f896f7d7c51f276a3f743d39dc851cb47ca538a
2024-02-11 21:20:02 -08:00
David VaccaandFacebook GitHub Bot 710ff5f4c9 Rename sliceChildShadowNodeViewPairsLegacy -> sliceChildShadowNodeViewPairsForTesting (#42928)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42928

Rename sliceChildShadowNodeViewPairsLegacy -> sliceChildShadowNodeViewPairsForTesting

changelog: [internal] internal

Reviewed By: rshest

Differential Revision: D53546236

fbshipit-source-id: a1590880360a7ae072cafeeead29d929f00e551d
2024-02-11 21:02:39 -08:00
David VaccaandFacebook GitHub Bot b5d9974169 Fix Differentiator comment format (#42929)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42929

Fix Differentiator comment format

changelog: [internal] internal

bypass-github-export-checks

Reviewed By: rshest

Differential Revision: D53546235

fbshipit-source-id: 763ee1272c8baa73f0bd54b3304da9a090e160ee
2024-02-11 21:02:39 -08:00
Jakub RomanczykandFacebook GitHub Bot 62c15bacaa fix(virtualized-lists): declare missing react peer dependency (#42947)
Summary:
In setups with `pnpm`  `react-native/virtualized-lists` gets bundled incorrectly because of the following error:

`Module not found: Error: Can't resolve 'react'`

As 'react' is used inside of the package, it should declared explicitly, instead of being a phantom dependency.

## Changelog:

[GENERAL] [FIXED] - Declare missing peer dependency `react`

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

Test Plan: not needed

Reviewed By: NickGerleman

Differential Revision: D53617462

Pulled By: cortinico

fbshipit-source-id: 19a8fed94263646b0af93339d5c014e629dfa6b1
2024-02-10 17:03:15 -08:00
Ramanpreet NaraandFacebook GitHub Bot 3582f43440 Fix relative includes in component codegen (#42956)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42956

In the component codegen system, when the header prefix is an empty string, we generate includes using angle brackets, like this:

```
#include <EventEmitter.h>
```

This fails to compile in buck.

If we instead generate includes using quotations, buck compiles again.
```
#include "EventEmitter.h"
```

So, changes: if the headerPrefix is an empty string, generate includes using quotes.

This is a followup to D51811596.

Changelog: [Internal]

Reviewed By: fkgozali, dmytrorykun

Differential Revision: D53487111

fbshipit-source-id: e90a8b9fd4f8a2a93a0f4ad0ed989af26ad122c5
2024-02-10 14:32:13 -08:00
David VaccaandFacebook GitHub Bot d0dd0e2852 Cleanup ReactScrollView
Summary:
Cleanup some code and lints in ReactScrollView

bypass-github-export-checks

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D53485242

fbshipit-source-id: ec8d0c4b42d88786c14897e4ff4b44c2cc084d87
2024-02-10 10:33:16 -08:00
Luna WeiandFacebook GitHub Bot 68e6a94538 Fixset-version to also update packages/react-native source (#42897)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42897

Changelog: [Internal] - Update nightly flow to use set-version

This change fixes `set-version` to update the `packages/react-native` native source and build files (as `set-rn-version` does) -- this was an oversight but not an issue as `set-version` isn't actually used anywhere right now.

Reviewed By: huntie

Differential Revision: D53463414

fbshipit-source-id: d0d9e4bbe246cccb8643a6ebf9794122bc343433
2024-02-09 21:35:18 -08:00
David VaccaandFacebook GitHub Bot 91fe3b484b Fully rollout FabricSharedEventPipeline (#42949)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/42949

Reviewed By: javache, sammy-SC

Differential Revision: D53552253

fbshipit-source-id: 67e9db9bd48dd9c37a78e74faf0406fef0c3ad8d
2024-02-09 18:27:03 -08:00
Joe VilchesandFacebook GitHub Bot ee21b85dae Support for (de)serializing node state (#42751)
Summary:
X-link: https://github.com/facebook/yoga/pull/1570

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

tsia. Need node state

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D53206323

fbshipit-source-id: eb48c3873536eb52c8ffcce8005725da274e5373
2024-02-09 16:44:32 -08:00
Joe VilchesandFacebook GitHub Bot e1afa023aa Support for (de)serializing config values (#42750)
Summary:
X-link: https://github.com/facebook/yoga/pull/1571

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

tsia. This is state we need to capture as it can drastically affect the benchmark times

Reviewed By: NickGerleman

Differential Revision: D53203385

fbshipit-source-id: 47178458d039df90fb15d8a420f9e0f17e4fe6ca
2024-02-09 16:44:32 -08:00
Nicola CortiandFacebook GitHub Bot 3c2b2b181c Kotlin to 1.9.22 (#42927)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42927

This bumps Kotlin to 1.9.22 which is the latest in OSS and closer to the version we use inside fbsource.

Turns out that Explicit API mode was not enabled correctly, so I had to go over all the Kotlin classes
and correctly set them to `public` if they were intended to be for public consumption.

I updated some of them to `private` or `internal` but otherwise I've defaulted to `public` which is the default
we have right now.

Changelog:
[Android] [Changed] - Kotlin to 1.9.22

Reviewed By: cipolleschi

Differential Revision: D53576844

fbshipit-source-id: dd8b08ce9bf87f738159f60fd850e3e3bc490ebc
2024-02-09 10:58:29 -08:00
Eric RozellandFacebook GitHub Bot cadaf26cde Fix clang warning for -Winconsistent-missing-destructor-override (#42942)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42942

Instance derives from jsinspector_modern::InstanceTargetDelegate, which defines a virtual destructor, but Instance does not mark its destructor with override.

## Changelog [Internal]

Reviewed By: cipolleschi

Differential Revision: D53609922

fbshipit-source-id: b30df7d59478fa72b53ddc2eeb04c291a6f5f9eb
2024-02-09 06:31:31 -08:00
Riccardo CipolleschiandFacebook GitHub Bot f6f461593b Make [RCTBridge currentBridge] work also inBridgeless for backward compatibility. (#42940)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42940

We might have some libraries that goes through the interop layer that are using [RCTBridge currentBridge]. Although this is an API that we would like them not to use, that's the sad reality and if we don't want to force a migration on those libraries, we need to be backward compatible.

This diff sets the `RCTBridgeProxy` as the `currentBridge` in case the app is running in BridgelessMode. This should make Bridgeless backward compatible.

## Changelog
[iOS][Fixed] - Make [RCTBridge currentBridge] work in bridgeless mode

Reviewed By: RSNara

Differential Revision: D53575361

fbshipit-source-id: 179e440662b577954a577e8400e0ce0dc5b4d3ff
2024-02-09 05:29:10 -08:00
Samuel SuslaandFacebook GitHub Bot 5fbdc994f9 remove animation from borderLayer to stop unwanted animations (#42922)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42922

changelog: [fix][ios] prevent unwanted border animation

The problem: CALayer and its properties are animatable. If RN applies mutations inside an animation block, it will animate. In this particular example, it was animated because of a transition applied by the library and because we were not creating new views, but recycling views from previous screen.

This caused size of _borderLayer to change from value A to value B inside of animation block. To resolve this, call removeAllAnimations on borderLayer.

Reviewed By: cipolleschi

Differential Revision: D53566886

fbshipit-source-id: 98e0b01a9185046e1ee500665c1832060ecc8884
2024-02-09 04:06:52 -08:00
Edmond ChuiandFacebook GitHub Bot 7afc8b8623 disable "Open Debugger" menu item if the bundler is disconnected (#42876)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42876

Changelog:
[Android][Fixed] Disable the "Open Debugger" item from dev menu if the bundler is disconnected

# Existing
In our dev menu, the "Open Debugger" menu item is shown even if the packager isn't connected.

{F1451833462}

# In this PR
The "Open Debugger" menu item is disabled when the packager is disconnected with the message "Connect to the bundler to debug JavaScript"

{F1451834019}

# Reference
* There are existing checks, but they're async. We don't need the check to be accurate; and we don't want to delay the dev menu from opening
    * [isMetroRunning()](https://github.com/facebook/react-native/blob/db066acfe3994787d706ad082ce718a91b8249f5/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java#L1013-L1027)
    * [isPackagerRunning(…)](https://github.com/facebook/react-native/blob/db066acfe3994787d706ad082ce718a91b8249f5/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java#L798-L805)
* Also on iOS: D53354110

Reviewed By: hoxyq

Differential Revision: D53428914

fbshipit-source-id: 3e70d7fec9fc8fc63a8519c5385a91775febce9a
2024-02-09 03:05:36 -08:00
Phillip PanandFacebook GitHub Bot d7dce975f9 introduce native api to access RuntimeExecutor (#42882)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42882

Changelog: [Android][Added] - introduce native api to access RuntimeExecutor

This is the android equivalent of [PR#42758](https://github.com/facebook/react-native/pull/42758).

From [PR#42758](https://github.com/facebook/react-native/pull/42758)

> The goal of this API is to provide a safe way to access the jsi::runtime in bridgeless mode. The decision to limit access to the runtime in bridgeless was a conscious one - the runtime pointer is not thread-safe and its lifecycle must be managed correctly by owners.

> However, interacting with the runtime is an advanced use case we would want to support. Our recommended ways to access the runtime in bridgeless mode is either 1) via the RuntimeExecutor, or 2) via a C++ TurboModule.

This diff introduces the API that would allow for 1). because react context can be non-null before react instance is ready, this can still return null. however, the callsite should be cognizant of when this will happen. in the case of expomodules, the runtime should be ready when the module is init, unless it is a eager initialized module

Reviewed By: RSNara

Differential Revision: D53461821

fbshipit-source-id: 69555d0593a59f8655e4dcd2f0ef1f78f4cfff7d
2024-02-08 18:09:36 -08:00
Bart TyrpienandFacebook GitHub Bot 40bb425f48 Update tsconfig to not run on files inside Pods (#42909)
Summary:
Opening the VisionOS fork crashes `tsserver.js` inside VSCode because of some Pods files. This stops `tsserver` from looking at any files inside Pods

[Link to issue](https://github.com/callstack/react-native-visionos/issues/97)

## Changelog:

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

Pick one each for the category and type tags:

[GENERAL] [ADDED] - Added a folder inside the `exclude` array inside `tsconfig`

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

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

Reviewed By: lunaleaps

Differential Revision: D53518533

Pulled By: cipolleschi

fbshipit-source-id: 8d7819ec3ae8f0b413389157a34f49961434037f
2024-02-08 18:04:16 -08:00
Phillip PanandFacebook GitHub Bot b796cda38b fix crash
Summary: blocks don't capture C++ objects so this will would crash

Reviewed By: sammy-SC, cipolleschi

Differential Revision: D53572123

fbshipit-source-id: 323f29c30d99616080aef6b0a895df4599788395
2024-02-08 12:24:48 -08:00
Oskar KwaśniewskiandFacebook GitHub Bot 2ca7bec0c2 fix: [Codegen] log supported apple platforms if there are any (#42819)
Summary:
This PR adds check if there are any supported platforms to log.

For built-in modules this was logging empty line (as some of them doesn't contain podspecs):

![CleanShot 2024-02-02 at 15 54 42@2x](https://github.com/facebook/react-native/assets/52801365/c7e36052-9c48-4e00-a539-6ee5d528bbee)

## Changelog:

[GENERAL] [FIXED] - Log Codegen supported platforms if any are available

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

Test Plan: Run Codegen and check if it prints empty `Supported Apple platforms`

Reviewed By: cortinico

Differential Revision: D53566301

Pulled By: cipolleschi

fbshipit-source-id: 3f6b6d3b44da1ab7174432a5fac7f7d3fde11103
2024-02-08 09:52:55 -08:00