Commit Graph

38536 Commits

Author SHA1 Message Date
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
Panos Vekris d75e917753 Deploy 0.247.1 to xplat (#46710)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46710

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D63560047

fbshipit-source-id: a43ac647fee12115c794aa8002bd340a4c4bcf16
2024-09-27 15:27:53 -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 33b78ee080 Substitute babel-preset-fbjs for metro-transform-plugins (#46689)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46689

Resubmission of D61014834 / https://github.com/facebook/react-native/pull/45959 (previously reverted).

> Addresses TODO comment. I noticed this lone reference to babel-preset-fbjs (last published 3y ago) while attempting to upgrade our Babel Flow syntax plugin.

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D63532211

fbshipit-source-id: e94b55b7b61194b50131b36a2fe817e149152953
2024-09-27 10:36:42 -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
Ruslan Lesiutin 53b7f0e764 upgrade React Native on a new RDT backend (#46669)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46669

# Changelog: [Internal]

In React DevTools 6.0.0, settings manager is [no longer used](https://github.com/facebook/react/pull/30986), because the host of the Backend is responsible for settings persistance.

Also, `installHook()` call was removed from the top level of the JavaScript module and now we need to call `initialize()` explicitly.

The logic for persisting settings will be added in one of the next diffs at the top.

Reviewed By: huntie

Differential Revision: D62967059

fbshipit-source-id: 5022546aab02540f38c8d2e2f2e7dfeb82863f3f
2024-09-27 08:12:45 -07:00
Ruslan Lesiutin 6173d6ca42 Update debugger-frontend from e8c7943...87b2feb (#46673)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46673

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

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

Reviewed By: huntie

Differential Revision: D63455520

fbshipit-source-id: 07776c17f368e895a2d526cbb9abb8e1104bb29c
2024-09-27 08:12:45 -07:00
Ruslan Lesiutin ed4f6d6891 upgrade[react-devtools-core]: 6.0.0 (#46670)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46670

# Changelog:
[General] [Changed] - upgrade React DevTools to 6.0.0.

allow-large-files

Reviewed By: huntie

Differential Revision: D63460308

fbshipit-source-id: 159b0a0a074aae52c3710730a4fc2cbccb04970d
2024-09-27 08:12:45 -07:00
Nicola Corti 1bdae07d89 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-27 07:49:52 -07:00
zhongwuzw 8bfd7e1039 Fixes Appearance getColorScheme sync method UI thread issue (#46344)
Summary:
If the module sets the method queue to the main queue, we should call it on the main queue if it contains some UI operations, otherwise it may lead to some undefined behavior.

## Changelog:

[IOS] [FIXED] - Fixes the exported synchronous method not being called on the method queue when it's the main queue

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

Test Plan: The sync method should be called on the main queue if the module's method queue is main queue.

Reviewed By: cipolleschi

Differential Revision: D63532525

Pulled By: javache

fbshipit-source-id: 55baaa60af96bb1355d3641174f23bccd8eb9344
2024-09-27 06:47:53 -07:00
Blake Friedman 8237e237ce 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-27 03:38:19 -07:00
Nicola Corti 12dda31bc1 fix: ReactDelegate crashing New Architecture apps by invoking setContentView (#46671)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46671

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

Currently `ReactFragment` and `ReactDelegate` don't work in OSS + New Architecture because we call `Activity.setContentView`
on the host activity.

That result on us replacing the whole activity layout, even when the user wants to use a Fragment.
As we do have `ReactActivityDelegate` that already does this:
https://github.com/facebook/react-native/blob/94b77938435693792e57c96d76691d58d7361530/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java#L138

So this call is unncessary.

I've also updated the relative documentation here:
https://github.com/facebook/react-native-website/pull/4232

Changelog:
[Android] [Fixed] - fix: ReactDelegate/ReactFragment crashing on New Architecture apps

Reviewed By: rozele

Differential Revision: D63464367

fbshipit-source-id: acbfbf7d68eb79657b811a5a9a0d3f72660ec94a
2024-09-27 01:49:38 -07:00
Nicola Corti 7176d11ce4 ReactFragment should properly instantiate ReactDelegate on Bridgeless (#46623)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46623

I've just noticed that ReactFragment is not properly instantiating the `ReactDelegate` with a ReactHost
when on Bridgeless. This causes Fragments to crash when the app is on bridgeless mode.

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

Changelog:
[Android] [Fixed] - ReactFragment should properly instantiate ReactDelegate on Bridgeless

Reviewed By: mdvacca

Differential Revision: D63319977

fbshipit-source-id: 08256e35b2769e18df2d24f870ec5d98e5574f85
2024-09-27 01:49:38 -07:00
Nicola Corti ecd660984c Gradle to 8.10.2 (#46656)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46656

This contains the fix for:
- https://github.com/gradle/gradle/issues/30472

Changelog:
[Internal] [Changed] - Gradle to 8.10.2

Reviewed By: tdn120

Differential Revision: D63457979

fbshipit-source-id: 1439a9ce198c1df0dafa8f5088c079c3fb3d1543
2024-09-27 00:43:25 -07:00
Sam Zhou efe51044b8 Deploy 0.247.0 to fbsource
Summary: Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D63506281

fbshipit-source-id: a992a1786a570f5d9562fbec71e0d2628c139bf3
2024-09-27 00:23:22 -07:00
Sam Zhou c2c9b78e49 Pre-suppress errors ahead of v0.247 release
Summary:
drop-conflicts

Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D63506234

fbshipit-source-id: 186d60e42a8a2a3604058692ed844ba764d6ad3f
2024-09-26 22:25:21 -07:00
David Vacca d93e67d02c Enable Microtasks, ModernRuntimeScheduler and NativeViewConfigsInBridgelessMode by default only for New Architecture (#46683)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46683

Enabling these Microtask, ModernRuntimeScheduler and NativeViewConfigsInBridgelessMode in BridgeMode is risky and leads to bugs.  In this diff I'm ensuring we only enable these flags when newArchitecture is enabled

changelog: [internal] internal

Reviewed By: shwanton

Differential Revision: D63503519

fbshipit-source-id: 4ef757834b8f7fba595b3394735f4b91335d7c98
2024-09-26 22:02:42 -07:00
Nick Gerleman 3f880991aa Back out "Redo "[RN][Android] Convert ReactViewManager, ReactClippingViewManager to Kotlin""
Summary: Backing out the stack since a same crash that previously effected many apps appeared again, and there are changes soon landing that will add more conflicts.

Reviewed By: Abbondanzo

Differential Revision: D63493332

fbshipit-source-id: 4423bf41c793e00a0aa22d12a77bca69d3b1ae77
2024-09-26 15:50:26 -07:00
Nick Gerleman 8d22e3b249 Back out "Redo "[RN][Android] Convert ReactViewGroup to Kotlin""
Summary: Backing out the stack since a same crash that previously effected many apps appeared again, and there are changes soon landing that will add more conflicts.

Reviewed By: Abbondanzo

Differential Revision: D63493331

fbshipit-source-id: 44658ffc99eb4ebc947f95bb6e6bde105ac88c93
2024-09-26 15:50:26 -07:00
Nick Gerleman a886a2fa05 Back out "ReactViewGroup post-conversion cleanup"
Summary: Backing out the stack since a same crash that previously effected many apps appeared again, and there are changes soon landing that will add more conflicts.

Reviewed By: Abbondanzo

Differential Revision: D63493334

fbshipit-source-id: 175fc7b5b69aa2874c867e460ab102bb077a7cd8
2024-09-26 15:50:26 -07:00
Eric Rozell 1dcaf823f5 Fix conflicting assertions for click events (#46633)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46633

There is an assertion in the "basic click test" that [checks](https://github.com/facebook/react-native/blob/d6e0bc7/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventClickTouch.js#L36-L40) that `isPrimary` is set to false. The same assertion suite also does a mouse event [validation](https://github.com/facebook/react-native/blob/d6e0bc7/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventSupport.js#L201-L204) that `isPrimary` is set to true.

This fixes the conflicting assertions, favoring the behavior observed on Firefox, which appears to be more closely aligned with the W3C spec.

## Changelog

[General][Fixed] Fixed issues with W3C PointerEvents testsx

Reviewed By: vincentriemer

Differential Revision: D63336622

fbshipit-source-id: adbfe5e1bc2a5fd7db18ae067f39e719c19c8cda
2024-09-26 14:45:44 -07:00
David Vacca fc9fcb5976 Fix initialization of FeatureFlags in DefaultNewArchitectureEntryPoint (#46681)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46681

Fix initialization of FeatureFlags in DefaultNewArchitectureEntryPoint

D60364016 introduced a bug, disabling Fabric and TurboModules when DefaultNewArchitectureEntryPoint is initialized with bridgless disabled

changelog: [internal] internal

Reviewed By: shwanton

Differential Revision: D63474698

fbshipit-source-id: 8b5aaeeda564d3463d13448b0adc7e964015000e
2024-09-26 14:23:04 -07:00
Thomas Nardone 9cd83fa9ab ReactViewGroup post-conversion cleanup (#46668)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46668

Small tweaks post-Kotlin-conversion:
- Make `overflow` a var
- Replace `+ -` with `-`
- Clean up properties and move up init block
- Iterate over entire allChildren array to clean up listeners

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D63343964

fbshipit-source-id: 2e9022e2d7e54ac338d1003419d8959771f7f270
2024-09-26 13:11:07 -07:00
Thomas Nardone be5e2b5827 Redo "[RN][Android] Convert ReactViewGroup to Kotlin" (#46672)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46672

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D63129923

fbshipit-source-id: 0734f564b38e3adba704edffe45511e671ae74ac
2024-09-26 13:11:07 -07:00
Thomas Nardone f775f6919f Redo "[RN][Android] Convert ReactViewManager, ReactClippingViewManager to Kotlin" (#46667)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46667

Pre-req for converting ReactViewGroup without affecting API visibility.
Changelog: [Internal]

Reviewed By: javache

Differential Revision: D63129925

fbshipit-source-id: 3b31df7b5450adcc961bb677114fb94d944f1ce4
2024-09-26 13:11:07 -07:00
Pieter De Baets 3fbf5c72f3 Fix ReactSurfaceView-backed roots not reporting the end of pending transactions correctly (#46676)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46676

Changelog: [internal]

## Context

We recently "fixed" a problem in `MountingCoordinator` on Android where it would report that it doesn't have any pending transactions when, in fact, it does. The fix introduces a new method in that class to delay marking transactions as done until a mount hook is invoked for that surface.

That fixed the issue... by always reporting that there were pending transactions accidentally.

The reason for this bug is that the mount hook doesn't have access to the mounting coordinator of the surface if the surface is registered through some of the methods in `Binding.cpp` that don't add the surface to a registry. In that case, we can never mark the transactions as done and the mounting coordinator for those surfaces always report pending transactions incorrectly.

NOTE: this bug only affects apps that have the `fixMountingCoordinatorReportedPendingTransactionsOnAndroid` feature flag enabled.

## Changes

This fixes the issue by making sure that surfaces are always registered in the registry and that we can access their mounting coordinators in the mount hook to report the transactions as done.

Reviewed By: rubennorte

Differential Revision: D63466672

fbshipit-source-id: a621a12cda89a3ab7331d3c6a16c6cdfa9341821
2024-09-26 11:32:00 -07:00
Pieter De Baets 04da3d784b Error in reportMount when surface is not found (#46678)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46678

I'm investigating some issues with surface management and noticed `surfaceHandlerRegistry_` is not updated in the bridgeless path when using ReactSurfaceView.

Adding a warning to help us validate this is resolved when we do eventually fix it.

Changelog: [Internal]

Reviewed By: fabriziocucci

Differential Revision: D63463521

fbshipit-source-id: 38995924588f1d71b9fc517c76a6e0c572fd0699
2024-09-26 11:32:00 -07:00
hoxyq (Meta Employee) 633ad4933e fix: use public instance in Fiber renderer and expose it from getInspectorDataForViewAtPoint (#31068) (#46674)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46674

bypass-github-export-checks

React DevTools no longer operates with just Fibers, it now builds its
own Shadow Tree, which represents the tree on the Host (Fabric on
Native, DOM on Web).

We have to keep track of public instances for a select-to-inspect
feature. We've recently changed this logic in
https://github.com/facebook/react/pull/30831, and looks like we've been
incorrectly getting a public instance for Fabric case.

Not only this, turns out that all `getInspectorData...` APIs are
returning Fibers, and not public instances. I have to expose it, so that
React DevTools can correctly identify the element, which was selected.

Changes for React Native are in
[D63421463](https://www.internalfb.com/diff/D63421463)

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

Test Plan: Sandcastle tests

Reviewed By: poteto

Differential Revision: D63453667

Pulled By: hoxyq

fbshipit-source-id: 21b1d5d4cd68b42748d4a785e0f28eaf5db57f21
2024-09-26 09:58:18 -07:00
Robert Pasiński 38b3b2195c New implementation of PerformanceObserver and related APIs (fixes #45122) (#45206)
Summary:
Changelog: [internal]

(this functionality hasn't been enabled in OSS yet, so no changelog necessary).

Fix https://github.com/facebook/react-native/issues/45122.

performance.mark is currently O(1) but performance.clearMark is O(n) (being n the number of entries in the buffer), which makes this operation very slow.

### Changes overview

 - Created new `PerformanceEntryBuffer` abstraction with the following subtypes, that differ on how entries are stored:
   - `PerformanceEntryCircularBuffer` - stores them in a ring buffer that was already implemented, removed key lookup cache (`BoundedConsumableBuffer`)
   - `PerformanceEntryKeyedBuffer` - stores them in a `unordered_map`, allowing for faster retrieval by type
   - `PerformanceEntryLinearBuffer` - a simple infinite buffer based on `std::vector`, currently used in a `PerformanceObserver`
 - Created `PerformanceObserver` abstraction on native side.
 - Created `PerformanceObserverRegistry` that collects active observers and forwards entries to observers that should retrieve them
 - Moved some method implementations to `.cpp` files to reduce potential compilation time slowdown. As the `PerformanceEntryReporter` can be included from anywhere in the code, it will be beneficial to make header files as light as possible.
 - Add comments to methods that note which standard is the method from/for.
 - Added some `[[nodiscard]]` attributes
 - Since the logic of routing entries to observers is moved to native side, JS side of the code got much simplified
 - If ever needed, `PerformanceObserver` can be created from native-side

Standards covered:

 - https://www.w3.org/TR/performance-timeline
 - https://www.w3.org/TR/event-timing/
 - https://w3c.github.io/timing-entrytypes-registry
 - https://w3c.github.io/user-timing/

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

Test Plan:
I've tested this e2e on IGVR and in the RNTester playground for the performance APIs. Everything works as expected.
There are also new unit tests for this.

C++ test results: https://www.internalfb.com/intern/testinfra/testconsole/testrun/8725724513169247/

Reviewed By: rshest

Differential Revision: D63101520

Pulled By: rubennorte

fbshipit-source-id: 5970b5c14692ff33ffda44a9f09067f6a758bdbe
2024-09-26 09:16:03 -07:00