Commit Graph

38536 Commits

Author SHA1 Message Date
Ruslan Lesiutin af8b232741 Update debugger-frontend from a556d26...50a4d4f (#46401)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46401

Changelog: [Internal] - Update `react-native/debugger-frontend` from a556d26...50a4d4f

Resyncs `react-native/debugger-frontend` from GitHub - see `rn-chrome-devtools-frontend` [changelog](https://github.com/facebookexperimental/rn-chrome-devtools-frontend/compare/a556d261a5e2131864f4e38ded62d8f90e81c39a...50a4d4f7fd86c73860498a24c763d99e07bc31ae).

Reviewed By: huntie

Differential Revision: D62385355

fbshipit-source-id: 77056540c9d40cd7cfc8098332e86f9521633619
2024-09-09 10:31:31 -07:00
Peter Abbondanzo 2e80f5acf1 Load XML files on disk by default (#46371)
Summary:
X-link: https://github.com/facebook/metro/pull/1348

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

## Internal

Vector drawable image support was added in D59530172 but importing vector drawable asset types was not supported out of the box. It required custom source transformers like the one added in D60021474. This is because Android cannot load vector drawable XML over the network. Vector drawables are compiled by AAPT as part of the build process. Even though Metro can serve XML, it would never load.

## Summary

This adds some minor checks in the `AssetSourceResolver` to only attempt loading XML asset types from disk on the Android platform. XML assets like vector drawables are precompiled and cannot be served over the network by Metro.

## Changelog

[Android] [Added] - Adds support for importing XML assets as images

Reviewed By: javache

Differential Revision: D62302929

fbshipit-source-id: 01e49ac5b0429d291318984128dfca2dc058149d
2024-09-09 10:18:10 -07:00
Rob Hogan 40f98b5eee Bump Metro to 0.81.0-alpha.0 (#46398)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46398

Bump Metro packages to the version stablising for RN 0.76

Changelog:
[General][Changed] - Bump Metro dependencies to 0.81.0-alpha.0

Reviewed By: cortinico

Differential Revision: D62377929

fbshipit-source-id: 0808b11ad534e6a649c28f32b19f95f691645be4
2024-09-09 08:20:52 -07:00
Nicola Corti 90f89a830a Gradle to 8.10.1 (#46399)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46399

This is a patch release for Gradle. Let's include it inside main/0.76.

Changelog:
[Android] [Changed] - Gradle to 8.10.1

Reviewed By: tdn120

Differential Revision: D62377887

fbshipit-source-id: e8a5acaa48c15c9a12a09504c33c2a0d2834d92c
2024-09-09 07:26:53 -07:00
Hampus Sjöberg 833c3a2cf5 fix: RNGP autolink not properly filter out pure C++ TurboModules (#46381)
Summary:
Hey.

The react-native gradle plugin didn't properly filter out [Pure](https://github.com/react-native-community/cli/pull/2387) C++ TurboModules for autolinking, which caused build failures as a non-existing gradle dependency would be emitted.

This makes Pure C++ TurboModules work again for Android.

## 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
-->

[ANDROID][FIXED] Fix autolinking issues for Pure C++ TurboModules

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

Test Plan:
https://github.com/hsjoberg/rn75autolinkregression

Try running this repro project to observe the error:

```
1: Task failed with an exception.
-----------
* Where:
Build file '/Users/coco/Projects/Blixt/rn75autolinkregression/example/android/app/build.gradle' line: 54

* What went wrong:
A problem occurred evaluating project ':app'.
> Project with path ':react-native-cxx-turbomodule' could not be found in project ':app'.
```

Simply add the 1-line code from this PR to make the build succeed.

Cheers.

Reviewed By: cipolleschi

Differential Revision: D62377757

Pulled By: cortinico

fbshipit-source-id: 9e3fa3777b4e6e4d3f2eb0f996ac0ac7676eedbe
2024-09-09 07:22:28 -07:00
Rob Hogan 143f1ad298 Enable RN DevTools Android OSS debug builds (#46395)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46395

Enable React Native Devtools in Android OSS debug builds

Changelog:
[Android][Added] Enable React Native DevTools in OSS debug builds

Reviewed By: huntie

Differential Revision: D62376708

fbshipit-source-id: b5f98d003fee224930c0b8df1455be962e56d245
2024-09-09 05:45:13 -07:00
Alex Hunt d55efe8953 Fix HERMES_ENABLE_DEBUGGER define for jsinspector-modern under CocoaPods (#46393)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46393

> [!Note]
> Replaces https://github.com/facebook/react-native/pull/46282.

We intended to enable Fusebox on `main` since https://github.com/facebook/react-native/pull/45469 — this worked when building under Buck, however was not working for builds under Xcode. This is because the `HERMES_ENABLE_DEBUGGER` preprocessor flag was missing for the `React-jsinspector` Podspec.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D62375148

fbshipit-source-id: 5d4d243d0a2cb7796fdf59d57086a0cb966639c7
2024-09-09 04:38:32 -07:00
Alex Hunt f220bde4d7 Remove Inspector Panel perf + network tabs under New Arch (#46307)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46307

Changelog:
[General][Breaking] - Remove Inspector Panel perf + network tabs  under New Arch (see https://github.com/react-native-community/discussions-and-proposals/pull/777)

Reviewed By: christophpurrer

Differential Revision: D62123634

fbshipit-source-id: 44ecc476943ccb33f8de96dcefa3e233e954841a
2024-09-09 04:31:17 -07:00
Vojtech Novak 7041ed28f0 fix(android): ensure Appearance change listener does not skip events (#46017)
Summary:
I'm able to reproduce a case when Appearance module methods are called in the following order:

starting point: dark mode enabled
1. call `setColorScheme` light
2. call `getColorScheme`, which sets `colorScheme` to light [here](https://github.com/facebook/react-native/blob/7bb7a6037bd78bbfa6d9e8499973ea921e9c70e1/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/appearance/AppearanceModule.kt#L57)
3. [onConfigurationChanged](https://github.com/facebook/react-native/blob/7bb7a6037bd78bbfa6d9e8499973ea921e9c70e1/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/appearance/AppearanceModule.kt#L82) is called but `if (colorScheme != newColorScheme)` does not evaluate to true, so no event is dispatched to JS. That means JS is not in sync with the native state.

The issue was the `getColorScheme` had a side-effect of setting `colorScheme` private member (not sure what its use was). The fix remembers the last emitted color scheme value and emits event if new value is different.

## Changelog:

[ANDROID] [FIXED] - ensure Appearance change listener does not skip events

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

Test Plan: tested locally with RN tester

Reviewed By: NickGerleman

Differential Revision: D62016949

Pulled By: cipolleschi

fbshipit-source-id: b7b5755d38becda655cf376749d9a996daff7e07
2024-09-09 04:30:50 -07:00
Riccardo Cipolleschi 148066e8f9 Bump CLI to 15 (#46394)
Summary:
Bumps the CLI to the next version

## Changelog:
[General][Changed] - Bump cli dependencies to 15.0.0-alpha.2

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

Test Plan: CI

Reviewed By: huntie

Differential Revision: D62375405

Pulled By: cipolleschi

fbshipit-source-id: fec99216bc7ad6decfd83840091d807f603184da
2024-09-09 03:54:43 -07:00
Oskar Kwaśniewski 3621606c44 feat(iOS): expose newArchEnabled, deprecate separate methods (#46228)
Summary:
This PR exposes the `newArchEnabled` flag and deprecates all of the separate methods to enable new architecture.

As discussed with cipolleschi here: https://github.com/react-native-community/template/pull/45#discussion_r1732522705

## Changelog:

[IOS] [DEPRECATED] - Deprecate turboModuleEnabled, fabricEnabled, bridgelessEnabled
[IOS] [ADDED] - Add newArchEnabled method to RCTAppDelegate

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

Test Plan: Test if switching newArchEnabled flag from AppDelegate works.

Reviewed By: cortinico

Differential Revision: D61849385

Pulled By: cipolleschi

fbshipit-source-id: 8acf718386882679f00d2d5000b4432a523b34ac
2024-09-09 03:15:19 -07:00
Alan Lee 97b661c3f0 add inset based margins to RedBox (#46391)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46391

**Issue:**
RedBox displays early error before JS Error handling is properly setup.
On Android 15, targetSdk 35 (forced edge-to-edge), dialog overlaps with system bars making it difficult to use.

**Solution**
Add inset based margins so content does not overlap with system bars.

Changelog:
[Android][Fixed] - RedBox content overlapping with system bars on Android 15 forced edge-to-edge

Reviewed By: fkgozali

Differential Revision: D62362105

fbshipit-source-id: 57f60222914d407ebdcfd0359dbdf3ac36bde8f5
2024-09-09 01:15:18 -07:00
Alan Lee 3244a5ee74 code cleanup for depreacted OS version (#46390)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46390

As React Native's minSdkVersion is not 24, clean up version checks and code that is using deprecated version from OSS

Changelog:
[Internal] - code cleanup for minSdkVersion 24

Reviewed By: philIip

Differential Revision: D62362059

fbshipit-source-id: a851d0908d4175269524f41955acca5f2da69cad
2024-09-09 00:25:54 -07:00
Riccardo Cipolleschi d424c24432 Zip slices to preserve symlinks (#46387)
Summary:
When creating Hermes in CI, we build it for MacOS and Mac Catalyst as well.
The slices for these platforms requires symlinks to work properly.
The upload artifacts action on github, when applied to folders, follows the symlinks and copies the destination folder. The result is that Hermes for macOS and Catalyst does not work as expected.

This should fix https://github.com/facebook/react-native/issues/46213.

## Changelog:
[Internal] - Build Hermes in CI properly

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

Test Plan: Tested already in 0.75

Reviewed By: robhogan

Differential Revision: D62355050

Pulled By: cipolleschi

fbshipit-source-id: 7abb85c8a2a88f13e06a49c6cb0caccbdad4551a
2024-09-08 06:27:48 -07:00
dirkpostma d687d38987 Fix duplicate entries in HEADER_SEARCH_PATHS when running react_native_post_install script (#46262)
Summary:
In a react native project where USE_FRAMEWORKS is not nil, every time when running `pod install`, duplicate lines are added to `HEADER_SEARCH_PATHS` section of `project.pbxproj`:

```
" ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers",
" ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers",
" ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers",
```

Note: a popular library that needs `use_frameworks` is react-native-firebase.
See https://rnfirebase.io/#altering-cocoapods-to-use-frameworks

## Analyse

- `react_native_post_install` calls `ReactNativePodsUtils.update_search_paths(installer)`
- when `ENV['USE_FRAMEWORKS'] != nil` then `update_search_paths` calls `add_search_path_if_not_included`
- `add_search_path_if_not_included` checks if `"#{new_search_path}"` is already there
- if not found it adds `" #{new_search_path}"` _with an extra space_
- next time, it can't find `"#{new_search_path}"` because of the extra space, and adds `" #{new_search_path}"` again

## Changelog:

[IOS] [FIXED] - react_native_post_install script no longer adds duplicate entries to HEADER_SEARCH_PATHS

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

Test Plan:
- create a react native project
- add `use_frameworks! :linkage => :static` to `ios/Podfile` (just before `use_react_native`)
- run `pod install`
- assert no duplicate lines are added to HEADER_SEARCH_PATHS of file `project.pbxproj`

Reviewed By: cipolleschi

Differential Revision: D61982680

Pulled By: shwanton

fbshipit-source-id: 61b566893c551d0813edd6eec2f8352c041c748f
2024-09-07 06:27:23 -07:00
Oskar Kwaśniewski 9cc6f007ba chore(iOS): bump socket rocket to 0.7.1 (#46300)
Summary:
This PR bumps Socket Rocket to 0.7.1, this release brings some new improvements and visionOS support. I've also moved the version to a constant.

## Changelog:

[INTERNAL] [CHANGED] - Bump SocketRocket to 0.7.1

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

Test Plan: CI Green

Reviewed By: cortinico, cipolleschi

Differential Revision: D62294833

Pulled By: blakef

fbshipit-source-id: 0e45c7de041710fb1f500b0ac23898b68a8a8936
2024-09-07 02:56:51 -07:00
Alan Lee 77b3a8bdd6 Modal bugfix for statusBarTranslucent prop and Android 15 (#46359)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46359

Remove unneeded code around size calculation and old arch support
- updateState was getting called unnecessarily in multiple places --> only call from onSizeChanged()
    - this is a reliable source for getting the content size area of the dialog used for Modal
     - remove code checking duplicated update
- Old architecture cleanup
    - Remove Java implementation of ShadowNode
      - we already have logic to set the node size via UIManagerModule::updateNodeSize(). This  code is now group together in updateState() for both new and old architecture

This fixes issues with resulting from wrong size calculation:
- having gaps at bottom when we set `statusBarTranslucent` to `true`
- Modal cut off at bottom on Android 15 (drawn under bottom nav bar)

Changelog:
[Android][Fixed] - Modal statusBarTranslucent bug, Modal at bottom being cut off in Android 15 (without forced edge-to-edge)
[Android][Deprecation] - Deprecating ModalHostShadowNode and ModalHostHelper classes

Reviewed By: mdvacca

Differential Revision: D62286026

fbshipit-source-id: 03b64a7783c12bebd1457c86a9a2657adc882c79
2024-09-07 00:59:47 -07:00
Alan Lee 79e4ed2b09 Refactor/ bugfix for ReactModalHostView (#46326)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46326

- renaming variabled to make intent more clear
    - `dialog` -> `dialogWindow` to distinguish with `activity.window`
    - `hostView` -> `dialogRootViewGroup` as name was confusing.
        - `ReactModalHostView` creates and manages `DialogRootViewGroup` but it used as contentView for the Dialog.
- bug fixes

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D62177564

fbshipit-source-id: f81b167c1a234c02617ec2a3d63979628e01063b
2024-09-06 19:07:04 -07:00
Shawn Dempsey 17d0345fdf Migrate FlatList/SectionList E2E testss from Catalyst to RNTester (#46274)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46274

changelog: [General][Add] - Add E2E test cases for Flat/SectionList to RNTester

Reviewed By: philIip

Differential Revision: D62002065

fbshipit-source-id: 038907cd7afd33505b7599e390cb9f366b7b32f6
2024-09-06 15:13:33 -07:00
Marc Rousavy e629a8552d fix: Bring back Cxx TurboModule autolinking via registerCxxModuleToGlobalModuleMap (#46360)
Summary:
Reverts the PR https://github.com/facebook/react-native/pull/45967 from philIip to bring back the `registerCxxModuleToGlobalModuleMap(..)` function, which I use in Nitro Modules and MMKV.

Ontop of that, this also removes the "experimental" `RCT_EXPORT_CXX_MODULE_EXPERIMENTAL` macro, which I think was the original intent of this PR as this macro is a bit unsafe.

I also added some small docs to `registerCxxModuleToGlobalModuleMap` while I'm at it.

## Changelog:

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

Pick one each for the category and type tags:

[GENERAL] [CHANGED] - Bring back CxxTurboModule autolinking function, but remove `RCT_EXPORT_CXX_MODULE_EXPERIMENTAL` macro

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

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

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

Test Plan: Build Nitro Modules. Worked for me! :)

Reviewed By: realsoelynn

Differential Revision: D62310637

Pulled By: philIip

fbshipit-source-id: 2caa2b8ea094dda5e13c81431a9a645cbcf8f807
2024-09-06 15:11:03 -07:00
Benoit Girard 1bd4a11736 Add Fusebox support for saving traces to disk (#46370)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46370

Add a function to write the current trace contents to a file. To be used by the upcoming Perfetto data source while we wait for devtools to work in a profiling build.

Reviewed By: rubennorte

Differential Revision: D62262985

fbshipit-source-id: 04789f5312721434c773e51b3da333498bf0e786
2024-09-06 12:40:42 -07:00
Tim Yung 2f8676924d Animated: Store Listeners w/ Map
Summary:
Currently, `AnimatedNode.prototype.getListeners` creates an array with `Object.keys()` to determine the number of listeners.

This is a relatively hot code path for animation-intensive user interfaces. Although `Object.keys()` is fast, every unnecessary memory allocation is an unnecessary opportunity to create garbage that requires collection.

Using an object as a dictionary performs worst than using a `Map` anyway, so this switches `AnimatedNode` to use a `Map`.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D62267352

fbshipit-source-id: 8629861a64109a3a711c0f66a345029d0bfcd440
2024-09-06 12:15:21 -07:00
Tim Yung d1ebe02c19 Animated: Optimize Traversals in Nodes (#46286)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46286

Optimizes the runtime performance of `Animated` by using memoization to avoid repetitive traversals of `props` (and `style`) values.

Changelog:
[General][Changed] - Improved runtime performance of `Animated`

Reviewed By: javache

Differential Revision: D62037506

fbshipit-source-id: b0202f02c87466e1cef61b841de7e861a0ecae4e
2024-09-06 12:15:21 -07:00
Tim Yung 9e35dffcf1 Animated: Refactor NativeAnimatedHelper (#46312)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46312

Refactors `NativeAnimatedHelper` to make it easier to read, reduce runtime overhead, and no longer export `queueOperation` (which was not useable externally anyway).

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D62139993

fbshipit-source-id: ce75e530887da6290f26060ecfe36049cf81879a
2024-09-06 12:15:21 -07:00
Dmitry Rykun 1063de3c27 Instrumentation for SurfaceMountingManager (#46366)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46366

This diff adds a Systrace section to the `SurfaceMountingManager::createViewUnsafe` method.
This will allow us to see more detail within the `MountItemDispatcher::mountViews preMountItems` that was previously almost blank.
Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D62247235

fbshipit-source-id: 3765c15e3e24e3231a30294938c725e82d100542
2024-09-06 11:05:15 -07:00
Pieter De Baets 0c90cfc7d4 Remove some Tasks overhead (#46348)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46348

`continueWithTask` skips an extra invocation layer that `onSuccess` adds. Switch to Task<Void> as the task can already represent failure or success without needing a boolean.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D62213722

fbshipit-source-id: 631d741bd2ec4917eab69a20978ab2ace737c459
2024-09-06 10:32:47 -07:00
Alan Lee 3bd3d7687d handle InspectorPanel overlap with system bars (#46340)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46340

**Issue:**
InspectorPanel is hidden behind 3 button nav bar on Android 15 forced edge-to-edge

**Solution:**
Apply SafeAreaView to avoid overlap with system bars
(CAUTION: SafeAreaView here is for internal RN Core usage only and should not be used elsewhere)

Changelog:
[Internal]

Reviewed By: cortinico, mdvacca

Differential Revision: D62225374

fbshipit-source-id: e762288386d4f1d210bd26b8f28e73c652c7ba4e
2024-09-06 09:39:01 -07:00
Alan Lee 206d0085f9 handle LogBox Notification overlap with nav bar (#46341)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46341

Issue: LogBox Notification (or toast) is partly hidden behind 3 button nav bar on Android 15 targetSdk 35 build

Solution: surround with SafeAreaView to avoid overlap with system bars
(CAUTION: SafeAreaView here is for internal RN Core usage only and should not be used elsewhere)

Changelog:
[Internal]

Reviewed By: cortinico, mdvacca

Differential Revision: D62224584

fbshipit-source-id: 0662b1be9822bf51dadec2dd4879c915a47dfc65
2024-09-06 09:39:01 -07:00
Nicola Corti aca31eb610 Bump AGP to 8.6.0 (#46368)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46368

This bumps AGP to the latest stable.
Release notes are here https://developer.android.com/build/releases/gradle-plugin

No relevant changes for React Native, other than the requirement on minimum Gradle version.

Changelog:
[Android] [Changed] - Bump AGP to 8.6.0

Reviewed By: tdn120

Differential Revision: D62296897

fbshipit-source-id: c34a18ab15dbacd6e5d69003b9e192d7f76d9f8f
2024-09-06 09:28:13 -07:00
Nicola Corti d0a5f8ff51 Gradle to 8.10 (#46369)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46369

This bumps Gradle to the latest stable ahead of the 0.76 branch cut.

Changelog:
[Android] [Changed] - Gradle to 8.10

Reviewed By: tdn120, Abbondanzo

Differential Revision: D62296898

fbshipit-source-id: 59fc119dd6fad3b6b0ebbfcd8166da4cad9b8633
2024-09-06 09:28:13 -07:00
Pieter De Baets 31abc5d51b Simplify preMountItems frame time check (#46347)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46347

Calculate a frame deadline, and compare the current time against that.

This will also allow us to make frame timing more dynamic in the future, based on the display's frame rate.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D62213710

fbshipit-source-id: 1c7fc4b67d08c1eda4f3b9612a4506b33c44f626
2024-09-06 09:19:01 -07:00
Richard Barnes 194b642633 Fix using namespace issues in xplat
Differential Revision: D62242159

fbshipit-source-id: b95e0ece2f55b3df3310ac84cde34d7f40b2706c
2024-09-06 09:06:49 -07:00
Dmitry Rykun 5e777848ed Cleanup the useDebouncedEffect experiment
Summary:
This diff cleans up the `use_debounced_effects_for_animated` experiment. It is not shipped because it breaks semantics of Animated.

It also removes the implementation of now unused `useDebouncedEffect` hook.

bypass-github-export-checks

Facebook
Details here https://fb.workplace.com/groups/3611662615830335/permalink/3666119690384627/

Changelog: [Internal]

Reviewed By: bvanderhoof

Differential Revision: D62188361

fbshipit-source-id: ce215cf7dd57e41e02c33760e91808d774bbd919
2024-09-06 05:27:01 -07:00
Samuel Susla 8ebddf3715 listen to onUserDrivenAnimationEnded in passive effects versions of useAnimatedPropsLifecycle (#46361)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46361

changelog: [internal]

to support onScroll native animated event, subscribe to onUserDrivenAnimationEnded event in passive effects version of useAnimatedPropsLifecycle.

Reviewed By: javache

Differential Revision: D62236130

fbshipit-source-id: 850e6cb5544eb0377492fd030f735b159f24ab8d
2024-09-06 04:30:17 -07:00
Samuel Susla 4c55e94dc5 remove unnecessary useRef (#46351)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46351

changelog: [internal]

useRef here is not needed, let's remove it.

Reviewed By: yungsters

Differential Revision: D62235850

fbshipit-source-id: 77d50152f5423e8806cc28c18bcaf4803076e813
2024-09-06 04:30:17 -07:00
Alan Lee 5fe7660439 Set inset based margins on LogBox (#46338)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46338

**Issue:**
With forced edge-to-edge on Android 15, LogBox bottom tab bar is hidden behind 3 button nav bar and is unusable.

**Solution:**
LogBox is using Android Dialog so update it to set margins based on inset values. With this change we can get rid of android header logic from JS.

Changelog:
[Android][Changed] - Modify LogBox to be usable on Android 15

Reviewed By: mdvacca

Differential Revision: D62224124

fbshipit-source-id: 4721753bf340bd813bcd560052c52b63fa58ad4b
2024-09-05 17:23:14 -07:00
Alan Lee f7479e6a1c set inset based padding to RNTester (#46354)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46354

**Issue:**
With forced edge-to-edge on Android 15, RNTester title at top overlaps with the status bar and bottom tab bar overlaps with bottom nav bar

**Solution:**
Add margins based on inset values to the ReactRootView which is the contentView for RNTesterActivity which acts as global padding within RNTester

Changelog:
[Android][Changed] - Adding padding for RNTester on Android 15 forced edge-to-edge

Reviewed By: mdvacca

Differential Revision: D62247910

fbshipit-source-id: 7b35d0c2016b6897b5de436a4245c9e910559541
2024-09-05 15:56:54 -07:00
Pieter De Baets 46fc9d9a2d Fix DispatchUIFrameCallback invoked multiple times per frame (#46346)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46346

Noticed that we could sometimes have multiple instances of DispatchUIFrameCallback in a single frame, which would cause us to execute more view preallocations or other work scheduled by Fabric. Root cause for this is on the new architecture, onHostResume seems to be invoked multiple times.

Make this code more resilient by explicitly tracking the state of the frame callback and avoiding multiple subscriptions. Longer-term we should consider having ReactChoreographer support repeating FrameCallbacks, since most of them are.

Changelog: [Android][Fixed] Fixed multiple Fabric dispatch callbacks being executed in a single Android frame

Reviewed By: sammy-SC

Differential Revision: D62213721

fbshipit-source-id: ac6fa5483ea38d9a15824af233fd23f1f6f3c891
2024-09-05 10:28:09 -07:00
Vitali Zaidman b37101486b update babel and fix tests accordingly (#46295)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46295

X-link: https://github.com/facebook/metro/pull/1343

Updated all **babel** packages in all `package.json` across the repo and ran `npx yarn-deduplicate yarn.lock --scopes babel`. Afterwards, fixed the following issues appearing as a result of that (squashed the following initially separate diffs to make this packages update work atomically):
### (D61336392) updated jest snapshot tests failing
### (D61336393) updated babel types and corrected typings accordingly
The latest babel 7 introduces the following features we need to adjust our types to:
* `JSXNamespacedName` is removed from valid `CallExpression` args ([PR](https://github.com/babel/babel/pull/16421))
  * `JSXNamespacedName` is used for namespaced XML properties in things like `<div namespace:name="value">`, but `fn(namespace:name)` doesn't make any sense.
* Dynamic imports are enabled behind a new flag `createImportExpressions` ([PR](https://github.com/babel/babel/pull/15682)), introducing calls such as `import(foo, options)`. These complicate the expected values passed to `import` to be more than just strings.
  * Since these are behind a flag that is not expected to be enabled, we can throw an error for now and whoever uses it can add a support to it if needed later.

### Added a new metro ENV ignore
`BROWSERSLIST_ROOT_PATH` is set to `""` explicitly in `xplat/js/BUCK`
and then ignored in
`js/tools/metro-buck-transform-worker/src/EnvVarAllowList.js`

Reviewed By: robhogan

Differential Revision: D61543660

fbshipit-source-id: abbcab72642cf6dc03eed5142eb78dbcc7f63a86
2024-09-05 07:11:17 -07:00
Pieter De Baets 3df0f3b9ff Skip transform invalidation if unchanged (#46345)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46345

Deriving transforms can be expensive on Android. When using NativeAnimated with transforms, especially with an EventBasedDriver, we may update the transform every frame, even if it's unchanged. Ideally, we'd fix this in Animated, and diff the previous and next values, but this closes the gap somewhat in the short-term.

Both JavaOnlyArray and ReadableNativeArray implement equals, but will not compare equality correctly with each other. That's not an issue, as it just means we'll redo the transform once more than necessary.

Changelog: [Android][Fixed] Optimize BaseViewManager#setTransform to ignore duplicate values

Reviewed By: NickGerleman

Differential Revision: D62213726

fbshipit-source-id: 5df026030c66e31eb6a5fe6353de3706b5b7b799
2024-09-05 04:48:15 -07:00
Sam Zhou 2bdcbb1c6b Deploy 0.245.2 to xplat (#46343)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46343

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D62226470

fbshipit-source-id: 58fb884fa9071cb3f6c5d4a046ce0a494297a495
2024-09-05 00:45:35 -07:00
Mohamed Alsadek f1031be3e2 Enable Multiple Sheet Presentation in React Native (#46333)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46333

This pull request introduces enhancements to the view controller presentation logic in React Native, allowing for multiple sheets to be presented on top of each other. The current implementation restricts the presentation to a single view at a time, which limits the flexibility needed in complex applications.
The proposed changes modify the presentation behavior to always utilize the top-most view controller for presentations. This adjustment ensures that multiple sheets can be managed more effectively, without disrupting the existing application flow.
Key changes include:
Modification of the presentation logic to reference the top-most view controller.
Utilization of a recursive method to determine the top-most controller.
The changes have been thoroughly tested with both old and new interfaces and have shown to work seamlessly across different scenarios
Changelog: [Internal] Allow multiple sheets to be presented on top of each other

Reviewed By: jessebwr

Differential Revision: D62202475

fbshipit-source-id: daa0cf95edb23ea52a26441337f9a16f5475b211
2024-09-04 20:43:58 -07:00
Sam Zhou 62ee5c9b81 Replace final $ObjMap in react-native with mapped type (#46335)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46335

Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D62208265

fbshipit-source-id: f7c72f7239b49fbaee626c3572c116e26b698300
2024-09-04 18:33:20 -07:00
Sam Zhou 464a202ba6 Replace $ObjMap in EventEmitter with mapped type (#46332)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46332

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D62199703

fbshipit-source-id: 24abf39b01d5ba8a90e03ce837a887d4b4f4ade8
2024-09-04 13:52:02 -07:00
Qi Zhao e8646630a4 fix broken test due to error message change (#46329)
Summary:
## Context
The error message in folly dynamic has been updated in D62136190. Updating related tests to reflect the change.

## Diff
Only test code is changed. No business logic change.

## Changelog:
[Internal] [Fixed] - Fix broken unit test due to folly error message change

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

```
Shows details about the selected run from the run history
Run result
java.lang.AssertionError: Test failure
Test Case RecoverableError
* Running RecoverableError.RunRethrowingAsRecoverableRecoverTest
* Running RecoverableError.RunRethrowingAsRecoverableFallthroughTest
2/2 tests passed.
Test Case JsArgumentHelpersTest
* Running JsArgumentHelpersTest.args
***** Failure in xplat/js/react-native-github/packages/react-native/ReactCommon/cxxreact/tests/jsarg_helpers.cpp:108
Expected equality of these values:
  ex.what()
    Which is: "Error converting javascript arg 4 to C++: TypeError: expected dynamic type 'int/double/bool/string', but had type 'array'"
  std::string("Error converting javascript arg 4 to C++: " "TypeError: expected dynamic type `int/double/bool/string', but had type `array'")
    Which is: "Error converting javascript arg 4 to C++: TypeError: expected dynamic type `int/double/bool/string', but had type `array'"

0/1 tests passed.
Test Case JSBigFileString
```

Reviewed By: yfeldblum

Differential Revision: D62184078

fbshipit-source-id: 6ae0a33f58e0e10f14166084b80a997e59a008ec
2024-09-04 12:19:00 -07:00
Tim Yung 320963c7cb RN: Enable Hermes Parser in Default Metro Config (#46318)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46318

Configures the Metro by default to use the Hermes parser so that React Native can fully leverage all modern Flow language syntax.

NOTE: This does not affect `*.ts` and `*.tsx` files which will continue to use Babel. Metro has logic to enforce this regardless of the transform options.

Changelog:
[General][Changed] - Changed Metro default config to use Hermes parser, enabling the use of advanced Flow syntax in React Native.

Reviewed By: robhogan

Differential Revision: D62161923

fbshipit-source-id: 0f4c069d429517be16abcc6a2187cd23c6bd52d4
2024-09-04 11:04:32 -07:00
Pieter De Baets b4b0c1d475 Avoid list allocation in scroll path (#46324)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46324

For listener sets that change infrequently, `CopyOnWriteArrayList` is a better trade-off compared to copying the list to iterate on it, especially in perf-sensitive paths like scrolling. Using `WeakReference` is also significantly simpler than `Collections.newSetFromMap(WeakHashMap`.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D62178024

fbshipit-source-id: bfc4f7389683b15be673dd7731094d52199d1c66
2024-09-04 10:51:48 -07:00
Sam Zhou eb02d5cb03 Deploy 0.245.1 to xplat (#46328)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46328

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D62186461

fbshipit-source-id: 280794aac3b627af430fc132283b06d512c52f2d
2024-09-04 09:01:22 -07:00
Tim Yung dda3397545 Animated: Make NativeAnimatedHelper Private (#46311)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46311

A straightforward move of `NativeAnimatedHelper` into the private directory, so that it does not impact our Public API.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D62142349

fbshipit-source-id: c93979e26e290d13e2a19fbe40d8f460ebea15fd
2024-09-04 02:54:57 -07:00
Mohamed Alsadek dea5a6ca60 Enable Multiple Sheet Presentation in React Native (#46316)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46316

This pull request introduces enhancements to the view controller presentation logic in React Native, allowing for multiple sheets to be presented on top of each other. The current implementation restricts the presentation to a single view at a time, which limits the flexibility needed in complex applications.

The proposed changes modify the presentation behavior to always utilize the top-most view controller for presentations. This adjustment ensures that multiple sheets can be managed more effectively, without disrupting the existing application flow.

Key changes include:
Modification of the presentation logic to reference the top-most view controller.
Utilization of a recursive method to determine the top-most controller.

The changes have been thoroughly tested with both old and new interfaces and have shown to work seamlessly across different scenarios

Changelog: [Internal] Allow multiple sheets to be presented on top of each other

Reviewed By: cipolleschi

Differential Revision: D62143463

fbshipit-source-id: 53667cf1a75e4514156780574bf604aee6b3fefc
2024-09-04 02:54:32 -07:00