Compare commits

...
Author SHA1 Message Date
Distiller a4430b52e5 Release 0.74.6
#publish-packages-to-npm&0.74-stable
2024-10-02 09:46:45 +00:00
Tommy NguyenandGitHub a90a17a8b3 fix(react-native): fix codegen failing in a pnpm monorepo setup (#45993) 2024-09-30 16:14:51 +01:00
Nicola CortiandGitHub a9588f3718 [0.74] Add support for handling com.facebook.react.bridge.Dynamic as parameter for TurboModules (#46067)
resolved: https://github.com/facebook/react-native/pull/45944
2024-09-30 16:14:40 +01:00
Blake Friedman 4e737b0b16 [LOCAL] bump hermes version 2024-09-30 16:13:04 +01:00
Tomasz ŻelawskiandBlake Friedman 4f0d295e77 fix(TypeScript): Allow readonly arrays in transform (#46310)
Summary:
Currently readonly arrays aren't allowed in components' style, but readonly objects are accepted. This becomes evident in such case:

```ts
import { View } from 'react-native';

interface AppProps {
  transform: readonly ({ translateX: number } | { translateY: number })[];
  shadowOffset: Readonly<{ width: number; height: number }>;
}

export default function App({ transform, shadowOffset }: AppProps) {
  return (
    <>
      {/* TypeScript error with transform */}
      <View style={{ transform }} />
      {/* No errors with shadowOffset */}
      <View style={{ shadowOffset }} />
    </>
  );
}
```

## Changelog:

[GENERAL] [FIXED] - Allow readonly array type for transform property

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

Test Plan:
`yarn test-typescript`

I added relevant tests cases.

Reviewed By: robhogan

Differential Revision: D62140462

Pulled By: NickGerleman

fbshipit-source-id: 87374b0901ebc40cab48d442b61fe7a65711bc89
2024-09-30 15:53:47 +01:00
Distiller 5e6fed361c Release 0.74.5
#publish-packages-to-npm&latest
2024-08-05 13:31:03 +00:00
Pieter De BaetsandThibault Malbranche 5da40cbb1c Stop emitting deprecated onTextInput events (#44479)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44479

TextInputs' onTextInput callback was removed way back in React Native 0.62 with https://github.com/facebook/react-native/commit/3f7e0a2c9601fc186f25bfd794cd0008ac3983ab , but remnants of the implementation exists.

We first have to remove the event emitting in native code, and can land the full removal separately in D57092733, once there's no older client references remaining to this event.

Changelog: [General][Removed] Remove deprecated onTextInput callback

Reviewed By: cipolleschi

Differential Revision: D57092734

fbshipit-source-id: 5b0beee3d55b70717216fe8ceaf52444540f5adc
2024-08-05 01:31:21 +02:00
Riccardo CipolleschiandGitHub 10e9669ad1 [RN][Hermes] Fore Hermes versions for slices through env var (#45840) 2024-08-05 01:30:40 +02:00
Distiller 097ce07602 Release 0.74.4
#publish-packages-to-npm&latest
2024-07-30 11:18:41 +00:00
Nicola CortiandGitHub 13ea273850 [0.74] Stub com.facebook.react.settings on 0.74 (#45720) 2024-07-29 11:18:21 +02:00
CHEN Xian-anandThibault Malbranche b9f7005c46 Not all the targets have a defined symbol_type (#45591)
Summary:
Errors occurred on running `pod install`:

```
[!] An error occurred while processing the post-install hook of the Podfile.

undefined method `symbol_type' for #<Xcodeproj::Project::Object::PBXAggregateTarget:0x000000010f6ea568>

[redact]/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:53:in `block in get_application_targets'
```

## Changelog:

[iOS] [Fixed] - Fix error on handling privacy manifest

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

Reviewed By: cipolleschi

Differential Revision: D60107607

Pulled By: dmytrorykun

fbshipit-source-id: 316220fe54174b18c9b61775f807d5d05d9f0240
2024-07-29 10:21:19 +02:00
Riccardo CipolleschiandGitHub 1835245e9e [RN][0.74]Fix XROS build (#45580) 2024-07-23 14:06:30 +02:00
Riccardo Cipolleschi c9ce04828f [LOCAL][RN][CI] Fix Typo for IOS_DEPLOYMENT_TARGET 2024-07-22 16:54:03 +01:00
Riccardo Cipolleschi 3597552c41 [LOCAL][RN][CI] Fix Build Slice Job for VisionOS 2024-07-22 16:40:22 +01:00
Riccardo Cipolleschi 713b6b930f [LOCAL][RN][CI] Fix Hermes for iOS in CI 2024-07-22 16:17:15 +01:00
Riccardo CipolleschiandThibault Malbranche c0dd23662e Factor out the CXX language standard in a separate const (#45374)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45374

This change factors out the language standard in a separate constant so we can easily control it from a single place.

There are only 2 exception to this:
1. hermes-engine: the podspec is used in CI and it has no access to the rct_cxx_language_standard variable
2. Yoga: it can be used as a separate pod, outside of React Native, so it makes sense to leave it alone.

This change also fixes a problem where, in some setup, the language was set to C++14

[Internal] - Refactor Cxx language standard in a single constant

Reviewed By: dmytrorykun, blakef

Differential Revision: D59629061

fbshipit-source-id: 41eac64e47c14e239d8ee78bd88ea30af244d695
2024-07-22 15:49:46 +02:00
Oskar KwaśniewskiandThibault Malbranche 8271278bba feat: build visionos hermes binary on the CI (#44691)
Summary:
As discussed with cipolleschi offline, this PR adds visionOS to the prebuilt Hermes binary for the CI.

[IOS] [ADDED] - Prebuilt version of Hermes for visionOS

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

Test Plan: Check if CI builds xcframework for visionOS.

Reviewed By: cortinico

Differential Revision: D58189271

Pulled By: cipolleschi

fbshipit-source-id: dc76746b2c1e22670bef4c21411a598e43dad577
2024-07-22 15:46:54 +02:00
Douglas LowderandThibault Malbranche a8c6aa2344 fix: Remove setting of process.exitCode that breaks Jest tests (#45562)
Summary:
In Node 20, the script to run unit tests in CI (`scripts/run-ci-javascript-tests.js`) will fail, even when all the Jest tests pass. This happens because one of the JS modules being tested is setting `process.exitCode` (see https://github.com/jestjs/jest/issues/9324#issuecomment-1808090455).

Changes:

- Modified the affected module to throw an exception when failing, instead of setting the exit code
- Adjusted the unit test for that module

## Changelog:

[General] [Fixed] - Remove setting of process.exitCode that breaks Jest tests

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

Test Plan:
Before this change, running `node scripts/run-ci-javascript-tests.js` would fail with Node 20.
After this change, it succeeds.

Reviewed By: blakef

Differential Revision: D60033582

Pulled By: cipolleschi

fbshipit-source-id: 71b7f4495d414e719a9bd2d892bd1bc3045ddd5d
2024-07-22 15:45:07 +02:00
nik910andThibault Malbranche c374415cec Adding space to $(inherited) string to avoid merging of inherited and… (#45520)
Summary:
Added space to $(inherited) string to avoid creation of wrong cpp flags in RCTAppDelegate podspec

<img width="1157" alt="Screenshot 2024-07-18 at 8 51 19 PM" src="https://github.com/user-attachments/assets/29d32d08-e81f-4c25-b8ee-5dccc0f620ea">

## Changelog:

[IOS] [FIXED] - Building of iOS project when RCTAppDelegate is used in the project

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

Test Plan: To test this you can simply change in your node modules and run pod install, the build will now work successfully

Reviewed By: cipolleschi

Differential Revision: D59950906

Pulled By: arushikesarwani94

fbshipit-source-id: 0d58620aa0be7ac4fcbcd309f06df0eef7844016
2024-07-22 15:44:55 +02:00
Blake FriedmanandThibault Malbranche 141778db55 Fix: OSS builds can accidentally using coreutils cp (#44097)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44097

There are two places where we use a feature specific to the system version of 'cp', the:

  -X    Do not copy Extended Attributes (EAs) or resource forks.

This feature isn't available in GNU's cp, which is commonly installed on macOS using:

  brew install coreutils && brew link coreutils

We can avoid the problem alltogether by being specific about the path of the system cp.

Changelog: [General][Fixed] don't break script phase and codegen when coreutils installed on macOS

Reviewed By: cipolleschi

Differential Revision: D56143216

fbshipit-source-id: f1c1ef9ea2f01614d6d89c4e9eedf43113deb80c
2024-07-22 15:44:45 +02:00
Riccardo CipolleschiandThibault Malbranche f996422c81 Fix path to node in .xcode.env.local (#43333)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43333

This change fixes https://github.com/facebook/react-native/issues/43285.
Basically, when using a `yarn` alias to install pods, yarn creates a copy of the `node` and `yarn` executables and the `command -v node` command will return the path to that executable.

## Changelog
[iOS][Fixed] - Do not use temporary node when creating the .xcode.env.local

Reviewed By: dmytrorykun

Differential Revision: D54542774

fbshipit-source-id: 3ab0d0bb441988026feff9d5390dcfd10869a1b5
2024-07-22 15:44:34 +02:00
Riccardo CipolleschiandThibault Malbranche 1f806871c5 Make sure to pass the BridgeProxy to view managers in the interop layer (#45329)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45329

Thanks to [#45232](https://github.com/facebook/react-native/issues/45232) we found a bug in the interop layer, where we were not passing the BridgeProxy in bridgeless mode to the view managers.

This Change should fix that issue.

## Changelog:
[iOS][Fixed] - Make sure to pass the RCTBridgeProxy to  ViewManagers

Reviewed By: dmytrorykun

Differential Revision: D59468292

fbshipit-source-id: 00666be21385a735878eb567c4b8a0986c609c5f
2024-07-22 15:44:23 +02:00
IrfanwaniandThibault Malbranche ab98c22085 fix: post install error in iOS after running pod install, undefined method 'path' for nil:NilClass (#45095)
Summary:
After upgrading my project to the latest version of react native i.e, 0.74.2, i was getting an error when running `pod install` an the error was coming from the post install hook. Going deeper into the file tree, i found that some of the things are Nil and react native is trying to use some methods on them, so fixed those issues by using chaining operators to conditionally apply the path method on them.

## Changelog:

[Internal] - fixes the post install issue when running pod install with react native version, 0.74.2

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

Test Plan: Manually tested the fix. Works perfectly fine in both debug and production mode.

Reviewed By: cortinico

Differential Revision: D58863666

Pulled By: cipolleschi

fbshipit-source-id: 64459711dcf926b7544b99b542e9861c1c0f05ca
2024-07-22 15:43:45 +02:00
Håkon KnutzenandThibault Malbranche b8006d40b0 Fix data races in RCTImageLoader and RCTNetworkTask with shared atomic counters (#45114)
Summary:
In order to fix the data races described in https://github.com/facebook/react-native/issues/44715, I propose a simple solution by leveraging shared counter functions wherein `std::atomic` is the backing for the integer values.

## Changelog:

[iOS] [Fixed] - Implement shared atomic counters and replace static integers in `RCTImageLoader` and `RCTNetworkTask` that were accessed concurrently, which in some cases lead to data races.

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

Test Plan: Added unit tests for the counters in `RCTSharedCounterTests`.

Reviewed By: cipolleschi

Differential Revision: D59155076

Pulled By: javache

fbshipit-source-id: f73afce6a816ad3226ed8c123cb2ccf4183549a0
2024-07-22 15:43:31 +02:00
distiller 8e5a9360bb Release 0.74.3
#publish-packages-to-npm&latest
2024-07-01 17:33:11 +00:00
Thibault Malbranche 3d53992051 fix: typo when cherry picking from kotlin to java 2024-07-01 15:01:20 +02:00
Rubén NorteandThibault Malbranche 3c4d7618f0 Back out "Revert D58459930: [react-native][PR] Add ReactMarkerConstants.CONTENT_APPEARED support on Android"
Summary:
Changelog: [ANDROID] [ADDED] - Add the ReactMarkerConstants.CONTENT_APPEARED support on Android in bridgeless mode.

This re-applies https://github.com/facebook/react-native/pull/43620 which was reverted because a CI job started failing because we forgot to update `packages/react-native/ReactAndroid/api/ReactAndroid.api`.

Reviewed By: cortinico

Differential Revision: D58535868

fbshipit-source-id: 9eec33c5e798850a7434a6c391abf2fc3fc9d0a6
2024-07-01 14:27:11 +02:00
Dmitry RykunandThibault Malbranche bdf6583c7e Fix output path for generated artifacts (#45165)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45165

This is a fix for https://github.com/facebook/react-native/issues/45112
This diff changes the codegen so that the output path is computed relative to project root (or `path` if provided) instead of current working directory.

Changelog: [General][Fixed] - Codegen computes output path relative to project root instead of current working directory.

Reviewed By: fkgozali

Differential Revision: D59009821

fbshipit-source-id: 3a138a3508fc239c8600b8c9f242f1c665f8e3c0
2024-07-01 14:21:32 +02:00
Nicola CortiandThibault Malbranche 278823ecc5 Back out "Add Float and Int type support for Android modules" (#45087)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45087

Original commit changeset: 32b3bbdf5fd2

Fixes https://github.com/facebook/react-native/issues/44963
Closes https://github.com/facebook/react-native/pull/45024

Original Phabricator Diff: D52420921

Changelog:
[Internal] [Changed] - Back out "[RN][Codegen]Add Float and Int type support for Android  modules"

Reviewed By: dmytrorykun

Differential Revision: D58820544

fbshipit-source-id: 59cd0e7cc17a681785c57b5ce1a9d50d28a348af
2024-07-01 14:19:23 +02:00
3a1ff94839 [Hermes] Bump Hermes (#45220)
* [Hermes] Bump Hermes

* Implement queueMicrotask and drainMicrotasks in JSC

Summary:
Changelog: [internal]

## Context

We want to enable the new React Native event loop by default for all users on the new RN architecture (on the bridgeless initialization path more concretely), which requires support for microtasks in all the JS engines that the support (Hermes already has it, JSC doesn't).

## Changes

This adds initial support for microtasks in JSC, so we can schedule and execute microtasks in this runtime.

One limitation about this approach is that, AFAIK, the public API for JSC doesn't allow us to customize its internal microtask queue or specify the method to be used by its built-in `Promise` or native `async function`, so we're forced to continue using a polyfill in that case (which uses `setImmediate` that will be mapped to `queueMicrotask`).

Reviewed By: NickGerleman

Differential Revision: D54302534

fbshipit-source-id: 47f71620344a81bc6624917f77452106ffbf55a3

---------

Co-authored-by: Rubén Norte <rubennorte@meta.com>
2024-07-01 11:38:09 +02:00
Riccardo Cipolleschi 28ccfdc3dd [CI] Disable unit tests as they are Flaky on M1 machines ## Summary Disable unit tests on iOS because they are flaky on M1 machines ## Changelog: [Internal] - Disable unit tests in CI ## Test Plan:
Circle CI is Green
2024-06-28 14:11:56 +02:00
Riccardo Cipolleschi 2b033756ef [CI] Move iOS Executors to M1 2024-06-28 12:51:27 +02:00
Szymon RybczakandGitHub d1e2a35061 feat: update CLI to 13.6.9 (#44793) 2024-06-19 14:15:13 +01:00
Rubén NorteandThibault Malbranche 7dd6549e09 Continue running microtasks when parent task throws
Summary:
Changelog: [General][Fixed] Fixed LogBox not showing correctly on the New Architecture

We found an incorrect behavior in the event loop, where an error in a task would prevent its microtasks from running. This isn't spec compliant and should be fixed.

This caused LogBox to not work correctly, as error reporting is implemented via microtasks that would never execute.

Reviewed By: sammy-SC

Differential Revision: D58010521

fbshipit-source-id: 7901c5d6e83fb63af148e12ad6c32be490a3999d
2024-06-18 14:41:09 +02:00
Ramanpreet NaraandThibault Malbranche 487c8489f1 Refactor: RuntimeScheduler: Delete ErrorUtils.h (#43953)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43953

RuntimeScheduler's ErrorUtils.h is redundant.

Let's just remove it.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D55547905

fbshipit-source-id: 5263c9fca8ae32bbfc672f0e16b79ee177cdd421
2024-06-18 14:41:09 +02:00
Rubén NorteandThibault Malbranche 37b33c34ba Small refactor in RuntimeScheduler_Modern to favor references over shared_ptr for non-owning function args (#43852)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43852

Changelog: [internal]

Just a small refactor so we rely less on shared pointers within `RuntimeSCheduler_Modern`.

Reviewed By: javache

Differential Revision: D55646389

fbshipit-source-id: d01dcba7b1551d349d21717ba585828ed7fb3259
2024-06-18 14:41:09 +02:00
Nicola CortiandThibault Malbranche 988bf162a0 Tentative fix for NPE JavaTimerManager$IdleCallbackRunnable.cancel (#44852)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44852

This attempts to fix #44842 by capturing the accessed field in a new variable.
We don't have a way to reproduce this & this is a best guess fix.

Changelog:
[Android] [Fixed] - Tentative fix for NPE `JavaTimerManager$IdleCallbackRunnable.cancel`

Reviewed By: javache

Differential Revision: D58356826

fbshipit-source-id: d016df9a52f81a8d645a0a100c6bc6111841e24e
2024-06-18 14:41:09 +02:00
huzhanbo.lucandThibault Malbranche f4b0fcb922 fix: android native rejections should be instanceof Error (#44487)
Summary:
fix https://github.com/facebook/react-native/issues/44050

## Changelog:

[ANDROID] [FIXED] - fix: android native rejections should be instanceof Error

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

Test Plan: reject returns Error.

Reviewed By: NickGerleman

Differential Revision: D57205131

Pulled By: javache

fbshipit-source-id: a5950481d0c4909be4dbea0b430e75222258ae68
2024-06-18 14:41:09 +02:00
Fabrizio BertoglioandThibault Malbranche e210c7c574 Fix Multiline TextInput with a fixed height scrolls to the bottom when prepending new lines to the text (#38679)
Summary:
### Please re-state the problem that we are trying to solve in this issue.

Multiline TextInput with a fixed height will scroll to the bottom of the screen when prepending new lines to the text.

### What is the root cause of that problem?

The issue is caused by iOS UITextView:
- The cursor moves to the end of the text when prepending new lines.
- Moving the cursor to the end of the text triggers the scroll to the bottom.

The behavior was reproduced on an iOS App (without react-native).
The example included below implements a Component RCTUITextView based on UITextView, which modifies the UITextView attributedText with the textViewDidChange callback (source code available in this [comment](https://github.com/Expensify/App/issues/19507#issuecomment-1595730348)).

Adding a new line on top of the UITextView on iOS results in:
Issue 1) The cursor moves to the end of TextInput text
Issue 2) The TextInput scrolls to the bottom

<details><summary>Reproducing the issue on an iOS App without react-native</summary>
<p>

<video src="https://user-images.githubusercontent.com/24992535/246601549-99f480f3-ce80-4678-9378-f71c8aa67e17.mp4" width="900" />

</p>
</details>

Issue 1) is already fixed in react-native, which restores the previous cursor position (on Fabric with  [_setAttributedString](https://github.com/fabriziobertoglio1987/react-native/blob/71e7bbbc2cf21abacf7009e300f5bba737e20d17/packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm#L600-L610)) after changing the text.
Issue 2) needs to be fixed in react-native.

### What changes do you think we should make in order to solve the problem?

Setting the correct TextInput scroll position after re-setting the cursor.

## Changelog:

[IOS] [FIXED] - Fix Multiline TextInput with a fixed height scrolls to the bottom when changing AttributedText

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

Test Plan:
Fabric (reproduces on controlled/not controlled TextInput example):

| Before    | After |
| ----------- | ----------- |
| <video src="https://github.com/facebook/react-native/assets/24992535/e06b31fe-407d-4897-b608-73e0cc0f224a" width="350" />      | <video src="https://github.com/facebook/react-native/assets/24992535/fa2eaa31-c616-43c5-9596-f84e7b70d80a" width="350" />       |

Paper (reproduces only on controlled TextInput example):

```javascript
function TextInputExample() {
  const [text, setText] = React.useState('');

  return (
    <View style={{marginTop: 200}}>
      <TextInput
        style={{height: 50, backgroundColor: 'white'}}
        multiline={true}
        value={text}
        onChangeText={text => {
          setText(text);
        }}
      />
    </View>
  );
}
```

| Before    | After |
| ----------- | ----------- |
| <video src="https://github.com/facebook/react-native/assets/24992535/6cb1f2de-717e-4dce-be0a-644f6a051c08" width="350" />      | <video src="https://github.com/facebook/react-native/assets/24992535/dee6edb6-76c6-48b0-b78f-99626235d30e" width="350" />       |

Reviewed By: sammy-SC, cipolleschi

Differential Revision: D48674090

Pulled By: NickGerleman

fbshipit-source-id: 349e7b0910e314ec94b45b68c38571fed41ef117
2024-06-18 14:41:09 +02:00
Kudo ChienandThibault Malbranche d9e42785f3 Support customizeRootView from RCTRootViewFactory (#44775)
Summary:
The new `customizeRootView` does not have the feature parity as `createRootViewWithBridge` where reusing RCTRootViewFactory to create a root view, it does not call `customizeRootView`. This PR moves the `customizeRootView` support from RCTAppDelegate into RCTRootViewFactory and improves the customizeRootView support.

[IOS] [CHANGED] - Support `customizeRootView` from `RCTRootViewFactory`

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

Test Plan:
Add customizeRootView to **packages/rn-tester/RNTester/AppDelegate.mm** and test whether RNTester has blue background color in both new arch and old arch mode.

```objc
- (void)customizeRootView:(RCTRootView *)rootView
{
  rootView.backgroundColor = [UIColor blueColor];
}
```

Reviewed By: dmytrorykun

Differential Revision: D58179693

Pulled By: cipolleschi

fbshipit-source-id: 0fac9a1bd5b2583a2700b3a3d2c80d0f608c4481
2024-06-18 14:41:09 +02:00
Jakub PiaseckiandThibault Malbranche a2b52af3bc Fix border drawn over children on iOS (#44777)
Summary:
Fixes https://github.com/facebook/react-native/issues/44690

In the code responsible for drawing border on iOS there's a comment saying:
> iOS draws borders in front of the content whereas CSS draws them behind the content. For this reason, only use iOS border drawing when clipping or when the border is hidden.

The condition that follows checks whether the content is clipped and the width and alpha channel of the border: https://github.com/facebook/react-native/blob/e0a2e86d0346bd7e40adf69311daa538ca8c9c5f/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm#L643-L644.

The problem is when the color is not set at all - `colorComponentsFromColor(borderMetrics.borderColors.left).alpha` will be equal to 0 since the relevant `SharedColor` is `null`: https://github.com/facebook/react-native/blob/e0a2e86d0346bd7e40adf69311daa538ca8c9c5f/packages/react-native/ReactCommon/react/renderer/graphics/platform/ios/react/renderer/graphics/HostPlatformColor.mm#L76-L86

Then it uses the path with the default iOS behavior (drawing the border on top of the content) instead of the custom one (with the border below) and it seems like it defaults to drawing black when the passed color is `nil`.

This PR simply adds one more check to make sure the color is actually set before choosing the default platform behavior.

## Changelog:

[IOS] [FIXED] - Fixed border being drawn over children when no color was set

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

Test Plan:
Tested on the code from the issue.

|Before|After|
|-|-|
|<img width="546" alt="Screenshot 2024-06-04 at 11 18 14" src="https://github.com/facebook/react-native/assets/21055725/f13250a9-2e99-41c5-a9bc-02d65c00a6c0">|<img width="546" alt="Screenshot 2024-06-04 at 11 17 38" src="https://github.com/facebook/react-native/assets/21055725/f4571a5f-dfc4-4191-854c-fd3faf698b29">|

Reviewed By: cortinico

Differential Revision: D58131337

Pulled By: cipolleschi

fbshipit-source-id: 7da247d81ecec586de6f0023e0cb399f9966213d
2024-06-18 14:41:09 +02:00
Soe LynnandThibault Malbranche 9a5faac12b overflow props is not honored in ScrollView in new architecture (#44699)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44699

Changelog: [Internal]

In Fabric, overflow props for ScrollView is not passed down. Hence, the overflow props is ignored and FlatList content is always clipped.

Reported from OSS https://github.com/facebook/react-native/issues/44683

Reviewed By: sammy-SC

Differential Revision: D57895399

fbshipit-source-id: 6ce65bea0803971060e8229b66563123dd6fc114
2024-06-18 14:41:09 +02:00
Alex Hunt 3888bf3238 Update Podfile.lock
Changelog: [Internal]
2024-06-04 18:00:01 +01:00
Distiller 17c0b1766f Release 0.74.2
#publish-packages-to-npm&latest
2024-06-04 15:08:03 +00:00
Kudo ChienandRiccardo Cipolleschi 053f1d9822 Fix dangling surfaces in ReactHostImpl (#44393)
Summary:
Though the `ReactHost.destroy()` is not being used from OSS code, we use it at Expo for expo-dev-client to change loading apps from different dev servers. Without cleanup the `mAttachedSurfaces`, it will have dangling or duplicated attached surfaces that cause duplicated react trees.

<img src="https://github.com/facebook/react-native/assets/46429/f84d274e-aaad-4352-9e3c-6262571a5625">

This PR tries to cleanup the `mAttachedSurfaces` from destroying.

## Changelog:

[ANDROID] [FIXED] - Fixed dangling `mAttachedSurfaces` after `ReactHost.destroy()`

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

Test Plan: have to manually call `ReactHost.destroy()` and recreate the MainActivity without killing the process. then reload the app will startSurface for the same attached surfaces.

Reviewed By: RSNara

Differential Revision: D56901863

Pulled By: javache

fbshipit-source-id: c7f822501d971810ac6aa7262b15da69ec41355e
2024-06-04 10:30:49 +01:00
legobtandRiccardo Cipolleschi 0f44ca644b chore: Increase iOS script portability (#44417)
Summary:
`pod install` and CocoaPods are actually not macOS specific.
Still, the pod lifecycle scripts of `react-native` depend on macOS-only utilities and will fail on Linux.

This is an attempt to make the scripts portable and make the pod install cleanly on Linux as well as macOS.

## Changelog:

    [INTERNAL] [FIXED] - Skip XCode patching when not run on macOS
    [INTERNAL] [FIXED] - Fall back to `which gcc`/`which g++` to identify C/C++ compiler when `xcrun` not available
    [INTERNAL] [FEAT] - Recognize CC and CXX env vars supplied to the script and prefer them over autodetection

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

Reviewed By: NickGerleman

Differential Revision: D57055928

Pulled By: cipolleschi

fbshipit-source-id: 1c49f70c52b4667abf0a215cbee52ee6aa6dd052
2024-06-04 10:30:03 +01:00
1f50fb7816 [0.74] Update eslint-plugin-jest to 27.x, @typescript-eslint deps to 7.x (#44764)
Summary:
This PR updates `typescript-eslint/eslint-plugin` and `typescript-eslint/parser` to `v7` and `eslint-plugin-jest` to `v27`, removing any dependencies on `typescript-eslint` `v6`, allowing projects using `react-native/eslint-config` to safely update to  `typescript-eslint` `v7` without having to worry about duplicate major versions installed

## Changelog:

- [General] [Changed]: Updated `eslint-plugin-jest` to `v27`
- [General] [Changed]: Updated `typescript-eslint` monorepo to `v7`

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

Test Plan: `yarn run lint` executed locally successfully

Reviewed By: robhogan

Differential Revision: D54749676

Pulled By: tdn120

fbshipit-source-id: f6fae92fc95333e28b36a3d2bd8470c8869d38bc

# Conflicts:
#	package.json
#	packages/eslint-config-react-native/package.json
#	yarn.lock

Co-authored-by: Lluís <lluis@skrit.es>
2024-06-04 10:27:56 +01:00
Riccardo Cipolleschi 2e21543017 [LOCAL] Fix prettier 2024-06-03 18:04:41 +01:00
Riccardo Cipolleschi 58f232c6c2 [LOCAL] Bump hermes version 2024-06-03 17:18:09 +01:00
Riccardo Cipolleschi 1e3d2161e8 Merge branch '0.74-stable' of https://github.com/facebook/react-native into 0.74-stable 2024-06-03 16:38:09 +01:00
Szymon RybczakandGitHub 335f6ed833 feat: upgrade CLI to 13.6.8 (#44757) 2024-06-03 15:49:09 +01:00
Renaud ChaputandRiccardo Cipolleschi 752c173da5 Fix Privacy Manifest generator when it does not contain a NSPrivacyAccessedAPITypes key (#44628)
Summary:
XCode privacy files might not contain a `NSPrivacyAccessedAPITypes` key, which causes the following error:

```
[!] An error occurred while processing the post-install hook of the Podfile.

undefined method `each' for nil

node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:111:in `block (4 levels) in get_used_required_reason_apis'
node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:106:in `each'
node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:106:in `block (3 levels) in get_used_required_reason_apis'
```

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

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

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

[IOS] [FIXED] - Privacy Manifest aggregation failing due to no `NSPrivacyAccessedAPITypes` key

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

Test Plan: I tested this patch on our own app and it solved the issue.

Reviewed By: christophpurrer

Differential Revision: D57618425

Pulled By: cipolleschi

fbshipit-source-id: 1a36ab5a1bb45b8507d3663b782c95258d97c8a4
2024-06-03 15:48:28 +01:00
szymonrybczakandRiccardo Cipolleschi 1860441d84 fix: warn only in init command when CLI uses cached npx version (#44644)
Summary:
In https://github.com/facebook/react-native/pull/37510, a check was introduced to check if user is using `latest` version of `npx`, but right now it checks for every command executed, but it should only ensure that `latest` is included when creating a new project.

In this Pull Request I've added a condition to only warn if `init` was fired.

[GENERAL] [FIXED] - Warn only in `init` command when CLI uses cached `npx` version

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

Test Plan: Warning about using `latest` version CLI should only be presented when running `init` command.

Reviewed By: arushikesarwani94

Differential Revision: D57681864

Pulled By: blakef

fbshipit-source-id: 5c81b9a08141396efcd24539b2560cea16028dd9
2024-06-03 15:46:44 +01:00
zhongwuzwandRiccardo Cipolleschi a88a3c5bbf iOS: Fixes textinput onscroll event payload (#43445)
Summary:
Fixes https://github.com/facebook/react-native/issues/43428 . cc cortinico .

## Changelog:

[IOS] [FIXED] - [Fabric] iOS: Fixes textinput onscroll event payload

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

Test Plan:
```
    const onInputScroll = (e) => {
      if (Platform.OS !== "web") {
        const {
          nativeEvent: {
            contentOffset: { x, y },
          },
        } = e;
        console.log('onInputScroll ====', e?.nativeEvent)
      }
    };

<TextInput
          onScroll={onInputScroll}
          // ref={inputRef}
          multiline
  />
```

Reviewed By: cortinico

Differential Revision: D54813378

Pulled By: sammy-SC

fbshipit-source-id: 76671fbb390c2fbc67a9c29b6c2a834ba699fff4
2024-06-03 15:43:32 +01:00
Rui YingandRiccardo Cipolleschi 2375b077ed Handle the case where the file reference doesn't have a path (#44410)
Summary:
The new cocoapod post install script includes aggregation and generation of privacy manifests for iOS, which is great. However, the script doesn't consider the case where the file reference doesn't have a path.

Example, for a project setup like the screenshot:
<img width="249" alt="image" src="https://github.com/facebook/react-native/assets/22592111/45dd1cf4-c2f6-4abb-940f-136a4d502966">

The code
https://github.com/facebook/react-native/blob/05a4232dd591e2d43f192d69ca14a04f4a3fb6a1/packages/react-native/scripts/cocoapods/privacy_manifest_utils.rb#L80-L81

prints `file_refs`:
```
[
<PBXFileReference name=`LaunchScreen.storyboard` path=`learnX/LaunchScreen.storyboard` UUID=`81AB9BB72411601600AC10FF`>,
<PBXVariantGroup name=`InfoPlist.strings` UUID=`D40B9F832B248EF5004BC08C`>,
<PBXFileReference path=`AppCenter-Config.plist` UUID=`D40B9F802B248EC2004BC08C`>,
<PBXFileReference name=`PrivacyInfo.xcprivacy` path=`learnX/PrivacyInfo.xcprivacy` UUID=`D403DD362BCA2BCF00E5295C`>,
<PBXFileReference name=`Assets.xcassets` path=`learnX/Assets.xcassets` UUID=`D40B9F652B248AEB004BC08C`>
]
```

where a `PBXVariantGroup` exists and it doesn't have `path`. The error `undefined method 'end_with?' for nil` occurs as a result.

## Changelog:

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

Pick one each for the category and type tags:

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

[IOS] [FIXED] - In privacy manifest post install script, handle the case where the file reference doesn't have a path

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

Test Plan:
1. Add a new "Strings File (Legacy)" in Xcode to the project.
2. Run `pod install` for iOS.
3. See the error `undefined method 'end_with?' for nil`.
4. Apply the fix and rerun `pod install`.
5. The script runs successfully.

Reviewed By: javache

Differential Revision: D57056159

Pulled By: cipolleschi

fbshipit-source-id: 42caaf1a98efb9111f6ff1014a5c8b7703b042f2
2024-06-03 15:43:25 +01:00
Robin ShinandRiccardo Cipolleschi 156e8cf52b fix: TextInput selectionColor props on iOS (#44420)
Summary:
This pull request fixes an issue where the `selectionColor` prop was not applied to the `TextInput` component on iOS, starting from React Native version 0.74.x.

This issue was introduced in PR [1e68e485](https://github.com/facebook/react-native/commit/1e68e48534aedf1533327bf65f26e5cf5b80127b#diff-b6634353ea5b10a91de24605dc51bdfb50e8ddb652ccd5b9dab194168a69d4b1) which relocated `selectionColor` along with `selectionHandleColor` and `cursorColor` out of `otherProps`. This modification inadvertently prevented `selectionColor` from being passed to the iOS native component.

This change ensures that the `selectionColor` prop is explicitly included in the `RCTTextInputView` component's properties, fixing the regression.

Note: `selectionHandleColor` and `cursorColor` are Android-specific and do not require explicit passing on iOS.

## Changelog:

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

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[IOS] [FIXED] - Fixed an issue where the `selectionColor` prop was not being applied on the `TextInput` component.

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

Test Plan:
**Environment:** iOS Simulator, React Native 0.74.0.

**Steps to reproduce:**

- Implement a `TextInput` component with the `selectionColor` prop set.
- Run the application on an iOS device or simulator.
- Focus on the TextInput component, write some text and select it.

**Expected Result:** the selection color should match the color provided to the `selectionColor` prop.

**Actual result before fix:** the selection color did not reflect the specified `selectionColor` prop and fell back to the default iOS selection color (blue).

**Screenshots:**
- Before fix:
<img width="1710" alt="before_fix" src="https://github.com/facebook/react-native/assets/17989553/8660068c-55c9-4f55-a788-f96eb681fb70">

- After fix:
<img width="1710" alt="after_fix" src="https://github.com/facebook/react-native/assets/17989553/93c9eb26-7da0-4957-b54f-8444aff7e374">

Reviewed By: javache

Differential Revision: D57017836

Pulled By: NickGerleman

fbshipit-source-id: 263ce22168e09c15cdfdb4eb4300a2605d8af032
2024-06-03 15:43:15 +01:00
Alan LeeandRiccardo Cipolleschi fc5e69e06b TextInput - selection prop is not set on component creation (#44398)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44398

**Problem:**
`selection` prop is not being set on component creation.
Not quite sure which RN version this issue was introduced but fixing it on latest code.

Use playground for testing (refer to following diff)

**Proposed Solution:**

Added notes in comments but `viewCommands.setTextAndSelection()` is called only on text or selection update which relies on comparing data with `lastNativeSelection`. Problem is that `lastNativeSelection` is initially set to the props value that is passed in so does not send the command on component creation.

So assign a default selection value of `{start: -1, end: -1}` so it can be set on component creation.

**Changelog:**
[General][Fixed] - `selection` prop in `TextInput` was not being applied at component creation

Reviewed By: cipolleschi

Differential Revision: D56911712

fbshipit-source-id: 7774b246383f85216536040688b0a8ea85b3478a
2024-06-03 15:43:08 +01:00
Arushi KesarwaniandRiccardo Cipolleschi 71153f6c73 Add ReactSoftException in ReactHostImpl only when onActivityResult, onNewIntent and onWindowFocusChange do not have the context (#44155)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44155

Add ReactSoftException in ReactHostImpl only when `onActivityResult`, `onNewIntent`and `onWindowFocusChange` do not have the context

Changelog:
[Android][Fixed] ReactSoftExceptions in ReactHostImpl only when Context is null

Reviewed By: cortinico

Differential Revision: D56325407

fbshipit-source-id: a9f8fd5772fc05d39e72236fb8edfe5f8a9d6a43
2024-06-03 15:42:57 +01:00
Riccardo Cipolleschi 2636eb19d1 Update Podfile.lock
Changelog: [Internal]
2024-05-03 17:31:23 +01:00
Distiller 31f9d45074 Release 0.74.1
#publish-packages-to-npm&latest
2024-05-02 18:17:04 +00:00
Riccardo Cipolleschi 093a2adc07 [LOCAL] Fix privacy manifest aggregator 2024-05-02 19:07:45 +01:00
Nicola Corti a0ed073650 [LOCAL] Fix compilation error on ReactDelegate 2024-05-02 10:59:41 +01:00
Riccardo Cipolleschi ec512a70cb [LOCAL] Bump podfile.lock and update privacy manifest 2024-05-02 10:20:35 +01:00
aleqsioandRiccardo Cipolleschi 4be1fafec8 Implement privacy manifest aggregation (#44214)
Summary:
As of now, Apple does not respect privacy manifests added as cocoapods resource bundles. This forces react-native developers to manually copy `.xcprivacy` files content for each native dependency that accesses restricted reason APIs to the root file.

This PR adds an aggregation step that crawls through pod dependencies to collect all reasons into the root privacy info file.

[IOS][ADDED] – Add privacy manifest aggregation.

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

Test Plan:
When run on RNTester, it appends aggregated entries (while keeping existing ones) to existing .xcprivacy file without modifing .pbxproj:
![image](https://github.com/facebook/react-native/assets/5597580/1d07a07d-bbec-4266-a599-a8d629078971)

When run on RNTester with the xcprivacy file removed from xcode beforehand, it creates a new .xcprivacy file, and adds it to Compile Bundle Resources in the same way as in the new template:
![image](https://github.com/facebook/react-native/assets/5597580/f80a3b4e-e41a-4906-8e2f-06cca0bc225a)

When run on RNTester with an empty .xcprivacy file, it appends aggregated entries from pods AND reasons for react-native core.

When run with `privacy_file_aggregation_enabled: false` in `use_react_native`, it falls back to existing behavior:
![image](https://github.com/facebook/react-native/assets/5597580/4519bba1-c80e-4cd0-b19c-bbbebfa8493b)

Reviewed By: cipolleschi

Differential Revision: D56481045

Pulled By: philIip

fbshipit-source-id: 1841bad821511c734d0cc0fcff5065ed92af76d8
2024-05-02 10:18:43 +01:00
Kudo ChienandRiccardo Cipolleschi 56631cd471 fix ReactActivity.getReactDelegate().reload() (#44223)
Summary:
fixing some problem for `ReactActivity.getReactDelegate().reload()` from https://github.com/facebook/react-native/issues/43521:
- the `reload()` does not work for bridge mode on release build

[ANDROID] [FIXED] - Fixed app reloading for `ReactActivity.getReactDelegate().reload()`.

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

Test Plan:
tried to temporary change toast.show as reload and test from rn-tester
```diff
 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/toast/ToastModule.kt
+++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/toast/ToastModule.kt
@@ -10,6 +10,7 @@ package com.facebook.react.modules.toast
 import android.view.Gravity
 import android.widget.Toast
 import com.facebook.fbreact.specs.NativeToastAndroidSpec
+import com.facebook.react.ReactActivity
 import com.facebook.react.bridge.NativeModule
 import com.facebook.react.bridge.ReactApplicationContext
 import com.facebook.react.bridge.UiThreadUtil
@@ -30,9 +31,11 @@ public class ToastModule(reactContext: ReactApplicationContext) :
       )

   override public fun show(message: String?, durationDouble: Double) {
-    val duration = durationDouble.toInt()
-    UiThreadUtil.runOnUiThread(
-        Runnable { Toast.makeText(getReactApplicationContext(), message, duration).show() })
+//    val duration = durationDouble.toInt()
+//    UiThreadUtil.runOnUiThread(
+//        Runnable { Toast.makeText(getReactApplicationContext(), message, duration).show() })
+    val activity = reactApplicationContext.currentActivity as? ReactActivity
+    activity?.reactDelegate?.reload()
   }

   override public fun showWithGravity(
```

tried for different mode
- [x] bridge mode + debug build
- [x] bridgeless mode + debug build
- [x] bridge mode + release build
- [x] bridgeless mode + release build

Reviewed By: fkgozali

Differential Revision: D56795975

Pulled By: arushikesarwani94

fbshipit-source-id: 895eab1927ba6db748ebb32c0fd5313f19cf9d1b
2024-05-02 10:15:59 +01:00
Pieter De BaetsandRiccardo Cipolleschi cc1c69799e Support more stubbed methods in BridgelessCatalystInstance (#44091)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44091

These can be stubbed easily using existing ReactHostImpl/ReactInstance API's

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D56139806

fbshipit-source-id: cefabe3aa0fb6556f8e296243ff233df07ddffee
2024-05-02 10:14:21 +01:00
58b1f9b2d4 feat: upgrade @react-native-community/cli to 13.6.6 (#44253)
Co-authored-by: Riccardo Cipolleschi <cipolleschi@meta.com>
2024-05-01 18:31:39 +01:00
Riccardo Cipolleschi bb890a308f [LOCAL] Fix prettier and Flow 2024-05-01 18:25:08 +01:00
Riccardo CipolleschiandRiccardo Cipolleschi 8813061286 Honor requiresMainQueueSetup in bridgeless mode for ViewManagers
Summary:
We [received an issue](https://github.com/react-native-maps/react-native-maps/issues/5042) in OSS where a ViewManager was configured to be initialized on the main queue, but it wasn't.
This was creating a soft crash and showing a RedBox to the user.
The library was going through the Interop Layer.

This change makes sure that, if the ViewManager is configured to be setup in the main queue, we retrieve the constants from the Main Queue

## Changelog
[iOS][Fixed] - Extract the constants from ViewManagers in the UI Thread if needed.

Reviewed By: sammy-SC

Differential Revision: D56762253

fbshipit-source-id: ca807b34d6e61418da9fd6a639a05f3394879f7c
2024-05-01 18:15:33 +01:00
Alan LeeandRiccardo Cipolleschi 13739510fb add missing struct member initialization in Props.h (#44294)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44294

**Problem:**

It was discovered while testing 3 party library, generated member variables in a C++ `struct` in `Props.h` is not initialized.
Also `WithDefault` would not work as well.
(For the problematic case it was a `boolean` but would also apply to other primitive types.)

If there is no default initialization and the component prop is optional and the user of the native component does not set the prop then the variable is never initialized and this is problematic for primitive types in C++ where no initialization results in an undefined behavior.

**Proposed solution:**

(Following C++Core Guideline of [always initialize](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-always).)
Reusing `generatePropsString()` used by `ClassTemplate` to generate props for `StructTemplate` as well.
updated relevant test snapshots.
This change is only concerning the `Props.h` file.

**Changelog:**
[General][Fixed] - fixed `Props.h` created from codegen missing default initializers in C++ `struct`

Reviewed By: cipolleschi

Differential Revision: D56659457

fbshipit-source-id: 0d21ad20c0491a7e8bb718cd3156da65def72f23
2024-05-01 18:15:27 +01:00
Riccardo CipolleschiandRiccardo Cipolleschi 59e7ed5038 Avoid calling abstract methods in RCTComposedViewRegistry
Summary:
`RCTComposedViewRegistry` extends `NSMutableDictionary` which is a clustered class in iOS.
NSMutableDictionary is techncially an abstract class, but when instantiated by `[NSMutableDictionary new];` the system will return one of concrete classes that inherit from `NSMutableDictionary`, opaquely from the perspective of the caller.

By calling `super`, we are actually calling the not implemented method for the abstract class. If this happen, this can crash the app.

Given that the `RCTComposedViewRegistry` is extending the dictionary only for its interface but is using other mechanisms as storage, is it fair to return `NULL`if the storages don't have the requested view.

## Changelog
[iOS][Fixed] -  Avoid calling abstract methods in RCTComposedViewRegistry

Reviewed By: cortinico

Differential Revision: D56755427

fbshipit-source-id: f5c56dc59ccc6b30c00199b4196c42eb9b021e2b
2024-05-01 18:15:21 +01:00
Samuel SuslaandRiccardo Cipolleschi 305249f964 maintain correct content offset when scroll view is suspended (#44256)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44256

[iOS] [Fixed] - Preserve content offset in ScrollView when the component is suspended

On iOS, components are recycled. For ScrollView, its content offset has to be reset back to original position. When we call `[UIScrollView setContentOffset:]`, it triggers all of its delegate methods and triggers `scrollViewDidScroll` where we set native state.

So when user scrolls to position 100 and scroll view suspends. it is removed from view hierarchy and recycled. Once the suspense boundary is resolved, scroll view will be inserted back into view hierarchy. But when it was recycled, we set back its original content offset (the default is 0, 0) but this was accidentally propagated through to shadow tree.

To avoid this, we simply need to invalidate `_state` before calling `[UIScrollView setContentOffset:]`.

Reviewed By: cipolleschi

Differential Revision: D56573370

fbshipit-source-id: c03d7d2d403af2e1649b4cf189072baeb4c286c8
2024-05-01 18:15:01 +01:00
Riccardo CipolleschiandRiccardo Cipolleschi 3467f2f3a3 Fix enable hermes debugger in Bridgeless mode
Summary:
Set the proper build flags for debugging in Bridgeless mode.

This fixes [#44240](https://github.com/facebook/react-native/issues/44240)

## Changelog:
[iOS][Fixed] - Add `HERMES_ENABLE_DEBUGGER=1` flag to React-RuntimeApple

Reviewed By: cortinico

Differential Revision: D56575647

fbshipit-source-id: a0613a5d46caeb1d3e636e54ecd43428fbaf46e8
2024-05-01 18:14:12 +01:00
Kudo ChienandRiccardo Cipolleschi 10fc2af13e Defines module for React-jsinspector (#44252)
Summary:
Defines module for `React-jsinspector` that for swift modules to integrate with.

to fix https://github.com/expo/expo/issues/28209, any podspec depends on HermesExecutorFactory should use ` add_dependency(s, "React-jsinspector", :framework_name => 'jsinspector_modern')` to add dependency. otherwise it will encounter the header not found issue because use_frameworks will change "jsinspector-modern" to "jsinspector_modern".

to depend on React-jsinspector from expo-modules-core, we need it to define as a module.
otherwise, it will have the error
```
The Swift pod `ExpoModulesCore` depends upon `React-jsinspector`, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.
```

## Changelog:

[IOS] [CHANGED] - Add `DEFINES_MODULE` for React-jsinspector.podspec

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

Test Plan: ci passed

Reviewed By: cortinico

Differential Revision: D56575102

Pulled By: cipolleschi

fbshipit-source-id: 9b7b4568a3e499f0a741a79a846263118ff2d112
2024-05-01 18:14:07 +01:00
Riccardo CipolleschiandRiccardo Cipolleschi eaaf865449 Fallback to the first foregroundInactive window when there are no foregroundActive windows in RCTKeyWindow (#44167)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44167

We received an issue for OSS where, when the main window is inactive and the system tries to present a dialog, the dialog is not presented in the right position on the screen.

This change introduce a fallback to the first inactive window (which is still visible on screen) and it fixes the issues.

[iOS][Changed] - Fallback to the first `foregroundInactive` window when there are no `foregroundActive` windows in RCTKeyWindow

Reviewed By: dmytrorykun

Differential Revision: D56354741

fbshipit-source-id: fa23131ecd40f6d91c705879a72890506ee21486
2024-05-01 18:13:57 +01:00
Arushi KesarwaniandRiccardo Cipolleschi 7a841dbcd1 Fixing exposing ReactDelegate through ReactActivity for reload() (#44227)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44227

In https://github.com/facebook/react-native/pull/44223/ kudo identified the incorrect return type.

Reviewed By: christophpurrer, philIip

Differential Revision: D56497700

fbshipit-source-id: 5d7fc7ef21c3d3033a2567eba51b613eb41f0a1a
2024-05-01 18:12:08 +01:00
Samuel SuslaandRiccardo Cipolleschi 165cabb21f reset animation state in TouchableOpacity and TouchableBounce (#44182)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44182

## Changelog:

[iOS] [Fixed] - Fixed stale state on TouchableOpacity and TouchableBounce

When TouchableOpacity and TouchableBounce are unmounted, we need to reset their state. This includes animation state. If we don't do that, view is unmounted on the mounting layer and animation will not be applied. This leaves view in undefined state. In TouchableOpacity, it is view with reduced opacity. TouchableBounce that is view with applied transform.

This was reported in https://github.com/facebook/react-native/issues/44044

Reviewed By: rubennorte, cipolleschi

Differential Revision: D56416571

fbshipit-source-id: 01214ec8a5e07c80a609e082b955a30305ad8396
2024-05-01 18:09:08 +01:00
Riccardo CipolleschiandRiccardo Cipolleschi 0a4d97362f Fix Symbol not found: (_JSGlobalContextSetInspectable) (#44185)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44185

This change will fix a symbol not found for JSC Runtime.

The `if` check was not a compile time check, therefore the symbol ended up in the binary even if it is not available.

Following this post on [Apple forum](https://forums.developer.apple.com/forums/thread/749534), this changes should do the trick.

## Changelog
[iOS][Fixed] - Fix Symbol not found: (_JSGlobalContextSetInspectable)

Reviewed By: hash3r

Differential Revision: D56425834

fbshipit-source-id: a37af51b078bd47a938e6b65d9d8e0f7506e746f
2024-05-01 18:09:02 +01:00
Samuel SuslaandRiccardo Cipolleschi 0a4cf4945c only trigger RCTContentDidAppearNotification when content appears (#43823)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43823

changelog: [internal]

Notification RCTContentDidAppearNotification was posted too early in RCTSurfaceHostingProxyRootView, which does not know when views are mounted.
It was also posted if no views were mounted, leading to inconsistent behaviour between Paper and Fabric.

The implementation is aligned with Paper: https://github.com/facebook/react-native/blob/main/packages/react-native/React/Base/RCTRootContentView.m#L45-L55

Reviewed By: cipolleschi

Differential Revision: D55640654

fbshipit-source-id: 2d7bc5afb6ba1c1e8db529ee11eac2bae2d936d6
2024-05-01 18:07:12 +01:00
Marc RousavyandRiccardo Cipolleschi a14df93b15 Allow ReactCommon/Folly to be used in Swift libraries (DEFINES_MODULE) (#43327)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43327

<!-- Thanks for submitting a pull request! We appreciate you spending the time to work on these changes. Please provide enough information so that others can review your pull request. The three fields below are mandatory. -->

## Summary

Swift Pods require the use of [modular headers](https://blog.cocoapods.org/CocoaPods-1.5.0/) to be statically linked. To interop with Objective-C modules, you need to make the Objective-C module "define a Module", that is modular header export.

This is already the case for a few podspecs so they can be consumed in Swift libraries, but `ReactCommon` and `RCT-Folly` don't do this yet and therefore this breaks in a few libraries of mine, for example see this issue: https://github.com/mrousavy/react-native-vision-camera/issues/195.

If I were to include `ReactCommon` or `RCT-Folly` in my Swift library's podspec, the following error arises:

```
[!] The following Swift pods cannot yet be integrated as static libraries:

The Swift pod `VisionCamera` depends upon `RCT-Folly`, which does not define modules.
To opt into those targets generating module maps (which is necessary to import them from Swift
when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or
specify `:modular_headers => true` for particular dependencies.
```

So this PR fixes this issue by allowing Swift libraries to consume the `ReactCommon` and `RCT-Folly` podspecs since they now export modular headers.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[General] [Fixed] - Expose Modular Headers for `ReactCommon` podspec
[General] [Fixed] - Expose Modular Headers for `RCT-Folly` podspec

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

Test Plan: * Add s.dependency "ReactCommon" or RCT-Folly to a Swift pod and see what happens. (See https://github.com/mrousavy/react-native-vision-camera/pull/273)

Reviewed By: dmytrorykun

Differential Revision: D54539127

Pulled By: cipolleschi

fbshipit-source-id: 2291cc0c8d6675521b220b02ef0c3c6a3e73be38
2024-05-01 18:07:07 +01:00
Riccardo CipolleschiandRiccardo Cipolleschi df6bec5427 Optimize RCTUIManager to avoid too many calls to viewForReactTag
Summary:
This change fixes a couple of issues within the RCTUIManager:
* it calls the right method in the `super` branches (although they should neve be executed)
* it invert the call order between the `_registry` and the `uiManager` to avoid extra calls into the `viewForReactTag`.

## Changelog:
[Internal] - Use the right method in super and invert the order of where we search for views.

## Facebook:
See S397861 and T180527210 for more information.

Reviewed By: javache

Differential Revision: D54246220

fbshipit-source-id: 1c7503ad3e80cf50ecc016a984ca180a19b73cc0
2024-05-01 18:07:02 +01:00
Distiller 60962b4406 Release 0.74.1-rc.0
#publish-packages-to-npm&--no-tag
2024-05-01 12:34:20 +00:00
Riccardo Cipolleschi 649f4a0d3e [LOCAL] Update trigger-release to support patch prereleases 2024-05-01 13:26:27 +01:00
Riccardo CipolleschiandRiccardo Cipolleschi d7d42673a5 Add support for patch rc versions
Summary:
We might want to publish some new versions of React Native with experimental feature to allow some partners to test whether those versions fixes some reported issues, before creating a proper stable version for the whole ecosystem.

The infra is mostly [setup for this](https://www.internalfb.com/code/fbsource/[496a64d180faab501b8598aa0ec26d47454fb961]/xplat/js/react-native-github/scripts/releases/utils/version-utils.js?lines=149), already. The only detail we need to take care of is not to move the `next` tag.

[Internal]

Reviewed By: cortinico, huntie

Differential Revision: D56578456

fbshipit-source-id: 8dcc674aab5f85077c1b3e6580c5aeb99226eff8
2024-05-01 13:23:08 +01:00
Alex Hunt 3ef4cc9a2f [LOCAL] Add missing chrome-launcher typedef 2024-05-01 10:57:23 +01:00
Riccardo Cipolleschi 462915d89a [LOCAL] Remove duplicated feature flag and fix iOS build 2024-04-30 20:15:58 +01:00
Nicola Corti edd1b0a13b [LOCAL] Fix compilation error on DefaultNewArchitectureEntryPoint 2024-04-30 18:09:12 +01:00
Riccardo Cipolleschi ecd5e51a53 [Local] Remove duplicated feature flags 2024-04-30 17:58:40 +01:00
Riccardo Cipolleschi 1ba79ebb6f [react-native] enable event loop with useLayoutEffect fix 2024-04-30 15:44:06 +01:00
Riccardo Cipolleschi df54c24d8d [LOCAL] Fix merge conflicts not resolved properly 2024-04-30 15:39:15 +01:00
Pieter De BaetsandRiccardo Cipolleschi ff4b20e823 Split scheduler commit and flush delegate methods (#44188)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44188

The current approach used for `batchRenderingUpdatesInEventLoop` is not compatible with Android due to limitations in its props processing model. The raw props changeset is passed through to Android, and must be available for the Android mounting layer to correctly apply changes.

We have some logic to merge these payloads when multiple ShadowNode clones take place but were previously assuming that a ShadowTree commit was a safe state to synchronize.

In the current implementation this means that two commits driven from layout effects (triggering states A → B → C) may cause Android to observe only the B → C props change, and miss out on any props changed in A → B.

Changelog: [Android][Fixed] Cascading renders were not mounting correctly when `batchRenderingUpdatesInEventLoop` is enabled.

Reviewed By: rubennorte

Differential Revision: D56414689

fbshipit-source-id: 7c74d81620db0f8b7bd67e640168afc795c7a1d7
2024-04-30 15:27:00 +01:00
Rubén NorteandRiccardo Cipolleschi b440672468 Enable event loop by default when bridgeless is enabled (#43396)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43396

Changelog: [General][Changed] Enabled new event loop behavior when bridgeless (new architecture) is enabled.

Reviewed By: rshest

Differential Revision: D54682678

fbshipit-source-id: ff8c45bc1caae0e9182aa94d915d7b6f9427caf9
2024-04-30 15:20:25 +01:00
Alex HuntandAlex Hunt 261a58761c Update "Open Debugger" to print extended Flipper guidance
Summary:
Supports the removal of Flipper from the template in 0.74, paried with additional blog post messaging: https://reactnative.dev/blog/2024/04/22/release-0.74#removal-of-flipper-react-native-plugin.

Changelog:
[General][Changed] - Update "Open Debugger" action to print extended Flipper guidance

Reviewed By: cipolleschi

Differential Revision: D56705236

fbshipit-source-id: d7e869625262ebb02bc2454c924f832cccfbcd31
2024-04-30 14:07:05 +01:00
Alex Hunt 680d89b6c5 Update Hermes version
For pick request https://github.com/reactwg/react-native-releases/issues/241
2024-04-25 12:05:58 +01:00
Moti ZilbermanandAlex Hunt 93956e267c Align debugger Chrome launch flags with Meta-internal version (#44180)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44180

Changelog: [General][Changed] Update Chrome launch flags for `--experimental-debugger` launch flow

Internally at Meta, we've been testing the experimental debugger launch flow with a different set of Chrome flags than are currently shipped in open source. This diff fixes those differences:

* Removes `--disable-backgrounding-occluded-windows`
* Adds `--guest`

Reviewed By: EdmondChuiHW

Differential Revision: D56418271

fbshipit-source-id: 884c5746e93cad89f17e4ef9e3ef193a2a454eb5
2024-04-25 11:45:48 +01:00
Alex Hunt a69dc5d2a6 Update Podfile.lock
Changelog: [Internal]
2024-04-25 11:45:38 +01:00
Distiller 972b42016e Release 0.74.0
#publish-packages-to-npm&latest
2024-04-22 11:41:17 +00:00
Alex Hunt 5d1272f9cd Update Podfile.lock
Changelog: [Internal]
2024-04-22 11:44:22 +01:00
Distiller d4a48ce692 Release 0.74.0-rc.9
#publish-packages-to-npm&next
2024-04-15 14:02:09 +00:00
Riccardo Cipolleschi 2b18fdf806 [LOCAL][iOS] Fix RNTester project and remove CCACHE from project when disabled 2024-04-15 12:15:37 +01:00
Phillip PanandAlex Hunt 92c6d22f3c add privacy manifest to pod install
Summary:
Changelog: [iOS][Added]

this creates the RN privacy manifest in the ios build step if user has not created one yet. the reasons have been added for the following APIs:

NSPrivacyAccessedAPICategoryFileTimestamp
- C617.1: We use fstat and stat in a few places in the C++ layer. We use these to read information about the JavaScript files in RN.

NSPrivacyAccessedAPICategoryUserDefaults
- CA92.1: We access NSUserDefaults in a few places.
1) To store RTL preferences
2) As part of caching server URLs for developer mode
3) A generic native module that wraps NSUserDefaults

NSPrivacyAccessedAPICategorySystemBootTime
- 35F9.1: Best guess reason from RR API pulled in by boost

Reviewed By: cipolleschi

Differential Revision: D53687232

fbshipit-source-id: 6dffb1a6013f8f29438a49752e47ed75c13f4a5c

# Conflicts:
#	packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj
2024-04-15 11:30:01 +02:00
Riccardo CipolleschiandAlex Hunt bb5451b425 Fix Open Debugger dev menu item missing from iOS Bridgeless
Summary:
After a [recent change](https://github.com/facebook/react-native/commit/90296be1d4fab09a52e02dd09f34f819136d0a07) we break part of the integration with the debug menu, which is was using the presence/absence of the bridge to decide whether we were in bridge or bridgeless.

For backward compatibility reasosn, the bridge ivar is now populated with the bridgeProxy, so just checking whether is nil or not is not enough to verify whether we are in bridge or in bridgeless mode anymore.

## Changelog:
[iOS][Fixed] - Make sure that the Open Debugger appears in bridgeless mode

Reviewed By: fkgozali

Differential Revision: D56067897

fbshipit-source-id: e2501ed730ff35bc755c24ef400130c551032e28
2024-04-15 11:22:11 +02:00
zhongwuzwandAlex Hunt 0b3ebdfb22 Change bridgeless check in dev menu (#43976)
Summary:
We would set the value of  _bridge ivar to bridgeProxy for turbo module in bridgeless mode in https://github.com/facebook/react-native/issues/43757 , so we need to change the way of bridgeless/bridge check.

## Changelog:

[IOS] [FIXED] - Change bridgeless check in dev menu

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

Test Plan: Dev menu shows bridgeless/bridge mode correctly.

Reviewed By: christophpurrer

Differential Revision: D56056640

Pulled By: cipolleschi

fbshipit-source-id: 1358c3027c1d5f12c70dd4486cc1d5975c7a185a
2024-04-15 11:22:04 +02:00
Arushi KesarwaniandAlex Hunt 26854de04b Implement getJavaScriptContextHolder for BridgelessCatalystInstance (#44054)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44054

Implement `getJavaScriptContextHolder()` for BridgelessCatalystInstance

Changelog:
[Android][Breaking] Implement `getJavaScriptContextHolder()` for Bridgeless Catalyst Instance

Reviewed By: christophpurrer

Differential Revision: D56046452

fbshipit-source-id: b7fed1da3064608d8ef5fa84f4e53a4f7a84cba7
2024-04-15 11:21:13 +02:00
Arushi KesarwaniandAlex Hunt e7131fadca Implement getRuntimeExecutor for BridgelessCatalystInstance (#44053)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44053

Implement `getRuntimeExecutor()` for BridgelessCatalystInstance

Changelog:
[Android][Breaking] Implement `getRuntimeExecutor()` for Bridgeless Catalyst Instance

Reviewed By: christophpurrer

Differential Revision: D56046398

fbshipit-source-id: b9f947cf6f83ce7c1d334558a11b76fccab45dbd
2024-04-15 11:21:07 +02:00
Nicola Corti 012a95cf56 Update Podfile.lock
Changelog: [Internal]
2024-04-10 15:45:31 +01:00
Distiller 2a6e156054 Release 0.74.0-rc.8
#publish-packages-to-npm&next
2024-04-10 13:06:30 +00:00
cb2d93ea50 [RN][iOS] Cherry Pick #43757 and #43994 (#44007)
* Support launchOptions in bridgeless mode (#43757)

Summary:
Support launchOptions in bridgeless mode
bypass-github-export-checks

[IOS] [FIXED] - Support launchOptions in bridgeless mode

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

Test Plan:
```
useEffect(() => {
    const processInitialURL = async () => {
      const url = await Linking.getInitialURL();
      if (url !== null) {
        console.log(`Initial url is: ${url}`);
      }
    };

    processInitialURL();
  }, []);
```

Reviewed By: javache

Differential Revision: D55790758

Pulled By: cipolleschi

fbshipit-source-id: 0f6aa6bdcebfc5bc42d632bea9193f122c1eb84f

* Fix Connect to Metro after Reload in Bridgeless mode (#43994)

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

We received [this issue](https://github.com/facebook/react-native/issues/43764) from OSS where an app can't connect to Metro on reloads in the following scenario:

* Start the App when metro does not run.
* Observe the error screen
* Start Metro
* Press Reload
* Observe the error message again

While the desired behavior should be to connect to Metro now that this is running.

The root cause of the problem is that the RCTHost is initialized with a value of the `bundleURL` that is `nil`. Upon reload, the RCTHost is **not** recreated: the instance is restarted, but with the previous `bundleURL`, which is still `nil`.

The solution is to initialize the `RCTHost` with a closure that re-evaluate the `bundleURL` whenever it is invoked and to evaluate it only on `start`, to keep the initialization path light.
This way, when the app is started with Metro not running, the `bundleURL` is `nil`. But when it is reloaded with Metro starting, the `bundleURL` is properly initialized.

Note that the changes in this diff are not breaking as I reimplemented (and deprecated) the old initializer so that they should work in the same way.

[iOS][Fixed] - Let RCTHost be initialized with a function to provide the `bundleURL` so that it can connect to metro on Reload when the url changes.

Reviewed By: dmytrorykun

Differential Revision: D55916135

fbshipit-source-id: 6927b2154870245f28f42d26bd0209b28c9518f2

* Fix badly resolved merge  conflicts

---------

Co-authored-by: zhongwuzw <zhongwuzw@qq.com>
2024-04-10 11:01:24 +01:00
Phillip PanandNicola Corti 2d84d83534 add privacy manifest to hello world template
Summary:
Changelog: [iOS][Added]

this change will be included in the RN CLI. so all new apps running the RN CLI to get created will get this manifest. the reasons have been added for the following APIs:

NSPrivacyAccessedAPICategoryFileTimestamp
- C617.1: We use fstat and stat in a few places in the C++ layer. We use these to read information about the JavaScript files in RN.

NSPrivacyAccessedAPICategoryUserDefaults
- CA92.1: We access NSUserDefaults in a few places.
1) To store RTL preferences
2) As part of caching server URLs for developer mode
3) A generic native module that wraps NSUserDefaults

NSPrivacyAccessedAPICategorySystemBootTime
- 35F9.1: Best guess reason from RR API pulled in by boost

Reviewed By: cipolleschi

Differential Revision: D53682756

fbshipit-source-id: 0426fe0002a3bc8b45ef24053ac4228c9f61eb85
2024-04-10 08:34:48 +01:00
Nicola Corti 03d526f4d5 Fix bridge mode by constructing ReactDelegate correctly. (#43999)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43999

Currently NewArch-BridgeMode is partially broken when creating views via `ReactDelegate`.
That's because we're using the ctor that doesn't account for `Boolean: fabricEnabled`.

That means that the `RootView` that it will be created are all having setIsFabric(FALSE).
This is causing problems like whitescreens on several reload + multiple warnings such as:
```
                         E  com.facebook.react.bridge.ReactNoCrashSoftException: Cannot get UIManager because the context doesn't contain an active CatalystInstance.
```

Fixes #43692

See for more context on this issues: https://github.com/facebook/react-native/issues/43692

Changelog:
[Android] [Fixed] - Fix bridge mode by constructing ReactDelegate correctly

Reviewed By: cipolleschi

Differential Revision: D55921078

fbshipit-source-id: 2c21d089a49538402d546177bcdb26c8d7d5fbc1
2024-04-09 18:27:53 +01:00
Riccardo CipolleschiandNicola Corti 4eb0534513 Fix Orientation listener in bridgeless mode (#43971)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43971

It turns out that we forgot to add a listener for the orientation change event in Bridgeless.

We used to have `UIApplicationDidChangeStatusBarOrientationNotification` but this is slightly unreliable because there might be use cases where the status bar has been hidden and, therefore, the event is not triggered.

This should fix an issue reported by OSS.

## Changelog:
[iOS][Fixed] - Make sure that the New Architecture listens to orientation change events.

Reviewed By: cortinico

Differential Revision: D55871599

fbshipit-source-id: c9b0634ec2126aa7a6488c2c56c87a9610fa1adf
2024-04-09 18:26:52 +01:00
Riccardo CipolleschiandNicola Corti c2317bf9a5 Fix double metro banner in Bridgeless (#43967)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43967

Following up https://github.com/facebook/react-native/issues/43943, the metro loading banner is presented twice in Bridgeless mode.

This happens because both the RCTInstance and the RCTHost are listening to the Reload Command and issuing the instructions to refetch the JSBundle and to present the banner.

The RCTInstance should not concern itself with lifecycle events, owned by the RCTHost.

## Changelog:
[iOS][Fixed] - Avoid to show Metro Loading banner twice.

Reviewed By: cortinico

Differential Revision: D55870640

fbshipit-source-id: addb67d3226f7d7db20736309172a42fc15f3aa3
2024-04-09 18:26:41 +01:00
Evert EtiandNicola Corti 85170c9442 Fix possible deadlock in dispatchViewUpdates (#43643)
Summary:
In https://github.com/th3rdwave/react-native-safe-area-context/issues/448 it was noticed that from 0.72 (https://github.com/facebook/react-native/commit/bc766ec7f8b18ddc0ff72a2fff5783eeeff24857 https://github.com/facebook/react-native/pull/35889) it was possible to get a deadlock in dispatchViewUpdates. ([More details](https://github.com/th3rdwave/react-native-safe-area-context/issues/448#issuecomment-1871155936))

This deadlock resulted in a laggy experience for all users using https://github.com/th3rdwave/react-native-safe-area-context/ on Android.

To avoid this problem, the author of the original fix [proposed](https://github.com/th3rdwave/react-native-safe-area-context/issues/448#issuecomment-1872121172) this solution which was tested by Discord and many other users.

It would be great to have this backported to 0.72 and 0.73 because of the large userbase using react-native-safe-area-context since it's recommended by expo and react-navigation.

## Changelog:

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

Pick one each for the category and type tags:

[ANDROID] [FIXED] - Fixed possible deadlock in dispatchViewUpdates

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

[ANDROID] [FIXED] - Fixed possible deadlock in dispatchViewUpdates

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

Test Plan:
The original memory leak remains fixed, and can be verified in https://github.com/feiyin0719/RNMemoryLeakAndroid.

To verify the deadlock is gone, every app using https://github.com/th3rdwave/react-native-safe-area-context will work smoothly and not log any excessive `Timed out waiting for layout`
(https://github.com/17Amir17/SafeAreaContext)

Reviewed By: arushikesarwani94

Differential Revision: D55339059

Pulled By: zeyap

fbshipit-source-id: c067997364fbec734510ce99b9994e89d044384a
2024-04-09 18:25:03 +01:00
Nicola Corti cbfa0a2055 Update Podfile.lock
Changelog: [Internal]
2024-04-08 14:56:24 +01:00
Distiller 40feba6a81 Release 0.74.0-rc.7
#publish-packages-to-npm&next
2024-04-08 12:21:14 +00:00
zhongwuzwandNicola Corti 44159e35ce Remove invalidate observer instead of re-adding observer in DeviceInfo module (#43737)
Summary:
Previous fix brings in https://github.com/facebook/react-native/pull/42396. Seems it's a mistake to re-add observer?
So let's remove it and also not `invalidate` method not be called twice.

## Changelog:

[IOS] [FIXED] - Remove invalidate observer instead of re-adding observer in DeviceInfo module

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

Test Plan: Fix for https://github.com/facebook/react-native/issues/42120 also works.

Reviewed By: javache

Differential Revision: D55692219

Pulled By: cipolleschi

fbshipit-source-id: dba1ddc39a9f2611fc2b84fadf8c23827891379a
2024-04-08 07:52:09 +01:00
Riccardo CipolleschiandNicola Corti 42eebafb81 Fix static linking for Bridgeless mode (#43846)
Summary:
Working with gabrieldonadel, we realized that static frameworks of the React-RendererRuntime are not following the proper folder structure.
When a user tries to import `ReactCommon/RCTHost` in the app delegate, for example, the user ends up with an error and they can't find the files.

These changes fixes this by establishing the right folder structure in the static frameworks

## Changelog:
[Internal] - Make sure that React-RuntimeCore and JSErrorHandler are created with the proper structure for static frameworks

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

Test Plan:
Tested locally on an app with 0.74.
Before: it failed to build.
After: it build successfully.

Reviewed By: cortinico

Differential Revision: D55741581

Pulled By: cipolleschi

fbshipit-source-id: 11ac0882d3feea05ef8904d55856ba5704b7a3b8
2024-04-08 07:51:47 +01:00
Riccardo CipolleschiandNicola Corti 4e9196d433 Fix RCTRCTComposedViewRegistry for Old Arch by adding count and keyEnumerator (#43850)
Summary:
In the Old Architecture and for Swift Libraries, these two methods are used to initialize a new disctionary but their implementation was missing so some libraries like lottie were failig to build.

## Changelog:
[Internal] - Implement missing `count` and `keyEnumerator` methods for RCTComposedViewRegistry

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

Test Plan: Tested locally with the repro provided by SWM

Reviewed By: javache

Differential Revision: D55743648

Pulled By: cipolleschi

fbshipit-source-id: 7bdb92625341cd704b8b09920ab3223a2ca61a54
2024-04-08 07:51:09 +01:00
Vojtech NovakandNicola Corti 57ed1bde01 fix: add missing fields to native errors in new arch (#43649)
Summary:
With 0.74.rc-5 one bug which related to errors was fixed (https://github.com/facebook/react-native/issues/41950). However, the fix introduced another one: the shape of Error objects that come from native modules has changed. This PR attempts to fix that, though it's not (yet) doing it in a way that would be 100% compatible with the old arch.

The problem was observed on iOS, not sure what the situation is on Android but believe it's okay there.

edit: on Android, there are no issues but the `message` field is enumerable, so that part is different from ios (see logs below).

Consider this code, where `error` is produced from a promise rejection inside of a native module.

```ts
  console.log(
    'own properties: ',
    JSON.stringify(Object.getOwnPropertyNames(error), null, 2),
  );
  console.log(
    'own enumerable properties: ',
    JSON.stringify(Object.entries(error), null, 2),
  );
```

These are the results for

<details>
  <summary>Old architecture</summary>

```
 LOG  Running "google-one-tap-example" with {"rootTag":1,"initialProps":{}}
 LOG  own properties:  [
  "stack",
  "code",
  "message",
  "domain",
  "userInfo",
  "nativeStackIOS"
]
 LOG  own enumerable properties:  [
  [
    "code",
    "-5"
  ],
  [
    "message",
    "RNGoogleSignIn: The user canceled the sign in request., Error Domain=com.google.GIDSignIn Code=-5 \"The user canceled the sign-in flow.\" UserInfo={NSLocalizedDescription=The user canceled the sign-in flow.}"
  ],
  [
    "domain",
    "com.google.GIDSignIn"
  ],
  [
    "userInfo",
    {
      "NSLocalizedDescription": "The user canceled the sign-in flow."
    }
  ],
  [
    "nativeStackIOS",
    [
      "0   ReactTestApp                        0x0000000102f4a6d8 RCTJSErrorFromCodeMessageAndNSError + 112",
      "1   ReactTestApp                        0x0000000102eeedd0 __41-[RCTModuleMethod processMethodSignature]_block_invoke_2.73 + 152",
      "2   ReactTestApp                        0x0000000102e2ae24 +[RNGoogleSignin rejectWithSigninError:withRejector:] + 548",
      "3   ReactTestApp                        0x0000000102e2aa8c -[RNGoogleSignin handleCompletion:serverAuthCode:withError:withResolver:withRejector:fromCallsite:] + 184",
      "4   ReactTestApp                        0x0000000102e2a8e0 -[RNGoogleSignin handleCompletion:withError:withResolver:withRejector:fromCallsite:] + 236",
      "5   ReactTestApp                        0x0000000102e28628 __40-[RNGoogleSignin signIn:resolve:reject:]_block_invoke_2 + 100",
      "6   ReactTestApp                        0x0000000102dc9d80 __35-[GIDSignIn addCompletionCallback:]_block_invoke_2 + 132",
...
    ]
  ]
]
```
</details>

<details>
  <summary>RN 74 rc-5 (with bridgeless on)</summary>

```
  (NOBRIDGE) LOG  Bridgeless mode is enabled
 (NOBRIDGE) LOG  Running "google-one-tap-example" with {"rootTag":1,"initialProps":{"concurrentRoot":true},"fabric":true}
 (NOBRIDGE) LOG  own properties:  [
  "stack",
  "message",
  "cause"
]
 (NOBRIDGE) LOG  own enumerable properties:  [
  [
    "cause",
    {
      "code": "-5",
      "message": "RNGoogleSignIn: The user canceled the sign in request., Error Domain=com.google.GIDSignIn Code=-5 \"The user canceled the sign-in flow.\" UserInfo={NSLocalizedDescription=The user canceled the sign-in flow.}",
      "nativeStackIOS": [
        "0   ReactTestApp                        0x00000001023a7b38 RCTJSErrorFromCodeMessageAndNSError + 112",
        "1   ReactTestApp                        0x00000001026cf774 ___ZZN8facebook5react15ObjCTurboModule13createPromiseERNS_3jsi7RuntimeENSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEU13block_pointerFvU13block_pointerFvP11objc_objectEU13block_pointerFvP8NSStringSH_P7NSErrorEEENK3$_0clES4_RKNS2_5ValueEPSQ_m_block_invoke.57 + 332",
        "2   ReactTestApp                        0x0000000102270958 +[RNGoogleSignin rejectWithSigninError:withRejector:] + 548",
        "3   ReactTestApp                        0x00000001022705c0 -[RNGoogleSignin handleCompletion:serverAuthCode:withError:withResolver:withRejector:fromCallsite:] + 184",
        "4   ReactTestApp                        0x0000000102270414 -[RNGoogleSignin handleCompletion:withError:withResolver:withRejector:fromCallsite:] + 236",
        "5   ReactTestApp                        0x000000010226e15c __40-[RNGoogleSignin signIn:resolve:reject:]_block_invoke_2 + 100",
        "6   ReactTestApp                        0x000000010220f328 __35-[GIDSignIn addCompletionCallback:]_block_invoke_2 + 132",
...
      ],
      "domain": "com.google.GIDSignIn",
      "userInfo": {
        "NSLocalizedDescription": "The user canceled the sign-in flow."
      }
    }
  ]
]
```
</details>

<details>
  <summary>with the diff from this PR</summary>

```
 (NOBRIDGE) LOG  own properties:  [
  "stack",
  "message",
  "code",
  "nativeStackIOS",
  "domain",
  "userInfo"
]
 (NOBRIDGE) LOG  own enumerable properties:  [
  [
    "code",
    "-5"
  ],
  [
    "nativeStackIOS",
    [
      "0   ReactTestApp                        0x000000010083b8f8 RCTJSErrorFromCodeMessageAndNSError + 112",
      "1   ReactTestApp                        0x0000000100b63534 ___ZZN8facebook5react15ObjCTurboModule13createPromiseERNS_3jsi7RuntimeENSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEU13block_pointerFvU13block_pointerFvP11objc_objectEU13block_pointerFvP8NSStringSH_P7NSErrorEEENK3$_0clES4_RKNS2_5ValueEPSQ_m_block_invoke.57 + 332",
      "2   ReactTestApp                        0x0000000100704718 +[RNGoogleSignin rejectWithSigninError:withRejector:] + 548",
      "3   ReactTestApp                        0x0000000100704380 -[RNGoogleSignin handleCompletion:serverAuthCode:withError:withResolver:withRejector:fromCallsite:] + 184",
      "4   ReactTestApp                        0x00000001007041d4 -[RNGoogleSignin handleCompletion:withError:withResolver:withRejector:fromCallsite:] + 236",
      "5   ReactTestApp                        0x0000000100701f1c __40-[RNGoogleSignin signIn:resolve:reject:]_block_invoke_2 + 100",
      "6   ReactTestApp                        0x00000001006a30e8 __35-[GIDSignIn addCompletionCallback:]_block_invoke_2 + 132",
...
    ]
  ],
  [
    "domain",
    "com.google.GIDSignIn"
  ],
  [
    "userInfo",
    {
      "NSLocalizedDescription": "The user canceled the sign-in flow."
    }
  ]
]

```
</details>

You see there is a change compared to old arch because `message` is no longer own enumerable property. If that needs to change (I guess it should), it'd be nice if someone more familiar with JSI pointed me in the right direction. Even with this inconsistency, the PR is an improvement and would be nice to have this fix included in the next RC.

This is output from Chrome's console for completeness, just to have something to compare to:

```
let err = new Error('hello')
undefined
Object.getOwnPropertyNames(err)
> ['stack', 'message']
Object.entries(err)
> []
```

bypass-github-export-checks

## Changelog:

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

Pick one each for the category and type tags:

[IOS] [FIXED] - add missing fields to native errors in new arch

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

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

Test Plan: Tested locally with an example app running RN 74-rc 5

Reviewed By: cortinico

Differential Revision: D55690184

Pulled By: cipolleschi

fbshipit-source-id: 60a857b9871af888dcd526782b5e6b73c07c051a
2024-04-08 07:50:19 +01:00
Jean-Baptiste LARRIVIEREandNicola Corti 454e576b5b fix: build settings for custom build configuration (#43780)
Summary:
This allows build configuration named like `StagingDebug` to match with settings applied to `Debug` This fixes https://github.com/facebook/react-native/issues/43185

Custom build setting were only applied to `Debug` build configurations, preventing configurations named `StagingDebug` or similar to access the new experimental debugger, as reported in https://github.com/facebook/react-native/issues/43185

This now applies the setting to every configuration ending with `Debug`

## Changelog:

[IOS] [CHANGED] - fix: build settings for custom build configuration

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

Reviewed By: dmytrorykun

Differential Revision: D55688996

Pulled By: cipolleschi

fbshipit-source-id: 1f34cd722f6acfaa08d3377e19a04d08af97ed7c
2024-04-08 07:49:43 +01:00
Dmitry RykunandNicola Corti d0dd48b4c9 Print Hermes build script shell commands only in CI (#43767)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43767

Print Hermes build script shell commands only in CI.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D55635527

fbshipit-source-id: f0a901e11c523987e97a28b5238dcc08586516dd
2024-04-08 07:49:43 +01:00
Riccardo CipolleschiandGitHub 0e5dc51bba [Yoga][0.74] Fix archive for MacOS Catalyst (#43900) 2024-04-08 07:49:36 +01:00
Alex Hunt 82643e1a35 Update Podfile.lock
Changelog: [Internal]
2024-04-02 13:48:19 +01:00
Distiller 6abca78895 Release 0.74.0-rc.6
#publish-packages-to-npm&next
2024-04-02 11:04:49 +00:00
Szymon RybczakandGitHub 4f50089da2 Upgrade @react-native-community/cli to 13.6.4 (#43681) 2024-04-02 10:38:55 +01:00
phillipandGitHub 49bb2f37f1 [rn][ios][0.74][RC6] decouple RCTBridge+Private from jsinspector-modern (#43708) 2024-04-02 10:38:27 +01:00
Arushi KesarwaniandAlex Hunt dc851b6b3a React-Native-Restart in release (#43645)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43645

https://github.com/facebook/react-native/pull/43521 & https://github.com/facebook/react-native/pull/43588 aimed to fix `react-native-restart`, however in release `handleReloadJS()` is a no-op in [DisabledDevSupportManager](https://github.com/facebook/react-native/blob/ac714b1c3300d3a169bdcfec05d556e18a7b83ff/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DisabledDevSupportManager.java#L139) which is why this should not work. Fixing it by relying on `ReactHostImpl.reload()` instead for Bridgeless.

Adding implementation of `DisabledDevSupportManager.handleReloadJS()` won't work as it would mean introducing circular dependency `devsupport` -> `runtime`

Reviewed By: cortinico

Differential Revision: D55342296

fbshipit-source-id: ee6fba68586a2bdd1163522f75e6beb1b7736f6c
2024-04-02 10:37:19 +01:00
Ruslan LesiutinandAlex Hunt 9a286d65d1 fix[android]: fix bridgeless configuration to include DebuggingOverlay in react packages (#43661)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43661

# Changelog: [Internal]

1. Remove `BridgelessDebugReactPackage.java`, this was added in D43407534. Technically, its the same as `DebugCorePackage.java`.
2. `ReactInstance` to add `DebugCorePackage`, so `DebuggingOverlay` view manager will be included in the bridgeless build.
3. Fix `RNTesterApplication.kt` to NOT create `MyLegacyViewManager` for every possible viewManagerName, apart from `"RNTMyNativeView"`, return null instead.

Reviewed By: cortinico

Differential Revision: D55375350

fbshipit-source-id: 1d3cb6b5ad3c0248df1def9f37c8c49b308f4473
2024-04-02 10:36:59 +01:00
Ruslan LesiutinandAlex Hunt 1dc11cb2b3 fix: defer ReactDevToolsOverlay import (#43690)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43690

# Changelog: [Internal]

Fixes https://github.com/facebook/react-native/issues/43678.

The issue is that once `getInspectorDataForViewAtPoint` is imported, it should throw if RDT global hook was not injected. ReactDevTools overlay imports `getInspectorDataForViewAtPoint`, this is why it did throw in testing environment.

ReactDevToolsOverlay JSX-element is already gated with RDT global hook check, adding a deferred import, same as it was already implemented for Inspector.

Still unclear to me how this didn't throw all this time while using the Catalyst / RNTester.

Reviewed By: cortinico

Differential Revision: D55474774

fbshipit-source-id: 759e5e8227cc7534193e5b95616b6099c15f5cb5
2024-04-02 10:36:34 +01:00
Andrew CoatesandAlex Hunt 5d63c85ced Add @types/react as optional peerDependency on packages that use it (#43509)
Summary:
Now that RN is providing TS type information, many of those .d.ts files depend on types from react.  In modern packagemanagers (Ex: pnpm) types/react will not be available to RN since it does not declare it as a dependency.

I also noticed that the types for react-native-popup-menu-android appear to be pointing to the wrong location.

Add types/react as a peerDependency on the packages that have .d.ts files that import from React.
Add types/react to peerDependencyMeta with optional:true to prevent users not using TS from requiring types/react.

[GENERAL] [ADDED] Added types/react as an optional peerDependency

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

Reviewed By: cortinico

Differential Revision: D55225940

Pulled By: NickGerleman

fbshipit-source-id: 4cbab071928cb925baec45f55461559acc9a54e6
2024-04-02 10:35:24 +01:00
CatStudioAppandAlex Hunt 462fbaef0c Update package.json to fix ccache_enabled option, fixes #43633 (#43634)
Summary:
I found in 0.74.0-rc.x, `ccache_enabled` is introduced. However, it is not being delivered via npm.

fixes https://github.com/facebook/react-native/issues/43633

Changelog: [iOS] [Fixed] - Adding ccache_clang wrapper scripts to package.json for distribution

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

Reviewed By: cortinico

Differential Revision: D55308743

Pulled By: blakef

fbshipit-source-id: e89a4bb3a1fbf8562d880b4c9d25dc9083717ba6
2024-04-02 10:34:18 +01:00
Dmitry RykunandAlex Hunt d85f8b7e7a Set HERMES_RELEASE_VERSION correctly (#43699)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43699

This diff initializes `RELEASE_VERSION` with the value that is provided by the `get_react_native_version` job (it stores its output into `/tmp/react-native-version`).

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D55484988

fbshipit-source-id: f0b5bb473096f3691f50152beb3181a454916fdc
2024-04-02 10:33:29 +01:00
Dmitry RykunandAlex Hunt a37ba6f3ff Move IOS_DEPLOYMENT_TARGET and MAC_DEPLOYMENT_TARGET to the command body
Summary:
This diff moves IOS_DEPLOYMENT_TARGET and MAC_DEPLOYMENT_TARGET definitions to the command body.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D55478563

fbshipit-source-id: bae327edbaf88a9e8b39b304d938389e3fc56f4f
2024-04-02 10:33:26 +01:00
Dmitry RykunandAlex Hunt f4b5bf1e14 Explicitly define IOS_DEPLOYMENT_TARGET and MAC_DEPLOYMENT_TARGET on CircleCI (#43683)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43683

This diff adds explicit definitions of IOS_DEPLOYMENT_TARGET and MAC_DEPLOYMENT_TARGET to `build_apple_slices_hermes` and `build_hermes_macos` jobs on CircleCI.
Eventually this will allow us to stop [interacting](https://github.com/facebook/react-native/blob/main/packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh#L28) with `hermes-engine.podspec` outside of the CocoaPods execution context, and make our CI jobs less error prone.

Changelog: [Internal]

Reviewed By: fkgozali, cortinico

Differential Revision: D55432703

fbshipit-source-id: dc1cc449ba60340d13db9e4d21970e4e3783f2da
2024-04-02 10:30:16 +01:00
Kevin GozaliandAlex Hunt 03237f449a Keep ES6Proxy enabled in bridgeless mode (#43538)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43538

The Hermes RuntimeConfig for bridgeless accidentally force-disabled ES6Proxy, resulting in https://github.com/facebook/react-native/issues/43523

Let's remove the incorrect override.

To test using RNTester, add the following change:

```
 diff --git a/packages/rn-tester/js/RNTesterAppShared.js b/packages/rn-tester/js/RNTesterAppShared.js
index 87cb6b69dfe..f2512d09c5a 100644
 --- a/packages/rn-tester/js/RNTesterAppShared.js
+++ b/packages/rn-tester/js/RNTesterAppShared.js
@@ -50,6 +50,8 @@ const RNTesterApp = ({
   );
   const colorScheme = useColorScheme();
+  new Proxy({}, {});
+
   const {
     activeModuleKey,
     activeModuleTitle,
```

Before this change, RNTester will get an error at start-up. After, the app loads correctly.

Changelog: [General][Fixed] Correctly keep ES6Proxy for bridgeless mode

Reviewed By: cortinico

Differential Revision: D55045780

fbshipit-source-id: 666b99712d35622f87d42f22a4611851df67d905
2024-04-02 10:29:43 +01:00
Alex Hunt d81065a621 [LOCAL] Update RNTester Podfile.lock 2024-04-02 10:29:27 +01:00
Distiller c0c3ac3f13 Release 0.74.0-rc.5
#publish-packages-to-npm&next
2024-03-25 13:57:17 +00:00
Nicola Corti cc6e734fa4 Revert "fix(iOS): add missing forward blocks to RCTRootViewFactory (#43638)"
This reverts commit eed035a3b6.
2024-03-25 12:18:44 +00:00
Arushi KesarwaniandNicola Corti f6757a20c6 Expose ReactDelegate for react-native-restart (#43588)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43588

Supported `reload()` in Bridgeless through ReactDelegate in https://github.com/facebook/react-native/pull/43521 in order to unblock react-native-restart

https://github.com/avishayil/react-native-restart/blob/134cabd5b3f355ffe551e5dd1be1dd46d870fe13/android/src/main/java/com/reactnativerestart/RestartModule.java#L54

which can access React Delegate through :
```
if(currentActivity instanceof ReactActivity) {
    ReactActivity reactActivity = (ReactActivity) currentActivity;
    ReactDelegate reactDelegate = reactActivity.getReactDelegate();
    reactDelegate.reload()
}
```

Changelog:
[Android][Added] Expose ReactDelegate in ReactActivity

Reviewed By: cortinico

Differential Revision: D55166962

fbshipit-source-id: 5d8dfd7ad61edbcb5233014800eb66a538842ca5
2024-03-25 10:45:35 +00:00
Arushi KesarwaniandNicola Corti 0e5ba6db2d Support reload in ReactDelegate (#43521)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43521

Changelog:
[Android] [Added] - Support reload() in ReactDelegate

Reviewed By: cortinico

Differential Revision: D54967602

fbshipit-source-id: adfa200cabcbecf9507775ac38f17c9d01b2671a
2024-03-25 10:45:00 +00:00
Arushi KesarwaniandNicola Corti 36d64312c8 Refactor ReactDelegate to provide DevSupportManager (#43520)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43520

Refactor ReactDelegate to have a private `getDevSupportManager()` that can also be re-used  by `reload()`

This method conditionally provides the correct DevSupportManager in cases of Bridge & Bridgeless

Changelog:
[Internal] internal

Reviewed By: cortinico

Differential Revision: D54967130

fbshipit-source-id: 37d585de33a50b98d01803d3080c5693a8c494b9
2024-03-25 10:44:47 +00:00
Arushi KesarwaniandNicola Corti 4fe26e3b2f Support onKeyLongPress in Bridgeless (#43472)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43472

Implement `onKeyLongPress` in Bridgeless

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

Reviewed By: cortinico

Differential Revision: D54876052

fbshipit-source-id: 88d572eab087d913205bdfa02dba96b169066393
2024-03-25 10:43:56 +00:00
Arushi KesarwaniandNicola Corti 8bf509ec44 Support onKeyDown in Bridgeless (#43466)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43466

Implement `onKeyDown` in Bridgeless by adding it to ReactHostImpl

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

Reviewed By: cortinico

Differential Revision: D54870966

fbshipit-source-id: 0f8e48b29679f1bca92f6ac7b6ebf1592cdc5dac
2024-03-25 10:43:30 +00:00
Arushi KesarwaniandNicola Corti 76463789fd Support onConfigurationChanged in Bridgeless (#43463)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43463

Implement `onConfigurationChanged` in Bridgeless by adding it to ReactHostImpl

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

Reviewed By: cortinico, RSNara

Differential Revision: D54792399

fbshipit-source-id: 6851daca815f486f4d839e128a1d740d3fec1996
2024-03-25 10:42:52 +00:00
Arushi KesarwaniandNicola Corti dbc83220e0 Support onNewIntent in Bridgeless (#43401)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43401

Implement `onNewIntent` in Bridgeless by adding it to ReactHostImpl

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

Reviewed By: fkgozali, RSNara

Differential Revision: D54703159

fbshipit-source-id: fd8589d8131f4fa57188d493331dc68fb38c4520
2024-03-25 10:40:54 +00:00
Arushi KesarwaniandNicola Corti 5eea4cda1b Support onWindowFocusChange in Bridgeless (#43398)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43398

Implement onWindowFocusChange in Bridgeless by adding it to the ReactHostImpl

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

Reviewed By: javache

Differential Revision: D54670119

fbshipit-source-id: 71f560e5a3bf0e853ac06955e67b8035f1ec0468
2024-03-25 10:40:25 +00:00
Nicola CortiandAlex Hunt 0f4234f450 Fix InteropUIBlockListener to support react-native-view-shot on Bridgeless (#43594)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43594

I've been migrating `react-native-view-shot` to Fabric by using the `InteropUiBlockListener`
and I've realized that the interop layer doesn't work well.

1. FabricUIManager needs to implement `UIBlockViewResolver` in order for the interop layer to work correctly.
2. We need to hook `addUIBlock` to the `didDispatchMountItems` callback otherwise the UIBlocks won't be executed at all.

Changelog:
[Android] [Fixed] - Fix InteropUIBlockListener to support react-native-view-shot on Bridgeless

Reviewed By: javache

Differential Revision: D55187939

fbshipit-source-id: d048b4b5eed77fa856fdfac17c0df5f23fd44844
2024-03-25 10:30:26 +00:00
Nick GerlemanandAlex Hunt 396d444e79 Fix Android HorizontalScrollView fling when content length less than ScrollView length (#43563)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43563

Fixes https://github.com/facebook/react-native/issues/42874

## Sumary

D9405703 added some custom logic for Flings, to support FlatList scenarios where content is being added on the fly, during Fling animation. This works by allowing start Fling to not have bounds, then correcting/cancelling Fling when overscroll happens over a bound that would normally be allowed.

This has some math to try to determine max content length, and will clamp to this when scrolling over it. This logic is incorrect when content length is less than scrollview length, and we end up snapping to a negative offset.

This change adds clamping, so that we don't snap to negative position in horizontal scroll view. This clamping was already indirectly present on vertical scroll view. https://www.internalfb.com/code/fbsource/[b43cdf9b2fec71f5341ec8ff2d47e28a066f052e]/xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java?lines=609

## Test Plan

Above issue no longer reproes. Flinging while content is being added to horizontal FlatList still works correctly.

Changelog:
[Android][Fixed] - Fix Android HorizontalScrollView fling when content length less than ScrollView length

Reviewed By: javache

Differential Revision: D55108818

fbshipit-source-id: 7cf0065f9f92832cc2606d1c7534fc150407b9c9
2024-03-25 10:28:29 +00:00
Nick GerlemanandAlex Hunt 20bcf57ee3 Warn users during "pod install" if XCode is too old (#43583)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43583

Fail during `pod install` if user's version of XCode is too old to avoid cryptic errors (e.g. https://github.com/reactwg/react-native-releases/issues/163).

I reused existing mechanism for version detection, though it may not be reliable for future versions of XCode.

Changelog:
[iOS][Changed] - Warn users during "pod install" if XCode is too old

Reviewed By: dmytrorykun

Differential Revision: D55149636

fbshipit-source-id: 78387ff19a6eb10f3ca0d4aa78e6b934ae3b0711
2024-03-25 10:28:13 +00:00
Gabriel DonadelandAlex Hunt 33e3ec9426 Implement multiple view manager lookup for the interop layer on Android (#43595)
Summary:
When running with the new architurece and using the renderer interop layer on Android, view managers don't work if their names start with `RCT`. This happens because the `RCT` prefix is automatically removed from the component name, and inside the internal `mViewManagers` we store view managers with the `RCT` prefix.

Using the `RCT` pattern as a prefix works fine with the old architecture and is actually used on the [Android Native UI Components](https://reactnative.dev/docs/next/native-components-android) tutorial in the docs, making me believe that this same patterns is used across many community libraries.

This diff adds a secondary lookup logic for view managers:

1. We look for the XXXViewManager.
2. If not found, we look for RCTXXXViewManager.

Quite similar to the iOS implementation introduced in  https://github.com/facebook/react-native/pull/38093

 ---

With this change we can also remove most of the entries from FabricNameComponentMapping (I can address this in a follow up PR)

https://github.com/facebook/react-native/blob/4e6eba7a2dedaa855af0bff5df3bec73a95f0fc4/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/FabricNameComponentMapping.java#L22-L45

## Changelog:

[ANDROID] [ADDED] - Implement multiple view manager lookup for the interop layer

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

Test Plan:
Tested installing a library such as [react-native-fbsdk-next](https://github.com/thebergamo/react-native-fbsdk-next) that names its view managers starting with `RCT`

<table>
<tr>
  <th>Before</th>
  <th>After</th>
</tr>
<tr>
<td>
<img width="519" alt="image" src="https://github.com/facebook/react-native/assets/11707729/123de1d6-f018-424b-b6ce-38221af9d83e">
</td>
<td><img width="519" alt="image" src="https://github.com/facebook/react-native/assets/11707729/0f35b369-e2e4-4bbf-b880-6471fbc05d38">
</td>
</tr>
</table>

Reviewed By: cortinico

Differential Revision: D55208396

Pulled By: arushikesarwani94

fbshipit-source-id: a1fb1f4cee8483cf91ebededd1d7c4ba7021f9d9
2024-03-25 10:27:49 +00:00
Jakub PiaseckiandAlex Hunt 35f6000c66 Include boost headers needed by rrc_text and rrc_textinput (#43608)
Summary:
Updates `PreparePrefabHeadersTask` to copy more headers from `boost`, specifically those required by `rrc_text` and `rrc_textinput`.

## Changelog:

[ANDROID] [CHANGED] - Copy boost headers needed by `rrc_text` and `rrc_textinput`

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

Reviewed By: rshest

Differential Revision: D55241345

Pulled By: cortinico

fbshipit-source-id: e92164676ba78ee15b3678a55c9098b0c6214b69
2024-03-25 10:27:25 +00:00
Jakub PiaseckiandAlex Hunt 1d4b263d3d Fix prefab header paths for rrc_text and rrc_textinput (#43591)
Summary:
- `rrc_textinput` at the moment points to a wrong subdirectory and needlessly adds a prefix path
- `rrc_text` is missing headers for `attributedstring` which it depends on

## Changelog:

[ANDROID] [FIXED] - Fixed prefab header paths for `rrc_text` and `rrc_textinput`

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

Reviewed By: fkgozali

Differential Revision: D55199580

Pulled By: cortinico

fbshipit-source-id: 85126c00943f82e908a52e05587661597761852e
2024-03-25 10:26:24 +00:00
2c62dcabe5 [0.74] Fixes build from source on Android (#43616)
* fix(android): fix `ndkVersion` is unset when building from source (#43131)

Summary:
`ndkVersion` is unset when building from source using this guide: https://reactnative.dev/contributing/how-to-build-from-source

## Changelog:

[ANDROID] [FIXED] - Fix `ndkVersion` is unset when building from source

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

Test Plan:
```
git clone https://github.com/microsoft/react-native-test-app.git
cd react-native-test-app
npm run set-react-version nightly
yarn

# Manually apply the patch in node_modules/react-native/ReactAndroid/build.gradle.kts
# Enable building from source
sed -i '' 's/#react.buildFromSource/react.buildFromSource/' example/android/gradle.properties

# Build
cd example/android
./gradlew assembleDebug
```

Reviewed By: christophpurrer

Differential Revision: D54006425

Pulled By: cortinico

fbshipit-source-id: 9ede64bc14af4cf609b7a4c12c5a1082bbc31f09

* Fix build from source for hermes-engine (#43609)

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

When users are building from source for React Native they don't have an ndkVersion variable specified. So we want to fallback to the global NDK version we set for the whole build here.

Changelog:
[Android] [Fixed] - Fix build from source for hermes-engine

Reviewed By: dmytrorykun

Differential Revision: D55240603

fbshipit-source-id: 3c725a164b40e176548af8ada9fcb13d391ef017

---------

Co-authored-by: Tommy Nguyen <4123478+tido64@users.noreply.github.com>
2024-03-25 10:24:36 +00:00
eed035a3b6 fix(iOS): add missing forward blocks to RCTRootViewFactory (#43638)
* fix(iOS): add missing forward blocks to RCTRootViewFactory (#43526)

Summary:
This PR adds missing forwarding blocks to RCTRootViewFactory, currently when a user tries to override `sourceURLForBridge` in AppDelegate it isn't overridden.

## Changelog:

[IOS] [FIXED] - add missing forward blocks to RCTRootViewFactory

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

Test Plan: Override: `extraModulesForBridge`, `extraLazyModuleClassesForBridge`, `bridge didNotFindModule`,  `sourceURLForBridge:` methods in AppDelegate and check if they are called on old architecture

Reviewed By: philIip

Differential Revision: D55186872

Pulled By: cortinico

fbshipit-source-id: 5988c7bab1439ccc4885b7337336c1e120ba9ea6
(cherry picked from commit 9d79f05e68)

* Follow-up with Review Feedback on RCTAppDelegate from #43526 (#43607)

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

PR #43526 was accidentally merged with several changes excluded. I'm following up on those here.

Changelog:
[Internal] [Changed] - Follow-up with Review Feedback on RCTAppDelegate from #43526

Reviewed By: dmytrorykun

Differential Revision: D55240435

fbshipit-source-id: c296a1e14b7032b211551334ca7b5a6824e8d45c
(cherry picked from commit 84c1c6ea9b)

---------

Co-authored-by: Oskar Kwaśniewski <oskarkwasniewski@icloud.com>
Co-authored-by: Nicola Corti <ncor@meta.com>
2024-03-25 10:24:21 +00:00
Cedric van PuttenandAlex Hunt f3b9226ca0 fix(dev-middleware): create custom message handler for synthetic page (#43559)
Summary:
This is a follow-up bugfix for expo/expo#27425, related to:
 - https://github.com/facebook/react-native/issues/43291
 - https://github.com/facebook/react-native/issues/43307
 - https://github.com/facebook/react-native/issues/43310
 - https://github.com/facebook/react-native/issues/43364

The middleware API works as intended and can run our extended CDP events. Unfortunately, this only applies to an actual `Page` from the device, not for the `React Native Experimental (Improved Chrome Reloads)` synthetic / virtual page.

That's because the middleware instantiation gets aborted when the page can't be found in `this.#pages.get(pageId)`, which always returns `null` for this synthetic page.

## Changelog:

[GENERAL] [FIXED] Create custom message handler for synthetic page

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

Test Plan: See added test case.

Reviewed By: motiz88

Differential Revision: D55129412

Pulled By: huntie

fbshipit-source-id: 9679d8fe68f3cb4104f4a042f93612b995baddc9
2024-03-21 13:28:49 +00:00
Alex HuntandAlex Hunt 0a7dbfd1a2 Adjust version parsing in release scripts, fix release dry runs in CI (#43568)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43568

Fixes to restore passing CI checks on main after D55027120.

- Widen validation checks in version utils to accept `0.x.x` (as opposed to `0.[not-'0'].x`).
- Use `tag: test` instead of `tag: latest` for dry run job params.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D55123739

fbshipit-source-id: 9f76dced4e7aa3ce87d6680cd7687ae443305331
2024-03-20 17:42:06 +00:00
Alex HuntandAlex Hunt d66bb7f853 Remove bump-all-updated-packages script (#43534)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43534

This is no longer used after switching to the new release workflow, which uses the newer and less error-prone `set-version` script.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D55027122

fbshipit-source-id: faa8cfd2af9b54fab611b108df162793c5768695
2024-03-20 14:40:54 +00:00
Alex HuntandAlex Hunt 8b5d650e60 Switch to new release workflow as default (#43533)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43533

Switch to the new unified release workflow by default, now that this has been validated on the `0.74-stable` branch.

- Remove `--use-new-workflow` flag and remove legacy logic.
- Remove legacy `prepare_package_for_release` CI job, and use `run_new_release_workflow` -> `run_release_workflow` as new workflow condition match.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D55027120

fbshipit-source-id: 7c05cdff95ac369ce6cd1201ccfc5718798c4da6

# Conflicts:
#	scripts/releases-ci/prepare-package-for-release.js
2024-03-20 14:40:44 +00:00
Alex Hunt 32deb27219 Update RNTester Podfile.lock 2024-03-18 16:45:51 +00:00
Alex Hunt 24b1da16ea [LOCAL] Fix new release workflow script (4) 2024-03-18 16:02:31 +00:00
Distiller 907bd438ff Release 0.74.0-rc.4
#publish-packages-to-npm&next
2024-03-18 15:20:38 +00:00
Alex Hunt eadf9203bf [LOCAL] Fix new release workflow script (3) 2024-03-18 15:02:09 +00:00
Alex Hunt 8535f496d2 [LOCAL] Fix new release workflow script (2) 2024-03-18 14:31:58 +00:00
Alex Hunt d6ee80959e [LOCAL] Revert Podfile.lock error handling in CI script, remove same step from new workflow
It looks like this always failed (recent example from RC3: https://app.circleci.com/pipelines/github/facebook/react-native/42625/workflows/911813aa-8c1c-4c7f-8382-5d67d3551923/jobs/1396276), but since #43513 this now correctly raises as an error to CircleCI.

To unblock our release:
- Revert.
- Also remove "Updating RNTester Podfile.lock" entirely from `prepare_release_new` job — technically this isn't in the critical path for making a release, but is part of consistent branch state _post release_.

Changelog: [Internal]
2024-03-18 14:21:45 +00:00
Alex Hunt bdb1034e3e [LOCAL] Fix new release workflow script 2024-03-18 13:19:24 +00:00
Kudo ChienandAlex Hunt daf012a958 Add registerCallableModule types (#43366)
Summary:
`registerCallableModule()` was added from 7f549ec7be but no typescript types there. this pr tries to add the corresponding types.

## Changelog:

[GENERAL] [FIXED] - Add missing `registerCallableModule` TypeScript definitions

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

Test Plan: patch locally and try to `import { registerCallableModule } from 'react-native';` in a 0.74.0-rc.2 project

Reviewed By: fabriziocucci

Differential Revision: D54676151

Pulled By: cortinico

fbshipit-source-id: cd01f2ebe2d2516b458fae5b2e83cba3d3794455
2024-03-18 11:09:04 +00:00
Alex HuntandAlex Hunt 40a4df0637 Fix RNTester Podfile.lock update in release workflow (#43513)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43513

The previous `update_podfile_lock.sh` script would fail as executed from the repo root (could not locate RNTester dir). Delete this and replace with direct calls in `prepare-package-for-release.js`, which will fail script on error.

 {F1469216632}

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D54949214

fbshipit-source-id: 4f032069e803e84f835c279d01332d16787dfafc
2024-03-18 11:09:04 +00:00
Alex HuntandAlex Hunt ff5d87db3e Fix E2E template install in CI jobs (#43323)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43323

This fixes a seemingly pre-existent misconfiguration within our `test_ios_template` E2E test setup in CircleCI.

**Background**

We call `npx react-native-community/cli init` with the `--skip-install` flag, as part of the bootstrapping logic in `scripts/e2e/init-template-e2e.js`. This is necessary because we later want to explicitly call `npm install` with a custom `--registry` for our locally mirrored packages (via Verdaccio).

For some reason, we were observing unexpected differences when this was run under CircleCI:

1. Runs `yarn init`
2. Runs a `yarn add` (unknown pkg)

 {F1464781818}

https://app.circleci.com/pipelines/github/facebook/react-native/42725/workflows/f648468b-e916-4501-887d-ad293aa6fccf/jobs/1398950

This is causing a Yarn-based install ahead of where we want — ignoring the `--skip-install` flag.

*I'm still unsure on the exact LOC cause in CLI* (but most likely, it's around the Yarn v3 move).

**Impact of this fix**

- The above meant that, when we were bootstrapping `test_ios_template` previously, packages weren't being read from Verdaccio, but **instead from npm** — using the `"0.74.0"` versions from the *previous branch cut* .
- After D54006327, this behaviour became breaking 💀 — since for the 0.74 -> 0.75 cut, we no longer physically published `"0.75.0-main"` (new format) packages to npm.

**This change**

I'm passing `--pm npm` to `npx react-native-community/cli init` to skip around any Yarn behaviour. This appears to have removed the erroneous `yarn` invocations .

Changelog: [Internal]

bypass-github-export-checks

Reviewed By: cortinico, cipolleschi

Differential Revision: D54536848

fbshipit-source-id: 473b11924955f5787c82a6c81d4527d77b810aa5
2024-03-18 11:09:04 +00:00
Alex HuntandAlex Hunt 4e677f021a Update set-version script to version private packages and workspace deps
Summary:
Addresses a gap when using the `set-version` script to update all packages on `main` (i.e. post branch cut):
- Package versions were not being set consistently. It is safe to version all workspace packages, including `"private"`.
    - Our publishing workflow is independent from this, and only considers public packages for submission to npm.
- We also need to update the root `package.json`, which includes `devDependencies` referencing workspace dependencies.

Unblocks https://github.com/facebook/react-native/pull/43132.

Changelog: [Internal]

Reviewed By: lunaleaps

Differential Revision: D54419456

fbshipit-source-id: 93eee669c5cf7c2f16b68a2bf41e9a8ace5521bf
2024-03-18 11:09:04 +00:00
Alex HuntandAlex Hunt 42e62bf963 Refactor remaining forEachPackage call sites (#43112)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43112

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53942028

fbshipit-source-id: 335bff3c3a31026bae7140fac1d1a6aae23a0f1e
2024-03-18 10:58:13 +00:00
Alex HuntandAlex Hunt 3b170a0910 Add prepare_release_new workflow, configure via flag (#43518)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43518

This is a minimum approach to achieve a **single-command publish flow** for React Native, unifying the previous `yarn bump-all-updated-packages` and `yarn trigger-react-native-release` workflow entry points.

This diff aims to change as little as possible to achieve the above — introducing a new job that merges operations to create the versioning commit. The triggered publish jobs are unchanged. In future, we may follow this change with further simplifications down the workflow tree.

**Key changes**

- Adds a new CircleCI workflow, `prepare_release_new`, which versions **all packages** and writes a single release commit.
- This replaces `yarn bump-all-updated-packages`, now implemented with the newer `set-version` script.
- Wires this up as an experiment within `trigger-react-native-release.js`, conditionally running the new workflow when `--use-new-workflow` is passed.

**Not changed**

- The single release commit written will continue to trigger both of the existing CI workflows on push (`publish_release` and `publish_bumped_packages`), which are unchanged.
    - The commit summary now includes the `#publish-packages-to-npm` marker, in order to trigger `publish_bumped_packages`.
- Usage: Release Crew members will continue to use the existing local script entry point (as [documented in the releases repo](https://github.com/reactwg/react-native-releases/blob/main/docs/guide-release-process.md#step-7-publish-react-native)), with the opt in flag.
    ```
    yarn trigger-react-native-release --use-new-workflow [...args]
    ```

After we're happy with the E2E behaviour of this workflow in the next 0.74 RC, I will follow up by dropping the `--use-new-workflow` flag and removing the old scripts (T182533699).

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D54956345

fbshipit-source-id: 35fd7af8f3e60a39507b5d978ccd97472bf03ddb
2024-03-18 10:41:28 +00:00
Alex HuntandAlex Hunt 680bfafcc2 Remove dangerous "9999" version string default (#43516)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43516

As titled. This seems dangerous — removing with the motivation that we'd prefer this script to fail during execution than to succeed in publishing `9999`.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D54956661

fbshipit-source-id: 23f8d49abd300385dde74871b6d2492ef63f058e
2024-03-18 10:41:16 +00:00
Phillip PanandAlex Hunt ffb93a81b5 support jsCallInvoker in RCTBridgeProxy (#43314)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43314

Changelog: [Internal]

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

Reviewed By: cipolleschi

Differential Revision: D54404845

fbshipit-source-id: 983e86829030557033b95625dab9068492739417
2024-03-18 10:39:47 +00:00
Arushi KesarwaniandAlex Hunt 9048c0e0b3 Fix Bridgeless React Context test in OSS (#43424)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43424

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

Reviewed By: fkgozali

Differential Revision: D54781539

fbshipit-source-id: 1c784804c31d4b57fe438d49f3ee3eb7034dd7a6
2024-03-18 10:37:44 +00:00
Arushi KesarwaniandAlex Hunt bccedff09b Implement getJSCallInvokerHolder for BridgelessCatalystInstance (#43400)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43400

Implement `getJSCallInvokerHolder()` for BridgelessCatalystInstance

Changelog:
[Android][Breaking] Implement `getJSCallInvokerHolder()` for Bridgeless Catalyst Instance

Reviewed By: cortinico

Differential Revision: D54650305

fbshipit-source-id: effac3daaad5173c2fd78ab11bbe3f3156a9c07b
2024-03-18 10:37:27 +00:00
Arushi KesarwaniandAlex Hunt 3e5dd5e2f2 Fix CI by adding explicit visibility modifier to BridgelessCatalystInstance (#43296)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43296

Fix CI by adding explicit visibility modifier to the newly added `BridgelessCatalystInstance` class. In Kotlin, in explicit API mode, which is usually the default mode for Kotlin, we must explicitly specify one of the modifiers for every declaration to make it clear and explicit.

Changelog:
[Internal] internal

Reviewed By: makovkastar

Differential Revision: D54442485

fbshipit-source-id: 4409ff810a09cc4fadcd2ccf21f7fbac3015f413
2024-03-18 10:37:22 +00:00
Arushi KesarwaniandAlex Hunt 8a04e4418a Add BridgelessCatalystInstance as a placeholder for backwards comptability of legacy APIs of CatalystInstance
Summary:
In order to make the legacy APIs of Catalyst Instance backwards compatible, introducing a regular class that implements CatalystInstance so as to make these APIs available for folks in Bridgeless mode as well.

Changelog:
[Internal] internal

Reviewed By: RSNara

Differential Revision: D54093013

fbshipit-source-id: f494c05e79f570883f9b5374cd177862970304c0
2024-03-18 10:37:00 +00:00
Riccardo CipolleschiandAlex Hunt ec48cb6560 Allow the app to control the Activity Indicator in Bridgeless mode (#43195)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43195

Right now, the activity indicator is automatically hidden when the view is ready to be shown in bridgeless mode.
There is no way to prevent that the activity indicator is automatically removed.

In OSS, we have libraries (e.g.: `react-native-bootsplash`) that will allow the app to control when and how dismiss the splashscreen, but due to the current automatic behavior on Bridgeless, they stopped working.

***Note:** In the previous implementation, they were working because instead of using the `loadingView` property, they were adding the splashscreen view on top of the existing one. However, with the lazy behavior of the bridgeless mode, this is not working anymore because the RCTMountingManager [expect not to have any subview](https://www.internalfb.com/code/fbsource/[6962fa457dbc74ab3a760cf6090d9643c6748781]/xplat/js/react-native-github/packages/react-native/React/Fabric/Mounting/RCTMountingManager.mm?lines=176) when the first surface is mounted.*

## Changelog
[iOS][Added] - Allow the activityIndicator to be controlled from JS in bridgeless mode

Reviewed By: philIip

Differential Revision: D54191856

fbshipit-source-id: 14738032f04adf7eaf7d200d889acd752aed0ed3
2024-03-18 10:31:50 +00:00
Cedric van PuttenandAlex Hunt 768cf6e79c feature(dev-middleware): add custom message handlers to extend CDP capabilities (#43291)
Summary:
This is a proposal for the `react-native/dev-middleware` package, to allow implementers to extend the CDP capabilities of the `InspectorProxy`. It's unfortunately needed until we can move to the native Hermes CDP layer.

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

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

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

## API:

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

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

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

## Changelog:

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

Pick one each for the category and type tags:

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

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

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

Test Plan: See added tests and code above

Reviewed By: huntie

Differential Revision: D54804503

Pulled By: motiz88

fbshipit-source-id: ae918dcd5b7e76d3fb31db4c84717567ae60fa96
2024-03-18 10:30:57 +00:00
Cedric van PuttenandAlex Hunt bf7f0d57cc feature(dev-middleware): use userAgent query parameter as fallback when header is unset (#43364)
Summary:
At Expo, we use [Expo Tools](https://github.com/expo/vscode-expo/blob/main/src/expoDebuggers.ts) to connect the [built-in vscode-js-debug](https://github.com/microsoft/vscode-js-debug) to Hermes.

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

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

## Changelog:

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

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

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

[GENERAL] [ADDED] - Fallback to query parameter based `user-agent` when header is unset

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

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

Reviewed By: huntie

Differential Revision: D54804556

Pulled By: motiz88

fbshipit-source-id: 1ff558ba5350811ad042d08a713438e046759feb
2024-03-18 10:30:42 +00:00
Cedric van PuttenandAlex Hunt 0e0838448a fix(dev-middleware): allow inspector proxy to fetch sourcemaps on lan connections (#43307)
Summary:
The inspector proxy is inlining source maps on `Debugger.scriptParsed` CDP events. The inlining prevents Chrome DevTools from downloading this remotely, as that's not supported in newer versions anymore.

The current implementation locks this inlining mechanism to just `localhost` and/or `127.0.0.1` addresses, making it incompatible with LAN or tunnel device connections.

This PR removes that limitation to allow source map inlining on these LAN and tunnel connections.

## Changelog:

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

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

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

[GENERAL][FIXED] Allow Inspector proxy to inline source maps on LAN connections

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

Test Plan:
- See added test
- Start Metro and connect a device over LAN, open the chrome devtools

Reviewed By: huntie

Differential Revision: D54485247

Pulled By: robhogan

fbshipit-source-id: 6fcb0c6dd762d2f0a013497ba0a1126095b9130b
2024-03-18 10:30:25 +00:00
Nicola CortiandAlex Hunt 0f4aedfe82 Properly handle RR and CMD+M in Bridgeless Mode (#43460)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43460

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

Fixes #43451

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

Reviewed By: huntie

Differential Revision: D54852959

fbshipit-source-id: 8fbbdab6818da9177e6db40e45d35258c7f5e236
2024-03-18 10:28:40 +00:00
Dmitry RykunandAlex Hunt 407be885fa Bring back the UNSET constant to TextAttributeProps (#43491)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43491

This diff brings back the `UNSET` constant to `TextAttributeProps`.
The removal of this constant was an unnecessary breaking change, that has broken several third-party libraries.

Changelog: [Android][Fixed] - Bring back the UNSET constant to TextAttributeProps.

Reviewed By: fabriziocucci

Differential Revision: D54899524

fbshipit-source-id: 368bde77d43f310fd458537d0191d09174fa5167
2024-03-18 10:28:17 +00:00
zhongwuzwandAlex Hunt aa0670b0ae iOS: Change image source url encode ascii to utf8 (#43502)
Summary:
We should use utf8 to cover more characters.

## Changelog:

[IOS] [FIXED] - [Fabric] iOS: Change image source url encode ascii to utf8

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

Test Plan: Fixes https://github.com/facebook/react-native/issues/43462

Reviewed By: rshest

Differential Revision: D54944653

Pulled By: cortinico

fbshipit-source-id: 0bbd3d46c8e5c04ceffe7e0ebae46dc2ce9507df
2024-03-18 10:27:57 +00:00
Joe VilchesandAlex Hunt 8830ed6bba Fix bug where absolute nodes were not insetted correctly in certain cases (#43417)
Summary:
X-link: https://github.com/facebook/yoga/pull/1593

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

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

Reviewed By: NickGerleman

Differential Revision: D54703955

fbshipit-source-id: 096c643f61d4f9bb3ee6278d675ebd69b57350d7
2024-03-18 10:27:38 +00:00
szymonrybczakandAlex Hunt bc745cb6ff Update @react-native-community/cli to 13.6.2 2024-03-12 14:45:49 +00:00
Alex Hunt 24d3251d3f Update Podfile.lock 2024-03-12 10:09:39 +00:00
Distiller 57cc8e7f67 [0.74.0-rc.3] Bump version numbers 2024-03-11 14:59:31 +00:00
Alex Hunt 8a7c718ab3 Bump package versions
#publish-packages-to-npm&0.74-stable
2024-03-11 13:53:12 +00:00
Cedric van PuttenandAlex Hunt 4efab59a1e feature(dev-middleware): add inspector proxy nativeNetworkInspection target capabilty flag (#43310)
Summary:
This adds the `nativeNetworkInspection` target capability flag, to enable/disable the proxy-side network inspection handling.

## Changelog:

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

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

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

[GENERAL][ADDED] Add inspector proxy `nativeNetworkInspection` target capability flag

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

Test Plan:
Once this lands, and is published through `react-native/dev-middleware`, we (Expo) can disable the proxy-side network inspection handling.

See https://github.com/expo/expo/pull/27425/commits/1a1b601a29fbc5766628238db7259121689f6cd6 on PR expo/expo#27425

Reviewed By: christophpurrer, motiz88

Differential Revision: D54486516

Pulled By: huntie

fbshipit-source-id: cc151349c816fb3866d3ec07af1a29a5f4ff9b00
2024-03-11 11:01:17 +00:00
Oskar KwaśniewskiandAlex Hunt e3da9b8c0a fix: add compiler conditional to hover style (#43331)
Summary:
Commit https://github.com/facebook/react-native/commit/73664f576aaa472d5c8fb2a02e0ddd017bbb2ea4 broke two jobs in CircleCI that we run using Xcode 14.3.1 because the commit introduced some types that are available only to iOS 17.
The code was wrapped around if(available()) statement, but this does not compile out the code. It is a runtime check and the code needs to build anyway.

This takes effect at compile time as well. However, unlike with #available, the method must type check and compile. The code will always be emitted into your binary: however, it will only be used when the binary is executed on platforms that meet the availability requirements.

source: [forums.swift.org/t/if-vs-available-vs-if-available/40266/2](https://forums.swift.org/t/if-vs-available-vs-if-available/40266/2)

This change should fix it, introducing some compile time pragmas that removes the code if we build with older versions of Xcode

## Changelog:

[IOS] [ADDED] - Compiler conditionals for hover style (cursor: pointer)

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

Test Plan: CI Green

Reviewed By: dmytrorykun

Differential Revision: D54540520

Pulled By: cipolleschi

fbshipit-source-id: 943ac479062e11969efa7645ec0ead26c6866374
2024-03-11 10:59:17 +00:00
Saad NajmiandAlex Hunt 7395765cf8 feat(iOS): Implement cursor style prop (#43078)
Summary:
Implement the cursor style prop for iOS (and consequently, visionOS), as described in this RFC: https://github.com/react-native-community/discussions-and-proposals/pull/750

See related PR in React Native macOS, where we target macOS and visionOS (not running in iPad compatibility mode) with the same change: https://github.com/microsoft/react-native-macos/pull/2080

Docs update: https://github.com/facebook/react-native-website/pull/4033

## Changelog:

[IOS] [ADDED] - Implement cursor style prop

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

Test Plan:
See the added example page, running on iOS with the new architecture enabled. This also runs the same on the old architecture.

https://github.com/facebook/react-native/assets/6722175/2af60a0c-1c1f-45c4-8d66-a20f6d5815df

See the example page running on all three apple platforms. The JS is slightly different because:
1. The "macOS Cursors" example is not part of this PR but the one in React Native macOS.
2. This PR (and exapmple) has went though a bunch of iterations and It got hard taking videos of every change 😅

https://github.com/facebook/react-native/assets/6722175/7775ba7c-8624-4873-a735-7665b94b7233

## Notes

- React Native macOS added the cursor prop to View with https://github.com/microsoft/react-native-macos/pull/760 and Text with https://github.com/microsoft/react-native-macos/pull/1469 . Much of the implementation comes from there.

- Due to an Apple bug, as of iOS 17.4 Beta 4, the shape of the iOS cursor hover effect doesn't render in the correct bounds (but it does on visionOS). I've worked around it with an ifdef. The result is that the hover effect will work on iOS and visionOS, but not iPad apps running in compatibility mode on visionOS.

Reviewed By: NickGerleman

Differential Revision: D54512945

Pulled By: vincentriemer

fbshipit-source-id: 699e3a01a901f55a466a2c1a19f667aede5aab80
2024-03-11 10:58:03 +00:00
Oskar KwaśniewskiandAlex Hunt 66b1cfee97 feat(RCTAppDelegate): Implement RCTRootViewFactory (#42263)
Summary:
This PR implements `RCTRootViewFactory` a utility class (suggested by cipolleschi) that returns proper RCTRootView based on the current environment state (new arch/old arch/bridgeless). This class aims to preserve background compatibility by implementing a configuration class forwarding necessary class to RCTAppDelegate.

This PR leverages the `RCTRootViewFactory` in `RCTAppDelegate` for the default initialization of React Native (greenfield).

Here is an example of creating a Brownfield integration (without RCTAppDelegate) using this class (can be later added to docs):

1. Store reference to `rootViewFactory` and to `UIWindow`

`AppDelegate.h`:
```objc
interface AppDelegate : UIResponder <UIApplicationDelegate>

property(nonatomic, strong) UIWindow* window;
property(nonatomic, strong) RCTRootViewFactory* rootViewFactory;

end
```

2. Create an initial configuration using `RCTRootViewFactoryConfiguration` and initialize `RCTRootViewFactory` using it. Then you can use the factory to create a new `RCTRootView` without worrying about old arch/new arch/bridgeless.

 `AppDelegate.mm`
```objc
implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary<UIApplicationLaunchOptionsKey,id> *)launchOptions {

  // Create configuration
 RCTRootViewFactoryConfiguration *configuration = [[RCTRootViewFactoryConfiguration alloc] initWithBundleURL:self.bundleURL
                                                                                                 newArchEnabled:self.fabricEnabled
                                                                                             turboModuleEnabled:self.turboModuleEnabled
                                                                                              bridgelessEnabled:self.bridgelessEnabled];

  // Initialize RCTRootViewFactory
  self.rootViewFactory = [[RCTRootViewFactory alloc] initWithConfiguration:configuration];

  // Create main root view
  UIView *rootView = [self.rootViewFactory viewWithModuleName:@"RNTesterApp" initialProperties:@{} launchOptions:launchOptions];

  // Set main window as you prefer for your Brownfield integration.
  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];

  // Later in the codebase you can initialize more rootView's using rootViewFactory.

  return YES;
}
end
```
bypass-github-export-checks

[INTERNAL] [ADDED] - Implement RCTRootViewFactory

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

Test Plan: Check if root view is properly created on app initialization

Reviewed By: dmytrorykun

Differential Revision: D53179625

Pulled By: cipolleschi

fbshipit-source-id: 9bc850965ba30d84ad3e67d91dd888f0547c2136
2024-03-11 10:54:06 +00:00
Tomek ZawadzkiandAlex Hunt 6440e35bc7 Expose react_render_textlayoutmanager via prefab (#43381)
Summary:
The `react_render_textlayoutmanager` was not exposed via prefab. I'm adding it to make possible for react-native-live-markdown to integrate on top of React Native via prefab. Based on https://github.com/facebook/react-native/issues/36166.

## Changelog:

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

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

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

[ANDROID] [CHANGED] - Expose `react_render_textlayoutmanager` via prefab.

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

Reviewed By: javache

Differential Revision: D54676207

Pulled By: cortinico

fbshipit-source-id: 90e3b90ff842250bf1e3abcc0c54f057b68a82fd
2024-03-11 10:49:09 +00:00
Arushi KesarwaniandAlex Hunt 10d65924ee Support onActivityResult in Bridgeless (#43351)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43351

Implement `onActivityResult` on Bridgeless

Changelog:
[Internal] internal

Reviewed By: cortinico

Differential Revision: D54574139

fbshipit-source-id: f2369077199186ac6ef0187b5dfe7ed95f3b87fc
2024-03-11 10:43:48 +00:00
Rick HanlonandAlex Hunt 31b62ab7f0 Fix component stacks for tsx, ts, and jsx files (#43370)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43370

Component stacks with files ending in .ts, .tsx, or .jsx were skipped in LogBox reporting. This diff fixes the regex.

Changelog:
[General][Fixed] - Support .tsx, .ts, and .jsx in component stacks

Reviewed By: yungsters

Differential Revision: D54638526

fbshipit-source-id: a5271daaa7b687e8e075be3f94ab9b9c03f79b66
2024-03-11 10:41:29 +00:00
Pieter De BaetsandAlex Hunt 1151ea1247 Fix DefaultReactNativeHost assuming lazyViewManagers are always available (#43334)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43334

cortinico flagged that bridge + fabric regressed in 0.74, likely due to D53406841.

Changelog: [Android][Fixed] Fix registration of ViewManagers in new renderer when not using lazyViewManagers.

Reviewed By: fkgozali

Differential Revision: D54551645

fbshipit-source-id: 0783030cd0d2900a3a254ae04c9ea4e51035272a
2024-03-11 10:39:14 +00:00
Oskar KwaśniewskiandAlex Hunt a9ec4203e1 fix(iOS) [0.74]: RCTRedBox not appearing in Bridgeless when metro is not running (#43147)
Summary:
When testing out `0.74.0-rc0` I found that when the metro is not running we are not displaying RedBox which bumps users to start the packager and reload the app. It also fixes the case where users try to reload by clicking the "Reload" button on RedBox.

## Before

https://github.com/facebook/react-native/assets/52801365/086c557f-ea1f-4a97-b4c7-df8a945cc7a0

## After

https://github.com/facebook/react-native/assets/52801365/9f8421b3-5e83-466f-8cdb-38f97981275d

## Changelog:

[IOS] [FIXED] - RCTRedBox not appearing in Bridgeless when metro is not running

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

Test Plan: Build the app without metro running check if RedBox is shown

Reviewed By: javache

Differential Revision: D54632056

Pulled By: dmytrorykun

fbshipit-source-id: fb6742898d3bd82545bfffd9175208e1a5984cb6
2024-03-11 10:37:10 +00:00
Pieter De BaetsandAlex Hunt bd39897abf Fix NullPointerException thrown on startup (#43293)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43293

Was debugging this, and found that this exception was being thrown due to `DefaultBindingsInstaller`, which was an invalid hybrid object. The ReactInstance initializer fully supports this being null, so let's use that as default.

Changelog: [Android][Fixed] NullPointerException is no longer ignored in MessageQueueThreadHandler

Reviewed By: sammy-SC

Differential Revision: D54434417

fbshipit-source-id: 52417b390061eface0f0578e32796d3a85303e03
2024-03-11 10:34:28 +00:00
Tomek ZawadzkiandAlex Hunt 7c2fb7911a Expose rrc_text via prefab (#43275)
Summary:
The `rrc_text` was not exposed via prefab. I'm adding it to make possible for react-native-live-markdown to integrate on top of React Native via prefab. Based on https://github.com/facebook/react-native/issues/36166.

## Changelog:

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

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

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

[ANDROID] [CHANGED] - Expose `rrc_text` via prefab.

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

Reviewed By: cipolleschi

Differential Revision: D54536468

Pulled By: cortinico

fbshipit-source-id: 8c4ef983467bfc46930f10bf7bd95761c2d11788
2024-03-11 10:33:39 +00:00
Tomek ZawadzkiandAlex Hunt 4dc9d54447 Expose rrc_textinput via prefab (#43274)
Summary:
The `rrc_textinput` was not exposed via prefab. I'm adding it to make possible for react-native-live-markdown to integrate on top of React Native via prefab. Based on https://github.com/facebook/react-native/issues/36166.

## Changelog:

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

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

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

[ANDROID] [CHANGED] - Expose `rrc_textinput` via prefab.

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

Reviewed By: cipolleschi

Differential Revision: D54482657

Pulled By: cortinico

fbshipit-source-id: ca7f4127f1808f841d88925238666e837de75bd0
2024-03-11 10:33:21 +00:00
Luna Wei 27b54bdcff local - podfile.lock update for rntester 2024-03-04 14:13:09 -08:00
Distiller c68669079a [0.74.0-rc.2] Bump version numbers 2024-03-04 19:42:11 +00:00
Luna Wei 1c1b03d6e8 bumped packages versions
#publish-packages-to-npm&0.74-stable
2024-03-04 11:29:35 -08:00
Luna Wei c7e704a0ef bumped packages versions
#publish-packages-to-npm&0.74-stable
2024-03-04 11:29:15 -08:00
Luna Wei 02d38e4eb5 bumped packages versions
#publish-packages-to-npm&0.74-stable
2024-03-04 11:28:55 -08:00
Luna Wei e063a1b0fb bumped packages versions
#publish-packages-to-npm&0.74-stable
2024-03-04 11:27:34 -08:00
Alex Hunt c09e4dacff Bump package versions
#publish-packages-to-npm&0.74-stable
2024-03-04 12:14:00 +00:00
Alex Hunt 011cb3a8d7 Update Podfile.lock 2024-03-04 12:11:28 +00:00
Riccardo CipolleschiandAlex Hunt a5b5f6be78 Rename PopupMenuAndroidNativeComponent.js to PopupMenuAndroidNativeComponent.android.js to fix CI
Summary:
This change renames `PopupMenuAndroidNativeComponent.js` to `PopupMenuAndroidNativeComponent.android.js`.

The reason is that, without the suffix, Codegen was reading the NativeComponent spec also for iOS, generating some invalid specs and making RNTester fail.

## Changelog:
[Android][Changed] - Rename `PopupMenuAndroidNativeComponent.js` to `PopupMenuAndroidNativeComponent.android.js`

Reviewed By: cortinico, dmytrorykun

Differential Revision: D54199736

fbshipit-source-id: 7fd67c4d38a69fe3a84c800c8ee5dcbd8c4f9a6c
2024-03-04 11:02:58 +00:00
Ramanpreet NaraandAlex Hunt 29b34e70e3 Pull PopupMenuAndroid out of React Native core
Summary:
**History:** This component was originally introduced into React Native core in D52712758, to replace UIManagerModule.showPopupMenu().

**Problem:** But, React Native core should be lean. Adding this component to React Native bloats the core.

**Changes:** So, this diff pulls PopupMenuAndroid out into its own package in the react-native GitHub repository.

In the future, this will be migrated to a community package!

Changelog: [Android][Removed] Move PopupMenu out of React Native core

Reviewed By: NickGerleman

Differential Revision: D53328110

fbshipit-source-id: 469d8dc3e756c06040c72e08fa004aafa1bd6e18
2024-03-04 11:02:52 +00:00
Nicola CortiandAlex Hunt 6294453980 Undo moving of TurboModule to internal and expose utility function for TurboModule.class.isAssignableFrom (#43219)
Summary:
After discussing with mdvacca, we prefer to undo the change of `TurboModule` package to `.internal` as this is a quite aggressive breaking change for the ecosystem.

Moreover: users should not invoke `TurboModule.class.isAssignableFrom` because `TurboModule` is `.internal`. Therefore I'm exposing another API to check if a class is a TurboModule as a static field of `ReactModuleInfo`.

## Changelog:

[INTERNAL] - Do not use TurboModule.class.isAssignableFrom

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

Test Plan: Tests are attached

Reviewed By: mdvacca, cipolleschi

Differential Revision: D54280882

Pulled By: cortinico

fbshipit-source-id: 9443c8aa23cf70dd5cfe574fe573d83313134358
2024-03-04 11:02:03 +00:00
Oskar KwaśniewskiandAlex Hunt 7822a7796f fix(iOS) [0.74]: properly warn about createRootViewWithBridge (#43146)
Summary:
This PR fixes an issue that `_logWarnIfCreateRootViewWithBridgeIsOverridden` was called in wrong place.

Assuming user overrides this method and call to `[super]`:

```objc
- (UIView *)createRootViewWithBridge:(RCTBridge *)bridge moduleName:(NSString *)moduleName initProps:(NSDictionary *)initProps {
  UIView *view = [super createRootViewWithBridge:bridge moduleName:moduleName initProps:initProps];
  view.backgroundColor = [UIColor redColor];
  return view;
}
```

This method still wasn't called in bridgeless (and not showing the error).

Checking if user overrides this method in `appDidFinishWithLaunching` works every time

![simulator_screenshot_0E22557C-CE37-4617-A25A-F39A6ED4D3D0](https://github.com/facebook/react-native/assets/52801365/d7865f37-32f0-40ad-a252-74ab7c5b7757)

## Changelog:

[IOS] [FIXED] - Properly warn about `createRootViewWithBridge` being deprecated

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

Test Plan: Check if warning is shown when message is overridden

Reviewed By: huntie

Differential Revision: D54303506

Pulled By: cipolleschi

fbshipit-source-id: cf30555c791493f28b3015a189cf93b60cace8f8
2024-03-04 11:01:37 +00:00
Riccardo CipolleschiandAlex Hunt 1ccc7a3e9e Deprecate getSurfacePresenter and getModuleRegistry in favor of their props
Summary:
This change align the `getSurfacePresenter` and `getModuleRegistry` to the iOS convention for which these should be computed properties with no `get` prefix in their name.

We want to land this change and to pick it in 0.74 so we can remove the `get` versions in 0.75.

## Changelog:
[iOS][Deprecated] - Deprecate `getSurfacePresenter` and `getModuleRegistry` for `surfacePresenter` and moduleRegistry` props.

Reviewed By: javache

Differential Revision: D54253805

fbshipit-source-id: e9ff7db744a73a3bd0f8ae1d87875e54ddd9a1a4
2024-03-04 11:01:15 +00:00
Dmitry RykunandAlex Hunt 987c1f2880 Fix findLibrariesFromReactNativeConfig
Summary:
This diff removes extra argument from the `extractLibrariesFromJSON` call inside `findLibrariesFromReactNativeConfig`.
This should fix the iOS failurte discribed in https://github.com/facebook/react-native/issues/43204
Changelog: [iOS][Fixed] - Codegen correctly handles react-native.config.js.

Reviewed By: cipolleschi

Differential Revision: D54248400

fbshipit-source-id: 2ae5d0d29f49725877559a5b0edd7d59f8bdefaa
2024-03-04 10:56:27 +00:00
Moti ZilbermanandAlex Hunt f6f3b5cb98 Restore Content-Length header in inspector-proxy JSON responses
Summary:
Changelog: [General][Fixed] Re-enable listing Hermes debugger targets in chrome://inspect, broken in 0.74 RC

Fixes https://github.com/facebook/react-native/issues/43259.

Reverts D52958725 and fixes the original `Content-Length` Unicode bug using a different approach.

Reviewed By: fabriziocucci

Differential Revision: D54409847

fbshipit-source-id: ed5bb464ab67f37535947646b124814d8bbf797c
2024-03-01 10:45:51 +00:00
Riccardo CipolleschiandAlex Hunt f7644be6d4 [RN][iOS]Rename BUILD_FROM_SOURCE to RCT_BUILD_HERMES_FROM_SOURCE 2024-02-29 10:48:01 +00:00
Distiller ad3f6b5274 [0.74.0-rc.1] Bump version numbers 2024-02-27 01:08:06 +00:00
Nicola Corti ba3cf235f5 bumped packages versions
#publish-packages-to-npm&0.74-stable
2024-02-26 16:54:52 -08:00
Cedric van PuttenandNicola Corti d032e35f86 feat(cli): warn underlying command when using npx react-native init (#43127)
Summary:
This adds a new warning for React Native 0.74, implementing the [RFC 0759](https://github.com/react-native-community/discussions-and-proposals/blob/nc/rnf/proposals/0759-react-native-frameworks.md#the-init-command) init command changes.

- It's added inside `react-native/cli.js` to avoid warning users when actually executing `npx react-native-community/cli` commands.
- The check is fairly simple: `process.argv[2] === 'init'`. The first two args are the Node bin and the actual script bin paths.
- The message is sent over `console.warn` to avoid potentially mixing JSON with non-JSON output.

## Changelog:

[GENERAL] [ADDED] - Warn with future command when using `npx react-native init`

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

Test Plan:
Any command other than `init` must not warn.

- `$ node ./path/to/react-native/cli.js init`
- `$ node ./path/to/react-native/cli.js init --help`
  - Should warn with `Running: npx react-native-community/cli init`
    ![image](https://github.com/facebook/react-native/assets/1203991/a3f5e3d2-7b59-41fe-9a53-bc9ce5a21fd1)
- `$ node ./path/to/react-native/cli.js --help`
  - Must not warn
    ![image](https://github.com/facebook/react-native/assets/1203991/97679429-db35-47f8-bdeb-33187bb167cf)

Reviewed By: cipolleschi

Differential Revision: D54063131

Pulled By: cortinico

fbshipit-source-id: c60b8b6034087b584e98b51f5bedf68a46caf44c
2024-02-26 11:47:20 -08:00
Nicola Corti b33b80f51c Bump CLI to 13.6.1 (#43153)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43153

This contains an hotfix for the CLI needed for 0.74

Changelog:
[Internal] [Changed] - Bump CLI to 13.6.1

Reviewed By: huntie

Differential Revision: D54073715

fbshipit-source-id: a5fdf02f47c5e144efc58e6b7fd355669a21e07b
2024-02-26 11:15:57 -08:00
Nicola Corti b3300d77ea Remove accidental files included inside the template.
Summary:
Those files should not stay in the root `/app` folder but inside the `/app/gradle/wrapper` folder.
I've noticed this in the Upgrade Helper UI hence I'm removing them.

Changelog:
[Internal] [Changed] - Remove accidental files included inside the template

Reviewed By: mdvacca

Differential Revision: D54122995

fbshipit-source-id: 8873a91ffbea20f609c7aabd428a815c77a38db5
2024-02-26 11:10:30 -08:00
Nicola Corti fde94ce307 Do not crash on onJSBundleLoadedFromServer when fast-refreshing on bridgeless mode
Summary:
RN-Tester is currently instacrashing on fast-refresh (pressing r on Metro) as it ends up on `onJSBundleLoadedFromServer`
which throws an exception on Bridgeless mode. I'm fixing it by following the same logic as `onReloadWithJSDebugger`.

Changelog:
[Android] [Fixed] - Do not crash on onJSBundleLoadedFromServer when fast-refreshing on bridgeless mode

Reviewed By: huntie

Differential Revision: D54121838

fbshipit-source-id: 82d98ec0c5b2295f5751525368c956574dd7f3a0
2024-02-26 11:10:23 -08:00
Diego SeguraandNicola Corti 1f7ed063c9 fix flatlist props being undefined in ios (#43141)
Summary:
When using Flatlist on iOS and Android its failing because props are undefined

The problem is described on https://github.com/facebook/react-native/issues/34783

![Captura de pantalla 2024-02-22 a las 4 13 11](https://github.com/facebook/react-native/assets/1161455/325738d9-2e49-44a0-bb6a-077b2e02e9cd)

![Captura de pantalla 2024-02-22 a las 4 14 58](https://github.com/facebook/react-native/assets/1161455/118f76e1-a818-428e-938e-123b55536b49)

Fixed by setting constructor before any statement and removing unnecessary props declaration at the top of the class.

## Changelog:

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

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[GENERAL] [FIXED] - Fix undefined props crash in FlatList

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

Reviewed By: javache

Differential Revision: D54069559

Pulled By: robhogan

fbshipit-source-id: b39cd9a273eb0279ed353f9efcb66a3c4ccf93b4
2024-02-26 11:09:34 -08:00
Nicola CortiandAlex Hunt 4def40ee33 Hook the default-app-setup OnLoad.cpp file with the cxxModuleProvider from RNCLI (#43049)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43049

This connects the OnLoad.cpp file used by OSS apps with the `rncli_cxxModuleProvider`.
This method is created by the CLI and takes care of querying all the TM CXX Modules discovered and returning them.

This PR is currently waiting on https://github.com/react-native-community/cli/pull/2296

Changelog:
[Internal] [Changed] - Hook the default-app-setup OnLoad.cpp file with the cxxModuleProvider from RNCLI

Reviewed By: cipolleschi

Differential Revision: D53812109

fbshipit-source-id: 47bc0ea699516993070cfa0127de97853acf8890
2024-02-22 11:01:50 +00:00
Riccardo CipolleschiandAlex Hunt 341fbe5486 [RN][Release] Fix release testing script 2024-02-21 17:55:37 +00:00
Distiller 898e207bcf [0.74.0-rc.0] Bump version numbers 2024-02-21 16:33:24 +00:00
Alex Hunt 619b8eb4d0 Bump package versions
#publish-packages-to-npm&0.74-stable
2024-02-21 15:20:42 +00:00
Alex Hunt ebca982365 Update Hermes version 2024-02-20 15:24:28 +00:00
439 changed files with 6585 additions and 3503 deletions
+11 -3
View File
@@ -12,15 +12,23 @@ parameters:
default: false
type: boolean
release_latest:
run_nightly_workflow:
default: false
type: boolean
release_version:
default: "9999"
default: ""
type: string
run_nightly_workflow:
release_monorepo_packages_version:
default: ""
type: string
release_tag:
default: ""
type: string
release_dry_run:
default: false
type: boolean
+3 -1
View File
@@ -31,7 +31,7 @@ commands:
- restore_cache:
key: *rbenv_cache_key
- run:
name: Bundle Install
name: Install the proper Ruby and run Bundle install
command: |
# Check if rbenv is installed. CircleCI is migrating to rbenv so we may not need to always install it.
@@ -58,8 +58,10 @@ commands:
# Set ruby dependencies
rbenv global << parameters.ruby_version >>
if [[ << parameters.ruby_version >> == "2.6.10" ]]; then
rbenv rehash
gem install bundler -v 2.4.22
else
rbenv rehash
gem install bundler
fi
bundle check || bundle install --path vendor/bundle --clean
+5 -5
View File
@@ -33,13 +33,13 @@ executors:
<<: *defaults
macos:
xcode: *xcode_version
resource_class: macos.x86.medium.gen2
resource_class: macos.m1.medium.gen1
environment:
- BUILD_FROM_SOURCE: true
- RCT_BUILD_HERMES_FROM_SOURCE: true
reactnativeios-lts:
<<: *defaults
macos:
xcode: '14.3.1'
resource_class: macos.x86.medium.gen2
xcode: '15.1'
resource_class: macos.m1.medium.gen1
environment:
- BUILD_FROM_SOURCE: true
- RCT_BUILD_HERMES_FROM_SOURCE: true
+69 -19
View File
@@ -116,7 +116,7 @@ jobs:
executor: reactnativeios
parameters:
ruby_version:
default: "2.7.7"
default: "2.7.8"
description: The version of ruby that must be used
type: string
steps:
@@ -599,7 +599,7 @@ jobs:
environment:
- HERMES_WS_DIR: *hermes_workspace_root
- HERMES_VERSION_FILE: "packages/react-native/sdks/.hermesversion"
- BUILD_FROM_SOURCE: true
- RCT_BUILD_HERMES_FROM_SOURCE: true
steps:
- run:
name: Install dependencies
@@ -780,7 +780,7 @@ jobs:
default: "iphoneos"
description: The Hermes Slice that this job has to build
type: enum
enum: ["macosx", "iphoneos", "iphonesimulator", "catalyst"]
enum: ["macosx", "iphoneos", "iphonesimulator", "catalyst", "xros", "xrsimulator"]
executor: reactnativeios
environment:
- HERMES_WS_DIR: *hermes_workspace_root
@@ -813,13 +813,18 @@ jobs:
exit 0
fi
export RELEASE_VERSION=$(cat /tmp/react-native-version)
if [[ "$SLICE" == "macosx" ]]; then
echo "[HERMES] Building Hermes for MacOS"
BUILD_TYPE="<< parameters.flavor >>" ./utils/build-mac-framework.sh
else
BUILD_TYPE="<< parameters.flavor >>" MACOSX_DEPLOYMENT_TARGET=10.15 ./utils/build-mac-framework.sh
elif [[ "$SLICE" == "xros" ]] || [[ "$SLICE" == "xrsimulator" ]]; then
echo "[HERMES] Building Hermes for XR: $SLICE"
BUILD_TYPE="<< parameters.flavor >>" XROS_DEPLOYMENT_TARGET=1.0 ./utils/build-ios-framework.sh "$SLICE"
elif [[ "$SLICE" == "iphoneos" ]] || [[ "$SLICE" == "iphonesimulator" ]] || [[ "$SLICE" == "catalyst" ]] ; then
echo "[HERMES] Building Hermes for iOS: $SLICE"
BUILD_TYPE="<< parameters.flavor >>" ./utils/build-ios-framework.sh "$SLICE"
BUILD_TYPE="<< parameters.flavor >>" IOS_DEPLOYMENT_TARGET=13.4 ./utils/build-ios-framework.sh "$SLICE"
fi
unset RELEASE_VERSION
echo "Moving from build_$SLICE to $FINAL_PATH"
mv build_"$SLICE" "$FINAL_PATH"
@@ -879,6 +884,10 @@ jobs:
key: << parameters.slice_base_cache_key >>-iphonesimulator-<< parameters.flavor >>
- restore_cache:
key: << parameters.slice_base_cache_key >>-catalyst-<< parameters.flavor >>
- restore_cache:
key: << parameters.slice_base_cache_key >>-xros-<< parameters.flavor >>
- restore_cache:
key: << parameters.slice_base_cache_key >>-xrsimulator-<< parameters.flavor >>
- run:
name: "Move back build folders"
command: |
@@ -887,6 +896,8 @@ jobs:
mv build_iphoneos_<< parameters.flavor >> build_iphoneos
mv build_iphonesimulator_<< parameters.flavor >> build_iphonesimulator
mv build_catalyst_<< parameters.flavor >> build_catalyst
mv build_xros_<< parameters.flavor >> build_xros
mv build_xrsimulator_<< parameters.flavor >> build_xrsimulator
- run:
name: "Prepare destroot folder"
command: |
@@ -898,7 +909,11 @@ jobs:
command: |
cd ./packages/react-native/sdks/hermes || exit 1
echo "[HERMES] Creating the universal framework"
export IOS_DEPLOYMENT_TARGET=13.4
export RELEASE_VERSION=$(cat /tmp/react-native-version)
./utils/build-ios-framework.sh build_framework
unset RELEASE_VERSION
unset IOS_DEPLOYMENT_TARGET
- run:
name: Package the Hermes Apple frameworks
command: |
@@ -933,6 +948,8 @@ jobs:
mkdir -p "$WORKING_DIR/catalyst"
mkdir -p "$WORKING_DIR/iphoneos"
mkdir -p "$WORKING_DIR/iphonesimulator"
mkdir -p "$WORKING_DIR/xros"
mkdir -p "$WORKING_DIR/xrsimulator"
cd ./packages/react-native/sdks/hermes || exit 1
@@ -941,6 +958,8 @@ jobs:
cp -r build_catalyst/$DSYM_FILE_PATH "$WORKING_DIR/catalyst/"
cp -r build_iphoneos/$DSYM_FILE_PATH "$WORKING_DIR/iphoneos/"
cp -r build_iphonesimulator/$DSYM_FILE_PATH "$WORKING_DIR/iphonesimulator/"
cp -r build_xrsimulator/$DSYM_FILE_PATH "$WORKING_DIR/xrsimulator/"
cp -r build_xros/$DSYM_FILE_PATH "$WORKING_DIR/xros/"
DEST_DIR="/tmp/hermes/dSYM/$FLAVOR"
tar -C "$WORKING_DIR" -czvf "hermes.framework.dSYM" .
@@ -1076,14 +1095,20 @@ jobs:
# -------------------------
# JOBS: Releases
# -------------------------
prepare_package_for_release:
# Writes a new commit and tag(s), which will trigger the `publish_release`
# and `publish_bumped_packages` workflows.
prepare_release:
parameters:
version:
type: string
latest:
type: boolean
default: false
dryrun:
# TODO(T182538198): Required for 0.74.x, where workspace packages are out
# of sync with react-native. This will be removed for 0.75+.
monorepo_packages_version:
type: string
tag:
type: string
dry_run:
type: boolean
default: false
executor: reactnativeios
@@ -1096,16 +1121,41 @@ jobs:
- brew_install:
package: cmake
- run:
name: "Set new react-native version and commit changes"
name: Versioning workspace packages
command: |
VERSION=<< parameters.version >>
node scripts/releases/set-version "<< parameters.monorepo_packages_version >>" --skip-react-native-version
- run:
name: Versioning react-native package
command: |
node scripts/releases/set-rn-version.js -v "<< parameters.version >>" --build-type "release"
- run:
name: Creating release commit
command: |
# I'm seeing failures in automatically detect the email for the
# agent that should push the commit.
git config --global user.name "Distiller"
git config --global user.email "distiller@circleci.com"
if [[ -z "$VERSION" ]]; then
VERSION=$(grep '"version"' package.json | cut -d '"' -f 4 | head -1)
echo "Using the version from the package.json: $VERSION"
fi
node ./scripts/releases-ci/prepare-package-for-release.js -v "$VERSION" -l << parameters.latest >> --dry-run << parameters.dryrun >>
git commit -a -m "Release << parameters.version >>" -m "#publish-packages-to-npm&<< parameters.tag >>"
git tag -a "v<< parameters.version >>" -m "v<< parameters.version >>"
env GIT_PAGER=cat git show HEAD
- when:
condition:
equal: ["latest", << parameters.tag >>]
steps:
- run:
name: Updating "latest" tag
command: |
git tag -d "latest"
git push origin :latest
git tag -a "latest" -m "latest"
- unless:
condition: << parameters.dry_run >>
steps:
run:
name: Pushing release commit
command: |
git push origin $CIRCLE_BRANCH --follow-tags
build_npm_package:
parameters:
@@ -4,11 +4,12 @@
- equal: [ false, << pipeline.parameters.run_release_workflow >> ]
- equal: [ false, << pipeline.parameters.run_nightly_workflow >> ]
jobs:
- prepare_package_for_release:
name: prepare_package_for_release
version: ''
latest : false
dryrun: true
- prepare_release:
name: "prepare_release (dry run test)"
version: "0.0.0"
monorepo_packages_version: "0.0.0"
tag: test
dry_run: true
- prepare_hermes_workspace
- build_android:
release_type: "dry-run"
@@ -24,7 +25,7 @@
matrix:
parameters:
flavor: ["Debug", "Release"]
slice: ["macosx", "iphoneos", "iphonesimulator", "catalyst"]
slice: ["macosx", "iphoneos", "iphonesimulator", "catalyst", "xros", "xrsimulator"]
- build_hermes_macos:
requires:
- build_apple_slices_hermes
@@ -56,8 +57,8 @@
- test_ios_template:
requires:
- build_npm_package
name: "Test Template with Ruby 3.2.0"
ruby_version: "3.2.0"
name: "Test Template with Ruby 3.2.2"
ruby_version: "3.2.2"
architecture: "NewArch"
flavor: "Debug"
executor: reactnativeios-lts
@@ -71,15 +72,15 @@
jsengine: ["Hermes", "JSC"]
use_frameworks: ["StaticLibraries", "DynamicFrameworks"]
exclude:
# This config is tested with Ruby 3.2.0. Let's not double test it.
# This config is tested with Ruby 3.2.2. Let's not double test it.
- flavor: "Debug"
jsengine: "Hermes"
use_frameworks: "StaticLibraries"
- test_ios_rntester:
requires:
- build_hermes_macos
name: "Test RNTester with Ruby 3.2.0"
ruby_version: "3.2.0"
name: "Test RNTester with Ruby 3.2.2"
ruby_version: "3.2.2"
executor: reactnativeios-lts
- test_ios_rntester:
requires:
@@ -95,11 +96,11 @@
# Tested by test_ios-JSC
- jsengine: "JSC"
use_frameworks: "StaticLibraries"
# Tested with Ruby 3.2.0, do not test this twice.
# Tested with Ruby 3.2.2, do not test this twice.
- jsengine: "Hermes"
use_frameworks: "StaticLibraries"
- test_ios_rntester:
run_unit_tests: true
run_unit_tests: false
use_frameworks: "StaticLibraries"
ruby_version: "2.6.10"
requires:
@@ -4,11 +4,12 @@
- equal: [ false, << pipeline.parameters.run_release_workflow >> ]
- equal: [ false, << pipeline.parameters.run_nightly_workflow >> ]
jobs:
- prepare_package_for_release:
name: prepare_package_for_release
version: ''
latest : false
dryrun: true
- prepare_release:
name: "prepare_release (dry run test)"
version: "0.0.0"
monorepo_packages_version: "0.0.0"
tag: test
dry_run: true
- prepare_hermes_workspace
- build_android:
release_type: "dry-run"
@@ -24,7 +25,7 @@
matrix:
parameters:
flavor: ["Debug", "Release"]
slice: ["macosx", "iphoneos", "iphonesimulator", "catalyst"]
slice: ["macosx", "iphoneos", "iphonesimulator", "catalyst", "xros", "xrsimulator"]
- build_hermes_macos:
requires:
- build_apple_slices_hermes
@@ -5,5 +5,5 @@
- equal: [ false, << pipeline.parameters.run_nightly_workflow >> ]
jobs:
- test_e2e_ios:
ruby_version: "2.7.7"
ruby_version: "2.7.8"
- test_e2e_android
@@ -4,11 +4,12 @@
- equal: [ false, << pipeline.parameters.run_release_workflow >> ]
- equal: [ false, << pipeline.parameters.run_nightly_workflow >> ]
jobs:
- prepare_package_for_release:
name: prepare_package_for_release
version: ''
latest : false
dryrun: true
- prepare_release:
name: "prepare_release (dry run test)"
version: "0.0.0"
monorepo_packages_version: "0.0.0"
tag: test
dry_run: true
- prepare_hermes_workspace
- build_android:
release_type: "dry-run"
@@ -24,7 +25,7 @@
matrix:
parameters:
flavor: ["Debug", "Release"]
slice: ["macosx", "iphoneos", "iphonesimulator", "catalyst"]
slice: ["macosx", "iphoneos", "iphonesimulator", "catalyst", "xros", "xrsimulator"]
- build_hermes_macos:
requires:
- build_apple_slices_hermes
@@ -47,8 +48,8 @@
- test_ios_template:
requires:
- build_npm_package
name: "Test Template with Ruby 3.2.0"
ruby_version: "3.2.0"
name: "Test Template with Ruby 3.2.2"
ruby_version: "3.2.2"
architecture: "NewArch"
flavor: "Debug"
executor: reactnativeios-lts
@@ -62,15 +63,15 @@
jsengine: ["Hermes", "JSC"]
use_frameworks: ["StaticLibraries", "DynamicFrameworks"]
exclude:
# Tested with Ruby 3.2.0, let's not double test this
# Tested with Ruby 3.2.2, let's not double test this
- flavor: "Debug"
jsengine: "Hermes"
use_frameworks: "StaticLibraries"
- test_ios_rntester:
requires:
- build_hermes_macos
name: "RNTester on Ruby 3.2.0"
ruby_version: "3.2.0"
name: "RNTester on Ruby 3.2.2"
ruby_version: "3.2.2"
executor: reactnativeios-lts
- test_ios_rntester:
name: "RNTester with Dynamic Frameworks"
@@ -82,7 +83,7 @@
jsengine: ["Hermes", "JSC"]
- test_ios_rntester:
name: "RNTester Integration Tests"
run_unit_tests: true
run_unit_tests: false
use_frameworks: "StaticLibraries"
ruby_version: "2.6.10"
requires:
+31 -23
View File
@@ -59,7 +59,7 @@ references:
# Dependency Anchors
# -------------------------
dependency_versions:
xcode_version: &xcode_version "15.0.1"
xcode_version: &xcode_version "15.2"
nodelts_image: &nodelts_image "cimg/node:20.2.0"
nodeprevlts_image: &nodeprevlts_image "cimg/node:18.12.1"
nodelts_browser_image: &nodelts_browser_image "cimg/node:20.2.0-browsers"
@@ -71,32 +71,32 @@ references:
cache_keys:
checkout_cache_key: &checkout_cache_key v1-checkout
gems_cache_key: &gems_cache_key v1-gems-{{ checksum "Gemfile.lock" }}
gems_cache_key: &gems_cache_key v1-gems-{{ arch }}-{{ checksum "Gemfile.lock" }}
gradle_cache_key: &gradle_cache_key v3-gradle-{{ .Environment.CIRCLE_JOB }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}-{{ checksum "packages/react-native/ReactAndroid/gradle.properties" }}
yarn_cache_key: &yarn_cache_key v6-yarn-cache-{{ .Environment.CIRCLE_JOB }}
rbenv_cache_key: &rbenv_cache_key v1-rbenv-{{ checksum "/tmp/required_ruby" }}
hermes_workspace_cache_key: &hermes_workspace_cache_key v5-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/hermes/hermesversion" }}
hermes_workspace_debug_cache_key: &hermes_workspace_debug_cache_key v2-hermes-{{ .Environment.CIRCLE_JOB }}-debug-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}-{{ checksum "packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh" }}
hermes_workspace_release_cache_key: &hermes_workspace_release_cache_key v2-hermes-{{ .Environment.CIRCLE_JOB }}-release-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}-{{ checksum "packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh" }}
yarn_cache_key: &yarn_cache_key v7-yarn-cache-{{ .Environment.CIRCLE_JOB }}
rbenv_cache_key: &rbenv_cache_key v1-rbenv-{{ arch }}-{{ checksum "/tmp/required_ruby" }}
hermes_workspace_cache_key: &hermes_workspace_cache_key v8-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/hermes/hermesversion" }}
hermes_workspace_debug_cache_key: &hermes_workspace_debug_cache_key v5-hermes-{{ .Environment.CIRCLE_JOB }}-debug-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}-{{ checksum "packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh" }}
hermes_workspace_release_cache_key: &hermes_workspace_release_cache_key v5-hermes-{{ .Environment.CIRCLE_JOB }}-release-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}-{{ checksum "packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh" }}
hermes_linux_cache_key: &hermes_linux_cache_key v1-hermes-{{ .Environment.CIRCLE_JOB }}-linux-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
hermes_windows_cache_key: &hermes_windows_cache_key v2-hermes-{{ .Environment.CIRCLE_JOB }}-windows-{{ checksum "/Users/circleci/project/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
# Hermes iOS
hermesc_apple_cache_key: &hermesc_apple_cache_key v3-hermesc-apple-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
hermes_apple_slices_cache_key: &hermes_apple_slices_cache_key v4-hermes-apple-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}-{{ checksum "packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh" }}
hermes_tarball_debug_cache_key: &hermes_tarball_debug_cache_key v5-hermes-tarball-debug-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}-{{ checksum "packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh" }}
hermes_tarball_release_cache_key: &hermes_tarball_release_cache_key v4-hermes-tarball-release-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}-{{ checksum "packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh" }}
hermes_macosx_bin_release_cache_key: &hermes_macosx_bin_release_cache_key v2-hermes-release-macosx-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
hermes_macosx_bin_debug_cache_key: &hermes_macosx_bin_debug_cache_key v2-hermes-debug-macosx-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
hermes_dsym_debug_cache_key: &hermes_dsym_debug_cache_key v2-hermes-debug-dsym-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
hermes_dsym_release_cache_key: &hermes_dsym_release_cache_key v2-hermes-release-dsym-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
hermesc_apple_cache_key: &hermesc_apple_cache_key v4-hermesc-apple-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
hermes_apple_slices_cache_key: &hermes_apple_slices_cache_key v13-hermes-apple-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}-{{ checksum "packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh" }}
hermes_tarball_debug_cache_key: &hermes_tarball_debug_cache_key v10-hermes-tarball-debug-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}-{{ checksum "packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh" }}
hermes_tarball_release_cache_key: &hermes_tarball_release_cache_key v9-hermes-tarball-release-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}-{{ checksum "packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh" }}
hermes_macosx_bin_release_cache_key: &hermes_macosx_bin_release_cache_key v5-hermes-release-macosx-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
hermes_macosx_bin_debug_cache_key: &hermes_macosx_bin_debug_cache_key v3-hermes-debug-macosx-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
hermes_dsym_debug_cache_key: &hermes_dsym_debug_cache_key v4-hermes-debug-dsym-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
hermes_dsym_release_cache_key: &hermes_dsym_release_cache_key v4-hermes-release-dsym-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
# Cocoapods - RNTester
pods_cache_key: &pods_cache_key v11-pods-{{ .Environment.CIRCLE_JOB }}-{{ checksum "packages/rn-tester/Podfile.lock.bak" }}-{{ checksum "packages/rn-tester/Podfile" }}
cocoapods_cache_key: &cocoapods_cache_key v11-cocoapods-{{ .Environment.CIRCLE_JOB }}-{{ checksum "packages/rn-tester/Podfile.lock" }}-{{ checksum "packages/rn-tester/Podfile" }}-{{ checksum "/tmp/hermes/hermesversion" }}
rntester_podfile_lock_cache_key: &rntester_podfile_lock_cache_key v9-podfilelock-{{ .Environment.CIRCLE_JOB }}-{{ checksum "packages/rn-tester/Podfile" }}-{{ checksum "/tmp/week_year" }}-{{ checksum "/tmp/hermes/hermesversion" }}
pods_cache_key: &pods_cache_key v12-pods-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "packages/rn-tester/Podfile.lock.bak" }}-{{ checksum "packages/rn-tester/Podfile" }}
cocoapods_cache_key: &cocoapods_cache_key v12-cocoapods-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "packages/rn-tester/Podfile.lock" }}-{{ checksum "packages/rn-tester/Podfile" }}-{{ checksum "/tmp/hermes/hermesversion" }}
rntester_podfile_lock_cache_key: &rntester_podfile_lock_cache_key v10-podfilelock-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "packages/rn-tester/Podfile" }}-{{ checksum "/tmp/week_year" }}-{{ checksum "/tmp/hermes/hermesversion" }}
# Cocoapods - Template
template_cocoapods_cache_key: &template_cocoapods_cache_key v6-cocoapods-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/iOSTemplateProject/ios/Podfile.lock" }}-{{ checksum "/tmp/iOSTemplateProject/ios/Podfile" }}-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "packages/rn-tester/Podfile.lock" }}
template_podfile_lock_cache_key: &template_podfile_lock_cache_key v6-podfilelock-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/iOSTemplateProject/ios/Podfile" }}-{{ checksum "/tmp/week_year" }}-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "packages/rn-tester/Podfile.lock" }}
template_cocoapods_cache_key: &template_cocoapods_cache_key v6-cocoapods-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/iOSTemplateProject/ios/Podfile.lock" }}-{{ checksum "/tmp/iOSTemplateProject/ios/Podfile" }}-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "packages/rn-tester/Podfile.lock" }}
template_podfile_lock_cache_key: &template_podfile_lock_cache_key v6-podfilelock-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/iOSTemplateProject/ios/Podfile" }}-{{ checksum "/tmp/week_year" }}-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "packages/rn-tester/Podfile.lock" }}
cache_paths:
hermes_workspace_macos_cache_paths: &hermes_workspace_macos_cache_paths
@@ -129,14 +129,22 @@ parameters:
default: false
type: boolean
release_latest:
run_nightly_workflow:
default: false
type: boolean
release_version:
default: "9999"
default: ""
type: string
run_nightly_workflow:
release_monorepo_packages_version:
default: ""
type: string
release_tag:
default: ""
type: string
release_dry_run:
default: false
type: boolean
+7 -6
View File
@@ -15,15 +15,16 @@
workflows:
version: 2
# This workflow should only be triggered by release script
package_release:
# Release workflow, triggered by `yarn trigger-react-native-release`
create_release:
when: << pipeline.parameters.run_release_workflow >>
jobs:
# This job will push a tag that will trigger the publish_release workflow
- prepare_package_for_release:
name: prepare_package_for_release
- prepare_release:
name: prepare_release
version: << pipeline.parameters.release_version >>
latest : << pipeline.parameters.release_latest >>
monorepo_packages_version: << pipeline.parameters.release_monorepo_packages_version >>
tag: << pipeline.parameters.release_tag >>
dry_run: << pipeline.parameters.release_dry_run >>
# This job will run only when a tag is published due to all the jobs being filtered.
publish_release:
+1
View File
@@ -42,6 +42,7 @@ project.xcworkspace
/packages/react-native/ReactAndroid/hermes-engine/.cxx/
/packages/react-native/template/android/app/build/
/packages/react-native/template/android/build/
/packages/react-native-popup-menu-android/android/build/
# Buck
.buckd
+3
View File
@@ -44,6 +44,9 @@ declare module 'chrome-launcher' {
declare class Launcher {
getChromePath(): string;
launch(options: Options): Promise<LaunchedChrome>;
Launcher: {
defaultFlags(): Array<string>,
};
}
declare module.exports: Launcher;
+7 -7
View File
@@ -14,7 +14,6 @@
"android": "cd packages/rn-tester && npm run android",
"build-android": "./gradlew :packages:react-native:ReactAndroid:build",
"build": "node ./scripts/build/build.js",
"bump-all-updated-packages": "node ./scripts/monorepo/bump-all-updated-packages",
"clang-format": "clang-format -i --glob=*/**/*.{h,cpp,m,mm}",
"clean": "node ./scripts/build/clean.js",
"flow-check": "flow check",
@@ -59,11 +58,11 @@
"@definitelytyped/dtslint": "^0.0.127",
"@jest/create-cache-key-function": "^29.6.3",
"@pkgjs/parseargs": "^0.11.0",
"@react-native/metro-babel-transformer": "0.74.0",
"@react-native/metro-config": "0.74.0",
"@react-native/metro-babel-transformer": "0.74.88",
"@react-native/metro-config": "0.74.88",
"@tsconfig/node18": "1.0.1",
"@types/react": "^18.0.18",
"@typescript-eslint/parser": "^6.7.4",
"@types/react": "^18.2.6",
"@typescript-eslint/parser": "^7.1.1",
"ansi-styles": "^4.2.1",
"async": "^3.2.2",
"babel-plugin-minify-dead-code-elimination": "^0.5.2",
@@ -78,7 +77,7 @@
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-ft-flow": "^2.0.1",
"eslint-plugin-jest": "^26.5.3",
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-jsx-a11y": "^6.6.0",
"eslint-plugin-lint": "^1.0.0",
"eslint-plugin-prettier": "^4.2.1",
@@ -113,5 +112,6 @@
"supports-color": "^7.1.0",
"typescript": "5.0.4",
"ws": "^6.2.2"
}
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/assets-registry",
"version": "0.74.0",
"version": "0.74.88",
"description": "Asset support code for React Native.",
"license": "MIT",
"repository": {
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/babel-plugin-codegen",
"version": "0.74.0",
"version": "0.74.88",
"description": "Babel plugin to generate native module and view manager code for React Native.",
"license": "MIT",
"repository": {
@@ -25,7 +25,7 @@
"index.js"
],
"dependencies": {
"@react-native/codegen": "0.74.0"
"@react-native/codegen": "0.74.88"
},
"devDependencies": {
"@babel/core": "^7.20.0"
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/community-cli-plugin",
"version": "0.74.0",
"version": "0.74.88",
"description": "Core CLI commands for React Native",
"keywords": [
"react-native",
@@ -22,10 +22,10 @@
"dist"
],
"dependencies": {
"@react-native-community/cli-server-api": "13.6.0",
"@react-native-community/cli-tools": "13.6.0",
"@react-native/dev-middleware": "0.74.0",
"@react-native/metro-babel-transformer": "0.74.0",
"@react-native-community/cli-server-api": "13.6.9",
"@react-native-community/cli-tools": "13.6.9",
"@react-native/dev-middleware": "0.74.88",
"@react-native/metro-babel-transformer": "0.74.88",
"chalk": "^4.0.0",
"execa": "^5.1.1",
"metro": "^0.80.3",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/debugger-frontend",
"version": "0.74.0",
"version": "0.74.88",
"description": "Debugger frontend for React Native based on Chrome DevTools",
"keywords": [
"react-native",
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/dev-middleware",
"version": "0.74.0",
"version": "0.74.88",
"description": "Dev server middleware for React Native",
"keywords": [
"react-native",
@@ -23,7 +23,7 @@
],
"dependencies": {
"@isaacs/ttlcache": "^1.4.1",
"@react-native/debugger-frontend": "0.74.0",
"@react-native/debugger-frontend": "0.74.88",
"@rnx-kit/chromium-edge-launcher": "^1.0.0",
"chrome-launcher": "^0.15.2",
"connect": "^3.6.5",
@@ -0,0 +1,394 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
* @oncall react_native
*/
import {fetchJson} from './FetchUtils';
import {createDebuggerMock} from './InspectorDebuggerUtils';
import {createDeviceMock} from './InspectorDeviceUtils';
import {createAndConnectTarget} from './InspectorProtocolUtils';
import {withAbortSignalForEachTest} from './ResourceUtils';
import {baseUrlForServer, createServer} from './ServerUtils';
import invariant from 'invariant';
import until from 'wait-for-expect';
// WebSocket is unreliable when using fake timers.
jest.useRealTimers();
jest.setTimeout(10000);
describe('inspector proxy device message middleware', () => {
const autoCleanup = withAbortSignalForEachTest();
const page = {
id: 'page1',
app: 'bar-app',
title: 'bar-title',
vm: 'bar-vm',
};
afterEach(() => {
jest.clearAllMocks();
});
test('middleware is created with device, debugger, and page information', async () => {
const createCustomMessageHandler = jest.fn().mockImplementation(() => null);
const {server} = await createServer({
logger: undefined,
projectRoot: '',
unstable_customInspectorMessageHandler: createCustomMessageHandler,
});
let device, debugger_;
try {
({device, debugger_} = await createAndConnectTarget(
serverRefUrls(server),
autoCleanup.signal,
page,
));
// Ensure the middleware was created with the device information
await until(() =>
expect(createCustomMessageHandler).toBeCalledWith(
expect.objectContaining({
page: expect.objectContaining({
...page,
capabilities: expect.any(Object),
}),
device: expect.objectContaining({
appId: expect.any(String),
id: expect.any(String),
name: expect.any(String),
sendMessage: expect.any(Function),
}),
debugger: expect.objectContaining({
userAgent: null,
sendMessage: expect.any(Function),
}),
}),
),
);
} finally {
device?.close();
debugger_?.close();
await closeServer(server);
}
});
test('middleware is created with device, debugger, and page information for synthetic reloadable page', async () => {
const createCustomMessageHandler = jest.fn().mockImplementation(() => null);
const {server} = await createServer({
logger: undefined,
projectRoot: '',
unstable_customInspectorMessageHandler: createCustomMessageHandler,
});
const {serverBaseUrl, serverBaseWsUrl} = serverRefUrls(server);
let device, debugger_;
try {
device = await createDeviceMock(
`${serverBaseWsUrl}/inspector/device?device=device1&name=foo&app=bar`,
autoCleanup.signal,
);
// Mock the device to return a normal React (Native) page
device.getPages.mockImplementation(() => [
{
...page,
// NOTE: 'React' is a magic string used to detect React Native pages.
title: 'React Native (mock)',
},
]);
// Retrieve the full page list from device
let pageList;
await until(async () => {
pageList = (await fetchJson(
`${serverBaseUrl}/json`,
// $FlowIgnore[unclear-type]
): any);
expect(pageList.length).toBeGreaterThan(0);
});
invariant(pageList != null, '');
// Find the synthetic page
const syntheticPage = pageList.find(
({title}) =>
// NOTE: Magic string used for the synthetic page that has a stable ID
title === 'React Native Experimental (Improved Chrome Reloads)',
);
expect(syntheticPage).not.toBeUndefined();
// Connect the debugger to this synthetic page
debugger_ = await createDebuggerMock(
syntheticPage.webSocketDebuggerUrl,
autoCleanup.signal,
);
// Ensure the middleware was created with the device information
await until(() =>
expect(createCustomMessageHandler).toBeCalledWith(
expect.objectContaining({
page: expect.objectContaining({
id: expect.any(String),
title: syntheticPage.title,
vm: syntheticPage.vm,
app: expect.any(String),
capabilities: expect.any(Object),
}),
device: expect.objectContaining({
appId: expect.any(String),
id: expect.any(String),
name: expect.any(String),
sendMessage: expect.any(Function),
}),
debugger: expect.objectContaining({
userAgent: null,
sendMessage: expect.any(Function),
}),
}),
),
);
} finally {
device?.close();
debugger_?.close();
await closeServer(server);
}
});
test('send message functions are passing messages to sockets', async () => {
const handleDebuggerMessage = jest.fn();
const handleDeviceMessage = jest.fn();
const createCustomMessageHandler = jest.fn().mockImplementation(() => ({
handleDebuggerMessage,
handleDeviceMessage,
}));
const {server} = await createServer({
logger: undefined,
projectRoot: '',
unstable_customInspectorMessageHandler: createCustomMessageHandler,
});
let device, debugger_;
try {
({device, debugger_} = await createAndConnectTarget(
serverRefUrls(server),
autoCleanup.signal,
page,
));
// Ensure the middleware was created with the send message methods
await until(() =>
expect(createCustomMessageHandler).toBeCalledWith(
expect.objectContaining({
device: expect.objectContaining({
sendMessage: expect.any(Function),
}),
debugger: expect.objectContaining({
sendMessage: expect.any(Function),
}),
}),
),
);
// Send a message to the device
createCustomMessageHandler.mock.calls[0][0].device.sendMessage({
id: 1,
});
// Ensure the device received the message
await until(() =>
expect(device.wrappedEvent).toBeCalledWith({
event: 'wrappedEvent',
payload: {
pageId: page.id,
wrappedEvent: JSON.stringify({id: 1}),
},
}),
);
// Send a message to the debugger
createCustomMessageHandler.mock.calls[0][0].debugger.sendMessage({
id: 2,
});
// Ensure the debugger received the message
await until(() =>
expect(debugger_.handle).toBeCalledWith({
id: 2,
}),
);
} finally {
device?.close();
debugger_?.close();
await closeServer(server);
}
});
test('device message is passed to message middleware', async () => {
const handleDeviceMessage = jest.fn();
const {server} = await createServer({
logger: undefined,
projectRoot: '',
unstable_customInspectorMessageHandler: () => ({
handleDeviceMessage,
handleDebuggerMessage() {},
}),
});
let device, debugger_;
try {
({device, debugger_} = await createAndConnectTarget(
serverRefUrls(server),
autoCleanup.signal,
page,
));
// Send a message from the device, and ensure the middleware received it
device.sendWrappedEvent(page.id, {id: 1337});
// Ensure the debugger received the message
await until(() => expect(debugger_.handle).toBeCalledWith({id: 1337}));
// Ensure the middleware received the message
await until(() => expect(handleDeviceMessage).toBeCalled());
} finally {
device?.close();
debugger_?.close();
await closeServer(server);
}
});
test('device message stops propagating when handled by middleware', async () => {
const handleDeviceMessage = jest.fn();
const {server} = await createServer({
logger: undefined,
projectRoot: '',
unstable_customInspectorMessageHandler: () => ({
handleDeviceMessage,
handleDebuggerMessage() {},
}),
});
let device, debugger_;
try {
({device, debugger_} = await createAndConnectTarget(
serverRefUrls(server),
autoCleanup.signal,
page,
));
// Stop the first message from propagating by returning true (once) from middleware
handleDeviceMessage.mockReturnValueOnce(true);
// Send the first message which should NOT be received by the debugger
device.sendWrappedEvent(page.id, {id: -1});
await until(() => expect(handleDeviceMessage).toBeCalled());
// Send the second message which should be received by the debugger
device.sendWrappedEvent(page.id, {id: 1337});
// Ensure only the last message was received by the debugger
await until(() => expect(debugger_.handle).toBeCalledWith({id: 1337}));
// Ensure the first message was not received by the debugger
expect(debugger_.handle).not.toBeCalledWith({id: -1});
} finally {
device?.close();
debugger_?.close();
await closeServer(server);
}
});
test('debugger message is passed to message middleware', async () => {
const handleDebuggerMessage = jest.fn();
const {server} = await createServer({
logger: undefined,
projectRoot: '',
unstable_customInspectorMessageHandler: () => ({
handleDeviceMessage() {},
handleDebuggerMessage,
}),
});
let device, debugger_;
try {
({device, debugger_} = await createAndConnectTarget(
serverRefUrls(server),
autoCleanup.signal,
page,
));
// Send a message from the debugger
const message = {
method: 'Runtime.enable',
id: 1337,
};
debugger_.send(message);
// Ensure the device received the message
await until(() => expect(device.wrappedEvent).toBeCalled());
// Ensure the middleware received the message
await until(() => expect(handleDebuggerMessage).toBeCalledWith(message));
} finally {
device?.close();
debugger_?.close();
await closeServer(server);
}
});
test('debugger message stops propagating when handled by middleware', async () => {
const handleDebuggerMessage = jest.fn();
const {server} = await createServer({
logger: undefined,
projectRoot: '',
unstable_customInspectorMessageHandler: () => ({
handleDeviceMessage() {},
handleDebuggerMessage,
}),
});
let device, debugger_;
try {
({device, debugger_} = await createAndConnectTarget(
serverRefUrls(server),
autoCleanup.signal,
page,
));
// Stop the first message from propagating by returning true (once) from middleware
handleDebuggerMessage.mockReturnValueOnce(true);
// Send the first emssage which should not be received by the device
debugger_.send({id: -1});
// Send the second message which should be received by the device
debugger_.send({id: 1337});
// Ensure only the last message was received by the device
await until(() =>
expect(device.wrappedEvent).toBeCalledWith({
event: 'wrappedEvent',
payload: {pageId: page.id, wrappedEvent: JSON.stringify({id: 1337})},
}),
);
// Ensure the first message was not received by the device
expect(device.wrappedEvent).not.toBeCalledWith({id: -1});
} finally {
device?.close();
debugger_?.close();
await closeServer(server);
}
});
});
function serverRefUrls(server: http$Server | https$Server) {
return {
serverBaseUrl: baseUrlForServer(server, 'http'),
serverBaseWsUrl: baseUrlForServer(server, 'ws'),
};
}
async function closeServer(server: http$Server | https$Server): Promise<void> {
return new Promise(resolve => server.close(() => resolve()));
}
@@ -14,11 +14,13 @@ import type {
JsonVersionResponse,
} from '../inspector-proxy/types';
import {fetchJson} from './FetchUtils';
import {fetchJson, fetchLocal} from './FetchUtils';
import {createDeviceMock} from './InspectorDeviceUtils';
import {withAbortSignalForEachTest} from './ResourceUtils';
import {withServerForEachTest} from './ServerUtils';
import nullthrows from 'nullthrows';
// Must be greater than or equal to PAGES_POLLING_INTERVAL in `InspectorProxy.js`.
const PAGES_POLLING_DELAY = 1000;
@@ -309,5 +311,67 @@ describe('inspector proxy HTTP API', () => {
}
});
});
test('handles Unicode data safely', async () => {
const device = await createDeviceMock(
`${serverRef.serverBaseWsUrl}/inspector/device?device=device1&name=foo&app=bar`,
autoCleanup.signal,
);
try {
device.getPages.mockImplementation(() => [
{
app: 'bar-app 📱',
id: 'page1 🛂',
title: 'bar-title 📰',
vm: 'bar-vm 🤖',
},
]);
jest.advanceTimersByTime(PAGES_POLLING_DELAY);
const json = await fetchJson<JsonPagesListResponse>(
`${serverRef.serverBaseUrl}${endpoint}`,
);
expect(json).toEqual([
expect.objectContaining({
description: 'bar-app 📱',
deviceName: 'foo',
id: 'device1-page1 🛂',
title: 'bar-title 📰',
vm: 'bar-vm 🤖',
}),
]);
} finally {
device.close();
}
});
test('includes a valid Content-Length header', async () => {
// NOTE: This test is needed because chrome://inspect's HTTP client is picky
// and doesn't accept responses without a Content-Length header.
const device = await createDeviceMock(
`${serverRef.serverBaseWsUrl}/inspector/device?device=device1&name=foo&app=bar`,
autoCleanup.signal,
);
try {
device.getPages.mockImplementation(() => [
{
app: 'bar-app',
id: 'page1',
title: 'bar-title',
vm: 'bar-vm',
},
]);
jest.advanceTimersByTime(PAGES_POLLING_DELAY);
const response = await fetchLocal(
`${serverRef.serverBaseUrl}${endpoint}`,
);
expect(response.headers.get('Content-Length')).not.toBeNull();
} finally {
device.close();
}
});
});
});
@@ -9,6 +9,7 @@
* @oncall react_native
*/
import type {CreateCustomMessageHandlerFn} from './inspector-proxy/CustomMessageHandler';
import type {BrowserLauncher} from './types/BrowserLauncher';
import type {EventReporter} from './types/EventReporter';
import type {Experiments, ExperimentsConfig} from './types/Experiments';
@@ -61,11 +62,12 @@ type Options = $ReadOnly<{
unstable_experiments?: ExperimentsConfig,
/**
* An interface for using a modified inspector proxy implementation.
* Create custom handler to add support for unsupported CDP events, or debuggers.
* This handler is instantiated per logical device and debugger pair.
*
* This is an unstable API with no semver guarantees.
*/
unstable_InspectorProxy?: Class<InspectorProxy>,
unstable_customInspectorMessageHandler?: CreateCustomMessageHandlerFn,
}>;
type DevMiddlewareAPI = $ReadOnly<{
@@ -80,16 +82,16 @@ export default function createDevMiddleware({
unstable_browserLauncher = DefaultBrowserLauncher,
unstable_eventReporter,
unstable_experiments: experimentConfig = {},
unstable_InspectorProxy,
unstable_customInspectorMessageHandler,
}: Options): DevMiddlewareAPI {
const experiments = getExperiments(experimentConfig);
const InspectorProxyClass = unstable_InspectorProxy ?? InspectorProxy;
const inspectorProxy = new InspectorProxyClass(
const inspectorProxy = new InspectorProxy(
projectRoot,
serverBaseUrl,
unstable_eventReporter,
experiments,
unstable_customInspectorMessageHandler,
);
const middleware = connect()
+5 -3
View File
@@ -13,6 +13,8 @@ export {default as createDevMiddleware} from './createDevMiddleware';
export type {BrowserLauncher, LaunchedBrowser} from './types/BrowserLauncher';
export type {EventReporter, ReportableEvent} from './types/EventReporter';
export {default as unstable_InspectorProxy} from './inspector-proxy/InspectorProxy';
export {default as unstable_Device} from './inspector-proxy/Device';
export type {
CustomMessageHandler,
CustomMessageHandlerConnection,
CreateCustomMessageHandlerFn,
} from './inspector-proxy/CustomMessageHandler';
@@ -0,0 +1,54 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
*/
import type {JSONSerializable, Page} from './types';
type ExposedDevice = $ReadOnly<{
appId: string,
id: string,
name: string,
sendMessage: (message: JSONSerializable) => void,
}>;
type ExposedDebugger = $ReadOnly<{
userAgent: string | null,
sendMessage: (message: JSONSerializable) => void,
}>;
export type CustomMessageHandlerConnection = $ReadOnly<{
page: Page,
device: ExposedDevice,
debugger: ExposedDebugger,
}>;
export type CreateCustomMessageHandlerFn = (
connection: CustomMessageHandlerConnection,
) => ?CustomMessageHandler;
/**
* The device message middleware allows implementers to handle unsupported CDP messages.
* It is instantiated per device and may contain state that is specific to that device.
* The middleware can also mark messages from the device or debugger as handled, which stops propagating.
*/
export interface CustomMessageHandler {
/**
* Handle a CDP message coming from the device.
* This is invoked before the message is sent to the debugger.
* When returning true, the message is considered handled and will not be sent to the debugger.
*/
handleDeviceMessage(message: JSONSerializable): true | void;
/**
* Handle a CDP message coming from the debugger.
* This is invoked before the message is sent to the device.
* When returning true, the message is considered handled and will not be sent to the device.
*/
handleDebuggerMessage(message: JSONSerializable): true | void;
}
@@ -16,6 +16,10 @@ import type {
CDPResponse,
CDPServerMessage,
} from './cdp-types/messages';
import type {
CreateCustomMessageHandlerFn,
CustomMessageHandler,
} from './CustomMessageHandler';
import type {
MessageFromDevice,
MessageToDevice,
@@ -51,6 +55,11 @@ type DebuggerInfo = {
userAgent: string | null,
};
type DebuggerConnection = {
...DebuggerInfo,
customHandler: ?CustomMessageHandler,
};
const REACT_NATIVE_RELOADABLE_PAGE_ID = '-1';
/**
@@ -74,7 +83,7 @@ export default class Device {
#pages: $ReadOnlyMap<string, Page>;
// Stores information about currently connected debugger (if any).
#debuggerConnection: ?DebuggerInfo = null;
#debuggerConnection: ?DebuggerConnection = null;
// Last known Page ID of the React Native page.
// This is used by debugger connections that don't have PageID specified
@@ -97,6 +106,9 @@ export default class Device {
#pagesPollingIntervalId: ReturnType<typeof setInterval>;
// The device message middleware factory function allowing implementers to handle unsupported CDP messages.
#createCustomMessageHandler: ?CreateCustomMessageHandlerFn;
constructor(
id: string,
name: string,
@@ -104,6 +116,7 @@ export default class Device {
socket: WS,
projectRoot: string,
eventReporter: ?EventReporter,
createMessageMiddleware: ?CreateCustomMessageHandlerFn,
) {
this.#id = id;
this.#name = name;
@@ -118,6 +131,7 @@ export default class Device {
appId: app,
})
: null;
this.#createCustomMessageHandler = createMessageMiddleware;
// $FlowFixMe[incompatible-call]
this.#deviceSocket.on('message', (message: string) => {
@@ -162,14 +176,7 @@ export default class Device {
getPagesList(): $ReadOnlyArray<Page> {
if (this.#lastConnectedLegacyReactNativePage) {
const reactNativeReloadablePage = {
id: REACT_NATIVE_RELOADABLE_PAGE_ID,
title: 'React Native Experimental (Improved Chrome Reloads)',
vm: "don't use",
app: this.#app,
capabilities: {},
};
return [...this.#pages.values(), reactNativeReloadablePage];
return [...this.#pages.values(), this.#createSyntheticPage()];
} else {
return [...this.#pages.values()];
}
@@ -205,16 +212,64 @@ export default class Device {
prependedFilePrefix: false,
pageId,
userAgent: metadata.userAgent,
customHandler: null,
};
// TODO(moti): Handle null case explicitly, e.g. refuse to connect to
// unknown pages.
const page: ?Page = this.#pages.get(pageId);
const page: ?Page =
pageId === REACT_NATIVE_RELOADABLE_PAGE_ID
? this.#createSyntheticPage()
: this.#pages.get(pageId);
this.#debuggerConnection = debuggerInfo;
debug(`Got new debugger connection for page ${pageId} of ${this.#name}`);
if (page && this.#debuggerConnection && this.#createCustomMessageHandler) {
this.#debuggerConnection.customHandler = this.#createCustomMessageHandler(
{
page,
debugger: {
userAgent: debuggerInfo.userAgent,
sendMessage: message => {
try {
const payload = JSON.stringify(message);
debug('(Debugger) <- (Proxy) (Device): ' + payload);
socket.send(payload);
} catch {}
},
},
device: {
appId: this.#app,
id: this.#id,
name: this.#name,
sendMessage: message => {
try {
const payload = JSON.stringify({
event: 'wrappedEvent',
payload: {
pageId: this.#mapToDevicePageId(pageId),
wrappedEvent: JSON.stringify(message),
},
});
debug('(Debugger) -> (Proxy) (Device): ' + payload);
this.#deviceSocket.send(payload);
} catch {}
},
},
},
);
if (this.#debuggerConnection.customHandler) {
debug('Created new custom message handler for debugger connection');
} else {
debug(
'Skipping new custom message handler for debugger connection, factory function returned null',
);
}
}
this.#sendMessageToDevice({
event: 'connect',
payload: {
@@ -231,6 +286,15 @@ export default class Device {
frontendUserAgent: metadata.userAgent,
});
let processedReq = debuggerRequest;
if (
this.#debuggerConnection?.customHandler?.handleDebuggerMessage(
debuggerRequest,
) === true
) {
return;
}
if (!page || !this.#pageHasCapability(page, 'nativeSourceCodeFetching')) {
processedReq = this.#interceptClientMessageForSourceFetching(
debuggerRequest,
@@ -311,6 +375,19 @@ export default class Device {
return page.capabilities[flag] === true;
}
/**
* Returns the synthetic "React Native Experimental (Improved Chrome Reloads)" page.
*/
#createSyntheticPage(): Page {
return {
id: REACT_NATIVE_RELOADABLE_PAGE_ID,
title: 'React Native Experimental (Improved Chrome Reloads)',
vm: "don't use",
app: this.#app,
capabilities: {},
};
}
// Handles messages received from device:
// 1. For getPages responses updates local #pages list.
// 2. All other messages are forwarded to debugger as wrappedEvent.
@@ -411,12 +488,21 @@ export default class Device {
});
}
if (this.#debuggerConnection != null) {
const debuggerConnection = this.#debuggerConnection;
if (debuggerConnection != null) {
if (
debuggerConnection.customHandler?.handleDeviceMessage(
parsedPayload,
) === true
) {
return;
}
// Wrapping just to make flow happy :)
// $FlowFixMe[unused-promise]
this.#processMessageFromDeviceLegacy(
parsedPayload,
this.#debuggerConnection,
debuggerConnection,
pageId,
).then(() => {
const messageToSend = JSON.stringify(parsedPayload);
@@ -499,7 +585,7 @@ export default class Device {
// Allows to make changes in incoming message from device.
async #processMessageFromDeviceLegacy(
payload: CDPServerMessage,
debuggerInfo: DebuggerInfo,
debuggerInfo: DebuggerConnection,
pageId: ?string,
) {
// TODO(moti): Handle null case explicitly, or ideally associate a copy
@@ -616,7 +702,7 @@ export default class Device {
*/
#interceptClientMessageForSourceFetching(
req: CDPClientMessage,
debuggerInfo: DebuggerInfo,
debuggerInfo: DebuggerConnection,
socket: WS,
): CDPClientMessage | null {
switch (req.method) {
@@ -633,7 +719,7 @@ export default class Device {
#processDebuggerSetBreakpointByUrl(
req: CDPRequest<'Debugger.setBreakpointByUrl'>,
debuggerInfo: DebuggerInfo,
debuggerInfo: DebuggerConnection,
): CDPRequest<'Debugger.setBreakpointByUrl'> {
// If we replaced Android emulator's address to localhost we need to change it back.
if (debuggerInfo.originalSourceURLAddress != null) {
@@ -758,10 +844,6 @@ export default class Device {
// Fetch text, raising an exception if the text could not be fetched,
// or is too large.
async #fetchText(url: URL): Promise<string> {
if (!['localhost', '127.0.0.1'].includes(url.hostname)) {
throw new Error('remote fetches not permitted');
}
// $FlowFixMe[incompatible-call] Suppress arvr node-fetch flow error
const response = await fetch(url);
if (!response.ok) {
@@ -11,6 +11,7 @@
import type {EventReporter} from '../types/EventReporter';
import type {Experiments} from '../types/Experiments';
import type {CreateCustomMessageHandlerFn} from './CustomMessageHandler';
import type {
JsonPagesListResponse,
JsonVersionResponse,
@@ -58,17 +59,22 @@ export default class InspectorProxy implements InspectorProxyQueries {
#experiments: Experiments;
// custom message handler factory allowing implementers to handle unsupported CDP messages.
#customMessageHandler: ?CreateCustomMessageHandlerFn;
constructor(
projectRoot: string,
serverBaseUrl: string,
eventReporter: ?EventReporter,
experiments: Experiments,
customMessageHandler: ?CreateCustomMessageHandlerFn,
) {
this.#projectRoot = projectRoot;
this.#serverBaseUrl = serverBaseUrl;
this.#devices = new Map();
this.#eventReporter = eventReporter;
this.#experiments = experiments;
this.#customMessageHandler = customMessageHandler;
}
getPageDescriptions(): Array<PageDescription> {
@@ -167,6 +173,7 @@ export default class InspectorProxy implements InspectorProxyQueries {
response.writeHead(200, {
'Content-Type': 'application/json; charset=UTF-8',
'Cache-Control': 'no-cache',
'Content-Length': Buffer.byteLength(data).toString(),
Connection: 'close',
});
response.end(data);
@@ -203,6 +210,7 @@ export default class InspectorProxy implements InspectorProxyQueries {
socket,
this.#projectRoot,
this.#eventReporter,
this.#customMessageHandler,
);
if (oldDevice) {
@@ -257,7 +265,7 @@ export default class InspectorProxy implements InspectorProxyQueries {
}
device.handleDebuggerConnection(socket, pageId, {
userAgent: req.headers['user-agent'] ?? null,
userAgent: req.headers['user-agent'] ?? query.userAgent ?? null,
});
} catch (e) {
console.error(e);
@@ -30,6 +30,13 @@ export type TargetCapabilityFlags = $ReadOnly<{
* In the proxy, this disables source fetching emulation and host rewrites.
*/
nativeSourceCodeFetching?: boolean,
/**
* The target supports native network inspection.
*
* In the proxy, this disables intercepting and storing network requests.
*/
nativeNetworkInspection?: boolean,
}>;
// Page information received from the device. New page is created for
@@ -46,6 +46,14 @@ export default function deprecated_openFlipperMiddleware({
'Flipper to be installed on your system to handle the ' +
"'flipper://' URL scheme.",
);
logger?.info(
'In React Native 0.74, Flipper is no longer included for new React ' +
'Native projects. The Flipper React Native plugin is also ' +
'unsupported. You can continue to use Flipper to debug ' +
"your app's JavaScript code, however we recommend switching to " +
'a modern alternative.\nSee ' +
'https://reactnative.dev/docs/debugging#opening-the-debugger.',
);
await open(FLIPPER_SELF_CONNECT_URL);
res.end();
} catch (e) {
@@ -51,12 +51,23 @@ const DefaultBrowserLauncher: BrowserLauncher = {
`react-native-debugger-frontend-${browserType}`,
);
const launchedChrome = await ChromeLauncher.launch({
chromePath,
chromeFlags: [
...ChromeLauncher.Launcher.defaultFlags().filter(
/**
* This flag controls whether Chrome treats a visually covered (occluded) tab
* as "backgrounded". We launch CDT as a single tab/window via `--app`, so we
* do want Chrome to treat our tab as "backgrounded" when the UI is covered.
* Omitting this flag allows "visibilitychange" events to fire properly.
*/
flag => flag !== '--disable-backgrounding-occluded-windows',
),
`--app=${url}`,
`--user-data-dir=${userDataDir}`,
'--window-size=1200,600',
'--guest',
],
chromePath,
ignoreDefaultFlags: true,
});
return {
@@ -1,6 +1,6 @@
{
"name": "@react-native/eslint-config",
"version": "0.74.0",
"version": "0.74.88",
"description": "ESLint config for React Native",
"license": "MIT",
"repository": {
@@ -22,13 +22,13 @@
"dependencies": {
"@babel/core": "^7.20.0",
"@babel/eslint-parser": "^7.20.0",
"@react-native/eslint-plugin": "0.74.0",
"@typescript-eslint/eslint-plugin": "^6.7.4",
"@typescript-eslint/parser": "^6.7.4",
"@react-native/eslint-plugin": "0.74.88",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-ft-flow": "^2.0.1",
"eslint-plugin-jest": "^26.5.3",
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0",
@@ -1,6 +1,6 @@
{
"name": "@react-native/eslint-plugin",
"version": "0.74.0",
"version": "0.74.88",
"description": "ESLint rules for @react-native/eslint-config",
"license": "MIT",
"repository": {
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/eslint-plugin-specs",
"version": "0.74.0",
"version": "0.74.88",
"description": "ESLint rules to validate NativeModule and Component Specs",
"license": "MIT",
"repository": {
@@ -31,7 +31,7 @@
"@babel/eslint-parser": "^7.20.0",
"@babel/plugin-transform-flow-strip-types": "^7.20.0",
"@babel/preset-flow": "^7.20.0",
"@react-native/codegen": "0.74.0",
"@react-native/codegen": "0.74.88",
"make-dir": "^2.1.0",
"pirates": "^4.0.1",
"source-map-support": "0.5.0"
@@ -1,6 +1,6 @@
{
"name": "@react-native/hermes-inspector-msggen",
"version": "0.72.0",
"version": "0.74.88",
"private": true,
"description": "Hermes Inspector Message Generator for React Native",
"license": "MIT",
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/metro-config",
"version": "0.74.0",
"version": "0.74.88",
"description": "Metro configuration for React Native.",
"license": "MIT",
"repository": {
@@ -26,8 +26,8 @@
"dist"
],
"dependencies": {
"@react-native/js-polyfills": "0.74.0",
"@react-native/metro-babel-transformer": "0.74.0",
"@react-native/js-polyfills": "0.74.88",
"@react-native/metro-babel-transformer": "0.74.88",
"metro-config": "^0.80.3",
"metro-runtime": "^0.80.3"
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/normalize-colors",
"version": "0.74.1",
"version": "0.74.88",
"description": "Color normalization for React Native.",
"license": "MIT",
"repository": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/js-polyfills",
"version": "0.74.0",
"version": "0.74.88",
"description": "Polyfills for React Native.",
"license": "MIT",
"repository": {
@@ -1,6 +1,6 @@
{
"name": "@react-native/babel-preset",
"version": "0.74.0",
"version": "0.74.88",
"description": "Babel preset for React Native applications",
"main": "src/index.js",
"repository": {
@@ -54,7 +54,7 @@
"@babel/plugin-transform-typescript": "^7.5.0",
"@babel/plugin-transform-unicode-regex": "^7.0.0",
"@babel/template": "^7.0.0",
"@react-native/babel-plugin-codegen": "0.74.0",
"@react-native/babel-plugin-codegen": "0.74.88",
"babel-plugin-transform-flow-enums": "^0.0.2",
"react-refresh": "^0.14.0"
},
@@ -1,6 +1,6 @@
{
"name": "@react-native/metro-babel-transformer",
"version": "0.74.0",
"version": "0.74.88",
"description": "Babel transformer for React Native applications.",
"main": "src/index.js",
"repository": {
@@ -16,7 +16,7 @@
"license": "MIT",
"dependencies": {
"@babel/core": "^7.20.0",
"@react-native/babel-preset": "0.74.0",
"@react-native/babel-preset": "0.74.88",
"hermes-parser": "0.19.1",
"nullthrows": "^1.1.1"
},
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@react-native/bots",
"description": "React Native Bots",
"version": "0.0.0",
"version": "0.74.88",
"private": true,
"license": "MIT",
"repository": {
@@ -1,6 +1,6 @@
{
"name": "@react-native/codegen-typescript-test",
"version": "0.0.1",
"version": "0.74.88",
"private": true,
"description": "TypeScript related unit test for @react-native/codegen",
"license": "MIT",
@@ -19,7 +19,7 @@
"prepare": "yarn run build"
},
"dependencies": {
"@react-native/codegen": "0.74.0"
"@react-native/codegen": "0.74.88"
},
"devDependencies": {
"@babel/core": "^7.20.0",
@@ -82,7 +82,7 @@ static inline std::string toString(const ArrayPropsNativeComponentViewSizesMask
return result;
}
struct ArrayPropsNativeComponentViewObjectStruct {
std::string prop;
std::string prop{};
};
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ArrayPropsNativeComponentViewObjectStruct &result) {
@@ -109,8 +109,8 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
struct ArrayPropsNativeComponentViewArrayOfObjectsStruct {
Float prop1;
int prop2;
Float prop1{0.0};
int prop2{0};
};
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ArrayPropsNativeComponentViewArrayOfObjectsStruct &result) {
@@ -756,12 +756,12 @@ static inline std::string toString(const ObjectPropsNativeComponentIntEnumProp &
}
}
struct ObjectPropsNativeComponentObjectPropStruct {
std::string stringProp;
bool booleanProp;
Float floatProp;
int intProp;
ObjectPropsNativeComponentStringEnumProp stringEnumProp;
ObjectPropsNativeComponentIntEnumProp intEnumProp;
std::string stringProp{\\"\\"};
bool booleanProp{false};
Float floatProp{0.0};
int intProp{0};
ObjectPropsNativeComponentStringEnumProp stringEnumProp{ObjectPropsNativeComponentStringEnumProp::Small};
ObjectPropsNativeComponentIntEnumProp intEnumProp{ObjectPropsNativeComponentIntEnumProp::IntEnumProp0};
};
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsNativeComponentObjectPropStruct &result) {
@@ -798,7 +798,7 @@ static inline std::string toString(const ObjectPropsNativeComponentObjectPropStr
}
struct ObjectPropsNativeComponentObjectArrayPropStruct {
std::vector<std::string> array;
std::vector<std::string> array{};
};
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsNativeComponentObjectArrayPropStruct &result) {
@@ -815,9 +815,9 @@ static inline std::string toString(const ObjectPropsNativeComponentObjectArrayPr
}
struct ObjectPropsNativeComponentObjectPrimitiveRequiredPropStruct {
ImageSource image;
SharedColor color;
Point point;
ImageSource image{};
SharedColor color{};
Point point{};
};
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsNativeComponentObjectPrimitiveRequiredPropStruct &result) {
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/codegen",
"version": "0.74.0",
"version": "0.74.88",
"description": "Code generation tools for React Native",
"license": "MIT",
"repository": {
@@ -35,7 +35,8 @@
"invariant": "^2.2.4",
"jscodeshift": "^0.14.0",
"mkdirp": "^0.5.1",
"nullthrows": "^1.1.1"
"nullthrows": "^1.1.1",
"yargs": "^17.6.2"
},
"devDependencies": {
"@babel/core": "^7.20.0",
@@ -52,8 +53,7 @@
"hermes-estree": "0.19.1",
"micromatch": "^4.0.4",
"prettier": "2.8.8",
"rimraf": "^3.0.2",
"yargs": "^17.6.2"
"rimraf": "^3.0.2"
},
"peerDependencies": {
"@babel/preset-env": "^7.1.6"
@@ -29,9 +29,10 @@ EDEN_SAFE_MV="mv"
if [ -x "$(command -v eden)" ]; then
pushd "$THIS_DIR"
# Detect if we are in an EdenFS checkout
# Detect if we are in an EdenFS checkout, but be sure to use /bin/cp
# incase users have GNU coreutils installed which is incompatible with -X
if [[ "$OSTYPE" == "darwin"* ]] && eden info; then
EDEN_SAFE_MV="cp -R -X"
EDEN_SAFE_MV="/bin/cp -R -X"
fi
popd >/dev/null
@@ -60,7 +61,7 @@ else
if [ "$OSTYPE" = "msys" ] || [ "$OSTYPE" = "cygwin" ]; then
tar cf - --exclude='*.lock' "$CODEGEN_DIR" | (cd "$TMP_DIR" && tar xvf - );
else
cp -R "$CODEGEN_DIR/." "$TMP_DIR";
/bin/cp -R "$CODEGEN_DIR/." "$TMP_DIR";
fi
pushd "$TMP_DIR" >/dev/null
@@ -166,6 +166,14 @@ function getEnumMaskName(enumName: string): string {
return `${enumName}Mask`;
}
function getDefaultInitializerString(
componentName: string,
prop: NamedShape<PropTypeAnnotation>,
): string {
const defaultValue = convertDefaultTypeToString(componentName, prop);
return `{${defaultValue}}`;
}
function convertDefaultTypeToString(
componentName: string,
prop: NamedShape<PropTypeAnnotation>,
@@ -270,6 +278,7 @@ const IncludeTemplate = ({
};
module.exports = {
getDefaultInitializerString,
convertDefaultTypeToString,
getCppArrayTypeForAnnotation,
getCppTypeForAnnotation,
@@ -23,8 +23,8 @@ const {
getNativeTypeFromAnnotation,
} = require('./ComponentsGeneratorUtils.js');
const {
convertDefaultTypeToString,
generateStructName,
getDefaultInitializerString,
getEnumMaskName,
toIntEnumValueName,
} = require('./CppHelpers.js');
@@ -456,13 +456,21 @@ function generateEnumString(
function generatePropsString(
componentName: string,
props: $ReadOnlyArray<NamedShape<PropTypeAnnotation>>,
nameParts: $ReadOnlyArray<string>,
) {
return props
.map(prop => {
const nativeType = getNativeTypeFromAnnotation(componentName, prop, []);
const defaultValue = convertDefaultTypeToString(componentName, prop);
const nativeType = getNativeTypeFromAnnotation(
componentName,
prop,
nameParts,
);
const defaultInitializer = getDefaultInitializerString(
componentName,
prop,
);
return `${nativeType} ${prop.name}{${defaultValue}};`;
return `${nativeType} ${prop.name}${defaultInitializer};`;
})
.join('\n' + ' ');
}
@@ -629,16 +637,11 @@ function generateStruct(
): void {
const structNameParts = nameParts;
const structName = generateStructName(componentName, structNameParts);
const fields = properties
.map(property => {
return `${getNativeTypeFromAnnotation(
componentName,
property,
structNameParts,
)} ${property.name};`;
})
.join('\n' + ' ');
const fields = generatePropsString(
componentName,
properties,
structNameParts,
);
properties.forEach((property: NamedShape<PropTypeAnnotation>) => {
const name = property.name;
@@ -738,6 +741,7 @@ module.exports = {
const propsString = generatePropsString(
componentName,
component.props,
[],
);
const extendString = getClassExtendString(component);
const extendsImports = getExtendsImports(component.extendsProps);
@@ -871,6 +871,38 @@ const OBJECT_PROPS: SchemaType = {
default: 0,
},
},
{
name: 'stringUserDefaultProp',
optional: true,
typeAnnotation: {
type: 'StringTypeAnnotation',
default: 'user_default',
},
},
{
name: 'booleanUserDefaultProp',
optional: true,
typeAnnotation: {
type: 'BooleanTypeAnnotation',
default: true,
},
},
{
name: 'floatUserDefaultProp',
optional: true,
typeAnnotation: {
type: 'FloatTypeAnnotation',
default: 3.14,
},
},
{
name: 'intUserDefaultProp',
optional: true,
typeAnnotation: {
type: 'Int32TypeAnnotation',
default: 9999,
},
},
{
name: 'stringEnumProp',
optional: true,
@@ -81,7 +81,7 @@ static inline std::string toString(const ArrayPropsNativeComponentSizesMask &val
return result;
}
struct ArrayPropsNativeComponentObjectStruct {
std::string stringProp;
std::string stringProp{\\"\\"};
};
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ArrayPropsNativeComponentObjectStruct &result) {
@@ -108,7 +108,7 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
struct ArrayPropsNativeComponentArrayObjectStruct {
std::string stringProp;
std::string stringProp{\\"\\"};
};
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ArrayPropsNativeComponentArrayObjectStruct &result) {
@@ -135,7 +135,7 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
struct ArrayPropsNativeComponentArrayStruct {
std::vector<ArrayPropsNativeComponentArrayObjectStruct> object;
std::vector<ArrayPropsNativeComponentArrayObjectStruct> object{};
};
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ArrayPropsNativeComponentArrayStruct &result) {
@@ -162,7 +162,7 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
struct ArrayPropsNativeComponentArrayOfArrayOfObjectStruct {
std::string stringProp;
std::string stringProp{\\"\\"};
};
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ArrayPropsNativeComponentArrayOfArrayOfObjectStruct &result) {
@@ -242,9 +242,9 @@ Map {
namespace facebook::react {
struct ArrayPropsNativeComponentNativePrimitivesStruct {
std::vector<SharedColor> colors;
std::vector<ImageSource> srcs;
std::vector<Point> points;
std::vector<SharedColor> colors{};
std::vector<ImageSource> srcs{};
std::vector<Point> points{};
};
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ArrayPropsNativeComponentNativePrimitivesStruct &result) {
@@ -1100,7 +1100,7 @@ static inline std::string toString(const ObjectPropsIntEnumProp &value) {
}
}
struct ObjectPropsObjectPropObjectArrayPropStruct {
std::vector<std::string> array;
std::vector<std::string> array{};
};
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsObjectPropObjectArrayPropStruct &result) {
@@ -1117,9 +1117,9 @@ static inline std::string toString(const ObjectPropsObjectPropObjectArrayPropStr
}
struct ObjectPropsObjectPropObjectPrimitiveRequiredPropStruct {
ImageSource image;
SharedColor color;
Point point;
ImageSource image{};
SharedColor color{};
Point point{};
};
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsObjectPropObjectPrimitiveRequiredPropStruct &result) {
@@ -1144,7 +1144,7 @@ static inline std::string toString(const ObjectPropsObjectPropObjectPrimitiveReq
}
struct ObjectPropsObjectPropNestedPropANestedPropBStruct {
std::string nestedPropC;
std::string nestedPropC{\\"\\"};
};
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsObjectPropNestedPropANestedPropBStruct &result) {
@@ -1161,7 +1161,7 @@ static inline std::string toString(const ObjectPropsObjectPropNestedPropANestedP
}
struct ObjectPropsObjectPropNestedPropAStruct {
ObjectPropsObjectPropNestedPropANestedPropBStruct nestedPropB;
ObjectPropsObjectPropNestedPropANestedPropBStruct nestedPropB{};
};
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsObjectPropNestedPropAStruct &result) {
@@ -1178,7 +1178,7 @@ static inline std::string toString(const ObjectPropsObjectPropNestedPropAStruct
}
struct ObjectPropsObjectPropNestedArrayAsPropertyArrayPropStruct {
std::string stringProp;
std::string stringProp{\\"\\"};
};
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsObjectPropNestedArrayAsPropertyArrayPropStruct &result) {
@@ -1205,7 +1205,7 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
struct ObjectPropsObjectPropNestedArrayAsPropertyStruct {
std::vector<ObjectPropsObjectPropNestedArrayAsPropertyArrayPropStruct> arrayProp;
std::vector<ObjectPropsObjectPropNestedArrayAsPropertyArrayPropStruct> arrayProp{};
};
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsObjectPropNestedArrayAsPropertyStruct &result) {
@@ -1222,16 +1222,20 @@ static inline std::string toString(const ObjectPropsObjectPropNestedArrayAsPrope
}
struct ObjectPropsObjectPropStruct {
std::string stringProp;
bool booleanProp;
Float floatProp;
int intProp;
ObjectPropsStringEnumProp stringEnumProp;
ObjectPropsIntEnumProp intEnumProp;
ObjectPropsObjectPropObjectArrayPropStruct objectArrayProp;
ObjectPropsObjectPropObjectPrimitiveRequiredPropStruct objectPrimitiveRequiredProp;
ObjectPropsObjectPropNestedPropAStruct nestedPropA;
ObjectPropsObjectPropNestedArrayAsPropertyStruct nestedArrayAsProperty;
std::string stringProp{\\"\\"};
bool booleanProp{false};
Float floatProp{0.0};
int intProp{0};
std::string stringUserDefaultProp{\\"user_default\\"};
bool booleanUserDefaultProp{true};
Float floatUserDefaultProp{3.14};
int intUserDefaultProp{9999};
ObjectPropsStringEnumProp stringEnumProp{ObjectPropsStringEnumProp::Option1};
ObjectPropsIntEnumProp intEnumProp{ObjectPropsIntEnumProp::IntEnumProp0};
ObjectPropsObjectPropObjectArrayPropStruct objectArrayProp{};
ObjectPropsObjectPropObjectPrimitiveRequiredPropStruct objectPrimitiveRequiredProp{};
ObjectPropsObjectPropNestedPropAStruct nestedPropA{};
ObjectPropsObjectPropNestedArrayAsPropertyStruct nestedArrayAsProperty{};
};
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsObjectPropStruct &result) {
@@ -1253,6 +1257,22 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
if (tmp_intProp != map.end()) {
fromRawValue(context, tmp_intProp->second, result.intProp);
}
auto tmp_stringUserDefaultProp = map.find(\\"stringUserDefaultProp\\");
if (tmp_stringUserDefaultProp != map.end()) {
fromRawValue(context, tmp_stringUserDefaultProp->second, result.stringUserDefaultProp);
}
auto tmp_booleanUserDefaultProp = map.find(\\"booleanUserDefaultProp\\");
if (tmp_booleanUserDefaultProp != map.end()) {
fromRawValue(context, tmp_booleanUserDefaultProp->second, result.booleanUserDefaultProp);
}
auto tmp_floatUserDefaultProp = map.find(\\"floatUserDefaultProp\\");
if (tmp_floatUserDefaultProp != map.end()) {
fromRawValue(context, tmp_floatUserDefaultProp->second, result.floatUserDefaultProp);
}
auto tmp_intUserDefaultProp = map.find(\\"intUserDefaultProp\\");
if (tmp_intUserDefaultProp != map.end()) {
fromRawValue(context, tmp_intUserDefaultProp->second, result.intUserDefaultProp);
}
auto tmp_stringEnumProp = map.find(\\"stringEnumProp\\");
if (tmp_stringEnumProp != map.end()) {
fromRawValue(context, tmp_stringEnumProp->second, result.stringEnumProp);
@@ -1024,6 +1024,10 @@ public class ObjectPropsPropsObjectProp {
private boolean mBooleanProp;
private float mFloatProp;
private int mIntProp;
private @Nullable String mStringUserDefaultProp;
private boolean mBooleanUserDefaultProp;
private float mFloatUserDefaultProp;
private int mIntUserDefaultProp;
private @Nullable String mStringEnumProp;
private @Nullable Integer mIntEnumProp;
private ObjectPropsPropsObjectPropObjectArrayProp mObjectArrayProp;
@@ -1047,6 +1051,22 @@ public class ObjectPropsPropsObjectProp {
return mIntProp;
}
@DoNotStrip
public @Nullable String getStringUserDefaultProp() {
return mStringUserDefaultProp;
}
@DoNotStrip
public boolean getBooleanUserDefaultProp() {
return mBooleanUserDefaultProp;
}
@DoNotStrip
public float getFloatUserDefaultProp() {
return mFloatUserDefaultProp;
}
@DoNotStrip
public int getIntUserDefaultProp() {
return mIntUserDefaultProp;
}
@DoNotStrip
public @Nullable String getStringEnumProp() {
return mStringEnumProp;
}
@@ -136,11 +136,11 @@ function translateFunctionParamToJavaType(
case 'NumberTypeAnnotation':
return wrapOptional('double', isRequired);
case 'FloatTypeAnnotation':
return wrapOptional('float', isRequired);
return wrapOptional('double', isRequired);
case 'DoubleTypeAnnotation':
return wrapOptional('double', isRequired);
case 'Int32TypeAnnotation':
return wrapOptional('int', isRequired);
return wrapOptional('double', isRequired);
case 'BooleanTypeAnnotation':
return wrapOptional('boolean', isRequired);
case 'EnumDeclaration':
@@ -462,7 +462,7 @@ module.exports = {
'com.facebook.react.bridge.ReactApplicationContext',
'com.facebook.react.bridge.ReactContextBaseJavaModule',
'com.facebook.react.bridge.ReactMethod',
'com.facebook.react.internal.turbomodule.core.interfaces.TurboModule',
'com.facebook.react.turbomodule.core.interfaces.TurboModule',
'com.facebook.proguard.annotations.DoNotStrip',
'javax.annotation.Nonnull',
]);
@@ -334,9 +334,9 @@ function translateReturnTypeToJniType(
case 'DoubleTypeAnnotation':
return nullable ? 'Ljava/lang/Double;' : 'D';
case 'FloatTypeAnnotation':
return nullable ? 'Ljava/lang/Float;' : 'F';
return nullable ? 'Ljava/lang/Double;' : 'D';
case 'Int32TypeAnnotation':
return nullable ? 'Ljava/lang/Integer;' : 'I';
return nullable ? 'Ljava/lang/Double;' : 'D';
case 'PromiseTypeAnnotation':
return 'Lcom/facebook/react/bridge/Promise;';
case 'GenericObjectTypeAnnotation':
@@ -20,7 +20,7 @@ import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.internal.turbomodule.core.interfaces.TurboModule;
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
import javax.annotation.Nonnull;
public abstract class NativeSampleTurboModuleSpec extends ReactContextBaseJavaModule implements TurboModule {
@@ -66,7 +66,7 @@ import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.WritableArray;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.internal.turbomodule.core.interfaces.TurboModule;
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -136,7 +136,7 @@ import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.internal.turbomodule.core.interfaces.TurboModule;
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
import javax.annotation.Nonnull;
public abstract class NativeSampleTurboModuleSpec extends ReactContextBaseJavaModule implements TurboModule {
@@ -178,7 +178,7 @@ import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.internal.turbomodule.core.interfaces.TurboModule;
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
import javax.annotation.Nonnull;
public abstract class AliasTurboModuleSpec extends ReactContextBaseJavaModule implements TurboModule {
@@ -224,7 +224,7 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.internal.turbomodule.core.interfaces.TurboModule;
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
import javax.annotation.Nonnull;
public abstract class NativeCameraRollManagerSpec extends ReactContextBaseJavaModule implements TurboModule {
@@ -272,7 +272,7 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.internal.turbomodule.core.interfaces.TurboModule;
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
import javax.annotation.Nonnull;
public abstract class NativeExceptionsManagerSpec extends ReactContextBaseJavaModule implements TurboModule {
@@ -338,7 +338,7 @@ import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.WritableArray;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.common.build.ReactBuildConfig;
import com.facebook.react.internal.turbomodule.core.interfaces.TurboModule;
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Map;
@@ -462,7 +462,7 @@ import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.internal.turbomodule.core.interfaces.TurboModule;
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
import javax.annotation.Nonnull;
public abstract class NativeSampleTurboModuleSpec extends ReactContextBaseJavaModule implements TurboModule {
@@ -500,7 +500,7 @@ import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.internal.turbomodule.core.interfaces.TurboModule;
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
import javax.annotation.Nonnull;
public abstract class NativeSampleTurboModule2Spec extends ReactContextBaseJavaModule implements TurboModule {
@@ -0,0 +1,3 @@
build/
react-native-gradle-plugin/build/
settings-plugin/build/
@@ -5,80 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import org.gradle.api.internal.classpath.ModuleRegistry
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.configurationcache.extensions.serviceOf
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlin.jvm).apply(false)
id("java-gradle-plugin")
}
repositories {
google()
mavenCentral()
}
gradlePlugin {
plugins {
create("react") {
id = "com.facebook.react"
implementationClass = "com.facebook.react.ReactPlugin"
}
create("reactrootproject") {
id = "com.facebook.react.rootproject"
implementationClass = "com.facebook.react.ReactRootProjectPlugin"
}
}
}
group = "com.facebook.react"
dependencies {
implementation(gradleApi())
// The KGP/AGP version is defined by React Native Gradle plugin.
// Therefore we specify an implementation dep rather than a compileOnly.
implementation(libs.kotlin.gradle.plugin)
implementation(libs.android.gradle.plugin)
implementation(libs.gson)
implementation(libs.guava)
implementation(libs.javapoet)
testImplementation(libs.junit)
testRuntimeOnly(
files(
serviceOf<ModuleRegistry>()
.getModule("gradle-tooling-api-builders")
.classpath
.asFiles
.first()))
}
// We intentionally don't build for Java 17 as users will see a cryptic bytecode version
// error first. Instead we produce a Java 11-compatible Gradle Plugin, so that AGP can print their
// nice message showing that JDK 11 (or 17) is required first
java { targetCompatibility = JavaVersion.VERSION_11 }
kotlin { jvmToolchain(17) }
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
apiVersion = "1.6"
// See comment above on JDK 11 support
jvmTarget = "11"
allWarningsAsErrors = true
}
}
tasks.withType<Test>().configureEach {
testLogging {
exceptionFormat = TestExceptionFormat.FULL
showExceptions = true
showCauses = true
showStackTraces = true
}
}
}
@@ -1,6 +1,6 @@
{
"name": "@react-native/gradle-plugin",
"version": "0.74.0",
"version": "0.74.88",
"description": "Gradle Plugin for React Native",
"license": "MIT",
"repository": {
@@ -29,7 +29,8 @@
"gradle",
"gradlew",
"gradlew.bat",
"src/main",
"README.md"
"README.md",
"react-native-gradle-plugin",
"settings-plugin"
]
}
@@ -0,0 +1,84 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import org.gradle.api.internal.classpath.ModuleRegistry
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.configurationcache.extensions.serviceOf
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
alias(libs.plugins.kotlin.jvm)
id("java-gradle-plugin")
}
repositories {
google()
mavenCentral()
}
gradlePlugin {
plugins {
create("react") {
id = "com.facebook.react"
implementationClass = "com.facebook.react.ReactPlugin"
}
create("reactrootproject") {
id = "com.facebook.react.rootproject"
implementationClass = "com.facebook.react.ReactRootProjectPlugin"
}
}
}
group = "com.facebook.react"
dependencies {
implementation(gradleApi())
// The KGP/AGP version is defined by React Native Gradle plugin.
// Therefore we specify an implementation dep rather than a compileOnly.
implementation(libs.kotlin.gradle.plugin)
implementation(libs.android.gradle.plugin)
implementation(libs.gson)
implementation(libs.guava)
implementation(libs.javapoet)
testImplementation(libs.junit)
testRuntimeOnly(
files(
serviceOf<ModuleRegistry>()
.getModule("gradle-tooling-api-builders")
.classpath
.asFiles
.first()))
}
// We intentionally don't build for Java 17 as users will see a cryptic bytecode version
// error first. Instead we produce a Java 11-compatible Gradle Plugin, so that AGP can print their
// nice message showing that JDK 11 (or 17) is required first
java { targetCompatibility = JavaVersion.VERSION_11 }
kotlin { jvmToolchain(17) }
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
apiVersion = "1.6"
// See comment above on JDK 11 support
jvmTarget = "11"
allWarningsAsErrors = true
}
}
tasks.withType<Test>().configureEach {
testLogging {
exceptionFormat = TestExceptionFormat.FULL
showExceptions = true
showCauses = true
showStackTraces = true
}
}
@@ -54,6 +54,26 @@ abstract class PreparePrefabHeadersTask : DefaultTask() {
it.include("boost/detail/workaround.hpp")
it.include("boost/operators.hpp")
it.include("boost/preprocessor/**/*.hpp")
// Headers needed for exposing rrc_text and rrc_textinput
it.include("boost/container_hash/**/*.hpp")
it.include("boost/detail/**/*.hpp")
it.include("boost/intrusive/**/*.hpp")
it.include("boost/iterator/**/*.hpp")
it.include("boost/move/**/*.hpp")
it.include("boost/mpl/**/*.hpp")
it.include("boost/mp11/**/*.hpp")
it.include("boost/describe/**/*.hpp")
it.include("boost/preprocessor/**/*.hpp")
it.include("boost/type_traits/**/*.hpp")
it.include("boost/utility/**/*.hpp")
it.include("boost/detail/workaround.hpp")
it.include("boost/assert.hpp")
it.include("boost/static_assert.hpp")
it.include("boost/cstdint.hpp")
it.include("boost/operators.hpp")
it.include("boost/config.hpp")
it.include("boost/utility.hpp")
it.include("boost/version.hpp")
it.into(File(outputFolder.asFile, headerPrefix))
}
}

Some files were not shown because too many files have changed in this diff Show More