Commit Graph

6545 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
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
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
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
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
Edmond Chui e5c7eb57e2 Update debugger-frontend from f7e972c...750ed14 (#45074)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45074

Changelog: [Internal] - Update `react-native/debugger-frontend` from f7e972c...750ed14

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

Reviewed By: vzaidman

Differential Revision: D58790390

fbshipit-source-id: b6b15ecbd521cdb231aa9d21135aacc39f31a425
2024-06-20 02:46:03 -07:00
Rob Hogan 2a6a895b17 Debugger: j opens debugger on most recently connected target (#45060)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45060

Currently, `j`, (i.e., `/open-debugger` with no parameters), connects the "first available" target, which in practice is the first page of the first connected device still connected.

In the absence of a target selection UI, a better guess at user intent is to use the *latest* target (most recently added page of most recently connected device).

Also slightly reduces CLI noise by not claiming that we're launching a debugger when there's no target, and not qualifying which target when there's only one.

Changelog:
[General][Changed] Debugger: `j` opens most recent (not first) target.

Reviewed By: huntie

Differential Revision: D58736151

fbshipit-source-id: 3d106a1fa958f9e5c91b16e04075609e1abf6e97
2024-06-19 11:28:36 -07:00
Rob Hogan 53951d7fec Debugger: Make /json/list ordered (#45069)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45069

Currently, `/json/list` returns pages within each device in the iteration order of a C++ `unordered_map`, which doesn't tell us anything useful. Page IDs happen to be sequential, but only as an implementation detail.

Change this contract so that we guarantee ordering reflects addition order, allowing clients to consistently select e.g. most recently added page for a given device.

The implementation of this is as simple as switching from an `unordered_map` to a key-ordered`map`, because we already assign keys (page IDs) with an incrementing integer. Within the inspector proxy, devices already use an insertion (connection)-ordered JS `Map`, so we just document this guarantee.

Changelog:
[General][Changed] Debugger: Make `/json/list` return connection-addition-ordered targets.

Reviewed By: huntie

Differential Revision: D58735947

fbshipit-source-id: 7a132cc5e750475792a2b845afc9a42424690bf1
2024-06-19 11:28:36 -07:00
Benoit Girard 30087a6e00 Introduce FuseboxTracer for DevTools tracing (#44840)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44840

Changelog: [Internal]

Introduce a simplified and minimal tracing backend for Fusebox. This backend is sufficient to implement a pretty usable performance panel.

Although the more I see how easy this is and how annoying working with Perfetto is, the more I think we should just maintain this going forward. Anyways we can figure that out incrementally. For now the plan is still for this to be temporary.

Reviewed By: motiz88

Differential Revision: D57981944

fbshipit-source-id: b3d8c6e8c5a18311bbe98254f8ddf3810fa1334b
2024-06-19 10:11:14 -07:00
Samuel Susla 82325b4260 use feature flag in render function for optimized text (#45068)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45068

changelog: [internal]

In D58672844 I added gating to module.exports.

This gating is sensitive to when feature flags are initialised and causes test failures and regressions for developers. Let's move the feature flag check to component's render function. It introduces extra spread operator but it is good enough to compare new and old <Text /> component.

Reviewed By: GijsWeterings

Differential Revision: D58783941

fbshipit-source-id: f89f4f48e6aeb774ed4a84483a9f4ad59d5bc045
2024-06-19 10:06:15 -07:00
Pieter De Baets 51e464f50f Remove unnecessary synchronized collections from ReactHostImpl (#45026)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45026

All callsites for these containers already explicitly synchronize using these objects, so there's no need to use a synchronized collection wrapper here.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D58724044

fbshipit-source-id: 5151ebb0ceda8656b6039d9984cc32a843051abd
2024-06-19 05:05:00 -07:00
Pieter De Baets 9b67547bec Remove enableArchitectureIndicator from AppRegistry API (#45025)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45025

This API just passed through the `enableArchitectureIndicator` prop to a custom WrapperComponent, as there is no default consumer of it. Instead, each provider of a custom WrapperComponent can capture the required value of itself.

Changelog: [General][Removed] Removed enableArchitectureIndicator API which is only used internally.

Reviewed By: cortinico

Differential Revision: D58723922

fbshipit-source-id: 0c52a904424382f33caab92ac50b316ae161f877
2024-06-19 05:05:00 -07:00
Samuel Susla 0c2fea5c23 fix syntax error (#45058)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45058

changelog: [internal]

Fix github action failure:

```
TransformError [SyntaxError]: /__w/react-native/react-native/packages/react-native/Libraries/Text/Text.js: Missing semicolon. (345:1)

  343 |     ? require('./TextOptimized')
  344 |     : Text
> 345 | ) as typeof Text;
```

Reviewed By: fabriziocucci

Differential Revision: D58779125

fbshipit-source-id: 76917aebf8ae8cfb9f2aa7a75a76383c5a832732
2024-06-19 04:59:02 -07:00
Rubén Norte 58ff2fc636 Make the instructions to regenerate feature flags easier to see in the docs (#45059)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45059

Changelog: [internal]

By moving the command to a code block it's going to be easier to see it when quickly reading the README.

Reviewed By: cortinico

Differential Revision: D58779883

fbshipit-source-id: e912a58641245c6d7dc158f7af0a722e438a0cc3
2024-06-19 04:13:38 -07:00