Commit Graph

12270 Commits

Author SHA1 Message Date
Ruslan Lesiutin ff4f4c8331 chore: cleanup duplicate import and typo in PerformanceTracer (#51681)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51681

# Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D75608626

fbshipit-source-id: 97236cd35afd1cd9955bf54a6fca4f19fde3007a
2025-05-29 10:37:19 -07:00
Tim Yung e7a9322bdf RN: Flowify packages/react-native-scripts (#51671)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51671

Adds `flow` (or `noflow`) to all files in this directory and ensures that Flow succeeds (by adding type annotations, using minor refactors, or suppressing errors due to intentionally dynamic logic).

This will help improve type safety when making changes both in these files as well as files that these depend on.

Changelog:
[Internal]

Reviewed By: SamChou19815

Differential Revision: D75581879

fbshipit-source-id: 6dcd8cc55d0021973eeae2670c1ebceb6d69fa8f
2025-05-29 07:52:38 -07:00
Tim Yung 1fd9508ecc RN: Refactor Jest Default Mocks (#51669)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51669

Refactors the default mocks initialized in `packages/react-native/jest/setup.js` so that each mock is defined in its own file.

This provides several benefits, including:

- The ability to use `import` statements without worrying about eager initialization of dependencies before `globals` is setup.
- The ability to verify mocks export the same types as the actual module, using a new Flow-typed `mock` helper function.
- The ergonomic of implementing mocks with more complex logic, without having to split them out into a separate module (e.g. `mockModal`, `mockScrollView`).

As part of this migration, I also fixed any minor discrepancies to match the actual type definition. For more involved discrepancies (e.g. missing methods), I added type suppressions for now to minimize breaking changes.

Changelog:
[General][Changed] - Improved default mocking for Jest unit tests.

Reviewed By: javache

Differential Revision: D75575421

fbshipit-source-id: 98d60e10b753f1505ffdccf5f12f5d3ef306ebb5
2025-05-29 07:52:38 -07:00
Samuel Susla 5bf7eb847c clean up AnimationDriverUtils (#51674)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51674

changelog: [internal]

just a clean up of code in AnimationDriverUtils and removal of unused headers.

Reviewed By: mdvacca

Differential Revision: D75549612

fbshipit-source-id: a8ad63622478d06318b6304b886554478b43d19b
2025-05-29 07:36:26 -07:00
Samuel Susla 014f212bce convert AnimatedModule away from lambdas (#51659)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51659

changelog: [internal]

use std::variant in AnimatedModule to generate smaller C++ binary.

Reviewed By: javache, mdvacca

Differential Revision: D75379819

fbshipit-source-id: 4dc8bbf6e2cdb7aa9080a27526ca9d43d155b5d7
2025-05-29 05:43:10 -07:00
Tim Yung d626d5b623 RN: Delete nullthrows Import in MutationObserver (#51672)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51672

Deletes an unused import.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D75583225

fbshipit-source-id: be57005f5647234acf450c13345987da24e92696
2025-05-29 03:50:47 -07:00
Tim Yung 235b6b180a RN: Fix Unstable Component in FlatList-multiColumn (#51673)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51673

Fixes a lint warning that seems to inconsistently fire, by improving the code that it complains about.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D75583443

fbshipit-source-id: b6df191e2e51dee688df3f3c960704dea28a4ece
2025-05-29 02:59:01 -07:00
Mateo Guzmán a42631efad Migrate CoreModulesPackage to Kotlin (#51640)
Summary:
Migrate com.facebook.react.CoreModulesPackage to Kotlin.

## Changelog:

[INTERNAL] - Migrate com.facebook.react.CoreModulesPackage to Kotlin

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

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

Reviewed By: arushikesarwani94

Differential Revision: D75502816

Pulled By: alanleedev

fbshipit-source-id: 0914adf0b7c5c082a283d9abac595783887da268
2025-05-29 01:56:29 -07:00
Peter Abbondanzo 3d7973a3e6 Add focus/blur example to RNTester (#51634)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51634

Creates an example in the ViewExample setup for how onBlur/onFocus behave when using keyboard navigation

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D75238317

fbshipit-source-id: e69122ca17727fc7f71e9bb7a09098a2771b098e
2025-05-28 21:29:51 -07:00
Peter Abbondanzo af0a76cf5f Add support for blur and focus on View (#51570)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51570

As the title suggests: adds support strictly to `View` components on Android for `onFocus` and `onBlur` events. This is especially helpful for apps that respond to controller or remote inputs and aligns with existing support for the `focusable` prop.

In order to make this change cross-compatible with text inputs, `TextInputFocusEvent` has been deprecated in favor of the `BlurEvent`/`FocusEvent` types now available from core. Their type signatures are identical but `BlurEvent`/`FocusEvent` should be the type going forward for all views that intend to support focus/blur. Text inputs intentionally do not forward information about their state upon focus/blur and docs specifically call out `onEndEditing` as a means of reading state synchronously when blurring. Therefore, the changes to the native side to remove the event type specifically for text inputs is not breaking.

Changelog: [Android][Added] - Support for `onFocus` and `onBlur` function calls in `View` components

Reviewed By: mdvacca

Differential Revision: D75238291

fbshipit-source-id: b991d1f24fc094ba9d5d466201ecd058f59258e9
2025-05-28 21:29:51 -07:00
Nick Gerleman dd9d7c0e74 Add Tests for layout events of ellipsized Text (#51666)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51666

The platforms handle this in pretty different ways right now. Let's add a test showing the differences.

Android also adds a bunch of unicode zero width spaces in there...

Changelog: [Internal]

Reviewed By: mlord93

Differential Revision: D75567210

fbshipit-source-id: 98cac7d3fd23451868b55b69478e2667a2de3716
2025-05-28 19:20:55 -07:00
Nick Gerleman 9478c27a69 Add Flag to disable global text measure cache (#51654)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51654

Facsimile may or may not use a global measure cache. Adding flags to let us run experiment, to understand real-world performance impact, now that we have fixed some (but not all) of the issues which may lead to measurement invalidation in Fabric.

Also does some quick cleanup th `SimpleThreadSafeCache` to remove the cache key as part of the lambda, which is never used, and makes this change mildly less efficient, and to accept lambda by generic type instead of repacking into std::function which has runtime overhead.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D75509799

fbshipit-source-id: 165c08d626ab1f2758f0203d3a0d527a1a5106a7
2025-05-28 17:59:15 -07:00
Tim Yung b654417afd RN: Unnecessary $FlowFixMe for jest.now() (#51665)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51665

This type suppression comment is no longer necessary.

Changelog:
[Internal]

Reviewed By: SamChou19815

Differential Revision: D75546017

fbshipit-source-id: 8c1f6a4260f0ca83bcba200bf550746270578534
2025-05-28 17:24:01 -07:00
Ramanpreet Nara 0b8db7e5e8 Mitigate device info main queue modules crash (#51662)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51662

## Changes
DeviceInfo: Deafult fontScale to 1 when accessibility manager isn't available

# Analysis
**The problem:** For reasons that we don't understand, accessibility manager is sometimes nil, when deviceinfo needs it. This is a long-standing issue in react native.

```
  _constants = @{
    @"Dimensions" : [self _exportedDimensions],
    // Note:
    // This prop is deprecated and will be removed in a future release.
    // Please use this only for a quick and temporary solution.
    // Use <SafeAreaView> instead.
    @"isIPhoneX_deprecated" : @(RCTIsIPhoneNotched()),
  };
```

```
- (NSDictionary *)_exportedDimensions
{
  RCTAssert(!_invalidated, @"Failed to get exported dimensions: RCTDeviceInfo has been invalidated");
  RCTAssert(_moduleRegistry, @"Failed to get exported dimensions: RCTModuleRegistry is nil");
  RCTAccessibilityManager *accessibilityManager =
      (RCTAccessibilityManager *)[_moduleRegistry moduleForName:"AccessibilityManager"];
  if (!accessibilityManager) {
    return nil;
  }
  CGFloat fontScale = accessibilityManager ? accessibilityManager.multiplier : 1.0;
  return RCTExportedDimensions(fontScale);
}

```

**The crash:** When accessibility manager is nil, device info tries to insert nil into an NSDictionary, and crashes.

We found a possible repro of this issue: [launch facebook, log out, and log back in](https://www.internalfb.com/diff/D72020801?transaction_fbid=982516293994114).

**Why this surged now:** Recently, we started initializing device info during react native init. That means this code-path just runs much more often.

# Mitigation
Remove the return nil in `[self _exportedDimensions]`. Instead, just default the fontScale to 1 when the accessibility manager isn't available.

**This should be safe:** If we assume that accessibility manager eventually becomes available, the fontScale will eventually become correct. Device info will send the updated fontScale to js when it becomes available: [native](https://www.internalfb.com/code/fbsource/[ec6fd664a9cd]/xplat/js/react-native-github/packages/react-native/React/CoreModules/RCTDeviceInfo.mm?lines=231-232), [js](https://www.internalfb.com/code/fbsource/[ec6fd664a9cd]/xplat/js/react-native-github/packages/react-native/Libraries/Utilities/Dimensions.js?lines=120-125).

# Long-term fix
Understand why accessibility manager is nil.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D75537894

fbshipit-source-id: 921cc573fdfd7e5c340ac3a4ada268caadb9e382
2025-05-28 15:29:19 -07:00
Nick Gerleman 628c1333ea Disable hasOverlappingRendering in PreparedLayoutTextView (#51549)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51549

This is copied from `ReactTextView`, with a comment explaining the shenanigans.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D75248328

fbshipit-source-id: b325cf05e0000ee0b0c5fb82f0e7412a680e5d01
2025-05-28 15:18:33 -07:00
Jorge Cabiedes Acosta 2c04b54c05 Fix Custom Focus Ordering for FocusForward, FocusBackward and nested children (#51575)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51575

Before we were relying on absolute focus direction to determine the next focusable view inspired by Recycler View's implementation. This turned out to be inaccurate since FocusForward and FocusBackward do the ordering differently.

For FocusForward and FocusBackwards the children of the root node are ordered first from top to bottom then, row groups are created by getting views with the same vertical position and then everything else is sorted left to right.

Android creates an array with this order and then just focuses the next or previous element of this list. We don't do this but now FocusForward and FocusBackward follow the some comparisons used to build this array on Android.

Also, there was an issue with nested children within an accessible view, this just needed a bit of refactor on the focusSearch function so that we can tell when we actually need to trigger our custom focus search

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D75301251

fbshipit-source-id: 93b708092299afa778ba5938b093c2c38209b497
2025-05-28 14:34:22 -07:00
Samuel Susla 091eb2ea11 clean up interface of AnimationDriver (#51663)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51663

changelog: [internal]

mark getters as noexcept const and use `get` prefix.

Reviewed By: christophpurrer

Differential Revision: D75531202

fbshipit-source-id: d66132ee3ec459e73ab3dc33c726c73d5afb6e72
2025-05-28 14:18:24 -07:00
Tim Yung a4c2007068 RN: Flowify packages/react-native/jest (#51652)
Summary:
Adds `flow` (or `noflow`) to all files in this directory and ensures that Flow succeeds (by adding type annotations, using minor refactors, or suppressing errors due to intentionally dynamic logic).

This will help improve type safety when making changes both in these files as well as files that these depend on.

Changelog:
[Internal]

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

Test Plan:
Ran Flow and Jest tests successfully:

```
$ yarn flow
$ yarn test
```

Ran a Jest unit test internally to make sure they work with our internal environment setup:

```
$ cd ~/fbsource
$ js1 test /View-test.js
```

Reviewed By: javache

Differential Revision: D75488160

Pulled By: yungsters

fbshipit-source-id: 536cef9699acfa1edcd3dcf61c53ebcd92f560f9
2025-05-28 12:20:48 -07:00
Ramanpreet Nara 14a115282b IntersectionObserver: Only reset modern io, if it exists (#51510)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51510

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D75077634

fbshipit-source-id: d648a5e8c1de8efd44f4b1d2c44932bfebe0fbb3
2025-05-28 11:25:50 -07:00
Bartłomiej Błoniarz 1161fb4fcd Add cloneMultiple method to the ShadowNode class (#50624)
Summary:
This PR adds a new cloning method, allowing for updating multiple nodes in a single transaction. It works in two phases:
1. Find which nodes have to be cloned (i.e. nodes given on input and all their ancestors)
2. Clone nodes in the bottom up order - so that every node is cloned exactly once

So the idea is that when we want to update all the red nodes in this picture, we first find the nodes in the green area and the clone only them in the correct order (children are cloned before parents):
![Screenshot 2025-04-10 at 14 31 14](https://github.com/user-attachments/assets/f397eeff-8279-4d0c-bf87-083bfb44b86a)

Adapting this method [brought a huge performance gain to reanimated](https://github.com/software-mansion/react-native-reanimated/pull/6214). I want to upstream it, so that:
1. we can optimize it further, because making it a part of the `ShadowNode` class gives us access to the parent field in `ShadowNodeFamily` so we can traverse the tree upwards, allowing for a optimal implementation of the first phase (in reanimated we repeatedly call `getAncestors`, which revisits some nodes multiple times)
2. the community can use it

A naive approach that calls `cloneTree` for every node is much slower, as it has to repeat many operations.
## Changelog:

[GENERAL] [ADDED] - Added `cloneMultiple` to `ShadowNode` class.

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

Test Plan:
I tested it with the following reanimated implementation and everything works fine:

<details>

```c++
const auto callback =
      [&](const ShadowNode &shadowNode,
          const std::optional<ShadowNode::ListOfShared> &newChildren) {
        return shadowNode.clone(
            {mergeProps(shadowNode, propsMap, shadowNode.getFamily()),
             newChildren
                 ? std::make_shared<ShadowNode::ListOfShared>(*newChildren)
                 : ShadowNodeFragment::childrenPlaceholder(),
             shadowNode.getState()});
      };
  return std::static_pointer_cast<RootShadowNode>(
      oldRootNode.cloneMultiple(families, callback));

```

</details>

I would like to add tests for it, but I'm not sure what's the best approach for that in the repo.

Reviewed By: mdvacca

Differential Revision: D75284060

Pulled By: javache

fbshipit-source-id: 0704c4386c3041eb368adf6950d46de197479058
2025-05-28 10:55:00 -07:00
Arthur Kushka 56c1ab3253 Revert D75478125: jsi | remove redundant semi colon
Differential Revision:
D75478125

Original commit changeset: d5a9db25ebee

Original Phabricator Diff: D75478125

fbshipit-source-id: a5d06fccfb955cbb598e20c96f607b95b26795d1
2025-05-28 06:26:09 -07:00
Samuel Susla 7dda5512ff introduce opt out mechanism for View Culling (#51657)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51657

changelog: [internal]

Introduce a new ShadowNodeTraits: `Unstable_uncullableView` and `Unstable_uncullableTrace`. As the name suggests, this is not stable API yet.

When a shadow node sets this trait, it will be opted out of view culling together with its ancestors all the way to the root.

The trait is propagated to its parent in 4 different places:
1. When node is first created.
2. When node is cloned.
3. When child is appended.
4. When child is replaced.

we can safely do it only in those places because React constructs nodes from bottom up. We are leveraging this implementation detail here but if that changes in the future, a traversal will be required.

Alternative solution considered here was a traversal of shadow tree during commit phase to propagate `Unstable_uncullable` trait. This could be done in a separate traversal or as part of layout phase where layout information is copied out of Yoga tree. Leveraging the fact that React is cloning bottom up makes the implementation simpler.

If React changes its cloning approach in the future, this will be caught by tests.

Reviewed By: lenaic

Differential Revision: D75476847

fbshipit-source-id: f1e98804565c140c64945662af0247b1bd0e1882
2025-05-28 06:25:41 -07:00
Pieter De Baets 618ed98882 Set default XMLHttpRequest trackingName to undefined (#51656)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51656

This fixes an issue with the internal networking layer when `enableModuleArgumentNSNullConversionIOS` is enabled, as we'd try to  pass `NSNull` as trackingName instead of omitting it.
`
Changelog: [Internal]

Reviewed By: fabriziocucci

Differential Revision: D75516619

fbshipit-source-id: 91a3bba32772fdd66edde1e24b7edd977918f727
2025-05-28 05:41:51 -07:00
Samuel Susla 66730ae59e Fix crash in view culling when view is unflattened/flattened in deep hierarchy where each node has top offset (#51639)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51639

changelog: [internal]

### Fix Crash in View Culling

This diff fixes a crash that occurs when a view is unflattened or flattened in a deep hierarchy where each node has a top offset.

The problem is that nodes passed to *calculateShadowViewMutationsFlattener* via argument *unvisitedOtherNodes* have their positions calculated in a different coordinate space and the view culling algorithm does not have the correct data to determine visibility of a node. To fix this, we pass another argument to *calculateShadowViewMutationsFlattener* which does have original view culling context with which these nodes had their position calculated.

Reviewed By: javache

Differential Revision: D75455704

fbshipit-source-id: 925f14dfdc6c2b669c89e100629291921f27cd1e
2025-05-28 05:16:26 -07:00
Nicola Corti a6f24a5eaa Cleanup custom LOG_TAG in our CMakeLists files. (#51622)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51622

We currently support an optional 3rd params for `target_compile_reactnative_options` which allows to specify a LOG_TAG macro.
No one is actually reading that Macro. The only usage would be logging from the Android SDK which we don't explicitely use.

Here I'm updating our build to specify a LOG_TAG as `ReactNative` for all the targets without allowing to customize it as it just complicates our build setup.

Changelog:
[Internal] [Changed] -

Reviewed By: mdvacca

Differential Revision: D75445577

fbshipit-source-id: a426ce77ba6d1dfd0800e874d9f7838bfdc5b877
2025-05-28 02:36:26 -07:00
Arthur Kushka 17f1d91893 jsi | remove redundant semi colon (#51651)
Summary:
X-link: https://github.com/facebook/hermes/pull/1714

X-link: https://github.com/facebook/hermes/pull/1715

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

this breaks certain compilers/build setups in cpp

Reviewed By: NickGerleman

Differential Revision: D75478125

fbshipit-source-id: d5a9db25ebeecb229e157babf2117e8a2096e0d2
2025-05-28 02:33:18 -07:00
Ramanpreet Nara 19d7e40c97 Introduce featureflag for main queue coordinator
Summary:
Gating for "main queue coordinator": D74769326

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D74940621

fbshipit-source-id: e5b339bd13c2015432211380ecfce00791a27f9f
2025-05-28 00:25:46 -07:00
Ramanpreet Nara b8ce7b837f RuntimeExecutor: Create an ios fork of sync ui thread utils
Summary:
RuntimeExecutor.h has sync ui thread utils:
* executeSynchronouslyOnSameThread_CAN_DEADLOCK

The ios platform has js -> ui sync calls. This util, when it executes concurrently with those sync calls, deadlocks react native.

On ios, we're going to resolve these deadlocks, which'll involve customizing this util: D74769326. Therefore, this diff forks an implementation of these sync ui thread utils for ios.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D74901907

fbshipit-source-id: f502df4216e9ba57f458435c696a2f086becf24f
2025-05-28 00:25:46 -07:00
Nick Lefever 8f2e981ab7 Remove hard-coded component name listing for Props 2.0 support testing (#51633)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51633

To fully support props diffing for a component, the component's Props implementation needs to implement the prop diffing for the derived class.

Because all Props classes extend the ViewProps, all Props classes implement the `getDiffProps` function. To support testing that the props diffing implementation support all properties of the derived Props class for the component being mounted, this diff adds the virtual function `getDiffPropsImplementationTarget` which returns the `ComponentName` that the `getDiffProps` function supports.

This removes the need for a hard-coded list of components that support props diffing and enables the use of codegen to conditionally enable props diffing.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D75465020

fbshipit-source-id: 2850a76f1036cfe930c3c69b98d478ef86a2d457
2025-05-27 19:04:03 -07:00
David Vacca 3903ce0a48 Update format for codegen prop diffing (#51644)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51644

This diff updates the format for codegen prop diffing in Android

changelog: [internal] internal

Reviewed By: shwanton

Differential Revision: D75476172

fbshipit-source-id: ec1c68ae1eb652fe9986386302969f9258983d39
2025-05-27 17:55:11 -07:00
David Vacca da5d15ba0e Add support to diff ImageSource props (#51643)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51643

Add support to diff ImageSource props

/react-native/ReactCommon/react/renderer/imagemanager/primitives.h

changelog: [internal] internal

Reviewed By: javache

Differential Revision: D69497848

fbshipit-source-id: 56afe1d8601f7f4dc5dab815b6e534d7c63f651b
2025-05-27 17:55:11 -07:00
David Vacca ad0ea17ae9 Add support to diff Point props (#51650)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51650

This diff adds support to diff props with Point type

changelog: [internal] internal

Reviewed By: mlord93

Differential Revision: D75469451

fbshipit-source-id: a6844b691d8e32326d04c2bd51e6509980feb611
2025-05-27 17:55:11 -07:00
David Vacca 508610865b Assert ImageRequest is not used as a prop in codegen (#51642)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51642

This diff asserts that ImageRequest won't be used as prop type

changelog: [internal] internal

Reviewed By: mlord93

Differential Revision: D75469453

fbshipit-source-id: e9e46bc8806e00c104b76825445fe72779106220
2025-05-27 17:55:11 -07:00
David Vacca 20da141f5f Add support for diffing ColorPrimitive props (#51641)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51641

Add support for diffing ColorPrimitive props

changelog: [internal] internal

Reviewed By: rshest

Differential Revision: D69493546

fbshipit-source-id: 7ad6a28bd42014a771c168d8d6a6d2349629f670
2025-05-27 17:55:11 -07:00
David Vacca 26d40e40e1 Add support for diffing primitve type props (#51649)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51649

 Add support for diffing primitve type props

changelog: [internal] internal

Reviewed By: NickGerleman

Differential Revision: D69491368

fbshipit-source-id: 2b882b349e9d1bd3a9012bae3c3e0a06be2fa0e3
2025-05-27 17:55:11 -07:00
David Vacca 2df200db3f Extend getDiffProps method to support no changes of props (#51646)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51646

Extend getDiffProps method to support no changes of props

changelog: [internal] internal

Reviewed By: lenaic

Differential Revision: D69487497

fbshipit-source-id: 2cb91f1cc6cba84100750ce5dda5824824c923fe
2025-05-27 17:55:11 -07:00
David Vacca 3609d070eb Extend getDiffProps method to call HostPlatformViewProps (#51638)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51638

Extend getDiffProps method to call HostPlatformViewProps

changelog: [internal] internal

Reviewed By: lenaic

Differential Revision: D69487495

fbshipit-source-id: 4d2b508f116ec0618b42981c0880361c3d8a871a
2025-05-27 17:55:11 -07:00
David Vacca 1a43fd7927 Prototype to create getDiff method using codegen (#51637)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51637

Start prototype to create getDiff method using js codegen

changelog: [internal] internal

Reviewed By: rshest

Differential Revision: D69487496

fbshipit-source-id: 1547a7302381333bf9b005153b44de5621bc56c4
2025-05-27 17:55:11 -07:00
Nick Gerleman 6e8ce60bd4 Implement ReactCompoundView for PreparedLayoutTextView (#51551)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51551

This allows hit RN's hit testing to find nested spans, and click them.

This mechanism is fully separate from the one used by a11y virtual views, and ClickableSpan, such as those added for links via dataDetectorType (and also the `link` role).

When we do have a link accessibilityRole, that ClickableSpan hit test seems to prevent the React one, and we only activate the onPress once (but then add keyboard interaction, press visual, and add to the a11y tree).

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D75257326

fbshipit-source-id: 0c693f581ec121cf4b4e3e2040d141985118224f
2025-05-27 17:23:36 -07:00
Nick Gerleman 83226431c2 Remove ShadowNodeTraits::Trait::DirtyYogaNode (#51645)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51645

It's dead, Jim

Changelog: [Internal]

Reviewed By: lenaic

Differential Revision: D75324251

fbshipit-source-id: 869e81f0ae0064629ddd84b939a1e492e6646365
2025-05-27 15:26:27 -07:00
Tim Yung 2a13d20085 RN: Enable avoidStateUpdateInAnimatedPropsMemo by Default (#51635)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51635

Enables a feature flag by default, that reduces the memory usage of`Animated`. For more details, see: https://github.com/facebook/react-native/pull/49184

Changelog:
[General][Changed] - Enabled a feature flag that optimizes `Animated` to reduce memory usage.

Reviewed By: jehartzog

Differential Revision: D75466724

fbshipit-source-id: 3fdb57f394448bbd0530dcb558a58958010d0edd
2025-05-27 14:17:30 -07:00
Ramanpreet Nara 7ef278af50 RuntimeExecutor: Remove noexcept from sync ui thread utils (#51514)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51514

This util can execute arbitrary runtimeWork, which can throw.

In the future, we'll also make these utils execute ui blocks posted from the javascript thread. And those will be able to throw.

Therefore, let's remove the noexcept. Otherwise, if an exception bubbles up to this util, it will just crash this app.

Changelog: [General][Changed] - RuntimeExecutor:  Remove noexcept from sync ui thread utils

Reviewed By: javache

Differential Revision: D75183993

fbshipit-source-id: 6c3a319fe3a76165a265815e6343220cf9db6fde
2025-05-27 12:21:04 -07:00
Ramanpreet Nara 4974839be9 RuntimeExecutor: Use promises in sync ui thread utils (#51429)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51429

If we use promises, I believe the code is just easier to understand.

Changelog: [Internal]

Reviewed By: javache, yungsters

Differential Revision: D74941734

fbshipit-source-id: a9bc5ac715c84a5a92f8f1c6635ebef9fe538377
2025-05-27 12:21:04 -07:00
Nicola Corti 8a04ce6656 Migrate MapBuilder to Kotlin (#51626)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51626

This just migrates the `MapBuilder` file to Kotlin.
Users on Kotlin should still use the built-in collection extensions rather than using this class that will go away at some point in the future.

Changelog:
[Internal] [Changed] -

Reviewed By: fabriziocucci

Differential Revision: D75448739

fbshipit-source-id: 2bfa24ad9bd37bd571ea4551bd9a10e848841e0a
2025-05-27 12:09:16 -07:00
Rubén Norte 619f68b720 Do not log warning for missing feature flags native module in tests (#51629)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51629

Changelog: [internal]

The native module will never be defined in tests, so there's no point in logging this warning there.

Reviewed By: rshest

Differential Revision: D75451414

fbshipit-source-id: cdc1f674d01fcaf58c1c2342c994d95e6b3b6847
2025-05-27 11:37:43 -07:00
Riccardo Cipolleschi 254a918669 properly set dependencies on JSI and React-hermes (#51623)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51623

This fix relaxes some dependencies on React-hermes that should not be in the code.

## Changelog:
[Internal] - Remove dependencies from React-Hermes when they are not needed.

Reviewed By: cortinico

Differential Revision: D75447910

fbshipit-source-id: 6d7695f0e2b6c936b4c5ed9e70261f1d3b28a3d0
2025-05-27 10:22:08 -07:00
Nicola Corti 2578fd1356 Remove unnecessary OkHttpCompat (#51624)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51624

Let's remove this class and inline all the methods to the callsites.
This class was also public which would make this a breaking change but I couldn't find any meaningful usage:
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.network.OkHttpCompat

Changelog:
[Internal] [Changed] -

Reviewed By: javache

Differential Revision: D75448162

fbshipit-source-id: 9f4793809c9115a299ac72d79dbfb44073320d54
2025-05-27 09:51:24 -07:00
Nicola Corti 4487697971 Migrate OkHttpCompat to Kotlin (#51625)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51625

This just migrates this class to Kotlin, which is also the last class in this package.

Changelog:
[Internal] [Changed] -

Reviewed By: rshest

Differential Revision: D75448161

fbshipit-source-id: d5457dd8017fd459d166d2945ff440c303943db2
2025-05-27 09:51:24 -07:00
Mateo Guzmán 66aca66c88 Migrate ReactMarker to Kotlin (#51578)
Summary:
Migrate com.facebook.react.bridge.ReactMarker to Kotlin.

## Changelog:

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

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

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

Reviewed By: rshest

Differential Revision: D75442661

Pulled By: javache

fbshipit-source-id: f05f54f0f68b5a7012312225c28484d57accecf8
2025-05-27 07:43:54 -07:00
Mateo Guzmán 9218d1ed89 Fix InputAccessoryView example in dark mode and convert to functional components (#51583)
Summary:
As I reviewed some examples, I noticed that this one's dark mode could be improved, and the code could be modernised a bit as well by converting its classes into functional components.

## Changelog:

[INTERNAL] - Fix InputAccessoryView example in dark mode and convert to functional components

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

Test Plan:
<details>
<summary>Screenshots</summary>

| Dark | Light |
|--------|-------|
| ![Simulator Screenshot - iPhone SE (3rd generation) - 2025-05-24 at 17 39 16](https://github.com/user-attachments/assets/3ed7cb53-89d4-440d-ac4f-50816527774e) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2025-05-24 at 17 39 35](https://github.com/user-attachments/assets/94592d35-859d-4666-a836-977903e955af) |
</details>

Reviewed By: fabriziocucci

Differential Revision: D75404561

Pulled By: cortinico

fbshipit-source-id: 3318e9869919e99055e47b59c89de0b22976f142
2025-05-27 06:44:54 -07:00