Commit Graph

38536 Commits

Author SHA1 Message Date
Nick Gerleman e43c5db84b Spannable -> Spanned (#51006)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51006

Moves a bit of code, reading spans that we may not control, to query for `Spanned`, instead of `Spannable`, since some code (see last diff around ellipsization) may wrap intermediate Spannables.

Changelog: [internal]

Reviewed By: joevilches

Differential Revision: D73820368

fbshipit-source-id: e107bcf1f2f7d5555fca68fb2209c12c3f99c099
2025-04-29 18:45:58 -07:00
Nick Gerleman 746275ff14 Incorporate maxLines and ellipsization into text layout (#51007)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51007

Right now, we fully layout text, then use max lines to determine  a metric to use when calculating size.

Android API 23+ which we fully target allows incorporating ellipsization and maxlines directly into the layout. This will let us directly draw the layout when using maxLines later. This may also let Android optimize line-breaking a bit, when we hit truncation.

Special care is taken not to set this when we are in `adjustsFontSizeToFit` path, so that line count will flow over, signifing overflow.

I think the main user-facing change is that `onTextLayout` events will have measures post-ellipsization.

Changelog:
[Android][Changed] - Incorporate maxLines and ellipsization into text layout

Reviewed By: joevilches

Differential Revision: D73811573

fbshipit-source-id: df83295d0902ae8b043ce57b06cbb9c8f0c194fc
2025-04-29 18:45:58 -07:00
Nick Gerleman 6f0a0a5c2c Correctly Pass SurfaceID to TextLayoutManager (#51005)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51005

We need to get a context corresponding to the root being passed, to be able to resolve things like theme to use. RIght now that's a TODO, that's been around since new arch. Let's pass the real data along.

Changelog:
[Android][Fixed] - Correctly Pass SurfaceID to TextLayoutManager

Reviewed By: javache

Differential Revision: D73819640

fbshipit-source-id: 1ae2505b59b8577d35a4dc5bb2a524663f3bd47f
2025-04-29 18:45:58 -07:00
Nick Gerleman 2e42eab6df Platform specific TextLayoutManager Headers (#50889)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50889

This effectively reverts D67064488

We are trying to smash together functions, variables, virtual or non-virtual, all required by different platforms, into a single header, often using #ifdefs that are not what we want (apart from a bad editor experience, `#ifdef ANDROID` may or may not be compiled into the react-native-cxx platform, and we cannot use it for the Android platform reliably).

For Facsimile, we are going to be introducing more potential divergence, with the idea of `PreparedText`, where we can generate intermediate products as part of the layout process to be reused later. I'm planning to design that in a way which can be eventually reused across platforms, but not everywhere.

I think the best path for this is going to be to allow each platform to have their own headers, instead of the current messiness, then allow shared code (e.g. in `ParagraphShadowNode`) to pick how to interact at compile time. I added an example of this as part of `TextLayoutManagerExtended`, to customize how we act if a `TextLayoutManager` chooses not to implement `measureLines`.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D73557126

fbshipit-source-id: 9851ebba691b0d123f6a355126f2d5b003aceba0
2025-04-29 18:45:58 -07:00
Martin Booth 2efe8094c0 Include offset as separate field in payloads (#50970)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50970

__onAnimatedValueUpdateReceived is called from 2 places.

It is called from the onAnimatedValueUpdate subscription where the source of the values comes from here: https://fburl.com/8v2cwd2x with getValue() returning the offset + value components combined.

It's also called from in the animation end callback here: https://fburl.com/h36xy2nw where the source of this value comes from https://fburl.com/sud7m7st. In this case it's accessing `nodeValue` directly rather than calling getValue() and so it only includes the value component.

In this diff we pass both the value and offset in both onAnimatedValueUpdate callbacks as well as endCallback.

This allows us to separate the value from the offset on the JS side and ensures we have the latest offset value from native

Changelog: [Android][Fixed] - Sync offset and value from native -> js in separate fields

Reviewed By: zeyap

Differential Revision: D73795619

fbshipit-source-id: e8ed234497e3fcaf9d2a137aa1e17ca8d0f76d97
2025-04-29 17:03:44 -07:00
Samuel Susla 1c5ec4bd35 introduce more tests for edge cases for view culling (#51000)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51000

changelog: [internal]

# Why so many tests?
Differentiator has two modes: regular and reparenting. The reparenting one is almost a completely separate Differentiator, effectively doubling the complexity. It handles quite a few different special cases and is not covered by any reasonable tests, so here I am adding the tests to make sure every branch of the reparenting Differentiator is traversed.

Reviewed By: lenaic

Differential Revision: D73845746

fbshipit-source-id: 27a9fd72a5f8111b84e231cf8f495e278037a323
2025-04-29 14:57:08 -07:00
David Vacca 0a5b21c44c Setup feature flag to fix double measurement of android components (#50971)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50971

This feature flag enables a fix of double measurement on a subset of android components

changelog: [internal] internal

Reviewed By: yungsters

Differential Revision: D73804996

fbshipit-source-id: 3271deb8a8bf4c132cbfb6819f72cab556c6253c
2025-04-29 13:50:57 -07:00
Ruslan Lesiutin 996630b5b5 Avoid copying samples list when serializing (#50985)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50985

# Changelog: [Internal]

There may be tens of thousands of samples stored, so we should avoid copying it. I don't think we should restrict it from being copied, though, but we don't need it to copy in this case.

Reviewed By: huntie, dannysu

Differential Revision: D73106950

fbshipit-source-id: 45c027ea8bfc3424fe3428f5578d5bed3d1cdda9
2025-04-29 12:03:11 -07:00
Ruslan Lesiutin b08f87aa90 TraceEventProfile as plain data structs (#50984)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50984

# Changelog: [Internal]

We are only using these struct to define how they will be serialize before sending over CDP, no need for custom constructors.

Also updated the naming of the serialization method to align with other parts of the project: `asDynamic()` -> `toDynamic()`.

Reviewed By: huntie

Differential Revision: D73774114

fbshipit-source-id: d0371cf3dee7584daa77054f73aced440550e674
2025-04-29 12:03:11 -07:00
Alex Taylor (alta) 78e45e5828 Deploy 0.269.1 to xplat (#50993)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50993

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D73853679

fbshipit-source-id: 4860c205f764a0be14080015cab1759bb59f442b
2025-04-29 10:24:21 -07:00
Rubén Norte 6dc4da466a Refactor event dispatching logic to improve readability and performance slightly (#50991)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50991

Changelog: [internal]

TSIA.

Reviewed By: javache

Differential Revision: D73853068

fbshipit-source-id: 93e33072e4ce14225cc76ca8daf5d8816489ac7b
2025-04-29 10:13:09 -07:00
Rubén Norte 030ca3c543 Fix bug when dispatching unique and non-unique events of the same type on the same target (#50988)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50988

Changelog: [internal]

This fixes a potential bug where we coalesce unique events with non-unique ones of the same type and target.

Not marked as a bug fix in the changelog because this wouldn't happen in practice, as we always dispatch events of a given type the same way (all unique or all non-unique).

Reviewed By: sammy-SC, javache

Differential Revision: D73849222

fbshipit-source-id: 6f387d63b3a68dccc81c110287d42e15e31c181e
2025-04-29 10:13:09 -07:00
Rubén Norte ab543d1ab1 Add isUnique option in RawEvent and refactor EventQueue to use it (#50987)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50987

Changelog: [internal]

This adds a new `isUnique` option in `RawEvent` to determine if it's unique (whether it should be coalesced with other unique events of the same type and target).

This effectively makes `dispatchUniqueEvent` redundant, as we can use `dispatchEvent` with a `RawEvent` marked as unique.

This will allow us to fix the bug we found in the new tests for event dispatching, where non-unique events of a given type where being coalesced with non-unique events of the same type.

Reviewed By: javache

Differential Revision: D73849220

fbshipit-source-id: ce89623aee509071ab6a86654ee25d9614863a8a
2025-04-29 10:13:09 -07:00
Rubén Norte 41de764c83 Add Fantom test for Fabric event dispatching (#50989)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50989

Changelog: [internal]

Just adding a test suite to verify the behavior of event dispatching in Fabric (especially around event priorities, automatic determination based on ContinuousStart/ContinuousEnd and unique events).

This also surfaced a bug where we incorrectly batch unique and non-unique events together (see the disabled test).

Reviewed By: javache

Differential Revision: D73849218

fbshipit-source-id: 404172822d6985283a161c8a56575e0b5658a5cc
2025-04-29 10:13:09 -07:00
Rubén Norte 524afb4c2a Expose event priorities in Fantom and JS (#50986)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50986

Changelog: [internal]

This just exposes some enum values and methods that we forgot to expose in a few interfaces.

Reviewed By: javache

Differential Revision: D73849221

fbshipit-source-id: 19014d53216e67c77b0c31e5ade8f86de071b001
2025-04-29 10:13:09 -07:00
riteshshukla04 761b15888d Migrate ViewGroupManager to kotlin (#50895)
Summary:
This PR aims to migrate ViewGroupManager to kotlin as part of https://github.com/facebook/react-native/issues/50513
## Changelog:
[ANDROID][CHANGED]Migrate ViewGroupManager to kotlin

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

Test Plan: Tested with RN tester with old and new arch

Reviewed By: javache

Differential Revision: D73770843

Pulled By: cortinico

fbshipit-source-id: 45959a8bf512b3590ca8bc64dac281e13fa41ca3
2025-04-29 09:47:33 -07:00
Riccardo Cipolleschi 9a448736c1 Fix E2E tests for template (#50990)
Summary:
With the redesign of the new app screen, the E2E tests against the template started failing because we don't have a `Step One` string anymore.

This change should fix them.

## Changelog:
[Internal] - Fix Template E2E tests

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

Test Plan: tested by running the E2E tests on this PR

Reviewed By: huntie

Differential Revision: D73855988

Pulled By: cipolleschi

fbshipit-source-id: d0d72e5a07cd88923e310767eae27f5df376d637
2025-04-29 09:14:11 -07:00
Riccardo Cipolleschi 91829bef5a Integrate sending notification to discord (#50979)
Summary:
As part of the work to integrate libraries with our nightlies, we want to receive a message when the libraries are failing to build on discord. This will help us catch breaking changes early on and onboarding library maintainer as soon as possible.

## Changelog:
[Internal] - Integrate with Discord when nightly fails

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

Test Plan: GHA

Reviewed By: cortinico

Differential Revision: D73845810

Pulled By: cipolleschi

fbshipit-source-id: c6cfdf16b29642b1c3ad3872096c0e815fa88a0a
2025-04-29 08:57:30 -07:00
Lenny Karunungan 868ec3db86 fix crash when host pause called and mCurrentActivity is null (#50992)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50992

shouldnt happen but when it does it shouldnt crash some more

fix for P1798860939

Changelog: [Internal] - fix crash when onHostPause is called and mCurrentActivity is null

Reviewed By: cortinico

Differential Revision: D73852655

fbshipit-source-id: 19ee4ada1c71a34a6115882e9a558b4ea9f9d8c7
2025-04-29 08:53:09 -07:00
Alex Hunt 0968707ef7 Create src/fb_internal/ directory, initially migrate VirtualView (#50965)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50965

While D72228547 has recently disallowed all `./src/*` subpath imports from React Native (functionally, `./src/private/*`), we have a number of APIs that are imported from Meta product code legitimately — e.g. as part of validating under-development React Native features internally in real Meta apps.

This diff defines a new, exported `./src/fb_internal/*` subpath via `package.json#exports`, which will allow us to expose select entry points for this purpose.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D73770609

fbshipit-source-id: 397019669e565b95a86302ef30f80b65a17dcc0d
2025-04-29 07:52:24 -07:00
Jakub Piasecki d2556c3cbd Update exports field to include the types entry (#50974)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50974

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D73835331

fbshipit-source-id: dc5002287408177db527140db967928a7714cf56
2025-04-29 07:37:39 -07:00
Alex Hunt 46ddb604d9 Update Metro dependencies to 0.82.2 (#50977)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50977

Updates all `metro*` dependencies to the latest `^0.82.2`.

Changelog: [Internal]

Reviewed By: vzaidman

Differential Revision: D73841705

fbshipit-source-id: dc550abfecddce933ed148f094aaf8629ffe549b
2025-04-29 06:25:22 -07:00
Dawid Małecki 7959a63a1a Migrate rn-tester codegen types imports to use root exported CodegenTypes namespace (#50976)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50976

This is the second part of the migration of `rn-tester` package to use root imports. In this diff the `CodegenTypes` namespace is used to define Codegen primitives.

Changelog:
[Internal]

Reviewed By: huntie

Differential Revision: D73780584

fbshipit-source-id: c13c2dfcfa4d023978a9463af1d2a3bf7b72476c
2025-04-29 06:06:16 -07:00
Dawid Małecki 9666a68977 Attach docs in AnimatedExports (#50975)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50975

Re-defining types in `AnimatedExports.js.flow` shadows their documentation located in `AnimatedImplementation`. Moving them to the `AnimatedExports` fixes the issue for generated TS types.

Changelog:
[Internal]

Reviewed By: huntie

Differential Revision: D73840908

fbshipit-source-id: 2648498a53660b483c70be647716accc11e96d82
2025-04-29 05:05:37 -07:00
Nicola Corti f882206bc9 Fix typo in ScrollView.d.ts (#50978)
Summary:
Fixes https://github.com/facebook/react-native/issues/50969

## Changelog:

[INTERNAL] -

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

Test Plan: N/A

Reviewed By: fabriziocucci

Differential Revision: D73842116

Pulled By: cortinico

fbshipit-source-id: 90bcbdec46a5de02c34c909e6e411f7cd0ae34eb
2025-04-29 04:01:37 -07:00
Joe Vilches e486fda106 Check feature flags for a11yOrder iff prop exists (#50967)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50967

In some cases we may want to check this only if the prop exists

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D73793783

fbshipit-source-id: b498f82414edf63d8644b90bb3932298eb37b43c
2025-04-28 14:39:31 -07:00
Martin Booth 3e3094c3dd Sync offset value to native immediately (#50941)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50941

Without doing this, using Animated.event to update a value with an offset causes the value to revert to not having an offset because the native side doesn't even know about the offset if it hasn't been synced.

Don't think there's a better place to sync this for the cases where an animation is kicked off entirely from the native side

Changelog: [Android][Fixed] - Ensure latest offset value is synced to native

Reviewed By: javache

Differential Revision: D73622302

fbshipit-source-id: 7e67a7f41d900cc225af410af94ccdfd33c170c8
2025-04-28 14:06:44 -07:00
Jorge Cabiedes Acosta 4ce093154d Add screenReaderFocusable prop (#50850)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50850

This prop will be used to enable screen reader focusability without allowing keyboard focus. Mostly a quality of life prop for product engineers and maps 1:1 to Android

Changelog: [Android][Added] - Expose Android's screenReaderFocusable prop

Reviewed By: javache

Differential Revision: D73382051

fbshipit-source-id: 8171b9d24a735dd42d54abe4537fb487bdd011b7
2025-04-28 12:11:04 -07:00
Alex Hunt 99c3aa3861 Add "./scripts/*" exports subpath (#50966)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50966

Should fix non-`.js` script resolution using `require.resolve` (currently breaking CI).

Changelog: [Internal]

Reviewed By: mdvacca, cipolleschi, rshest

Differential Revision: D73786668

fbshipit-source-id: 9f793cd9df217158aa4ade0a0b41c183caefae49
2025-04-28 11:41:50 -07:00
Jorge Cabiedes Acosta fd8a3456ca Add accessibilityRespondsToUserInteraction prop (#50837)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50837

This prop can be used to disable user interaction with switch control, voice control or full keyboard access.

VoiceOver is not affected by it.

https://developer.apple.com/documentation/swiftui/view/accessibilityrespondstouserinteraction(_:)

Changelog: [iOS][Added] - Expose iOS's accessibilityRespondsToUserInteraction as a prop

Reviewed By: joevilches

Differential Revision: D73382060

fbshipit-source-id: c9f3137adc0ea34a58435f7f0438748fbfcc5a18
2025-04-28 11:15:35 -07:00
Riccardo Cipolleschi 1cfb46b63b Override updateRuntimeShadowNodeReferencesOnCommit for OSS (#50962)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50962

OSS is affected by https://github.com/facebook/react-native/issues/49694 and it is endangering the migration of multiple apps to the New Architecture.

We fixed the issue but it is hidden behind feature flag while we are experimenting with it internally, to make sure it does not causes regressions.

However, the fix has been verified for the reproducer code and the OSS will be beneficial for the community.

We are overriding the featureFlag, enabling it for OSS.

## Changelog:
[Internal] - Enable `updateRuntimeShadowNodeReferencesOnCommit` for OSS

Reviewed By: lenaic, cortinico

Differential Revision: D73771648

fbshipit-source-id: 4394a2370d9edd9699c8e03293868defd465853c
2025-04-28 10:55:07 -07:00
Jakub Grzywacz 4d7c4bd6e8 Fix ImageSource require (#50963)
Summary:
In react-native-svg, I found that the `Image` component stopped working starting with `react-native@0.79`. After some debugging, I traced the issue to the migration of `Libraries/Image` to the new export syntax (see https://github.com/facebook/react-native/commit/8783196ee540f8f78ce60ad20800338cc7645194). To fix this, I updated the import to match other requires, similar to https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js#L84.

## Changelog:

[GENERAL] [FIXED] - Fix codegen ImageSource require

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

Test Plan:
`validAttributes` process should be a function instead of object with a default property.

Before:
<img width="1041" alt="image" src="https://github.com/user-attachments/assets/9fbc9e9f-6c45-4b0b-adb8-2eb911676fe1" />

After:
<img width="1005" alt="image" src="https://github.com/user-attachments/assets/ee594103-90da-4917-8252-72f4ecfc28e1" />

Reviewed By: Abbondanzo

Differential Revision: D73778127

Pulled By: huntie

fbshipit-source-id: ae80c770e8e578794ae1356751f170ff955e1f5a
2025-04-28 10:30:21 -07:00
Alex Hunt 6ea24f7bb9 Define "react-native-strict-api" type exports (#50909)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50909

Enables and maps the `types_generated/` directory for `react-native` and `react-native/virtualized-lists` — exposing the new Strict TypeScript API entry points to React Native.

**New `"exports"` conditions**

- `"react-native-strict-api"` — The Strict TypeScript API opt in, exposing the `index.d.ts` entry point only.
- `"react-native-strict-api-UNSAFE-ALLOW-SUBPATHS"` — Opts into the new from-source generated types, but allows accessing subpaths (unsafe).
    - We intend for this unsafe condition to be an escape hatch for Frameworks only (i.e. Expo).

Note: In the case of `virtualized-lists`, we simply use the `"types"` condition — since this package did not expose any TypeScript API previously.

NOTE: Should we need to roll back JS Stable API phase 1, **this is the single diff to revert**.

Changelog:
[General][Added] - Configure the "react-native-strict-api" opt in for our next-gen TypeScript API

Reviewed By: cipolleschi

Differential Revision: D71969602

fbshipit-source-id: 291182cc826db8b33f21fc79698e6096876d17ef
2025-04-28 10:00:39 -07:00
Alex Hunt 1d8fec19f0 Fix all active ESLint warnings (#50964)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50964

Address/supress ESLint warnings across the codebase, currently flagged on every PR via GitHub's "Unchanged files with check annotations" check.

{F1977480883}

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D73778510

fbshipit-source-id: 91bed86877eae74fa3b9ebea71e26cdcaeee1761
2025-04-28 09:31:46 -07:00
Vin-Xi 93efaeb241 refactor: rewrite Inspector from Java to Kotlin (#50947)
Summary:
Rewrite of the Inspector class from Java to Kotlin in scope of https://github.com/facebook/react-native/issues/50513

## Changelog:
[ANDROID] [CHANGED] - Migrated Inspector to Kotlin

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

Test Plan: Tested using RNTester app, on both old and new arch, and tested by navigating to multiple pages

Reviewed By: cortinico

Differential Revision: D73767386

Pulled By: javache

fbshipit-source-id: e0098568aa0ed9863503e206a88d3b171c8f9966
2025-04-28 09:20:56 -07:00
Nicola Corti 0e963aaa54 Gradle to 8.14 (#50960)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50960

This brings Gradle to the latest minor ahead of branch cut.

Changelog:
[Android] [Changed] - Gradle to 8.14

Reviewed By: cipolleschi

Differential Revision: D73769416

fbshipit-source-id: 52fd6b36068a719fbfdee6b5df0e80573567487a
2025-04-28 08:01:08 -07:00
Dawid Małecki ddcab831b1 Migrate already root exported deep imports in rn-tester. (#50958)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50958

In rn-tester package there are many react-native deep imports which will be deprecated in the future. It is a starter for migrating rn-tester to using root imports instead. Only deep imports that are already root exported are changed. This diff avoids using `CodegenTypes` as it causes build errors and will be resolved in next stages.

Besides import changes, `PointerEvent` type is now also exported from the root.

Changelog:
[Internal]

Reviewed By: huntie

Differential Revision: D73656526

fbshipit-source-id: 5814a3d9c6a04b1236581dbbe291cd109e2c71c0
2025-04-28 07:24:46 -07:00
Rubén Norte e162fba413 Update interruptible rendering test to use feature flag to fix React<>Fabric priorities (#50959)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50959

Changelog: [internal]

This updates the test for interruptible rendering to use the feature flag that fixes priority mapping between Fabric and React.

In this case, it shows how the change fixed how React Native implements the React programming model, as before this change continuous events weren't interrupting transitions (and they should): https://github.com/facebook/react/blob/c498bfce8b9baa3dd21bd0d5124eb3a4549886f1/packages/react-reconciler/src/__tests__/ReactUpdatePriority-test.js#L109

Reviewed By: sammy-SC

Differential Revision: D73662527

fbshipit-source-id: 6276fe6f02b6c4e1af8dbb7d46c9a14ee6846636
2025-04-28 06:55:25 -07:00
Rubén Norte 9ae7f7fcc1 Refactor InterruptibleRendering Fantom test to use dispatchNativeEvent (#50957)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50957

Changelog: [internal]

Now we can use the higher level API for event dispatching in this test.

Reviewed By: javache

Differential Revision: D73663626

fbshipit-source-id: 961af26f62128f093c71ad14f457ac8544348415
2025-04-28 06:55:25 -07:00
Dawid Małecki a120c5c4db Ignore warnings for imports from react-native/Libraries/Core/InitializeCore (#50903)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50903

For now we do not change the way this module is exported to prevent breaking changes (due to high usage in external packages).  It is a tentative mitigation - this case requires more discussion and what could be sufficient. The `no-deep-imports` rule and plugin shouldn't emit a warning when encountered.

Changelog:
[Internal]

Reviewed By: huntie

Differential Revision: D73590627

fbshipit-source-id: 6f85c52373ee6c7c538c632b55cd9e0b9357f2a3
2025-04-28 05:32:11 -07:00
Sanjay Thakur 7a919d6966 Fix EXC_BAD_ACCESS within RCTInspectorNetworkReporter (#50952)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50952

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D73720844

fbshipit-source-id: 5acde68e811782a1a402ad633b56c7bdd9b7ea22
2025-04-28 04:55:05 -07:00
Nicola Corti 9345c88a61 Implement LegacyArchitecture warning for ShadowNode measure() (#50932)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50932

Add a warning for LegacyArch users that are providing a ViewManager with a corresponding shadow node that implements the `YogaMeasureFunction`.

For those users, we know that the ViewManager is most likely not working on the NewArch (unless they have a backward compat ViewManager with a C++ shadow node implementation).

Changelog:
[Android] [Added] - Warn Legacy Arch users if they use a Component with a ShadowNode with `YogaMeasureFunction.measure()` function. That Component will stop working on NewArch.

Reviewed By: javache

Differential Revision: D73654273

fbshipit-source-id: 70d232434f94bc2a6970379d566b276f73850fce
2025-04-28 04:28:06 -07:00
Alex Hunt 3cf0102007 Redesign New App Screen and move to package (#50939)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50939

Redesigns React Native's `NewAppScreen` component, and moves it into a new `react-native/new-app-screen` package with a single component export. Deletes the old New App Screen under `'react-native/Libraries/NewAppScreen/'`.

{F1977434404}

**Motivation**

- **Reduces our public API** (see https://github.com/react-native-community/discussions-and-proposals/pull/894)
    - Separates this screen from the main `react-native` package, where it was a number of subpath exports.
    - Reduces the size of the main `react-native` package, including image assets — which are redundant for consumers like Expo.
- **Updated visual treatment**
    - Replace outdated logo, update to a responsive tablet/windowed layout.
    - Removes outdated guidance (e.g. "use cmd+R to reload"), and generally simplifies the layout (with the aim of reducing future maintenance).
- **Simplifies template boilerplate**
    - `NewAppScreen` is now a fully encapsulated screen layout, avoiding the cruft of the previous modular design.

**Integration plan**

When we cut the `0.80-stable` branch, we'll update [the template](https://github.com/react-native-community/template/blob/main/template/App.tsx) to import and use `<NewAppScreen />`.

- This will cause an extra runtime dependency in the template `package.json`, which will require user cleanup. We are happy with this tradeoff, given the self-evident package name, reduction of template boilerplate, and size reduction on the main `react-native` package.

Changelog:
[General][Breaking] - The `NewAppScreen` component is redesigned and moved to the `react-native/new-app-screen` package

Reviewed By: cipolleschi

Differential Revision: D73657878

fbshipit-source-id: 9ca07afa9fbdd6f32015eafa2f27d52ed182918e
2025-04-28 04:17:21 -07:00
Oskar Kwaśniewski 1b4a6ec1ca fix(CI): run monitor-new-issues only in the main repo (#50951)
Summary:
This PR makes sure that monitor-new-issues runs only in the main repo. It was failing on my fork and spamming notifications.

## Changelog:

[INTERNAL] [FIXED] - run monitor-new-issues only in the main repo

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

Test Plan: CI Green

Reviewed By: cipolleschi

Differential Revision: D73763006

Pulled By: cortinico

fbshipit-source-id: cbb22f8804448b41de970d3d11930110b353994f
2025-04-28 03:22:04 -07:00
Ruslan Shestopalyuk 403feb9bc2 Migrate ReactActivity (#50871)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50871

# Changelog:
[Android][Changed] - ReactActivity has been migrated to Kotlin.

Reviewed By: cortinico

Differential Revision: D73507044

fbshipit-source-id: 936263100ca93dafd643a53e5cb799fd5ed7e584
2025-04-28 01:53:11 -07:00
Mateo Guzmán 29cc2357e2 Remove unused com.facebook.react.bridge.MemoryPressure class (#50924)
Summary:
This class can be internalized as part of the initiative to reduce the public API surface. I've checked there are [no relevant OSS usages](https://github.com/search?type=code&q=NOT+is%3Afork+NOT+org%3Afacebook+NOT+repo%3Areact-native-tvos%2Freact-native-tvos+NOT+repo%3Anuagoz%2Freact-native+NOT+repo%3A2lambda123%2Freact-native+NOT+repo%3Abeanchips%2Ffacebookreactnative+NOT+repo%3AfabOnReact%2Freact-native-notes+NOT+user%3Ahuntie+NOT+user%3Acortinico+NOT+repo%3AMaxdev18%2Fpowersync_app+NOT+repo%3Acarter-0%2Finstagram-decompiled+NOT+repo%3Am0mosenpai%2Finstadamn+NOT+repo%3AA-Star100%2FA-Star100-AUG2-2024+NOT+repo%3Alclnrd%2Fdetox-scrollview-reproductible+NOT+repo%3ADionisisChytiris%2FWorldWiseTrivia_Main+NOT+repo%3Apast3l%2Fhi2+NOT+repo%3AoneDotpy%2FCaribouQuest+NOT+repo%3Abejayoharen%2Fdailytodo+NOT+repo%3Amolangning%2Freversing-discord+NOT+repo%3AScottPrzy%2Freact-native+NOT+repo%3Agabrieldonadel%2Freact-native-visionos+NOT+repo%3AGabriel2308%2FTestes-Soft+NOT+repo%3Adawnzs03%2FflakyBuild+NOT+repo%3Acga2351%2Fcode+NOT+repo%3Astreeg%2Ftcc+NOT+repo%3Asoftware-mansion-labs%2Freact-native-swiftui+NOT+repo%3Apkcsecurity%2Fdecompiled-lightbulb+com.facebook.react.bridge.MemoryPressure).

Edit: we can remove it as has no usages

## Changelog:

[INTERNAL] - Remove unused com.facebook.react.bridge.MemoryPressure class

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

Test Plan:
```bash
yarn test-android
yarn android
```

Reviewed By: javache

Differential Revision: D73643870

Pulled By: rshest

fbshipit-source-id: 80c9abe82352a13cdd9f4110349e03656d423a05
2025-04-28 01:23:25 -07:00
Martin Booth 9efcdc091c Calling setOffset actually calls setAnimatedNodeOffset currently (#50913)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50913

Changelog: [Android][Fixed] - Fix BatchExecutionOpCodes.OP_CODE_SET_ANIMATED_NODE_OFFSET mapping to call setAnimatedNodeOffset (rather than setAnimatedNodeValue)

Reviewed By: zeyap, Abbondanzo

Differential Revision: D73608624

fbshipit-source-id: 38e5b94d9fa8b0a0d776e7886020b4cb1e347821
2025-04-27 17:52:17 -07:00
Jorge Cabiedes Acosta eb2f6b1ae5 Fix RemoveClipped subviews algorithm
Summary:
For real this time, the change was lost due to some merge conflict

Changelog: [Internal]

Reviewed By: Abbondanzo

Differential Revision: D73726167

fbshipit-source-id: 1e0cef75f59a166d795922266365b2b7b060472e
2025-04-26 17:35:22 -07:00
Alex Hunt 319ba0afd2 Define "exports" field on main package (#50872)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50872

NOTE: Resubmission of D71968187.

Define `"exports"` field on the main `react-native` package.

**Notes**

Module resolution should be equivalent to the previous implicit `"main"` field (backwards compatible).

- Exports all module subpaths to JavaScript (Flow) source files, with and without `.js` suffix (unchanged )
    - These are restricted to the `flow/` and `Libraries/` subdirectories (ℹ️ this should be unchanged, matching any JS imports apps may have today)
        - Still includes 3P integration scripts such as `./jest-preset.js` and `./rn-get-polyfills.js` (unchanged )
- Exports `./package.json` (unchanged )
- TypeScript should:
    - fall back to the `"types"` field (unchanged )
    - OR to `"."`,`"./*"` when Package Exports support is enabled via `compilerOptions`, and use the *adjacent `.d.ts` file* (unchanged )

Changelog:
[General][Breaking] - The `react-native` package now defines package.json `"exports"`.
- While these expose existing JavaScript and TypeScript modules, this change may affect deep imports of non-JS files via Node in third party tools.
- Jest mocks to a `react-native` subpath will need to be updated to match the import path used in your code.
- Imports from `src/` and `src/private/` directories are disallowed.

Reviewed By: robhogan

Differential Revision: D72228547

fbshipit-source-id: d50d6e556d32a9cf2f90855a562e61549853acb9
2025-04-25 15:40:14 -07:00
Jorge Cabiedes Acosta 9526406fc2 Fix crash with nested FlatLists and fix edge case with nested views (#50855)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50855

This diff addresses a crash caused by view duplication in React Native Android. The issue occurred when a view was not already clipped and was laid out again, resulting in duplicated views.

This problem was particularly noticeable when using nested FlatLists, which triggered a custom focus search with an incomplete and buggy duplicated FlatList container view.

The fix involves preventing the duplication of views by checking if a view is clipped already before laying it out again. Additionally, this diff includes two other improvements:
- Preventing clipping issues: When a view is nested within a non-ReactClippingViewGroup ancestor, focus searching would fail due to the needUpdateClippingRecursive logic only running on instances of ReactClippingViewGroup. By excluding these ancestors, we ensure that the next focusable view can be properly excluded from being clipped.
- Minor fix: A minor fix was made to prevent potential issues in deeply nested cases.
- Add a Kill switch with a feature flag and mobile config combo.

Reviewed By: joevilches

Differential Revision: D73471780

fbshipit-source-id: efbb968600f21b24ab1fa32222d555f346fb336e
2025-04-25 13:01:31 -07:00