Commit Graph

12270 Commits

Author SHA1 Message Date
Dawid Małecki 83399e245b Migrate import React to import * as React (#50433)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50433

Make React imports consistent across react-native source code to also align with Flow tooling.

flow-api-translator adds `import * as React from 'react';` if there is no React import and React namespace has to be used after translation.

Changelog:
[Internal]

Reviewed By: huntie

Differential Revision: D72238732

fbshipit-source-id: 5f8cfeab26f397684b1d802731729be7071b5da7
2025-04-02 06:59:33 -07:00
Jakub Piasecki a7c38ddd34 Update type names to reduce symbol duplication (#50443)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50443

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D72298410

fbshipit-source-id: dd1b0fdfe63f64e97cc5001b8e7baeaf37c0d5d9
2025-04-02 05:39:33 -07:00
Jakub Piasecki 7325512219 Reduce duplication of TextInput props (#50430)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50430

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D72244423

fbshipit-source-id: 6ab76d32b269c0c33390b2e84a745549bcf9a66e
2025-04-02 00:45:29 -07:00
Ramanpreet Nara 094876367f Delete RCTComputeScreenScale
Summary:
This method is redundant. You could just call RCTScreenScale()

Changelog: [iOS][Removed] Delete RCTComputeScreenScale

Reviewed By: philIip

Differential Revision: D72258778

fbshipit-source-id: 0b469169efc4f2def85b2e6b736f3c4570e6b428
2025-04-01 19:49:45 -07:00
Ramanpreet Nara dc97df10a2 Delete RCTFloorPixelValue
Summary:
This is dead code. Let's remove this for now.

This api is unsafe: if it's called from a non-ui thread, it may dispatch to the ui thread synchronously.

Changelog: [iOS][Removed] - Remove RCTFloorPixelValue

Reviewed By: NickGerleman

Differential Revision: D72260694

fbshipit-source-id: d032917643c957a395ee380ef925a047abd5dace
2025-04-01 19:39:19 -07:00
Ramanpreet Nara 61bd649c93 RCTTextLayoutManager: Migrate off screen scale access
Summary:
## Problem
If RCTScreenScale() is called from a non-ui thread, it will synchronously dispatch to the ui thread.

If the calling thread is the javascript thread, this could deadlock React Native.

## Changes
Move the method calls to the ui thread.

In the future, once all call-sites are migrated to the ui thread, we will just make these methods assert that they're being called from the ui thread.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D72177192

fbshipit-source-id: daadf713f059d33e8fff4559b4184f9d4b6b420d
2025-04-01 19:28:08 -07:00
Nicola Corti 526f6cbe07 Delete unnecessary NativeModuleSoLoader (#50199)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50199

We don't really need another wrapper around SoLoader to decide when to load a library. SoLoader already does this for us. See:
https://github.com/facebook/SoLoader/blob/62c2028a07f146bbc56c0337dacf226fcd6f95ef/java/com/facebook/soloader/SoLoader.java#L1070-L1139
I'm removing this extra unnecessary class.

Changelog:
[Internal] [Changed] -

Reviewed By: javache

Differential Revision: D71637449

fbshipit-source-id: 33a146b56f8027fdb7fc48fd6f68bdbcf0b34fd6
2025-04-01 19:19:04 -07:00
Jakub Piasecki 597c457b68 Update types exported from the root package (#50418)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50418

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D72223744

fbshipit-source-id: 00abe0e5a83f3625f53e4386cf7a8b8e25cfa180
2025-04-01 19:18:22 -07:00
Mateo Guzmán 1012445ef5 Fix unresolved KDoc references (#50403)
Summary:
Static code analysis detected some unresolved KDoc references. In this PR, I’m addressing a few of them.

## Changelog:

[INTERNAL] - Fix some unresolved KDoc references

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

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

Reviewed By: cortinico

Differential Revision: D72234349

Pulled By: javache

fbshipit-source-id: 0877992cce5d76124b83c5261ec680683caadc9c
2025-04-01 12:19:01 -07:00
Alan Hughes 9eb75d4bd5 Change exception handele type in ReleaseDevSupportManager (#50400)
Summary:
In expo-updates, we would like to handle exceptions on app launch. We used to do this by reassigning our own `DefaultJSExceptionHandler` to the property on the  `ReleaseDevSupportManager `.  This class has been migrated to kotlin and is now final so we can no longer do this. Instead of having the `defaultJSExceptionHandler` typed as `DefaultJSExceptionHandler` we'd like to change it to the interface, `JSExceptionHandler` so we can do this https://github.com/expo/expo/blob/93b7e9b1724a7be11b9d79c0313a2e5a2fd5e5bf/packages/expo-updates/android/src/main/java/expo/modules/updates/errorrecovery/ErrorRecovery.kt#L118C82-L118C97

## Changelog:

[ANDROID] [CHANGED] Change `defaultJSExceptionHandler`'s type to  `JSExceptionHandler` on the `ReleaseDevSupportManager`

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

Test Plan: RNTester runs without issue in a release build.

Reviewed By: huntie

Differential Revision: D72173667

Pulled By: cortinico

fbshipit-source-id: 978fd696322432e638a90014ff3c8c2b09fae761
2025-04-01 07:42:37 -07:00
Jakub Piasecki 09d21955ac Update Keyboard instantiation to align with other singletons (#50420)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50420

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D72223852

fbshipit-source-id: 3a131153cd329347250d81e1fc2043fbbd6e687e
2025-04-01 07:12:56 -07:00
Mateo Guzmán ecd902a9f1 Make MessageQueueThreadHandler internal (#50375)
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.MessageQueueThreadHandler).

All GH search results for this class point to error trace files.

## Changelog:

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

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

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

Reviewed By: cortinico

Differential Revision: D72076724

Pulled By: javache

fbshipit-source-id: fa49f62c8d6b8efaeb1831ef2c69e293cf418520
2025-04-01 06:20:40 -07:00
Jakub Piasecki 30fd5a3c05 Update Accessibility, Animated and Appearance type exports (#50421)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50421

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D72224821

fbshipit-source-id: 604fcdcabc1b6eeca7df3a32faf2505ddf268547
2025-04-01 03:54:49 -07:00
Jakub Piasecki f446ac346d Make selected props not required (#50417)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50417

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D72223589

fbshipit-source-id: 7a88d585edca4dd9c028244c7bd456afc87e0faf
2025-04-01 03:50:38 -07:00
Jakub Piasecki ad5f5a332a Make VirtualizedList use ScrollViewProps directly (#50416)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50416

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D72223126

fbshipit-source-id: 8598a02c31e16302a3f2ce8678602a33fc090c8a
2025-04-01 03:46:00 -07:00
Evghenii Nicolaev d3daabfe2b Revert D71805075: Update hermes-parser and related packages in fbsource to 0.27.0
Differential Revision:
D71805075

Original commit changeset: 685194c12ac0

Original Phabricator Diff: D71805075

fbshipit-source-id: b28f0f83ad8b4f4f6b5e62fdc9ff323af79c1d43
2025-04-01 03:45:23 -07:00
Iwo Plaza be8393c41b Limit @react-native/virtualized-lists subpath imports (#50392)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50392

## This diff
Defines an exports field for the "react-native/virtualized-lists" package. Limits internal use of subpath
imports to virtualized-lists package, and exports all currently used APIs one the root level.

Changelog:
[General][Breaking] - Subpath imports to the internal react-native/virtualized-lists package are not allowed.

Reviewed By: huntie

Differential Revision: D72162344

fbshipit-source-id: 828dab8e569f019fc48084af475e152b898f5bb5
2025-04-01 03:26:25 -07:00
Pieter De Baets fdf396b964 Remove unique_ptr for globalRootComponentDescriptor (#50391)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50391

No need for the indirection here of a heap allocated pointer.

Since we have the RootComponentDescriptor we generally don't need it in any other component registry.

Changelog: [Internal]

Reviewed By: philIip

Differential Revision: D72058916

fbshipit-source-id: 0c29f26f4c56c4353eda251fe06a475e3b6085da
2025-04-01 02:18:44 -07:00
Alex Hunt f13c8a7417 Update hermes-parser and related packages in fbsource to 0.27.0 (#50241)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50241

Bump hermes-parser and related packages to [0.27.0](https://github.com/facebook/hermes/blob/main/tools/hermes-parser/js/CHANGELOG.md).

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D71805075

fbshipit-source-id: 685194c12ac037f74cc4fd54eb0d777a74507727
2025-04-01 01:01:05 -07:00
generatedunixname89002005232357 411af39f97 Revert D71908601 (#50409)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/50409

Reviewed By: rozele

Differential Revision: D72190428

fbshipit-source-id: 00d2be5eda7fd6b89883a27c5ccb463b76428258
2025-03-31 20:05:04 -07:00
generatedunixname89002005232357 0670e382a5 Revert D71582553 (#50410)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/50410

Reviewed By: rozele

Differential Revision: D72190404

fbshipit-source-id: c24fe997ccad22bef018b635140126b3d729a00c
2025-03-31 20:05:04 -07:00
Peter Abbondanzo ad8be9ada6 Remove Android image prefetching feature flag (#50412)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50412

Removes the `enableImagePrefetchingAndroid` feature flag.

Changelog: [Internal]

Reviewed By: lenaic

Differential Revision: D72198491

fbshipit-source-id: bd9bb9ecc7b58ac1fe6a507ec9caf1ce99e0ba63
2025-03-31 18:50:54 -07:00
Zeya Peng 4912958812 synchronouslyUpdateViewOnUIThread on UIManager (#50379)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50379

## Changelog:

[Android] [Added] - Allow invoking `synchronouslyUpdateViewOnUIThread` from c++ via `UIManager`
implementation is provided by SchedulerDelegate on the platform

Reviewed By: javache

Differential Revision: D71648772

fbshipit-source-id: bba0f7e9e2deafd074d28ff5cece6b7738c4d123
2025-03-31 13:17:56 -07:00
Jakub Piasecki 97324abc0e Type Animated.event listener argument (#50390)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50390

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D72151986

fbshipit-source-id: 26c9b6dff669fac6fcb8db1f6a0b23648f6f4afb
2025-03-31 09:36:57 -07:00
Tim Yung bff5c30118 Revert D71968187: Define "exports" field on main package
Differential Revision:
D71968187

Original commit changeset: 28ff941692d1

Original Phabricator Diff: D71968187

fbshipit-source-id: a6843ab57da7b8a2c436dbdf23644fe2d8954520
2025-03-31 09:21:06 -07:00
Innei ce47d6a131 fix(typo): RCTBridgeProxy.mm methid to method (#50394)
Summary:
Fix typo

## Changelog:
[Internal] - typo `RCTBridgeProxy.mm` `methid` to `method`

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

Test Plan: N/A

Reviewed By: NSProgrammer, cortinico

Differential Revision: D72168477

Pulled By: cipolleschi

fbshipit-source-id: 6442aa87e90b9be9c18a2e2535939630848907d9
2025-03-31 08:58:56 -07:00
Adam Ernst ac23323da1 RCTDeviceInfo: fix crash due to failure to get AccessibilityManager (#50398)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/50398

Reviewed By: philIip

Differential Revision: D72020801

fbshipit-source-id: 556e6d5a3e8492e8283ee10aa5829186d172b28f
2025-03-31 08:43:06 -07:00
Mateo Guzmán 8985c6be48 Make CallbackImpl internal (#50378)
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.CallbackImpl).

All GH search results are forks.

## Changelog:

[INTERNAL] - Make com.facebook.react.bridge.CallbackImpl internal

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

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

Reviewed By: cortinico

Differential Revision: D72159376

Pulled By: javache

fbshipit-source-id: 1a3335431d46615262747e3d5b8cf6e8cab192a3
2025-03-31 06:35:39 -07:00
Mateo Guzmán c094f924dc Make InvalidIteratorException internal (#50383)
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.InvalidIteratorException).

All GH search results are forks.

## Changelog:

[INTERNAL] - Make com.facebook.react.bridge.InvalidIteratorException internal

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

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

Reviewed By: cortinico

Differential Revision: D72159343

Pulled By: javache

fbshipit-source-id: 7ed30a4691fe8d7646e64b382b3459e7ab76508e
2025-03-31 06:23:16 -07:00
Andrew Wang 63160341d9 Revert D70615310: Collection of small type updates
Differential Revision:
D70615310

Original commit changeset: 11dc833aeeeb

Original Phabricator Diff: D70615310

fbshipit-source-id: 6508f8e27e1a17f6086fdecb5177472233dc3480
2025-03-31 06:14:37 -07:00
Jakub Piasecki f8a4f80b6e Collection of small type updates (#50312)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50312

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D70615310

fbshipit-source-id: 11dc833aeeeb67e03808b18b50ff79ae6aa956ec
2025-03-31 04:13:04 -07:00
Pieter De Baets d4778e31ab Add diagram of Android event lifecycle (#50324)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50324

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D71976930

fbshipit-source-id: 5bfaccfd1e1967c691cfbf3f5584d6052c0bec2c
2025-03-31 03:53:58 -07:00
Alex Hunt 9fc2a9b9e6 Define "exports" field on main package (#50320)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50320

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.
- Imports from `src/` and `src/private/` directories are disallowed.

Reviewed By: robhogan

Differential Revision: D71968187

fbshipit-source-id: 28ff941692d1822a916457c4fb891e200e3bca61
2025-03-31 02:37:13 -07:00
David Vacca 46cd9165c1 Remove @LegacyArchitecture annotation from CxxCallbackImpl class (#50308)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50308

CxxCallbackImpl is used in new architecture, in this diff i'm removing LegacyArchitecture annotation from CxxCallbackImpl class

changelog: [internal] internal

Reviewed By: alanleedev

Differential Revision: D71820292

fbshipit-source-id: 54748cc23aa7091841a025e41ad43dcaa60923cd
2025-03-28 21:36:54 -07:00
David Vacca a90bc9a766 Mark SingleThreadAsserter as @LegacyArchitecture (#50307)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50307

Mark SingleThreadAsserter as LegacyArchitecture

changelog: [internal] internal

Reviewed By: alanleedev

Differential Revision: D71820293

fbshipit-source-id: a974ee65b2659028d14f73504f73db2b3ae63f70
2025-03-28 21:36:54 -07:00
Panos Vekris 6d5dde6393 pre-suppress errors for natural_inference.local_primitive_literals=partial in fbsource (#50380)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50380

Pre-suppresses errors in xplat/js and arvr/js for phase 1 of Natural Inference for Primitive Literals

See https://fb.workplace.com/groups/floweng/permalink/28092444257044156/

Reviewed By: gkz

Differential Revision: D72088386

fbshipit-source-id: 0827822199cb31a80afbca2a16f74aea4b6c4957
2025-03-28 20:35:51 -07:00
Alex Taylor (alta) 798c3dd842 Deploy 0.266.0 to xplat (#50373)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50373

Changelog: [Internal]

Reviewed By: jbrown215, SamChou19815, panagosg7

Differential Revision: D72061660

fbshipit-source-id: a6862fe0e1f62992b76145006b3f8bc3ad788258
2025-03-28 13:07:06 -07:00
Nick Gerleman e861949ccd Make SafeReleaseJniRef more generic (#50376)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50376

This makes a couple of tweaks to `SafeReleaseJniRef` to let it be used in more places:

1. Add a default ctor for null state
2. Bridge `get()` to return raw JNI ref, for use when calling Java functions directly (compared to current use case of hybrid objects)
3. Keep JNI environment attached to thread longer term, instead of repeated attach/detach, to allow use for higher frequency objects.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D71933838

fbshipit-source-id: 622cc70d2d7483475406314abcbcf92d3d2ff227
2025-03-28 12:32:20 -07:00
zhongwuzw 7441127040 Added slash of alpha support using rgb() (#50281)
Summary:
Fixes https://github.com/facebook/react-native/issues/50207

Added slash alpha support like `rgb(255 122 127 / 0.2);`, currently seems we don't support it.

## Changelog:

[GENERAL] [ADDED] - Added slash of alpha support using rgb()

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

Test Plan: `rgb(255 122 127 / 0.2)` can shows correctly.

Reviewed By: cipolleschi

Differential Revision: D72009174

Pulled By: NickGerleman

fbshipit-source-id: f53e550cfdc8f481785a1fb134cd0fab810f8f38
2025-03-28 11:46:00 -07:00
Ritesh Shukla af1f1e4fe5 Implementation of URLSearchParams Methods (#50043)
Summary:
This PR addresses the following issues and enhances the functionality of `URLSearchParams`:

1. Extended Initialization Parameters: Previously, only `Record<string, string>` was supported while initialising  URLSearchParams. Now supports `string`, `Record<string, string>`, and `Array<[string, string]>` (aligning with web standards).

2. Added Implementation for `delete()`, `get()`, `getAll()`, `has()`, `sort()`, and `set()`.

3. Addition of Iteration Methods: Added  `keys()`, `values()`, `entries()`, and `forEach()`  methods.  Outputs are identical to web.

4. Bug Fix: Incorrect Initialization from URL. Previously, `URLSearchParams` was initialized with an empty value when accessed via `url.searchParams`, even if the `URL` contained search parameters.

## Changelog:
[General][Added] Implementation for URLSearchParams

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

Test Plan:
Can be tested by below code
```js
  const isHermes = () => !!global.HermesInternal;
  const params = new URLSearchParams("");
  console.log("Is Hermes Enabled:-",isHermes())
  console.log("Values:", Array.from(params.values())); //  ["value1", "value2"]
  console.log("Keys:", Array.from(params.keys())); //  ["key1", "key2"]
  console.log("Entries:", Array.from(params.entries())); //  [["key1", "value1"], ["key2", "value2"]]
  params.forEach((value, key) => {
      console.log(`${key}: ${value}`);
  });
  console.log("Has 'key1'", params.has("key1")); //  true
  console.log("Has 'key3'", params.has("key3")); //  false
  console.log("Get 'key1':", params.get("key1")); //  "value1"
  console.log("Get 'key3':", params.get("key3")); //  null
```

Tested on both hermes and JSC.

Hermes:-
![image](https://github.com/user-attachments/assets/9a467001-693a-4e38-b349-e8d92f961808)

JSC:-
![image](https://github.com/user-attachments/assets/e5f89375-ede4-4ea0-9c62-f98f63c67188)

Reviewed By: cipolleschi

Differential Revision: D71965101

Pulled By: huntie

fbshipit-source-id: c0a0f965ac1ff9577cdc8b3c11f0dd0ced538868
2025-03-28 10:18:59 -07:00
Vitali Zaidman aadb1f1116 improve error reporting when a debugger for an unknown device is opened (#50330)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50330

Changelog: [Internal]

Make the error reported when a debugger is created for a device that does not exist generic, and not including any specific details to make them easier to aggregate

Reviewed By: hoxyq

Differential Revision: D71979796

fbshipit-source-id: 88badc51043e35ff91d7db81c5966ed5ffce9109
2025-03-28 09:16:49 -07:00
zhongwuzw 44810f7498 Reland: avoid race condition crash in [RCTDataRequestHandler invalidate (#50342)
Summary:
Reland https://github.com/facebook/react-native/commit/6bc5ddea3ea3ca20060ea0181630539931948085, the reason the previous commit has an issue is `weakOp` would always `nil` when captured in block :https://github.com/facebook/react-native/blob/6bc5ddea3ea3ca20060ea0181630539931948085/packages/react-native/Libraries/Network/RCTDataRequestHandler.mm#L52-L54

Now, we can create an `NSBlockOperation` and use `addExecutionBlock` instead. `weakOp` can be captured correctly.

## Changelog:

[IOS] [FIXED] - Reland: avoid race condition crash in [RCTDataRequestHandler invalidate

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

Test Plan: N/A

Reviewed By: cipolleschi

Differential Revision: D72047232

Pulled By: javache

fbshipit-source-id: c3a5a9fca909f7eac16d78b650c9ea9f5b8e64e4
2025-03-28 09:05:01 -07:00
Tim Yung da1bf8d1d1 RN: Ship scheduleAnimatedCleanupInMicrotask (#50341)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50341

Ships tge `scheduleAnimatedCleanupInMicrotask` feature flag, which changes the cleanup of `AnimatedProps` to occur in a microtask instead of synchronously during effect cleanup (for unmount) or subsequent mounts (for updates).

Changelog:
[General][Changed] - When an `Animated` component is unmounted, any completion callbacks will now be called in a microtask instead of during the commit phase.

Reviewed By: javache

Differential Revision: D71942778

fbshipit-source-id: cbe636d5cff84dfeca2f21ead374609c536e91ad
2025-03-28 08:13:39 -07:00
Tim Yung e704f8ac2f RN/Metro: Set reactRuntimeTarget on Hermes Parser (#50339)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50339

Explicitly sets the default `reactRuntimeTarget` when invoking `require('hermes-parser').parse` so that it'll be easier to find these configurations when upgrading to `'19'`.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D72006705

fbshipit-source-id: 4994917152a2a4a767b871d4a36092c0c5391324
2025-03-28 08:02:09 -07:00
Ruslan Lesiutin 6b72fd2dbf Send Profile in smaller chunk to prevent WebSocket disconnections on android (#50337)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50337

# Changelog: [Internal]

This should not have any functional changes, it only prevents the WebSocket from being killed on Android, when we are sending Profile-related Trace Events.

For large traces, a single message could be more than 16MB, because we send a unique string url for every call frame.

Reviewed By: huntie

Differential Revision: D71993748

fbshipit-source-id: f0bfddfb0bb87631e72b573142abdf0d7d87ba48
2025-03-28 05:43:41 -07:00
Rubén Norte c6eb714035 Add basic documentation for MutationObserver (#50335)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50335

Changelog: [internal]

This defines the internal technical documentation for the MutationObserver API, as an example of how to define docs using the new strategy and structure.

Reviewed By: javache

Differential Revision: D71890748

fbshipit-source-id: 3ef19c784dff7aea7a2e2d08302640d5eefacc30
2025-03-28 05:28:44 -07:00
Rubén Norte 435d58d215 Align feature flags documentation with new guidelines (#50334)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50334

Changelog: [internal]

This updates the documentation for the feature flag system to adhere to the new documentation strategy and structure.

Reviewed By: javache, rshest

Differential Revision: D71889753

fbshipit-source-id: 7ff47cf613ac01012e7329485d2b97e997a97c07
2025-03-28 05:28:44 -07:00
Pieter De Baets 6dd5a838c3 Do not crash when event is emitted when ReactInstance is reloaded
Summary:
Regression introduced in D71735505 where I tried to ensure fabricEventEmitter was always non-null. Instead log a soft error when this happens, so we don't drop the event silently.

Changelog: [Android][Fixed] Fixed crash when event is emitted after instance is shutdown

Reviewed By: mdvacca

Differential Revision: D71967092

fbshipit-source-id: 990b6414b41a2709d70a6deae38f5aa043203a20
2025-03-28 04:17:20 -07:00
Dawid Małecki 6877263003 Align Flow with TS types and export relevant modules (#50322)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50322

Changelog:
[Internal]

Reviewed By: huntie

Differential Revision: D71973327

fbshipit-source-id: ef3a6ad4c0ba6d32bfd1e4cc2ac8e0afac51e9fe
2025-03-28 02:47:22 -07:00
Jorge Cabiedes Acosta 1f8d824e67 Ignore unexisting nativeIDs on accessibilityOrder (#50325)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50325

axOrderViews is an optimization I came up with so that we could find and queue all the views on a single tree traversal. It initializes the array with the size of the accessibilityOrder array and places each view where its nativeID is. If there is no view corresponding to the nativeID then that axOrderViews element will be null. So to fully ignore nativeIDs that don't correspond to any View we can just filter the nulls

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D71977739

fbshipit-source-id: a3f2138eebe06808ce413355df5d9beb2f4ff388
2025-03-27 16:02:55 -07:00