Commit Graph

30049 Commits

Author SHA1 Message Date
Panos Vekris
1f89a1c96b Deploy 0.225.1 to xplat (#42027)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42027

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D52353283

fbshipit-source-id: 4f6cefdcfe38d34c8629178823df6b39c5aebbfb
2023-12-20 19:54:48 -08:00
Kevin Gozali
08c916d52f ReactNativeCoreE2E: hardcode testIDs for View tests (#42026)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42026

Previously, the examples allow overriding the testIDs for each inner example from ViewExample.js in RNTester. However, that setup relies on another infra/abstraction to inject the testIDs properly. For simplicity, let's just make them hardcoded using the pattern view-test-<example-name>.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D52349100

fbshipit-source-id: 09d51935318d0592a9aae7da61cab0c87ac69152
2023-12-20 18:33:13 -08:00
Kevin Gozali
f7e99e6978 RNTester: inline BorderExample testIDs for simpler maintenance (#41987)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41987

Previously, the examples allow overriding the testIDs for each inner example from BorderExample.js in RNTester. However, that setup relies on another infra/abstraction to inject the testIDs properly. For simplicity, let's just make them hardcoded using the pattern `border-test-<example-name>`.

Changelog: [Internal]

Reviewed By: NickGerleman, mdvacca

Differential Revision: D52282922

fbshipit-source-id: 8fdc3d799befddbbb9bd8e60c8a904670c035d59
2023-12-20 18:33:13 -08:00
Kevin Gozali
a47d7c54e8 Improved RNTester deeplink support to go straight to a specific example (#41981)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41981

Improved RNTester URL deeplink support to cover:
*  `rntester://example/<moduleKey>`
*  `rntester://example/<moduleKey>/<exampleKey>`

Extra details:
* For example modules that do not specify `showIndividualExamples: true`, allow deeplink URL with the specific exampleKey to only render the specific example, instead of all of them.
* Added flexibility for moduleKey: search for optional suffixes ("Index", "Example").
* Adjusted Back button action to properly go back to the root after a deeplink.
* Added `example-container` generic testID on the example wrapper component.

Changelog: [Internal]

Reviewed By: yungsters, NickGerleman

Differential Revision: D52227013

fbshipit-source-id: 4ba050592f39d6895f5124fa25c77f2d0199aa3f
2023-12-20 18:33:13 -08:00
Tim Yung
228cb80af9 RN: Remove Deprecated Prop Types (#42019)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42019

Removes the following deprecated properties from React Native:

- `Image.propTypes`
- `Text.propTypes`
- `TextInput.propTypes`
- `ColorPropType`
- `EdgeInsetsPropType`
- `PointPropType`
- `ViewPropTypes`

The deprecation history for these prop types is not super obvious, so here is a summary:

- `react@15.5` extracted `prop-types` into a separate package to reflect that not everybody uses them.
- `react-native@0.68` added a deprecation warning to built-in prop types. (3f629049ba)
- `react-native@0.69` removed built-in prop types. (3e229f27bc)
- `react-native@0.71` restored built-in prop types, along with bug fixes to isolate deprecated usage. (b966d29724)

We believe that by the next public release, enough time will have passed for the community to be able to upgrade without patching React Native or otherwise working around the removal of these deprecated prop types.

**If anyone has trouble identifying the source of a deleted prop types usage, please file an issue so we can help track it down with you.**

Changelog:
[General][Removed] - Removed deprecated prop types

Reviewed By: lunaleaps, NickGerleman

Differential Revision: D52337762

fbshipit-source-id: 9731f7e1dec29f3df535ab75cc50bed001fdfa0b
2023-12-20 16:31:37 -08:00
Moti Zilberman
2b63b9bba9 C++ InspectorPackagerConnection tests (#42017)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42017

Changelog: [Internal]

C++ unit tests for D52134592. The tests heavily use gtest / gmock features to mock the various interfaces associated with `InspectorPackagerConnection` (see `InspectorMocks.h`) and to make it easy to write complex assertions on dynamic and JSON values (see `FollyDynamicMatchers.h`).

To simplify access to the mock objects while they are owned by the `InspectorPackagerConnection` under test, I've also created the `UniquePtrFactory` helper (see doc comments and unit tests that fully explain its functionality).

Reviewed By: huntie

Differential Revision: D52134593

fbshipit-source-id: 23b8098232898be7e5cbd9b31b3358640c5e5eec
2023-12-20 13:53:09 -08:00
Moti Zilberman
db0d178b8f C++ InspectorPackagerConnection (#41977)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41977

Changelog: [Internal]

Adds a new C++ implementation of `InspectorPackagerConnection`, intended to eventually replace `RCTInspectorPackagerConnection` on iOS and `InspectorPackagerConnection.java` on Android.

The main *new* abstraction in the C++ version is the `InspectorPackagerConnectionDelegate` interface, which will allow each platform to plug in its own scheduler and WebSocket implementation

This is almost entirely a direct translation of the Objective-C implementation to C++, so I've modelled it as a file copy in source control for ease of review. We may iterate further on the API at a later date, especially once the old implementations are gone.

Reviewed By: huntie

Differential Revision: D52134592

fbshipit-source-id: b4778b9c4fd424c4fa8d23bb9171629874e50e73
2023-12-20 13:53:09 -08:00
Moti Zilberman
cfa02eec50 Remove unused bundle status reporting from inspector infra (#41975)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41975

The version of `inspector-proxy` included with React Native has not used the `isLastBundleDownloadSuccess` and `bundleUpdateTimestamp` properties in years. This diff removes the backend support for reporting them (in preparation for a C++ rewrite of this infrastructure). We can consider bringing a similar feature back in the future on top of the modern CDP infra (which we are currently building).

Changelog: [General][Breaking] Remove APIs for reporting bundle download status to inspector-proxy, which does not use this information.

Reviewed By: huntie

Differential Revision: D52258567

fbshipit-source-id: e810278f949d8ab7dbc660cdc036a0f8464727f6
2023-12-20 13:53:09 -08:00
Dmitry Rykun
dae4a11e90 Introduce "headerPrefix" codegen option (#41956)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41956

By default, generated Cxx sources for components all end up in same directory. However the include declarations in them look like this:
```
#include <react/renderer/components/${libraryName}/ShadowNodes.h>
```
And not like this:
```
#include "ShadowNodes.h"
```
This works fine with Buck because it supports header prefixes.
To get this working with CocoaPods we define additional `HEADER_SEARCH_PATHS` for our `React-Codegen` pod.
This approach will not work if we want to generate code at the library level and check in the artifacts. That's because we don't have control over the Podspec there, and can't inject those additional `HEADER_SEARCH_PATHS`.

This diff adds the `headerPrefix` argument to the codegen entry point. It is `react/renderer/components/${libraryName}` by default, but can become empty if we want to generate code at the library level, and don't want to deal with this nested header structure.

*Note:* `RNCodegen` runs all the generators [in a loop](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/generators/RNCodegen.js#L263-L275), assuming that the all have same function signature So I had to add the `headerPrefix` argument to all the generators, even to the ones that don't really need it.

Changelog: [General][Added] - Introduce "headerPrefix" codegen option.

Reviewed By: zeyap

Differential Revision: D51811596

fbshipit-source-id: c5c3e1e571c7c4ea2f5354eb9a7b0df6b917fc0c
2023-12-20 09:25:05 -08:00
fortmarek
b00569c9f5 Update CHANGELOG.md (#42011)
Summary:
Adds changelog for the 0.72.8 release.

## Changelog:

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

Pick one each for the category and type tags:

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

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

[INTERNAL] [CHANGED] - Add changelog for the 0.72.8 release.

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

Test Plan: Read the changelog 🤞

Reviewed By: christophpurrer

Differential Revision: D52325318

Pulled By: huntie

fbshipit-source-id: 377a81f255c909b7da9370d6e3856265e2081b46
2023-12-20 07:42:05 -08:00
Moti Zilberman
9842994798 Use didReceiveMessageWithString in RCTInspectorPackagerConnection (#41974)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41974

Changelog: [Internal]

Switches `RCTInspectorPackagerConnection` to use the recommended and type-safe `didReceiveMessageWithString` method to receive messages from SRWebSocket.

Reviewed By: huntie

Differential Revision: D52257082

fbshipit-source-id: ce1233a06b15a353500f81ae5a7730422c668be7
2023-12-20 06:20:38 -08:00
Moti Zilberman
82bc2d7168 Back out "Add log message if App moves to background" (#41971)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41971

Original commit changeset: 29e1aba9c4ea

Original Phabricator Diff: D49956535

D49956535 added the new behaviour of logging helpful messages to the CDP console when the app is backgrounded/foregrounded. The underlying UX issue is legitimate: how do we reinforce the mental connection between the debugger frontend and the app being debugged, when they might be running in different windows or even machines, and particularly when the app might be backgrounded while the debugger frontend remains active.

However, this implementation is too closely coupled to the socket management layer, and is iOS-specific to boot. I'm removing it here to simplify porting `RCTInspectorPackagerConnection` to C++. We can revisit this UX problem later - preferably by investigating how it's handled in the case of Chrome Android and a remote DevTools client.

This feature has not been included in an OSS release of React Native yet, so very few users will be affected by its removal.

Changelog: [iOS][Removed] - Revert D49956535; remove console.log notification in DevTools if app transitions between back/foreground.

Reviewed By: blakef

Differential Revision: D51468311

fbshipit-source-id: b875d6cf03d3521c8e876c358b2299f20d395400
2023-12-20 06:20:38 -08:00
Alex Taylor (alta)
e730fdff50 Update hermes-parser and related packages in fbsource to 0.18.2 (#42003)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42003

Bump hermes-parser and related packages to [0.18.2](https://github.com/facebook/hermes/blob/main/tools/hermes-parser/js/CHANGELOG.md).

Changelog: [internal]

Reviewed By: pieterv

Differential Revision: D52303145

fbshipit-source-id: 1b2b07c16bf55879ecb3b6611cbd53faa1ecc012
2023-12-19 20:48:44 -08:00
Phillip Pan
60b1182edb clean up unused methods from NativeBugReporting (#41984)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41984

Changelog: [Internal]

this is unused anywhere, delete. for some reason we only have the spec file in oss but no native implementation

Reviewed By: christophpurrer

Differential Revision: D51968870

fbshipit-source-id: a4931d08c50954bfa557451e5e4d79a10dfeaefe
2023-12-19 17:20:24 -08:00
David Vacca
0373329933 Delete unused methods in JSCHeapCapture (#41973)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41973

Delete unused methods in JSCHeapCapture

changelog: [internal] internal

Reviewed By: christophpurrer

Differential Revision: D52153259

fbshipit-source-id: 323dfc5ab5848f246a3a603ae8b973db9044685f
2023-12-19 15:35:58 -08:00
Alex Hunt
7a4950b366 Set InspectorFlags in RCTAppDelegate (#41976)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41976

Progress towards an opt-in setup for our new CDP backend.

- Wires up D51563107 to conditionally disable the legacy Hermes debugger via `ReactNativeConfig`.
    - **Configuration covered**: iOS, for the `RCTAppDelegate` code path.
- Create C++-only overload of `RCTAppSetupPrepareApp`, deprecate the previous function.

Changelog:
[iOS][Deprecated] - Deprecate `RCTAppSetupPrepareApp`, replaced with C++ overload

Reviewed By: motiz88

Differential Revision: D51589221

fbshipit-source-id: 1688f97c69abb06d271b4d26b875365a8d86ba77
2023-12-19 15:18:05 -08:00
Nick Gerleman
11d3e11a4a Add E2E Test for experimental_layoutConformance (#42002)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42002

Adds an E2E test on top of the RNTester example for this (as a practice we should probably do this for new examples).

I didn't add unit tests for this originally, but probably should do that as well if it gets more interesting...

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D51639134

fbshipit-source-id: 379d95dfc676252e10b7076e294ac5534c6f06bf
2023-12-19 14:50:41 -08:00
Pieter Vanderwerff
bd4ddbe5e5 Deploy 0.225.0 to xplat (#42004)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42004

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D52305312

fbshipit-source-id: b18045c450dc3204b08452ede17b76d1a43cce50
2023-12-19 14:40:47 -08:00
Nick Gerleman
9436d2d30f Reorder members in Node.h (#41994)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41994

X-link: https://github.com/facebook/yoga/pull/1529

Reorganizes the header according to common C++ convnetions. Public first, then private. Constructors, then functions, then member variables.

Reviewed By: joevilches

Differential Revision: D52106056

fbshipit-source-id: 0095cf7caa58dc79c1803b3b231911e4fc66ddaf
2023-12-19 13:38:40 -08:00
Nick Gerleman
52af3e4695 Node::styleDefinesDimension() -> Node::hasDefiniteLength() (#41995)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41995

X-link: https://github.com/facebook/yoga/pull/1526

This function has made quite the journey from something that originally made more sense. This renames, refactors, and adds documentation for what it actually does.

This should eventually make its way into `yoga::Style` once computed style is moved into that structure.

bypass-github-export-checks

Reviewed By: joevilches

Differential Revision: D52105718

fbshipit-source-id: 6492224dd2e10cef3c5fc6a139323ad189a0925c
2023-12-19 13:38:40 -08:00
Nick Gerleman
87a636a093 yoga::resolveValue -> Length::resolve (#41939)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41939

X-link: https://github.com/facebook/yoga/pull/1520

This code originates as `YGValueResolve`, used to compute a YGValue to a length in points, using a reference for 100%.

This moves it to `Style::Length`, so we can encapsulate parts of it (for style value functions), and make the API more cohesive now that we can do C++ style OOP with it.

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D51796973

fbshipit-source-id: a7c359c7544f4bd2066a80d976dde67a0d16f1dd
2023-12-19 13:38:40 -08:00
Nick Gerleman
6e7185156c Make CompactValue internal detail of yoga::Style (#41776)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41776
X-link: https://github.com/facebook/yoga/pull/1492

# Summary

In preparation to replace `CompactValue`, this fully encapsulates it as an implementation detail of `yoga::Style`.

The internal API now always operates on `Style::Length`, converted to `YGValue` at the public API boundary.

In the next step, we can plug in a new representation within `Style`, which should enable 64 bit values, and lower memory usage.

# Test Plan

1. Existing tests (inc for style, invalidation, CompactValue) pass
2. Check that constexpr `yoga::isinf()` produces same assembly under Clang as `std::isinf()`
3. Fabric Android builds
4. Yoga benchmark does style reads

# Performance

Checking whether a style is defined, then reading after, is a hot path, and we are doubling any space style lengths take in the stack (but not long-term on the node). After a naive move, on one system, the Yoga benchmark creating, laying out, and destroying a tree, ran about 8-10%  slower in the "Huge nested flex" example. We are converting in many more cases instead of doing undefined check, but operating on accessed style values no longer needs to do the conversion multiple times.

I changed the `CompactValue` conversion to YGValue/StyleLength path to check for undefined as the common case (since we always convert, instead of calling `isUndefined` directly on CompactValue. That seemed to get the difference down to ~5-6% when I was playing with it then. We can optimistically make some of this up with ValuePool giving better locality, and fix this more holistically if we reduce edge and value resolution.

On another machine where I tested this, the new revision went the opposite direction, and was about 5% faster, so this isn't really a cut and dry regression, but we see different characteristics than before.

# Changelog
[Internal]

Reviewed By: rozele

Differential Revision: D51775346

fbshipit-source-id: c618af41b4882b4a227c917fcad07375806faf78
2023-12-19 13:38:40 -08:00
Oskar Kwaśniewski
90fb73e83c feat: Optimise RCTKeyWindow() calls in RCTForceTouchAvailable method (#41935)
Summary:
This PR optimises RCTKeyWindow() calls in `RCTForceTouchAvailable` method. This method was calling RCTKeyWindow hundreds of times while scrolling on the screen.

Before:

On the video you can see that this function is being called **350 times** just from simple list scrolling. RCTKeyWindow is looping over app windows so it's not a cheap operation.

https://github.com/facebook/react-native/assets/52801365/5b69cbd6-d148-4d06-b672-bd7b60472c13

After: the function is called only few times at the start of the app to get initial layout measurements.

Solution: I think we can check just once for the force touch capabilities as devices can't change it on the fly

bypass-github-export-checks

## Changelog:

[IOS] [FIXED] - Optimise RCTKeyWindow() calls in RCTForceTouchAvailable method

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

Test Plan: CI Green

Reviewed By: dmytrorykun

Differential Revision: D52172510

Pulled By: cipolleschi

fbshipit-source-id: 881a3125a2af4376ce65d785d8eee09c7d8f1f16
2023-12-19 10:09:49 -08:00
Dmitry Rykun
21784e2ce5 Introduce "codegenConfig.includesGeneratedCode" property (#41655)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41655

This diff adds support for checked-in codegen artifacts for libraries.
It introduces a new property to `codegenConfig`, called `includesGeneratedCode`. If codegen sees `includesGeneratedCode: true` in a project's dependency, it assumes that the library has codegen artifacts in it, and will not generate any code.

Changelog: [General][Added] - Introduce "codegenConfig.includesGeneratedCode" property.

Reviewed By: cipolleschi

Differential Revision: D51207265

fbshipit-source-id: 65855fd846e24a53cb18008839121e99eeb59309
2023-12-19 05:28:01 -08:00
Dmitry Rykun
c45c13f1b1 Replace utils.parseArgs with yargs (#41924)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41924

`utils.parseArgs` are only available in Node >=18.3, we can't use this function because we target Node >=18.0.
This diff replaces `utils.parseArgs` with `yargs`.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D52117818

fbshipit-source-id: 79223997874b6cfdea2ce38243b615a0dbb704a6
2023-12-19 04:43:37 -08:00
Arushi Kesarwani
1045b225f1 Removing Fabric check from UIManagerProvider (#41982)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41982

Moving the check for Fabric i.e. `ReactFeatureFlags.enableFabricRenderer` to old JSI Module path logic instead of new UIManagerProvider path for Fabric initialization and changing the default of UIManagerProvider from `null` -> `reactApplicationContext -> null;` since we are adding null check on the returned `UIManager`

Slight change of design of API for JSI Module in order to address the issues faced due to `ReactFeatureFlags.enableFabricRenderer`,
1. Getting rid of this check for the new Fabric initialization and keeping the old JSI Module path intact.
2. Allowing the UIManager to be nullable so as to allow Twilight surface not have UIManager set even though they it succeeds in initializing the TwilightJSIModule.
3. As made the UIManager nullable, added the null check for the same.
4. This eradicates the dependency on this flag for Anna as well.

Reviewed By: christophpurrer

Differential Revision: D52273097

fbshipit-source-id: bdf8b1de3771250c987c8f8bd4e48192f67a1afa
2023-12-19 00:03:17 -08:00
szymonrybczak
43826facfa fix(rn-tester): add missing params when running Android app from watch mode (#41979)
Summary:
Passed `--mode HermesDebug` to `run-android` command when running from watch mode by pressing `a` on terminal running a dev server. The flag is the same as in the `package.json`:
27f38f6f06/packages/rn-tester/package.json (L17)

## Changelog:

[INTERNAL] [CHANGED] - Add missing params when running Android app from watch mode by pressing `a`

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

Test Plan: Run `yarn start` press `a` in the watch mode, and Android app should be build and launch correctly.

Reviewed By: cipolleschi

Differential Revision: D52265462

Pulled By: lunaleaps

fbshipit-source-id: b2fbe6c889d8067876e160a8ce64dedcc4ce24d7
2023-12-18 13:18:02 -08:00
Riccardo Cipolleschi
27f38f6f06 Make the Fabric Interop Layer automatic (#41656)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41656

This change makes all the legacy components to go through the interop layer.
It also introduce the `RCTFabricInteropLayerEnabled()` and the `RCTEnableFabricInteropLayer(BOOL)` functions to work as feature flags behind the change to completely disable the Interop layer.

## Changelog
[iOS][Changed] - Make the Fabric Interop Layer automatic when the Nw architecture is enabled.

Reviewed By: cortinico

Differential Revision: D51586461

fbshipit-source-id: 8f92a76e6dbbee93055a1ebe49779dd64e484d95
2023-12-18 09:40:09 -08:00
Dmitry Rykun
32dab7a63f Add the DoubleConversion dependency to third-party libraries (#41972)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41972

This diff adds the `DoubleConversion` dependency to the `install_modules_dependencies` function, that installs all the dependencies that third-party libraries might need.
The libraries will need the `DoubleConversion` pod if they include the generated Fabric files.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D51848314

fbshipit-source-id: ae2ce022c6f51ce392852494c61e26ff810d30d0
2023-12-18 09:37:54 -08:00
Dmitry Rykun
a5ee029cd0 Remove last useges of configFileDir CLI argument (#41936)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41936

This argument was removed in D51303793. This diff removes all remaining usages of it.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D52035346

fbshipit-source-id: 99886be7ed810f58d8fb31fb22a44b2471e974ce
2023-12-18 07:18:17 -08:00
Thibault Malbranche
13c5cefb59 chore: changelog for 0.73.1 (#41970)
Summary:
Adds changelog for the 0.73.1 patch.

## Changelog:

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

Pick one each for the category and type tags:

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

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

[Internal] [Changed] - Add 0.73.1 changelog

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

Reviewed By: christophpurrer

Differential Revision: D52253474

Pulled By: huntie

fbshipit-source-id: 18fb45afcbb4fa0f864916922c0e9d69cc6d213f
2023-12-18 06:19:53 -08:00
Kræn Hansen
289e78388a Use $REACT_NATIVE_PATH instead of relative path (#41968)
Summary:
I believe it's valuable to be able to initialise the React Native template into a mono-repo and have it work with zero updates to the configuration.
In its current form the template's Xcode project makes assumptions on the relative location of the `react-native` package, while it could instead use the `REACT_NATIVE_PATH` variable set in the `scripts/cocoapods/utils.rb` script:

2441fa2847/packages/react-native/scripts/cocoapods/utils.rb (L82)

via

2441fa2847/packages/react-native/template/ios/Podfile (L35)

## Changelog:

[IOS] [ADDED] - Add use of the `REACT_NATIVE_PATH` in the "Bundle React Native code and images" shell script build phase. This will help apps initialized into a mono-repo which hoists the `react-native` package.

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

Test Plan: I initialized the React Native template into an NPM workspaces mono-repo and experienced a failure running the script phase. I updated it to the code in this PR, which resolved the issue.

Reviewed By: christophpurrer, cipolleschi

Differential Revision: D52240559

Pulled By: robhogan

fbshipit-source-id: 1c5710c8ffe9d289f32c5ed83cb58ae27f3c931a
2023-12-18 05:19:53 -08:00
Nick Gerleman
2441fa2847 Change Style::resolveColumnGap() return from Length to Style::Length
Summary:
X-link: https://github.com/facebook/yoga/pull/1525

Accidentally left this inconsistent with some of the refactoring. Rename the lone usage of `Length` within Style class to `Style::Length` to match the rest of the code.

This is functionally identical as before.

Changelog: [Internal]

bypass-github-export-checks

Reviewed By: yungsters

Differential Revision: D52096820

fbshipit-source-id: d6c569a02fb27a6e7548a9c12ff764afb823a282
2023-12-17 02:58:54 -08:00
Nick Gerleman
b7eb0c85a2 Fix align-content of cross-stretched container (#41964)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41964

X-link: https://github.com/facebook/yoga/pull/1524

D52087013 (#1513) fixed some issues, including where measuring under max-content or fit-content, align-content stretch would consume the entire available cross-dimensions, instead of only sizing to definite dimension, like the spec dicates.

I missed a case, where flexbox considers a container as having a definite cross-size if it is being stretched, even if it doesn't have a definite length.

https://www.w3.org/TR/css-flexbox-1/#definite-sizes

> 3. Once the cross size of a flex line has been determined, items in auto-sized flex containers are also considered definite for the purpose of layout;

> 1. If a single-line flex container has a definite cross size, the outer cross size of any stretched flex items is the flex container’s inner cross size (clamped to the flex item’s min and max cross size) and is considered definite.

We handle `align-items: stretch` of a flex container after cross-size determination by laying out the child under stretch-fit (previously YGMeasureModeExactly) constraint. This checks that case, and sizing the line container to specified cross-dim if we are told to stretch to it.

We could probably afford to merge this a bit with later with what is currently step 9, where we end up redoing some of this same math.

Reviewed By: yungsters

Differential Revision: D52234980

fbshipit-source-id: 475773a352fd01f63a4b21e93a55519726dc0da7
2023-12-17 01:13:36 -08:00
Cheng Zhao
b3ba340bc3 std::terminate belongs to <exception> header (#41917)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41917

See also https://en.cppreference.com/w/cpp/error/terminate.

X-link: https://github.com/facebook/yoga/pull/1511

Reviewed By: christophpurrer

Differential Revision: D52072882

Pulled By: NickGerleman

fbshipit-source-id: 4d4d442b82d108d1d2ff5d241fbdc8df89045fed
2023-12-17 00:47:44 -08:00
David Vacca
17d2c8acb9 Ensure Bridge and Bridgeless register native modules using the same order
Summary: I've noticed that Bridge and Bridgeless initialize the list of ReactPackages using a different order, we are fixing it in this diff

Reviewed By: philIip

Differential Revision: D52145148

fbshipit-source-id: 6ad85bd0903f9beab455783e8deaf5c529b87a2e
2023-12-16 13:57:04 -08:00
Riccardo Cipolleschi
479b4bb1ba Install bundler versions depending on Ruby version (#41962)
Summary:
Since yesterday evening (why it is always friday evening???) CircleCI or Gem decided to update the default bundler version that is installed with `gem bundle install`.
Therefore, CI for iOS stopped working.

This change installs bundler's versions so that they are compatible with the Ruby version.

## Changelog:

[Internal] - Fix CI for iOS installing versions of bundler that are compatible with Ruby

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

Test Plan: CircleCI is green

Reviewed By: GijsWeterings

Differential Revision: D52230544

Pulled By: cipolleschi

fbshipit-source-id: 2f96e16ecb94159953056e8de757ea4d249f80f0
2023-12-16 08:50:20 -08:00
Nick Gerleman
b221265f41 Fix sizing and alignment issues with multi-line containers (#41916)
Summary:
X-link: https://github.com/facebook/yoga/pull/1513

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

Fixes https://github.com/facebook/yoga/issues/1300
Fixes https://github.com/facebook/yoga/issues/1008

This fixes a smattering of issues related to both sizing and aligment of multi-line-containers:

1. We were previously incorrectly bounding the size of each flex line to the min/max of the entire container.
2. Per-line leads were sometimes incorrectly contributing to alignment within the line
3. The cross dim size used for multi-line alignment is not correct, or correctly clamped. If the available size comes from a max constraint, that was incorrectly used instead of a definite size, or size of content. Leads were entirely skipped for min constraint.

Need to test how breaking this is, to see if it might need to go behind an errata.

See related PRs:
1. https://github.com/facebook/yoga/pull/1491
2. https://github.com/facebook/yoga/pull/1493
3. https://github.com/facebook/yoga/pull/1013

Changelog:
[General][Fixed] - Fix Yoga sizing and alignment issues with multi-line containers

Reviewed By: joevilches

Differential Revision: D52087013

fbshipit-source-id: 8d95ad17e58c1fec1cceab9756413d0b3bd4cd8f
2023-12-16 01:12:30 -08:00
Sam Zhou
ce692138ed Use conditional type to flattern RN styles (#41931)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41931

`GenericStyleProp` is defined as

```
type GenericStyleProp<+T> =
  | null
  | void
  | T
  | false
  | ''
  | $ReadOnlyArray<GenericStyleProp<T>>;
```

and `____FlattenStyleProp_Internal` is designed to reverse it. We can use conditional type to achieve it instead of $Call:

`null | void | false | ''` doesn't contribute to anything doing reversal, so they are mapped to empty. When we encounter $ReadOnlyArray, we recursively apply `____FlattenStyleProp_Internal`. Otherwise, we return the input type.

Changelog: [Internal]

Reviewed By: jbrown215

Differential Revision: D52142082

fbshipit-source-id: 590c71c6400498730675e20c67b173c3bc285d00
2023-12-15 15:13:05 -08:00
Dmitry Rykun
d45a01d6d1 Introduce "outputDir" property of "codegenConfig" (#41782)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41782

This diff adds `outputDir` property to `codegenConfig`.
Now codegen output dir is resolved like this:
1. It is set to `outputDir` argument of `generate-codegen-artifacts.js` if it is present.
2. *[New]* It is set to `outputDir` property of `codegenConfig` if it is present.
3. It is set to the project root.

Changelog: [General][Added] - Introduce "outputDir" property of "codegenConfig"

Reviewed By: cipolleschi

Differential Revision: D51494009

fbshipit-source-id: 0f6e3607b29a3c6d228a88a9460d55bb65c7e55a
2023-12-15 03:54:35 -08:00
Zeya Peng
5d1eac047a add RNTester example for native command Array param (#41897)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41897

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D51875073

fbshipit-source-id: 403274b3063d7c49fe4642347d2f724d58a46c1f
2023-12-14 21:06:09 -08:00
David Vacca
8e1c45a7a0 Update ReactAndroid.api (#41951)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41951

Update ReactAndroid.api

changelog: [internal] internal

Reviewed By: RSNara

Differential Revision: D52185871

fbshipit-source-id: b8284e1cfaa6fe998904f9a5e7ae4c297905f1eb
2023-12-14 17:44:51 -08:00
Alex Taylor (alta)
1fed7ab8ea Deploy 0.224.0 to xplat (#41949)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41949

Changelog: [internal]

Reviewed By: gkz

Differential Revision: D52177280

fbshipit-source-id: 37fe478645ad30b40f4fb4e81d7fc467ac971928
2023-12-14 14:58:43 -08:00
Zeya Peng
c52af32042 support Array param for native component command (#41899)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41899

Changelog: [Internal]

Reviewed By: dmytrorykun

Differential Revision: D52046165

fbshipit-source-id: b8276b3db54b3f88b90f16a3275d591decfa5fb3
2023-12-14 13:47:33 -08:00
Phillip Pan
a0efa26065 deprecate @property methodQueue (#41944)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41944

Changelog: [iOS][Deprecated]

i think we can now communicate the deprecation of this selector.

after removing all of the synthesize methodQueue callsites in our codebase, our native modules are still stable, save for one native module, RCTNetworking. so i feel comfortable recommending users to create their own queues.

and after removing `methodQueue` overrides to support synchronous void methods, those modules are also still stable, so i'm also comfortable we can recommend handling the dispatch_async in the product layer.

Reviewed By: arushikesarwani94, cipolleschi

Differential Revision: D52150696

fbshipit-source-id: ff6b90fc685796e5560167f1377a76526ee07744
2023-12-14 13:47:11 -08:00
Riccardo Cipolleschi
b0982971c6 Improve setting props of the Interop Layer (#41942)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41942

Previously, every time a component was updated, we were passing all the props to the interoperated component.
With this change, we are going to only pass the props that are changed.

As a safety feature, if the new codepath is not able to detect the type of the prop properly, it will fall back to the previous behavior.

## Changelog:
[Internal] - Only pass props to the interoperated component when they changes

Reviewed By: sammy-SC

Differential Revision: D51755764

fbshipit-source-id: 0185d2cceeab2a1e45b87d5a1e82ab06e00aa82d
2023-12-14 08:52:54 -08:00
Riccardo Cipolleschi
201d2d1fde Unify SetProps for View and ShadowView in the InteropLayer (#41941)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41941

While working on the interop layer, I realized that htis code is duplicated.

## Changelog
[Internal] - Use the same method for View And ShadowView in the Interop layer

Reviewed By: sammy-SC

Differential Revision: D51752171

fbshipit-source-id: 579652de262fea7edb13a1329cb07683eab78124
2023-12-14 08:52:54 -08:00
Christoph Purrer
8183afeb81 Use enum classes in C++ Turbo Modules (#41923)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41923

Changelog: [Internal][BREAKING] Use C++ enum classes in C++ Turbo Modules

Problem:
Using **C styles** `enums` can easily cause compiliation errors if symbol names collide. This code does not compile:
```
enum CustomEnumInt { A = 23, B = 42 };

static int A = 22;
```

This **C++ code**, using `enum classes` compiles:
```
enum class CustomEnumInt : int32_t { A = 23, B = 42 };

static int A = 22;
```

Reviewed By: rshest

Differential Revision: D52098598

fbshipit-source-id: c919bd2e41970c83a032fec91b0537cd6fae8397
2023-12-14 06:54:49 -08:00
Joe Vilches
1e22fa39ea Change offsetParent, offsetTop and offsetLeft to respect positioned ancestor, not parent (#41903)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41903

These offset methods are supposed to be in reference to the node's nearest positioned (non-static) ancestor: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent. Right now, because static did not exist, they return the offset from the parent. This changes it so that the API is spec compliant and will look at the position of its ancestors before settling on the right offset. I added a helper `getNewestPositionedAncestorOfShadowNode` to get the correct node. Then I use that to calculate the proper offset

Changelog: [Internal]

Reviewed By: rubennorte, NickGerleman

Differential Revision: D51414950

fbshipit-source-id: ebc8de1d3a0f3e9485f63e792b5bef5b9151460d
2023-12-13 15:08:35 -08:00
Phillip Pan
9dbecc57ba remove unused methods from RCTAppearance (#41920)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41920

Changelog: [Internal]

these overrides do nothing, the superclass leaves these empty as well. remove

Reviewed By: cipolleschi

Differential Revision: D51968873

fbshipit-source-id: a214903d2834aa502c9e81ebaab928694bfa0818
2023-12-13 14:58:29 -08:00