Commit Graph

12270 Commits

Author SHA1 Message Date
Joe Vilches e704f3ba9b Rename Node.h's getResolvedDimension to getProcessedDimension (#46649)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46649

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

To get the height and width we call a function currently named `getResolvedDimension`. This returns a `Style::Length`, which in most cases we "resolve" immediately by calling `resolve`. This is a bit confusing that you need to `resolve` something that is already `resolved`.

I plan on adding a new function soon for `contentBox` which would resolve the length for you, so I think this should be renamed.

Also deleted unused `getResolvedDimensions`

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D63407730

fbshipit-source-id: e855c17d9c99817be308b7263fcb5d43559ede14
2024-10-01 15:19:22 -07:00
Nick Gerleman 267b250690 Cleanup background drawing feature flags (#46761)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46761

The legacy paths for this is all gone and non functional. We can clean thes up fully now.

Changelog: [Internal]

Reviewed By: rshest, Abbondanzo

Differential Revision: D63652264

fbshipit-source-id: cabc1af0098553c64f834e6bc30000ef7a942a4c
2024-10-01 12:46:29 -07:00
Christoph Purrer 1118cc6327 Share TextInputEventEmitter between C++ platforms (#46198)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46198

Extending on https://github.com/facebook/react-native/pull/43431 this change allows to share the TextInputEventEmitter with our C++ based platforms such as RN Windows > https://github.com/microsoft/react-native-windows/blob/main/vnext/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputEventEmitter.h

## Changelog:
[Internal] - Share TextInputEventEmitter between C++ platforms

Reviewed By: NickGerleman

Differential Revision: D61749959

fbshipit-source-id: 2526bf29200cd6a3dc6d5eaef5edbaf4b1df5751
2024-10-01 12:35:16 -07:00
Alex Hunt aa55d765e5 Add CLI selection of multiple debug targets (#46627)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46627

IMPORTANT: Requires a Metro bump, CI will fail until updated.

Introduces a target selection API for launching React Native DevTools when more than one device is connected.

Credit to robhogan for the initial internal implementation of `OpenDebuggerKeyboardHandler`!

(This leverages recent additions to Metro's reporter API — which we should follow up on to use for the rest of `community-cli-plugin`. Notably, using `TerminalReporter` ensures server output won't conflict with Metro's own event and progress logs.)

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D63255295

fbshipit-source-id: da93500358791eabe4cab433cad31b82d518fb5f
2024-10-01 11:27:41 -07:00
Alex Hunt 7c2a7de162 Bump Metro to 0.81.0-alpha.2 (#46703)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46703

Updates us in line with the release branch and unblocks https://github.com/facebook/react-native/pull/46627.

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D63544047

fbshipit-source-id: 4c093e6c2fc389888f12063df013db7023761859
2024-10-01 11:27:41 -07:00
Rubén Norte a5e430579e Improve RNTester example for performance.mark/measure (#46759)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46759

Changelog: [internal]

This improves the example in RNTester for `performance.mark` and `performance.measure` by only listing the marks/measures explicitly emitted from the example. This removes noise if other parts of the app are logging marks/measures as well.

Reviewed By: rshest

Differential Revision: D63695731

fbshipit-source-id: f65cf59363da0e6c9e0b3ffadf05abd2eb5a214c
2024-10-01 11:03:31 -07:00
Riccardo Cipolleschi eaa780de1c Fix crash for Modal not attached to window manager (#46758)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46758

There are some occurrencies where the Modal results not attached to the Window, perhaps when the app is backgrounded.

This trigger an exception `java.lang.IllegalArgumentException: View=DecorView@b9f88af[AdsManagerActivity] not attached to window manager`.\

This was fixed already but the conversion from Java to Kotlin missed a condition in the `||` clause. We are adding it back.

## Changelog
[Android][Fixed] - Fix crash for Modal not attached to window manager

## Facebook
The original fix is in this diff  D22264672 by mdvacca
Also see this post: https://fb.workplace.com/groups/rn.support/permalink/27047414764880449/

Reviewed By: cortinico

Differential Revision: D63700769

fbshipit-source-id: bc8a44868d5cacb8822e1646c2b7643682f45e1b
2024-10-01 10:59:40 -07:00
Riccardo Cipolleschi 6d6dd99ec9 Throw JS exception when calling a method if bufferedRuntimeExecutor is not initialized (#46735)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46735

We had some crash on Android where we call [`callFunctionOnModule`](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactCommon/react/runtime/ReactInstance.cpp#L258) when the `bufferedRuntimeExecutor_` might not be initialized. This can happen when navigating away from RN surface and quickly navigate to another one or across refreshes.

There could be a scheduled JS function from the previous surface/instance that might try to call a native module while the new instance is being created.

This change prevent the crash and replace it with a soft crash, that should show a RedBox on the screen.

## Changelog
[Internal] - Throw JS exception when calling a method if buffereRuntimeExecutor is not initialized

## Facebook
Have a look at T201983945 that generated the crash report

Reviewed By: cortinico

Differential Revision: D63638633

fbshipit-source-id: ba331f5173963265232d0810c2d12895cea3d528
2024-10-01 10:15:50 -07:00
Nicola Corti c441de5a47 Fix build warning for prepareGlog (#46756)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46756

prepareGlog was firing a warning due to a duplicate config.h file. Here I'm setting so that the file is always overridden (which is the desired behavior) to suppress this warning.

Changelog:
[Internal] [Changed] - Fix build warning for prepareGlog

Reviewed By: cipolleschi

Differential Revision: D63696664

fbshipit-source-id: 83b78afea09c4a5d39f341dd5b604cec466470ae
2024-10-01 10:04:57 -07:00
Nicola Corti 3cd46b9534 Do not reference setTranslucentBackgroundDrawable (#46754)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46754

This method has been deprecated since 0.76, but we're still using it inside our codebase.
I'm cleaning up the only usage of it replacing it with the implementation.

Changelog:
[Internal] [Changed] - Do not reference `setTranslucentBackgroundDrawable`

Reviewed By: cipolleschi

Differential Revision: D63695933

fbshipit-source-id: d39b13b584d3ac1406c61c3bf86b86b05dc984d9
2024-10-01 10:04:57 -07:00
Nicola Corti eb3d352761 RNGP - Do not apply java-gradle-plugin on root build (#46755)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46755

There is no need to apply `java-gradle-plugin` to the root build of RNGP as that does not contain any Gradle Plugins (they're in subfolders).

This is actually causing the build to be a bit slower as extra tasks for compilation/bundling will be created which are definitely not needed.

Changelog:
[Internal] [Changed] - RNGP - Do not apply `java-gradle-plugin` on root build

Reviewed By: cipolleschi

Differential Revision: D63695934

fbshipit-source-id: 84268105c73b49afdcd94610fcb7006ef53306a4
2024-10-01 10:04:57 -07:00
Nicola Corti 41c6ad5597 Fix NPE on ReactTextInputManager.setTextDecorationLine (#46750)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46750

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

Fix is pretty straightforward, parameter is annotated as Nullable, but is accessed with a `.split` call.
This causes a crash when the `textDecorationLine` property is removed (i.e. is null).

Changelog:
[Android] [Fixed] - Fix NPE on ReactTextInputManager.setTextDecorationLine

Reviewed By: cipolleschi

Differential Revision: D63689492

fbshipit-source-id: 3424897cc40beaeb579e3affd0a87656ff43afee
2024-10-01 09:20:53 -07:00
Pieter De Baets 4ede9205a0 Fix BoxShadow support for platform colors (#46753)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46753

Colors can be more than just ints, so we need to use `ColorPropConverter` to convert it correctly. For ViewManagers, this happens automatically through the ReactProp annotation, but since this is a nested field, we need to manually apply it.

Changelog: [Android][Fixed] BoxShadow now supports platformColor.

Reviewed By: fabriziocucci

Differential Revision: D63693048

fbshipit-source-id: 26b1da24db1b6f319af8cef6f62e4739c3f65ee3
2024-10-01 08:30:25 -07:00
Oskar Kwaśniewski d24507611d feat(iOS): expose RCT_NEW_ARCH_ENABLED to Swift (#46749)
Summary:
This PR exposes `RCT_NEW_ARCH_ENABLED` flag to Swift.

It allows you to use conditional compilation:

```swift
#if RCT_NEW_ARCH_ENABLED
func test() {
	print("I'm running on new arch!)
}
#else
func test() {
	print("I'm running on old arch!)
}
#endif
```

## Changelog:

[IOS] [ADDED] - expose RCT_NEW_ARCH_ENABLED to Swift

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

Test Plan: CI Green

Reviewed By: cortinico

Differential Revision: D63689711

Pulled By: cipolleschi

fbshipit-source-id: 706013019571f597d1966ffcf13bd47ba7f29a2d
2024-10-01 07:59:25 -07:00
Alex Hunt 80122678e0 Simplify FuseboxReactDevToolsDispatcher diagram and document inline (#46737)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46737

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D63637626

fbshipit-source-id: 314ec6dc6eff8d458beba84e49d5aaca3d192087
2024-10-01 06:50:49 -07:00
Alex Hunt 82f4e1714d Reorganise debugger modules in src/private/ (#46738)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46738

Combines modules previously under `fusebox` and `reactdevtools` directories into a single `src/private/debugging/` directory.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D63637625

fbshipit-source-id: 58add7fa3b6553c33d59e785563b24d57b7db547
2024-10-01 06:50:49 -07:00
Pieter De Baets 390925ea39 Add StrictAnimatedProps to fix missing Animated types (#46659)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46659

The current `AnimatedProps` maps all types to `any` which prevents us from catching many types of issues. Introduce an alternative variant which we can adopt incrementally which enforces the underlying types.

Changelog: [General][Fixed] Improved types for AnimatedProps

Reviewed By: SamChou19815

Differential Revision: D63315760

fbshipit-source-id: 718fc2754cc99891e490a48d7792f626205c37e4
2024-10-01 06:29:51 -07:00
Cedric van Putten 39c98fb8f8 fix(react-native-codegen): upgrade jscodeshift@17.0.0 to resolve outdated dependencies (#46724)
Summary:
This upgrades `jscodeshift` from `0.14.0` to `17.0.0`, to resolve unsupported babel dependencies when installing React Native. See https://github.com/expo/expo/issues/31613

## Changelog:

[GENERAL] [FIXED] - Upgrade Codegen dependency `jscodeshift@17.0.0` to resolve outdated dependencies

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

Test Plan:
To test it out yourself:

- `npx create-expo@latest ./test-codegen`
- `cd ./test-codegen`
- `npm why babel/plugin-proposal-nullish-coalescing-operator@7.18.6 | grep codegen` - [npm deprecation](https://www.npmjs.com/package/babel/plugin-proposal-nullish-coalescing-operator/v/7.18.6)
- `npm why babel/plugin-proposal-class-properties@7.18.6 | grep codegen` - [npm deprecation](https://www.npmjs.com/package/babel/plugin-proposal-class-properties/v/7.18.6)
- `npm why rimraf@2.6.3 | grep codegen` - [npm deprecation](https://www.npmjs.com/package/rimraf/v/2.6.3)
- `npm why babel/plugin-proposal-optional-chaining@7.21.0 | grep codegen` - [npm deprecation](https://www.npmjs.com/package/babel/plugin-proposal-optional-chaining/v/7.21.0)

> [!IMPORTANT]
> There are other dependencies that require an update, unfortunately there are no flow typings available (yet).
> - `npm why glob@7.2.3 | grep codegen` - [npm deprecation](https://www.npmjs.com/package/glob/v/7.2.3)

Reviewed By: cortinico

Differential Revision: D63629133

Pulled By: huntie

fbshipit-source-id: 3799e49677b8e5fd64841e6c7f855bde10e15072
2024-10-01 05:14:16 -07:00
Nicola Corti 290258f00f Further Reduce Build Warnings (#46733)
Summary:
This further reduces the build warning coming from the Hermes build, which we can't do much about as we don't own that code.

## Changelog:

[Internal] [Changed] - Further Reduce Build Warnings

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

Test Plan: CI

Reviewed By: NickGerleman

Differential Revision: D63644753

Pulled By: cortinico

fbshipit-source-id: d0e65559715ac1fa2b920f4c3d3cf63b6171765d
2024-10-01 02:47:59 -07:00
Tim Yung 223e98cc4b RN: Remove String Refs from NativeMethods (TS) (#46734)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46734

The TypeScript definition for `NativeMethods` defined a `refs` property for referencing component instances by string refs.

String refs are deprecated and support is being formally dropped in React 19.

This removes the obsolete type definition.

Changelog:
[General][Removed] - Removed `refs` property from `NativeMethods` TypeScript definition.

Reviewed By: NickGerleman

Differential Revision: D63640881

fbshipit-source-id: 82148ac91bd44d63da9a41b1d1dcebb7ca32a5bd
2024-09-30 14:54:51 -07:00
Eli White 86cac68365 Promise annotations must specify their elementType (#46727)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46727

It makes scripts operating on the schema complicated when the elementType might be there or might not. Let's make it required, but VoidTypeAnnotation if it's unknown.

Arguably we shouldn't allow it to be unknown at all, but that's out of scope here.

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D63616703

fbshipit-source-id: 290586384b911928e55344aa522bd296f23a074c
2024-09-30 11:19:44 -07:00
Eli White ad380c011f Add test for Object with indexers (#46726)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46726

An object isn't allowed to have both an indexer and regular properties. Previously, the schema just wouldn't include the properties and would only include the indexer. Instead of failing silently and not generating the expected code, let's explicitly error out.

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D63615090

fbshipit-source-id: a4c881b7a809f0b467509f7f7e2131be59ee274e
2024-09-30 11:19:44 -07:00
Eli White c658e87518 Add a test for an Alias to an Alias (#46725)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46725

This covers types that deeply alias.

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D62926913

fbshipit-source-id: 2fea1900f1be2893230a949db6778c76afae0423
2024-09-30 11:19:44 -07:00
Pieter De Baets 544c4ff75b Use HybridClassBase for frequently constructed objects (#46706)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46706

Simplifies object construction and collection, and avoids additional JNI roundtrips to set HybridData.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D63537781

fbshipit-source-id: 55df2785840ec8fcd5a7a08d2c7dd73c5b5fca82
2024-09-30 09:59:52 -07:00
Frank Calise e12c0d9551 fix(dev-menu): export for react-native package (#46723)
Summary:
In an effort to achieve a similar API in the new architecture, I was trying to replace the following code from the old architecture:
```
import { NativeModules } from 'react-native'
// ...
NaiveModules.DevMenu.show()
```

After https://github.com/facebook/react-native/issues/46694 landed, you can achieve this with the following import in the new architecture:
```
// ts-ignore
import DevMenu from "react-native/Libraries/NativeModules/specs/NativeDevMenu"

// and then use it
DevMenu.show()
```

However, this change provides the interface for `DevMenu` from the `react-native` package, similar to the API for `DevSettings`, making it easier to use via the public API and better type support.

```
import { DevMenu } from 'react-native'
DevMenu.show()
```

## Changelog:

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

Pick one each for the category and type tags:

[GENERAL] [ADDED] - Export `DevMenu` from `react-native`

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

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

Test Plan:
<img width="750" alt="image" src="https://github.com/user-attachments/assets/dc5a9876-4364-473e-9fd8-c49484d6de01">

### Before
`any` type on `show` from the private import
<img width="226" alt="image" src="https://github.com/user-attachments/assets/45a085d2-9794-482d-b5ec-3b882aadb56b">

### After
typed show method from the new import
<img width="399" alt="image" src="https://github.com/user-attachments/assets/7c7587b3-499b-40f0-8262-126e4ec17dc6">

Reviewed By: cortinico

Differential Revision: D63631196

Pulled By: huntie

fbshipit-source-id: a00efa85c8ca1aa127c9ae0a059978ba5eadb376
2024-09-30 09:22:52 -07:00
Rick Hanlon cbb313253f 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-09-30 09:15:04 -07:00
Oskar Kwaśniewski fbda60e657 feat(iOS): refactor RCTDevLoadingView to use constraints (#46621)
Summary:
This PR refactors the RCTDevLoadingView to use constraints instead of explicitly defining frames.

Now the code looks like this:

```
#if TARGET_OS_MACCATALYST
      self->_window.frame = CGRectMake(0, window.safeAreaInsets.top, windowWidth, 20);
      self->_label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, windowWidth, 20)];
#else
      self->_window.frame = CGRectMake(0, 0, windowWidth, window.safeAreaInsets.top + 10);
      self->_label = [[UILabel alloc] initWithFrame:CGRectMake(0, window.safeAreaInsets.top - 10, windowWidth, 20)];
#endif
```

When working with visionOS I quickly found my self in the need of adding additional else there...

This PR uses constraints to layout the views correctly for every device.

| Device         | Screenshot |
| -------------- | ---------- |
| iOS | <img src="https://github.com/user-attachments/assets/decc146e-41a2-4ce8-bafd-77c77a39398b" width="200"/> |
| macOS Catalyst | <img src="https://github.com/user-attachments/assets/78ef4946-a6dc-49a2-864e-a483577798f1" width="200"/> |
| iPadOS | <img src="https://github.com/user-attachments/assets/a15bd1a8-84ae-47d0-becb-e14c3a9352d4" width="200"/>  |
| visionOS | <img src="https://github.com/user-attachments/assets/d74f0607-837e-4f7b-b924-fc6fce80d763" width="200"/>  |

## Changelog:

[IOS] [CHANGED] - refactor RCTDevLoadingView to use constraints

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

Test Plan: Test if DevLoading view is properly showing up

Reviewed By: blakef

Differential Revision: D63383002

Pulled By: cipolleschi

fbshipit-source-id: b17499e12d4a882facce4c45b1cc22eb43ea3bb1
2024-09-30 08:26:45 -07:00
evanbacon 4caf548a9f add missing iOS platform colors (#46730)
Summary:
- add missing platform colors on iOS https://developer.apple.com/documentation/uikit/uicolor/standard_colors

## Changelog:

[IOS] [ADDED] - Add `systemCyan` and `systemMint` colors on iOS

<!-- 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

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

Test Plan:
- Ran it in an iOS app (text is no longer black)

![Simulator Screenshot - iPhone 15 Pro - 2024-09-30 at 15 31 30](https://github.com/user-attachments/assets/2f1d337c-d5f3-40d6-8e58-fdccb94603fd)

Reviewed By: cortinico

Differential Revision: D63635182

Pulled By: cipolleschi

fbshipit-source-id: b6fa3ff0e38630d820aacedbf88dfe9bd13c0644
2024-09-30 08:12:41 -07:00
shubhamguptadream11 5c7a166dca 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-09-30 08:04:36 -07:00
Pieter De Baets 18faf68b48 Rename Binding to FabricUIManagerBinding (#46705)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46705

We have multiple classes in React Native Android acting as a binding layer (between C++ and Java, between C++ and JS). Make it more obvious this Binding is for (Android) FabricUIManager and flatten the (now) unused Binding interface.

Changelog: [Android][Removed] BindingImpl is no longer part of the public interface

Reviewed By: cortinico

Differential Revision: D63536329

fbshipit-source-id: 329d184c1889fbe804995211cdd339b50a7c9234
2024-09-30 07:31:56 -07:00
Pieter De Baets 8dd616410d Make more SurfaceHandler configuration go through UIManager Binding (#46701)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46701

Reduce the interface we expose in SurfaceHandler(Binding), and concentrate the logic in the FabricUIManager Binding.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D63536328

fbshipit-source-id: 5882bdd24fd3ca8f3d36210dca80587fee091dcf
2024-09-30 07:31:56 -07:00
Riccardo Cipolleschi aa35a21714 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-09-30 06:03:22 -07:00
Samuel Susla 4e38493d71 delete state alignment mechanism (#46658)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46658

changelog: [internal]

We are shipping a better solution: Runtime Shadow Node Reference Syncing which is being rolled out.

Reviewed By: lenaic, rubennorte

Differential Revision: D63456344

fbshipit-source-id: e70b7dd4be7bf0670366e5200a910195b929a14d
2024-09-30 04:59:49 -07:00
Nicola Corti d1f47f7ad5 Silence unnecessary Gradle outputs - Part 1 (#46704)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46704

Our build log for Gradle is extremely noisy due to Hermes.
Here I'm suppressing all the build output from Hermes as we can't really do much from that side of the build.

This should make it easier for folks on GitHub Actions to immediately spot where are failures.

Changelog:
[Internal] [Changed] - Silence unnecessary Gradle outputs

Reviewed By: GijsWeterings

Differential Revision: D63541175

fbshipit-source-id: d1a60098c317ff9e8c9575b5b8b2aab639f28f2f
2024-09-30 03:55:54 -07:00
Jorge Cabiedes Acosta fae572d815 Fix mixBlendMode not updating on Image state updates (#46680)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46680

Since the parent of a view with mixBlendMode prop set is the one responsible for setting the compositing of the child, when updating mixBlendMode on a child we need to also invalidate the parent.

Changelog: [Android] [Fixed] - mixBlendMode now properly does state updates

Reviewed By: joevilches

Differential Revision: D63424394

fbshipit-source-id: 0eb15520f1087e25683853632943e64a66344481
2024-09-29 22:59:28 -07:00
Jorge Cabiedes Acosta d2c48f3b1a Remove experimental_ and cleanup mixBlendMode experiment (#46650)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46650

tsia

Changelog: [General] [Added] - Removed `experimental` prefix and fully released `mixBlendMode` prop

Reviewed By: joevilches

Differential Revision: D63407473

fbshipit-source-id: 892ababcfe19b82d3f4c73d3cbc13fb46b7425b6
2024-09-29 22:59:28 -07:00
Nick Gerleman 513e9669e7 Fix interactions between removeClippedSubviews and RTL by applying HorizontalScrollContentView translation during layout metric assignment (#46685)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46685

This attempts a similar fix to D59566611, but keeps the removedClippedSubviews logic as is, instead moving the current translation done in ReactHorizontalScrollContainerView onLayout to ShadowNode layout metric assignment (so the world is consistent from very early on, and `removeClippedSubviews` never sees coordinates before translation),

I suspect doing this at the ShadowNode layer might also result in some fixes to DevTools in RTL.

This should let us roll out setAndroidLayoutDirection again.

Changelog:
[Android][Fixed] - Fix interactions between removeClippedSubviews and RTL

Reviewed By: mdvacca

Differential Revision: D63318754

fbshipit-source-id: 828e103e2ad21c7e886e39c163474b10ebd5099e
2024-09-27 19:19:53 -07:00
Nick Gerleman a396f6c49b Back out "Do not hold raw RuntimeScheduler pointer in BufferedRuntimeExecutor"
Summary:
A crash we are getting in the wild suggests that destruction on weak ref count going away may be delaying RuntimeExecutor task destruction to a point where jsi::Function is invalid. Let's try backing D62748768 out and seeing if the crash goes away.

Changelog:
[General][Fixed] - Attempt to fix crash from delayed RuntimeExecutor task destruction

#bypass-github-export-checks

Reviewed By: mdvacca

Differential Revision: D63568504

fbshipit-source-id: 6152e7293902d0eb67a14c5840bea56561c35b08
2024-09-27 18:19:45 -07:00
zhongwuzw 7c60a65ace 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-09-27 13:11:45 -07:00
Alex Hunt d17373c4ef Require Flow types in all react-native source files (#45786)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45786

Following D60377082, `packages/react-native/Libraries/` is now 100% parsable by `flow-api-translator` and covered by `flow-api-test`. This diff increases test strictness to preserve this state going forward.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D60377123

fbshipit-source-id: 8c48bdd73d9d0d97a114d553eb70cc01faf18e89
2024-09-27 12:02:37 -07:00
Alex Hunt 776e822db5 Add minimal Flow types to remaining files under Libraries/ (#45785)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45785

Adds `flow` annotation, and/or adds minimal Flow types to remaining files under `packages/react-native/Libraries/`. As of this diff, 100% of this directory is now parsable by `flow-api-translator` and covered by `public-api-test`.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D60377082

fbshipit-source-id: 67e8acafc3fdd8f107f1d8d53c69ee6c27d3ed0a
2024-09-27 12:02:37 -07:00
Alex Hunt 64381d3569 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-27 10:20:19 -07:00
Alex Hunt 1387f521fd 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-27 10:20:19 -07:00
Alex Hunt dc8bc45cfa 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-27 10:20:19 -07:00
Nicola Corti 6eb21ca1fb 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-27 08:40:14 -07:00
Pieter De Baets 43af902693 Unbreak Android LayoutAnimation by making all surfaces go through Binding (#46691)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46691

In Bridgeless, ReactSurface would only call `registerSurface` when it started, which did not match the behaviour seen in startSurface(WithConstraints). Instead, make all calls to start the surface go through the FabricUIManager Binding so we can correctly configure `setMountingOverrideDelegate` which is required for layout animations.

Changelog: [Android][FIxed] LayoutAnimations work on full new architecture

Reviewed By: cortinico

Differential Revision: D63533635

fbshipit-source-id: f6d3db020bb2d7245f7b14f2407271d76837d40c
2024-09-27 08:32:31 -07:00
Ruslan Lesiutin 459fadce77 Use native module to persist RDT settings (#46663)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46663

# Changelog: [Internal]

Now we can use the native module for persisting settings in React DevTools. Basically, this diff adds read / write implementations.

Reviewed By: huntie

Differential Revision: D62967060

fbshipit-source-id: c14ef056c8d7e30a23d2b84d1ad4fc0ad8eaaf34
2024-09-27 08:12:45 -07:00
Ruslan Lesiutin d336a7c9c6 fix: pass closest public instance to React DevTools (#46664)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46664

# Changelog: [Internal]

Please see https://github.com/facebook/react/pull/31068.

Synced changes for React Native - D63453667.

Reviewed By: huntie

Differential Revision: D63421463

fbshipit-source-id: e455711206598a06f7cdce4150e79c3548843b99
2024-09-27 08:12:45 -07:00
Ruslan Lesiutin 37756d7de5 fix: ReactDevToolsSettingsManagerModule in ReactModuleList for android (#46665)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46665

# Changelog: [Internal]

Looks like this module was missing on android for a while.

Reviewed By: huntie

Differential Revision: D63460309

fbshipit-source-id: 7146e7f2104f868d0f2b7271bd2c452608611ea3
2024-09-27 08:12:45 -07:00
Ruslan Lesiutin cf491d769f Libraries/DevToolsSettings -> private/reactdevtools/ReactDevToolsSettings (#46662)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46662

# Changelog: [Internal]

This should not have been a public API in the first place.

1. Moving this to `src/private`.
2. Removed some unused APIs, such as profiling settings.

Reviewed By: huntie

Differential Revision: D62965492

fbshipit-source-id: fb97eccaf647ce418f500b02d153263aa8632eee
2024-09-27 08:12:45 -07:00