Commit Graph

33510 Commits

Author SHA1 Message Date
Alex Hunt 52ea8b07e2 Specify package manager version for project (#47091)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47091

Prompted by https://github.com/facebook/react-native/pull/47083, this change adds a `"packageManager"` field to the root `package.json` specifying `yarn@1.22.22`. This will configure a compatible, predictable version of Yarn for users using [Corepack](https://nodejs.org/api/corepack.html) via the Yarn Modern install process.

See https://yarnpkg.com/getting-started/install and https://nodejs.org/api/corepack.html.

Tested on a fresh system (GitHub Codespaces).

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D64536673

fbshipit-source-id: 535c0ca725172e4a06de04b19c6cd2d31788f5a4
2024-10-17 07:55:07 -07:00
Riccardo Cipolleschi f1d2331dfb We use the right filename as hash in CI cache key (#47087)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47087

In the repo, we don't have a `build-apple-framewroks.sh` file, but we do have a `build-apple-framewrok.sh` file, with no ending `s`

## Changelog:
[Internal] - Fix CI cache key

Reviewed By: cortinico

Differential Revision: D64531456

fbshipit-source-id: 05c104390b875eeef2cf15f8a30c8672cfc9b61d
2024-10-17 07:47:51 -07:00
Robert Pasiński 32f7b3b4e0 fix: performance.measure with mark names (#46786)
Summary:
This PR improves PerformanceObserver Native Public API and fixes issue with `performance.measure` not working with mark names.

## Changelog:

 - Made `PerformanceEntryReporter::report[Mark|Measure]` return the created entry with computed data.
 - Updated JS-Native interface to return computed data from Native side to JS.
 - Updated JS tests

[GENERAL] [FIXED] - Fixed `performance.measure` with mark names
[GENERAL] [INTERNAL] - `PerformanceEntryReporter::reportMark` and `PerformanceEntryReporter::reportMeasaure` now return created performance entries.

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

Test Plan:
- [ ] Update JS tests
 - [ ] Update Native tests

Reviewed By: rshest

Differential Revision: D64466057

Pulled By: rubennorte

fbshipit-source-id: d280d66c268a9830fbc9e6f3304e108ecf870a59
2024-10-17 07:25:50 -07:00
Edmond Chui ff113545cf Update debugger-frontend from a897db8...117c96a (#47072)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47072

Changelog: [Internal] - Update `react-native/debugger-frontend` from a897db8...117c96a

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

Reviewed By: hoxyq

Differential Revision: D64487276

fbshipit-source-id: ae7efce5dadf72f62c824d0acbc6aa6d44149905
2024-10-17 07:25:20 -07:00
Nicola Corti 7bbac8ee27 Migrate MainReactPackage to Kotlin (#47070)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47070

For the sake of Stable API, I'd like to get this class converted to Kotlin

The class is becoming `final` so could be breaking for some users if they subclass `MainReactPackage` which I believe this should not be a valid usage of this API.

Changelog:
[Android] [Changed] - Migrate MainReactPackage to Kotlin (and make it final)

Reviewed By: tdn120

Differential Revision: D64479418

fbshipit-source-id: 24a07de4e5796a7b82ba34c9b36511b8fc526f1a
2024-10-17 05:29:04 -07:00
Nicola Corti 2d2bb9c588 Undo breaking change on ViewManagerDelegate.kt String params (#47086)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47086

When we migrated `ViewManagerDelegate` to Kotlin, we convered his string params to be `String` (rather than `String?`).

Existing implementation of this interface in OSS written in Kotlin were using `String?` due to this interface being in Java (and not being Nullsafe annotated).
Therefore now changing this interface from `String?` to `String` is a breaking change for them.

Affected libraries are:
https://github.com/search?q=%22fun+receiveCommand%28%22+%22commandId%3A+String%3F%22+%22args%3A+ReadableArray%22+language%3Akotlin+-org%3Afacebook+-is%3Afork&type=code&p=4

This prevents the breaking change and should be included in 0.76.

Changelog:
[Android] [Fixed] - Undo breaking change on ViewManagerDelegate.kt String params

Reviewed By: cipolleschi

Differential Revision: D64532446

fbshipit-source-id: aac286554ad0e35f557160f900bcbad1acc5930d
2024-10-17 04:45:05 -07:00
Samuel Susla c90ab6e878 use unique_ptr instead of shared_ptr in RCTScheduler (#47055)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47055

changelog: [internal]

no need to use shared_ptr here.

Reviewed By: christophpurrer

Differential Revision: D64464645

fbshipit-source-id: 8947ac8d13322ace3204697047a7582940f98687
2024-10-17 04:42:46 -07:00
Rubén Norte 2d9fe11578 Unify feature flags for event loop (2nd attempt) (#47084)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47084

Changelog: [internal]

This unifies all the feature flags that control the new event loop on RN. Before, we'd have granular flags for different aspects of it. With this diff, we enable the event loop by default with bridgeless, and we introduce a new flag to explicitly disable it in that case if necessary.

When we're ready to clean up this opt-out, we just need to remove the `&& !ReactNativeFeatureFlags::disableEventLoopOnBridgeless()` conditions.

Reviewed By: fkgozali

Differential Revision: D64464902

fbshipit-source-id: d1a0ba38dd4c189c2da905b49de23a821223ac3a
2024-10-17 04:42:37 -07:00
Rubén Norte f92863e815 Add support for feature flags without native implementation (#47059)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47059

Changelog: [internal]

This adds a new configuration for feature flags to preserve their definition only in JavaScript and skip their native API and implementations. This is useful to preserve the API in JavaScript when JavaScript changes progress faster than native changes.

Reviewed By: sammy-SC

Differential Revision: D64464779

fbshipit-source-id: 0af9624daad7bd655172905f8f616d53655cb407
2024-10-17 04:42:37 -07:00
Samuel Susla a72510d586 delete EventBeat's copy ctor and remove default implementation for induce (#47057)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47057

changelog: [internal]

EventBeat should never be copied. Make that explicit.
EventBeat::induce must never be empty, remove the default implementation.

# Goal of this stack:
Centralise event beat logic into EventBeat class inside react-native-github. Subclasses should only override EventBeat::request and EventBeat::induce.

Reviewed By: christophpurrer

Differential Revision: D64291845

fbshipit-source-id: 9265491c33b23d6ec2ccad4e2ea55e2b11211e6a
2024-10-17 04:36:28 -07:00
Samuel Susla e6ba1db5e9 rename AsyncEventBeat to AndroidEventBeat (#47053)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47053

changelog: [internal]

AsyncEventBeat is Android specific, let's rename it to reflect that.

Goal of this stack:
Centralise event beat logic into EventBeat class inside react-native-github. Subclasses should only override EventBeat::request and EventBeat::induce.

Reviewed By: christophpurrer

Differential Revision: D64301829

fbshipit-source-id: cc550ce3836764519c2f4ef849d699ed66226359
2024-10-17 04:36:28 -07:00
Samuel Susla c36806f9e8 pass eventBeat directly into EventDispatcher (#47052)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47052

changelog: [internal]

EventBeat can be constructed in Scheduler and passed to EventDispatcher. This is cleaner than passing down all dependencies and constructing it in place.

# Goal of this stack:
Centralise event beat logic into EventBeat class inside react-native-github. Subclasses should only override EventBeat::request and EventBeat::induce.

Reviewed By: christophpurrer

Differential Revision: D64291401

fbshipit-source-id: ef6d2bdb630767de1dab6052d9d9226c9e1a5f3c
2024-10-17 04:36:28 -07:00
Samuel Susla b1ec76e2ad copy by value in RunLoopObserver ctor (#47051)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47051

changelog: [internal]

copy weak owner instead of using const&. const& is wrong here and hides important information because weak owner is always copied into ivat.

Goal of this stack:
Centralise event beat logic into EventBeat class inside react-native-github. Subclasses should only override EventBeat::request and EventBeat::induce.

Reviewed By: christophpurrer

Differential Revision: D64291515

fbshipit-source-id: 3e74270f03fac121e9f45b0a8ad287ccdb0a059a
2024-10-17 04:36:28 -07:00
Samuel Susla e00002131c refactor EventBeat owner (#47050)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47050

changelog: [internal]

- Rename SchedulerToolbox::asynchronousEventBeatFactory to SchedulerToolbox::eventBeatFactory. There is only one eventBeat, no need to distinguish between sync and async.
- Remove typealias EventBeat::SharedOwnerBox and pass by value instead of const&.

# Goal of this stack:
Centralise event beat logic into EventBeat class inside react-native-github. Subclasses should only override `EventBeat::request` and `EventBeat::induce`.

Reviewed By: christophpurrer

Differential Revision: D64291288

fbshipit-source-id: 96afc56a51677ed9e61b2a662bb968678fa770f7
2024-10-17 04:36:28 -07:00
Nicola Corti 125d01286f Add -Xshare:off for Unit tests (#47066)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47066

This suppresses the warning:
```
Sharing is only supported for boot loader classes because bootstrap classpath has been appended
```

which is not relevant for us.

Changelog:
[Internal] [Changed] - Add -Xshare:off for Unit tests

Reviewed By: cipolleschi

Differential Revision: D64474372

fbshipit-source-id: 67d0a2da47ecd1d4ab906b03515b9a59f2e4f245
2024-10-17 04:33:01 -07:00
Blake Friedman 19971092b6 Add changelog for 0.76.0-rc.5 (#47037)
Summary:
Changelog:
[Internal] - add changelog

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

Reviewed By: NickGerleman

Differential Revision: D64433991

Pulled By: blakef

fbshipit-source-id: 74c219553a40ff79554ec6a313e23eb82a5534ac
2024-10-17 02:31:08 -07:00
Douglas Lowder bb8992c760 fix: Add missing tvOS steps to build-hermes-macos GH action (#47073)
Summary:
After examining Hermes artifacts built after merging of https://github.com/facebook/react-native/issues/46865 , it was apparent that tvOS frameworks were missing from the Hermes universal framework generated by CI.

I went back and discovered additional steps that need to be added to the `build-hermes-macos` action to make CI work correctly.

## Changelog:

[Internal][Fixed] add required steps to build tvOS in build-hermes-macos action

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

Test Plan: After merging, Hermes artifacts generated by CI should contain the missing tvOS bits.

Reviewed By: rshest

Differential Revision: D64528911

Pulled By: cipolleschi

fbshipit-source-id: 61db3e154767830a4726d7ceeec229a4af30d247
2024-10-17 02:22:02 -07:00
Tim Yung 01e210fd28 RN: Support Ref Cleanup in useMergeRefs (#47040)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47040

Updates `useMergeRefs` to support cleanup functions.

Changelog:
[General][Changed] - `useMergeRefs` and components using it (e.g. `Pressable`) now support ref cleanup functions.

Reviewed By: lunaleaps

Differential Revision: D64437947

fbshipit-source-id: b715abfa5b4236c1a7685ac023ff1d0384b6a3a4
2024-10-17 01:28:07 -07:00
Alan Lee 1c002c7b4e bump fbjni to 0.7.0 (#47031)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47031

fbjni 0.7.0 has updates to support 16KB page size

- https://github.com/facebookincubator/fbjni/releases/tag/v0.7.0

Changelog:
[Android][Changed] - Bump fbjni to 0.7.0

Reviewed By: cortinico

Differential Revision: D64372127

fbshipit-source-id: eb2be6aec30ea5051d55d38554c0a912ff579109
2024-10-17 00:43:21 -07:00
Sam Zhou 10d8c0df29 Deploy 0.249.0 to xplat (#47077)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47077

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D64512638

fbshipit-source-id: 6c61e13ef0b02f755a150a4d31312375ca487076
2024-10-17 00:09:24 -07:00
Nick Gerleman 6dc64d44f8 Add some unit tests for RCTIsAttributedStringEffectivelySame (#47038)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47038

tsia

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D64433780

fbshipit-source-id: d29f23c3d01cbb6157ba33c682cb1d9e20f12a7a
2024-10-16 23:34:08 -07:00
Tim Yung fa0358a058 RN: Fix useMergeRefs-test.js (#47076)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47076

The Jest unit tests for `useMergeRefs` were incorrectly implemented, leading to missing expected values. The root cause is that the test helpers were rendering to new roots instead of reusing the same root.

This refactors the test helpers to be simpler and easier to debug, and then fixes the bug described above.

Changelog:
[Internal]

Reviewed By: lunaleaps

Differential Revision: D64498741

fbshipit-source-id: f0dd65f89e0c13721e83a8e38a699bc688812a0e
2024-10-16 16:01:10 -07:00
Thomas Nardone 9406a09f87 Add PixelUtil extensions for Int, Long (#46992)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46992

Changelog: [Android][Added] Added PixelUtil extensions for Int and Long

Reviewed By: Abbondanzo

Differential Revision: D64262473

fbshipit-source-id: 49a666662ca260b878bdfa9a81a79dd6a381c879
2024-10-16 13:55:01 -07:00
Edmond Chui c35035ed3c Update debugger-frontend from 0ecc39f...a897db8 (#47067)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47067

Changelog: [Internal] - Update `react-native/debugger-frontend` from 0ecc39f...a897db8

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

Reviewed By: hoxyq

Differential Revision: D64475173

fbshipit-source-id: 216c88e13c292c4f857e03e135d761e7042a14c0
2024-10-16 12:21:31 -07:00
Sam Zhou 75dc0f7c73 Eliminate last React$AbstractComponent in react-native (#47069)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47069

Use of this internal type will trigger a `internal-type` error in the next version of Flow. This diff eliminates the last use in react native.

Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D64479166

fbshipit-source-id: d440a2fbfe88223462ce61252082a2e7381fb4c9
2024-10-16 11:55:49 -07:00
Nicola Corti c867aba2f3 Move BridgelessDevSupportManager to .devsupport package (#46914)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46914

The `BridgelessDevSupportManager` should have lived inside the `.devsupport` package alongside all the other
devsupport related tooling.

It was instead created inside `.runtime` causing a tight coupling with `ReactHostImpl`.
This made it impossible for Frameworks to customize it (i.e. in Expo GO) also because there was a circular
dependency between ReactHostImpl and BridgelessDevSupportManager

In this diff I'm:
1. Breaking the circular dependency by using `ReactHostDevHelper`
2. Updating all the parameters to reference `ReactHost` rather than `ReactHostImpl`
3. Moving BridgelessDevSupportManager to the `.devsupport` package.

This is breaking for users that are manually composing a `BridgelessDevSupportManager` or
that are extending the `ReactInstanceDevHelper`.

- `ReactInstanceDevHelper` has 3 new method which will have to be implemented.
- `BridgelessDevSupportManager` is now living in a different package.

Changelog:
[Android] [Breaking] - Add 3 methods to ReactInstanceDevHelper

Reviewed By: rshest

Differential Revision: D64105790

fbshipit-source-id: 13478fe1a035adb5b0dc83ebb1daad6cfb243881
2024-10-16 11:25:26 -07:00
Edmond Chui ad6a2fa612 Fusebox reload-to-profile refactor (#47060)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47060

Changelog: [internal]

Follow up on feedback from D64077813

 oliver_clean

Reviewed By: hoxyq

Differential Revision: D64469842

fbshipit-source-id: e4639defb01683090823eb6774b0c65e9157ef27
2024-10-16 10:31:15 -07:00
Ruslan Lesiutin f53cd7238c Encapsulate TracingAgent (#46986)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46986

# Changelog: [Internal]

Encapsulate integration with `FuseboxTracer.cpp` into `TracingAgent.cpp`, which will be responsible for handling `Tracing` domain CDP events.

Closer to the top of the stack, more changes will be added to it.

Reviewed By: huntie

Differential Revision: D64249695

fbshipit-source-id: 4adf5973299275e210e7cdf9c816efab881c9daf
2024-10-16 10:14:52 -07:00
Samuel Susla 4e12b86bfc delete fetchImagesInViewPreallocation feature flag (#47056)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47056

changelog: [internal]

Reviewed By: Abbondanzo

Differential Revision: D64464758

fbshipit-source-id: 88b8deacac273b693c4bcdd195cbf46441330b0b
2024-10-16 09:08:28 -07:00
poonamjain96 848471b69f Add test case for set opacity in new arch examples (#47043)
Summary:
Part of this: https://github.com/facebook/react-native/issues/46757
Solves:
- ME2E0004

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

[ Internal ] [ Added ] - Add setOpacity test in new-arch-example

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

Test Plan:
```
yarn e2e-test-ios
yarn e2e-test-android
```

Reviewed By: cortinico

Differential Revision: D64457441

Pulled By: cipolleschi

fbshipit-source-id: 310270293f5c7ec8a94c0d38fdd0897e4591ec14
2024-10-16 08:33:37 -07:00
Riccardo Cipolleschi 17455e1004 Sort the changelog properly
Summary:
While working on the changelog, I realized that version 0.75.4 ended up in between RCs of 0.76

To avoid to lose the changelog of 0.75.4 once we release 0.76, I moved it to the right place, above 0.75.3's changelog
bypass-github-export-checks
## Changelog:
[Internal] - Sort Changelog properly

Reviewed By: cortinico

Differential Revision: D64470420

fbshipit-source-id: 0602b6cf4d7b9d9b3befb2535de6079d28545a15
2024-10-16 08:18:59 -07:00
antFrancon 6aeca53b3e fix(android): Prevent ArrayIndexOutOfBoundsException in permission check (#47047)
Summary:
This PR addresses a potential `ArrayIndexOutOfBoundsException` in the Android module's permission checking logic.

```diff
- results.length > 0 && results[j] == PackageManager.PERMISSION_GRANTED
+ results.length > j && results[j] == PackageManager.PERMISSION_GRANTED
```

It ensures that we only access the results array when the index `j` is within bounds, preventing crashes due to invalid array access that have been occurring in the production environment.

Here is the Crashlytics dashboard concerning this type of crash on my app last week (react-native 0.75.4 - old arch):
![image](https://github.com/user-attachments/assets/0b7c1a10-39f6-4a17-9eee-4b17986f5b85)

## Changelog:

[ANDROID] [FIXED] - Prevent ArrayIndexOutOfBoundsException in permission check

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

Test Plan:
1. Verify normal permission request scenarios still work on Android:
   - Request a permission (e.g., camera, location)
   - Grant the permission
   - Verify the app functions correctly with the granted permission

2. Monitor production crash reports:
   - Deploy the fix to production
   - Observe a decrease in ArrayIndexOutOfBoundsException occurrences in the permission check logic

Note: As this crash was only observed in production, we'll rely on production monitoring to verify the fix's effectiveness over time.

Reviewed By: rshest

Differential Revision: D64464171

Pulled By: cortinico

fbshipit-source-id: 87beacf7ee749a51665577d05a56cc8d6889d70f
2024-10-16 07:30:30 -07:00
David Vacca 6b67772204 Enable 'useFabricInterop' by default in new architecture (#47017)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47017

Enable 'useFabricInterop' by default in RNOSS

changelog: [Android][Changed] Enable fabric interop by default in new architecture for Android

Reviewed By: cortinico, rshest

Differential Revision: D64340659

fbshipit-source-id: b94421aaf482675dbe8838a97d9968494e4fa75f
2024-10-16 04:37:14 -07:00
Douglas Lowder f673759c83 feat: Add tvOS support to Hermes artifacts (#46865)
Summary:
Adds tvOS to the list of Apple platforms supported by the Hermes artifacts. After this, the React Native TV builds will be able to use the same Hermes artifacts as those used by RN core.

~Added some code in `hermes-utils.rb` so that the Hermes podspec can use a local Maven repo (`/tmp/maven-local`).~

> *Note:* ~This PR should not be merged until the corresponding Hermes PR https://github.com/facebook/hermes/pull/1529 is merged.~ (https://github.com/facebook/hermes/pull/1529 has been merged)

## Changelog:

[iOS][Added] tvOS support for Hermes artifacts

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

Test Plan: - tvOS is also added to the build and test GitHub workflows.

Reviewed By: rshest

Differential Revision: D64461324

Pulled By: cipolleschi

fbshipit-source-id: d63889c60c72519818e7076cd0ab5851791715a1
2024-10-16 03:39:58 -07:00
Edmond Chui 4df224ca6d Fusebox reload-to-profile (Part 2 of 2: JS) (#46905)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46905

Changelog: [General][Added] - Add support for reload-to-profile in Fusebox (Part 2 of 2: JS)

Reviewed By: hoxyq

Differential Revision: D64077813

fbshipit-source-id: a6d3326d8514f49e47074d21d37e00044ad62fd8
2024-10-16 01:27:28 -07:00
Shawn Dempsey 85f1d9a518 Back out "Unify feature flags for event loop" (#47041)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47041

Original commit changeset: b879447def8a

Original Phabricator Diff: D64175216

Reviewed By: fkgozali

Differential Revision: D64439014

fbshipit-source-id: efc1bb7baa547d270322aabf6c5a4f50ace23e1b
2024-10-15 21:53:42 -07:00
Nick Gerleman 557e3447f5 Include existing attributes in newly typed text (#47018)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47018

This change makes it so that newly typed text in a TextInput will include the existing attributes present based on cursor position. E.g. if you type after an inner fragment with blue text, the next character will be blue (or, an event emitter specific to an inner fragment will also be expanded). This is a behavior change for the (admittedly rare) case of uncontrolled TextInput with initially present children AttributedText, but more often effect controlled components, before state update (we are after, less likely to need to reset AttributedString because of mismatch).

Originally included this in D64121570, but it's not needed to fix the common case since we include paragraph-level event emitter as part of default attributes, and has some of its own risk, so I decided it is better separate.

Changelog:
[iOS][Changed] - Include existing attributes in newly typed text

Reviewed By: cipolleschi

Differential Revision: D64352310

fbshipit-source-id: 90ef8c49f50186eadf777e81cf6af57e1aada207
2024-10-15 16:24:53 -07:00
Nick Gerleman 36fd5533f6 Fix cursor moving while typing quickly and autocorrection triggered in controlled single line TextInput on iOS (New Arch) (#46970)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46970

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

This one is a bit of a doozy...

During auto-correct in UITextField (used for single line TextInput) iOS will mutate the buffer in two parts, non-atomically. After the first part, after iOS triggers `textFieldDidChange`, selection is in the wrong position. If we set full new AttributedText at this point, we propagate the incorrect cursor position, and it is never restored.

In the common case, where we are not mutating text in the controlled component, we shouldn't need to be setting AttributedString in the first place, and we do have an equality comparison there currently. But it is defeated because attributes are not identical. There are a few sources of that:
1. NSParagraphStyle is present in backing input, but not the AttributedString we are setting.
2. Backing text has an NSShadow with no color (does not render) not in the AttributedText
3. Event emitter attributes change on each update, and new text does not inherit the attributes.

The first two are part of the backing input `typingAttributes`, even if we set a dictionary without them. To solve for them, we make attribute comparison insensitive to the attribute values in a default initialized control. There is code around here fully falling back to attribute insensitive comparison, which we would ideally fix to instead role into this "effective" attribute comparison.

The event emitter attributes being misaligned is a real problem. We fix in a couple ways.
1. We treat the attribute values as equal if the backing event emitter is the same
2. We set paragraph level event emitter as a default attribute so the first typed character receives it

After these fixes, scenario in https://github.com/facebook/react-native-website/pull/4247 no longer repros in new arch. Typing in debug build also subjectively seems faster? (we are not doing second invalidation of the control on every keypress).

Changes which do mutate content may be susceptible to the same style of issue, though on web/`react-dom` in Chrome, this seems to not try to preserve selection at all if the selection is uncontrolled, so this seems like less of an issue.

I haven't yet looked at old arch, but my guess is we have similar issues there, and could be fixed in similar ways (though, we've been trying to avoid changing it as much as possible, and 0.76+ has new arch as default, so not sure if worth fixing in old impl as well if this is very long running issue).

Changelog:
[iOS][Fixed] - Fix cursor moving in iOS controlled single line TextInput on Autocorrection (New Arch)

Reviewed By: javache, philIip

Differential Revision: D64121570

fbshipit-source-id: 2b3bd8a3002c33b68af60ffabeffe01e25c7ccfe
2024-10-15 16:24:53 -07:00
Ruslan Lesiutin d287c72804 Update debugger-frontend from 6f29504...0ecc39f (#47036)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47036

Changelog: [Internal] - Update `react-native/debugger-frontend` from 6f29504...0ecc39f

Resyncs `react-native/debugger-frontend` from GitHub - see `rn-chrome-devtools-frontend` [changelog](https://github.com/facebookexperimental/rn-chrome-devtools-frontend/compare/6f29504d63ea3de4b07545fdfa59b978e30b05a9...0ecc39f68a7dbfb76ae5801b24f0e8ad610ba785).

Reviewed By: EdmondChuiHW

Differential Revision: D64405153

fbshipit-source-id: 1fe491aa878d203bee207f5c4163aac98f4524c2
2024-10-15 13:15:07 -07:00
Ruslan Lesiutin c1a7b4a8e9 upgrade[react-devtools-*]: ^6.0.1 (#47034)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47034

allow-large-files

# Changelog: [Internal]

Upgrades React DevTools npm packages to 6.0.1 for whole xplat.

Reviewed By: EdmondChuiHW

Differential Revision: D64403912

fbshipit-source-id: 39310fcb300a2a2e48d38faacef97ef65c49bbe8
2024-10-15 13:15:07 -07:00
Joe Vilches dd1aea5ccf fix(iOS): Replace uses of CGColorRef with UIColor to avoid manual memory management v2 (#47019)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47019

NOTE: This code is largely the same as https://github.com/facebook/react-native/pull/46847, I am merely fixing some internal issues

The original diff (D63989547) was backed out because it was causing some crashes related to some internal code that had to be changed. That code did not necessarily need to be changed - we could have just left the `RCTCreateCGColorRefFromSharedColor` function and not touched the internal code - which is what I am going to do here

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D64201626

fbshipit-source-id: a8ead7a542514aee0749973e284cb7727d393c03
2024-10-15 12:59:58 -07:00
evanbacon 043e2fe14a prevent fatal crashes when launching App Clips (#47000)
Summary:
App Clips are full of bugs. One such bug is how launching an App Clip from Test Flight (and perhaps other systems) will cause the user activity to be of type `NSUserActivityTypeBrowsingWeb` but with a nullish `userActivity.webpageURL` (even though it's typed as never being nullish in this mode).

## Changelog:

[IOS] [FIXED] - Fix launching App Clips with nullish URLs.

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

Test Plan:
The following was failing cryptically and required extensive debugging to get launching.

https://github.com/user-attachments/assets/ffd26297-b20b-45a2-97cc-35a48b740cb2

Reviewed By: cipolleschi

Differential Revision: D64372170

Pulled By: lunaleaps

fbshipit-source-id: 388f05530f3bccdd9b446382931f127421bc8a27
2024-10-15 11:50:12 -07:00
Rubén Norte f9460deda7 Clean up feature flag removeNestedCallsToDispatchMountItemsOnAndroid (#47026)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47026

Changelog: [internal]

Clean up feature flag after we tested it's safe.

Reviewed By: javache

Differential Revision: D64332654

fbshipit-source-id: 33e92abb24c9350628a814ecab195f995316d2bc
2024-10-15 10:59:03 -07:00
tarunrajput 3f633473c3 Add maestro e2e test for Legacy Style Event (#46784)
Summary:
part of https://github.com/facebook/react-native/issues/46757
closes ME2E0006, ME2E0007

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

[Internal] - add e2e test for Legacy Style Event

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

Test Plan:
```
yarn e2e-test-ios
yarn e2e-test-android
```

Reviewed By: cortinico

Differential Revision: D64172277

Pulled By: cipolleschi

fbshipit-source-id: adf3a55b354f1a293c4620dc617a6a08e3aebd2b
2024-10-15 10:57:32 -07:00
Riccardo Cipolleschi 118c1f7035 Add support for new iOS text content type cellular EID and cellular IMEI (#46507)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46507

Support for new iOS text content type to autofill cellular EID or cellular IMEI:
- https://developer.apple.com/documentation/uikit/uitextcontenttypecellulareid?language=objc
- https://developer.apple.com/documentation/uikit/uitextcontenttypecellularimei?language=objc

## Changelog:

[General][Added] - Add JS layer for new text content type cellular EID and cellular IMEI

Reviewed By: cortinico

Differential Revision: D62737200

fbshipit-source-id: 4db9c29079e63107deeb00a3a1558aa151d80fc1
2024-10-15 10:55:03 -07:00
Rubén Norte 9e5b6e88c5 Unify feature flags for event loop (#46953)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46953

Changelog: [internal]

This unifies all the feature flags that control the new event loop on RN. Before, we'd have granular flags for different aspects of it. With this diff, we enable the event loop by default with bridgeless, and we introduce a new flag to explicitly disable it in that case if necessary.

When we're ready to clean up this opt-out, we just need to remove the `&& !ReactNativeFeatureFlags::disableEventLoopOnBridgeless()` conditions.

Reviewed By: javache

Differential Revision: D64175216

fbshipit-source-id: b879447def8ab47c6ab772812ff1031177494069
2024-10-15 09:44:01 -07:00
Rubén Norte 3ebf4f3b0e Force bridgeless feature flags in RCTAppDelegate when bridgeless is enabled (#46972)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46972

Changelog: [internal]

I'm unifying the feature flags for the new event loop (so it's enabled by default when bridgeless is enabled, unless a feature flag is explicitly set), and I realized that the feature flags for Bridgeless, Fabric and Turbo Modules aren't being set in iOS, causing my changes to be incorrect (as we're using bridgeless but the bridgeless flag is off).

This forces the right flags when using bridgeless so the configuration is consistent.

Reviewed By: rshest, cipolleschi

Differential Revision: D64234056

fbshipit-source-id: bfdbe6742ee84c23d6d2c0c56e6ca8fce1788b26
2024-10-15 09:44:01 -07:00
Riccardo Cipolleschi 7b6e8e7765 Codegen fails with Local Module (#47027)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47027

While I was writing the documentation for extracting a module in a library, I realized that Codegen ignored the local node modules.

The reason is that `require.resolve` fails to resolve a local path.

bypass-github-export-checks

## Changelog
[General][Fixed] - Make Codegen work with local modules

Reviewed By: cortinico

Differential Revision: D64242713

fbshipit-source-id: cc5167665a49df1d09eb66a0dc9d76466f087a25
2024-10-15 09:30:50 -07:00
Riccardo Cipolleschi 40bcf0edba Do not kill emulators when testing (#47030)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47030

Looking at the videos from the E2E tests, it seems that the tests are pretty reliable aside from the first one that often fail. And it looks like it is failing not because the test is wrong, but because maestro hits some sort of timeout and kills the test sooner.

With these changes we are:
- giving more time to maestro to run
- not killing the emulator anymore

Killing and restarting the simulator was making this problem workse, because a newly started simulator required more time to boots and to work properly

## Changelog:
[Internal] - stop killing simulators and increase timeouts

Reviewed By: cortinico

Differential Revision: D64398111

fbshipit-source-id: 17b107fee24d0fbd4897212c1907be3761e337ab
2024-10-15 08:32:37 -07:00
poonamjain96 8cf27e8b6f Add test for Console.log measure in new-arch-examples (#47020)
Summary:
Part of this: https://github.com/facebook/react-native/issues/46757
Solves:
- ME2E0005

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

[ Internal ] [ Added ] - Add console.log measure test in new-arch-example

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

Test Plan:
```
yarn e2e-test-ios
yarn e2e-test-android
```

Reviewed By: cortinico

Differential Revision: D64397112

Pulled By: cipolleschi

fbshipit-source-id: c9192d66065038528751e2e366f58158b06eb864
2024-10-15 08:29:47 -07:00