Commit Graph
9797 Commits
Author SHA1 Message Date
Mateo GuzmánandFacebook GitHub Bot d49ec1d79c Migrate CxxModuleWrapperBase to Kotlin (#50251)
Summary:
Migrate com.facebook.react.bridge.CxxModuleWrapperBase to Kotlin.

## Changelog:

[INTERNAL] - Migrate com.facebook.react.bridge.CxxModuleWrapperBase to Kotlin

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

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

Reviewed By: alanleedev

Differential Revision: D71830747

Pulled By: arushikesarwani94

fbshipit-source-id: 174dff86f6d1ad8228491c15e226986dad2edb1b
2025-03-26 20:35:13 -07:00
Tim YungandFacebook GitHub Bot 4a7946bef5 Animated: Pass Target into {dis,}connectAnimatedView (#50229)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50229

Makes a few internal improvements to `AnimatedProps`:

- Change `__connectAnimatedView` and `__disconnectAnimatedView` to be private methods, so that we can confidently change their type signatures.
- Pass `#targetInstance` into those methods, so that the responsibility of verifying `#targetInstance`'s non-nullability is hoisted to the call sites.

There should be no observable runtime behavior change.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D71740601

fbshipit-source-id: 6abc6faf63f3c3274fd2d92baf0958d2471d4a63
2025-03-26 20:05:28 -07:00
Tim YungandFacebook GitHub Bot c9ff9570ab Animated: Type #animatedView in AnimatedProps (#50228)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50228

Properly annotate the type of `#animatedView` in `AnimatedProps` and rename it to `#targetInstance`.

Otherwise, no runtime behavior change.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D71739606

fbshipit-source-id: c97e4bd323ad9b1c08fd4976f13b6b20e8fe4793
2025-03-26 20:05:28 -07:00
Danny SuandFacebook GitHub Bot f3a5d1957a Don't throw again in JsErrorHandler
Summary:
JsErrorHandler throwing again masks what the real problem is.

Changelog: [Internal]

Reviewed By: tmikov

Differential Revision: D71920942

fbshipit-source-id: 1697f6f4c779d5c896df1be8e696a185f1c2c828
2025-03-26 19:35:02 -07:00
Nick GerlemanandFacebook GitHub Bot 177b8b4c40 Move CornerRadii resolution logic out of LengthPercentage (#50306)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50306

`LengthPercentage` is a class representing a length, or a percentage of a reference length.

Having a function on it, specific to resolving asymetrical corner radius is the wrong organization. Let's move it to where it belongs.

Very technically breaking, but I would be shocked if anyone is using this API.

Changelog: [Internal]

Reviewed By: jorge-cab

Differential Revision: D71922893

fbshipit-source-id: 4660c861e21c1dffae15d3f463c135a494124e2a
2025-03-26 19:29:24 -07:00
Tim YungandFacebook GitHub Bot a8a4ab10d0 RN: Ship disableInteractionManager (#50233)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50233

Ships the `disableInteractionManager` feature flag, which disables `InteractionManager` and replaces its scheduler with `setImmediate`.

Changelog:
[General][Changed] - InteractionManager is deprecated and will be removed in a future release. Its behavior has been changed to be the same as `setImmediate`, and callers should migrate away from it.

Reviewed By: javache

Differential Revision: D71766877

fbshipit-source-id: 36710fdf17c92f8cdee141e43a3c4d0bd9ef0e81
2025-03-26 17:59:40 -07:00
Alex HuntandFacebook GitHub Bot 116437e46e Support CDP Response.statusText (#50174)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50174

Add `httpReasonPhrase` util and use to populate CDP `Response.statusText` value.

AFAIK, neither platform, and none of our dependencies, reliably provide this mapping — so this is implemented directly.

Changelog: [Internal]

Reviewed By: vzaidman

Differential Revision: D71470037

fbshipit-source-id: f3f6437d0fb3227858b5910a71170e3a634aa962
2025-03-26 15:40:42 -07:00
Alex HuntandFacebook GitHub Bot 4a055e4812 Configure prod version of NetworkReporter (#50286)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50286

Configures a thinner version of `NetworkReporter.cpp` (the entry point to `jsinspector_network`) in production builds (i.e. dev or profiling build, as gated by `REACT_NATIVE_DEBUGGER_ENABLED`).

Even though enabling the CDP Network domain isn't reachable in prod, this will reduce the compiled code footprint of `jsinspector_network`.

We also don't need `glog` here any more — remove dep.

**Implementation notes**

The reason to gate the logic within each method, with inline `#ifdefs`, rather than swapping between complete implementation files, is because each `report*` function will also have load-bearing logic (for the Performance API) in all prod builds. Therefore, this will reduce duplication (and file switching) down the line — and can be understood at a glance with this pattern.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D71636694

fbshipit-source-id: 50e7c008bb6fd128fe1248d767832b36ccb0219b
2025-03-26 15:40:42 -07:00
Alex HuntandFacebook GitHub Bot c91cafae32 Refactor NetworkReporter internals (#50173)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50173

Refactors the internals of `NetworkReporter` (and the `jsinspector_network` library) to better organise concepts before we scale to more Network CDP events.

- Introduces `cdp::network` structs modelling CDP `Network` domain events and data types.
- Moves implementation details in converting input data objects to CDP types into `CdpNetwork.cpp` and `HttpUtils.cpp`.

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D71470039

fbshipit-source-id: 0c04ffb40efbbb6d6d9782959f5adb33c9097ccb
2025-03-26 15:40:42 -07:00
Ramanpreet NaraandFacebook GitHub Bot 7d739ae89c Migrate modules off lazy main queue setup
Summary:
These modules don't actually use ui things in their setup. So, they don't need to be set up on the main queue.

Changelog: [Internal]

Reviewed By: lyahdav

Differential Revision: D71849447

fbshipit-source-id: d9d6ee043cac112731c27ff920e857fccdd54bc0
2025-03-26 15:16:45 -07:00
Ramanpreet NaraandFacebook GitHub Bot b432e4cb16 Make Appearance use main queue setup (#50110)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50110

## Rationale
Rendering can now include main -> js sync calls.

If we allow js -> main sync calls during rendering, react native can deadlock.

So, this diff moves the js -> main sync calls to "main queue module setup", which occurs before rendering.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D71347452

fbshipit-source-id: 894f21c703981c633fc0966e1edd647251d0fe2c
2025-03-26 15:16:45 -07:00
Tim YungandFacebook GitHub Bot 6346689c3d RN: Remove eslint-config-prettier Overrides (#50302)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50302

Changes `eslint-config-react-native` to stop overriding rules that are disabled by `eslint-config-prettier`, which disables rules that conflict with Prettier formatting.

This also adds a Jest unit test to enforce that this invariant even as the configs change.

Changelog:
[General][Changed] - `eslint-config-react-native` now respects rules disabled by `eslint-config-prettier`.

Reviewed By: kassens

Differential Revision: D71922014

fbshipit-source-id: 55ba46e880d6129a417e864ab2fbb5704c57997b
2025-03-26 15:10:22 -07:00
zhongwuzwandFacebook GitHub Bot 62536db8c7 Fabric: Fixes color hash type to prevent bits truncation (#50285)
Summary:
I made a mistake before, it seems we should use std::size_t to prevent bits truncation.

## Changelog:

[IOS] [FIXED] - Fabric: Fixes color hash type to prevent bits truncation

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

Test Plan: N/A

Reviewed By: javache

Differential Revision: D71895413

Pulled By: cipolleschi

fbshipit-source-id: 26cc036bee851902e11abfa8ed5c5c8222421b09
2025-03-26 14:13:19 -07:00
Alex HuntandFacebook GitHub Bot 1c04cf5ca0 Minimize operations in RCTInspectorNetworkReporter in prod (#50242)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50242

Similar to D71636694, adds conditional compile to `RCTInspectorNetworkReporter.mm` to minimize code size and operations performed in production builds.

Specifically:

- Expensive copy of `httpBody` is eliminated.
- Other optional fields that are only mapped when CDP support is enabled are also omitted.

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D71637716

fbshipit-source-id: 6c7688b1ac82d2b1047b42a812834a7dfb37cd0f
2025-03-26 12:25:00 -07:00
Alex HuntandFacebook GitHub Bot 793094fc0f Implement core Network CDP events on iOS (#50142)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50142

This is a first pass at integrating `NetworkReporter` in our networking stack on iOS (`RCTNetworking.mm`).

**Implemented events**

Wires up minimal events sufficient to populate the Chrome DevTools Network panel:

- `Network.requestWillBeSent`
- `Network.responseReceived`
- `Network.loadingFinished`

**Other notes**

`RCTNetworking` is used (tentatively) as the integration point since it:

- Is the default implementation for the network stack on iOS.
    - Should allow us to pair with originating JS call site down the line.
- Intercepts Blob requests (at least `RCTImageLoader`).
- Sits outside the user-configurable `RCTNetworkingResponseHandler` and `RCTNetworkingRequestHandler` concepts.
- Is where network events are currently sent to JavaScript (`sendEventWithName`).

NOTE: Reminder: `NetworkReporter` is currently a no-op without the `fuseboxNetworkInspectionEnabled` experiment set.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D71470038

fbshipit-source-id: 069d77473c333a98f796b3dffa670a39b3016b2b
2025-03-26 12:25:00 -07:00
Rubén NorteandFacebook GitHub Bot bcce235841 Add basic tests for Event Timing API (#50289)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50289

Changelog: [internal]

Adding basic Fantom tests for the new Event Timing API.

Reviewed By: huntie

Differential Revision: D71734778

fbshipit-source-id: b5da3162fade64eadede72346af50df68b4facd9
2025-03-26 11:09:42 -07:00
Rubén NorteandFacebook GitHub Bot 499eef1fc8 Rename LongTask as LongTasks in test (#50290)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50290

Changelog: [internal]

Small rename as the official name of the API is LongTasks.

Reviewed By: yungsters

Differential Revision: D71734777

fbshipit-source-id: fac085e3b0d304f7d05087143c15d32cf2b0971b
2025-03-26 11:09:42 -07:00
Joe VilchesandFacebook GitHub Bot 33bd90e07c Improve accessibilityOrder algo on iOS (#50265)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50265

This is a fun one!

"Improvements" consist of
* Performance is better now. Previously we did a tree walk for each ID in the array, now its just one :)
* Properly handles coopting (more on that below)

**Performance**
The previous implementation naively walked the tree until it found the right nativeId for each nativeId in the prop. This new algo just does a single tree walk and collects the views that have the right nativeIds as we are doing that walk.

**Coopting**
Our iOS code implements a form of accessibility coopting, where an element can "speak for" a descendant. This happens when some parent element does not have an accessibility label but a descendant does. We look at the subtree and grab every node that has a label and lift it up to the aforementioned element without a label. This enables some nice a11y features like wrapping `Text` in a `View` and letting the `View` just read all the `Text` inside (imagine a button with a label, you would only want to focus the button and just read the text instead of the text itself).

This feature is nice but it becomes buggy when we introduce `accessibilityOrder`. Previously, there was no way to access nested elements on iOS, the platform prohibits this. However, you can get around this by using `accessibilityElements`, which our `accessibilityOrder` prop maps to. So you could define the order as `['parent', 'child']` and access both elements just fine. However, if that `parent` is a `View` that coopts `Text`, we have some issues. The `View` will read the `Text` but then when the user swipes we focus the `Text` and read it again!

To get around this we check up the superview chain in RCTParagraphViewComponentView looking for Views that might coopt us and a cooresponding accessibilityElements with said candidates. If there is such a View we do not announce ourselves. Performance is iffy here, we need to iterate up to root for all text focusing, but this should be fairly fast for all intents and purposes and I have not noticed any lag when changing focus ordering.

Changelog: [Internal]

Reviewed By: jorge-cab

Differential Revision: D71562476

fbshipit-source-id: 31fd935df0764459403464bd645aae2e664c69cb
2025-03-26 11:08:36 -07:00
Alex HuntandFacebook GitHub Bot 701859b397 Deprecate *EventData types in favour of *Event (#50215)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50215

Backwards compatible updates to `CoreEventTypes`, `Image`, `Switch`, `TextInput` to align types and reduce root exports.

The effects of this change can be seen in `packages/react-native/types/__typetests__/index.tsx` (smoke test file against current manual TypeScript definitions).

Under Flow, exports on each `*EventData` type are directly removed (unreferenced).

Changelog:
[General][Deprecated] - Deprecate `*EventData` types on `Image`, `Switch`, `TextInput` components. These can be substituted for `*Event`, e.g. `NativeSyntheticEvent<ImageLoadEventData>` becomes `ImageLoadEvent`.

Reviewed By: NickGerleman

Differential Revision: D71734361

fbshipit-source-id: 287c775e840319242984d248169c267abf8f032b
2025-03-26 09:55:33 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 515976cb4a Have react-hermes and React-renderercss define modules (#50283)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50283

In OSS we have some libraries written in Swift, like Flashlist, that depends on these pods.

However, if a pod is not configured to define modules, those pods cannot be imported by Swift. Therefore, the libraries above will failed to be installed in a project.

This change adds the defines_modules directive to those pods and make the library work again.

This fixes https://github.com/facebook/react-native/issues/50246

## Changelog
[Internal] - Make React-hermes and React-renderercss defines modules

Reviewed By: fabriziocucci

Differential Revision: D71892679

fbshipit-source-id: b03b65986fbdbe781b616f31dfb6bceb38b8b3b7
2025-03-26 08:25:25 -07:00
Tim YungandFacebook GitHub Bot 2abe623d9f Animated: Omit allowlist in avoidStateUpdateInAnimatedPropsMemo Experiment (#50232)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50232

While reviewing the `avoidStateUpdateInAnimatedPropsMemo` experiment, I noticed that the control and test groups were invoking `areCompositeKeysEqual` differently:

- Test group was passing in `allowlist`.
- Control group was not passing in `allowlist`.

Passing it in is technically more correct, but let's restore the control group behavior for now to isolate the tested changes.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D71746745

fbshipit-source-id: aa34db0532ef53ead08bbd632aab0994b31b9340
2025-03-26 08:07:53 -07:00
Mateo GuzmánandFacebook GitHub Bot 8b449c2694 Migrate GuardedRunnable to Kotlin (#50259)
Summary:
Migrate com.facebook.react.bridge.GuardedRunnable to Kotlin.

## Changelog:

[INTERNAL] - Migrate com.facebook.react.bridge.GuardedRunnable to Kotlin

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

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

Reviewed By: javache

Differential Revision: D71846384

Pulled By: Abbondanzo

fbshipit-source-id: b465ce107f9a32e273442644ef6079347fe7e401
2025-03-26 07:30:22 -07:00
Mateo GuzmánandFacebook GitHub Bot c372dc1ec8 Migrate GuardedAsyncTask to Kotlin (#50254)
Summary:
Migrate com.facebook.react.bridge.GuardedAsyncTask to Kotlin.

## Changelog:

[INTERNAL] - Migrate com.facebook.react.bridge.GuardedAsyncTask to Kotlin

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

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

Reviewed By: javache

Differential Revision: D71846375

Pulled By: Abbondanzo

fbshipit-source-id: e4befe99333512312d1930b09b1edd9501a2f80a
2025-03-26 07:25:09 -07:00
Mateo GuzmánandFacebook GitHub Bot 9a5a67912b Migrate CallbackImpl to Kotlin (#50263)
Summary:
Migrate com.facebook.react.bridge.CallbackImpl to Kotlin.

## Changelog:

[INTERNAL] - Migrate com.facebook.react.bridge.CallbackImpl to Kotlin

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

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

Reviewed By: javache

Differential Revision: D71855490

Pulled By: Abbondanzo

fbshipit-source-id: 72f15083010601b56f415493d58fc557f3ab35ef
2025-03-26 07:20:15 -07:00
Vitali ZaidmanandFacebook GitHub Bot 2bc0fe621d Update debugger-frontend from 46feed4...26e19a4 (#50277)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50277

Changelog: [Internal] - Update `react-native/debugger-frontend` from 46feed4...26e19a4

Resyncs `react-native/debugger-frontend` from GitHub - see `rn-chrome-devtools-frontend` [changelog](https://github.com/facebook/react-native-devtools-frontend/compare/46feed41c15bcaafa086c1397562fa2af7cc503b...26e19a44bd2a55668effe4fdf7c0fef42b1944b7).

Reviewed By: hoxyq

Differential Revision: D71888932

fbshipit-source-id: e968d2a4bbb325354bc9ab265f0e8c1d48eef7d4
2025-03-26 05:50:22 -07:00
Jorge Cabiedes AcostaandFacebook GitHub Bot 8184ed634e Add OnHierarchyChangeListener to accessibilityOrder parent to track changes in hierarchy (#50261)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50261

Since now we have the optimization of only running the custom accessibility order when we define the tree as dirty we need to add a hierarchy change listener on all ViewGroups within the parent to notify accessibility services of potential changes in hierarchy and so mark the subtree as dirty.

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D71821636

fbshipit-source-id: 25649efa1679024a205e94c340511dc58783d575
2025-03-26 05:42:16 -07:00
Jorge Cabiedes AcostaandFacebook GitHub Bot 8cf4d5b531 Finish adding accessibilityOrder to ReactNative (#50255)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50255

Few details where missing for fully enabling accessibilityOrder on ReactNative

Changelog: [General][Added] Add accessibilityOrder to iOS and Android

Reviewed By: joevilches

Differential Revision: D71420768

fbshipit-source-id: 110ba4c42adc193b34e200aab5dd059badbc2e62
2025-03-26 05:42:16 -07:00
Dawid MałeckiandFacebook GitHub Bot 0a58bb569b Align flattenStyle to accept animated styles (#50250)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50250

Aligned flattenStyle to also accept Animated styles.

Changelog:
[Internal] - Aligned flattenStyle to accept animated styles.

Reviewed By: huntie

Differential Revision: D71814372

fbshipit-source-id: 3bfb5f1dcd8e6dd3d38dca547b69a3c43b87b356
2025-03-26 03:02:52 -07:00
Dawid MałeckiandFacebook GitHub Bot 5ba3aacaf7 Remove StrictAnimatedComponentType from createAnimatedComponent (#50240)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50240

StrictAnimatedComponentType was introduced to incrementally adopt sctricter animated types at the time. After aligning AnimatedProps it is no longer necessary and can be swapped with AnimatedProps.

Changelog:
[Internal] - Removed StrictAnimatedComponentType from createAnimatedComponent.

Reviewed By: huntie

Differential Revision: D71804845

fbshipit-source-id: e8adbfde1a48fd3f4fc94f4cc0938bd64384c418
2025-03-26 01:22:32 -07:00
Vitali ZaidmanandFacebook GitHub Bot 590426da14 don't strip IWebSocket or it's members in release builds
Summary:
Changelog:
[General][Internal]

Reviewed By: Abbondanzo

Differential Revision: D71815485

fbshipit-source-id: cba6d4907ccdd366b31edfb74ca1f6001f970739
2025-03-25 23:56:38 -07:00
Sam ZhouandFacebook GitHub Bot 171c6808b9 Align react-native jest definition with internal jest definition (#50272)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50272

Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D71849789

fbshipit-source-id: 5b600c4371a21a28272538022234e2cc01e8d92b
2025-03-25 19:13:58 -07:00
Zeya PengandFacebook GitHub Bot e7b3424cce Add feature flag useCxxNativeAnimated (#50038)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50038

Changelog: [Internal]

Creating a new feature flag to gate change for integrating c++ native animated

Reviewed By: rozele

Differential Revision: D71216797

fbshipit-source-id: 9669628a0789701ab6d447a8561027f3a335ef4f
2025-03-25 18:51:52 -07:00
Sam ZhouandFacebook GitHub Bot a70fe45370 Shim $PropertyType in react-native for now (#50271)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50271

In the next version of Flow, support for `$PropertyType` will be removed in favor of indexed access types. The final 2 usages in react-native is in `ReactNativeTypes`, which is synced from upstream react. Sync of https://github.com/facebook/react/pull/32733 is currently blocked by test failures, so I will add the temporary shim to unblock releases.

Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D71849353

fbshipit-source-id: d4787fe17ae52aa50d54f9fb7fb8b14c149aa1e6
2025-03-25 18:08:26 -07:00
Rubén NorteandFacebook GitHub Bot 7d8ac6639f Move ensureInstance and isUnreachable to tests utilities directory (#50260)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50260

Changelog: [internal]

Created new directory `react-native/src/private/__tests__/utilities` and moved `ensureInstance` and `isUnreachable` to it.

Reviewed By: yungsters

Differential Revision: D71826787

fbshipit-source-id: 50a50a54ab928c9060282a9f2256ad97dd856ba4
2025-03-25 17:09:18 -07:00
Rubén NorteandFacebook GitHub Bot 3331218b84 Fix several tests and grouping in Fantom-itest (#50258)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50258

Changelog: [internal]

Minor reordering of tests in `Fantom-itest`, fix of describe block for  `enqueueScrollEvent` and fix incorrect usage of `enqueueScrollEvent` instead of `scrollTo` in `scrollTo` tests.

Reviewed By: yungsters

Differential Revision: D71820977

fbshipit-source-id: 07637e2d18cde96c78c83285ba28201260e42f3c
2025-03-25 17:09:18 -07:00
Rubén NorteandFacebook GitHub Bot b12ab7a3d4 Enforce that WeakRef.deref() is always called within the event loop (#50257)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50257

Changelog: [internal]

## Context

We have some tests that make sure certain objects are deallocated/released at the right times, but those are generally hard to get right. The main reason is that WeakRefs semantics are tied to the tasks and microtasks in JS, but we handle them both inside and outside the Event Loop in Fantom tests.

This leads to some surprising behavior where things we expect to have been deallocated weren't because of some innocent looking code.

## Changes

This introduces a safety mechanism in Fantom to enforce that WeakRefs are always dereferenced inside the Event Loop, by patching the method in `WeakRef` and checking if we're in the Event Loop using Fantom APIs.

It also updates the existing test using WeakRefs to fix the new errors thrown by this patch, and to serve as a "good example" on how to use WeakRefs to do memory testing.

Reviewed By: yungsters

Differential Revision: D71815397

fbshipit-source-id: 8faab1898d9112ec365b41867179abb8b251e337
2025-03-25 17:09:18 -07:00
Pieter De BaetsandFacebook GitHub Bot d1c0f57073 Simplify event emitter layering (#50219)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50219

* Make FabricEventDispatcher private, we already have a public EventDispatcher interface
* Rename ReactEventEmitter to EventEmitterImpl, to make it clearer it aligned with EventDispatcherImpl
* Update docs to make it clearer what's part of the old architecture

Changelog:

[Android][Removed] Removed FabricEventDispatcher from public Android API
[Android][Removed] Removed (un)registerEventEmitter from EventDispatcher interface

Reviewed By: lenaic

Differential Revision: D71735505

fbshipit-source-id: f0b56298cc38d08101ccdcdf0bda5487204e7bdc
2025-03-25 14:53:36 -07:00
Mateo GuzmánandFacebook GitHub Bot 175c969148 Migrate ReactRawTextShadowNode to Kotlin (#50234)
Summary:
Migrate com.facebook.react.views.text.ReactRawTextShadowNode to Kotlin.

## Changelog:

[INTERNAL] - Migrate com.facebook.react.views.text.ReactRawTextShadowNode to Kotlin

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

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

Reviewed By: rshest

Differential Revision: D71803869

Pulled By: javache

fbshipit-source-id: dba9eea7aa8453b9372cbeb54a7f86b35fd30905
2025-03-25 14:46:06 -07:00
Sam ZhouandFacebook GitHub Bot cbd2ee55ef Eliminate $PropertyType and $ElementType in react-native (#50262)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50262

Prepare for their removal in Flow

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D71823860

fbshipit-source-id: e1e18424ae731cd323999316a7f3a5d42f4b5b91
2025-03-25 14:00:17 -07:00
Eric RozellandFacebook GitHub Bot c920b7f54a Do not register RCTSurfacePresenterObserver for animatedShouldSignalBatch (#50247)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50247

Rather than nooping the RCTSurfacePresenterObserver in RCTNativeAnimatedTurboModule, we should just not register the observer when using ReactNativeFeatureFlags::animatedShouldSignalBatch.

## Changelog

[Internal]

Reviewed By: shwanton

Differential Revision: D71735004

fbshipit-source-id: 5176497197314a9b07fc9bd77828f7a2af2650ea
2025-03-25 13:19:36 -07:00
Joe VilchesandFacebook GitHub Bot bffb414291 Allow link role to be announced if its set on entire text in nested text (#50236)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50236

If you do something like

```
<Text>
  <Text accessibilityRole="link">
    I am a link!
  </Text>
</Text>
```

we do not announce "link".

We skip any sort of spans on the entire text on iOS, which I feel like is not ideal. This case would be common enough, and users may not have access to the top level text component.

Note Android correctly handles this already.

Changelog: [iOS] [Fixed] - Correctly announce "link" on nested text if its the entire text element

Reviewed By: javache

Differential Revision: D71770798

fbshipit-source-id: 4a0781a95cb27cf244d6d2b1d1df8a0451964301
2025-03-25 12:56:47 -07:00
generatedunixname89002005287564andFacebook GitHub Bot 0437c4071b Fix CQS signal. Id] 22447575 -- modernize-use-nullptr in xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/jni/react/jni (#50256)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/50256

Reviewed By: dtolnay

Differential Revision: D71798310

fbshipit-source-id: 233822abac4288ab5871718671936bbbd6d571ff
2025-03-25 12:34:59 -07:00
Alex HuntandFacebook GitHub Bot a0bc9a84d9 Use UIDevice systemName for inspector metadata (#50245)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50245

Follows D69867335, but uses the system `[[UIDevice currentDevice] systemName]` API to get the case sensitive OS name (as opposed to the `RCTPlatformName` concept, which is lowercase "ios").

Ultimately, this value is displayed as a user facing label in the debugger.

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D71809427

fbshipit-source-id: 3f62bba94df16329c934a7671bcaa489c6797cb6
2025-03-25 11:55:17 -07:00
Jakub PiaseckiandFacebook GitHub Bot b2d88d33b7 Align SectionList types with OSS (#50074)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50074

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D71318882

fbshipit-source-id: ac26820bd4a9200c4156b703dce036535f677025
2025-03-25 11:03:54 -07:00
Jakub PiaseckiandFacebook GitHub Bot e27c97bc56 Update StyleSheet and Platform exports (#50169)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50169

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D71548325

fbshipit-source-id: b0c6cc0dc3b15757f0630d7ef8398161a46c51a8
2025-03-25 10:28:13 -07:00
Dawid MałeckiandFacebook GitHub Bot 3bb86b0ecf Change Animated re-export to generate correct namespace in TS (#50222)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50222

The flow-api-translator will generate

```ts
export * as default from './AnimatedExports';
```

in TS which preserves the namespace. Previous import, export translated to:

```ts
declare const $$EXPORT_DEFAULT_DECLARATION$$: typeof Animated;
declare type $$EXPORT_DEFAULT_DECLARATION$$ =
  typeof $$EXPORT_DEFAULT_DECLARATION$$;
export default $$EXPORT_DEFAULT_DECLARATION$$;
```

which dropped the `Animated` namespace.

Changelog:
[Internal]

Reviewed By: huntie

Differential Revision: D71737199

fbshipit-source-id: a46a7ddddd023fa831cd4bb50f17a0641f328066
2025-03-25 03:47:30 -07:00
Dawid MałeckiandFacebook GitHub Bot 9c5cf4e9c4 Align AnimateProps to match TS types (#50214)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50214

This diff is a second step toward the TS AnimatedProps alignment. In this change the rest of the extended types and recursions in `WithAnimatedValue` are applied.

Changelog:
[Internal] - Aligned AnimateProps to match TS types.

Reviewed By: huntie

Differential Revision: D71623036

fbshipit-source-id: d4777e25c3bf3119608938ee4cd246cdc4c4f7ee
2025-03-25 03:47:30 -07:00
Dawid MałeckiandFacebook GitHub Bot eb2d9c1ac0 Check for Builtin and Nullable types in WithAnimatedValue to align closer to TS types (#50195)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50195

In Flow, all AnimatedProps properties are set to `any` and misaligned with Typescript definitions. This diff is a first step toward the TS AnimatedProps. The problem can be broken down into a few parts, at each point more types will be extended in WithAnimatedValue and the rest will be set to `any`. This approach enables smoother migration and validation.

Changelog:
[Internal] - Check for Builtin and Nullable types in WithAnimatedValue to align closer to TS types.

Reviewed By: huntie

Differential Revision: D71551006

fbshipit-source-id: 9316227f4ba32bdaa5be8097483a03ae19bf516f
2025-03-25 03:47:30 -07:00
Pieter De BaetsandFacebook GitHub Bot e104532357 Cleanup fixDifferentiatorEmittingUpdatesWithWrongParentTag (#50221)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50221

This was already rolled out by default previously, but we wanted to complete further testing internally before cleaning up the flag.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D71735311

fbshipit-source-id: b9d32787081fbe3d7fb740067d3709624028fa23
2025-03-24 20:25:19 -07:00
Sam ZhouandFacebook GitHub Bot be7abbcf3f Minor fixes for jest libdef (#50235)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50235

- Remove duplicate definition for `toBeCalledWith` and `lastCalledWith`.
- Replace `typeof undefined` with `void`
- Make some Array types readonly where we can.

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D71762238

fbshipit-source-id: 5c20bd7e941a8c36084e291f23cd6caa27f07eb9
2025-03-24 15:32:25 -07:00