Commit Graph

38536 Commits

Author SHA1 Message Date
Vladimir Makaev 3949d9b5ba Update ktfmt component on FBS:master
Reviewed By: zertosh

Differential Revision: D62584126

fbshipit-source-id: 46170730dd7cabfa5e366a3139a9119c319592cc
2024-09-12 14:06:06 -07:00
Tim Yung d0121a6c2d Revert D62398039: Speed up animation on back button press + animated reattach on tab switch
Differential Revision:
D62398039

Original commit changeset: af286e428188

Original Phabricator Diff: D62398039

fbshipit-source-id: 9a69733d5a00c9081471096cca298579af468352
2024-09-12 13:34:32 -07:00
Jorge Cabiedes Acosta 6b369a40d9 Remove experimental_ prefix from filter (#46406)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46406

As title

Second attempt at landing the new name. There were 2 issues previously which led us to revert.

1. **Error on workrooms tests.** This ended up not being caused by us but rather by D61896776. After renaming the error changed which might've caused the renaming to be blamed for the issue. It has since been resolved

2. **FB crash** FB was crashing when using drop-shadow after renaming. For some reason after renaming `filter` an invalid stylex property was making FB crash. We don't know why renaming uncovered the issue but the the code was using unsupported features on RN (`calc` & `stylex`) which then led to passing a raw unsupported value for `filter` and crashing on the `processFilter` function.

FB was fixed here D62407454 to prevent crashing after landing this diff

Changelog: [General] [Changed] - Add official `filter` CSSProperty.

Reviewed By: NickGerleman

Differential Revision: D62401985

fbshipit-source-id: 14422603c40b7ddf8300029165a85655354075c3
2024-09-12 11:46:43 -07:00
Shawn Dempsey ec39b8ba96 ReactNativeNewArchitectureFeatureFlagsDefaults defaults to newArch (#46448)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46448

Changelog: [Internal]

**Context**

- D61621224 changed `ReactNativeNewArchitectureFeatureFlagsDefaults` to default `newArchitectureEnabled=true`

https://www.internalfb.com/code/fbsource/[dc23ff7ddd18]/xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeNewArchitectureFeatureFlagsDefaults.kt?lines=16-18

**Change**
- We no longer need to explicitly set `newArchitectureEnabled=true`

Reviewed By: cortinico

Differential Revision: D62537633

fbshipit-source-id: 64df997fe85e49d731a914bd5ca749085749a0ac
2024-09-12 10:08:54 -07:00
Oskar Kwaśniewski cadd41b1a2 fix(iOS): don't reference PrivacyInfo.xcprivacy twice for new projects (#46457)
Summary:
This PR fixes an issue with PrivacyInfo files.

When generating a new project for using the latest RC 0.76.0.rc0 I got two privacy manifests references in Xcode.

This is because `PrivacyManifestUtils` look for build phase reference:

```ruby
reference_exists = target.resources_build_phase.files_references.any? { |file_ref| file_ref&.path&.end_with? "xcprivacy" }
```

Which doesn't exist for the generated template.

Here is how Xcode file tree looks like after installing pods:

![CleanShot 2024-09-12 at 13 23 21@2x](https://github.com/user-attachments/assets/44e5bb55-a1ab-4b4b-bfe4-e4a6808afd15)

## Changelog:

[IOS] [FIXED] - don't reference PrivacyInfo.xcprivacy twice for new projects

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

Test Plan:
1. Generate a new project
2. Execute pod install
3. Check if only one PrivacyInfo file exists

Reviewed By: cortinico

Differential Revision: D62580116

Pulled By: cipolleschi

fbshipit-source-id: 1224a41307ae6c9b862832f145baf0edc92476d6
2024-09-12 09:31:25 -07:00
Riccardo Cipolleschi 120558c0cd Bump main to 0.77
Summary:
This change bumps the React Native version in main to 0.77

bypass-github-export-checks

## Changelog:
[General][Changed] - Bump main to 0.77-main

## Facebook:
generated by running `js1 publish react-native 0.77.0-main`

Reviewed By: cortinico

Differential Revision: D62575939

fbshipit-source-id: 6d239fca2eed6cfe51f8c37f78d8dc8730c18b8c
2024-09-12 09:23:23 -07:00
Samuel Susla 6243a33978 do not pass state wrapper for text during view preallocation (#46418)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46418

changelog: [internal]

introduce a small performance optimisation on Android.

When Paragraph is preallocated, it does not have valid C++ state. But we still send it to Android layer because it is part of a more generic pipeline. This has a cost because Android will end up using the state to update internal state on ReactTextView. To avoid this, simply add a special case to view preallocation and prevent it from sending C++ state.

Reviewed By: javache

Differential Revision: D62435529

fbshipit-source-id: 36b5b00a7a390432721d28d53ff8d4af76169e08
2024-09-12 08:01:28 -07:00
Marlene Cota 13db1cb88b Fix double to float type conversion error (#46447)
Summary:
![image](https://github.com/user-attachments/assets/3808e1ec-7b56-4cc6-85fb-a48beceba519)

## Changelog:
[GENERAL] [FIXED] - Fix type conversion error in react native windows build.

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

Test Plan: RNW CI builds.

Reviewed By: cipolleschi

Differential Revision: D62570270

Pulled By: cortinico

fbshipit-source-id: da3da297ba10cdd41f49e754ce52053055d61644
2024-09-12 07:27:52 -07:00
Nicola Corti 81e8c39f0a Do not stub SoLoader and use version 0.12.0 (#46422)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46422

Stubbing SoLoader comes with a couple of breaking changes (e.g. users in OSS are using `com.facebook.common.logging.FLog` which is exposed by Fresco).

In order to reduce those breaking changes, here I'm moving React Native to use SoLoader 0.12.0.
This new version comes with a constructor that accepts a MergedSoMapping implementation which we provide only for OSS apps.

Please note that the CI on this Diff will be red till SoLoader 0.12.0 releases.

Changelog:
[Internal] [Changed] - Do not stub SoLoader and use version 0.12.0

Reviewed By: cipolleschi

Differential Revision: D62447566

fbshipit-source-id: 6ff38799ed0c9f40cf3ab84be8a05979def63dc2
2024-09-12 07:17:22 -07:00
Tommy Nguyen aec6666bfa Re-add RCTHermesInstance constructor for compatibility (#46453)
Summary:
https://github.com/facebook/react-native/pull/46314 introduced a breaking change, making it hard to maintain backwards compatibility elsewhere. This change re-introduces the constructor that takes two arguments.

## Changelog:

[IOS] [FIXED] - Unbreak `RCTHermesInstance` constructor breaking change

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

Test Plan: n/a

Reviewed By: javache

Differential Revision: D62574496

Pulled By: cortinico

fbshipit-source-id: dcd15bf9694f4b14e37d61d7209193b3e448cd6b
2024-09-12 07:05:39 -07:00
Pieter De Baets 533ef2ca37 Mark HoverEvents as handled when pointer event dispatching is enabled (#46445)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46445

Similarly to onTouchEvent, we should return true from onHoverEvent to signal to Android that the hover event is "handled" (because we've dispatched the event to JS). This is important to be able to distinguish multiple stacked React roots on top of each other.

Changelog: [Android][Fixed] Hover events were dispatched incorrectly when multiple ReactRoots were layered.

Reviewed By: mdvacca

Differential Revision: D62529586

fbshipit-source-id: d007c44b8ef56989888eb9a993e1428bd0b72a7b
2024-09-12 03:30:52 -07:00
Thomas Nardone c942469700 Re-enable ktfmt on RN (#46441)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46441

Changelog: [Internal]

Reviewed By: zertosh

Differential Revision: D62518893

fbshipit-source-id: ca2ff83018716a4dc1e2dcfb8596138d088ce9f4
2024-09-11 19:06:25 -07:00
Jorge Cabiedes Acosta 2241c3146f Remove experimental_ prefix from boxShadow (#46404)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46404

As title

Second attempt to rename the prop. BoxShadow caused no issues after renaming but it was batched with `filter` which we reverted.

Changelog: [General] [Changed] - Add official `boxShadow` CSSProperty.

Reviewed By: NickGerleman, cyan33

Differential Revision: D62400814

fbshipit-source-id: ad721f6d11d614e987048e55556b05ff74a4747d
2024-09-11 16:01:06 -07:00
Tim Yung dc84d00db6 Animated: Minimize AnimatedProps Invalidation (#46386)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46386

Currently, `useAnimatedProps` attempts (and fails) to memoize the `AnimatedProps` instance by using `props` in the dependency array:

https://www.internalfb.com/code/fbsource/[de6bf108ae11fad0e8516617cde6f0cf3152d129]/xplat/js/react-native-github/packages/react-native/Libraries/Animated/useAnimatedProps.js?lines=56-59

However, `props` is very easily invalidated whenever the component is updated by its parent. The only time when it will not be invalidated is if the component that directly uses this hook — `createAnimatedComponent`'s return value — updates state… which never happens.

This changes `useAnimatedProps` so that we memoize `AnimatedProps` using only the nested property values that actually require a new `AnimatedProps` object to be created, which are `AnimatedNode` subclasses.

A minor detail is that in order for `AnimatedProps.prototype.__getValue` to continue working, we must supply `props` when we're actualizing the `AnimatedNode` instances into real values. This is accomplished by introducing a new method to select `AnimatedNode` subclasses: `__getValueFromStatic{Props,Object,Style,Transforms}`

Changelog:
[General][Added] - Created an experimental optimization to improve memoization within `Animated` to improve product performance

Reviewed By: javache

Differential Revision: D61997128

fbshipit-source-id: 2ca3cfb1038ba9a0abd82904acbc5cb4eb41a45d
2024-09-11 15:34:22 -07:00
Riccardo Cipolleschi 401f735e35 Add changelog for 0.75.3 (#46442)
Summary:
Add changelog for version 0.75.3

## Changelog:
[Internal] - Add Changelog for 0.75.3

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

Test Plan: N/A

Reviewed By: kassens

Differential Revision: D62526856

Pulled By: cipolleschi

fbshipit-source-id: 50045ec5fbbbf282bcec3dd59787f860e5510846
2024-09-11 15:21:55 -07:00
Royi Hagigi 46abda55b9 Speed up animation on back button press + animated reattach on tab switch (#46438)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46438

When hiding a view with React.Activity, React will "detach" all the views in teh subtree (call all their effect cleanups) and then upon showing it again will attach them (call all their effects again).

This was previously causing problems with useAnimatedProps and https://github.com/facebook/react-native/pull/46205 was intended to fix it (cc javache), but it's still a perf drain to have to detach all of this and then re-attach it upon show. Worse, it makes it so that we can't actually do any animations upon re-showing a view until all the passive effects have run to re-attach the views to the animations.

So instead, what this diff does is lean on the fact that useInsertionEffect *does not* clean up and rerun when Activity goes from hidden to visible and vice versa. Thus, we can rely on it to only detach the animated node when we're *actually* unmounting - rather than when we're simply hiding/showing.

Changelog:
[General][Changed] - Improved the performance of unmounting (and updating, when an enclosing Activity becomes hidden) Animated components

Reviewed By: yungsters, sammy-SC

Differential Revision: D62398039

fbshipit-source-id: af286e428188b5104f6cfd3fd4d8c9f791dedb8d
2024-09-11 15:00:01 -07:00
Melissa Liu 65d8f66b50 improve text line height calculation (#46362)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46362

Changelog:
[Android] [Fixed] - improve text line height calculation

## Context
There is a recurring issue in React Native where text containing accented characters, non-latin scripts, and special glyphs experiences truncation when line height is set too small, even when the line height equals or exceeds the font size. This problem has a significant impact, particularly when rendering complex text in multiple languages or special character sets.

See: https://docs.google.com/document/d/1W-A80gKAyhVbz_WKktSwwJP5qm6h6ZBjFNcsVbknXhI/edit?usp=sharing for more context

## Investigation
Previously, when font metrics (ascent, descent, top, bottom) exceeded the line height, the logic arbitrarily prioritized descent over ascent and bottom top. This led to vertical misalignment and text clipping at the top of the text.

## Proposed Implementation:

1. Descent Exceeds Line Height:
Descent is capped to fit within the line height, setting ascent and top to 0, similar to the current behavior.
2. Shrink ascent and descent equally:
When the combined ascent and descent exceed the line height, the vertical deficit is split proportionally between them, ensuring even distribution of the space.
3. Proportionally shrink top and bottom:
If the top and bottom together exceed the line height, reductions are now applied proportionally based on the delta between top and ascent and bottom and descent.

Reviewed By: NickGerleman

Differential Revision: D62295350

fbshipit-source-id: 81381e8ea18ba9059488468295778c21781e4e7a
2024-09-11 14:53:09 -07:00
Melissa Liu f338e7c0a1 add feature flag for line height gating (#46408)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46408

## Changelog:

[Android] [Added] - new feature flag for line height calculation

## Context
Adding feature flag for line height calculation centering.

There is a recurring issue in React Native where text containing accented characters, non-latin scripts, and special glyphs experiences truncation when line height is set too small, even when the line height equals or exceeds the font size. This causes issues in rendering complex text in multiple languages or special character sets.

See: https://docs.google.com/document/d/1W-A80gKAyhVbz_WKktSwwJP5qm6h6ZBjFNcsVbknXhI/edit?usp=sharing for more context

## Investigation
Previously, when font metrics (ascent, descent, top, bottom) exceeded the line height, the logic arbitrarily prioritized descent over ascent and bottom top. This led to vertical misalignment and text clipping at the top of the text.

## Implementation:

1. Descent Exceeds Line Height:
Descent is capped to fit within the line height, setting ascent and top to 0, similar to the current behavior.
2. Shrink ascent and descent equally:
When the combined ascent and descent exceed the line height, the vertical deficit is split proportionally between them, ensuring even distribution of the space.
3. Proportionally shrink top and bottom:
If the top and bottom together exceed the line height, reductions are now applied proportionally based on the delta between top and ascent and bottom and descent.

Reviewed By: NickGerleman

Differential Revision: D62421775

fbshipit-source-id: 6b0542426d7ee575f4986e60ddf92247542b65cb
2024-09-11 14:53:09 -07:00
Zeya Peng 4014aa4528 correctly pass down isLooping in parallel animation (#46429)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46429

Right now if I create a `Animated.loop(Animated.parallel(...))`, `config.__isLooping` for nested animations are not `true`. The reason is Animated.parallel doesn't pass down `isLooping`. This change is fixing that.

Changelog: [General][Fixed] - correctly pass down isLooping in parallel animation

Reviewed By: cipolleschi

Differential Revision: D62473189

fbshipit-source-id: 405dd36aa008cc965599ff82333b5552df1eb41f
2024-09-11 09:58:04 -07:00
Pieter De Baets 94489d563d Add trace markers for onScrollChanged / updateClippingRect (#46412)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46412

These are quite useful when investigating scroll performance.

Changelog: [internal]

Reviewed By: rshest

Differential Revision: D62213724

fbshipit-source-id: 3293aaf82584eae8508c748638c47c8b010db58f
2024-09-11 08:22:08 -07:00
Riccardo Cipolleschi 274f5bfe6c Disable concurrency on main (#46435)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46435

On main, we want to run CI as fast as possible to catch failures as soon as possible.
Currently, if two commits arrives on main (say commit A and commi B) CI will run on commit B only when it is finished on commit A.
Instead, we would like for CI to run in parallel.

## Changelog
[Internal] - Run CI in parallel on main

Reviewed By: cortinico

Differential Revision: D62496842

fbshipit-source-id: 03dc910deab42af98d92ea8e8e5b90049940dba1
2024-09-11 07:08:40 -07:00
Mohamed Alsadek b3f4d54786 Back out "Enable Multiple Sheet Presentation in React Native" (#46433)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46433

Original commit changeset: 53667cf1a75e

Original Phabricator Diff: D62143463

Changelog: [Internal]  revert previous modal presentation improvement

Reviewed By: sammy-SC

Differential Revision: D62474039

fbshipit-source-id: b510c0460c06ab9d595d414d4ea32acd224871bc
2024-09-11 04:20:50 -07:00
Mohamed Alsadek 080c82e70f Back out "Enable Multiple Sheet Presentation in React Native" (#46434)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46434

Original commit changeset: daa0cf95edb2

Original Phabricator Diff: D62202475

Changelog: [Internal]  revert previous modal presentation improvement

Reviewed By: sammy-SC

Differential Revision: D62474041

fbshipit-source-id: a4af6b5361dcc482e9bb3c2f45d614f9494f022e
2024-09-11 04:20:50 -07:00
Nicola Corti 1e07ac1d32 Add an issue template for React Native DevTools bug reports
Summary:
This introduces a new issue template for Debugger related issues.

bypass-github-export-checks

Changelog:
[Internal] [Changed] - Add an issue template for React Native DevTools bug reports

Reviewed By: cipolleschi, hoxyq

Differential Revision: D62440315

fbshipit-source-id: c7437d9787a910a2886df50171c86c9ed2412dd6
2024-09-11 04:14:56 -07:00
Tomek Zawadzki e91690d929 Expose jsctooling via prefab (#46430)
Summary:
This PR exposes `jsctooling` prefab that contains `facebook::jsc::makeJSCRuntime` used by Reanimated and other third-party libraries previously accessed via `libjscexecutor.so`.

Based on https://github.com/facebook/react-native/pull/46423.

## Changelog:

[Android] [Changed] - Expose jsctooling via prefab

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

Test Plan: Tested on Reanimated paper-example app built from source on RN 0.76.0-rc.0 with JSC enabled

Reviewed By: cipolleschi

Differential Revision: D62492763

Pulled By: cortinico

fbshipit-source-id: 53b6c0d9bb88559c40b5b8796bf6a1513bd388d9
2024-09-11 03:52:55 -07:00
Tomek Zawadzki b1d42c8ef2 Expose react_timing headers in reactnative prefab (#46427)
Summary:
This PR fixes the following error when building third-party libraries that `#include <react/fabric/Binding.h>` which includes `react/timing/primitives.h` which is not included in `reactnative` prefab.

```
FAILED: CMakeFiles/rnscreens.dir/src/main/cpp/NativeProxy.cpp.o
/Users/tomekzaw/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=aarch64-none-linux-android24 --sysroot=/Users/tomekzaw/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -DFOLLY_NO_CONFIG=1 -Drnscreens_EXPORTS -I/Users/tomekzaw/RNOS/react-native-reanimated/node_modules/react-native-screens/android/../cpp -isystem /Users/tomekzaw/.gradle/caches/8.10.1/transforms/eb5443cef7868b6c3cc54bbf3f161a63/transformed/react-android-0.76.0-rc.0-debug/prefab/modules/jsi/include -isystem /Users/tomekzaw/.gradle/caches/8.10.1/transforms/eb5443cef7868b6c3cc54bbf3f161a63/transformed/react-android-0.76.0-rc.0-debug/prefab/modules/reactnative/include -isystem /Users/tomekzaw/.gradle/caches/8.10.1/transforms/b0878eb14f826ac5f04db98523604de2/transformed/fbjni-0.6.0/prefab/modules/fbjni/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security   -fno-limit-debug-info  -fPIC -std=c++20 -MD -MT CMakeFiles/rnscreens.dir/src/main/cpp/NativeProxy.cpp.o -MF CMakeFiles/rnscreens.dir/src/main/cpp/NativeProxy.cpp.o.d -o CMakeFiles/rnscreens.dir/src/main/cpp/NativeProxy.cpp.o -c /Users/tomekzaw/RNOS/react-native-reanimated/node_modules/react-native-screens/android/src/main/cpp/NativeProxy.cpp
In file included from /Users/tomekzaw/RNOS/react-native-reanimated/node_modules/react-native-screens/android/src/main/cpp/NativeProxy.cpp:2:
In file included from /Users/tomekzaw/.gradle/caches/8.10.1/transforms/eb5443cef7868b6c3cc54bbf3f161a63/transformed/react-android-0.76.0-rc.0-debug/prefab/modules/reactnative/include/react/fabric/Binding.h:17:
In file included from /Users/tomekzaw/.gradle/caches/8.10.1/transforms/eb5443cef7868b6c3cc54bbf3f161a63/transformed/react-android-0.76.0-rc.0-debug/prefab/modules/reactnative/include/react/jni/JRuntimeScheduler.h:11:
In file included from /Users/tomekzaw/.gradle/caches/8.10.1/transforms/eb5443cef7868b6c3cc54bbf3f161a63/transformed/react-android-0.76.0-rc.0-debug/prefab/modules/reactnative/include/react/renderer/runtimescheduler/RuntimeScheduler.h:11:
/Users/tomekzaw/.gradle/caches/8.10.1/transforms/eb5443cef7868b6c3cc54bbf3f161a63/transformed/react-android-0.76.0-rc.0-debug/prefab/modules/reactnative/include/react/performance/timeline/PerformanceEntryReporter.h:10:10: fatal error: 'react/timing/primitives.h' file not found
#include <react/timing/primitives.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
```

## Changelog:

[ANDROID] [FIXED] - Expose `react_timing` headers in `reactnative` prefab

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

Test Plan: Tested on Reanimated fabric-example app with react-native-screens installed built from source on top of RN 0.76.0-rc.0 with new arch enabled

Reviewed By: cipolleschi

Differential Revision: D62492707

Pulled By: cortinico

fbshipit-source-id: 94ed7044457bea53660a6ca6d5342cf8ea20a8b4
2024-09-11 03:47:56 -07:00
Ruslan Lesiutin 69325c11f2 Update debugger-frontend from 50a4d4f...e8c7943 (#46414)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46414

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

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

Reviewed By: robhogan

Differential Revision: D62436953

fbshipit-source-id: 7a877142c5713c78cb6f1a3d839c4e90f93fa0c6
2024-09-11 03:42:57 -07:00
Douglas Cheong a05f9c6771 Mark params as unused (#46426)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46426

## Changelog:
[Internal] -
Comment out unused params

Reviewed By: rshest

Differential Revision: D62448755

fbshipit-source-id: da647197994b982f924b2c1330a2b529e48d7ad8
2024-09-10 14:33:17 -07:00
Benoit Girard ef0ea4d834 Add FuseboxPerfettoDataSource to emit Fusebox traces using Perfetto (#46376)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46376

Ideally we would use Fusebox directly but it's not supported in release build. This is a clever work around that:
1) Allows us to use Perfetto to start/stop a trace, otherwise we'd need to build another way to do that which would be either hacky and/or complex.
2) Implements tacking Hermes JS samples and putting them inside of Fusebox traces.
3) Manually taking the trace and opening them in an instance of devtools.

Reviewed By: rubennorte

Differential Revision: D62263012

fbshipit-source-id: 49468914d2b7e5da4761329b176f140b917a404d
2024-09-10 12:54:02 -07:00
Nick Lefever 199d194c46 Use asset name as key for vector image check caching (#46421)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46421

Changelog: [Internal]

Avoid using the Context as a cache key, using only the asset name.

Reviewed By: Abbondanzo

Differential Revision: D62445718

fbshipit-source-id: 4161e6ef1bbc396c8ab815cdc0362159411f6a68
2024-09-10 12:44:22 -07:00
Nicola Corti f41af55958 Expose hermestooling via prefab (#46423)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46423

This is used by Reanimated as they were previously accessing `libhermes_executor.so`

Changelog:
[Android] [Changed] - Expose hermestooling via prefab

Reviewed By: cipolleschi

Differential Revision: D62447875

fbshipit-source-id: e863c56bc5a801ee7de8a4e5d45f95481d3497f8
2024-09-10 11:46:40 -07:00
Nick Lefever 65beadb00a Cache vector image detection for assets (#46415)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46415

Changelog: [Internal]

Cache the results checking for vector content. This check is decompressing the asset content and parsing XML to check for vector graphics. Caching the result per context/asset name removes the need to parse the content on each image assignment.

Reviewed By: Abbondanzo

Differential Revision: D62436412

fbshipit-source-id: 9e1fe9f0747c9a30ac0d89124b6909d4260a2a2f
2024-09-10 09:20:08 -07:00
Yunlong Wu 4a22f2c816 Add TextInput.editable and BaseTextInputProps (#46356)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46356

# Changelog:
[Internal]-
Currently TextInput does not expose `editable` and `readOnly` (only `editable` is exposed as Android-specific prop).
This change is to add them to BaseTextInputProps so they can be supported cross-platform.

Reviewed By: rshest

Differential Revision: D62180722

fbshipit-source-id: 6cb82589f1d36b61167761f5a2e70e8d4b31b01b
2024-09-10 09:08:23 -07:00
Tim Yung 5b5a8397aa Animated: Create enableAnimatedAllowlist Feature Flag (#46405)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46405

Creates a feature flag for enabling the `Animated` code paths utilizing the new allowlist features. This enables us to validate the impact on product performance and developer experience before fully rolling it out.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D62405286

fbshipit-source-id: be4a4786d4d2f44504f7788e473c12ed432ef1cd
2024-09-10 08:33:54 -07:00
Nicola Corti 773a02ad5d Fix wrong command for publishing of external-artifacts (#46417)
Summary:
This is a pick on main of a fix necessary to release 0.76.x

## Changelog:

[INTERNAL] - Fix wrong command for publishing of external-artifacts

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

Test Plan: CI

Reviewed By: cipolleschi

Differential Revision: D62440193

Pulled By: cortinico

fbshipit-source-id: 57ea0736c1b6e3e60b048a46770356901de74024
2024-09-10 07:11:42 -07:00
Riccardo Cipolleschi d3d48cb357 feat(JS): Expose text content types to JS (#46170)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46170

This PR expose to JS a few missing text content types on iOS (available from iOS 15)

- dateTime
- flightNumber
- shipmentTrackingNumber

## Changelog
[General][Added] - Expose missing text content type to JS

Reviewed By: blakef

Differential Revision: D61657788

fbshipit-source-id: 1a0ea0e76efaf715d88bcbf249f7cb20b5f3607b
2024-09-10 05:00:00 -07:00
shubhamguptadream11 ce2d34f194 feat(iOS): line break mode implement JS APIs for the new mode (#46128)
Summary:
Solves this issue: https://github.com/facebook/react-native/issues/44107

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

[IOS] [ADDED] - Line break mode for TextInput components. **This includes JS APIs for the new mode.**

This PR is a breakdown of [this](https://github.com/facebook/react-native/pull/45968) PR.

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

Test Plan:
- Added unit tests to cover the new JS APIs.
- Verified that the new mode functions as expected through manual testing.

Reviewed By: andrewdacenko

Differential Revision: D61657004

Pulled By: cipolleschi

fbshipit-source-id: 9fc5c40fc077bee8e1abc51b6eae2e0f0fcd9b8f
2024-09-10 04:52:22 -07:00
Riccardo Cipolleschi 27bd6c9227 Use Debug APK for release testing (#46413)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46413

When testing RNTester for Android during a release, we downloads the APKs from CI to save time.

Sadly, we were downloading the Release APKs instead of the Debug ones, so we could not test te integration with Metro.

This change fixes the testing scripts to download the debug APK

## Changelog
[Internal] - Download the debug APK instead of the Release one

Reviewed By: cortinico

Differential Revision: D62436023

fbshipit-source-id: 08a568caf3e5c85b9da933bc01623587bd36affe
2024-09-10 04:41:07 -07:00
Tim Yung 8dabed60f4 Animated: Create Default NativeAnimatedAllowlist (#46385)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46385

Changes `NativeAnimatedAllowlist` to export a "default allowlist" for use with "native animated components" (i.e. components that are only used with `Animated` values with `useNativeDriver`).

This required some minor internal implementation changes in order to make the allowlist conform to `{[string]: true}`, so I also added some unit tests to ensure the functionality remains the same.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D62351434

fbshipit-source-id: e92b7245c0d61da87a0d149ffeb967f1ebb888a2
2024-09-09 20:34:57 -07:00
Tim Yung f3f652daab Animated: Create Experimental Props Allowlist (#46374)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46374

Creates an experimental `allowlist` parameter that can be supplied to a new `unstable_createAnimatedComponentWithAllowlist` method for use in new experiments to evaluate the impact on product performance and developer experience.

When it is provided, only the props and styles in `allowlist` will be inspected for `AnimatedNode` values. The hypothesis for this change is that restricting the search space for `AnimatedProps` to an allowlist will significantly reduce the runtime overhead of using `Animated` components.

Changelog:
[General][Added] - Created an experimental (unstable) method for allowlisting props when using `Animated`

Reviewed By: javache

Differential Revision: D62117424

fbshipit-source-id: bdd656be1fdc7454360035627644606cb00d33c0
2024-09-09 20:34:57 -07:00
Tim Yung 5dbd9fc159 Animated: Reduce Duplication in Animated{Props,Style} (#46384)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46384

Minor refactor to reduce duplicated logic when traversing props and styles in `AnimatedProps` and `AnimatedStyle`, respectively.

This refactor also makes a future optimization (in which we want to skip processing certain props) more straightforward to implement.

Changelog
[Internal]

Reviewed By: javache

Differential Revision: D62351078

fbshipit-source-id: 63c06462c99ef83f3b511456a3281b940b7a3ac0
2024-09-09 20:34:57 -07:00
Tim Yung 734c1505f4 Animated: Improve Types in Animated{Props,Style} (#46383)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46383

Minor refactors to the internal types of `AnimatedProps` and `AnimatedStyle` to avoid using `Object` and `any`.

This also migrates private properties prefixed with `_` to instead use `#` (ECMAScript private properties). This has the desired benefit of minimizing thrash in the `public-api-test.js` snapshot, too.

There are no behavior changes associated with this commit.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D62351005

fbshipit-source-id: bb69d4db50aef5e0b3193971dac581686e359a95
2024-09-09 20:34:57 -07:00
Tim Yung fe6228512e Animated: Delete AnimatedNode.prototype.toJSON (#46382)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46382

Deletes the `AnimatedNode.prototype.toJSON` method.

It was originally introduced by [facebook/react-native#7442](https://github.com/facebook/react-native/pull/7442) as a means to resolve [facebook/react-native#7441](https://github.com/facebook/react-native/issues/7441), where an error occurs attempting to serialize `AnimatedNode` instances.

However, this is no longer needed for that purpose because our inspector implementation is now more resilient. (It correctly reports the current style value instead of the `AnimatedNode` instance.)

The impetus for this change is that this `toJSON` method prevents a future performance optimization for all `Animated` components.

Changelog:
[General][Changed] - AnimatedNode (and its subclasses) no longer implement `toJSON()`.

Reviewed By: javache

Differential Revision: D62350726

fbshipit-source-id: c68edc98878e58d48bc677c4f1299bb1bd15c9c4
2024-09-09 20:34:57 -07:00
Tim Yung ca234ba10e Animated: Lazily Allocate AnimatedNode Instances (#46317)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46317

Changes `AnimatedProps` to avoid allocating `AnimatedStyle` (and `AnimatedTransform`, `AnimatedObject`) unless necessary.

This not only reduces memory and traversal overhead, but it enables us to implement allowlist strategies to prune unnecessary traversals.

Changelog:
[General][Changed] - Animated now omits `style` if the supplied value is null, undefined, or not an object. Previously, it would emit an empty `style` object.
[General][Changed] - Animated now resolves `style` to the original prop value if it contains no `AnimatedNode` instances. Previously, it would resolve to a flattened style object.

Reviewed By: javache

Differential Revision: D62117423

fbshipit-source-id: 34b0c9940be5b6f5d94467993a5344406cc56f93
2024-09-09 20:34:57 -07:00
Tim Yung 9e6c4fd342 Animated: Codify Update Subscription Invariants (#46373)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46373

Currently, the logic for managing the native subscription in `AnimatedNode` is scattered and difficult to follow. This refactors the code to make the subscription's state easier to understand and harder to break in future refactors.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D62268695

fbshipit-source-id: 098cc6413db2abffa80983116dd0a5f440ba6fce
2024-09-09 20:34:57 -07:00
Tim Yung 7377929e15 RN: Reintroduce forwardRef to ScrollView (#46400)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46400

Since React 19 is not yet stable, we cannot publish a release of React Native depending on it, yet. As such, we have to revert our dependency on React 19 and bring back patterns such as `forwardRef`.

This is a spiritual revert of https://github.com/facebook/react-native/pull/45197.

Changelog:
[Internal]

Reviewed By: cipolleschi

Differential Revision: D62384482

fbshipit-source-id: 880ad1166e0b449ad5be6f914907661adb5f458d
2024-09-09 20:32:19 -07:00
SamChou19815 (Meta Employee) 1f65bf9545 Upgrade Flow to 0.245.2 (#30919)
Summary:
## Summary

This PR bumps Flow all the way to the latest 0.245.2.

Most of the suppressions comes from Flow v0.239.0's change to include
undefined in the return of `Array.pop`.

I also enabled `react.custom_jsx_typing=true` and added custom jsx
typing to match the old behavior that `React.createElement` is
effectively any typed. This is necessary since various builtin
components like `React.Fragment` is actually symbol in the React repo
instead of `React.AbstractComponent<...>`. It can be made more accurate
by customizing the `React$CustomJSXFactory` type, but I will leave it to
the React team to decide.

## How did you test this change?

`yarn flow` for all the renderers

DiffTrain build for commit https://github.com/facebook/react/commit/e210d08180a63f42079b91acaa7f6af15eef6d32.

Reviewed By: yungsters

Differential Revision: D62384646

Pulled By: SamChou19815

fbshipit-source-id: 727794f2d4091f37d771854b8e8a52f070309213
2024-09-09 19:53:43 -07:00
Alan Lee af1b18e125 fix SafeAreaView mis-used import (#46402)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46402

JS code for importing SafeAreaView is causing error in windows due to import being used.
Fix it by using conditional require instead

Changelog:
[Internal] -  Fixed mis-used import of core only SafeAreaView in JS

Reviewed By: fkgozali

Differential Revision: D62392588

fbshipit-source-id: 65c4728ff73b43cc54543ec2d141a88fce1275ca
2024-09-09 19:43:27 -07:00
Kacper Rozniata 84f2d25124 fix(iOS): fix animating Switch component value change (#46173)
Summary:
This PR fixes animating controlled `Switch` component when it's initial value is set to `false`

When initial value was set to `false`, `_isInitialValueSet` flag wasn't changed to `YES`, because `oldSwitchProps.value` &`newSwitchProps.value` were equal, which resulted in controlled `Switch` component being updated without animation on first value change

This PR fixes it by moving setting `_isInitialValueSet` flag to the end of `updateProps` method

## Changelog:

[IOS] [FIXED] - Fix animating Switch component value change in Fabric

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

Test Plan:
1. Open `Switch` example in `RNTester`
2. In `Change events can be detected` section press switch that is `off` by default
3. Switch under it should change with animation

Reviewed By: javache

Differential Revision: D62377771

Pulled By: cipolleschi

fbshipit-source-id: 0213287c935db79a199b086ebb36a6979df03913
2024-09-09 16:41:49 -07:00
Samuel Susla 95af340aac ship granular state updates on iOS (#46403)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46403

changelog: [internal]

ship granular state updates on iOS.

Reviewed By: rubennorte

Differential Revision: D62374462

fbshipit-source-id: 7ed217011e1c65031d418f1807802c113628f542
2024-09-09 15:23:59 -07:00