Commit Graph

12270 Commits

Author SHA1 Message Date
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
Samuel Susla 2f0c06de10 setup gating for <TextOptimized /> (#45031)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45031

changelog: [internal]

Reviewed By: rubennorte

Differential Revision: D58672844

fbshipit-source-id: 2c99d3b66665c8dc0b796713b21d91211b469d81
2024-06-18 16:23:45 -07:00
Jorge Cabiedes Acosta d8739e1d37 Add unit tests for BorderRadiusStyle (#44964)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44964

Testing property priority and correct setting percentages for business logic of `BorderRadiusStyle.kt`

To prevent issues like the one fixed by D57473482

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D58705515

fbshipit-source-id: 74e9a68fc0e3d1e88b8eebbb34a1ca8c29052c21
2024-06-18 10:46:23 -07:00
Moti Zilberman e55ea2daf1 Fix debugger handoff logic to prevent "zombie" state (#45035)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45035

Changelog: [General][Fixed] Avoid a zombie state when opening a second debugger frontend concurrently.

The problem here was that we were sending proxy-protocol messages to the device in the wrong order (`disconnect` *after* `connect`):

 {F1701266597}

The root cause was that we were depending on the outgoing debugger socket's async `close` event to trigger sending the `disconnect` message to the device. This would happen after we'd already (synchronously) sent the `connect` message.

With this diff, we send the `disconnect` message synchronously with calling `close()` on the debugger socket, which fixes the ordering problem at the source. To avoid sending duplicate `disconnect` messages (e.g. one before calling `close()` and one from the `close` event handler), we store some extra state on `Device` (`#connectedPageIds`).

Reviewed By: robhogan, huntie

Differential Revision: D58730634

fbshipit-source-id: 0f54af2e4f8071a8f6d97cc9e3d8a4ea89a46f43
2024-06-18 09:39:35 -07:00
Moti Zilberman 9cca4c1ec1 Add test for connecting multiple debuggers to a single page, reproing "zombie" state (#45034)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45034

Changelog: [Internal]

TSIA

Reviewed By: hoxyq

Differential Revision: D58728261

fbshipit-source-id: 32d4b05d69f88e68b5327dc5c8e837291e3d7726
2024-06-18 09:39:35 -07:00
Moti Zilberman 6695b6e3b8 Reuse Device instances when handing off connections based on device ID (#45027)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45027

Changelog: [Internal]

Changes the device ID collision handling logic to reuse `Device` instances instead of creating new ones. This enables further refactoring of `Device` to improve session state isolation.

Reviewed By: hoxyq

Differential Revision: D58724884

fbshipit-source-id: bc11ce45ce8c80c58c32dcd1b07b28f1d1753a62
2024-06-18 09:39:35 -07:00
Nicola Corti a272e8ee66 Remove unused rn-tester e2e tests (#45032)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45032

Those tests haven't been running since ~1 year now.
I know it's not ideal but I'd rather remove them instead of keeping them around not executing.
We can still revert them back from the history once we decide to revive the E2E testing effort.

Changelog:
[Internal] [Changed] - Remove unused rn-tester e2e tests

Reviewed By: cipolleschi

Differential Revision: D58729123

fbshipit-source-id: f0f47e3c2e087141fdff506b7c5c9b460263721b
2024-06-18 09:06:42 -07:00
Hailey cdab5370af fix (iOS): fix selectTextOnFocus in Fabric and non-Fabric by calling selectAll after becomeFirstResponder (#44307)
Summary:
Fixes https://github.com/facebook/react-native/issues/41988

Hopefully even if this isn't the right way to go about solving this, it at least points in the right direction for a different fix!

Currently - both on Paper and Fabric - the `selectTextOnFocus` prop does not work as expected on a single line text input. It seems that if the `UITextField` has not yet become the first responder, the text will be briefly selected but then deselected immediately afterward.

This can be seen in the tester when running for either Fabric or Paper (video using Fabric)

https://github.com/facebook/react-native/assets/153161762/aa9c609e-6eb8-4177-a41f-32aae53c06ac

Instead, we can move the `selectAll` call to `reactFocus` in `RCTBaseTextInputView` or `focus` `RCTTextInputComponentView` - both of which first call `becomeFirstResponder` - to get the expected result.

## Changelog:

[IOS] [FIXED] - fix selectTextOnFocus in Fabric and non-Fabric by calling selectAll after becomeFirstResponder

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

Test Plan:
* Test changes on RN Tester (iOS)

 https://pxl.cl/55kDc

Reviewed By: cipolleschi

Differential Revision: D56699773

Pulled By: fabriziocucci

fbshipit-source-id: ed092835f3c602e2c50a4198357653a9cef942d9
2024-06-18 08:44:09 -07:00
Moti Zilberman db2c44a7eb Make inspector-proxy protocol types mutable by default (#45021)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45021

Changelog: [Internal]

TSIA, hoisted from an upcoming refactor of `Device` in inspector-proxy.

Reviewed By: hoxyq

Differential Revision: D58723496

fbshipit-source-id: af272b08bc280d681bd7e1adb60d2a411a549864
2024-06-18 08:25:32 -07:00
Jakub Piasecki 01f7ab814f Fix text baseline being moved up on iOS (#44932)
Summary:
Fixes https://github.com/facebook/react-native/issues/44929

Moves calling `RCTApplyBaselineOffset` so it's called in similar way as on the old architecture: https://github.com/facebook/react-native/blob/726a4a1e5ef3bc8034a068145da2bb94ae3acfaa/packages/react-native/Libraries/Text/Text/RCTTextShadowView.mm#L229

https://github.com/facebook/react-native/blob/726a4a1e5ef3bc8034a068145da2bb94ae3acfaa/packages/react-native/Libraries/Text/Text/RCTTextShadowView.mm#L165-L167

I'm not exactly sure why (and Apple's docs aren't helping) but it looks like calling `NSTextStorage initWithAttributedString` results in an attributed string where emojis are separate fragments with Apple's emoji font set, which results in the correct baseline calculations. This is the way it happens on the old arch.

The way it's currently implemented on the new architecture, `RCTApplyBaselineOffset` is called on ` newly created attributed string where emojis are in the same fragment as other parts of the text which alters the result of baseline calculations compared to what's later drawn on the screen.

## Changelog:

[IOS] [FIXED] - Fixed text baseline being moved upwards in certain cases

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

Test Plan:
<details>
<summary>Check the following snipped</summary>

```jsx
import React from 'react';
import {
  Text,
  View,
} from 'react-native';

const App = () => {
  return (
    <View style={{
      paddingTop: 100,
    }}>
        <Text style={{fontSize: 15, lineHeight: 20, fontFamily: 'Arial', backgroundColor: 'gray'}}>A 😞😞😞 B</Text>
    </View>
  );
};

export default App;

```

</details>

|Before|After|
|-|-|
|<img width="546" alt="new-broken" src="https://github.com/facebook/react-native/assets/21055725/cc0a3841-beb5-4afc-8abf-1124312fa6e0">|<img width="546" alt="new-fixed" src="https://github.com/facebook/react-native/assets/21055725/0ec2f6f1-3c62-4537-9a75-6abb840633f7">|

Reviewed By: cipolleschi

Differential Revision: D58589249

Pulled By: sammy-SC

fbshipit-source-id: 1e0a730519a5c79ff8a35b0dfb16b68966a8dd9f
2024-06-18 05:28:21 -07:00
Rubén Norte 404f323359 Set up experiment to fix the mapping of event priorities between Fabric and React (#45013)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45013

Changelog: [internal]

## Context

We recently realized that in the majority of events dispatched to React from Fabric, passive effects were being mounted synchronously, blocking paint instead of in a separate task after paint.

The reason for that is that in React, passive effects for discrete events are mounted synchronously by design (see https://github.com/reactwg/react-18/discussions/128), and Fabric is currently assigning the discrete event priority to most current events (including things like layout events).

## Changes

This creates a feature flag to opt into a more granular control over event priorities in React Native. Instead of assigning the discrete event priority to events by default, this would assign the "default" event priority by default, except for events dispatched during continuous events that would also be considered continuous.

This would also fix the priority for continuous events, that it was currently being assigned as "default" incorrectly.

Reviewed By: christophpurrer, javache, sammy-SC

Differential Revision: D58677191

fbshipit-source-id: c65a8dc2118ed028e1e895adec54f9072b7e55a6
2024-06-18 05:24:57 -07:00
Moti Zilberman 43d69ee26c Fix ReactNativeReloads test case (#45011)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45011

Changelog: [Internal]

Fixes an inspector-proxy test case that was (silently) incorrect. This is in preparation for an upcoming rewrite of the core of inspector-proxy to more strictly isolate session state, which causes the incorrect test to fail.

Reviewed By: hoxyq

Differential Revision: D58193527

fbshipit-source-id: bdc27179210117ca9249b272f2e4aff19ba8a06c
2024-06-18 02:53:18 -07:00
Josh Katz 5df5ed1a88 Revert D58602799: Add unit tests for BorderRadiusStyle
Differential Revision:
D58602799

Original commit changeset: 605bc384267d

Original Phabricator Diff: D58602799

fbshipit-source-id: e843aa25f0cb37344a423e886b4e4a2878d89eec
2024-06-17 16:41:33 -07:00
Blake Friedman 07abfceae1 remove the template from react-native package (#45008)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45008

As part of RFC0759, we are moving the template into it's own repository.

## Useful Links:
- [Section in RFC0759](https://github.com/react-native-community/discussions-and-proposals/blob/main/proposals/0759-react-native-frameworks.md#evolving-the-react-native-community-template--cli)
- [Template's new home](https://github.com/react-native-community/template)
- [Versioning discussion](https://github.com/react-native-community/cli/issues/2345)

Changelog: [General][Breaking] removed the template from react-native into react-native-community/template

Reviewed By: cortinico

Differential Revision: D58184276

fbshipit-source-id: 5e52320af55495488587accbe144d11164cea4fd
2024-06-17 15:48:09 -07:00
Pieter Vanderwerff 36a04055d8 Create TextOptimized component to performance test changes to Text (#44962)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44962

Add a short term fork of `Text` for the purpose of performance testing.

Specific differences from `Text`:
 - Lazy init Pressability via a nested component.
 - Skip children context wrapper when safe.
 - Move props destructuring to function param.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D58601810

fbshipit-source-id: 988bac6100287705fb1bf8dc48cb2cfae56343df
2024-06-17 12:11:45 -07:00
Jorge Cabiedes Acosta 8c7c6f35e3 Add unit tests for BorderRadiusStyle (#44964)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44964

Testing property priority and correct setting percentages for business logic of `BorderRadiusStyle.kt`

To prevent issues like the one fixed by D57473482

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D58602799

fbshipit-source-id: 605bc384267d9f4ae5a051e76c1a4d862fe54039
2024-06-17 12:09:00 -07:00
Alan Lee 4792671e4d extract ParsedError handling to helper (#44922)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44922

extract ParsedError handling code into `StackTraceHelperTest`.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D58512611

fbshipit-source-id: 959978d80907f2afba96ef249c2fddd351d099ff
2024-06-17 10:39:22 -07:00
Alan Lee fe7e7a015f add default early JS error handler (#44884)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44884

Removing JavaScript error handler supplied to ReactHostImpl.java which is just a stub and creating a default handler in ReactInstance.java which uses NativeExceptionHandler TurboModule to handle error.

Changelog: [Android][BREAKING]  Removing `ReactJsExceptionHandler` param from ReactHostImpl() constructor and providing a default private implementation

Reviewed By: javache, cortinico

Differential Revision: D58385767

fbshipit-source-id: 46548677df936b7c2f584084a2c9769c27e6a963
2024-06-17 10:39:22 -07:00
Moti Zilberman 4c6bff01b3 Fix bug in device ID collision handling, add tests (#45010)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45010

D46482492 added logic for handing off state across "device" connections that have the same ID. This logic currently has no test coverage. It also contains a bug whereby the new device's pages are removed from the target listing endpoint (`/json`) when the *old* device's socket is closed.

This diff adds tests and fixes the bug.

Changelog: [General][Fixed] inspector-proxy no longer accidentally detaches connected devices.

## Next steps

It seems that the device ID handoff logic exists to paper over a deeper problem with the inspector proxy protocol (or its implementation in React Native): The React Native runtime should not routinely be creating new "device" connections without tearing down previous ones.

In followup diffs, I'll explore changing this behaviour for Fusebox, based on the new test coverage.

Reviewed By: robhogan

Differential Revision: D51013056

fbshipit-source-id: e0c17678cc747366a3b75cef18ca2a722fc93acd
2024-06-17 09:56:14 -07:00
Riccardo Cipolleschi 16380aa167 Fix tests for React 19 (#45007)
Summary:
Qhile landing the changes for React19 in 0.75, we missed one test that needs to be updated

## Changelog:
[Internal] - Fix Jest tests in React 19

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

Test Plan: CircleCI is green

Reviewed By: robhogan

Differential Revision: D58671824

Pulled By: cipolleschi

fbshipit-source-id: 48a72f5cdc4d03201cb1778915ed3519759cf017
2024-06-17 07:47:15 -07:00
Samuel Susla a6b862d427 clean up systrace for systrace View preallocation (#44956)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44956

changelog: [internal]

do not show systrace logs for flattened views.

Reviewed By: rubennorte

Differential Revision: D58587946

fbshipit-source-id: 6ef12feb352b9c79db6b91767c2d77906bba9cdc
2024-06-17 06:51:24 -07:00
Afonso 0950916846 Fix custom port listening configuration through metro.config.js (#44957)
Summary:
After updating my project to 0.73.2 I noticed that even though I had a specific port set in my `metro.config.js`, every time I'd start my project, it was running on port 8081. Passing the `--port` argument would allow me to change the port, but the config from metro did not.  I checked if the metro config was being properly applied, using `--verbose` and it was.

So I dug a bit, trying to figure out what had changed and noticed the coalescing of the value, whenever the argument `--port` is not present. That seemed odd since it meant that there's always a port defined for the `options` of `loadMetroConfig`, which would always be used in the `loadConfig` step.

To confirm I was on the right track I went to the [cli-plugin-metro](https://github.com/react-native-community/cli/blob/v11.3.10/packages/cli-plugin-metro) repo, to the last release before the move here, and noticed that there was [no coalescing in the same method](https://github.com/react-native-community/cli/blob/v11.3.10/packages/cli-plugin-metro/src/commands/start/runServer.ts#L60).

In this PR, I remove the coalescing of the port from `runServer.js` from the `community-cli-plugin`, to allow the port configuration through `metro.config.js`.

## Changelog:
[INTERNAL] [FIXED] - Fix server port configuration via `metro.config.js`
<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

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

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

Test Plan:
Running `yarn start` and verifying that:
- it would listen to port `8081` if no argument nor a custom port was set in `metro.config.js`
- it would listen to port `8082` if that one was defined in `metro.config.js`
- it would listend to port `8083` if that port was passed as an argument to the command (i.e. `yarn start --port 8083` even though port 8082 was defined in `metro.config.js`

Reviewed By: cortinico

Differential Revision: D58605152

Pulled By: robhogan

fbshipit-source-id: 9cf7a8b6a0d9de3af1ca4092906b4c648acee373
2024-06-17 05:52:16 -07:00
Robert Pasiński abfadc6083 feat: Implement requestIdleCallback (#44636) (#44759)
Summary:
Implements `requestIdleCallback` and `cancelIdleCallback`

### Notes

Proposed implementation does yet cover all WHATWG eventloop requirements.
 - Deadline computation is not implemented and is polyfilled by giving each callback `50ms`, rather than it being shared between other idle callbacks.
 - The requested callbacks are called with lowest priority by the scheduler as of now, but the execution is not as described in the standard.

## Changelog:

- [GENERAL] [ADDED] - Implemented `requestIdleCallback` and `cancelIdleCallback`

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

Reviewed By: javache, sammy-SC

Differential Revision: D58415077

Pulled By: rubennorte

fbshipit-source-id: 46189d4e3ca1d353fa6059a904d677c28c61b604
2024-06-17 04:22:43 -07:00
Jakub Piasecki 9922628032 Allow for setting accessibility label on text (#45003)
Summary:
Closes https://github.com/facebook/react-native/issues/43648.

`accessibilityLabel` is overridden on `RCTParagraphComponentView`: https://github.com/facebook/react-native/blob/fe06cbfbf332a999e065bdc13ef5cdeed20c5517/packages/react-native/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm#L157-L160

Effectively making it ignore whatever is set in the prop on the component. This PR updates the overridden method to check if the prop is set (and return that if it is) before returning the text as a label.

## Changelog:

[IOS] [FIXED] - Fix the accessibility label not being applied to text components on the new architecture

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

Test Plan:
Tried out on the reproduced from the issue.

|Text with label set|Text with no label set|
|-|-|
|<img width="982" alt="Screenshot 2024-06-17 at 08 33 58" src="https://github.com/facebook/react-native/assets/21055725/646014b3-5e9e-4023-8fe7-6dd65f04b217">|<img width="982" alt="Screenshot 2024-06-17 at 08 34 12" src="https://github.com/facebook/react-native/assets/21055725/2d712ced-ab78-4f8d-b482-b30df53ca949">|

Reviewed By: javache

Differential Revision: D58664380

Pulled By: cipolleschi

fbshipit-source-id: 88b45ca859283e16472630675b66a12732be6388
2024-06-17 03:12:23 -07:00
Tim Yung 97f9e101bf RN: Update Renderers for React 19 (#44991)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44991

Updates the open source renderers for React 19. This is in preparation for React Native 0.75.

Notable, this incorporates the feature flag changes from [facebook/react#29903](https://github.com/facebook/react/pull/29903).

Changelog:
[General][Changed] - Upgrade Renderers for React 19

Reviewed By: robhogan

Differential Revision: D58632199

fbshipit-source-id: 674bb47554e4b0c6ab5127fb9683ed8284b7a4ce
2024-06-17 02:59:55 -07:00
Tim Yung 0dd8224a71 RN/Relay: Bump Dependency to React 19 (#44990)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44990

Upgrades React Native and Relay to depend on React 19, which is currently published as release candidates. This is in preparation for React Native 0.75.

This will depend on updating open source renderers after [facebook/react#29903](https://github.com/facebook/react/pull/29903) is merged.

Changelog:
[General][Changed] - Upgrade to React 19

Reviewed By: robhogan

Differential Revision: D58625271

fbshipit-source-id: f9ad95b18716a9ce02f7cfbcc7248bdfb244c010
2024-06-17 02:59:55 -07:00