Compare commits

...
Author SHA1 Message Date
Rob Hogan dad840cb42 community-cli-plugin: resolve cli-server-api via peer dependency on cli 2025-03-18 13:18:42 +00:00
Blake Friedman 8d8b8c343e Update Podfile.lock
Changelog: [Internal]
2024-10-09 01:47:01 +01:00
React Native Bot 5106933c75 Release 0.76.0-rc.4
#publish-packages-to-npm&next
2024-10-08 22:20:58 +00:00
Blake Friedman 25a65cd2bd Revert [0.76] Fix errors with component stacks reported as warnings
- "Fix errors with component stacks reported as warnings (#46637)": 2da46a88ee
- "Refactor LogBox tests to spies (#46638)": 89263647aa
- "Add integration tests for console errors + ExceptionManager (#46636)": 094f036115
- "Re-enable integration tests (#46639)": bf40710f4f
2024-10-07 15:59:39 +01:00
Alex HuntandGitHub 7a601f428e [0.76] Update debugger-frontend from e8c7943...ce5d32a (#46790) 2024-10-07 15:42:18 +01:00
Alex HuntandGitHub 6047f9cc09 [0.76][Fix] Restore Metro log forwarding, change notice to signal future removal (#46815) 2024-10-07 15:41:56 +01:00
Nicola CortiandGitHub 531657b394 [0.76] Update ReactNativeFlipper deprecation to ERROR (#46840) 2024-10-07 15:41:32 +01:00
Rick HanlonandBlake Friedman 2da46a88ee Fix errors with component stacks reported as warnings (#46637)
Summary:
Ok so this is a doozy.

## Overview
There was a report that some console.error calls were being shown as warnings in LogBox but as console.error in the console. The only time we should downlevel an error to a warning is if the custom warning filter says so (which is used for some noisy legacy warning filter warnings internally).

However, in when I switched from using the `Warning: ` prefix, to using the presence of component stacks, I subtly missed the default warning filter case.

In the internal warning filter, the `monitorEvent` is always set to something other than `unknown` and if it's set to `warning_unhandled` then `suppressDialog_LEGACY` is always false.

However, the default values for the warning filter are that `monitorEvent = 'unknown'` and `suppressDialog_LEGACY = true`. In this case, we would downlevel the error to a warning.

## What's the fix?
Change the default settings for the warning filter.

## What's the root cause?

Bad configuration combinations in a fragile system that needs cleaned up, and really really bad testing practices with excessive mocking and snapshot testing (I can say that, I wrote the tests)

## How could it have been caught?
It was, but I turned off the integration tests while landing the component stack changes because of mismatches between flags internally and in OSS, and never turned them back on.

Changelog: [General] [Fixed] - Fix logbox reporting React errors as Warnings

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

Reviewed By: huntie

Differential Revision: D63349613

Pulled By: rickhanlonii

fbshipit-source-id: 32e3fa4e2f2077114a6e9f4feac73673973ab50c
2024-10-07 15:35:28 +01:00
Rick HanlonandBlake Friedman 89263647aa Refactor LogBox tests to spies (#46638)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46638

This is annoying, but in the next diff that fixes a bug I need to test using the default warning filter instead of a mock (really, all this mocking is terrible, idk why I did it this way).

Unfortunately, in Jest you can't just reset mocks from `jest.mock`, `restoreMocks` only resets spies and not mocks (wild right).

So in this diff I converted all the `jest.mock` calls to `jest.spyOn`. I also corrected some of the mocks that require `monitorEvent: 'warning',` like the warning filter sets.

I also added a test that works without the fix.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D63349615

fbshipit-source-id: 4f2a5a8800c8fe1a10e3613d3c2d0ed02fca773e
2024-10-07 15:35:28 +01:00
Rick HanlonandBlake Friedman 094f036115 Add integration tests for console errors + ExceptionManager (#46636)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46636

Adds more integration tests for LogBox (currently incorrect, but fixed in a later diff).

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D63349614

fbshipit-source-id: 8f5c6545b48a1ed18aea08d4ecbecd7a6b9fa05a
2024-10-07 15:35:28 +01:00
Rick HanlonandBlake Friedman bf40710f4f Re-enable integration tests (#46639)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46639

These tests were skipped when we were switching to component stacks, which also hid a bug later in the stack. Re-enable them.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D63349616

fbshipit-source-id: ccde7d5bb3fcd9a27adf4af2068a160f02f7432a
2024-10-07 15:35:27 +01:00
Cedric van PuttenandBlake Friedman 9ae812c72d fix(dev-middleware): respond with status code 200 when launching RNDT (#46814)
Summary:
This fixes an issue where `POST /open-debugger?appId&device&target` does not return a proper status code, meaning that the request will never be answered and clients might hang until the request timeout is hit.

## 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] - Respond with status code `200` when successfully launching RNDT

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

Test Plan:
- `curl -v -X POST "<deviceUrl>"`
- This should show a proper response for the request.

before | after
 --- | ---
![image](https://github.com/user-attachments/assets/5b820acd-1168-4642-90ec-f2eeec0afc16) | ![image](https://github.com/user-attachments/assets/82bb2a6c-3c7b-483f-a4a1-ad00e5ca0178)

Reviewed By: NickGerleman

Differential Revision: D63837025

Pulled By: huntie

fbshipit-source-id: ac72fc793e015f0eec498f4a35b4fb9e301c5b32
2024-10-07 15:19:52 +01:00
Alan HughesandBlake Friedman 904222e608 Allow taking control of bundle loading on new arch (#46731)
Summary:
On the old architecture you could take control of loading the bundle by implementing
```objc
- (void)loadSourceForBridge:(RCTBridge *)bridge
                 onProgress:(RCTSourceLoadProgressBlock)onProgress
                 onComplete:(RCTSourceLoadBlock)loadCallback;
```
in your `RCTBridgeDelegate`. This is not currently possible in the new architecture.

I've added this using a pretty much identical api by adding a function to both the `RCTInstanceDelegate` and `RCTHostDelegate` protocols. This will be called on the `RCTRootViewFactory`. I've added two properties to the `RCTRootViewFactoryConfiguration`, `loadSourceForHost` and `loadSourceWithProgressForHost`. If one is present, we call it, otherwise we fallback to the normal loading process

## Changelog:

[iOS] [Breaking] - Add ability to control bundle loading on the new architecture similar to `loadSourceForBridge`. Removed some properties from the `RCTRootViewFactory`.

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

Test Plan: Rn-tester works as normal and it is working for our use case in expo go.

Reviewed By: blakef

Differential Revision: D63755188

Pulled By: cipolleschi

fbshipit-source-id: f1f26b2775b9e547ce7a23028665797c19bfdd9b
2024-10-07 15:19:35 +01:00
Saad NajmiandBlake Friedman a536580e84 fix(iOS): Properly retain/release backgroundColor in RCTBorderDrawing (#46797)
Summary:
I discovered this while working on my shim of `UIGraphicsImageRenderer` for macOS (See https://github.com/microsoft/react-native-macos/pull/2209). A variable of type`CGColorRef` is not automatically retained and released when passed into a block. There was a case in `RCTBorderDrawing` where we were doing so. To fix this, we have two options:

1. Pass a `UIColor` instead (Requires a change to the signature of the function calling it)
2. Properly retain and release the variable.

The first option would technically be a breaking change (we would need to change the signature of `RCTGetBorderImage`, so I'm opting for option 2.

## Changelog:

[IOS] [FIXED] -  Properly retain/release backgroundColor in RCTBorderDrawing

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

Test Plan: CI should pass. Locally, borders still draw fine for me.

Reviewed By: joevilches

Differential Revision: D63827824

Pulled By: cipolleschi

fbshipit-source-id: 926601d062b90a7d741d7a1af3070cec4b8795ae
2024-10-07 15:19:09 +01:00
Saad NajmiandBlake Friedman 5e9804a398 Rename RCTUIGraphicsImageRenderer to RCTMakeUIGraphicsImageRenderer (#46772)
Summary:
Because `UIGraphicsImageRenderer` doesn't exist on macOS, I need to shim it for React Native macOS (See https://github.com/microsoft/react-native-macos/pull/2209). I planned to use the name `RCTUIGraphicsImageRenderer`. However.. it seems that is used by a static helper function in `RCTBorderDrawing.m`. So.. let's rename it? The function is just a helper method to make an instance of the class, so I think the name `RCTMakeUIGraphicsImageRenderer` is slightly more idiomatic anyway.

This method is not public, so it should not break the public API of React Native.

## Changelog:

[IOS] [CHANGED] - Rename `RCTUIGraphicsImageRenderer` to `RCTMakeUIGraphicsImageRenderer`

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

Test Plan: CI should pass

Reviewed By: joevilches

Differential Revision: D63765490

Pulled By: cipolleschi

fbshipit-source-id: de68dce0f92ec249ea8586dbf7b9ba34a8476074
2024-10-07 15:18:34 +01:00
shubhamguptadream11andBlake Friedman e14cdf6a5b fix(iOS): title and title color handling added for refresh control (#46655)
Summary:
Solve a part of this issue:  https://github.com/facebook/react-native/issues/46631

## 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] [CHANGED] - Passed correct title and titleColor prop to updateTitle function

**What's the Issue:**
When updating the PullToRefreshViewProps in a React Native iOS app, changes to the title and titleColor were not being reflected properly in the RefreshControl. This happened because the function responsible for updating the title (_updateTitle) was not always receiving the correct or updated values for title and titleColor.

**Updated `_updateTitle` function:**

The _updateTitle method was modified to accept both title and titleColor as parameters. This ensures that the latest values are always used when updating the refresh control's attributedTitle.
If the title is empty, the attributedTitle is cleared by setting it to nil. Otherwise, both the title and titleColor (if present) are applied correctly.

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

Test Plan:
**Without fix:**
https://github.com/user-attachments/assets/8a83c247-bf78-4080-bdc1-ac5a852481e8

**With Fix:**
https://github.com/user-attachments/assets/52e2495a-4419-41d1-b308-acb64600f9f7

Reviewed By: javache

Differential Revision: D63466516

Pulled By: cipolleschi

fbshipit-source-id: fef61a003b658b20a25b61b6d07ee9fe0750dae7
2024-10-07 15:18:34 +01:00
Riccardo CipolleschiandBlake Friedman 1c47b60585 Fix the generation of .xcode.env.local (#46661)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46661

The previous approach was brittle and it was not working in all the scenarios.

This is the same approach used [by Expo](https://github.com/expo/expo/blob/12f24ea7fdbc8bab864d7852ae8e7275e44db4df/packages/expo-modules-autolinking/scripts/ios/xcode_env_generator.rb#L37C44-L37C75) (thanks guys! :D) and it looks like it is more stable.

This should definitely fix [#43285](https://github.com/facebook/react-native/issues/43285).

## Changelog
[Internal] - Fix the generation of .xcode.env.local

Reviewed By: cortinico

Differential Revision: D63460707

fbshipit-source-id: c6732adce3df5f8365b17ed9c500c38f773ecee5
2024-10-07 15:18:33 +01:00
zhongwuzwandBlake Friedman 756867933e Fabric: Fixes animations strict weak ordering sorted check failed (#46582)
Summary:
Fixes https://github.com/facebook/react-native/issues/46568 . cc cipolleschi

## Changelog:

[IOS] [FIXED] - Fabric: Fixes animations strict weak ordering sorted check failed

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

Test Plan:
See issue in  https://github.com/facebook/react-native/issues/46568

## Repro steps
- Install Xcode 16.0
- navigate to react-native-github
- yarn install
- cd packages/rn-tester
- bundle install
- RCT_NEW_ARCH_ENABLED=1 bundle exec pod install
open RNTesterPods.xcworkspace to open Xcode

{F1885373361}

Testing with Reproducer from OSS
|  Paper |  Fabric (With Fix) |
|--------|-----------------|
| {F1885395747} | {F1885395870} |

Android - LayoutAnimation (Looks like it has been broken and not working way before this changes.)
 https://pxl.cl/5DGVv

Reviewed By: cipolleschi

Differential Revision: D63399017

Pulled By: realsoelynn

fbshipit-source-id: aaf4ac2884ccca2da7e90a52a8ef10df6ae4fc8a
2024-10-07 15:18:33 +01:00
Tomasz ŻelawskiandBlake Friedman 273ad9c070 feat: Expose MetroConfig type directly from @react-native/metro-config (#46602)
Summary:
React Native [app template provided by the CLI](https://github.com/react-native-community/template) currently uses [`metro-config` directly for `MetroConfig` type](https://github.com/react-native-community/template/blob/main/template/metro.config.js#L7).
However, it doesn't have `metro-config` as neither a dependency or dev dependency, which can lead to version mismatches.

While this is obviously a mistake on the template repo side, `metro-config` versions aren't matched with `react-native` versions. Therefore, getting the correct version of `metro-config` from `react-native/metro-config` would require reflecting on `react-native/metro-config`'s package.json etc. which is far from ideal. In my opinion it's would be much better to expose `MetroConfig` type from `react-native/metro-config` directly.

Version mismatching can happen in a monorepo setup. Say we have the monorepo structure using Yarn Modern:

```tree
.
├── RN75-app (workspace)
├── RN76-app (workspace)
│   ├── metro.config.js
│   └── node_modules
│       └── react-native
│           └── metro-config (0.76)
│               └── node_modules
│                   └── metro-config (version for 0.76)
└── node_modules
    ├── react-native
    │   └── metro-config (0.75)
    └── metro-config (version for 0.75)
```

`react-native@0.75` gets hoisted to the monorepo root while `react-native@0.76` sits in an RN 0.76 app workspace.

Say we have the following `RN76-app/metro.config.js` contents:

```js
const {getDefaultConfig, mergeConfig} = require('react-native/metro-config');

/**
 * Metro configuration
 * https://reactnative.dev/docs/metro
 *
 * type {import('metro-config').MetroConfig}
 */
const config = {};

module.exports = mergeConfig(getDefaultConfig(__dirname), config);
```

In this case, `require('react-native/metro-config')` would resolve to `RN76-app/node_modules/react-native/node_modules/metro-config` since `react-native/metro-config` is a (dev) dependency of the App.

However `import('metro-config).MetroConfig` would resolve to `node_modules/metro-config` since it's not a direct dependency.

This is how we have a mismatch - imported functions come from different packages than imported type.

## Changelog:

[GENERAL] [ADDED] - Expose `MetroConfig` type directly from `react-native/metro-config`.

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

Test Plan:
`yarn build` to generate dist for `react-native/metro-config`, see it has the export of `MetroConfig`.

## Notes

If this PR gets approved, I'll submit relevant one to the CLI template.

Reviewed By: huntie

Differential Revision: D63258881

Pulled By: robhogan

fbshipit-source-id: e6f3c880eb4a0aa902c62932d58f243c38b07c2e
2024-10-07 15:18:33 +01:00
Blake Friedman 9628882922 Update Podfile.lock
Changelog: [Internal]
2024-10-01 13:29:05 +01:00
React Native Bot dbd9952e0a Release 0.76.0-rc.3
#publish-packages-to-npm&next
2024-10-01 10:20:51 +00:00
Blake Friedman 4e10c8b602 [LOCAL] Fix conflict on package.json 2024-09-30 15:06:40 +01:00
Nicola CortiandGitHub 52322fbd0e [0.76] Fix ReactFragment on New Architecture (#46675) 2024-09-30 14:44:22 +01:00
Alex HuntandGitHub 2f04dfe795 [0.76] Use Metro terminal reporter for dev-middleware logs (#46646) 2024-09-30 14:43:19 +01:00
5a0df6d0bf [0.76] Simplify key handling in start command (#46645)
Co-authored-by: Blake Friedman <blakef@meta.com>
2024-09-30 14:43:01 +01:00
Alex HuntandGitHub 6a24df7eaa [0.76] Add CLI selection of multiple debug targets (#46644) 2024-09-30 14:41:01 +01:00
Alex HuntandGitHub 2a344a9580 [0.76] Update Metro to 0.81.0-alpha.2 (#46643) 2024-09-30 14:40:42 +01:00
Alex HuntandBlake Friedman d56fb57502 Switch to hermes-parser in eslint-config
Summary:
Similar to D63541483, modernises our Flow syntax support for our published ESLint config to use `hermes-eslint` (`hermes-parser`).

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D63541856

fbshipit-source-id: 06cc5725faf5934fda07713ec1dac54ff9c32ddf
2024-09-30 14:36:59 +01:00
Alex HuntandBlake Friedman ddeb5081b8 Switch Babel parsing from legacy Flow plugin to hermes-parser (#46696)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46696

Following D62161923, we began to lose sync with modern Flow syntax when Metro's `transformer.hermesParser` option is disabled. This config option loads Babel for transformation (instead of `hermes-parser`), which requires a Babel plugin to parse (not strip) Flow syntax.

This diff migrates us away from `babel/plugin-syntax-flow` (see also https://github.com/babel/babel/issues/16264) and uses the modern [`babel-plugin-syntax-hermes-parser`](https://www.npmjs.com/package/babel-plugin-syntax-hermes-parser) instead (a component of the modern Hermes Parser stack).

Following this change, new projects that unset `transformer.hermesParser` will compile.

Resolves https://github.com/facebook/react-native/issues/46601.

Changelog:
[General][Fixed] - Fix parsing of modern Flow syntax when `transformer.hermesParser = false` is configured in Metro config

Reviewed By: cipolleschi

Differential Revision: D63535216

fbshipit-source-id: d2c6ddec030d89e2698e03b76194cf3568d04e6b
2024-09-30 14:34:46 +01:00
Alex HuntandBlake Friedman dfef912c89 Switch to hermes-parser in eslint-* package tests (#46699)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46699

Switch from legacy Babel Flow parser integrations to the Meta-maintained `hermes-eslint` and `babel-plugin-syntax-hermes-parser` packages (both part of the `hermes-parser` codebase).

Required to unblock D63535216.

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D63541483

fbshipit-source-id: 04ccfa04c9a2b8c0a87ef1a5c38e952971838b77
2024-09-30 14:33:39 +01:00
Nicola CortiandBlake Friedman dabb3dff00 Add Android implementation for DevMenu Module (#46694)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46694

The DevMenu module was never implemented on Android. This adds its implementation by mirroring the iOS implementation.

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

Changelog:
[Android] [Fixed] - Add missing Android implementation for DevMenu Module

Reviewed By: cipolleschi

Differential Revision: D63535172

fbshipit-source-id: 791e72b46b7d3264b98e85a73f2d9025dc3a2c7d
2024-09-30 14:30:50 +01:00
Blake FriedmanandBlake Friedman 4f26100d11 cli: fix init when called as npx react-native init (#46677)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46677

Since removing `react-native-community/cli` as a dependency in 0.76 the `npx react-native init` command isn't working.  This is the deprecated way to run this command, but users should still expect it to work for now.

This now forks this kind of request to `npx react-native-community/cli init <args>` as described in the warning logs to the user.

Changelog: [Internal]

Issue: reactwg/react-native-releases#508

Reviewed By: cortinico

Differential Revision: D63467046

fbshipit-source-id: 84560bdae8d6f62629dee61da3cbbf544b9a83b2
2024-09-30 14:30:33 +01:00
Nicola CortiandBlake Friedman 3ee652a3d3 RNGP: Read enableWarningsAsErrors property correctly (#46657)
Summary:
I've noticed that some users are reporting build failures due to warnings inside RNGP.
We do have `allWarningsAsErrors` set to true for everyone (also for users).
That's too aggressive, and can cause build failures which are not necessary. Let's keep it enabled only on our CI (when the `enableWarningsAsErrors` property is set).

## Changelog:

[INTERNAL] - RNGP: Read `enableWarningsAsErrors` property correctly

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

Test Plan: CI

Reviewed By: NickGerleman

Differential Revision: D63459601

Pulled By: cortinico

fbshipit-source-id: 0307e8d6771518038a5abe27ca5a993cb0a9f8c0
2024-09-30 14:30:11 +01:00
tutejsyandBlake Friedman 166984e1e2 Fix applying of tintColor and progressViewOffset props for RefreshControl component (#46628)
Summary:
While developing my project with New Architecture enabled I've found out that properties `tintColor` and `progressViewOffset` of component `RefreshControl` don't apply on iOS.  This happens due to the lack of handling of these properties in the `RCTPullToRefreshViewComponentView.mm` class.

The bug can be easily reproduced in RNTester app on RefreshControlExample.js screen, since it has property `tintColor="#ff0000"` (Red color), but RefreshControl renders with gray color:

<img width="300" alt="RefreshControlExample.js" src="https://github.com/user-attachments/assets/10931204-dbe8-4cbd-9adc-d0f38319febd">

<img width="300" alt="gray Refresh Control" src="https://github.com/user-attachments/assets/e5d088e8-b3f5-46b8-9284-9b452232ad10">

<br />
<br />

This PR is opened to fix that by applying `tintColor` and `progressViewOffset` props to `_refreshControl` in `RCTPullToRefreshViewComponentView.mm` class.

Fixes https://github.com/facebook/react-native/pull/46628

## Changelog:

[IOS][FIXED] - Fix applying of tintColor and progressViewOffset props for RefreshControl component with New Architecture enabled

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

Test Plan:
1. Run rn-tester app with New Architecture enabled on iOS
2. Open screen of RefreshControl component:

<img width="300" alt="Снимок экрана 2024-09-24 в 19 48 49" src="https://github.com/user-attachments/assets/94a2d02d-f3e3-4e18-a345-87c22d4a2620">

3. Open `/packages/rn-tester/js/examples/RefreshControl/RefreshControlExample.js` file and change properties `tintColor` and `progressViewOffset` of  RefreshControl components on the line 85:

<img width="300" alt="Снимок экрана 2024-09-24 в 22 01 19" src="https://github.com/user-attachments/assets/425826a6-d34c-4316-8484-e65f125a8b28">

4. check that your changes applied:

<img width="300" alt="Снимок экрана 2024-09-24 в 19 54 46" src="https://github.com/user-attachments/assets/b97621f1-b553-48c9-bc81-e04a99a7e099">

Reviewed By: cortinico

Differential Revision: D63381050

Pulled By: cipolleschi

fbshipit-source-id: 4f3aed8bd7a1e42ce2a75aa19740fd8be1623c86
2024-09-30 14:29:44 +01:00
Oskar KwaśniewskiandBlake Friedman f22a5ef4ed feat: improve RCTAppDelegate usage for brownfield (#46625)
Summary:
This PR improves the usage of `RCTAppDelegate` for brownfield scenarios.

Currently, when we want to integrate React Native with a brownfield app users might not want to initialize React Native in the main window. They may want to create it later.

Example usage:

```swift
class AppDelegate: RCTAppDelegate {
   override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
      // Disable automatically creating react native window
      self.automaticallyLoadReactNativeWindow = false

      return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}
```

```swift
import Foundation
import React
import React_RCTAppDelegate

class SettingsViewController: UIViewController {

  override func viewDidLoad() {
    super.viewDidLoad()
    self.view = (RCTSharedApplication()?.delegate as? RCTAppDelegate)?.rootViewFactory .view(withModuleName: "Settings", initialProperties: [:])
  }
}
```

## Changelog:

[IOS] [ADDED] - improve RCTAppDelegate usage for brownfield, add `automaticallyLoadReactNativeWindow` flag

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

Test Plan: CI Green

Reviewed By: cortinico

Differential Revision: D63325397

Pulled By: cipolleschi

fbshipit-source-id: 1361bda5fcd91f4933219871c64a84a83c281c34
2024-09-30 14:29:05 +01:00
HaileyandBlake Friedman e61606a0a1 convert NSNull to nil before checking type in readAsDataURL (#46635)
Summary:
This issue original arose out of https://github.com/bluesky-social/social-app/issues/5100. Copying the description (with my general understanding of the problem) from the patch PR to here as well.

There's a crash that comes up in the following, pretty specific scenario:

- Have a response that has an empty body
- Do not include a `content-type` header in the response
- Set the `x-content-type-options` header to `nosniff`

RN handles the response for a request in this block of code: https://github.com/facebook/react-native/blob/303e0ed7641409acf2d852c077f6be426afd7a0c/packages/react-native/Libraries/Blob/RCTBlobManager.mm#L314-L326

Here, we see that values of `nil` - which `[response MIMEType]` will return when no `content-type` is provided in the response and the actual type cannot be determined (https://developer.apple.com/documentation/foundation/nsurlresponse/1411613-mimetype) - gets converted to `NSNull` by `RCTNullIfNil`.

When we get back over to `readAsDataURL`, we see that we grab the type from the dictionary and check if its `nil` before calling `length` on the string. https://github.com/facebook/react-native/blob/303e0ed7641409acf2d852c077f6be426afd7a0c/packages/react-native/Libraries/Blob/RCTFileReaderModule.mm#L74-L77

However, this check is dubious, because the value will never actually be `nil`. It will always either be `NSString` or `NSNull` because of the `RCTNullIfNil` call made above and `[RCTConvert NSString]` seems to just return the input if it is `NSNull`.

## Changelog:

[IOS] [FIXED] - Convert `NSNull` to `nil` before checking `type` in `readAsDataURL`

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

Test Plan:
This is a little awkward to test, but essentially this comes up in the following scenario that is described (and "tested" as being fixed by tweaking) in https://github.com/bluesky-social/social-app/issues/5100. I have personally tested by using Cloudflare rules to add/remove that particular header from an empty body response. You could also test this with a little local web server if you want.

### Before

https://github.com/user-attachments/assets/deb86c68-2251-4fef-9705-a1c93584e83e

### After

https://github.com/user-attachments/assets/9ffab11b-b2c8-4a83-afd6-0a55fed3ae9b

Reviewed By: dmytrorykun

Differential Revision: D63381947

Pulled By: cipolleschi

fbshipit-source-id: b2b4944d998133611592eed8d112faa6195587bd
2024-09-30 14:28:21 +01:00
Renaud ChaputandBlake Friedman 83f1e7d7d0 Fix <KeyboardAvoidingView> with floating keyboard on iPad (#44859)
Summary:
On iPadOS, users can change the kind of keyboard displayed onscreen, going from normal keyboard, to split keyboard (one half on the left of the screen, one half on the right), or a floating keyboard that you can move around the screen.

When a non-normal kind of keyboard is used, `<KeyboardAvoidingView>` calculations are all wrong and, depending on the `behavior` prop, can make your screen completely hidden.

This PR attempts to detect that the keyboard is not the "normal displayed-at-bottom-of-screen" keyboard, and forces `enable={false}` if this happens.

The approach of comparing the keyboard width with the window width comes from this comment: https://github.com/facebook/react-native/issues/29473#issuecomment-696658937

A better fix might be to detect the kind of keyboard used, but this involves native code changes and I do not know iOS enough to do that. In addition, I have not found an easy way to do it using iOS APIs after a quick search.

I also chose to cache the window width as a class attribute. Maybe this is not needed as `Dimensions.get('window').width` is very fast and can be called on every keyboard event?

This fixes https://github.com/facebook/react-native/issues/44068 and https://github.com/facebook/react-native/issues/29473

## Changelog:

[IOS] [FIXED] - Fix `<KeyboardAvoidingView>` with floating keyboard on iPadOS

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

Test Plan:
Tested using RNTester and the "Keyboard Avoiding View with different behaviors" example.

Before:

https://github.com/facebook/react-native/assets/42070/111598a3-286c-464d-8db8-73afb35cd7f9

After:

https://github.com/facebook/react-native/assets/42070/0b3bc94f-8b67-4f42-8a83-e11555080268

Reviewed By: cortinico

Differential Revision: D62844854

Pulled By: cipolleschi

fbshipit-source-id: 577444be50019572955a013969d78178914b5b8d
2024-09-30 14:27:58 +01:00
Nick GerlemanandBlake Friedman ba7fca8cbd Fix measuring text with incorrect hyphenationFrequency
Summary:
A typo means TextLayoutManager will incorrectly measure text as if `LineBreaker.HYPHENATION_FREQUENCY_NORMAL` is set, instead of the correct default of `LineBreaker.HYPHENATION_FREQUENCY_NONE` which we use to display the `TextView`. This causes truncation if hyphenation would have caused text to be shorter than if not hyphenated. Fix the typo.

Changelog: [Android][Fixed] - Fix measuring text with incorrect hyphenationFrequency

Reviewed By: mellyeliu

Differential Revision: D63293027

fbshipit-source-id: baaf2ae2676548cf0815ae96e324af273be6f99e
2024-09-30 14:27:39 +01:00
Nicola CortiandBlake Friedman cffeb603de Properly set REACTNATIVE_MERGED_SO for autolinked libraries. (#46606)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46606

This fixes this issue reported here:
https://github.com/react-native-community/discussions-and-proposals/discussions/816#discussioncomment-10673136

reported by both SWM and Expo.

The problem is that `REACTNATIVE_MERGED_SO` is not properly set for autolinked libraries so they can't access it
to understand if the version of ReactNative has merged so libraries or not.
This fixes it, I've tested against
https://github.com/tomekzaw/repro-reactnative-merged-so
reproducer provided by tomekzaw

Changelog:
[Android] [Fixed] - Properly set `REACTNATIVE_MERGED_SO` for autolinked libraries

Reviewed By: rubennorte

Differential Revision: D63262687

fbshipit-source-id: c505dce9036bb4cd0366b7ab99412368963273af
2024-09-30 14:26:41 +01:00
Blake Friedman d334f4d77e Update Podfile.lock
Changelog: [Internal]
2024-09-24 11:52:21 +01:00
React Native Bot 23f62acd83 Release 0.76.0-rc.2
#publish-packages-to-npm&next
2024-09-24 08:25:33 +00:00
Riccardo CipolleschiandGitHub 1099c0ccf7 [RN][iOS] Fix SVC for lineBreakModeIOS (#46514) 2024-09-23 14:30:05 +01:00
Riccardo CipolleschiandBlake Friedman e8fdd3c5ac Fix crash when navigating away from screens (#46559)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46559

There is an edge case when we navigate away from a screen that contains a scroll view where one of the UISCrollViewDelegates does not implement the scrollViewDidEndDecelerating method.

This happens because the Macro used assumes that the event that we are forwarding is the actual method from where the macro is called. Which is not true when it comes to `didMoveToWindow`.

This change fixes that by explicitly expanding the macro in this scenario and passing the right selector.

## Changelog:
[iOS][Fixed] - Fixed a crash when navigating away from a screen that contains a scrollView

## Facebook
This should fix T201780472

Reviewed By: philIip

Differential Revision: D62935876

fbshipit-source-id: e29aadf201c8066b5d3b7b0ada21fa8d763e9af0
2024-09-23 14:28:54 +01:00
Nicola CortiandBlake Friedman a22e29c192 Fix init behavior for 0.76 (#46560)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46560

The `init` command should still keep on working till 2024-12-31

This handles this scenario as currently `npx react-native@next init` is broken.

Changelog:
[Internal] [Changed] - Clarify init behavior for 0.76

Reviewed By: huntie, cipolleschi

Differential Revision: D62958747

fbshipit-source-id: ce3d974df55162720d59a7ece7fcb816e257185d
2024-09-23 14:28:31 +01:00
DawidandBlake Friedman 6d300b6fb8 fix app crashing when reloads overlap (#46416)
Summary:
Regarding the [issue](https://github.com/facebook/react-native/issues/44755) where the app sometimes crashes due to race condition when two reloads overlap in unfortunate way. This PR fixes it in some way by introducing throttling on reload command. For now I set it to 700ms as I was still able to reproduce it on 500-550ms for provided repro in the issue. The problem may still happen for bigger apps where reload may take more time to finish.

## 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] - throttle reload command

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

Test Plan: I've tested on provided repro and a smaller app trying to brake it.

Reviewed By: huntie

Differential Revision: D62847076

Pulled By: cipolleschi

fbshipit-source-id: 6471f792d6b692e87e3e98a699443a88c6ef43cd
2024-09-23 14:26:26 +01:00
Alex HuntandBlake Friedman e490b1ed9f Add missing babel-jest dependency to react-native package (#46539)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46539

Resubmission of D62583665, addressing internal CI errors from dep relocation.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D62867287

fbshipit-source-id: d28d35e2c0a82d7d2bfdaa26c4f9fe8c3a5ef41a
2024-09-23 14:25:35 +01:00
MasGaNoandBlake Friedman 1a04e5db62 fix(ios): allow pods mixte type settings on post-install (#46536)
Summary:
Following the discussion on https://github.com/facebook/react-native/issues/46505, this PR aims to allow mixte type configuration (String and/or Array of String) during the post installation of pods.

## 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] - allow pods mixte type settings on post-install

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

Test Plan: `packages/react-native/scripts/cocoapods/__tests__/utils-test.rb` test suits was updated to support array and works as expected

Reviewed By: shwanton

Differential Revision: D62870582

Pulled By: cipolleschi

fbshipit-source-id: c0ace6d9d20e6609ceae5aafd236d97fc9e86ddf
2024-09-23 14:24:26 +01:00
Vin XiandBlake Friedman efc475c3f9 fix(react-native-xcode): Add back BUNDLE_COMMAND (#46495)
Summary:
In this PR https://github.com/facebook/react-native/issues/45560  the BUNDLE_COMMAND initialization was removed while it is still being used. Without it, building from Xcode throws unknown options error for Physical iOS devices.

I have just brought back the initialization from the PR before that, so the bundle phase is successful.

## Changelog:
[IOS][Fixed] - Add back the BUNDLE_COMMAND

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

Test Plan: I have bundled release builds in Xcode. Everything seems to be fine.

Reviewed By: cortinico

Differential Revision: D62846877

Pulled By: cipolleschi

fbshipit-source-id: 3f07e8c0bc5acf98177582f1fee9a55ae77b31a1
2024-09-23 14:23:59 +01:00
Alex HuntandBlake Friedman 947734f235 Switch to Hermes parser in Jest preset (#46465)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46465

Resolves https://github.com/facebook/react-native/issues/46355.

Changelog: [Internal]

bypass-github-export-checks

Reviewed By: robhogan

Differential Revision: D62583337

fbshipit-source-id: 64813d84c2a6395be8ef4f138398834ddae6e54b
2024-09-23 14:23:17 +01:00
shubhamguptadream11andBlake Friedman a4210ef245 fix(iOS): fire onMomentumScrollEnd when UIScrollView is removed from window (#46277)
Summary:
Solves this issue: https://github.com/facebook/react-native/issues/46276

## 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] [ADDED] - fire onMomentumScrollEnd when UIScrollView is removed from window

**Why the issue is happening?**
The `onMomentumScrollEnd` event is typically triggered by the `UIScrollView` delegate methods `scrollViewDidEndDecelerating` and `scrollViewDidEndScrollingAnimation`. However, if the scroll view is removed from the window while navigating away, these delegate methods are not called, resulting in the event not being dispatched.

This behaviour was particularly problematic in scenarios where a scroll view is in motion, and the user navigates away from the screen before the scrolling completes. In such cases, the `onMomentumScrollEnd` event would never fire, which further make scroll area un touchable or un responsive.

**What we changed?**
In the didMoveToWindow method, we added logic to handle the scenario where the UIScrollView is being removed from the window (i.e., when the component is unmounted or the user navigates away). Here’s a breakdown of the changes:

- **Added a Check for Scroll State:** We check if the UIScrollView was decelerating or had stopped tracking (_scrollView.isDecelerating || _scrollView.isTracking == NO).

- **Manually Triggered onMomentumScrollEnd:** If the scroll view was in motion and is being removed from the window, we manually trigger the `onMomentumScrollEnd` event to ensure that the final scroll state is captured.

**_I had fixed this issue on both Old and New arch._**

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

Test Plan:
Attaching a video with working solution:

https://github.com/user-attachments/assets/1a1f3765-3f11-46c3-af18-330c88478db8

Reviewed By: andrewdacenko

Differential Revision: D62374798

Pulled By: cipolleschi

fbshipit-source-id: 014be8d313bab0257459dc4e53f5b0386a39d5e0
2024-09-23 14:20:59 +01:00
Saad NajmiandBlake Friedman d129e9a1b5 Revert "feat: build codegen on postinstall (#46227)" (#46420)
Summary:
This reverts commit 0cb97f0261.

Revert this commit that adds a `post install` script for a couple of reasons:

1. (EDIT: This turns out to be unrelated) The `postinstall` script causes `yarn install` to fail on React Native macOS, where we use Yarn 4. I'm not entirely sure why, but I probably won't debug it for the rest of the reasons.
2. `postinstall` scripts (at least inside Microsoft) are viewed as a security risk. Any package in your dependency tree can get compromised, add the phase, and run arbitrary code. This has happened in the past with React Native past if I recall correctly. As such, we disable `postinstall` scripts in many of our repos (including `rnx-kit` and `react-native-test-app`).
3. The issue this is trying to solve is to help newcomers avoid a stale cache when they switch branches in the React Native monorepo and only run `yarn install`. I think it would be sufficient to add some documentation somewhere that it is expected one runs `yarn && yarn build` to use this repo locally? That's a fairly common practice in monorepos, at least ones inside Microsoft.

## Changelog:

[INTERNAL] [SECURITY] - Remove post install script phase in the React Native monorepo

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

Test Plan: CI should pass

Reviewed By: christophpurrer, robhogan, cortinico, rshest

Differential Revision: D62755022

Pulled By: huntie

fbshipit-source-id: bf94ed33e3e451ea337ef7a6984f7ba964d0b212
2024-09-23 14:20:09 +01:00
Riccardo Cipolleschi b958fe13f9 [LOCAL] Bump Podfile.lock 2024-09-16 20:07:15 +02:00
React Native Bot ec9e1718aa Release 0.76.0-rc.1
#publish-packages-to-npm&next
2024-09-16 16:25:38 +00:00
Riccardo Cipolleschi c4714e81d8 [LOCAL] Bump Podfile.lock 2024-09-16 16:01:20 +02:00
Riccardo Cipolleschi b8fa7c80ff Revert "Animated: Restore AnimatedNode.prototype.toJSON (#46498)"
This reverts commit 83eb95e72a.
2024-09-16 16:00:00 +02:00
Rob HoganandGitHub 4126ce844d [0.76] Bump Metro to 0.81.0-alpha (#46431) 2024-09-16 15:44:00 +02:00
Rodolfo Gomez SirimarcoandRiccardo Cipolleschi 95021db72a Fix Headless Crash Tried to finish non-existent task with id (#46497)
Summary:
Sometimes a headless task tries to finish, but it doesn’t exist, which causes an exception.
No one knows how to reliably reproduce it, as it could be a race condition. However, if you attempt to remove a task that has already been removed, it shouldn’t cause an issue since you're trying to remove something that’s already gone (which is exactly what you want).

Fixes:
 - https://github.com/facebook/react-native/issues/46496
 - https://github.com/facebook/react-native/issues/33883
 - https://github.com/facebook/react-native/issues/27597
 - https://github.com/transistorsoft/react-native-background-fetch/issues/202
 - https://github.com/transistorsoft/react-native-background-fetch/issues/369
 - https://github.com/transistorsoft/react-native-background-geolocation/issues/2096
 - https://github.com/jpush/jpush-react-native/issues/78

## Stacktrace:
```
Fatal Exception: java.lang.AssertionError: Tried to finish non-existent task with id 28.
  at com.facebook.infer.annotation.Assertions.assertCondition(Assertions.java:88)
  at com.facebook.react.jstasks.HeadlessJsTaskContext.finishTask(HeadlessJsTaskContext.java:179)
  at com.facebook.react.jstasks.HeadlessJsTaskContext$3.run(HeadlessJsTaskContext.java:217)
  at android.os.Handler.handleCallback(Handler.java:958)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loopOnce(Looper.java:257)
  at android.os.Looper.loop(Looper.java:368)
  at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:233)
  at java.lang.Thread.run(Thread.java:1012)
```

## Screenshot

https://github.com/user-attachments/assets/101f0f53-95c9-40ec-a59d-22d6d474b457

## Changelog:

[ANDROID] [FIXED] - Fix Headless Crash `Tried to finish non-existent task with id`

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

Test Plan:
I created an example where I attempt to remove a task that doesn’t exist.

Example: https://github.com/RodolfoGS/react-native-fix-non-existent-task

### How to reproduce using the example above:
1. `git clone git@github.com:RodolfoGS/react-native-fix-non-existent-task.git`
2. `cd react-native-fix-non-existent-task`
3. `npm install`
4. `npm run android`
5. Notice the crash

### Steps to create the example from scratch and reproduce the crash:
1. `npx react-native-community/cli@latest init AwesomeProject`
2. `cd AwesomeProject`
3. Add call to finishTask to reproduce the crash (https://github.com/RodolfoGS/react-native-fix-non-existent-task/commit/6fe3c1388a58b9ffdcca5f9c6f00a4f2fea725ea)
4. `npm run android`
5. Notice the crash

Reviewed By: javache

Differential Revision: D62738059

Pulled By: rshest

fbshipit-source-id: 3232dc76ba8a069279c2b741d62372537a3f9140
2024-09-16 15:43:00 +02:00
Tim YungandRiccardo Cipolleschi 83eb95e72a Animated: Restore AnimatedNode.prototype.toJSON (#46498)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46498

Looks like this is still necessary because we still run into this error when using the Components tab when using React DevTools:

> TypeError: cyclical structure in JSON object

This effectively reverts https://github.com/facebook/react-native/pull/46382.

Changelog:
[General][Changed] - AnimatedNode (and its subclasses) once again implement `toJSON()`.

Reviewed By: javache

Differential Revision: D62690380

fbshipit-source-id: d5b7c1d156b49838abefe48a7d7b61471cc3488a
2024-09-16 15:42:54 +02:00
Nick GerlemanandRiccardo Cipolleschi 3b44182c1d Unhide new arch layout props (#46478)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46478

These are all supported in the new arch (default as of 0.76), across all platforms. but were previously hidden from types, and undocumented.

I will make a pick request for this change, and we should then add these to documentation.

Changelog:
[General][Added] - Unhide new arch layout props

Reviewed By: cortinico

Differential Revision: D62616897

fbshipit-source-id: f6c2e71785284e667824a76918ccf2724adc4e98
2024-09-16 15:42:43 +02:00
Alan LeeandRiccardo Cipolleschi f4fd248d53 fix SafeAreaView mis-used import (#46402)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46402

JS code for importing SafeAreaView is causing error in windows due to import being used.
Fix it by using conditional require instead

Changelog:
[Internal] -  Fixed mis-used import of core only SafeAreaView in JS

Reviewed By: fkgozali

Differential Revision: D62392588

fbshipit-source-id: 65c4728ff73b43cc54543ec2d141a88fce1275ca
2024-09-16 15:41:43 +02:00
Nicola CortiandRiccardo Cipolleschi c41ab475b1 Back out "Remove some Tasks overhead" (#46483)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46483

Original commit changeset: 631d741bd2ec

This is breaking the RedBox on React Native 0.76 on Android when not connected to Metro.

Original Phabricator Diff: D62213722

Changelog:
[Internal] [Changed] - Back out "[react-native] Remove some Tasks overhead"

Reviewed By: cipolleschi

Differential Revision: D62644614

fbshipit-source-id: a092614da78bef65546c2539a3ebc9bff5e807b2
2024-09-16 15:41:39 +02:00
Oskar KwaśniewskiandRiccardo Cipolleschi 1dd89df561 fix(iOS): don't reference PrivacyInfo.xcprivacy twice for new projects (#46457)
Summary:
This PR fixes an issue with PrivacyInfo files.

When generating a new project for using the latest RC 0.76.0.rc0 I got two privacy manifests references in Xcode.

This is because `PrivacyManifestUtils` look for build phase reference:

```ruby
reference_exists = target.resources_build_phase.files_references.any? { |file_ref| file_ref&.path&.end_with? "xcprivacy" }
```

Which doesn't exist for the generated template.

Here is how Xcode file tree looks like after installing pods:

![CleanShot 2024-09-12 at 13 23 21@2x](https://github.com/user-attachments/assets/44e5bb55-a1ab-4b4b-bfe4-e4a6808afd15)

## Changelog:

[IOS] [FIXED] - don't reference PrivacyInfo.xcprivacy twice for new projects

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

Test Plan:
1. Generate a new project
2. Execute pod install
3. Check if only one PrivacyInfo file exists

Reviewed By: cortinico

Differential Revision: D62580116

Pulled By: cipolleschi

fbshipit-source-id: 1224a41307ae6c9b862832f145baf0edc92476d6
2024-09-16 15:41:34 +02:00
Riccardo Cipolleschi a0f11acc34 Fix SVC Validator for Box Shadow and filter (#46454)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46454

The SVC Validator have no idea on how to process a simple NSArray *.

With this change, we are creating two named types for the NSArray:
* BoxShadowArray
* FilterArray
To create unique types that we can reference in JS.

We are then enhancing the `getProcessor` function to return the proper processor when those types are found in the NativeViewConfig

## Changelog:
[iOS][Fixed] - Fixed warnings when validating SVC

## Facebook:
This change is OTA safe: even when we ship the JS before the native code, the new cases in the switch will be never hit, similarly to the situation we have right now.

As soon as the native code is shipped, the new cases will start get hit and the wrning will disappear

Reviewed By: NickGerleman

Differential Revision: D62574612

fbshipit-source-id: d173bf5534ee5e436f23a4bc6e2fb25e72a4b06d
2024-09-16 15:41:26 +02:00
Riccardo Cipolleschi 507934f7d9 Fix Basic SVC for RNTester iOS (#46439)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46439

The SVC for some components on iOS got out of sync.
This was creating warnings in the React Native DevTools and it was affecting the release of 0.76.

With this change, I updated the manually written SVC so that we don't have warnings anymore.

We still have to fix the `boxShadow` and `filter`. This will happen in a later change.

## Changelog
[iOS][Fixed] - Solved SVC warnings for RNTester

Reviewed By: NickGerleman

Differential Revision: D62501704

fbshipit-source-id: 3c02f7615c3511a97eba73a2ddaa713d2e4e30f0
2024-09-16 15:41:22 +02:00
Jorge Cabiedes AcostaandRiccardo Cipolleschi e6396039c7 Rename DropShadowPrimitive to DropShadowValue (#46476)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46476

Keep the type naming consistent with examples like `DimensionValue`, `ColorValue`, etc.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D62614579

fbshipit-source-id: 824ea9af17487a4459e8f39d9374e2e00452db43
2024-09-16 15:41:03 +02:00
Jorge Cabiedes AcostaandRiccardo Cipolleschi fdb5721ead Rename BoxShadowPrimitive to BoxShadowValue (#46485)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46485

Keep the type naming consistent with examples like `DimensionValue`, `ColorValue`, etc.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D62614444

fbshipit-source-id: 3ff66d3f52623b6fb7bd8d31d2910aa255ae8a31
2024-09-16 15:40:50 +02:00
Jorge Cabiedes AcostaandRiccardo Cipolleschi 123b25226a Remove experimental_ prefix from filter (#46406)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46406

As title

Second attempt at landing the new name. There were 2 issues previously which led us to revert.

1. **Error on workrooms tests.** This ended up not being caused by us but rather by D61896776. After renaming the error changed which might've caused the renaming to be blamed for the issue. It has since been resolved

2. **FB crash** FB was crashing when using drop-shadow after renaming. For some reason after renaming `filter` an invalid stylex property was making FB crash. We don't know why renaming uncovered the issue but the the code was using unsupported features on RN (`calc` & `stylex`) which then led to passing a raw unsupported value for `filter` and crashing on the `processFilter` function.

FB was fixed here D62407454 to prevent crashing after landing this diff

Changelog: [General] [Changed] - Add official `filter` CSSProperty.

Reviewed By: NickGerleman

Differential Revision: D62401985

fbshipit-source-id: 14422603c40b7ddf8300029165a85655354075c3
2024-09-16 15:36:41 +02:00
Jorge Cabiedes AcostaandRiccardo Cipolleschi 6259ee91bd Remove experimental_ prefix from boxShadow (#46404)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46404

As title

Second attempt to rename the prop. BoxShadow caused no issues after renaming but it was batched with `filter` which we reverted.

Changelog: [General] [Changed] - Add official `boxShadow` CSSProperty.

Reviewed By: NickGerleman, cyan33

Differential Revision: D62400814

fbshipit-source-id: ad721f6d11d614e987048e55556b05ff74a4747d
2024-09-16 15:36:31 +02:00
Riccardo Cipolleschi b4aab7fb52 Exclude dSYM from the archive (#46472)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46472

Currently, we are building the Debug symbols (dSYM) for hermes dSYM but we are not shipping them with the xcframework.
This is correct, because Debug symbols can increase the size of Hermes thus enalrging the iOS IPA and increasing the download time when installing pods.

We distribute the dSYM separatedly, in case users needs to symbolicate Hermes stack traces.

However the path to the dSYM still appears in the Info.plist of the universal XCFramework and this can cause issues when submitting an app to apple.

This change should remove those lines from the universal framework.

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

## Changelog
[Internal] - Remove dSYM path from Info.plist

Reviewed By: cortinico

Differential Revision: D62603425

fbshipit-source-id: 038ec3d6b056a3d6f5585c8125d0430f56f11bb9
2024-09-16 15:29:38 +02:00
Tommy NguyenandRiccardo Cipolleschi 064887675b Re-add RCTHermesInstance constructor for compatibility (#46453)
Summary:
https://github.com/facebook/react-native/pull/46314 introduced a breaking change, making it hard to maintain backwards compatibility elsewhere. This change re-introduces the constructor that takes two arguments.

## Changelog:

[IOS] [FIXED] - Unbreak `RCTHermesInstance` constructor breaking change

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

Test Plan: n/a

Reviewed By: javache

Differential Revision: D62574496

Pulled By: cortinico

fbshipit-source-id: dcd15bf9694f4b14e37d61d7209193b3e448cd6b
2024-09-16 15:29:33 +02:00
Nicola CortiandRiccardo Cipolleschi 2a10923863 Bump SoLoader to 0.12.1 and remove unnecessary extra manifest metadata. (#46461)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46461

This bumps SoLoader to 0.12.1 inside React Native and cleans up the extra
`com.facebook.soloader.enabled` metadata which are not necessary anymore.

Changelog:
[Internal] [Changed] - Bump SoLoader to 0.12.1 and remove unnecessary extra manifest metadata

Reviewed By: cipolleschi

Differential Revision: D62581188

fbshipit-source-id: ff990c0af1f0f51070037fcb4c7c13fbe6bae234
2024-09-16 15:29:27 +02:00
Nicola CortiandRiccardo Cipolleschi bf14325d30 Unblock RNTester instacrashing due to SoLoader not being enabled (#46459)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46459

After the SoLoader 0.12.0 bump I've noticed RNTester is instacrashing due to us not having enabled it
explicitely in the Manifest:

Changelog:
[Internal] [Changed] - Unblock RNTester instacrashing due to SoLoader not being enabled

Reviewed By: cipolleschi

Differential Revision: D62580751

fbshipit-source-id: 3b291e7f82daf1a6bd61bc9588c2d49a389801ef
2024-09-16 15:29:22 +02:00
Nicola CortiandRiccardo Cipolleschi 2085076449 Do not stub SoLoader and use version 0.12.0 (#46422)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46422

Stubbing SoLoader comes with a couple of breaking changes (e.g. users in OSS are using `com.facebook.common.logging.FLog` which is exposed by Fresco).

In order to reduce those breaking changes, here I'm moving React Native to use SoLoader 0.12.0.
This new version comes with a constructor that accepts a MergedSoMapping implementation which we provide only for OSS apps.

Please note that the CI on this Diff will be red till SoLoader 0.12.0 releases.

Changelog:
[Internal] [Changed] - Do not stub SoLoader and use version 0.12.0

Reviewed By: cipolleschi

Differential Revision: D62447566

fbshipit-source-id: 6ff38799ed0c9f40cf3ab84be8a05979def63dc2
2024-09-16 15:29:13 +02:00
Ruslan LesiutinandRiccardo Cipolleschi d67d91407e Update debugger-frontend from 50a4d4f...e8c7943 (#46414)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46414

Changelog: [Internal] - Update `react-native/debugger-frontend` from 50a4d4f...e8c7943

Resyncs `react-native/debugger-frontend` from GitHub - see `rn-chrome-devtools-frontend` [changelog](https://github.com/facebookexperimental/rn-chrome-devtools-frontend/compare/50a4d4f7fd86c73860498a24c763d99e07bc31ae...e8c79432972029c625c91d16967b07fe61f04a61).

Reviewed By: robhogan

Differential Revision: D62436953

fbshipit-source-id: 7a877142c5713c78cb6f1a3d839c4e90f93fa0c6
2024-09-16 15:29:04 +02:00
Ruslan LesiutinandRiccardo Cipolleschi 4d67a27c37 Update debugger-frontend from a556d26...50a4d4f (#46401)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46401

Changelog: [Internal] - Update `react-native/debugger-frontend` from a556d26...50a4d4f

Resyncs `react-native/debugger-frontend` from GitHub - see `rn-chrome-devtools-frontend` [changelog](https://github.com/facebookexperimental/rn-chrome-devtools-frontend/compare/a556d261a5e2131864f4e38ded62d8f90e81c39a...50a4d4f7fd86c73860498a24c763d99e07bc31ae).

Reviewed By: huntie

Differential Revision: D62385355

fbshipit-source-id: 77056540c9d40cd7cfc8098332e86f9521633619
2024-09-16 15:29:01 +02:00
Tomek ZawadzkiandRiccardo Cipolleschi b0db081a76 Expose jsctooling via prefab (#46430)
Summary:
This PR exposes `jsctooling` prefab that contains `facebook::jsc::makeJSCRuntime` used by Reanimated and other third-party libraries previously accessed via `libjscexecutor.so`.

Based on https://github.com/facebook/react-native/pull/46423.

## Changelog:

[Android] [Changed] - Expose jsctooling via prefab

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

Test Plan: Tested on Reanimated paper-example app built from source on RN 0.76.0-rc.0 with JSC enabled

Reviewed By: cipolleschi

Differential Revision: D62492763

Pulled By: cortinico

fbshipit-source-id: 53b6c0d9bb88559c40b5b8796bf6a1513bd388d9
2024-09-16 15:28:53 +02:00
Tomek ZawadzkiandRiccardo Cipolleschi 959eafca33 Expose react_timing headers in reactnative prefab (#46427)
Summary:
This PR fixes the following error when building third-party libraries that `#include <react/fabric/Binding.h>` which includes `react/timing/primitives.h` which is not included in `reactnative` prefab.

```
FAILED: CMakeFiles/rnscreens.dir/src/main/cpp/NativeProxy.cpp.o
/Users/tomekzaw/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=aarch64-none-linux-android24 --sysroot=/Users/tomekzaw/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -DFOLLY_NO_CONFIG=1 -Drnscreens_EXPORTS -I/Users/tomekzaw/RNOS/react-native-reanimated/node_modules/react-native-screens/android/../cpp -isystem /Users/tomekzaw/.gradle/caches/8.10.1/transforms/eb5443cef7868b6c3cc54bbf3f161a63/transformed/react-android-0.76.0-rc.0-debug/prefab/modules/jsi/include -isystem /Users/tomekzaw/.gradle/caches/8.10.1/transforms/eb5443cef7868b6c3cc54bbf3f161a63/transformed/react-android-0.76.0-rc.0-debug/prefab/modules/reactnative/include -isystem /Users/tomekzaw/.gradle/caches/8.10.1/transforms/b0878eb14f826ac5f04db98523604de2/transformed/fbjni-0.6.0/prefab/modules/fbjni/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security   -fno-limit-debug-info  -fPIC -std=c++20 -MD -MT CMakeFiles/rnscreens.dir/src/main/cpp/NativeProxy.cpp.o -MF CMakeFiles/rnscreens.dir/src/main/cpp/NativeProxy.cpp.o.d -o CMakeFiles/rnscreens.dir/src/main/cpp/NativeProxy.cpp.o -c /Users/tomekzaw/RNOS/react-native-reanimated/node_modules/react-native-screens/android/src/main/cpp/NativeProxy.cpp
In file included from /Users/tomekzaw/RNOS/react-native-reanimated/node_modules/react-native-screens/android/src/main/cpp/NativeProxy.cpp:2:
In file included from /Users/tomekzaw/.gradle/caches/8.10.1/transforms/eb5443cef7868b6c3cc54bbf3f161a63/transformed/react-android-0.76.0-rc.0-debug/prefab/modules/reactnative/include/react/fabric/Binding.h:17:
In file included from /Users/tomekzaw/.gradle/caches/8.10.1/transforms/eb5443cef7868b6c3cc54bbf3f161a63/transformed/react-android-0.76.0-rc.0-debug/prefab/modules/reactnative/include/react/jni/JRuntimeScheduler.h:11:
In file included from /Users/tomekzaw/.gradle/caches/8.10.1/transforms/eb5443cef7868b6c3cc54bbf3f161a63/transformed/react-android-0.76.0-rc.0-debug/prefab/modules/reactnative/include/react/renderer/runtimescheduler/RuntimeScheduler.h:11:
/Users/tomekzaw/.gradle/caches/8.10.1/transforms/eb5443cef7868b6c3cc54bbf3f161a63/transformed/react-android-0.76.0-rc.0-debug/prefab/modules/reactnative/include/react/performance/timeline/PerformanceEntryReporter.h:10:10: fatal error: 'react/timing/primitives.h' file not found
#include <react/timing/primitives.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
```

## Changelog:

[ANDROID] [FIXED] - Expose `react_timing` headers in `reactnative` prefab

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

Test Plan: Tested on Reanimated fabric-example app with react-native-screens installed built from source on top of RN 0.76.0-rc.0 with new arch enabled

Reviewed By: cipolleschi

Differential Revision: D62492707

Pulled By: cortinico

fbshipit-source-id: 94ed7044457bea53660a6ca6d5342cf8ea20a8b4
2024-09-16 15:28:47 +02:00
Nicola CortiandRiccardo Cipolleschi bc62261dfa Expose hermestooling via prefab (#46423)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46423

This is used by Reanimated as they were previously accessing `libhermes_executor.so`

Changelog:
[Android] [Changed] - Expose hermestooling via prefab

Reviewed By: cipolleschi

Differential Revision: D62447875

fbshipit-source-id: e863c56bc5a801ee7de8a4e5d45f95481d3497f8
2024-09-16 15:28:42 +02:00
Nicola CortiandRiccardo Cipolleschi 4af4311fc8 RNGP - Sanitize the output of the config command (#46482)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46482

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

I'm sanitizing the output of the `config` command + I've added some more logging in case of failure.

Changelog:
[Android] [Fixed] - RNGP - Sanitize the output of the config command

Reviewed By: cipolleschi

Differential Revision: D62641979

fbshipit-source-id: c13d27a42beeb7a973c1802e7204631d49d3d09b
2024-09-16 15:28:34 +02:00
Hampus SjöbergandRiccardo Cipolleschi e78ea9f6d9 fix: RNGP autolink not properly filter out pure C++ TurboModules (#46381)
Summary:
Hey.

The react-native gradle plugin didn't properly filter out [Pure](https://github.com/react-native-community/cli/pull/2387) C++ TurboModules for autolinking, which caused build failures as a non-existing gradle dependency would be emitted.

This makes Pure C++ TurboModules work again for Android.

## 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][FIXED] Fix autolinking issues for Pure C++ TurboModules

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

Test Plan:
https://github.com/hsjoberg/rn75autolinkregression

Try running this repro project to observe the error:

```
1: Task failed with an exception.
-----------
* Where:
Build file '/Users/coco/Projects/Blixt/rn75autolinkregression/example/android/app/build.gradle' line: 54

* What went wrong:
A problem occurred evaluating project ':app'.
> Project with path ':react-native-cxx-turbomodule' could not be found in project ':app'.
```

Simply add the 1-line code from this PR to make the build succeed.

Cheers.

Reviewed By: cipolleschi

Differential Revision: D62377757

Pulled By: cortinico

fbshipit-source-id: 9e3fa3777b4e6e4d3f2eb0f996ac0ac7676eedbe
2024-09-16 15:28:29 +02:00
Riccardo Cipolleschi 33d175f51b [LOCAL] Bump Podfile.lock 2024-09-10 16:30:47 +01:00
React Native Bot f60fbc15ae Release 0.76.0-rc.0
#publish-packages-to-npm&next
2024-09-10 13:17:08 +00:00
Nicola Corti 28facc2824 Revert "Release 0.76.0-rc.0"
This reverts commit 1e3c583d73.
2024-09-10 14:09:13 +01:00
Nicola Corti cf5d04d3e1 [LOCAL] Fix wrong command for publishing of external-artifacts 2024-09-10 14:08:42 +01:00
React Native Bot 1e3c583d73 Release 0.76.0-rc.0
#publish-packages-to-npm&next
2024-09-10 10:47:25 +00:00
Riccardo Cipolleschi 026fd325ab [LOCAL] Fix testing script to use debug versions of the Android APK 2024-09-10 08:25:26 +01:00
Riccardo Cipolleschi b395208303 [LOCAL] Properly make ScrollView compatible with React19 2024-09-09 18:01:41 +01:00
Riccardo Cipolleschi 8041e410e3 [LOCAL] Make ScrollView compatible with React 18.3.1 2024-09-09 16:57:24 +01:00
Riccardo Cipolleschi 13ab63b60a Revert "Revert "RN: Remove forwardRef from ScrollView (#45197)""
This reverts commit 965d84314a.
2024-09-09 16:56:20 +01:00
Riccardo Cipolleschi 965d84314a Revert "RN: Remove forwardRef from ScrollView (#45197)"
This reverts commit 1341169a4b.
2024-09-09 15:03:13 +01:00
Riccardo Cipolleschi b93b378fa0 [LOCAL] Revert React 19 to React 18.3.1 2024-09-09 14:33:25 +01:00
Riccardo Cipolleschi f55759e633 [LOCAL] Bump hermes version 2024-09-09 14:30:57 +01:00
166 changed files with 63376 additions and 45810 deletions
@@ -22,7 +22,7 @@ runs:
- name: Restore Cached Artifacts
uses: actions/cache/restore@v4
with:
key: v4-hermes-artifacts-${{ inputs.flavor }}-${{ inputs.hermes-version }}-${{ inputs.react-native-version }}
key: v4-hermes-artifacts-${{ inputs.flavor }}-${{ inputs.hermes-version }}-${{ inputs.react-native-version }}-${{ hashFiles('./packages/react-native/sdks/hermes/utils/build-apple-frameworks.sh') }}
path: |
/tmp/hermes/osx-bin/${{ inputs.flavor }}
/tmp/hermes/dSYM/${{ inputs.flavor }}
@@ -200,7 +200,7 @@ runs:
uses: actions/cache/save@v4
if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, '-stable') }} # To avoid that the cache explode.
with:
key: v4-hermes-artifacts-${{ inputs.flavor }}-${{ inputs.hermes-version }}-${{ inputs.react-native-version }}
key: v4-hermes-artifacts-${{ inputs.flavor }}-${{ inputs.hermes-version }}-${{ inputs.react-native-version }}-${{ hashFiles('./packages/react-native/sdks/hermes/utils/build-apple-frameworks.sh') }}
path: |
/tmp/hermes/osx-bin/${{ inputs.flavor }}
/tmp/hermes/dSYM/${{ inputs.flavor }}
+7 -11
View File
@@ -32,8 +32,7 @@
"test-typescript": "dtslint packages/react-native/types",
"test": "jest",
"trigger-react-native-release": "node ./scripts/releases-local/trigger-react-native-release.js",
"update-lock": "npx yarn-deduplicate",
"postinstall": "cd packages/react-native-codegen && yarn build"
"update-lock": "npx yarn-deduplicate"
},
"workspaces": [
"packages/*",
@@ -50,8 +49,8 @@
"@definitelytyped/dtslint": "^0.0.127",
"@jest/create-cache-key-function": "^29.6.3",
"@pkgjs/parseargs": "^0.11.0",
"@react-native/metro-babel-transformer": "0.76.0-main",
"@react-native/metro-config": "0.76.0-main",
"@react-native/metro-babel-transformer": "0.76.0-rc.4",
"@react-native/metro-config": "0.76.0-rc.4",
"@tsconfig/node18": "1.0.1",
"@types/react": "^18.2.6",
"@typescript-eslint/parser": "^7.1.1",
@@ -87,24 +86,21 @@
"jest": "^29.6.3",
"jest-junit": "^10.0.0",
"jscodeshift": "^0.14.0",
"metro-babel-register": "^0.80.10",
"metro-memory-fs": "^0.80.10",
"metro-babel-register": "^0.81.0-alpha.2",
"metro-memory-fs": "^0.81.0-alpha.2",
"micromatch": "^4.0.4",
"mkdirp": "^0.5.1",
"node-fetch": "^2.2.0",
"nullthrows": "^1.1.1",
"prettier": "2.8.8",
"prettier-plugin-hermes-parser": "0.23.1",
"react": "19.0.0-rc-fb9a90fa48-20240614",
"react-test-renderer": "19.0.0-rc-fb9a90fa48-20240614",
"react": "18.3.1",
"react-test-renderer": "18.3.1",
"rimraf": "^3.0.2",
"shelljs": "^0.8.5",
"signedsource": "^1.0.0",
"supports-color": "^7.1.0",
"typescript": "5.0.4",
"ws": "^6.2.3"
},
"resolutions": {
"react-is": "19.0.0-rc-fb9a90fa48-20240614"
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/assets-registry",
"version": "0.76.0-main",
"version": "0.76.0-rc.4",
"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.76.0-main",
"version": "0.76.0-rc.4",
"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.76.0-main"
"@react-native/codegen": "0.76.0-rc.4"
},
"devDependencies": {
"@babel/core": "^7.25.2"
+10 -9
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/community-cli-plugin",
"version": "0.76.0-main",
"version": "0.76.0-rc.4",
"description": "Core CLI commands for React Native",
"keywords": [
"react-native",
@@ -22,24 +22,25 @@
"dist"
],
"dependencies": {
"@react-native/dev-middleware": "0.76.0-main",
"@react-native/metro-babel-transformer": "0.76.0-main",
"@react-native/dev-middleware": "0.76.0-rc.4",
"@react-native/metro-babel-transformer": "0.76.0-rc.4",
"chalk": "^4.0.0",
"execa": "^5.1.1",
"metro": "^0.80.10",
"metro-config": "^0.80.10",
"metro-core": "^0.80.10",
"invariant": "^2.2.4",
"metro": "^0.81.0-alpha.2",
"metro-config": "^0.81.0-alpha.2",
"metro-core": "^0.81.0-alpha.2",
"node-fetch": "^2.2.0",
"readline": "^1.3.0"
},
"devDependencies": {
"metro-resolver": "^0.80.10"
"metro-resolver": "^0.81.0-alpha.2"
},
"peerDependencies": {
"@react-native-community/cli-server-api": "*"
"@react-native-community/cli": "*"
},
"peerDependenciesMeta": {
"@react-native-community/cli-server-api": {
"@react-native-community/cli": {
"optional": true
}
},
@@ -0,0 +1,174 @@
/**
* 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 type TerminalReporter from 'metro/src/lib/TerminalReporter';
import chalk from 'chalk';
import fetch from 'node-fetch';
type PageDescription = $ReadOnly<{
id: string,
title: string,
description: string,
deviceName: string,
...
}>;
export default class OpenDebuggerKeyboardHandler {
#devServerUrl: string;
#reporter: TerminalReporter;
#targetsShownForSelection: ?$ReadOnlyArray<PageDescription> = null;
constructor({
devServerUrl,
reporter,
}: {
devServerUrl: string,
reporter: TerminalReporter,
}) {
this.#devServerUrl = devServerUrl;
this.#reporter = reporter;
}
async #tryOpenDebuggerForTarget(target: PageDescription): Promise<void> {
this.#targetsShownForSelection = null;
this.#clearTerminalMenu();
try {
await fetch(
new URL(
'/open-debugger?target=' + encodeURIComponent(target.id),
this.#devServerUrl,
).href,
{method: 'POST'},
);
} catch (e) {
this.#log(
'error',
'Failed to open debugger for %s on %s debug targets: %s',
target.description,
target.deviceName,
e.message,
);
this.#clearTerminalMenu();
}
}
/**
* Used in response to 'j' to debug - fetch the available debug targets and:
* - If no targets, warn
* - If one target, open it
* - If more, show a list. The keyboard listener should run subsequent key
* presses through maybeHandleTargetSelection, which will launch the
* debugger if a match is made.
*/
async handleOpenDebugger(): Promise<void> {
this.#setTerminalMenu('Fetching available debugging targets...');
this.#targetsShownForSelection = null;
try {
const res = await fetch(this.#devServerUrl + '/json/list', {
method: 'POST',
});
if (res.status !== 200) {
throw new Error(`Unexpected status code: ${res.status}`);
}
const targets = (await res.json()) as $ReadOnlyArray<PageDescription>;
if (!Array.isArray(targets)) {
throw new Error('Expected array.');
}
if (targets.length === 0) {
this.#log('warn', 'No connected targets');
this.#clearTerminalMenu();
} else if (targets.length === 1) {
const target = targets[0];
// eslint-disable-next-line no-void
void this.#tryOpenDebuggerForTarget(target);
} else {
this.#targetsShownForSelection = targets;
if (targets.length > 9) {
this.#log(
'warn',
'10 or more debug targets available, showing the first 9.',
);
}
this.#setTerminalMenu(
`Multiple debug targets available, please select:\n ${targets
.slice(0, 9)
.map(
({description, deviceName}, i) =>
` ${chalk.white.inverse(` ${i + 1} `)} - "${description}" on "${deviceName}"`,
)
.join('\n ')}`,
);
}
} catch (e) {
this.#log('error', `Failed to fetch debug targets: ${e.message}`);
this.#clearTerminalMenu();
}
}
/**
* Handle key presses that correspond to a valid selection from a visible
* selection list.
*
* @return true if we've handled the key as a target selection, false if the
* caller should handle the key.
*/
maybeHandleTargetSelection(keyName: string): boolean {
if (keyName >= '1' && keyName <= '9') {
const targetIndex = Number(keyName) - 1;
if (
this.#targetsShownForSelection != null &&
targetIndex < this.#targetsShownForSelection.length
) {
const target = this.#targetsShownForSelection[targetIndex];
// eslint-disable-next-line no-void
void this.#tryOpenDebuggerForTarget(target);
return true;
}
}
return false;
}
/**
* Dismiss any target selection UI, if shown.
*/
dismiss() {
this.#clearTerminalMenu();
this.#targetsShownForSelection = null;
}
#log(level: 'info' | 'warn' | 'error', ...data: Array<mixed>): void {
this.#reporter.update({
type: 'unstable_server_log',
level,
data,
});
}
#setTerminalMenu(message: string) {
this.#reporter.update({
type: 'unstable_server_menu_updated',
message,
});
}
#clearTerminalMenu() {
this.#reporter.update({
type: 'unstable_server_menu_cleared',
});
}
}
@@ -10,20 +10,44 @@
*/
import type {Config} from '@react-native-community/cli-types';
import type TerminalReporter from 'metro/src/lib/TerminalReporter';
import {KeyPressHandler} from '../../utils/KeyPressHandler';
import {logger} from '../../utils/logger';
import OpenDebuggerKeyboardHandler from './OpenDebuggerKeyboardHandler';
import chalk from 'chalk';
import execa from 'execa';
import fetch from 'node-fetch';
import invariant from 'invariant';
import readline from 'readline';
import {ReadStream} from 'tty';
const CTRL_C = '\u0003';
const CTRL_D = '\u0004';
const RELOAD_TIMEOUT = 500;
const throttle = (callback: () => void, timeout: number) => {
let previousCallTimestamp = 0;
return () => {
const currentCallTimestamp = new Date().getTime();
if (currentCallTimestamp - previousCallTimestamp > timeout) {
previousCallTimestamp = currentCallTimestamp;
callback();
}
};
};
type KeyEvent = {
sequence: string,
name: string,
ctrl: boolean,
meta: boolean,
shift: boolean,
};
export default function attachKeyHandlers({
cliConfig,
devServerUrl,
messageSocket,
reporter,
}: {
cliConfig: Config,
devServerUrl: string,
@@ -31,21 +55,40 @@ export default function attachKeyHandlers({
broadcast: (type: string, params?: Record<string, mixed> | null) => void,
...
}>,
reporter: TerminalReporter,
}) {
if (process.stdin.isTTY !== true) {
logger.debug('Interactive mode is not supported in this environment');
return;
}
readline.emitKeypressEvents(process.stdin);
setRawMode(true);
const execaOptions = {
env: {FORCE_COLOR: chalk.supportsColor ? 'true' : 'false'},
};
const onPress = async (key: string) => {
switch (key.toLowerCase()) {
const reload = throttle(() => {
logger.info('Reloading connected app(s)...');
messageSocket.broadcast('reload', null);
}, RELOAD_TIMEOUT);
const openDebuggerKeyboardHandler = new OpenDebuggerKeyboardHandler({
reporter,
devServerUrl,
});
process.stdin.on('keypress', (str: string, key: KeyEvent) => {
logger.debug(`Key pressed: ${key.sequence}`);
if (openDebuggerKeyboardHandler.maybeHandleTargetSelection(key.name)) {
return;
}
switch (key.sequence) {
case 'r':
logger.info('Reloading connected app(s)...');
messageSocket.broadcast('reload', null);
reload();
break;
case 'd':
logger.info('Opening Dev Menu...');
@@ -76,21 +119,19 @@ export default function attachKeyHandlers({
).stdout?.pipe(process.stdout);
break;
case 'j':
// TODO(T192878199): Add multi-target selection
await fetch(devServerUrl + '/open-debugger', {method: 'POST'});
// eslint-disable-next-line no-void
void openDebuggerKeyboardHandler.handleOpenDebugger();
break;
case CTRL_C:
case CTRL_D:
openDebuggerKeyboardHandler.dismiss();
logger.info('Stopping server');
keyPressHandler.stopInterceptingKeyStrokes();
setRawMode(false);
process.stdin.pause();
process.emit('SIGINT');
process.exit();
}
};
const keyPressHandler = new KeyPressHandler(onPress);
keyPressHandler.createInteractionListener();
keyPressHandler.startInterceptingKeyStrokes();
});
logger.log(
[
@@ -104,3 +145,11 @@ export default function attachKeyHandlers({
].join('\n'),
);
}
function setRawMode(enable: boolean) {
invariant(
process.stdin instanceof ReadStream,
'process.stdin must be a readable stream to modify raw mode',
);
process.stdin.setRawMode(enable);
}
@@ -12,6 +12,8 @@
import type {NextHandleFunction, Server} from 'connect';
import type {TerminalReportableEvent} from 'metro/src/lib/TerminalReporter';
import typeof * as CLIServerAPI from '@react-native-community/cli-server-api';
import {logger} from '../../utils/logger';
type MiddlewareReturn = {
@@ -65,11 +67,26 @@ const communityMiddlewareFallback = {
// Attempt to use the community middleware if it exists, but fallback to
// the stubs if it doesn't.
try {
const community = require('@react-native-community/cli-server-api');
communityMiddlewareFallback.indexPageMiddleware =
community.indexPageMiddleware;
// `@react-native-community/cli` is an optional peer dependency of this
// package, and should be a dev dependency of the host project (via the
// community template's package.json).
const communityCliPath = require.resolve('@react-native-community/cli');
// `@react-native-community/cli-server-api` is a dependency of
// `@react-native-community/cli`, but is not re-exported by it, so we need
// to resolve the former through the latter.
const communityCliServerApiPath = require.resolve(
'@react-native-community/cli-server-api',
{paths: [communityCliPath]},
);
// $FlowIgnore[unsupported-syntax] dynamic import
const communityCliServerApi: CLIServerAPI = require(
communityCliServerApiPath,
);
communityMiddlewareFallback.createDevServerMiddleware =
community.createDevServerMiddleware;
communityCliServerApi.createDevServerMiddleware;
communityMiddlewareFallback.indexPageMiddleware =
communityCliServerApi.indexPageMiddleware;
} catch {
logger.debug(`⚠️ Unable to find @react-native-community/cli-server-api
Starting the server without the community middleware.`);
@@ -14,6 +14,7 @@ import type {Reporter} from 'metro/src/lib/reporting';
import type {TerminalReportableEvent} from 'metro/src/lib/TerminalReporter';
import typeof TerminalReporter from 'metro/src/lib/TerminalReporter';
import createDevMiddlewareLogger from '../../utils/createDevMiddlewareLogger';
import isDevServerRunning from '../../utils/isDevServerRunning';
import loadMetroConfig from '../../utils/loadMetroConfig';
import {logger} from '../../utils/logger';
@@ -98,6 +99,11 @@ async function runServer(
);
}
let reportEvent: (event: TerminalReportableEvent) => void;
const terminal = new Terminal(process.stdout);
const ReporterImpl = getReporterImpl(args.customLogReporterPath);
const terminalReporter = new ReporterImpl(terminal);
const {
middleware: communityMiddleware,
websocketEndpoints: communityWebsocketEndpoints,
@@ -111,13 +117,9 @@ async function runServer(
const {middleware, websocketEndpoints} = createDevMiddleware({
projectRoot,
serverBaseUrl: devServerUrl,
logger,
logger: createDevMiddlewareLogger(terminalReporter),
});
let reportEvent: (event: TerminalReportableEvent) => void;
const terminal = new Terminal(process.stdout);
const ReporterImpl = getReporterImpl(args.customLogReporterPath);
const terminalReporter = new ReporterImpl(terminal);
const reporter: Reporter = {
update(event: TerminalReportableEvent) {
terminalReporter.update(event);
@@ -130,6 +132,7 @@ async function runServer(
cliConfig: ctx,
devServerUrl,
messageSocket: messageSocketEndpoint,
reporter: terminalReporter,
});
}
},
@@ -1,90 +0,0 @@
/**
* 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 {CLIError} from './errors';
import {logger} from './logger';
const CTRL_C = '\u0003';
/** An abstract key stroke interceptor. */
export class KeyPressHandler {
_isInterceptingKeyStrokes = false;
_isHandlingKeyPress = false;
_onPress: (key: string) => Promise<void>;
constructor(onPress: (key: string) => Promise<void>) {
this._onPress = onPress;
}
/** Start observing interaction pause listeners. */
createInteractionListener(): ({pause: boolean, ...}) => void {
// Support observing prompts.
let wasIntercepting = false;
const listener = ({pause}: {pause: boolean, ...}) => {
if (pause) {
// Track if we were already intercepting key strokes before pausing, so we can
// resume after pausing.
wasIntercepting = this._isInterceptingKeyStrokes;
this.stopInterceptingKeyStrokes();
} else if (wasIntercepting) {
// Only start if we were previously intercepting.
this.startInterceptingKeyStrokes();
}
};
return listener;
}
_handleKeypress = async (key: string): Promise<CLIError | void> => {
// Prevent sending another event until the previous event has finished.
if (this._isHandlingKeyPress && key !== CTRL_C) {
return;
}
this._isHandlingKeyPress = true;
try {
logger.debug(`Key pressed: ${key}`);
await this._onPress(key);
} catch (error) {
return new CLIError('There was an error with the key press handler.');
} finally {
this._isHandlingKeyPress = false;
return;
}
};
/** Start intercepting all key strokes and passing them to the input `onPress` method. */
startInterceptingKeyStrokes() {
if (this._isInterceptingKeyStrokes) {
return;
}
this._isInterceptingKeyStrokes = true;
const {stdin} = process;
// $FlowFixMe[prop-missing]
stdin.setRawMode(true);
stdin.resume();
stdin.setEncoding('utf8');
stdin.on('data', this._handleKeypress);
}
/** Stop intercepting all key strokes. */
stopInterceptingKeyStrokes() {
if (!this._isInterceptingKeyStrokes) {
return;
}
this._isInterceptingKeyStrokes = false;
const {stdin} = process;
stdin.removeListener('data', this._handleKeypress);
// $FlowFixMe[prop-missing]
stdin.setRawMode(false);
stdin.resume();
}
}
@@ -0,0 +1,44 @@
/**
* 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 type TerminalReporter from 'metro/src/lib/TerminalReporter';
type LoggerFn = (...message: $ReadOnlyArray<string>) => void;
/**
* Create a dev-middleware logger object that will emit logs via Metro's
* terminal reporter.
*/
export default function createDevMiddlewareLogger(
reporter: TerminalReporter,
): $ReadOnly<{
info: LoggerFn,
error: LoggerFn,
warn: LoggerFn,
}> {
return {
info: makeLogger(reporter, 'info'),
warn: makeLogger(reporter, 'warn'),
error: makeLogger(reporter, 'error'),
};
}
function makeLogger(
reporter: TerminalReporter,
level: 'info' | 'warn' | 'error',
): LoggerFn {
return (...data: Array<mixed>) =>
reporter.update({
type: 'unstable_server_log',
level,
data,
});
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/core-cli-utils",
"version": "0.76.0-main",
"version": "0.76.0-rc.4",
"description": "React Native CLI library for Frameworks to build on",
"license": "MIT",
"main": "./src/index.flow.js",
+3 -3
View File
@@ -1,9 +1,9 @@
@generated SignedSource<<d156d11a5d3cc2a10238c2f014ada9f9>>
Git revision: a556d261a5e2131864f4e38ded62d8f90e81c39a
@generated SignedSource<<2ae3cc4cc779b7d9b387f7d8ba402248>>
Git revision: ce5d32a14f18a8fc4bdaf787eb46800b7f73e524
Built with --nohooks: false
Is local checkout: false
Remote URL: https://github.com/facebookexperimental/rn-chrome-devtools-frontend
Remote branch: main
Remote branch: 0.76-stable
GN build args (overrides only):
is_official_build = true
Git status in checkout:
@@ -20,7 +20,6 @@ style.setProperty('--image-file-nodeIcon', 'url(\"' + new URL('./nodeIcon.avif',
style.setProperty('--image-file-popoverArrows', 'url(\"' + new URL('./popoverArrows.png', import.meta.url).toString() + '\")');
style.setProperty('--image-file-react_native/learn-debugging-basics', 'url(\"' + new URL('./react_native/learn-debugging-basics.jpg', import.meta.url).toString() + '\")');
style.setProperty('--image-file-react_native/learn-native-debugging', 'url(\"' + new URL('./react_native/learn-native-debugging.jpg', import.meta.url).toString() + '\")');
style.setProperty('--image-file-react_native/learn-react-devtools', 'url(\"' + new URL('./react_native/learn-react-devtools.jpg', import.meta.url).toString() + '\")');
style.setProperty('--image-file-react_native/learn-react-native-devtools', 'url(\"' + new URL('./react_native/learn-react-native-devtools.jpg', import.meta.url).toString() + '\")');
style.setProperty('--image-file-react_native/welcomeIcon', 'url(\"' + new URL('./react_native/welcomeIcon.png', import.meta.url).toString() + '\")');
style.setProperty('--image-file-toolbarResizerVertical', 'url(\"' + new URL('./toolbarResizerVertical.png', import.meta.url).toString() + '\")');
Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
import*as e from"../../core/i18n/i18n.js";import*as o from"../../ui/legacy/legacy.js";const t={title:"⚛️ Components",command:"Show React DevTools Components panel"},n=e.i18n.registerUIStrings("panels/react_devtools/react_devtools_components-meta.ts",t),a=e.i18n.getLazilyComputedLocalizedString.bind(void 0,n);let i;o.ViewManager.registerViewExtension({location:"panel",id:"react-devtools-components",title:a(t.title),commandPrompt:a(t.command),persistence:"permanent",order:1e3,loadView:async()=>new((await async function(){return i||(i=await import("./react_devtools.js")),i}()).ReactDevToolsComponentsView.ReactDevToolsComponentsViewImpl)});
import*as e from"../../core/i18n/i18n.js";import*as o from"../../ui/legacy/legacy.js";const t={title:"Components",command:"Show React DevTools Components panel"},n=e.i18n.registerUIStrings("panels/react_devtools/react_devtools_components-meta.ts",t),a=e.i18n.getLazilyComputedLocalizedString.bind(void 0,n);let i;o.ViewManager.registerViewExtension({location:"panel",id:"react-devtools-components",title:a(t.title),commandPrompt:a(t.command),persistence:"permanent",order:1e3,loadView:async()=>new((await async function(){return i||(i=await import("./react_devtools.js")),i}()).ReactDevToolsComponentsView.ReactDevToolsComponentsViewImpl)});
@@ -1 +1 @@
import*as e from"../../core/i18n/i18n.js";import*as o from"../../ui/legacy/legacy.js";const t={title:"⚛️ Profiler",command:"Show React DevTools Profiler panel"},i=e.i18n.registerUIStrings("panels/react_devtools/react_devtools_profiler-meta.ts",t),r=e.i18n.getLazilyComputedLocalizedString.bind(void 0,i);let a;o.ViewManager.registerViewExtension({location:"panel",id:"react-devtools-profiler",title:r(t.title),commandPrompt:r(t.command),persistence:"permanent",order:1e3,loadView:async()=>new((await async function(){return a||(a=await import("./react_devtools.js")),a}()).ReactDevToolsProfilerView.ReactDevToolsProfilerViewImpl)});
import*as e from"../../core/i18n/i18n.js";import*as o from"../../ui/legacy/legacy.js";const t={title:"Profiler",command:"Show React DevTools Profiler panel"},i=e.i18n.registerUIStrings("panels/react_devtools/react_devtools_profiler-meta.ts",t),r=e.i18n.getLazilyComputedLocalizedString.bind(void 0,i);let a;o.ViewManager.registerViewExtension({location:"panel",id:"react-devtools-profiler",title:r(t.title),commandPrompt:r(t.command),persistence:"permanent",order:1e3,loadView:async()=>new((await async function(){return a||(a=await import("./react_devtools.js")),a}()).ReactDevToolsProfilerView.ReactDevToolsProfilerViewImpl)});
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/debugger-frontend",
"version": "0.76.0-main",
"version": "0.76.0-rc.4",
"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.76.0-main",
"version": "0.76.0-rc.4",
"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.76.0-main",
"@react-native/debugger-frontend": "0.76.0-rc.4",
"chrome-launcher": "^0.15.2",
"chromium-edge-launcher": "^0.2.0",
"connect": "^3.6.5",
@@ -21,7 +21,7 @@ declare var globalThis: $FlowFixMe;
*/
export async function fetchLocal(
url: string,
options?: Parameters<typeof fetch>[1] & {dispatcher?: mixed},
options?: Partial<Parameters<typeof fetch>[1] & {dispatcher?: mixed}>,
): ReturnType<typeof fetch> {
return await fetch(url, {
...options,
@@ -18,6 +18,7 @@ import {fetchJson, fetchLocal} from './FetchUtils';
import {createDeviceMock} from './InspectorDeviceUtils';
import {withAbortSignalForEachTest} from './ResourceUtils';
import {withServerForEachTest} from './ServerUtils';
import DefaultBrowserLauncher from '../utils/DefaultBrowserLauncher';
// Must be greater than or equal to PAGES_POLLING_INTERVAL in `InspectorProxy.js`.
const PAGES_POLLING_DELAY = 1000;
@@ -368,4 +369,60 @@ describe('inspector proxy HTTP API', () => {
}
});
});
describe('/open-debugger endpoint', () => {
it('opens requested device using appId, device, and target', async () => {
// Connect a device to use when opening the debugger
const device = await createDeviceMock(
`${serverRef.serverBaseWsUrl}/inspector/device?device=device1&name=foo&app=bar`,
autoCleanup.signal,
);
device.getPages.mockImplementation(() => [
{
app: 'bar-app',
id: 'page1',
title: 'bar-title',
vm: 'bar-vm',
capabilities: {
// Ensure the device target can be found when launching the debugger
nativePageReloads: true,
},
},
]);
jest.advanceTimersByTime(PAGES_POLLING_DELAY);
// Hook into `DefaultBrowserLauncher.launchDebuggerAppWindow` to ensure debugger was launched
const launchDebuggerSpy = jest
.spyOn(DefaultBrowserLauncher, 'launchDebuggerAppWindow')
.mockResolvedValueOnce();
try {
// Fetch the target information for the device
const pageListResponse = await fetchJson<JsonPagesListResponse>(
`${serverRef.serverBaseUrl}/json`,
);
// Select the first target from the page list response
expect(pageListResponse.length).toBeGreaterThanOrEqual(1);
const firstPage = pageListResponse[0];
// Build the URL for the debugger
const openUrl = new URL('/open-debugger', serverRef.serverBaseUrl);
openUrl.searchParams.set('appId', firstPage.description);
openUrl.searchParams.set(
'device',
firstPage.reactNative.logicalDeviceId,
);
openUrl.searchParams.set('target', firstPage.id);
// Request to open the debugger for the first device
const response = await fetchLocal(openUrl.toString(), {method: 'POST'});
// Ensure the request was handled properly
expect(response.status).toBe(200);
// Ensure the debugger was launched
expect(launchDebuggerSpy).toHaveBeenCalledWith(expect.any(String));
} finally {
device.close();
}
});
});
});
@@ -132,6 +132,7 @@ export default function openDebuggerMiddleware({
{launchId, useFuseboxEntryPoint},
),
);
res.writeHead(200);
res.end();
break;
case 'redirect':
+2 -2
View File
@@ -39,7 +39,7 @@ module.exports = {
overrides: [
{
files: ['*.js'],
parser: '@babel/eslint-parser',
parser: 'hermes-eslint',
plugins: ['ft-flow'],
rules: {
// Flow Plugin
@@ -51,7 +51,7 @@ module.exports = {
},
{
files: ['*.jsx'],
parser: '@babel/eslint-parser',
parser: 'hermes-eslint',
},
{
files: ['*.ts', '*.tsx'],
@@ -1,6 +1,6 @@
{
"name": "@react-native/eslint-config",
"version": "0.76.0-main",
"version": "0.76.0-rc.4",
"description": "ESLint config for React Native",
"license": "MIT",
"repository": {
@@ -22,7 +22,7 @@
"dependencies": {
"@babel/core": "^7.25.2",
"@babel/eslint-parser": "^7.25.1",
"@react-native/eslint-plugin": "0.76.0-main",
"@react-native/eslint-plugin": "0.76.0-rc.4",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"eslint-config-prettier": "^8.5.0",
@@ -31,7 +31,8 @@
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-native": "^4.0.0"
"eslint-plugin-react-native": "^4.0.0",
"hermes-eslint": "^0.23.1"
},
"peerDependencies": {
"eslint": ">=8",
@@ -12,7 +12,7 @@
const ESLintTester = require('eslint').RuleTester;
ESLintTester.setDefaultConfig({
parser: require.resolve('@babel/eslint-parser'),
parser: require.resolve('hermes-eslint'),
parserOptions: {
requireConfigFile: false,
ecmaVersion: 6,
@@ -1,6 +1,6 @@
{
"name": "@react-native/eslint-plugin",
"version": "0.76.0-main",
"version": "0.76.0-rc.4",
"description": "ESLint rules for @react-native/eslint-config",
"license": "MIT",
"repository": {
@@ -16,8 +16,12 @@
"react-native"
],
"bugs": "https://github.com/facebook/react-native/issues",
"main": "index.js",
"devDependencies": {
"babel-plugin-syntax-hermes-parser": "^0.23.1",
"hermes-eslint": "^0.23.1"
},
"engines": {
"node": ">=18"
},
"main": "index.js"
}
}
@@ -12,13 +12,13 @@
const ESLintTester = require('eslint').RuleTester;
ESLintTester.setDefaultConfig({
parser: require.resolve('@babel/eslint-parser'),
parser: require.resolve('hermes-eslint'),
parserOptions: {
requireConfigFile: false,
ecmaVersion: 6,
sourceType: 'module',
babelOptions: {
presets: [require.resolve('@babel/preset-flow')],
presets: [require.resolve('babel-plugin-syntax-hermes-parser')],
},
},
});
+9 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/eslint-plugin-specs",
"version": "0.76.0-main",
"version": "0.76.0-rc.4",
"description": "ESLint rules to validate NativeModule and Component Specs",
"license": "MIT",
"repository": {
@@ -18,9 +18,6 @@
"specs"
],
"bugs": "https://github.com/facebook/react-native/issues",
"engines": {
"node": ">=18"
},
"main": "index.js",
"scripts": {
"prepack": "node prepack.js",
@@ -28,12 +25,18 @@
},
"dependencies": {
"@babel/core": "^7.25.2",
"@babel/eslint-parser": "^7.25.1",
"@babel/plugin-transform-flow-strip-types": "^7.25.2",
"@babel/preset-flow": "^7.24.7",
"@react-native/codegen": "0.76.0-main",
"@react-native/codegen": "0.76.0-rc.4",
"make-dir": "^2.1.0",
"pirates": "^4.0.1",
"source-map-support": "0.5.0"
},
"devDependencies": {
"babel-plugin-syntax-hermes-parser": "^0.23.1",
"hermes-eslint": "^0.23.1"
},
"engines": {
"node": ">=18"
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/gradle-plugin",
"version": "0.76.0-main",
"version": "0.76.0-rc.4",
"description": "Gradle Plugin for React Native",
"license": "MIT",
"repository": {
@@ -64,7 +64,8 @@ tasks.withType<KotlinCompile>().configureEach {
apiVersion = "1.6"
// See comment above on JDK 11 support
jvmTarget = "11"
allWarningsAsErrors = true
allWarningsAsErrors =
project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false
}
}
@@ -188,6 +188,7 @@ abstract class ReactExtension @Inject constructor(val project: Project) {
?.dependencies
?.values
?.filter { it.platforms?.android !== null }
?.filterNot { it.platforms?.android?.isPureCxxDependency == true }
?.forEach { deps ->
val nameCleansed = deps.nameCleansed
val dependencyConfiguration = deps.platforms?.android?.dependencyConfiguration
@@ -166,6 +166,10 @@ abstract class GenerateAutolinkingNewArchitecturesFileTask : DefaultTask() {
cmake_minimum_required(VERSION 3.13)
set(CMAKE_VERBOSE_MAKEFILE on)
# We set REACTNATIVE_MERGED_SO so libraries/apps can selectively decide to depend on either libreactnative.so
# or link against a old prefab target (this is needed for React Native 0.76 on).
set(REACTNATIVE_MERGED_SO true)
{{ libraryIncludes }}
set(AUTOLINKED_LIBRARIES
@@ -30,10 +30,19 @@ abstract class GeneratePackageListTask : DefaultTask() {
@TaskAction
fun taskAction() {
val model = JsonUtils.fromAutolinkingConfigJson(autolinkInputFile.get().asFile)
val model =
JsonUtils.fromAutolinkingConfigJson(autolinkInputFile.get().asFile)
?: error(
"""
RNGP - Autolinking: Could not parse autolinking config file:
${autolinkInputFile.get().asFile.absolutePath}
The file is either missing or not containing valid JSON so the build won't succeed.
"""
.trimIndent())
val packageName =
model?.project?.android?.packageName
model.project?.android?.packageName
?: error(
"RNGP - Autolinking: Could not find project.android.packageName in react-native config output! Could not autolink packages without this field.")
@@ -189,6 +189,44 @@ class ReactExtensionTest {
assertThat(deps).isEmpty()
}
@Test
fun getGradleDependenciesToApply_withIsPureCxxDeps_filtersCorrectly() {
val validJsonFile =
createJsonFile(
"""
{
"reactNativeVersion": "1000.0.0",
"dependencies": {
"@react-native/oss-library-example": {
"root": "./node_modules/@react-native/android-example",
"name": "@react-native/android-example",
"platforms": {
"android": {
"sourceDir": "src/main/java",
"packageImportPath": "com.facebook.react"
}
}
},
"@react-native/another-library-for-testing": {
"root": "./node_modules/@react-native/cxx-testing",
"name": "@react-native/cxx-testing",
"platforms": {
"android": {
"sourceDir": "src/main/java",
"packageImportPath": "com.facebook.react",
"isPureCxxDependency": true
}
}
}
}
}
"""
.trimIndent())
val deps = getGradleDependenciesToApply(validJsonFile)
assertThat(deps).containsExactly("implementation" to ":react-native_android-example")
}
private fun createJsonFile(@Language("JSON") input: String) =
tempFolder.newFile().apply { writeText(input) }
}
@@ -115,6 +115,10 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest {
cmake_minimum_required(VERSION 3.13)
set(CMAKE_VERBOSE_MAKEFILE on)
# We set REACTNATIVE_MERGED_SO so libraries/apps can selectively decide to depend on either libreactnative.so
# or link against a old prefab target (this is needed for React Native 0.76 on).
set(REACTNATIVE_MERGED_SO true)
set(AUTOLINKED_LIBRARIES
@@ -137,6 +141,10 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest {
cmake_minimum_required(VERSION 3.13)
set(CMAKE_VERBOSE_MAKEFILE on)
# We set REACTNATIVE_MERGED_SO so libraries/apps can selectively decide to depend on either libreactnative.so
# or link against a old prefab target (this is needed for React Native 0.76 on).
set(REACTNATIVE_MERGED_SO true)
add_subdirectory(./a/directory/ aPackage_autolinked_build)
add_subdirectory(./another/directory/ anotherPackage_autolinked_build)
add_subdirectory(./another/directory/cxx/ anotherPackage_cxxmodule_autolinked_build)
@@ -54,7 +54,8 @@ tasks.withType<KotlinCompile>().configureEach {
apiVersion = "1.6"
// See comment above on JDK 11 support
jvmTarget = "11"
allWarningsAsErrors = true
allWarningsAsErrors =
project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false
}
}
@@ -24,7 +24,8 @@ tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
apiVersion = "1.6"
jvmTarget = "11"
allWarningsAsErrors = true
allWarningsAsErrors =
project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false
}
}
@@ -30,7 +30,8 @@ tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
apiVersion = "1.6"
jvmTarget = "11"
allWarningsAsErrors = true
allWarningsAsErrors =
project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false
}
}
@@ -21,8 +21,23 @@ object JsonUtils {
}
fun fromAutolinkingConfigJson(input: File): ModelAutolinkingConfigJson? =
input.bufferedReader().use {
runCatching { gsonConverter.fromJson(it, ModelAutolinkingConfigJson::class.java) }
input.bufferedReader().use { reader ->
runCatching {
// We sanitize the output of the `config` command as it could contain debug logs
// such as:
//
// > AwesomeProject@0.0.1 npx
// > rnc-cli config
//
// which will render the JSON invalid.
val content =
reader
.readLines()
.filterNot { line -> line.startsWith(">") }
.joinToString("\n")
.trim()
gsonConverter.fromJson(content, ModelAutolinkingConfigJson::class.java)
}
.getOrNull()
}
}
@@ -186,6 +186,54 @@ class JsonUtilsTest {
assertThat("implementation").isEqualTo(parsed.project!!.android!!.dependencyConfiguration)
}
@Test
fun fromAutolinkingConfigJson_withInfoLogs_sanitizeAndParseIt() {
@Suppress("JsonStandardCompliance")
val validJson =
createJsonFile(
"""
> AwesomeProject@0.0.1 npx
> rnc-cli config
{
"reactNativeVersion": "1000.0.0",
"project": {
"ios": {
"sourceDir": "./packages/rn-tester",
"xcodeProject": {
"name": "RNTesterPods.xcworkspace",
"isWorkspace": true
},
"automaticPodsInstallation": false
},
"android": {
"sourceDir": "./packages/rn-tester",
"appName": "RN-Tester",
"packageName": "com.facebook.react.uiapp",
"applicationId": "com.facebook.react.uiapp",
"mainActivity": ".RNTesterActivity",
"watchModeCommandParams": [
"--mode HermesDebug"
],
"dependencyConfiguration": "implementation"
}
}
}
"""
.trimIndent())
val parsed = JsonUtils.fromAutolinkingConfigJson(validJson)!!
assertThat("./packages/rn-tester").isEqualTo(parsed.project!!.android!!.sourceDir)
assertThat("RN-Tester").isEqualTo(parsed.project!!.android!!.appName)
assertThat("com.facebook.react.uiapp").isEqualTo(parsed.project!!.android!!.packageName)
assertThat("com.facebook.react.uiapp").isEqualTo(parsed.project!!.android!!.applicationId)
assertThat(".RNTesterActivity").isEqualTo(parsed.project!!.android!!.mainActivity)
assertThat("--mode HermesDebug")
.isEqualTo(parsed.project!!.android!!.watchModeCommandParams!![0])
assertThat("implementation").isEqualTo(parsed.project!!.android!!.dependencyConfiguration)
}
@Test
fun fromAutolinkingConfigJson_withDependenciesSpecified_canParseIt() {
val validJson =
@@ -16,6 +16,7 @@ import com.facebook.react.ReactPackage
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
import com.facebook.react.defaults.DefaultReactNativeHost
import com.facebook.react.soloader.OpenSourceMergedSoMapping
import com.facebook.soloader.SoLoader
class MainApplication : Application(), ReactApplication {
@@ -41,7 +42,7 @@ class MainApplication : Application(), ReactApplication {
override fun onCreate() {
super.onCreate()
SoLoader.init(this, false)
SoLoader.init(this, OpenSourceMergedSoMapping)
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for this app.
load()
+8 -8
View File
@@ -1,6 +1,6 @@
{
"name": "helloworld",
"version": "0.76.0-main",
"version": "0.76.0-rc.4",
"private": true,
"scripts": {
"bootstrap": "node ./cli.js bootstrap",
@@ -12,24 +12,24 @@
"test": "jest"
},
"dependencies": {
"react": "19.0.0-rc-fb9a90fa48-20240614",
"react-native": "1000.0.0"
"react": "18.3.1",
"react-native": "0.76.0-rc.4"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@babel/runtime": "^7.25.0",
"@react-native/babel-preset": "0.76.0-main",
"@react-native/core-cli-utils": "0.76.0-main",
"@react-native/eslint-config": "0.76.0-main",
"@react-native/metro-config": "0.76.0-main",
"@react-native/babel-preset": "0.76.0-rc.4",
"@react-native/core-cli-utils": "0.76.0-rc.4",
"@react-native/eslint-config": "0.76.0-rc.4",
"@react-native/metro-config": "0.76.0-rc.4",
"babel-jest": "^29.6.3",
"chalk": "^4.1.2",
"commander": "^12.0.0",
"eslint": "^8.19.0",
"jest": "^29.6.3",
"listr2": "^8.2.1",
"react-test-renderer": "19.0.0-rc-fb9a90fa48-20240614",
"react-test-renderer": "18.3.1",
"rxjs": "^7.8.1"
},
"engines": {
@@ -1,6 +1,6 @@
{
"name": "@react-native/hermes-inspector-msggen",
"version": "0.76.0-main",
"version": "0.76.0-rc.4",
"private": true,
"description": "Hermes Inspector Message Generator for React Native",
"license": "MIT",
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/metro-config",
"version": "0.76.0-main",
"version": "0.76.0-rc.4",
"description": "Metro configuration for React Native.",
"license": "MIT",
"repository": {
@@ -26,9 +26,9 @@
"dist"
],
"dependencies": {
"@react-native/js-polyfills": "0.76.0-main",
"@react-native/metro-babel-transformer": "0.76.0-main",
"metro-config": "^0.80.10",
"metro-runtime": "^0.80.10"
"@react-native/js-polyfills": "0.76.0-rc.4",
"@react-native/metro-babel-transformer": "0.76.0-rc.4",
"metro-config": "^0.81.0-alpha.2",
"metro-runtime": "^0.81.0-alpha.2"
}
}
+2
View File
@@ -11,6 +11,8 @@
import type {ConfigT} from 'metro-config';
export type {MetroConfig} from 'metro-config';
import {getDefaultConfig as getBaseConfig, mergeConfig} from 'metro-config';
const INTERNAL_CALLSITES_REGEX = new RegExp(
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/normalize-colors",
"version": "0.76.0-main",
"version": "0.76.0-rc.4",
"description": "Color normalization for React Native.",
"license": "MIT",
"repository": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/js-polyfills",
"version": "0.76.0-main",
"version": "0.76.0-rc.4",
"description": "Polyfills for React Native.",
"license": "MIT",
"repository": {
+11 -11
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/babel-preset",
"version": "0.76.0-main",
"version": "0.76.0-rc.4",
"description": "Babel preset for React Native applications",
"main": "src/index.js",
"repository": {
@@ -15,23 +15,16 @@
"license": "MIT",
"dependencies": {
"@babel/core": "^7.25.2",
"@babel/plugin-transform-async-generator-functions": "^7.25.4",
"@babel/plugin-transform-class-properties": "^7.25.4",
"@babel/plugin-proposal-export-default-from": "^7.24.7",
"@babel/plugin-transform-logical-assignment-operators": "^7.24.7",
"@babel/plugin-transform-nullish-coalescing-operator": "^7.24.7",
"@babel/plugin-transform-numeric-separator": "^7.24.7",
"@babel/plugin-transform-object-rest-spread": "^7.24.7",
"@babel/plugin-transform-optional-catch-binding": "^7.24.7",
"@babel/plugin-transform-optional-chaining": "^7.24.8",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-syntax-export-default-from": "^7.24.7",
"@babel/plugin-syntax-flow": "^7.24.7",
"@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3",
"@babel/plugin-syntax-optional-chaining": "^7.8.3",
"@babel/plugin-transform-arrow-functions": "^7.24.7",
"@babel/plugin-transform-async-generator-functions": "^7.25.4",
"@babel/plugin-transform-async-to-generator": "^7.24.7",
"@babel/plugin-transform-block-scoping": "^7.25.0",
"@babel/plugin-transform-class-properties": "^7.25.4",
"@babel/plugin-transform-classes": "^7.25.4",
"@babel/plugin-transform-computed-properties": "^7.24.7",
"@babel/plugin-transform-destructuring": "^7.24.8",
@@ -39,8 +32,14 @@
"@babel/plugin-transform-for-of": "^7.24.7",
"@babel/plugin-transform-function-name": "^7.25.1",
"@babel/plugin-transform-literals": "^7.25.2",
"@babel/plugin-transform-logical-assignment-operators": "^7.24.7",
"@babel/plugin-transform-modules-commonjs": "^7.24.8",
"@babel/plugin-transform-named-capturing-groups-regex": "^7.24.7",
"@babel/plugin-transform-nullish-coalescing-operator": "^7.24.7",
"@babel/plugin-transform-numeric-separator": "^7.24.7",
"@babel/plugin-transform-object-rest-spread": "^7.24.7",
"@babel/plugin-transform-optional-catch-binding": "^7.24.7",
"@babel/plugin-transform-optional-chaining": "^7.24.8",
"@babel/plugin-transform-parameters": "^7.24.7",
"@babel/plugin-transform-private-methods": "^7.24.7",
"@babel/plugin-transform-private-property-in-object": "^7.24.7",
@@ -56,7 +55,8 @@
"@babel/plugin-transform-typescript": "^7.25.2",
"@babel/plugin-transform-unicode-regex": "^7.24.7",
"@babel/template": "^7.25.0",
"@react-native/babel-plugin-codegen": "0.76.0-main",
"@react-native/babel-plugin-codegen": "0.76.0-rc.4",
"babel-plugin-syntax-hermes-parser": "^0.23.1",
"babel-plugin-transform-flow-enums": "^0.0.2",
"react-refresh": "^0.14.0"
},
+1 -1
View File
@@ -25,7 +25,7 @@ function isTSXSource(fileName) {
const loose = true;
const defaultPlugins = [
[require('@babel/plugin-syntax-flow')],
[require('babel-plugin-syntax-hermes-parser')],
[require('babel-plugin-transform-flow-enums')],
[require('@babel/plugin-transform-block-scoping')],
[require('@babel/plugin-transform-class-properties'), {loose}],
@@ -1,6 +1,6 @@
{
"name": "@react-native/metro-babel-transformer",
"version": "0.76.0-main",
"version": "0.76.0-rc.4",
"description": "Babel transformer for React Native applications.",
"main": "src/index.js",
"repository": {
@@ -16,7 +16,7 @@
"license": "MIT",
"dependencies": {
"@babel/core": "^7.25.2",
"@react-native/babel-preset": "0.76.0-main",
"@react-native/babel-preset": "0.76.0-rc.4",
"hermes-parser": "0.23.1",
"nullthrows": "^1.1.1"
},
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@react-native/bots",
"description": "React Native Bots",
"version": "0.76.0-main",
"version": "0.76.0-rc.4",
"private": true,
"license": "MIT",
"repository": {
@@ -1,6 +1,6 @@
{
"name": "@react-native/codegen-typescript-test",
"version": "0.76.0-main",
"version": "0.76.0-rc.4",
"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.76.0-main"
"@react-native/codegen": "0.76.0-rc.4"
},
"devDependencies": {
"@babel/core": "^7.25.2",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/codegen",
"version": "0.76.0-main",
"version": "0.76.0-rc.4",
"description": "Code generation tools for React Native",
"license": "MIT",
"repository": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "react-native-info",
"version": "0.76.0-main",
"version": "0.76.0-rc.4",
"main": "build/index.js",
"license": "MIT",
"private": true,
@@ -1,6 +1,6 @@
{
"name": "@react-native/popup-menu-android",
"version": "0.76.0-main",
"version": "0.76.0-rc.4",
"description": "PopupMenu for the Android platform",
"main": "index.js",
"files": [
@@ -17,7 +17,7 @@
],
"license": "MIT",
"devDependencies": {
"@react-native/codegen": "0.76.0-main"
"@react-native/codegen": "0.76.0-rc.4"
},
"peerDependencies": {
"@types/react": "^18.2.6",
@@ -1,6 +1,6 @@
{
"name": "@react-native/oss-library-example",
"version": "0.76.0-main",
"version": "0.76.0-rc.4",
"private": true,
"description": "Package that includes native module exapmle, native component example, targets both the old and the new architecture. It should serve as an example of a real-world OSS library.",
"license": "MIT",
@@ -26,8 +26,8 @@
],
"devDependencies": {
"@babel/core": "^7.25.2",
"@react-native/babel-preset": "0.76.0-main",
"react-native": "1000.0.0"
"@react-native/babel-preset": "0.76.0-rc.4",
"react-native": "0.76.0-rc.4"
},
"peerDependencies": {
"react": "*",
@@ -1,7 +1,7 @@
{
"name": "@react-native/test-renderer",
"private": true,
"version": "0.76.0-main",
"version": "0.76.0-rc.4",
"description": "A Test rendering library for React Native",
"license": "MIT",
"devDependencies": {
@@ -64,6 +64,9 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, strong, nullable) NSDictionary *initialProps;
@property (nonatomic, strong, nonnull) RCTRootViewFactory *rootViewFactory;
/// If `automaticallyLoadReactNativeWindow` is set to `true`, the React Native window will be loaded automatically.
@property (nonatomic, assign) BOOL automaticallyLoadReactNativeWindow;
@property (nonatomic, nullable) RCTSurfacePresenterBridgeAdapter *bridgeAdapter;
/**
@@ -12,6 +12,7 @@
#import <React/RCTSurfacePresenterBridgeAdapter.h>
#import <React/RCTUtils.h>
#import <ReactCommon/RCTHost.h>
#include <UIKit/UIKit.h>
#import <objc/runtime.h>
#import <react/featureflags/ReactNativeFeatureFlags.h>
#import <react/featureflags/ReactNativeFeatureFlagsDefaults.h>
@@ -38,6 +39,14 @@
@implementation RCTAppDelegate
- (instancetype)init
{
if (self = [super init]) {
_automaticallyLoadReactNativeWindow = YES;
}
return self;
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[self _setUpFeatureFlags];
@@ -47,23 +56,28 @@
RCTAppSetupPrepareApp(application, self.turboModuleEnabled);
self.rootViewFactory = [self createRCTRootViewFactory];
UIView *rootView = [self.rootViewFactory viewWithModuleName:self.moduleName
initialProperties:self.initialProps
launchOptions:launchOptions];
if (self.newArchEnabled || self.fabricEnabled) {
[RCTComponentViewFactory currentComponentViewFactory].thirdPartyFabricComponentsProvider = self;
}
if (self.automaticallyLoadReactNativeWindow) {
[self loadReactNativeWindow:launchOptions];
}
return YES;
}
- (void)loadReactNativeWindow:(NSDictionary *)launchOptions
{
UIView *rootView = [self.rootViewFactory viewWithModuleName:self.moduleName
initialProperties:self.initialProps
launchOptions:launchOptions];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [self createRootViewController];
[self setRootView:rootView toRootViewController:rootViewController];
self.window.rootViewController = rootViewController;
self.window.windowScene.delegate = self;
[self.window makeKeyAndVisible];
return YES;
_window.rootViewController = rootViewController;
[_window makeKeyAndVisible];
}
- (void)applicationDidEnterBackground:(UIApplication *)application
@@ -261,19 +275,6 @@
return [weakSelf sourceURLForBridge:bridge];
};
configuration.hostDidStartBlock = ^(RCTHost *_Nonnull host) {
[weakSelf hostDidStart:host];
};
configuration.hostDidReceiveJSErrorStackBlock =
^(RCTHost *_Nonnull host,
NSArray<NSDictionary<NSString *, id> *> *_Nonnull stack,
NSString *_Nonnull message,
NSUInteger exceptionId,
BOOL isFatal) {
[weakSelf host:host didReceiveJSErrorStack:stack message:message exceptionId:exceptionId isFatal:isFatal];
};
if ([self respondsToSelector:@selector(extraModulesForBridge:)]) {
configuration.extraModulesForBridge = ^NSArray<id<RCTBridgeModule>> *_Nonnull(RCTBridge *_Nonnull bridge)
{
@@ -295,7 +296,7 @@
};
}
return [[RCTRootViewFactory alloc] initWithConfiguration:configuration andTurboModuleManagerDelegate:self];
return [[RCTRootViewFactory alloc] initWithTurboModuleDelegate:self hostDelegate:self configuration:configuration];
}
#pragma mark - Feature Flags
@@ -12,6 +12,7 @@
@protocol RCTCxxBridgeDelegate;
@protocol RCTComponentViewFactoryComponentProvider;
@protocol RCTTurboModuleManagerDelegate;
@protocol RCTHostDelegate;
@class RCTBridge;
@class RCTHost;
@class RCTRootView;
@@ -30,13 +31,6 @@ typedef NSURL *_Nullable (^RCTBundleURLBlock)(void);
typedef NSArray<id<RCTBridgeModule>> *_Nonnull (^RCTExtraModulesForBridgeBlock)(RCTBridge *bridge);
typedef NSDictionary<NSString *, Class> *_Nonnull (^RCTExtraLazyModuleClassesForBridge)(RCTBridge *bridge);
typedef BOOL (^RCTBridgeDidNotFindModuleBlock)(RCTBridge *bridge, NSString *moduleName);
typedef void (^RCTHostDidStartBlock)(RCTHost *host);
typedef void (^RCTHostDidReceiveJSErrorStackBlock)(
RCTHost *host,
NSArray<NSDictionary<NSString *, id> *> *stack,
NSString *message,
NSUInteger exceptionId,
BOOL isFatal);
#pragma mark - RCTRootViewFactory Configuration
@interface RCTRootViewFactoryConfiguration : NSObject
@@ -147,22 +141,6 @@ typedef void (^RCTHostDidReceiveJSErrorStackBlock)(
*/
@property (nonatomic, nullable) RCTBridgeDidNotFindModuleBlock bridgeDidNotFindModule;
/**
* Called when `RCTHost` started.
* @parameter: host - The started `RCTHost`.
*/
@property (nonatomic, nullable) RCTHostDidStartBlock hostDidStartBlock;
/**
* Called when `RCTHost` received JS error.
* @parameter: host - `RCTHost` which received js error.
* @parameter: stack - JS error stack.
* @parameter: message - Error message.
* @parameter: exceptionId - Exception ID.
* @parameter: isFatal - YES if JS error is fatal.
*/
@property (nonatomic, nullable) RCTHostDidReceiveJSErrorStackBlock hostDidReceiveJSErrorStackBlock;
@end
#pragma mark - RCTRootViewFactory
@@ -187,6 +165,10 @@ typedef void (^RCTHostDidReceiveJSErrorStackBlock)(
- (instancetype)initWithConfiguration:(RCTRootViewFactoryConfiguration *)configuration;
- (instancetype)initWithTurboModuleDelegate:(id<RCTTurboModuleManagerDelegate>)turboModuleManagerDelegate
hostDelegate:(id<RCTHostDelegate>)hostdelegate
configuration:(RCTRootViewFactoryConfiguration *)configuration;
/**
* This method can be used to create new RCTRootViews on demand.
*
@@ -83,7 +83,7 @@ static NSDictionary *updateInitialProps(NSDictionary *initialProps, BOOL isFabri
@end
@interface RCTRootViewFactory () <RCTContextContainerHandling, RCTHostDelegate> {
@interface RCTRootViewFactory () <RCTContextContainerHandling> {
std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig;
facebook::react::ContextContainer::Shared _contextContainer;
}
@@ -95,15 +95,18 @@ static NSDictionary *updateInitialProps(NSDictionary *initialProps, BOOL isFabri
@end
@implementation RCTRootViewFactory {
RCTRootViewFactoryConfiguration *_configuration;
__weak id<RCTTurboModuleManagerDelegate> _turboModuleManagerDelegate;
__weak id<RCTHostDelegate> _hostDelegate;
RCTRootViewFactoryConfiguration *_configuration;
}
- (instancetype)initWithConfiguration:(RCTRootViewFactoryConfiguration *)configuration
andTurboModuleManagerDelegate:(id<RCTTurboModuleManagerDelegate>)turboModuleManagerDelegate
- (instancetype)initWithTurboModuleDelegate:(id<RCTTurboModuleManagerDelegate>)turboModuleManagerDelegate
hostDelegate:(id<RCTHostDelegate>)hostdelegate
configuration:(RCTRootViewFactoryConfiguration *)configuration
{
if (self = [super init]) {
_configuration = configuration;
_hostDelegate = hostdelegate;
_contextContainer = std::make_shared<const facebook::react::ContextContainer>();
_reactNativeConfig = std::make_shared<const facebook::react::EmptyReactNativeConfig>();
_contextContainer->insert("ReactNativeConfig", _reactNativeConfig);
@@ -112,6 +115,17 @@ static NSDictionary *updateInitialProps(NSDictionary *initialProps, BOOL isFabri
return self;
}
- (instancetype)initWithConfiguration:(RCTRootViewFactoryConfiguration *)configuration
andTurboModuleManagerDelegate:(id<RCTTurboModuleManagerDelegate>)turboModuleManagerDelegate
{
id<RCTHostDelegate> hostDelegate = [turboModuleManagerDelegate conformsToProtocol:@protocol(RCTHostDelegate)]
? (id<RCTHostDelegate>)turboModuleManagerDelegate
: nil;
return [self initWithTurboModuleDelegate:turboModuleManagerDelegate
hostDelegate:hostDelegate
configuration:configuration];
}
- (instancetype)initWithConfiguration:(RCTRootViewFactoryConfiguration *)configuration
{
return [self initWithConfiguration:configuration andTurboModuleManagerDelegate:nil];
@@ -188,26 +202,6 @@ static NSDictionary *updateInitialProps(NSDictionary *initialProps, BOOL isFabri
return rootView;
}
#pragma mark - RCTHostDelegate
- (void)hostDidStart:(RCTHost *)host
{
if (self->_configuration.hostDidStartBlock) {
self->_configuration.hostDidStartBlock(host);
}
}
- (void)host:(RCTHost *)host
didReceiveJSErrorStack:(NSArray<NSDictionary<NSString *, id> *> *)stack
message:(NSString *)message
exceptionId:(NSUInteger)exceptionId
isFatal:(BOOL)isFatal
{
if (self->_configuration.hostDidReceiveJSErrorStackBlock) {
self->_configuration.hostDidReceiveJSErrorStackBlock(host, stack, message, exceptionId, isFatal);
}
}
#pragma mark - RCTCxxBridgeDelegate
- (std::unique_ptr<facebook::react::JSExecutorFactory>)jsExecutorFactoryForBridge:(RCTBridge *)bridge
{
@@ -266,7 +260,7 @@ static NSDictionary *updateInitialProps(NSDictionary *initialProps, BOOL isFabri
__weak __typeof(self) weakSelf = self;
RCTHost *reactHost =
[[RCTHost alloc] initWithBundleURLProvider:self->_configuration.bundleURLBlock
hostDelegate:self
hostDelegate:_hostDelegate
turboModuleManagerDelegate:_turboModuleManagerDelegate
jsEngineProvider:^std::shared_ptr<facebook::react::JSRuntimeFactory>() {
return [weakSelf createJSRuntimeFactory];
@@ -72,9 +72,10 @@ RCT_EXPORT_METHOD(readAsDataURL
nil);
} else {
NSString *type = [RCTConvert NSString:blob[@"type"]];
NSString *text = [NSString stringWithFormat:@"data:%@;base64,%@",
type != nil && [type length] > 0 ? type : @"application/octet-stream",
[data base64EncodedStringWithOptions:0]];
NSString *text = [NSString
stringWithFormat:@"data:%@;base64,%@",
![type isEqual:[NSNull null]] && [type length] > 0 ? type : @"application/octet-stream",
[data base64EncodedStringWithOptions:0]];
resolve(text);
}
@@ -9,6 +9,7 @@
*/
import type {ViewStyleProp} from '../../StyleSheet/StyleSheet';
import type {DimensionsPayload} from '../../Utilities/NativeDeviceInfo';
import type {
ViewLayout,
ViewLayoutEvent,
@@ -18,6 +19,7 @@ import type {KeyboardEvent, KeyboardMetrics} from './Keyboard';
import LayoutAnimation from '../../LayoutAnimation/LayoutAnimation';
import StyleSheet from '../../StyleSheet/StyleSheet';
import Dimensions from '../../Utilities/Dimensions';
import Platform from '../../Utilities/Platform';
import {type EventSubscription} from '../../vendor/emitter/EventEmitter';
import AccessibilityInfo from '../AccessibilityInfo/AccessibilityInfo';
@@ -66,6 +68,7 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
viewRef: {current: React.ElementRef<typeof View> | null, ...};
_initialFrameHeight: number = 0;
_bottom: number = 0;
_windowWidth: number = Dimensions.get('window').width;
constructor(props: Props) {
super(props);
@@ -130,6 +133,10 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
}
};
_onDimensionsChange = ({window}: DimensionsPayload) => {
this._windowWidth = window?.width ?? 0;
};
// Avoid unnecessary renders if the KeyboardAvoidingView is disabled.
_setBottom = (value: number) => {
const enabled = this.props.enabled ?? true;
@@ -145,6 +152,15 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
return;
}
if (
Platform.OS === 'ios' &&
this._windowWidth !== this._keyboardEvent.endCoordinates.width
) {
// The keyboard is not the standard bottom-of-the-screen keyboard. For example, floating keyboard on iPadOS.
this._setBottom(0);
return;
}
const {duration, easing, endCoordinates} = this._keyboardEvent;
const height = await this._relativeKeyboardHeight(endCoordinates);
@@ -178,6 +194,7 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
if (Platform.OS === 'ios') {
this._subscriptions = [
Keyboard.addListener('keyboardWillChangeFrame', this._onKeyboardChange),
Dimensions.addEventListener('change', this._onDimensionsChange),
];
} else {
this._subscriptions = [
@@ -1931,19 +1931,22 @@ function createRefForwarder<TNativeInstance, TPublicInstance>(
return state;
}
// TODO: After upgrading to React 19, remove `forwardRef` from this component.
// NOTE: This wrapper component is necessary because `ScrollView` is a class
// component and we need to map `ref` to a differently named prop. This can be
// removed when `ScrollView` is a functional component.
function Wrapper({
ref,
...props
}: {
...Props,
ref: React.RefSetter<PublicScrollViewInstance>,
}): React.Node {
return <ScrollView {...props} scrollViewRef={ref} />;
}
const Wrapper = React.forwardRef(function Wrapper(
props: Props,
ref: ?React.RefSetter<PublicScrollViewInstance>,
): React.Node {
return ref == null ? (
<ScrollView {...props} />
) : (
<ScrollView {...props} scrollViewRef={ref} />
);
});
Wrapper.displayName = 'ScrollView';
// $FlowExpectedError[prop-missing]
Wrapper.Context = ScrollViewContext;
module.exports = ((Wrapper: $FlowFixMe): React.AbstractComponent<
@@ -160,6 +160,9 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig =
snapToInterval: true,
snapToOffsets: true,
snapToStart: true,
verticalScrollIndicatorInsets: {
diff: require('../../Utilities/differ/insetsDiffer'),
},
zoomScale: true,
...ConditionallyIgnoredEventHandlers({
onScrollBeginDrag: true,
@@ -85,8 +85,15 @@ const RCTTextInputViewConfig = {
topContentSizeChange: {
registrationName: 'onContentSizeChange',
},
topChangeSync: {
registrationName: 'onChangeSync',
},
topKeyPressSync: {
registrationName: 'onKeyPressSync',
},
},
validAttributes: {
dynamicTypeRamp: true,
fontSize: true,
fontWeight: true,
fontVariant: true,
@@ -97,6 +104,7 @@ const RCTTextInputViewConfig = {
textTransform: true,
textAlign: true,
fontFamily: true,
lineBreakModeIOS: true,
lineHeight: true,
isHighlighted: true,
writingDirection: true,
@@ -150,6 +158,8 @@ const RCTTextInputViewConfig = {
onSelectionChange: true,
onContentSizeChange: true,
onScroll: true,
onChangeSync: true,
onKeyPressSync: true,
}),
},
};
@@ -120,7 +120,7 @@ const ReactNativeStyleAttributes: {[string]: AnyAttributeType, ...} = {
/**
* Filter
*/
experimental_filter: {process: processFilter},
filter: {process: processFilter},
/**
* MixBlendMode
@@ -135,7 +135,7 @@ const ReactNativeStyleAttributes: {[string]: AnyAttributeType, ...} = {
/*
* BoxShadow
*/
experimental_boxShadow: {process: processBoxShadow},
boxShadow: {process: processBoxShadow},
/**
* Linear Gradient
+3 -3
View File
@@ -14,10 +14,10 @@ const version: $ReadOnly<{
patch: number,
prerelease: string | null,
}> = {
major: 1000,
minor: 0,
major: 0,
minor: 76,
patch: 0,
prerelease: null,
prerelease: 'rc.4',
};
module.exports = {version};
@@ -42,9 +42,13 @@ if (__DEV__) {
if (!Platform.isTesting) {
const HMRClient = require('../Utilities/HMRClient');
// [0.76 only] When under React Native DevTools, log "JavaScript logs will
// be removed from Metro..." warning, and continue to forward logs.
if (global.__FUSEBOX_HAS_FULL_CONSOLE_SUPPORT__) {
HMRClient.unstable_notifyFuseboxConsoleEnabled();
} else if (console._isPolyfilled) {
}
if (console._isPolyfilled) {
// We assume full control over the console and send JavaScript logs to Metro.
[
'trace',
@@ -169,10 +169,10 @@ const validAttributesForNonEventProps = {
experimental_backgroundImage: {
process: require('../StyleSheet/processBackgroundImage').default,
},
experimental_boxShadow: {
boxShadow: {
process: require('../StyleSheet/processBoxShadow').default,
},
experimental_filter: {
filter: {
process: require('../StyleSheet/processFilter').default,
},
experimental_mixBlendMode: true,
@@ -198,6 +198,7 @@ const validAttributesForNonEventProps = {
testID: true,
backgroundColor: {process: require('../StyleSheet/processColor').default},
backfaceVisibility: true,
cursor: true,
opacity: true,
shadowColor: {process: require('../StyleSheet/processColor').default},
shadowOffset: {diff: require('../Utilities/differ/sizesDiffer')},
@@ -216,16 +217,18 @@ const validAttributesForNonEventProps = {
role: true,
borderRadius: true,
borderColor: {process: require('../StyleSheet/processColor').default},
borderBlockColor: {process: require('../StyleSheet/processColor').default},
borderCurve: true,
borderWidth: true,
borderBlockWidth: true,
borderStyle: true,
hitSlop: {diff: require('../Utilities/differ/insetsDiffer')},
collapsable: true,
collapsableChildren: true,
experimental_filter: {
filter: {
process: require('../StyleSheet/processFilter').default,
},
experimental_boxShadow: {
boxShadow: {
process: require('../StyleSheet/processBoxShadow').default,
},
experimental_mixBlendMode: true,
@@ -240,9 +243,15 @@ const validAttributesForNonEventProps = {
borderLeftWidth: true,
borderLeftColor: {process: require('../StyleSheet/processColor').default},
borderStartWidth: true,
borderBlockStartWidth: true,
borderStartColor: {process: require('../StyleSheet/processColor').default},
borderBlockStartColor: {
process: require('../StyleSheet/processColor').default,
},
borderEndWidth: true,
borderBlockEndWidth: true,
borderEndColor: {process: require('../StyleSheet/processColor').default},
borderBlockEndColor: {process: require('../StyleSheet/processColor').default},
borderTopLeftRadius: true,
borderTopRightRadius: true,
@@ -188,6 +188,10 @@ function getProcessorForType(typeName: string): ?(nextProp: any) => any {
case 'UIImage':
case 'RCTImageSource':
return resolveAssetSource;
case 'BoxShadowArray':
return processBoxShadow;
case 'FilterArray':
return processFilter;
// Android Types
case 'Color':
return processColor;
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -110,11 +110,102 @@ export interface FlexStyle {
top?: DimensionValue | undefined;
width?: DimensionValue | undefined;
zIndex?: number | undefined;
direction?: 'inherit' | 'ltr' | 'rtl' | undefined;
/**
* @platform ios
* Equivalent to `top`, `bottom`, `right` and `left`
*/
direction?: 'inherit' | 'ltr' | 'rtl' | undefined;
inset?: DimensionValue | undefined;
/**
* Equivalent to `top`, `bottom`
*/
insetBlock?: DimensionValue | undefined;
/**
* Equivalent to `bottom`
*/
insetBlockEnd?: DimensionValue | undefined;
/**
* Equivalent to `top`
*/
insetBlockStart?: DimensionValue | undefined;
/**
* Equivalent to `right` and `left`
*/
insetInline?: DimensionValue | undefined;
/**
* Equivalent to `right` or `left`
*/
insetInlineEnd?: DimensionValue | undefined;
/**
* Equivalent to `right` or `left`
*/
insetInlineStart?: DimensionValue | undefined;
/**
* Equivalent to `marginVertical`
*/
marginBlock?: DimensionValue | undefined;
/**
* Equivalent to `marginBottom`
*/
marginBlockEnd?: DimensionValue | undefined;
/**
* Equivalent to `marginTop`
*/
marginBlockStart?: DimensionValue | undefined;
/**
* Equivalent to `marginHorizontal`
*/
marginInline?: DimensionValue | undefined;
/**
* Equivalent to `marginEnd`
*/
marginInlineEnd?: DimensionValue | undefined;
/**
* Equivalent to `marginStart`
*/
marginInlineStart?: DimensionValue | undefined;
/**
* Equivalent to `paddingVertical`
*/
paddingBlock?: DimensionValue | undefined;
/**
* Equivalent to `paddingBottom`
*/
paddingBlockEnd?: DimensionValue | undefined;
/**
* Equivalent to `paddingTop`
*/
paddingBlockStart?: DimensionValue | undefined;
/**
* Equivalent to `paddingHorizontal`
*/
paddingInline?: DimensionValue | undefined;
/**
* Equivalent to `paddingEnd`
*/
paddingInlineEnd?: DimensionValue | undefined;
/**
* Equivalent to `paddingStart`
*/
paddingInlineStart?: DimensionValue | undefined;
}
export interface ShadowStyleIOS {
@@ -239,16 +330,16 @@ export type FilterFunction =
| {opacity: number | string}
| {saturate: number | string}
| {sepia: number | string}
| {dropShadow: DropShadowPrimitive | string};
| {dropShadow: DropShadowValue | string};
export type DropShadowPrimitive = {
export type DropShadowValue = {
offsetX: number | string;
offsetY: number | string;
standardDeviation?: number | string | undefined;
color?: ColorValue | number | undefined;
};
export type BoxShadowPrimitive = {
export type BoxShadowValue = {
offsetX: number | string;
offsetY: number | string;
color?: string | undefined;
@@ -336,6 +427,8 @@ export interface ViewStyle extends FlexStyle, ShadowStyleIOS, TransformsStyle {
pointerEvents?: 'box-none' | 'none' | 'box-only' | 'auto' | undefined;
isolation?: 'auto' | 'isolate' | undefined;
cursor?: CursorValue | undefined;
boxShadow?: ReadonlyArray<BoxShadowValue> | string | undefined;
filter?: ReadonlyArray<FilterFunction> | string | undefined;
}
export type FontVariant =
@@ -700,9 +700,9 @@ export type FilterFunction =
| {opacity: number | string}
| {saturate: number | string}
| {sepia: number | string}
| {dropShadow: DropShadowPrimitive | string};
| {dropShadow: DropShadowValue | string};
export type DropShadowPrimitive = {
export type DropShadowValue = {
offsetX: number | string,
offsetY: number | string,
standardDeviation?: number | string,
@@ -719,7 +719,7 @@ export type GradientValue = {
}>,
};
export type BoxShadowPrimitive = {
export type BoxShadowValue = {
offsetX: number | string,
offsetY: number | string,
color?: ____ColorValue_Internal,
@@ -788,8 +788,8 @@ export type ____ViewStyle_InternalCore = $ReadOnly<{
elevation?: number,
pointerEvents?: 'auto' | 'none' | 'box-none' | 'box-only',
cursor?: CursorValue,
experimental_boxShadow?: $ReadOnlyArray<BoxShadowPrimitive> | string,
experimental_filter?: $ReadOnlyArray<FilterFunction> | string,
boxShadow?: $ReadOnlyArray<BoxShadowValue> | string,
filter?: $ReadOnlyArray<FilterFunction> | string,
experimental_mixBlendMode?: ____BlendMode_Internal,
experimental_backgroundImage?: $ReadOnlyArray<GradientValue> | string,
isolation?: 'auto' | 'isolate',
@@ -10,7 +10,7 @@
*/
import type {ProcessedColorValue} from './processColor';
import type {BoxShadowPrimitive} from './StyleSheetTypes';
import type {BoxShadowValue} from './StyleSheetTypes';
import processColor from './processColor';
@@ -24,7 +24,7 @@ export type ParsedBoxShadow = {
};
export default function processBoxShadow(
rawBoxShadows: ?($ReadOnlyArray<BoxShadowPrimitive> | string),
rawBoxShadows: ?($ReadOnlyArray<BoxShadowValue> | string),
): Array<ParsedBoxShadow> {
const result: Array<ParsedBoxShadow> = [];
if (rawBoxShadows == null) {
@@ -106,16 +106,14 @@ export default function processBoxShadow(
return result;
}
function parseBoxShadowString(
rawBoxShadows: string,
): Array<BoxShadowPrimitive> {
let result: Array<BoxShadowPrimitive> = [];
function parseBoxShadowString(rawBoxShadows: string): Array<BoxShadowValue> {
let result: Array<BoxShadowValue> = [];
for (const rawBoxShadow of rawBoxShadows
.split(/,(?![^()]*\))/) // split by comma that is not in parenthesis
.map(bS => bS.trim())
.filter(bS => bS !== '')) {
const boxShadow: BoxShadowPrimitive = {
const boxShadow: BoxShadowValue = {
offsetX: 0,
offsetY: 0,
};
@@ -12,7 +12,7 @@
'use strict';
import type {ColorValue} from './StyleSheet';
import type {DropShadowPrimitive, FilterFunction} from './StyleSheetTypes';
import type {DropShadowValue, FilterFunction} from './StyleSheetTypes';
import processColor from './processColor';
@@ -179,7 +179,7 @@ function _getFilterAmount(filterName: string, filterArgs: mixed): ?number {
}
function parseDropShadow(
rawDropShadow: string | DropShadowPrimitive,
rawDropShadow: string | DropShadowValue,
): ?ParsedDropShadow {
const dropShadow =
typeof rawDropShadow === 'string'
@@ -248,8 +248,8 @@ function parseDropShadow(
return parsedDropShadow;
}
function parseDropShadowString(rawDropShadow: string): ?DropShadowPrimitive {
const dropShadow: DropShadowPrimitive = {
function parseDropShadowString(rawDropShadow: string): ?DropShadowValue {
const dropShadow: DropShadowValue = {
offsetX: 0,
offsetY: 0,
};
+6 -5
View File
@@ -153,11 +153,12 @@ const HMRClient: HMRClientNativeInterface = {
level: 'info',
data: [
'\n' +
'\x1b[7m' +
' \x1b[1mJavaScript logs have moved!\x1b[22m They will now appear in the debugger console. ' +
'Tip: Type \x1b[1mj\x1b[22m in the terminal to open the debugger (requires Google Chrome ' +
'or Microsoft Edge).' +
'\x1b[27m' +
'\u001B[7m' +
' \u001B[1m💡 JavaScript logs will be removed from Metro in React ' +
'Native 0.77!\u001B[22m Please use React Native DevTools as your ' +
'default tool. Tip: Type \u001B[1mj\u001B[22m in the terminal to ' +
'open (requires Google Chrome or Microsoft Edge).' +
'\u001B[27m' +
'\n',
],
}),
@@ -1749,10 +1749,12 @@ declare class KeyboardAvoidingView extends React.Component<Props, State> {
viewRef: { current: React.ElementRef<typeof View> | null, ... };
_initialFrameHeight: number;
_bottom: number;
_windowWidth: number;
constructor(props: Props): void;
_relativeKeyboardHeight(keyboardFrame: KeyboardMetrics): Promise<number>;
_onKeyboardChange: $FlowFixMe;
_onLayout: $FlowFixMe;
_onDimensionsChange: $FlowFixMe;
_setBottom: $FlowFixMe;
_updateBottomIfNecessary: $FlowFixMe;
componentDidUpdate(_: Props, prevState: State): void;
@@ -8232,8 +8234,8 @@ export type FilterFunction =
| { opacity: number | string }
| { saturate: number | string }
| { sepia: number | string }
| { dropShadow: DropShadowPrimitive | string };
export type DropShadowPrimitive = {
| { dropShadow: DropShadowValue | string };
export type DropShadowValue = {
offsetX: number | string,
offsetY: number | string,
standardDeviation?: number | string,
@@ -8247,7 +8249,7 @@ export type GradientValue = {
positions?: $ReadOnlyArray<string>,
}>,
};
export type BoxShadowPrimitive = {
export type BoxShadowValue = {
offsetX: number | string,
offsetY: number | string,
color?: ____ColorValue_Internal,
@@ -8314,8 +8316,8 @@ export type ____ViewStyle_InternalCore = $ReadOnly<{
elevation?: number,
pointerEvents?: \\"auto\\" | \\"none\\" | \\"box-none\\" | \\"box-only\\",
cursor?: CursorValue,
experimental_boxShadow?: $ReadOnlyArray<BoxShadowPrimitive> | string,
experimental_filter?: $ReadOnlyArray<FilterFunction> | string,
boxShadow?: $ReadOnlyArray<BoxShadowValue> | string,
filter?: $ReadOnlyArray<FilterFunction> | string,
experimental_mixBlendMode?: ____BlendMode_Internal,
experimental_backgroundImage?: $ReadOnlyArray<GradientValue> | string,
isolation?: \\"auto\\" | \\"isolate\\",
@@ -8586,7 +8588,7 @@ exports[`public API should not change unintentionally Libraries/StyleSheet/proce
inset?: boolean,
};
declare export default function processBoxShadow(
rawBoxShadows: ?($ReadOnlyArray<BoxShadowPrimitive> | string)
rawBoxShadows: ?($ReadOnlyArray<BoxShadowValue> | string)
): Array<ParsedBoxShadow>;
"
`;
@@ -21,10 +21,10 @@ NSDictionary* RCTGetReactNativeVersion(void)
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^(void){
__rnVersion = @{
RCTVersionMajor: @(1000),
RCTVersionMinor: @(0),
RCTVersionMajor: @(0),
RCTVersionMinor: @(76),
RCTVersionPatch: @(0),
RCTVersionPrerelease: [NSNull null],
RCTVersionPrerelease: @"rc.4",
};
});
return __rnVersion;
@@ -49,6 +49,11 @@ using namespace facebook::react;
[_refreshControl addTarget:self
action:@selector(handleUIControlEventValueChanged)
forControlEvents:UIControlEventValueChanged];
const auto &concreteProps = static_cast<const PullToRefreshViewProps &>(*_props);
_refreshControl.tintColor = RCTUIColorFromSharedColor(concreteProps.tintColor);
[self _updateProgressViewOffset:concreteProps.progressViewOffset];
}
#pragma mark - RCTComponentViewProtocol
@@ -78,6 +83,14 @@ using namespace facebook::react;
}
}
if (newConcreteProps.tintColor != oldConcreteProps.tintColor) {
_refreshControl.tintColor = RCTUIColorFromSharedColor(newConcreteProps.tintColor);
}
if (newConcreteProps.progressViewOffset != oldConcreteProps.progressViewOffset) {
[self _updateProgressViewOffset:newConcreteProps.progressViewOffset];
}
BOOL needsUpdateTitle = NO;
if (newConcreteProps.title != oldConcreteProps.title) {
@@ -88,11 +101,11 @@ using namespace facebook::react;
needsUpdateTitle = YES;
}
[super updateProps:props oldProps:oldProps];
if (needsUpdateTitle) {
[self _updateTitle];
}
[super updateProps:props oldProps:oldProps];
}
#pragma mark -
@@ -102,6 +115,15 @@ using namespace facebook::react;
static_cast<const PullToRefreshViewEventEmitter &>(*_eventEmitter).onRefresh({});
}
- (void)_updateProgressViewOffset:(Float)progressViewOffset
{
_refreshControl.bounds = CGRectMake(
_refreshControl.bounds.origin.x,
-progressViewOffset,
_refreshControl.bounds.size.width,
_refreshControl.bounds.size.height);
}
- (void)_updateTitle
{
const auto &concreteProps = static_cast<const PullToRefreshViewProps &>(*_props);
@@ -723,6 +723,29 @@ static inline UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCu
[self _handleFinishedScrolling:scrollView];
}
- (void)didMoveToWindow
{
[super didMoveToWindow];
if (!self.window) {
// The view is being removed, ensure that the scroll end event is dispatched
[self _handleScrollEndIfNeeded];
}
}
- (void)_handleScrollEndIfNeeded
{
if (_scrollView.isDecelerating || !_scrollView.isTracking) {
if (!_eventEmitter) {
return;
}
static_cast<const ScrollViewEventEmitter &>(*_eventEmitter).onMomentumScrollEnd([self _scrollViewMetrics]);
[self _updateStateWithContentOffset];
_isUserTriggeredScrolling = NO;
}
}
- (void)_handleFinishedScrolling:(UIScrollView *)scrollView
{
[self _forceDispatchNextScrollEvent];
@@ -182,7 +182,7 @@ static CGPathRef RCTPathCreateOuterOutline(BOOL drawToEdge, CGRect rect, RCTCorn
}
static UIGraphicsImageRenderer *
RCTUIGraphicsImageRenderer(CGSize size, CGColorRef backgroundColor, BOOL hasCornerRadii, BOOL drawToEdge)
RCTMakeUIGraphicsImageRenderer(CGSize size, CGColorRef backgroundColor, BOOL hasCornerRadii, BOOL drawToEdge)
{
const CGFloat alpha = CGColorGetAlpha(backgroundColor);
const BOOL opaque = (drawToEdge || !hasCornerRadii) && alpha == 1.0;
@@ -231,7 +231,9 @@ static UIImage *RCTGetSolidBorderImage(
} : viewSize;
UIGraphicsImageRenderer *const imageRenderer =
RCTUIGraphicsImageRenderer(size, backgroundColor, hasCornerRadii, drawToEdge);
RCTMakeUIGraphicsImageRenderer(size, backgroundColor, hasCornerRadii, drawToEdge);
CGColorRetain(backgroundColor);
UIImage *image = [imageRenderer imageWithActions:^(UIGraphicsImageRendererContext *_Nonnull rendererContext) {
const CGContextRef context = rendererContext.CGContext;
const CGRect rect = {.size = size};
@@ -242,6 +244,7 @@ static UIImage *RCTGetSolidBorderImage(
CGContextAddPath(context, path);
CGContextFillPath(context);
}
CGColorRelease(backgroundColor);
CGContextAddPath(context, path);
CGPathRelease(path);
@@ -481,7 +484,7 @@ static UIImage *RCTGetDashedOrDottedBorderImage(
const BOOL hasCornerRadii = RCTCornerRadiiAreAboveThreshold(cornerRadii);
UIGraphicsImageRenderer *const imageRenderer =
RCTUIGraphicsImageRenderer(viewSize, backgroundColor, hasCornerRadii, drawToEdge);
RCTMakeUIGraphicsImageRenderer(viewSize, backgroundColor, hasCornerRadii, drawToEdge);
return [imageRenderer imageWithActions:^(UIGraphicsImageRendererContext *_Nonnull rendererContext) {
const CGContextRef context = rendererContext.CGContext;
const CGRect rect = {.size = viewSize};
@@ -431,18 +431,19 @@ RCT_CUSTOM_VIEW_PROPERTY(experimental_layoutConformance, NSString *, RCTView)
// filtered by view configs.
}
RCT_CUSTOM_VIEW_PROPERTY(experimental_filter, NSArray *, RCTView)
typedef NSArray *FilterArray; // Custom type to make the StaticViewConfigValidator Happy
RCT_CUSTOM_VIEW_PROPERTY(filter, FilterArray, RCTView)
{
// Property is only to be used in the new renderer.
// It is necessary to add it here, otherwise it gets
// filtered by view configs.
// Property is only to be used in the new renderer.
// It is necessary to add it here, otherwise it gets
// filtered by view configs.
}
RCT_CUSTOM_VIEW_PROPERTY(experimental_boxShadow, NSArray *, RCTView)
typedef NSArray *BoxShadowArray; // Custom type to make the StaticViewConfigValidator Happy
RCT_CUSTOM_VIEW_PROPERTY(boxShadow, BoxShadowArray, RCTView)
{
// Property is only to be used in the new renderer.
// It is necessary to add it here, otherwise it gets
// filtered by view configs.
// Property is only to be used in the new renderer.
// It is necessary to add it here, otherwise it gets
// filtered by view configs.
}
RCT_CUSTOM_VIEW_PROPERTY(experimental_mixBlendMode, NSString *, RCTView)
@@ -848,6 +848,26 @@ RCT_SCROLL_EVENT_HANDLER(scrollViewDidScrollToTop, onScrollToTop)
RCT_FORWARD_SCROLL_EVENT(scrollViewDidEndZooming : scrollView withView : view atScale : scale);
}
- (void)didMoveToWindow
{
[super didMoveToWindow];
if (self.window == nil) {
// Check if the ScrollView was in motion
if (_scrollView.isDecelerating || !_scrollView.isTracking) {
// Trigger the onMomentumScrollEnd event manually
RCT_SEND_SCROLL_EVENT(onMomentumScrollEnd, nil);
// We can't use the RCT_FORWARD_SCROLL_EVENT here beacuse the `_cmd` parameter passed
// to `respondsToSelector` is the current method - so it will be `didMoveToWindow` - and not
// `scrollViewDidEndDecelerating` that is passed.
for (NSObject<UIScrollViewDelegate> *scrollViewListener in _scrollListeners) {
if ([scrollViewListener respondsToSelector:@selector(scrollViewDidEndDecelerating:)]) {
[scrollViewListener scrollViewDidEndDecelerating:_scrollView];
}
}
}
}
}
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
// Fire a final scroll event
@@ -3314,6 +3314,15 @@ public final class com/facebook/react/modules/core/TimingModule : com/facebook/f
public final class com/facebook/react/modules/core/TimingModule$Companion {
}
public final class com/facebook/react/modules/debug/DevMenuModule : com/facebook/fbreact/specs/NativeDevMenuSpec {
public fun <init> (Lcom/facebook/react/bridge/ReactApplicationContext;Lcom/facebook/react/devsupport/interfaces/DevSupportManager;)V
public fun debugRemotely (Z)V
public fun reload ()V
public fun setHotLoadingEnabled (Z)V
public fun setProfilingEnabled (Z)V
public fun show ()V
}
public final class com/facebook/react/modules/debug/DevSettingsModule : com/facebook/fbreact/specs/NativeDevSettingsSpec {
public fun <init> (Lcom/facebook/react/bridge/ReactApplicationContext;Lcom/facebook/react/devsupport/interfaces/DevSupportManager;)V
public fun addListener (Ljava/lang/String;)V
@@ -4047,6 +4056,33 @@ public class com/facebook/react/shell/MainReactPackage$$ReactModuleInfoProvider
public fun getReactModuleInfos ()Ljava/util/Map;
}
public final class com/facebook/react/soloader/OpenSourceMergedSoMapping : com/facebook/soloader/ExternalSoMapping {
public static final field INSTANCE Lcom/facebook/react/soloader/OpenSourceMergedSoMapping;
public fun invokeJniOnload (Ljava/lang/String;)V
public final fun libfabricjni_so ()I
public final fun libhermes_executor_so ()I
public final fun libhermesinstancejni_so ()I
public final fun libhermestooling_so ()I
public final fun libjscexecutor_so ()I
public final fun libjscinstance_so ()I
public final fun libjscruntime_so ()I
public final fun libjsctooling_so ()I
public final fun libjsijniprofiler_so ()I
public final fun libjsinspector_so ()I
public final fun libmapbufferjni_so ()I
public final fun libreact_devsupportjni_so ()I
public final fun libreact_featureflagsjni_so ()I
public final fun libreact_newarchdefaults_so ()I
public final fun libreactnative_so ()I
public final fun libreactnativeblob_so ()I
public final fun libreactnativejni_so ()I
public final fun librninstance_so ()I
public final fun libturbomodulejsijni_so ()I
public final fun libuimanagerjni_so ()I
public final fun libyoga_so ()I
public fun mapLibName (Ljava/lang/String;)Ljava/lang/String;
}
public final class com/facebook/react/touch/JSResponderHandler : com/facebook/react/touch/OnInterceptTouchEventListener {
public fun <init> ()V
public final fun clearJSResponder ()V

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