Commit Graph

38536 Commits

Author SHA1 Message Date
Fabrizio Cucci 1908b3dfac Kotlinify JavaScriptModuleRegistry (#51164)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51164

As per title.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D74326679

fbshipit-source-id: ecd15fda9ea8686b65171c462e7e82dc9609377b
2025-05-07 10:34:14 -07:00
Mateo Guzmán 84253c4e20 Add missing ReplaceWith on deprecations (#51144)
Summary:
Static code analysis detected several missing `ReplaceWith` on deprecated methods. This diff addresses some of them by adding the most accurate suggestions based on the implementations.

## Changelog:

[INTERNAL] - Add missing ReplaceWith on deprecations

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

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

Reviewed By: fabriziocucci

Differential Revision: D74327121

Pulled By: javache

fbshipit-source-id: 5b338531210bef104208d14cbd0e3320dc566b8e
2025-05-07 10:09:35 -07:00
Nicola Corti cf94070416 Unbreak build_android due to broken StateReconciliationTest.cpp (#51161)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51161

This unbreaks the CI after D74245228

Changelog:
[Internal] [Changed] -

Reviewed By: javache

Differential Revision: D74324800

fbshipit-source-id: b89147f4f57b5d94fd8ae1549ef18ef2deb97c5b
2025-05-07 08:49:39 -07:00
Riccardo Cipolleschi 130fb7fd30 Fix set-rn-version to account for codegen snapshot test files (#51157)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51157

test-js jobs are failing because the codegen snapshot tests generates a Podspecs withan hardcoded version that does not matches the version we are about to release.

This fix updates the script that set the RN version to make sure it also updates the Codegen snapshots.

This is a porting to `main` of [this PR](https://github.com/facebook/react-native/pull/51156).

## Changelog:
[Internal] - Fix set-rn-version to account for codegen snapshot test files

Reviewed By: fabriziocucci, cortinico

Differential Revision: D74321590

fbshipit-source-id: 6837e60a0a2834030680f7ec0c7584bf2622f33e
2025-05-07 07:18:45 -07:00
Riccardo Cipolleschi 56b2690ecd Fix creation of Draft release (#51159)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51159

This change fixes a syntax error in the GH Action that generates the draft PR.

## Changelog:
[Internal] - Fix draft release generation

Reviewed By: fabriziocucci, cortinico

Differential Revision: D74322577

fbshipit-source-id: 0fcb03403ea35f7c64217bce5f1cbf93e7d5bd9a
2025-05-07 07:07:59 -07:00
Riccardo Cipolleschi 807dfb4a1b Fix build codegen (#51130)
Summary:
When testing the release by running the `test-e2e-local` for RNTester on iOS, the script sometimes fails because it expect to have codegen properly built before running the app.
This fix makes sure we build the codegen package.

## Changelog:
[Internal] - Fix building the codegen

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

Test Plan: Tested locally

Reviewed By: fabriziocucci

Differential Revision: D74248031

Pulled By: cipolleschi

fbshipit-source-id: 319f3332c616f7118b673fb7acb63c2e15946b2c
2025-05-07 06:12:06 -07:00
Mateo Guzmán a3c9db6122 Make ReactQueueConfigurationImpl internal (#51143)
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.queue.ReactQueueConfigurationImpl).

## Changelog:

[INTERNAL] - Make com.facebook.react.bridge.queue.ReactQueueConfigurationImpl internal

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

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

Reviewed By: rshest, cortinico

Differential Revision: D74309556

Pulled By: javache

fbshipit-source-id: 1c5eaa0e975bd2db5d451c5e21f14cfa3856e4c3
2025-05-07 05:21:37 -07:00
Mateo Guzmán f81a721b57 Make DebugServerException internal (#51140)
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.common.DebugServerException).

## Changelog:

[INTERNAL] - Make com.facebook.react.common.DebugServerException internal

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

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

Reviewed By: javache

Differential Revision: D74309486

Pulled By: rshest

fbshipit-source-id: 092ffb350d9093deb6b12ad639dd7453027c4c06
2025-05-07 04:54:39 -07:00
Samuel Susla 12fb101e30 deprecate type aliases ShadowNode::Unshared and ShadowNode::Weak (#51151)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51151

changelog: [General][Deprecated] - deprecate type aliases ShadowNode::Unshared and ShadowNode::Weak in favour of std::shared_ptr<ShadowNode> and std::weak_ptr<ShadowNode>

migrate away from using these type aliases to avoid confusion.

It is unclear from ShadowNode::Unshared what it means. This can be avoided by using std::shared_ptr<ShadowNode> directly. The same applies to ShadowNode::Weak.

Reviewed By: rubennorte

Differential Revision: D74245228

fbshipit-source-id: f22a18e87f170e46f5079e0ee7678700a3f5f623
2025-05-07 04:51:38 -07:00
Alex Hunt f4dd3addb6 Remove force disable Fusebox flag (#51127)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51127

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D74246823

fbshipit-source-id: af3978c120853d4ef1150fffb38c71c74728f907
2025-05-07 04:26:06 -07:00
Rubén Norte 79c3b4c409 MutationObserver: switch from ShadowNode to ShadowNodeFamily to prevent leaks (#51149)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51149

Changelog: [internal]

This replaces the use of `ShadowNode` with `ShadowNodeFamily` in the `MutationObserver` logic to prevent retaining stale subtrees of the nodes being observed.

It refactors some existing logic so we don't need to keep track of the shadow nodes in JS. It was only used to be able to find the node for a target after unmounted, so we could "unobserve" it, but `MutationObserver` doesn't support unobserving individual targets anyway, so we removed that use case and implemented a more general `unobserveAll` method that doesn't require the shadow nodes in the first place.

Reviewed By: javache

Differential Revision: D74240834

fbshipit-source-id: 6d4c43a561780962874c76615fb53369c0c68cf7
2025-05-07 04:17:26 -07:00
Rubén Norte da56d57ac7 Refactor MutationObserver.disconnect (#51128)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51128

Changelog: [internal]

Just a minor refactor of a method in `MutationObserver` which was doing some redundant work that could be avoided.

Reviewed By: javache

Differential Revision: D74247437

fbshipit-source-id: 510d26f2a315582df9cddc215bf516d3d4ebd341
2025-05-07 04:17:26 -07:00
Rubén Norte 759652b09f Refactor existing native module into a general purpose native module for Fantom test specific methods (#51133)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51133

Changelog: [internal]

Having a single native module with all the test-specific functionality that we need in native in Fantom is just more convenient.

Reviewed By: rshest, huntie

Differential Revision: D73997209

fbshipit-source-id: 5d3aa69a2c799166a1351fbff3e80e4396cec9c6
2025-05-07 04:16:41 -07:00
Alex Hunt 12627f10b3 Report PerformanceResourceTiming events (#51126)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51126

NOTE: Resubmission of D73922341, fixing a dependency cycle (T223145455).

(Sparsely) wires up reporting of Network events to the Web Performance subsystem.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D74245441

fbshipit-source-id: ce8f47dfb3f5cd415f51287d7fcc6a048336018e
2025-05-07 03:49:56 -07:00
Mateo Guzmán f9225635bf Fix unresolved KDoc references (#51142)
Summary:
Static code analysis shows that there are a lot of unresolved KDoc references. This is just another round addressing several of them.

## Changelog:

[INTERNAL] - Fix unresolved KDoc references

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

Test Plan: Verify that the comments link the classes correctly using Android Studio.

Reviewed By: rshest

Differential Revision: D74305933

Pulled By: javache

fbshipit-source-id: f512a33fa5da46fb828bb76bd95d9502261ea08a
2025-05-07 03:31:30 -07:00
Jakub Piasecki e48b496665 Update fabric-component type test to use namespaced types (#51120)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51120

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D74242678

fbshipit-source-id: b39b56bb3a34633bec55f07c8bf081fb70b62249
2025-05-07 03:06:04 -07:00
David Vacca a254b5e69e Introduce ReactSoftExceptionLogger.CategoryMode to warn categories used on soft errors (#51141)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51141

This diff introduces ReactSoftExceptionLogger.CategoryMode to limit categories used on soft errors, the limiation will only create a lint warning but won't create a compilation error.

changelog: [internal] internal

Reviewed By: javache

Differential Revision: D74263367

fbshipit-source-id: 56fb2ef0ad3d24810172af300e43ecc1f479464f
2025-05-06 15:46:23 -07:00
Tim Yung d945c5863a IntersectionObserver: Switch from ShadowNode to ShadowNodeFamily (#51089)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51089

Currently, `IntersectionObserver#observe` retains a reference to the `ShadowNode` of the view that is supplied as an argument, which is used to compute intersection whenever a shadow tree is committed.

However, the `shadowNode` includes all of child nodes and state at the time that `IntersectionObserver#observe` is called. This means that an active `IntersectionObserverEntry` will retain references to memory that would otherwise be deallocated (e.g. if children of the observed view are unmounted after `IntersectionObserver#observe` is called).

This diff refactors `IntersectionObserver` to instead retain a reference to the `ShadowNodeFamily`, which does not retain references to child nodes and still eanbles `IntersectionObserver` to compute intersections.

Changelog:
[General][Changed] - Fixed `IntersectionObserver#observe` to avoid retaining memory for unmounted child nodes of observed views.

Reviewed By: RSNara

Differential Revision: D74130479

fbshipit-source-id: 6b581f73f06b93e6463d5004c181c39aae13896a
2025-05-06 15:24:42 -07:00
Abhijeet Jha d94f4d8c9d Added decalaration for pressRetentionOffset prop to be recognised by typescript (#51068)
Summary:
Added decalaration for  pressRetentionOffset prop to be recognised by typescript

## Changelog:
Added decalaration for  pressRetentionOffset prop to be recognised by typescript in Text.d.ts

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

Pick one each for the category and type tags:
[General] [Added] - Add  pressRetentionOffset prop to be recognised by typescript in Text.d.ts

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

Test Plan:
Before fix

https://github.com/user-attachments/assets/476364c4-6602-4916-84f2-1ede56bce285

After fix

https://github.com/user-attachments/assets/e5f720d9-cd7d-4cf0-8499-ebe9f83eb17b

Tested here: Related PR: (https://github.com/microsoft/react-native-windows/pull/14596)

Reviewed By: yungsters

Differential Revision: D74208617

Pulled By: philIip

fbshipit-source-id: 625996bec64058e4e4cdbe108ed53a62426d1222
2025-05-06 10:20:41 -07:00
Rob Hogan db0fa9200e Update Metro to ^0.82.3 (#51122)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51122

Update Metro to 0.82.2 => 0.82.3, containing important bug fixes for `package.json#exports` support.

Changelog: [General][Changed] Metro to ^0.82.3

Reviewed By: huntie

Differential Revision: D74181990

fbshipit-source-id: 8320a0cf4aa671d9e7f2976c36d260934807a179
2025-05-06 09:29:30 -07:00
Samuel Susla 4b06965b30 add fantom test for View.accessibilityRole (#51131)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51131

changelog: [internal]

add test for View.accessibilityRole.

Reviewed By: rubennorte

Differential Revision: D74247897

fbshipit-source-id: 9246e690fe15fc659b134cf2484a5ac64ff321d7
2025-05-06 09:17:49 -07:00
Samuel Susla 93b8868c77 small changes to ctor of State and ConcreteState (#51118)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51118

changelog: [internal]

1. `ConcreteState` and `State` were taking shared_ptr to family even though they only use weak_ptr.
2. `ConcreteState` was taking a const& to `data`. It unconditionally takes ownership of data, make it obvious in the interface.

Reviewed By: lenaic

Differential Revision: D74024980

fbshipit-source-id: 22401d4153588861f3edd04af0bdc7213a8056ac
2025-05-06 07:42:47 -07:00
Alex Hunt 9bccd6c4ea Explicitly exclude types_generated/ from "exports" (#51121)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51121

Previously could match via the `"./*"` subpath when `"react-native-strict-api"` is not set. Only the entry point `./types_generated/index.d.ts` should be exposed.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D74242716

fbshipit-source-id: 232c90f34fafe8fdf1a5a7ef1fec4acc191525b4
2025-05-06 07:26:04 -07:00
Alex Hunt c34987f0b5 Remove redundant config value for @types/react-native (#51119)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51119

See https://www.typescriptlang.org/tsconfig/#types.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D74242632

fbshipit-source-id: d4b5cbb42340e40a7e6770e3a6c41964366fe71e
2025-05-06 06:49:27 -07:00
Jakub Piasecki 9010e691e0 Update transform types to preserve behavior in TypeScript (#51115)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51115

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D74229819

fbshipit-source-id: 08e363ae58c29ca910601b2f078153b8ff30103c
2025-05-06 06:21:15 -07:00
Dawid Małecki 5e612e6eca Fix suggesting components from types_generated directory (#51101)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51101

TS LSP suggests importing/using components from `types_generated` directory which are exported under slightly different name than root exports. Prefixing default exports with `$$` fixes the issue.

Changelog:
[Internal]

Reviewed By: huntie

Differential Revision: D74177107

fbshipit-source-id: 86a6869c2aa7a113915184e4857a7882710b1db4
2025-05-06 06:01:19 -07:00
Jakub Piasecki a65744fd4a Unify ref usages in TS type tests (#51117)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51117

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D74240080

fbshipit-source-id: 5cc7042b5ac1515887d20b72a0b7d96cc8313ed7
2025-05-06 05:42:29 -07:00
Pieter De Baets ef6f2fb32d Create granite.target_platform for RN overrides (#51076)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51076

Changelog: [Internal]

Reviewed By: MichaelTay, rshest

Differential Revision: D73451500

fbshipit-source-id: b31962fed5004204e15f4adbaf8a8ce2432b94a2
2025-05-06 03:38:22 -07:00
Christian Falch 3ac16dd6a8 replaced use of rsync with cp in prebuild scripts (#51095)
Summary:
When building the RNDependencies XCFrameworks we saw some errors in the CI servers about rsync failing:

`rsync(3031): error: poll: hangup on nonblocking write`

We decided to fix this by changing from using rsync to cp.

This commit fixes this by replacing rsync with cp, and adding a cleanup step after copying the XCFramework files.

## Changelog:

[INTERNAL] [FIXED] - Replacing rsync with cp, and adding a cleanup step after copying the XCFramework files.

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

Test Plan: Run RNDependencies scripts on CI and verify that they're working as expected.

Reviewed By: fabriziocucci

Differential Revision: D74236114

Pulled By: cipolleschi

fbshipit-source-id: accd84abf7601919cfdbc1b6a8681a61d4293ca5
2025-05-06 02:19:54 -07:00
David Vacca 3ad0b8244a Throw if getCatalystInstance() is executed when running on bridgless mode + legacy arch minification (#51112)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51112

Throw if getCatalystInstance() is executed when running on bridgless mode + legacy arch minification

This should be safe given that all the methods of BridgelessCatalystInstance throw exceptions

changelog: [internal] internal

Reviewed By: alanleedev

Differential Revision: D74200099

fbshipit-source-id: a888061250f19348a22895c3684aa2333280c916
2025-05-05 23:53:10 -07:00
David Vacca a02052d37f Mark BridgelessCatalystInstance as LegacyArchitecture and remove DoNotStrip (#51111)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51111

BridgelessCatalystInstance is unused in bridgeless, any usage will lead to an exception / crash.
This diffs marks BridgelessCatalystInstance as LegacyArchitecture and removes DoNotStrip annotation to enable further optimizations

changelog: [internal] internal

Reviewed By: alanleedev

Differential Revision: D74200097

fbshipit-source-id: f99b6fa74c30bdf0e1cd6758e223601b3ce5826c
2025-05-05 23:53:10 -07:00
Tim Yung e69e35e370 Fantom: Create Shadow Node Reference Counter (#51088)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51088

Creates `ShadowNodeReferenceCounter`, a module with utilities for writing Fantom tests that make assertions about the reference count for a `ShadowNode` object.

Changelog:
[Internal]

Reviewed By: lunaleaps

Differential Revision: D74131710

fbshipit-source-id: a949a402ee52f40445ce99c712540e80c8a05065
2025-05-05 23:43:41 -07:00
Nick Gerleman f85b30b24b Underpinnings for Caching Text Layouts (#51065)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51065

This adds infrastructure to let us start storing cached Android text layouts as part of a `ParagraphShadowNode`. After this, we will clear them out, and propagate them to state. Right now, the flag doesn't do much, apart from extra work.

This is done by adding `TextLayoutManagerExtended::supportsPreparedLayout()`, and `TextLayoutManager::PreparedLayout` types, to shim between platforms, then on Android, we add a `PreparedLayout`, which is for now just an Android layout, with extra field (`maxNumberOfLines`, for some reason not exposed on recent versions).

Android `TextLayoutManager` java side is split a little bit, so that we reuse all the existing logic for prepared layouts. I tried to set up the boundary, so that we don't reserialize a MapBuffer after preparation, and for simplicity, this means source of truth for attachment count, and attachment sizes, now lives on the layout. This means we need to change boundary a bit, where we are no longer able to pass in a buffer to fill from C++ side of attachment positions.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D73970149

fbshipit-source-id: ff71c227e062c16fe52a4eb3ba2acbebf3d96e56
2025-05-05 16:48:16 -07:00
Aaron Coplan 2562440385 Construct FBImagePerfImageInfo and pass to completion handler from within FBIconModule (#51110)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51110

Changelog: [iOS][Changed] Update RCTImageLoader.mm to cast loadHandler to RCTImageLoaderLoggable before calling shouldEnablePerfLogging

Replacing cast from RCTImageURLLoaderWithAttribution to RCTImageLoaderLoggable

Reviewed By: philIip

Differential Revision: D73148595

fbshipit-source-id: 01f61bc60624e2bb9cb4ff9b45094e38ea77dcaa
2025-05-05 16:37:56 -07:00
Aaron Coplan 43c9a609de Update loadImageURL signature in RCTImageURLLoader to include metadata in completion callback (#51107)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51107

Changelog: [iOS][Deprecated] Deprecate loadImageForURL in favor of new signature which uses completionHandlerWithMetadata

Updating the signature of completionHandlerWithMetadata to allow passing metadata through the completionHandlerWithMetadata in order to enable better instrumentation of image loading.

Reviewed By: philIip

Differential Revision: D73162738

fbshipit-source-id: 8e7e4ac35c9685a362a2efe08ebebbf0dd249ff9
2025-05-05 16:37:56 -07:00
Nick Gerleman e565c662d7 Assume full container width when ellipsizing line (#51108)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51108

We calculate the width of text to be the full width of the container, if the text overflows the bounds of the container, instead of the wrapped width, to match the behavior on web.

Incorporating line count into layout defeats this logic, since the final layout never overflows. We need to also check to see if we are ellipsized (had overflow) instead.

Changelog:
[Android][Fixed] - Assume full container width when ellipsizing line

Reviewed By: joevilches

Differential Revision: D74204041

fbshipit-source-id: 1c2a7fc50f101bd4c9ed2f979534731992b5310b
2025-05-05 15:47:10 -07:00
Joe Vilches f1e7bbb88b Fix "detected text" annoucement (#51106)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51106

There was a strange bug reported to us with `accessibilityOrder` where an OCR model would announce text on the screen sometimes. This would happen if a focused `View` without a label would wrap `Text` that was was not included in the `accessibilityOrder` array. What happens under the hood is we have a focused `View` trying to coopt a label. It finds no accessibility nodes under it (because the `Text` has `importantForAccessibility` set to `NO`) so it falls back to this weird TalkBack behavior. It both reads the text from the TextView and announces an OCR announcement - leading to repeating the text.

To fix this we just check if we are going to coopt text and if we do then we do not set `importantForAccessibility`. Behavior here changes a bit. Links are not accessible without having to reference the Text, setting `accessible={true}` on non-referenced `Text` will lead to be focusable.

These are both less bad than what we had before though, so I think this tradeoff is fine.

Changelog: [Internal]

Reviewed By: jorge-cab

Differential Revision: D74101530

fbshipit-source-id: 0678915efdc46a6273f79927b87f22bc9017814a
2025-05-05 12:58:18 -07:00
Rob Hogan f4936894f0 Miscellaneous lint fixes (#51099)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51099

Fix up some misc broken lints and add temporary suppressions to reduce noise in the subsequent stack.

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D74141669

fbshipit-source-id: dc19378e41f6d8d45fc7d2ecf18c1c01a1e501be
2025-05-05 09:48:46 -07:00
Eric Rozell d9823d80bb Delete ShadowTreeRevision on background thread (#50997)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50997

In some apps, we spend a non-trivial amount of time calling ShadowNode destructors on the UI thread.

A simple way to avoid stalling the UI thread is to move the `baseRevision_` instance to a data structure that is cleared on a background thread, so it's tree of ShadowNode shared_ptrs are released (and in most cases destroyed) on the background thread.

Rather than using std::thread, this change introduces the LowPriorityExecutor abstraction that should be supplied by host platforms. The implementation of this LowPriorityExecutor for each platform is as follows:
- iOS: uses dispatch_async to a low priority dispatch queue
- Android: uses a pthread with SCHED_OTHER and priority = 19

Moving the ShadowTreeRevision into a lambda capture and punting the lambda to the LowPriorityExecutor moves the destructor calls of the ShadowNodes to the host platform implementation of the LowPriorityExecutor.

This change is also guarded by a feature flag so we can keep an eye out for potential memory leaks.

## Changelog

[Internal]

Reviewed By: NickGerleman

Differential Revision: D73688009

fbshipit-source-id: 6a66da248e6fe5c38375bf026499346e8381e75a
2025-05-05 07:44:02 -07:00
Dawid Małecki 8d08845cda Root export PublicRootInstance and PublicTextInstance for ReactNativeTypes to use (#51018)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51018

`ReactNativeTypes` deep imports  `MeasureOnSuccessCallback`, `PublicInstance`, `PublicRootInstance` and `PublicTextInstance`. The `MeasureOnSuccessCallback` type  is already root exported, `PublicInstance` is exported as `HostInstance` and there are two types left to export to root import all of them from react-native. This is needed for `simpleResolve` to properly resolve and build types located in `ReactNativePrivateInterface`.

This cannot be fixed on the resolver level because that would also involve change in the `exports` field in `package.json` to enable types resolution for deep paths which should be strict by design.

Changelog:
[Internal]

Reviewed By: huntie

Differential Revision: D73926160

fbshipit-source-id: 3a711a0f002ea42d9ad538c07ec00f22cc4afb6b
2025-05-05 03:24:02 -07:00
Ruslan Lesiutin 271232d856 Make call frames point to function definition, not callsite (#51084)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51084

# Changelog: [Internal]

Reviewed By: dannysu

Differential Revision: D73850528

fbshipit-source-id: fc1c22c5bf7cf71f76cf49643af06eeb188b770c
2025-05-05 02:20:58 -07:00
Alex Hunt 69f9a9a029 Add status bar offset to New App Screen on Android (#51091)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51091

Fix for top padding with Android edge-to-edge (default for current version of the RN template). We add a `statusBarHeightOffset` explicitly, since this is not covered by the builtin `SafeAreaView`.

{F1977676990}

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D74142357

fbshipit-source-id: 6d70db43d8b80b7e3d2d4b598e29560efa046b5c
2025-05-04 13:07:52 -07:00
Rob Hogan 93f22e79d4 community-cli-plugin: Use TerminalReporter type from metro, replace deep imports (#51092)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51092

`TerminalReporter` is re-exported from `metro` (since [0.76.7](https://github.com/facebook/metro/releases/tag/v0.76.7)), so we can update these deep imports to use public exports.

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D74141704

fbshipit-source-id: 22cd3209868ed9ab260e199f9099ef98335feaeb
2025-05-04 09:57:57 -07:00
Nick Gerleman 5eed872463 Split Java TextLayoutManager Logic (#51066)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51066

Splits up some of the `measureText` code in Android TextLayoutManager, ahead of D73970149, which adds `measurePreparedLayout` to reuse most of this logic. Most significant change, is we pull out logic to iterate and retrieve metrics for attachments, since `measurePreparedLayout`, needs to also return dimensions, and fill into ArrayList, instead of received buffer.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D74035246

fbshipit-source-id: 2a0f5b171c4343e26ffa5b2538a0018939b06773
2025-05-02 23:22:09 -07:00
Jorge Cabiedes Acosta 989b3f61a0 Fix clipToPaddingBox on new Background and Border drawable (#51055)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51055

When clipping to the padding box without a background or border set, we should default to clipping to the drawing rectangle.

This ensures accurate clipping behavior when there is no background or border set. This is because it seems bounds accommodates the contents of the drawables but when no content is present (either a background or a border) the bounds are 0. In which case we want to rely on the drawing rect instead of the bounds for this edge case.

Changelog: [Android][Fixed] - Fix incorrect clip to padding box on new Background and Border drawables

Reviewed By: NickGerleman

Differential Revision: D74014372

fbshipit-source-id: bd5a496db6de44c4185760ed72b3013d9f2faa00
2025-05-02 19:00:28 -07:00
Jiawei Lü d45c0419ac Revert D73922341: Report PerformanceResourceTiming events
Differential Revision:
D73922341

Original commit changeset: bcfc03c3d8a9

Original Phabricator Diff: D73922341

fbshipit-source-id: 3898ae763332b79f5a37fc91abb70be53c299655
2025-05-02 14:42:24 -07:00
Joe Vilches e00028f6bb Clean up useEditTextStockAndroidFocusBehavior feature flag (#51039)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51039

We added a feature flag in case this broke things. Its been about 4 months now with now issues, I think we can clean this up.

Changelog: [Android][Fixed] - Can now focus TextInput with keyboard

Reviewed By: NickGerleman

Differential Revision: D73954790

fbshipit-source-id: 4682cf709aa2f34ba69e76a35d07a908edb28f23
2025-05-02 13:21:27 -07:00
Mateo Guzmán 6fa1864d52 Make ModuleDataCleaner internal (#51060)
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.modules.common.ModuleDataCleaner).

Only one library uses it (https://github.com/jbrodriguez/react-native-android-sqlite), but it's hasn't been updated for 10 years. Marking it as breaking, but it's unlikely that the library is used nowadays. See:

## Changelog:

[ANDROID][BREAKING] - Make com.facebook.react.modules.common.ModuleDataCleaner internal

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

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

Reviewed By: cortinico, shwanton

Differential Revision: D74036994

Pulled By: arushikesarwani94

fbshipit-source-id: 520fc3dfdc1ecfb27f161a1b59ad5d79dfc854cf
2025-05-02 12:51:13 -07:00
Ramanpreet Nara f4d99d6a23 Reland: [rn][ios] Bridgeless: Fix unstable_hasComponent (#51053)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51053

unstable_hasComponent(component) first registers the component with react native, if possible. Then, it returns you whether registration succeeded.

## Problem
For unregistered components, the initial call returns false. But, all subsequent calls return true.

The reason why: After the initial call fails, react native registers unimplemented view under that component name. So, all subsequent calls return true.

## Solution
Just record the initial loopup result. And always return that initial lookup result from this method.

Changelog: [iOS][Fixed] Fix bug: unstable_hasComponent(*) = true for unregistered components for n > 1th call.

Reviewed By: yungsters, cipolleschi

Differential Revision: D73949864

fbshipit-source-id: ac5b6fc373cb1b2436045ae1f78391f0712bca17
2025-05-02 12:27:58 -07:00
generatedunixname499836121 c514333f41 Apply fixup patch to fbsource
Summary:
This is an automatically generated fixup patch to bring fbsource back into sync with
facebook/react on GitHub. Please land this patch as soon as possible, as the difference
reflected on here is already on GitHub and future changes may depend on these
changes!

Changelog: [Internal]

<< DO NOT EDIT BELOW THIS LINE >>
diff-train-skip-merge

Generated by: https://www.internalfb.com/intern/sandcastle/job/22517999956752681/

GitHub Repo: facebook/react

Reviewed By: kassens

Differential Revision: D73844457

fbshipit-source-id: 840a8448839992538427cd52501cdfaf0a2e82da
2025-05-02 12:24:24 -07:00