Commit Graph

32109 Commits

Author SHA1 Message Date
Zeya Peng b5683a7516 Create util functions to convert Color <-> uint8_t RGBA values (#45139)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45139

## Changelog

Sometimes we pass down int RGBA values in [0, 255] to represent color components in ReactNative;
and other times we use float. Since we introduce display P3, we probably want to use color depth more than 8bit

In the first case, when RGBA are passed down as uint8_t, we can directly calculate Color/SharedColor without normalizing them to [0,1] and scale back to [0, 255] as `colorFromComponents` does; otherwise there could be some precision loss..

So here I'm adding some new utils for that purpose: see `colorFromRGBA`, `redFromColor`, `greenFromColor`, etc

[Internal]
Examples in codebase:
* rgba in [0, 255]:
https://www.internalfb.com/code/fbsource/[67148a47147b0e15f0f0748003394040611c2bc2]/xplat/js/react-native-github/packages/react-native/ReactCommon/react/renderer/graphics/fromRawValueShared.h?lines=28-35

* rgba in [0, 1]:
https://www.internalfb.com/code/fbsource/[67148a47147b0e15f0f0748003394040611c2bc2]/xplat/js/react-native-github/packages/react-native/ReactCommon/react/renderer/graphics/fromRawValueShared.h?lines=37-45

https://www.internalfb.com/code/fbsource/[67148a47147b0e15f0f0748003394040611c2bc2]/xplat/js/react-native-github/packages/react-native/ReactCommon/react/renderer/graphics/fromRawValueShared.h?lines=47-64

Reviewed By: rshest

Differential Revision: D58872165

fbshipit-source-id: 748a12a99591c895fed65cda6deeaa2a3e0c3cf5
2024-06-25 16:04:56 -07:00
Tim Yung 08b05f30c2 RN: Refactor ScrollView Native Component Imports (#45168)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45168

Refactors the native component imports in `ScrollView` so that 1) they create less clutter in the `ScrollView` implementation file, and 2) they offer more efficient import inlining.

Currently, `ScrollView` has to evaluate both horizontal and vertical components even though only one may be used. Now this optimization is possible.

Changelog: [Internal]

Reviewed By: lyahdav

Differential Revision: D59015990

