Commit Graph

38536 Commits

Author SHA1 Message Date
Eric Rozell e344b4914c Unconditionally clear static LongLivedObjectCollection (#47891)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47891

Various C++ utilities for handling callbacks and promises rely on the static LongLivedObjectCollection. Even if a host platform injects it's TurboModuleBinding with a custom LongLivedObjectCollection, there's no guarantee that the platform is not also using C++ TurboModules that use the static LongLivedObjectCollection. Clearing both collections solves issues for TurboModuleBindings with custom LongLivedObjectCollections that also have cross platform C++ TurboModules that use the static collection.

## Changelog

[Internal]

Reviewed By: javache

Differential Revision: D66324044

fbshipit-source-id: a5a973087c35fc00240e40ba757d49125473daf4
2024-11-22 15:20:10 -08:00
Maddie Lord 450d982844 onHostDestroy, only set EnableDevSupport to false if the current activity is the one being destroyed (#47907)
Summary:
Changelog: [Internal]

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

EnableDevSupport is set to false on lifecyle events like onPause and onHostDestroy, and set to true on events like onResume and onCreate.

In apps like AMA and Twilight, there is first a loginActivity, which then calls the mainActivity. After mainActivity is created, loginActivity is destroyed. This causes enableDevSupport to always be false because onDestroy for loginActivity is triggered after onCreate for mainActivity.

Reviewed By: RSNara, alanleedev

Differential Revision: D66124018

fbshipit-source-id: e40a5b24cf73000b0bfeaa1d8e3902718b281410
2024-11-22 12:48:33 -08:00
Tom Scallon 162208d264 Support defining multiple CxxReactPackages from a single lambda (#47897)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47897

Changelog: [Internal]

In some situations, we want to provide multiple `CxxReactModules` from a single lambda. Currently, this is painful -- this change makes it less so.

Reviewed By: tdn120

Differential Revision: D66337573

fbshipit-source-id: ed57ad6ca2b98d4787aca7da3714c05c3d03b649
2024-11-22 12:09:12 -08:00
Luna Wei a77d8d9d50 Support rn_rootThreshold on IntersectionObserver (viewAreaCoveragePercentThreshold) (#47908)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47908

Changelog: [General][Added] - Add support for `rn_rootThreshold` in Intersection Observer

`rn_rootThreshold` is a custom IntersectionObserver option and not part of the IntersectionObserver spec. We are adding it because it covers a specific use-case for measuring viewability that is robust for `target`s that are larger than the viewport or specified `root`.

The threshold ratio is of the intersection area (of `root` and `target`) to the total area of the `root`.

 {F1960832959}
Source - EX314979

`rn_rootThreshold` is an optional threshold and can be combined with the `thresholds` option. An intersection will fire if any specified thresholds is met.

Note: If you use specify a `rn_rootThreshold`, the default `threshold` is no longer applied

The main use case of `rn_rootThreshold` is being able to specify a level of viewability independent of `target` size. For example, a `target` that is larger than the `root` (commonly the viewport) will not trigger the IntersectionObserver for a `threshold` of `1`. Setting `rn_rootThreshold` of `1`, will trigger once the item takes full size of the `root`.';

Reviewed By: yungsters

Differential Revision: D66031119

fbshipit-source-id: 7bdc871dc5b4e6c0edc7d6e17a0a0cfd51c4fe81
2024-11-22 11:50:36 -08:00
Thomas Nardone 0b22b955f1 ReactViewGroup - utilize onViewAdded/Removed (#47890)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47890

The fix in [#40859](https://github.com/facebook/react-native/pull/40859) overrode every possible add or remove to ensure completeness, but all paths should also call onViewAdded/onViewRemoved via:
- `addView`/`addViewInLayout` -> [addViewInner](https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-15.0.0_r5/core/java/android/view/ViewGroup.java#5310)
- `removeView`/`removeViewInLayout` -> [removeViewInternal](https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-15.0.0_r5/core/java/android/view/ViewGroup.java#5606)
- `removeViews`/`removeViewsInLayout` -> [removeViewsInternal](https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-15.0.0_r5/core/java/android/view/ViewGroup.java#5714)

Changelog: [Android][Changed] Consolidated ReactViewGroup add/remove overrides

Reviewed By: javache

Differential Revision: D66320586

fbshipit-source-id: aaf16af5ad87789f575fcb79dcf31f5686002b2d
2024-11-22 10:27:09 -08:00
Thomas Nardone 3d1a505da5 ReactViewGroup - extract method for parent check (#47878)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47878

Make it clearer what we're checking, and provide a single point of code where we could potentially improve the logic.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D66302526

fbshipit-source-id: a0e6d1004aef25897e9633fe930915ba585c1cb5
2024-11-22 10:27:09 -08:00
Thomas Nardone f1d7016be9 ReactViewGroup cleanup (#47674)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47674

Small changes that can be done in Java and make a Kotlin conversion more seamless.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D66033963

fbshipit-source-id: 666302f132b98019f1013a335a2c59c7a4f31836
2024-11-22 10:27:09 -08:00
Rob Hogan 74995bc90a dev-middleware: Generalise URL rewriting, don't only rewrite for Android emulators (#47880)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47880

The previous diffs in this stack have aimed to make URL rewriting by inspector-proxy robust to any configuration of device->server, debugger->server and server->server connections.

Though rewriting was originally introduced to support Android emulator networking, we can now expand it to cover other use cases, like the device reaching the server over an internet address not reachable from the dev machine, or the debugger routing to the server through a tunnel on a different port, without needing CORS workarounds.

Changelog
[General][Fixed] dev-middleware: Rewrite URLs in the inspector proxy to cover all configurations, not just Android emulators.

Reviewed By: huntie

Differential Revision: D66247355

fbshipit-source-id: e9201ebc1f7f5fe2119c71cd4d7b4ca895645404
2024-11-22 10:26:43 -08:00
Pieter De Baets aec7a66ae8 Remove deprecated ReactModuleInfo constructor (#47681)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47681

These were deprecated back in D49262824, so should be safe to remove now.

Changelog: [Android][Removed] Removed hasConstants constructor from ReactModuleInfo

Reviewed By: mdvacca

Differential Revision: D66127070

fbshipit-source-id: 3bd441c96597598470f16c7770c4dfa4ada563a0
2024-11-22 08:05:41 -08:00
Pieter De Baets bf5c98cf5e Remove deprecated TurboReactPackage (#47680)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47680

This was deprecated in D50128456 so should be safe to remove now.

Changelog: [Android][Removed] Removed TurboReactPackage, which was replaced by BaseReactPackage

Reviewed By: mdvacca

Differential Revision: D66127067

fbshipit-source-id: a4090ab439cf99dc693622b8da2c0cffa247ad24
2024-11-22 08:05:41 -08:00
zhongwuzw 89f93dc921 Fabric: Fixes high contrast color when not specified (#47418)
Summary:
Fixes the high contrast color when not specified. Previously, if we didn't specify highContrastLight or highContrastDark, it would create a UIColor with an alpha of 0, which is not what we expected. We should fall back to the dark or light color instead.

## Changelog:

[IOS] [FIXED] - Fabric: Fixes high contrast color when not specified

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

Test Plan:
1. Enable color contrast in iPhone's settings.
2. Open PlatformColor example in RNTester. See dynamic colors
3. color shows correctly
![image](https://github.com/user-attachments/assets/a71b8743-b397-4a11-b287-ec117b1ba243)

Before:
![image](https://github.com/user-attachments/assets/6a12824b-f77c-4979-a232-c1c97554e53c)

Reviewed By: javache

Differential Revision: D66303078

Pulled By: cipolleschi

fbshipit-source-id: 63a0d2bc94eea438d4f69643d09825b74575188b
2024-11-22 07:16:24 -08:00
Andrew Coates e6848ba5ba Fixes to bridging/base.h for MSVC compatibility (#47882)
Summary:
Attempting to use the various bridging template and generated C++ Specs for native modules in a project compiling with MSVC does not build.

For the fromJs I had to add `std::move` - otherwise it could not cast.

The supportsFromJs and supportsToJs are changed to address an IntelliSense issue where the template specialization cannot have default members.

## Changelog:
[GENERAL] [FIXED] - Fix C++ bridging template compatibility with MSVC

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

Test Plan: It continues to build on Android/iOS builds.  And it also builds with MSVC for react-native-windows and other out of tree platforms that use MSVC.

Reviewed By: cipolleschi

Differential Revision: D66360833

Pulled By: javache

fbshipit-source-id: bf97db1cd247a383eb86cac31c601e8ab3400fd2
2024-11-22 06:55:58 -08:00
Blake Friedman e4fc27ec4d Add changelog for 0.76.3 (#47893)
Summary:
Add changelog for 0.76.3

Changelog: [Internal] - Add changelog for 0.76.3

bypass-github-export-checks

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

Test Plan: N/A

Reviewed By: cipolleschi

Differential Revision: D66329466

Pulled By: blakef

fbshipit-source-id: e399175e198d11e2a5c0492fa1869797b50ef26f
2024-11-22 05:55:25 -08:00
Samuel Susla bb78142011 fix code comment for collapsable prop (#47881)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47881

changelog: [internal]

collapsable prop is not only for android.

Reviewed By: NickGerleman

Differential Revision: D66299356

fbshipit-source-id: 1c7435c77ef029fea55346f4ca16b5c81022b85a
2024-11-22 05:45:13 -08:00
Riccardo Cipolleschi 677d82d818 Disable E2E Tests on RNTester (#47903)
Summary:
E2E tests for Android RNTester in GHA are flaky and they prevent CI to be green on main.
Given that the Branch cut is happening on Monday and that I'll be away for a week, it's better to disable them.

I'm planning to work a bit on those today and more once I'm back

## Changelog:
[Internal] - Temporarily disable E2E tests for Android

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

Test Plan: GHA

Reviewed By: javache

Differential Revision: D66359177

Pulled By: cipolleschi

fbshipit-source-id: a0064418af607953cf46445613796c18fb6e1389
2024-11-22 05:14:22 -08:00
oddlyspaced 8dc2c90ce5 chore(Android): convert systeminfo module classes to kotlin (#47616)
Summary:
Saw a lot of PRs and push to convert existing Java code to Kotlin, and wanted to contribute to the cause. This is a starting point for me so I can understand more about the Java to Kotlin conversion process for ReactAndroid package.

## Changelog:
- Converted AndroidInfoHelpers to Kotlin class
- Converted AndroidInfoModule to Kotlin object and updated usage of it across the package

Pick one each for the category and type tags:

[ANDROID] [CHANGED] - Migrated systeminfo module code from Java to Kotlin

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests

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

Test Plan: Verified build on local dev environment.

Reviewed By: NickGerleman

Differential Revision: D66258996

Pulled By: javache

fbshipit-source-id: e0958c0be735f54cb20c7daeee1526059edaabcc
2024-11-22 03:35:36 -08:00
Pieter De Baets d424bb9d7c Convert com.facebook.testutils.shadows to Kotlin (#47487)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47487

Changelog: [Android][Deprecated] Deprecated shadows for ReadableNative[Map|Array].[Readable|Writable]

Reviewed By: rshest

Differential Revision: D65597417

fbshipit-source-id: 61f649c32fb91a13af075aa65869093f31d218e3
2024-11-22 01:53:48 -08:00
Pieter De Baets eb5fbdf134 Convert com.facebook.react.bridge.WritableNativeArray to Kotlin (#47486)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47486

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D65596952

fbshipit-source-id: 462432af819ed9a7fba515cee54055d737d2584e
2024-11-22 01:53:48 -08:00
Pieter De Baets 145c72f816 Convert com.facebook.react.bridge.ReadableNativeArray to Kotlin (#47484)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47484

Small change to types in the base class: all non-primitives return optional from ReadableArray, which matches the semantics in ReadableMap. We already rely on this in some cases, but the current nullability annotations were incorrect, and null values from the array would be passed through from `getMap` and `getArray`.

Changelog: [Android][Breaking] ReadableArray non-primitive getters are now correctly typed as optional

Reviewed By: Abbondanzo

Differential Revision: D65596278

fbshipit-source-id: 5574e9000b07de292bd0da5f1b071aac0eb331d6
2024-11-22 01:53:48 -08:00
Phillip Pan 3575e21f73 fix extraModulesForBridge: in interop
Summary:
Changelog: [Internal]

the delegate of TMM is RCTInstance, but RCTInstance doesn't forward all of the APIs and we aren't protected by the compiler because of the optional in TMMDelegate

i found that this backwards compat API did not actually get set up correctly and was never working in the first place... this is why we should avoid optional

long term, TMMDelegate needs to be pushed down to the infra layer and not exist in product, cc blakef

Reviewed By: javache

Differential Revision: D66148789

fbshipit-source-id: 925a6d4ebb6ba6bfb0b1aec6710695e7551ba475
2024-11-21 23:02:15 -08:00
Thomas Nardone e2c621c5fc ReactViewGroup - fix setBorderRadius javadoc (#47892)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47892

Update to match the method so it doesn't show as an error in the IDE.

Changelog:[Internal]

Reviewed By: jorge-cab

Differential Revision: D66326667

fbshipit-source-id: f81bdc7763862fc06440b27e417e0b53ad7774da
2024-11-21 19:00:06 -08:00
Ramanpreet Nara e4d8c96786 Correct message annotation on early js errors (#47889)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47889

## Context
When is the runtime ready?
- After the main bundle finishes executing **without** raising a fatal javascript error

## Changes
Let's decorate all errors reported while the runtime is not ready as "[runtime not ready]".

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D66316907

fbshipit-source-id: e48542af4f84d4cc3a6ce8f667dbaa10c30c19a8
2024-11-21 16:00:44 -08:00
David Vacca fd1d6b8c65 Remove DeprecatedInNewArchitecture for ReactProp annotation (#47744)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47744

Remove DeprecatedInNewArchitecture for ReactProp annotation

ReactProp is still used in new arch, we might remove this annotation in the future but it will be independent of new arch

changelog: [internal] internal

Reviewed By: javache

Differential Revision: D66216728

fbshipit-source-id: 86d9aeb2932cbf34c57a7a850da0ced5268447bf
2024-11-21 15:45:21 -08:00
David Vacca fb737ca7d3 Deprecate ReactContext.getFabricUIManager() method (#47743)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47743

Deprecate ReactContext.getFabricUIManager() method

changelog: [Android][Deprecated] ReactContext.getFabricUIManager() method

Reviewed By: shwanton

Differential Revision: D66216427

fbshipit-source-id: 0e716921a6fc65ad1ccfcab71640174515ae4f67
2024-11-21 15:45:21 -08:00
David Vacca 3baf562df0 Migrate SurfaceDelegate to Kotlin (#47687)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47687

Migrate SurfaceDelegate to Kotlin

changelog: [internal] internal

Reviewed By: javache

Differential Revision: D66134455

fbshipit-source-id: 35e6a5c590c1f8eb0060f8f44680b9134ea127c1
2024-11-21 15:45:21 -08:00
Ramanpreet Nara c02e3b1c60 Only handle the first javascript fatal error (#47783)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47783

After the first javascript fatal, the runtime starts tearing down. And it becomes invalid. So, subsequent js fatals will most likely be just noise. Let's filter them out.

This impacts bridgeless mode: both the javascript and c++ pipeline.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D66193194

fbshipit-source-id: 61a731850f7ac4f00bfac24e3260673bf94ba8ed
2024-11-21 14:09:08 -08:00
Jorge Cabiedes Acosta 451ff70da4 implement correct border-radius scaling on overlapping radii (#47886)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47886

We were not scaling border radii properly when they overlap.

We were relying on Android's handling of the issue which is not compliant with the web algorithm leading to **visible gaps between layers when the radii overlapped**

We are now following web spec https://www.w3.org/TR/css-backgrounds-3/#corner-overlap

Changelog: [Android] [Added] Add overlapping radii resolution logic preventing incorrect rendering

Reviewed By: NickGerleman

Differential Revision: D66269809

fbshipit-source-id: 4ab7025dc1e41be6205ff6b828617e1e222536a9
2024-11-21 14:01:02 -08:00
Sam Zhou 12550f05c5 Deploy 0.254.1 to xplat (#47887)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47887

Changelog: [Internal]

Reviewed By: alexmckenley

Differential Revision: D66315470

fbshipit-source-id: 16b8fca3412fc2fcea3be8dfd0c760d97c56d734
2024-11-21 13:13:10 -08:00
Matthew Horan 68db74205a Fix asynchronous access to KeyboardAvoidingEvent event in onLayout handler (#47798)
Summary:
The `onLayout` handler of the `KeyboardAvoidingView` view is async due to the `await AccessibilityInfo.prefersCrossFadeTransitions` in `_relativeKeyboardHeight`.

A connected `onLayout` handler will be unable to access the event. Call `persist()` on the event so that it can be accessed asynchronously.

## Changelog:

[GENERAL] [FIXED] - Accessing KeyboardAvoidingEvent event in onLayout handler

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

Test Plan:
The following should not produce an error:
```
import * as React from 'react';
import {
  KeyboardAvoidingView,
  SafeAreaView,
  TextInput
} from 'react-native';

export default function() {
  return (
    <SafeAreaView>
      <KeyboardAvoidingView onLayout={(event) => console.log(event)} behavior="padding">
        <TextInput />
      </KeyboardAvoidingView>
    </SafeAreaView>
  );
}
```

Reviewed By: cipolleschi

Differential Revision: D66306085

Pulled By: dmytrorykun

fbshipit-source-id: 9ccf00db79947670ddc7de74a47cc6dc27455fc0
2024-11-21 12:10:17 -08:00
Rob Hogan 5da7ebf99a dev-middleware: Don't assume device-relative and debugger-relative URLs have the same port (#47876)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47876

Currently, if a device is connected to the bundler via, say, `http://10.0.2.2:8081` (Android default), and a debugger is opened on `http://localhost:8081`, we rewrite hostnames `10.0.2.2.`<->`localhost` so that URLs are correct relative to each.

However, if the debugger is on a different port or protocol, this breaks down - because we only rewrite hostnames.

This fixes that by using the debugger's connecting `Host` header and `encrypted` state to derive the base URL of the server relative to the frontend. We then update the rewriting logic to use this actual full origin (protocol + host) in place of the device-relative origin.

Changelog:
[General][Fixed] dev-middleware: Fix URL rewriting where device and debugger reach the server on different ports/protocols.

Reviewed By: huntie

Differential Revision: D66077627

fbshipit-source-id: 01f6565149caa34b1e9e50dd58deb0122485657c
2024-11-21 11:39:20 -08:00
Rob Hogan aae3e03e57 dev-middleware: Refactor urlRegex rewriting, regex-escape IP4 addresses (#47872)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47872

Largely a refactoring to the way we currently rewrite `url`/`urlRegex` in `Debugger.setBreakpointByURL` CDP requests (debugger->target).

Rewriting regexes is fragile, it only really works if we can assume `'localhost'` appears literally and that ports and protocols don't need changing. The intention here is to freeze the current behaviour so as not to break anyone relying on it (if anyone is), and decouple it from more robust rewriting we want to generalise.

Also adds simple regex escaping to host names (always IPv4 addresses) we inject into regex patterns, since the previous approach could've led to false matches in unlikely edge cases.

Changelog:
[General][Fixed] dev-middleware: Regex-escape IP addresses in urlRegex replacements

Reviewed By: huntie

Differential Revision: D66238782

fbshipit-source-id: 4cd0029081d68c193e36d3713057ffdc7ef0656f
2024-11-21 10:09:41 -08:00
Rubén Norte 6c581c9b9b Allow JS_DIR path to be relative to cwd (#47877)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47877

Changelog: [internal]

Reviewed By: sammy-SC

Differential Revision: D66302814

fbshipit-source-id: 55d6f86d098673e28fad71a43863f2041810d04b
2024-11-21 09:14:45 -08:00
Pieter Vanderwerff ae09827b15 Deploy 0.254.0 to xplat (#47810)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47810

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D66278779

fbshipit-source-id: 01dec1dc844607afa8f650c5acdebc6d5d5739d2
2024-11-21 08:26:07 -08:00
Kudo Chien ce838a4bcf Fix lazy import error from jest and Appearance.js (#47629)
Summary:
currently running jest test, it shows an error:

```
ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From __tests__/App.test.tsx.

      at getState (node_modules/react-native/Libraries/Utilities/Appearance.js:18:26)
      at addChangeListener (node_modules/react-native/Libraries/Utilities/Appearance.js:71:19)
      at subscribe (node_modules/react-native/Libraries/Utilities/useColorScheme.js:10:66)
      at subscribeToStore (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:6232:10)
      at commitHookEffectListMount (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13038:26)
      at commitPassiveMountOnFiber (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:14461:11)
      at commitPassiveMountEffects_complete (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:14421:9)
      at commitPassiveMountEffects_begin (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:14408:7)
      at commitPassiveMountEffects (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:14396:3)
      at flushPassiveEffectsImpl (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:16287:3)
      at flushPassiveEffects (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:16236:14)
      at node_modules/react-test-renderer/cjs/react-test-renderer.development.js:16051:9
      at workLoop (node_modules/scheduler/cjs/scheduler.development.js:266:34)
      at flushWork (node_modules/scheduler/cjs/scheduler.development.js:239:14)
      at Immediate.performWorkUntilDeadline [as _onImmediate] (node_modules/scheduler/cjs/scheduler.development.js:533:21)
```

it is a regression from https://github.com/facebook/react-native/issues/46123 that to have a lazy require.

this pr tries to mock `useColorScheme` to return `light`. i think we don't necessarily test the color scheme changes in jest runtime. originally `useColorScheme` also returns `light` because of [this statement](https://github.com/facebook/react-native/blob/9a60038a40e16925ea1adeb3e3c937c22a615485/packages/react-native/Libraries/Utilities/Appearance.js#L77-L83)

## Changelog:

[GENERAL] [FIXED] - Fixed jest error from Appearance.js

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

Test Plan:
```sh
$ npx react-native-community/cli init RN0762 --pm bun --version 0.76.2
$ cd RN0762
$ bun test run
```

Reviewed By: cipolleschi

Differential Revision: D66297456

Pulled By: huntie

fbshipit-source-id: 80d1460532e76bd1815c66964547b50d7f7b3558
2024-11-21 07:46:14 -08:00
Blake Friedman 6460d2b3e7 Support Windows sdkmanager.bat (#47874)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47874

We should be searching for the .bat file on Windows to remain compatible with some user setups.

Changelog: [Android][Fixed] look for sdkmanager.bat

Reviewed By: cipolleschi

Differential Revision: D66295240

fbshipit-source-id: 6b79a9aa40f77ed9c5b3d6ad92b1a62e78159223
2024-11-21 07:19:35 -08:00
Riccardo Cipolleschi b8419b2eed Include autolinkin.h in OnLoad.cpp only if it exists (#47875)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47875

The old architecture looks broken because in the OnLoad.cpp file we try to include the autolinking.h header which is only generated when the New Architecture is enabled.

This fix guards the include and the usage of the function provided by the autolinking so that the old architecture should work as well.

## Changelog
[Internal] - Include autolinkin.h in OnLoad.cpp only if it exists

Reviewed By: blakef

Differential Revision: D66295318

fbshipit-source-id: 18461e6b70ac92af57b805bef51c0df49db02283
2024-11-21 05:55:58 -08:00
Alex Hunt 3de9892353 Skip hermes-parser under Babel for non-Flow JS code (#47568)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47568

Resolves https://github.com/facebook/hermes/issues/1549.

Changelog:
[General][Fixed] - When using Babel with plain JavaScript files, support for additional user syntax plugins should be fixed (now uses Babel's parser instead of hermes-parser). There is no change for JS files annotated with `flow`, where extended JS syntax remains unsupported.

Reviewed By: blakef

Differential Revision: D65816797

fbshipit-source-id: 9f05e86019548ac8727ee65c2e2c417d78a406d8
2024-11-21 05:41:39 -08:00
Alex Hunt 113337f269 Update hermes-parser and related packages in fbsource to 0.25.1 (#47573)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47573

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

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D65816542

fbshipit-source-id: cb445eb77790fb2632d3bc318c6eb59f097b1518
2024-11-21 05:41:39 -08:00
Santiago 7d63235086 Fix Appearance.setColorScheme(null) not resetting color scheme value (#47739)
Summary:
Fixes https://github.com/facebook/react-native/issues/47725

Calling Appearance.setColorScheme(null) or Appearance.setColorScheme(undefined) no longer resets the color scheme useColorScheme returns like on previous rn versions.

## Changelog:

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

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[GENERAL] [FIXED] - Fix `Appearance.setColorScheme(null)` not resetting color scheme value

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

Test Plan: Repo with a patch ready to test: https://github.com/sangonz193/react-native-color-scheme-patch

Reviewed By: yungsters

Differential Revision: D66230236

Pulled By: cipolleschi

fbshipit-source-id: cc668acb1fde6d30f2706fc0ab7dee5cea1c3b14
2024-11-21 04:43:46 -08:00
Rubén Norte 9f604dbd43 Watch changes in C++ files (#47871)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47871

Changelog: [internal]

No need to keep going back to save test files when we change C++ files and need to re-run tests :)

Reviewed By: javache

Differential Revision: D66293212

fbshipit-source-id: dc232e1d3f7f8ae1578e894ce14bd21ccf3c8ade
2024-11-21 03:58:36 -08:00
Rubén Norte 92a476661c Add flag to force running tests in optimized mode (#47870)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47870

Changelog: [internal]

This flag allows us to run optimized mode by using the right buck modes for the Fantom CLI, using minified + dev in Metro and building bytecode using Buck as well.

It's disabled by default but in the future we can enable it based on the configuration in the test file (e.g.: if it's a benchmark) or we can run tests in both modes by default to catch problems caused by the differences between environments.

Reviewed By: rshest

Differential Revision: D66292709

fbshipit-source-id: d25294b739ff6a67507990241784b838d5b30dcd
2024-11-21 03:58:36 -08:00
Abdelhafidh Belalia 550b0c0ed1 TextLayout: take full width if text wrapped (#47435)
Summary:
### Problem
The calculated width for a multiline text is based on the longest line. However it does not account for text that wraps.

**Example** if numberOfLines=1 and the text wraps

```
+---------------------------+
This is a long text that
will wrap
+---------------------------+
```

The TextView will render
```
+---------------------------+
This is a long text t...
+---------------------------+
```

because the `calculatedWidth` took the width of the first line.

Also see https://github.com/facebook/react-native/pull/41770#issuecomment-2453611554 for additional context.

### Solution

If the text wraps, take the whole width.

```
+---------------------------+
This is a long text that w...
+---------------------------+
```

Fixes https://github.com/facebook/react-native/issues/39722
Fixes https://github.com/facebook/yoga/issues/1730

## Changelog:

[GENERAL] [FIXED] - Fix text not taking full width

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

Test Plan:
```tsx
        <Text
          numberOfLines={1}
          style={{
            backgroundColor: 'red',
            alignSelf: 'flex-start',
            color: 'white',
            fontSize: 34,
          }}>
          {'This is a long text that will wrap.'}
        </Text>
        <Text
          numberOfLines={3}
          style={{
            backgroundColor: 'red',
            alignSelf: 'flex-start',
            color: 'white',
            fontSize: 34,
          }}>
          {
            '1\n\ntest\nThis is a long text that will wrap.This is a long text that will wrap.This is a long text that will wrap.\n'
          }
        </Text>
        <Text
          numberOfLines={3}
          style={{
            backgroundColor: 'red',
            alignSelf: 'flex-start',
            color: 'white',
            fontSize: 34,
          }}>
          {
            '1\n\nThis is a long text that will wrap.This is a long text that will wrap.This is a long text that will wrap.\n'
          }
        </Text>
```
1. Verify that the first and third text take full width
2. Verify that the second text does not take full width

| Before | After |
|:------:|:-----:|
|   <img width="480" alt="Screenshot 2024-11-05 at 9 00 24 PM" src="https://github.com/user-attachments/assets/b8d765c0-f4b1-42c6-afc7-75862c52612a">     |    <img width="480" alt="Screenshot 2024-11-05 at 9 01 49 PM" src="https://github.com/user-attachments/assets/f1534c14-a56a-4d44-8edc-4d9f75166cb2">   |

Reviewed By: NickGerleman

Differential Revision: D65521732

Pulled By: realsoelynn

fbshipit-source-id: 0bb0bb306445e73e8b24ff4c02921739d15ee07e
2024-11-21 03:16:30 -08:00
Dmitry Rykun 105ad855d9 Fix ViewConfig validation error after merging defaultSrc into defaultSource for RCTImageView (#47754)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47754

The `./resolveAssetSource` processor was added to the `defaultSource` prop in the `RCTImageView` static view config in D65819218.
To match this in native view config, we're adding the `customType = "ImageSource"` hint to the view config infra, so it knows to assign correct processor to the native view config in runtime.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D66228921

fbshipit-source-id: d0e0cd9e2f5cc0ba5b3a7002f7ade3f45305a2ac
2024-11-21 03:12:21 -08:00
Riccardo Cipolleschi 880dea858e Bump Podfile.lock for Folly (#47868)
Summary:
RNTester jobs are failing because we bumped folly to the recent version but we didn't update the podfile.lock

## Changelog:
[Internal] - Bump Podfile.lock to new Folly version

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

Test Plan: GHA

Reviewed By: robhogan

Differential Revision: D66292931

Pulled By: cipolleschi

fbshipit-source-id: 19cbe1321d2891135aa9777823e9dff2916b16dc
2024-11-21 02:33:29 -08:00
Riccardo Cipolleschi 0eb9472c69 Allow downgrading CMake to build hermesc on Windows (#47867)
Summary:
CI is failing to build HermesC on windows due to a version mismatch of the CMake already installed

## Changelog:
[Internal] - Fix Windows CI for HermesC

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

Test Plan: GHA

Reviewed By: robhogan

Differential Revision: D66292617

Pulled By: cipolleschi

fbshipit-source-id: 5e8f4f45e33fbdd9ff163b4e8a09cb98d4366dc7
2024-11-21 02:20:30 -08:00
David Vacca ac0dbe1ea2 Migrate ReactClippingProhibitedView to Kotlin (#47752)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47752

Migrate ReactClippingProhibitedView to Kotlin

changelog: [internal] internal

Reviewed By: javache

Differential Revision: D66217071

fbshipit-source-id: e7559db5c3f2795b78f51c3bd5a3f521eb54b70d
2024-11-20 23:08:03 -08:00
David Vacca a2523a24c7 Migrate ReactCompoundView to kotlin (#47748)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47748

Migrate ReactCompoundView to kotlin

changelog: [internal] internal

Reviewed By: javache

Differential Revision: D66217094

fbshipit-source-id: 238c20c907880f4251c9b5926ad486cfff55a3b0
2024-11-20 23:08:03 -08:00
Jakub Piasecki aa53bde21b Fix the nodes' owners not being updated when display: contents is used (#47733)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47733

In https://github.com/facebook/yoga/pull/1729 I moved the cleanup of `display: contents` nodes to happen before all the early returns, but that change also made it be called **before** `cloneChildrenIfNeeded`. It actually needs to be called after `cloneChildrenIfNeeded` to make sure that children of `display: contents` nodes are properly owned.

It also needs to be called in every short-path, so it's being called in four places in this PR. Please let me know whether it's ok or not.

X-link: https://github.com/facebook/yoga/pull/1743

Reviewed By: NickGerleman

Differential Revision: D65953902

Pulled By: zeyap

fbshipit-source-id: 0b18a5651f19c23564f5b3aa2a50833426e9ca5f
2024-11-20 20:01:50 -08:00
phuccvx12 73a2be1243 Fix: Correct Layout Behavior for Combined align-content and align-items (#47732)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47732

This pull request addresses the issue where combining align-content and align-items properties resulted in incorrect layout behavior in Yoga version 3.1.0, as reported in [Issue https://github.com/facebook/yoga/issues/1739](https://github.com/facebook/yoga/issues/1739).

# Changes Made:

Alignment Logic Update: Modified the alignment calculations to ensure that the combination of align-content and align-items properties produces the expected layout, consistent with CSS Flexbox standards and previous Yoga versions.

Test Cases Added: Introduced new test cases to cover scenarios involving various combinations of align-content and align-items properties to prevent future regressions.

# Testing:

All existing tests pass successfully.

New test cases confirm that the layout behaves as expected when align-content and align-items are used together.

# Impact:

This fix ensures that layouts using both align-content and align-items properties render correctly, aligning with the behavior observed in Yoga version 1.19.0 and standard web browsers.

X-link: https://github.com/facebook/yoga/pull/1742

Reviewed By: joevilches

Differential Revision: D65953882

Pulled By: zeyap

fbshipit-source-id: 7e12a21b1d442b35c3f3536cad32dc4b82130d15
2024-11-20 19:59:42 -08:00
David Vacca 17502dd743 Migrate ReactCompoundViewGroup to kotlin (#47751)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47751

Migrate ReactCompoundViewGroup to kotlin

changelog: [internal] internal

Reviewed By: javache

Differential Revision: D66217251

fbshipit-source-id: b24b4ed984670e18256dda758bfa1d783badd536
2024-11-20 18:51:34 -08:00