fbshipit-source-id: 963009821a7d3019d36a43269e9792ac1f2f38ec
2024-06-25 13:25:43 -07:00
Ruslan Lesiutin 2e03d262d4 upgrade[react-devtools-*]: v.5.3.0 (#45159)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45159

Changelog: [Internal]

via `js1 upgrade react-devtools -v ^5.3.0`

allow-large-files

Reviewed By: EdmondChuiHW

Differential Revision: D59001348

fbshipit-source-id: e17e1070b38256644fa987bd00510b8a7c5d848a
2024-06-25 10:52:46 -07:00
Dmitry Rykun a44dd57f10 Update codegen artifacts for react-native-test-library (#45164)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45164

Some changes have been made to the codegen since `react-native-test-library` was published. This diff updates the generated artifacts in that library.
Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D59010093

fbshipit-source-id: f11ccd3645da72d45c70581e485f8546166ca182
2024-06-25 09:57:04 -07:00
zhongwuzw 70b43bb013 Fixes js bundle failed (#45155)
Summary:
When I enabled `FORCE_BUNDLING`, it build errors like below. cc blakef
![image](https://github.com/facebook/react-native/assets/5061845/d23f6bad-ed60-4f1f-8111-2361c93e93a4)

## Changelog:

[INTERNAL] [FIXED] - Fixes js bundle failed

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

Test Plan: Enable FORCE_BUNDLING and build success.

Reviewed By: cipolleschi

Differential Revision: D59006962

Pulled By: blakef

fbshipit-source-id: 1142d1ddbae7346b67712fac0237950847211992
2024-06-25 08:57:21 -07:00
Ramanpreet Nara 7522336412 Bridgeless: Allow js bundle configuration via filepaths
Summary:
## Summary
Right now, the only way to load the javascript bundle is through the assets:// directory.

But, legacy react native also supports loading bundles via regular file urls.

If present, those file urls override the assets:// bundle urls.

This diff implements that support in bridgeless.

Changelog: [Android][Added] Allow js bundle file urls

Reviewed By: christophpurrer

Differential Revision: D58977143

fbshipit-source-id: 6f1a170546c8bbeac3a1b9d2dd5633177e33a688
2024-06-25 07:13:39 -07:00
Ramanpreet Nara 80e1dd70b0 ReactHost: Make ReactInstanceEventListener APIs public
Summary:
The ReactInstanceManager allows applications to register a ReactInstanceEventListener with itself.

Exposing a similar functionality to ReactHost. So, applications can do the same in bridgeless.

Changelog: [Android][Added] - Make ReactInstanceEventListener available on ReactHost

Reviewed By: christophpurrer

Differential Revision: D58890092

fbshipit-source-id: c18ee8a45d274c5cba859c6a5b4049904f1d308a
2024-06-25 07:13:39 -07:00
Rob Hogan 88ba9a6042 Inspector: Support /open-debugger specifying target param (#45138)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45138

Add a new `/open-debugger` endpoint format that allows specifying `target` - the proxy-unique target `id`. This is logically equivalent to specifying both device and page.

Changelog:
[General][Added]: Inspector: Support `/open-debugger` specifying `target` param

Reviewed By: hoxyq

Differential Revision: D58950622

fbshipit-source-id: 9665f8a24ba2bb0561cc3c693dfb84bfffdeb4a4
2024-06-25 06:28:57 -07:00
Rob Hogan c7970379a1 Inspector: Enforce device and appId filters if both are given to /open-debugger (#45140)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45140

Previously, if the `/open-debugger` endpoint was provided with both `device` and `appId` query params, we would:
 - Try to find a target with a matching `device` (note that these logical "devices" are unique per-app) - if found, use it. Otherwise,
 - Try to find a target with a matching `appId` - if found, use that.

This could go "wrong" in two ways:
 - If a `device` is given with a spurious `appId`, we'd open to a target with an `appId` differing from the one specified.
 - If the `device` has gone away but there is a different target with the same app, we'd use that as a fallback (right app, wrong device).

This applies the filters more strictly so that if both are given, both must match.

Changelog:
[General][Changed]: Inspector: Enforce device and appId filters if both are given to /open-debugger

Reviewed By: hoxyq

Differential Revision: D58951952

fbshipit-source-id: a95f1160e5c88f957445058f3273e922a5d28c1e
2024-06-25 06:28:57 -07:00
Dmitry Rykun 1fda630d87 Make RawPropsParser::iterateOverValues more performant (#45088)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45088

This diff should make iterator-style prop setting more performant.
- It removes some layers of indirection. Now `ConcreteComponentDescriptor` calls into `setProp` directly.
- On both platforms, we will use `folly::dynamic` parser, it seems it is slightly faster.
- On Android, we will reuse `props->rawProps` parsed as a `folly::dynamic` representation, instead of parsing stuff twice.

Changelog: [Internal] - This hasn't been rolled out to OSS yet.

Reviewed By: javache

Differential Revision: D58593492

fbshipit-source-id: aa2dcb4e7ba2248f6ba7aa82a60355efdf769b2c
2024-06-25 05:09:08 -07:00
zhongwuzw 9b9c780cc8 Fixes TextInput crash when undo if text longer than maxLength (#45097)
Summary:
Fixes https://github.com/facebook/react-native/issues/45050 . System pass the range bigger than we allowed because we limit the maxLength. We truncated the range to fix the undo crash.

cc. cortinico .

## Changelog:

[IOS] [FIXED] - Fixes TextInput crash when undo if text longer than maxLength

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

Test Plan: Repro please see https://github.com/facebook/react-native/issues/45050.

Reviewed By: cortinico

Differential Revision: D58947130

Pulled By: cipolleschi

fbshipit-source-id: 1c09cad8ac7ee99f3a3eef93fafb5aeac425d146
2024-06-25 04:23:38 -07:00
Biki-das cf015f93ef feat:- added UIInterfaceOrientation in place of statusBarOrient… (#44825)
Summary:
This PR replaces the depreacted `statusBarOrientation` method to `interfaceOrientation`, as in the apple developer docs it clearly says the method has been deprecated
https://developer.apple.com/documentation/uikit/uiapplication/1623026-statusbarorientation

## Changelog:
[iOS] feat:- added UIInterfaceOrientation in place of statusBarOrietation.

[IOS] [ADDED] - Added RCTUIInterfaceOrientation helper method

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

Test Plan: Tried `RNTester` build after the changes and it ran successfully!

Reviewed By: cortinico

Differential Revision: D58947500

Pulled By: cipolleschi

fbshipit-source-id: 401abf1d46b415093f441d1dbee139e7aaf8712c
2024-06-25 04:14:30 -07:00
Miklós Fazekas f903f34837 Allow library podspec to declare Swift Package Manager dependencies (#44627)
Summary:
React-Native uses Cocapods for native dependency management on iOS. While CocoaPods is flexible and popular, Apple's Swift Package Manager is the new standard. Currently consuming packages available only via Swift Package Manager is not possible. This change implements a single extension so .podspec files can declare Swift Package Manager dependencies via
```ruby
ReactNativePodsUtils.spm_dependency(s,
     url: 'https://github.com/apple/swift-atomics.git',
     requirement: {kind: 'upToNextMajorVersion', minimumVersion: '1.1.0'},
     products: ['Atomics']
   )
```

bypass-github-export-checks

## Changelog:

[IOS] [ADDED] - libraries can now declare Swift Package Manager dependencies in their .podspec with `ReactNativePodsUtils.spm_dependency`

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

Test Plan:
https://github.com/mfazekas/rn-spm-rfc-poc/

Is a simple demo for the feature:

1. Podspec declare dependency with:

   ```ruby
   if const_defined?(:ReactNativePodsUtils) && ReactNativePodsUtils.respond_to?(:spm_dependency)
     ReactNativePodsUtils.spm_dependency(s,
       url: 'https://github.com/apple/swift-atomics.git',
       requirement: {kind: 'upToNextMajorVersion', minimumVersion: '1.1.0'},
       products: ['Atomics']
     )
   else
     raise "Please upgrade React Native to >=0.75.0 to use SPM dependencies."
   end
   ```

2. [`import Atomics`](https://github.com/mfazekas/rn-spm-rfc-poc/blob/e4eb1034f7498dedee4cb673d327c34a6048bda2/ios/MultiplyInSwift.swift#L1C2-L1C15) and [`ManagedAtomic`](https://github.com/mfazekas/rn-spm-rfc-poc/blob/e4eb1034f7498dedee4cb673d327c34a6048bda2/ios/MultiplyInSwift.swift#L7-L13) is used in the code

3.) `spm_dependency` causes the dependency to be added via `post_install` hook in the workspace

<img width="261" alt="image" src="https://github.com/facebook/react-native/assets/52435/ad6aee1c-ac88-4c84-8aa3-50e148c4f5b2">

4.) `spm_dependecy` causes the library to be linked with `Atomics` library

<img width="817" alt="image" src="https://github.com/facebook/react-native/assets/52435/bfc8dfc0-aeb7-4c75-acbd-937eab1cbf80">

Limitations:
1.) only works `USE_FRAMEWORKS=dynamic pod install` otherwise the linker fails [with known Xcode issue - duplicate link issue](https://forums.swift.org/t/objc-flag-causes-duplicate-symbols-with-swift-packages/27926)
2.) .xcworkspace needs to be reopened after `pod install` - this could be worked around by not removing/readding spm dependencies

### See also:

https://github.com/react-native-community/discussions-and-proposals/issues/587#issuecomment-2117025448
https://github.com/react-native-community/discussions-and-proposals/pull/787

Reviewed By: cortinico

Differential Revision: D58947066

Pulled By: cipolleschi

fbshipit-source-id: ae3bf955cd36a02cc78472595fa003cc9e843dd5
2024-06-25 03:45:07 -07:00
Moti Zilberman 4a8f0ee58a Keep HostTarget registered until ReactHostImpl/ReactInstanceManager is invalidated (#45146)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45146

Changelog: [Internal]

Currently, on Android, we destroy the Fusebox `HostTarget` when we receive the `onHostDestroy` event, which (counterintuitively) does not mean the ReactHost/InstanceManager ("Java Host") is being destroyed. This can lead to situations where the `HostTarget` is destroyed too soon (e.g. when a single Java Host is reused across multiple Activities).

Now that we have the `invalidate()` method on the Java Host classes, we can tie `HostTarget`'s destruction to that instead.

Since calling `invalidate()` is explicitly optional, we also need to account for the case where the caller just lets go of the Java Host reference and expects GC to handle cleanup. This includes:

* Breaking the retain cycle between the Java Host and its C++ part. We achieve this using `WeakReference` to reference the Java Host.
* Making the C++ part of the Host safe to destroy from any thread (and in particular the finalizer thread). We achieve this by scheduling `HostTarget`'s unregistration (in C++) on the executor supplied by the Java Host.

Reviewed By: hoxyq

Differential Revision: D58284590

fbshipit-source-id: 4ee4780354fb81137b891d5891d6138ac215cbff
2024-06-24 14:35:53 -07:00
Moti Zilberman a7adfef0bb Reject debugger connections to unknown page IDs (#45148)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45148

Changelog: [General][Fixed] Reconnecting to an unknown inspector page no longer results in a zombie connection

TSIA

Reviewed By: hoxyq

Differential Revision: D58954759

fbshipit-source-id: 99c5caccc3cc917e0691e94326c7a35874f9a385
2024-06-24 12:59:53 -07:00
Christoph Purrer 6daccf75da Enable EventEmitter parsing for TypeScript TM Specs (#45118)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45118

## Changelog:

[General] [Fixed] - Enable EventEmitter parsing for TypeScript TM Specs

Reviewed By: rshest

Differential Revision: D58929364

fbshipit-source-id: 0f95aee2f387edf0a148b368d71b0325c805f724
2024-06-24 11:36:49 -07:00
Robert Pasiński af04eb773c fix: Improve Timers error handling and web compatibility (fixes #45085) (#45105)
Summary:
Improve compatibility with web implementations of JS timers.

Fixes https://github.com/facebook/react-native/issues/45085

## Changelog:

[GENERAL] [CHANGED] - Timer functions are now throwing exceptions in less cases and are instead quiet quitting (similar to browsers)
[GENERAL] [CHANGED] - Timer functions `timeout` argument is now coerced to a number

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

Test Plan: Updated RN tester

Reviewed By: christophpurrer

Differential Revision: D58952146

Pulled By: javache

fbshipit-source-id: 5b6de524f6a03f5221f0d11e0ae2a9313951c767
2024-06-24 11:24:46 -07:00
Rubén Norte 0062435d2e Rename some methods in RuntimeScheduler_Modern to refer to event loop more explicitly (#45143)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45143

Changelog: [internal]

Just a small refactor of some private methods in `RuntimeScheduler_Modern` to refer to some concepts in terms of the event loop.

Reviewed By: christophpurrer

Differential Revision: D58948811

fbshipit-source-id: 979c78ccd4cf5d96f00061049366171934b43ee2
2024-06-24 10:22:38 -07:00
Blake Friedman 2d737bbf9a fix: podfile lock cache keys (#45128)
Summary:
These keys weren't evaluating`hashfiles(...)`.

{F1716603166}

## Changelog: [Internal]

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

Reviewed By: cipolleschi

Differential Revision: D58947839

Pulled By: blakef

fbshipit-source-id: d3c36235387a1c54f637b2b9bf53198bd29226e2
2024-06-24 09:40:43 -07:00
Moti Zilberman 986cf18dd2 Migrate ReactHost / ReactInstanceManager destroy() call sites to use invalidate() (#45082)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45082

Changelog: [Android][Breaking] `ReactNativeHost` invalidates the instance manager on `clear()`

Changes `ReactNativeHost.clear()` to invalidate the underlying `ReactInstanceManager`, rather than merely destroying the instance.

This is technically a **breaking change** because the underlying `ReactInstanceManager` may have escaped (via `ReactNativeHost.getReactInstanceManager()`) before the `clear()` call. In my reading of the API and of usages like [this one in Expo](https://github.com/expo/expo/blob/23a905b17065703882ebeda1fc9f65a05cc69fa7/packages/expo-dev-menu-interface/android/src/main/java/expo/interfaces/devmenu/ReactHostWrapper.kt#L117), this should rarely occur in practice.

The plan:
1. D58811090: Add the basic `invalidate()` functionality.
2. **[This diff]**: Add `invalidate()` call sites where it makes sense in core.
3. [Upcoming diff]: Keep the Fusebox debugging target registered until the Host is explicitly invalidated.

Reviewed By: javache

Differential Revision: D58811091

fbshipit-source-id: 5dfebad46a2bdf3601642b3c3fe3e79e8695e193
2024-06-24 09:14:01 -07:00
Moti Zilberman a3db352e25 Add invalidate() method to ReactHost and ReactInstanceManager (#45081)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45081

Changelog: [Android][Added] Add `invalidate()` method to ReactHost and ReactInstanceManager

Adds an `invalidate()` method to both `ReactHost` (Bridgeless) and `ReactInstanceManager` (Bridge). This method is an *optional* signal that the application is about to permanently stop using the Host, and that the Host can therefore fully clean up any resources it's holding.

Reusing a Host after it's invalidated is illegal and will trigger a Java assertion.

The plan:
1. **[This diff]**: Add the basic `invalidate()` functionality.
2. [Upcoming diff]: Add `invalidate()` call sites where it makes sense in core
3. [Upcoming diff]: Keep the Fusebox debugging target registered until the Host is explicitly invalidated.

Reviewed By: tdn120

Differential Revision: D58811090

fbshipit-source-id: 79b607dcc74de38b85fc0ebb4c640b9654595c9a
2024-06-24 09:14:01 -07:00
Jorge Cabiedes Acosta d11a7b0d18 Add DropShadow effect on Android (#44937)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44937

Continuing CSS filters support efforts for Android this diff implements support for dropShadow.

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D58488573

fbshipit-source-id: 393e43ba1e24705d8f1fc4ba3df8e12272d874b3
2024-06-24 08:45:51 -07:00
Jorge Cabiedes Acosta b56ce9d35b JS plumbing to get dropShadow into native (#44939)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44939

DropShadow is a filter so we need to add the logic for sending it to native through the same process function for the other filters.

Drop shadow can have more arguments than the other filters. I'm following a similar pattern to boxShadow D57872933.

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D58370127

fbshipit-source-id: dba06bb2e0ea2799d20e8b0b9065a5729df22bb6
2024-06-24 08:45:51 -07:00
Blake Friedman 9ba600c066 chore: remove lockfile from Helloworld (#45135)
Summary:
Accidentally shipped, removing.

## Changelog: [Internal]

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

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

Reviewed By: christophpurrer

Differential Revision: D58950410

Pulled By: blakef

fbshipit-source-id: 7bda7278f918a1e50c25f86e461e19fe7e176c5c
2024-06-24 08:08:11 -07:00
Nicola Corti 61b3c95b45 Bump CLI to 14 alpha9 (#45121)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45121

As the title says

Changelog:
[Internal] [Changed] - Bump CLI to 14 alpha9

Reviewed By: cipolleschi, blakef

Differential Revision: D58945983

fbshipit-source-id: 227b56bb0441a60ce247524ac8361e5eb8674c3c
2024-06-24 06:51:29 -07:00
Riccardo Cipolleschi 42735717b5 Fix Cache checks in build_hermes_macos (#45127)
Summary:
The cache checks in GHA were performed against bool values, while the actual values are strings.
So the checks were always failing and all the steps were executed, even when not necessary.

The reason why it was failing is because, with this setup, when a cache is hit, some steps were skipped in previous jobs, making following jobs trying to execute code on not-existing files.

## Changelog:
[Internal] - Fix cache for build_hermes_macos

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

Test Plan: GHA are green again

Reviewed By: blakef

Differential Revision: D58947838

Pulled By: cipolleschi

fbshipit-source-id: 8dba216e72a3034fd4c1484418d37bfb78cf314d
2024-06-24 05:54:30 -07:00
Nick Lefever 72ce6ff03a Fix runtime shadow node reference corruption on measure (#45116)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45116

Changelog: [Internal]

The UIManagerBinding `findShadowNodeByTag_DEPRECATED` method returns a shadow node and was updating the runtime reference on the shadow node with the created wrapper for the return value.

The JSObject holding the wrapper would get deallocated, which would deallocate the wrapper stored on the shadow node.

This would cause crashes on the next reference update for the shadow node, due to the shared_ptr being reassigned with the new value while it was already deallocated.

The `sendAccessibilityEvent` function calls `findShadowNodeByTag_DEPRECATED` to get the shadow node referenced by the provided react tag, which could lead to runtime shadow node reference corruption.

Reviewed By: sammy-SC

Differential Revision: D58920296

fbshipit-source-id: ddb9ed0ee64bc01934aabde7070731dc53a2db70
2024-06-24 05:20:42 -07:00
Oskar Kwaśniewski 6bb75c7b13 fix: set proper framework dependencies for built-in pods (#45104)
Summary:
Platforms like visionOS require explicit framework dependencies to be set in pods to build properly. For some reason linking on visionOS is more strict than on iOS but this might change in some future OS versions so it's good to have pods having exact dependencies.

I've discussed that earlier with Saadnajmi and cipolleschi. Let me know if you are okay with this change.

## Changelog:

[IOS] [FIXED] - set proper framework dependencies for built-in pods

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

Test Plan: CI Green

Reviewed By: dmytrorykun

Differential Revision: D58943593

Pulled By: cipolleschi

fbshipit-source-id: 3d2df4f3bbdf36704e09f5e39bfb838b2e0f3c99
2024-06-24 03:14:55 -07:00
Panos Vekris f7fe68861a set one_sided_type_guards=true in fbsource (#45107)
Summary:
This diff enables:
1.  [one-sided type guards](https://flow.org/en/docs/types/type-guards/#one-sided-type-guards) (`implies x is T`), and
2. stricter checking of type guard consistency (see [relevant docs page](https://flow.org/en/docs/types/type-guards/#toc-consistency-checks-of-type-guard-functions)).

To prevent many new errors from being introduced this diff also converts some two-sided type guards to [one-sided](https://flow.org/en/docs/types/type-guards/#one-sided-type-guards) ones.

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

Updated the flowconfigs and synced flow_runner/codemods since the change has already been applied there:
```
js1 upgrade www-shared -p flow_runner/codemods
```

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D58874409

fbshipit-source-id: 959a6773701518a1d6aa35e2ec28fd4ce12d2e75
2024-06-21 16:15:34 -07:00
Benoit Girard 8a6508c623 Increase the buffer size and try kStall to avoid dropping samples (#45111)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45111

Spent time debugging this issue today:
https://fb.workplace.com/groups/1700234700326965/posts/2197109080639522

The problem is described here:
https://perfetto.dev/docs/concepts/buffers

But basically we're writing too much data, too fast and the traced process can't read it fast enough. Perfetto is doing data drop.

This diff tries to use the `kStall` mode. It doesn't seem to do much but I'll leave it in for now because it shouldn't hurt too much. It's designed for our use case.

The main fix comes from increasing the buffer size to 20MB. Since it's not on by default I think it's fine to have a really large buffer for now to unblock tracing.

Reviewed By: javache

Differential Revision: D58832598

fbshipit-source-id: 101b364e2e9e28aa6a041ded1df82d5fec1f42e1
2024-06-21 13:31:55 -07:00
Oskar Kwaśniewski 34cd195d9f fix: retrieve statusbar size using RCTUIStatusBarManager (#45103)
Summary:
This PR changes the call from `RCTSharedApplication()` to retrieve the status bar size using the `RCTUIStatusBarManager()` method, a way which supports multi-window apps.

## Changelog:

[IOS] [FIXED] - Retrieve status bar size using RCTUIStatusBarManager

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

Test Plan: Check if the perf menu pops up in the correct spot.

Reviewed By: javache

Differential Revision: D58868503

Pulled By: cipolleschi

fbshipit-source-id: db5fc80a712a8a18a2863cdfbbe44f48bafe9fc3
2024-06-21 08:27:50 -07:00
Rubén Norte a8a76f9bfa Improve profiling information for timers (#45091)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45091

Changelog: [internal]

We're currently logging when we execute timers in Systrace/Perfetto, but we have no information about them whatsoever.

This adds some additional information:
  * What kind of timer it is
  * It's ID
  * And most importantly, when it was created (including the ID as well).

This allows us to know where was a specific timer scheduled and with what API.

Reviewed By: bgirard

Differential Revision: D58832112

fbshipit-source-id: 1bc11759b6c8296acf63ff3533ca1dc3428360a7
2024-06-21 05:13:20 -07:00
Rubén Norte fdf0183831 Stop defining setImmediate and clearImmediate from TimerManager when using microtasks (#45090)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45090

Changelog: [internal]

The definition of these methods is redundant when using microtasks, so it's better to avoid defining them in the first place (to also detect issues if the setup is not what we expect).

Reviewed By: sammy-SC

Differential Revision: D58816582

fbshipit-source-id: dd1b07f8b11069605e3184b1272a9bbc3b44ca75
2024-06-21 05:13:20 -07:00
Irfanwani 1bec961c95 fix: post install error in iOS after running pod install, undefined method 'path' for nil:NilClass (#45095)
Summary:
After upgrading my project to the latest version of react native i.e, 0.74.2, i was getting an error when running `pod install` an the error was coming from the post install hook. Going deeper into the file tree, i found that some of the things are Nil and react native is trying to use some methods on them, so fixed those issues by using chaining operators to conditionally apply the path method on them.

## Changelog:

[Internal] - fixes the post install issue when running pod install with react native version, 0.74.2

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

Test Plan: Manually tested the fix. Works perfectly fine in both debug and production mode.

Reviewed By: cortinico

Differential Revision: D58863666

Pulled By: cipolleschi

fbshipit-source-id: 64459711dcf926b7544b99b542e9861c1c0f05ca
2024-06-21 04:36:01 -07:00
Oskar Kwaśniewski a7b2555644 feat: remove upper limit for Cocoapods version (allow for 1.15.2) (#45099)
Summary:
This PR uses a suggested solution from here: https://github.com/facebook/react-native/issues/42698 to allow users to use Cocoapods 1.15.2 which fixed issues regarding RN builds.

## Changelog:

[IOS] [FIXED] - Bump cocoapods version to 1.15.2 excluding 1.15.0, 1.15.1

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

Test Plan: CI Green

Reviewed By: blakef

Differential Revision: D58863685

Pulled By: cipolleschi

fbshipit-source-id: 0128eb0cbf83e4a3d35addbae4c31e349775688c
2024-06-21 04:12:26 -07:00
Nicola Corti e7d1708701 Fix broken unableToAddHandledRootView (#45101)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45101

This test broke after I merged
https://github.com/facebook/react-native/pull/34785
yesterday.

Just fixing it in a similar way as the test above.

Changelog:
[Internal] [Changed] - Fix broken unableToAddHandledRootView

Reviewed By: rubennorte, blakef

Differential Revision: D58864166

fbshipit-source-id: 4f48dbfd5238a2811564ce02199af7fc284d39b4
2024-06-21 03:41:40 -07:00
Nicola Corti 15909fab95 packages/react-native-gradle-plugin/ -> packages/gradle-plugin/ (#44832)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44832

I'm renaming this folder as now we have 2 gradle plugins + we currently have
`package/react-native-gradle-plugin/react-native-gradle-plugin/` which is confusing so we can just call this folder `packages/gradle-plugin/`
to be consistent with the NPM package name

Changelog:
[Internal] [Changed] - packages/react-native-gradle-plugin/ -> packages/gradle-plugin/

Reviewed By: blakef

Differential Revision: D58284883

fbshipit-source-id: 5a7bb40a5d80f6fbab4ffb29e44107453f1013ec
2024-06-21 01:08:00 -07:00
psionic12 3429dc1ccf Log a SoftException on SurfaceMountingManager.addRootView (#34785)
Summary:
Follow the same solution (do not throw a crash when view ID is set already) used in `ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java` for `ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java`

## Changelog

[Android] [Changed] - Log a SoftException on SurfaceMountingManager.addRootView

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

Test Plan: None

Reviewed By: cipolleschi

Differential Revision: D40022263

Pulled By: cortinico

fbshipit-source-id: d565d2831e2833ccea55f28ea16083b7bae0ed32
2024-06-20 13:16:32 -07:00
Blake Friedman 3dcf86b802 Update @react-native-community/cli to 14.0.0-alpha.7 (#45086)
Summary:
RN CLI to 14.0.0-alpha.7

## Changelog:
[General][Changed] RN CLI to 14.0.0-alpha.7

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

Test Plan:
```
yarn
```

Reviewed By: cortinico

Differential Revision: D58819145

Pulled By: blakef

fbshipit-source-id: 025f190908c52afd3f1055a665986fea4785e192
2024-06-20 11:48:18 -07:00
Jakub Piasecki 2eaf0b0848 Add an overload for createLayout to reduce code duplication (#45083)
Summary:
Adds an overload for `createLayout` method that also handles extracting paragraph attributes and scaling font size if necessary.

## Changelog:

[ANDROID] [CHANGED] - Extracted common parts related to calculating text layout to a helper

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

Test Plan: Tried out on RNTester

Reviewed By: robhogan

Differential Revision: D58818560

Pulled By: cortinico

fbshipit-source-id: a42b5de04c4a70edb88cdd734387d7e4cee94032
2024-06-20 11:09:15 -07:00
Nicola Corti 8a6b88eeaf Back out "Add Float and Int type support for Android modules" (#45087)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45087

Original commit changeset: 32b3bbdf5fd2

Fixes https://github.com/facebook/react-native/issues/44963
Closes https://github.com/facebook/react-native/pull/45024

Original Phabricator Diff: D52420921

Changelog:
[Internal] [Changed] - Back out "[RN][Codegen]Add Float and Int type support for Android  modules"

Reviewed By: dmytrorykun

Differential Revision: D58820544

fbshipit-source-id: 59cd0e7cc17a681785c57b5ce1a9d50d28a348af
2024-06-20 11:06:46 -07:00
Alan Lee 8a3ffb6d23 fix TextInput 'contextMenuHidden' prop (#45014)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45014

`TextInput`'s `contextMenuHidden` prop isn't working working as expected.
It should hide the context menu (copy/paste/...) that pops up from input text.

Reference: [Android doc](https://developer.android.com/reference/android/widget/TextView#setCustomSelectionActionModeCallback(android.view.ActionMode.Callback))
> Returning false from `ActionMode.Callback.onCreateActionMode(ActionMode, android.view.Menu)` will prevent the action mode from being started.

**Changelog:** [Android][Fixed] - TextInput's `contextMenuHidden` prop bug fix

Reviewed By: javache

Differential Revision: D58684366

fbshipit-source-id: 328c267ed0e896a78e114578e3a00adf41f2e095
2024-06-20 10:38:58 -07:00
Riccardo Cipolleschi 75451d5b89 Fix yml syntax on main (#45084)
Summary:
While landing a change on GH, I forget to remove one line that does not belong to an action

## Changelog:
[Internal] - CI fix

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

Test Plan: GHA are green

Reviewed By: blakef

Differential Revision: D58817768

Pulled By: cipolleschi

fbshipit-source-id: 5fc02d2d2a19dd3fe2202c93d0d1873e5dda4b82
2024-06-20 07:49:52 -07:00
Riccardo Cipolleschi 9c6c637816 Refactor Hermes workspace (#45071)
Summary:
This change is the first step in refactoring GHA so that they can be reused more easily across jobs.
Its goal is also to be more reliable w.r.t. caches.

That this change do:
* moves `prepare_hermes_workspace` to a composite action
	* saves the `prepare_hermes_workspace` caches only on main
	* uploads the destination folder as an artifact so that we can use it later in the run
* makes the `test-all`, `nightly` and `publish-release` workflow use the new composite action
* updates the `setup-hermes-workspace` to download and use the artifact uploaded by `prepare_hermes_workspace`

## Changelog:
[Internal] - Factor out the prepare_hermes_workspace action

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

Test Plan: GHA in CI

Reviewed By: cortinico

Differential Revision: D58808087

Pulled By: cipolleschi

fbshipit-source-id: 42c46bcf75fc73b2edfda9be62b5d0fe8a919a5d
2024-06-20 06:50:23 -07:00
Pieter De Baets 2e6f105ef3 Pass EventDispatcher listeners by value (#45077)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45077

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D58791938

fbshipit-source-id: 079fbfad4dd309a41c360e1bdb93e56f8793e6b3
2024-06-20 06:15:11 -07:00
Pieter De Baets a2cb34371e Handle textAlignment: start and make logs consistent (#45076)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45076

> **start**: The same as left if direction is left-to-right and right if direction is right-to-left.

This is equivalent to `auto`, which is not actually a valid CSS value.

Changelog: [General][Added] Add support for `texAlignment: 'start'`

Reviewed By: sammy-SC

Differential Revision: D58791937

fbshipit-source-id: 09622d814212a7055f94b1f091c71edae5db117c
2024-06-20 06:15:11 -07:00
Nicola Corti a297b30377 Bump reactnativecommunity/react-native-android to 13.1 (#45073)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45073

We can also remove the workaround needed for git `safe.directory`
as this is now configured inside the container as `*`

Changelog:
[Internal] [Changed] - Bump reactnativecommunity/react-native-android to 13.1

Reviewed By: blakef

Differential Revision: D58789791

fbshipit-source-id: f44163a0aa822b19e0dd1106d3f039fd0dc83186
2024-06-20 06:04:45 -07:00
Riccardo Cipolleschi ea31a79fe9 Fix build_android by setting git safe folders (#45065)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45065

This fix makes sure that Android runner can run git commands.
This is porting in main the commit https://github.com/facebook/react-native/commit/fee215664287ddca31c8400c87a825c8e9822290

## Changelog
[Internal] - Make the build_android run git commands

Reviewed By: cortinico

Differential Revision: D58782969

fbshipit-source-id: ab35f7e3d1733ab770f2a397552daa1ec7c13cf7
2024-06-20 03:24:29 -07:00
Riccardo Cipolleschi 710b0e64ab Port fixes to release scripts to use GITHUB_REF and GITHUB_REF_NAME variables (#45066)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45066

This changes ports in main the fixes we had to make to the release scripts to run properly in release mode.

This includes the commits:

* https://github.com/facebook/react-native/commit/375c88478c985976e1b59dfa7353042a18b4d132
* https://github.com/facebook/react-native/commit/609c7c05b13214f2a834b251de095243f8dcbf68
* https://github.com/facebook/react-native/pull/45062

## Changelog:
[Internal] - Fix release scripts to run properly in release mode

Reviewed By: cortinico

Differential Revision: D58782925

fbshipit-source-id: b096909d5f8281809ee3c2a01eefda1d19f32936
2024-06-20 03:24:29 -07:00
Riccardo Cipolleschi 90d4d55122 Port Create Release fixes from Stable to main (#45063)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45063

While doing the release of 0.75, we have to fix the Create Release action a few times to get it right.
This change contains the fixes from
* https://github.com/facebook/react-native/commit/e36b46f0c970dc3f1f5b5058a8d10834acdb2667
* https://github.com/facebook/react-native/commit/1b891357b2f1995f2344cc991be423ca66fa6770
* https://github.com/facebook/react-native/commit/56e1c8bfdd57600e79c0b17de1d2fd933d20b8f9
* https://github.com/facebook/react-native/commit/03591318fbabdc0c06808316f471cc361b53c57f
* https://github.com/facebook/react-native/commit/528097709aeef434b0d85565bfd89a4a9ff5644e
* https://github.com/facebook/react-native/commit/f4b1dd1fa11374cae8a696833ad9ded0767cba8f

## Changelog
[Internal] - Backport changes to Create Release github action

Reviewed By: cortinico

Differential Revision: D58782391

fbshipit-source-id: b68088fb8c4290efcb4599d1b090b18e401e4b66
2024-06-20 03:24:29 -07:00