Commit Graph
30159 Commits
Author SHA1 Message Date
Paul Schreiber 63e893d23d Properly handle Xcode targets with spaces in their names (#42220)
Summary:
Properly handle targets with spaces in their names

Use quotes around the argument to basename path. Ensures this succeeds when the Xcode target name has spaces.

example:
```sh
#!/bin/sh
SOURCEMAP_FILE="ArchiveIntermediates/Jane Doe/IntermediateBuildFilesPath/Jane Doe.build/Release-iphoneos/JaneDoe.build/DerivedSources/main.jsbundle.map"
BN_SOURCEMAP_FILE="$(basename $SOURCEMAP_FILE)"
echo $BN_SOURCEMAP_FILE
```

output:
```
Jane Jane main.jsbundle.map
```

```sh
#!/bin/sh
SOURCEMAP_FILE="ArchiveIntermediates/Jane Doe/IntermediateBuildFilesPath/Jane Doe.build/Release-iphoneos/JaneDoe.build/DerivedSources/main.jsbundle.map"
BN_SOURCEMAP_FILE="$(basename "$SOURCEMAP_FILE")"
echo $BN_SOURCEMAP_FILE
```

output:
```
main.jsbundle.map
```

## Changelog:
[iOS] [Fixed] - Fix support for SOURCEMAP_FILE path containing spaces

## Related
https://github.com/facebook/react-native/pull/40937

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

Reviewed By: christophpurrer

Differential Revision: D52650491

Pulled By: arushikesarwani94

fbshipit-source-id: e42b8a0d018b37fb558abd53d765fbdd676c51a2
2024-01-10 09:52:33 -08:00
Tommy Nguyen 9155e2d182 fix: declare missing dependency chalk (#42235)
Summary:
Dependency on `chalk` was introduced in https://github.com/facebook/react-native/pull/37510, but was never declared. In pnpm setups, the CLI fails to run because of this.

This needs to be picked to 0.73.

## Changelog:

[GENERAL] [FIXED] - Declare missing dependency `chalk`

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

Test Plan: n/a

Reviewed By: huntie

Differential Revision: D52660337

Pulled By: cortinico

fbshipit-source-id: 1cd45fcff72045c127773566a27103f1b38262b3
2024-01-10 08:59:29 -08:00
Dmitry Rykun be0c353e18 CocoaPods: simplify iOS build directory cleanup (#42233)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42233

This diff removes the need for providing the `ios_folder` argument to `use_react_native`. We no longer do any manual path tranformations to get the iOS project root.
Instead we use `Pod::Config.instance.installation_root` which always points to the correct directory.

Changelog: [iOS][Breaking] - CocoaPods: remove the `ios_folder` argument from the `use_react_native` function.

Reviewed By: cipolleschi

Differential Revision: D52659429

fbshipit-source-id: 67c79cd9d74a0351ad2c242b74cbd48b6bd2dc94
2024-01-10 08:38:50 -08:00
Ramanpreet Nara 8fd2f1263c BridgelessUIManager: Finish focus, blur (#42210)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42210

Implement Focus and blur, by using commands.

Changelog: [Internal]

Reviewed By: dmytrorykun

Differential Revision: D52383997

fbshipit-source-id: ca3c20d77b17147b592cbf3c48772b857a2e2c55
2024-01-10 07:01:22 -08:00
Ramanpreet Nara 7effa2527f BridgelessUIManager: Finish sendAccessibilityEvent
Summary: Changelog: [Internal]

Reviewed By: dmytrorykun

Differential Revision: D52383282

fbshipit-source-id: 791cca056ebbe2bdf16082985a37b6df6724088b
2024-01-10 07:01:22 -08:00
Ramanpreet Nara 0bb1a5a867 BridgelessUIManager: Finish setLayoutAnimationEnabledExperimental (#42207)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42207

In open source, with the new architecture, layout animations are **always** enabled.

They cannot be disabled.

Therefore, when this UIManagerModule method is called with false, just report an error. That way, if layout animations were explicitly disabled on Android, the developer will know, when they try to enable the new architecture.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D52349297

fbshipit-source-id: 7969bd7294ce7369643004e5ff7e0c1ed4a59cd6
2024-01-10 07:01:22 -08:00
Ramanpreet Nara 07e3c2e6eb BridgelessUIManager: Finish configureNextLayoutAnimation (#42211)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42211

According to [LayoutAnimation.js](https://github.com/facebook/react-native/blob/2b63b9bba98cfe142581b47cc20bd3068e3e4281/packages/react-native/Libraries/LayoutAnimation/LayoutAnimation.js#L78-L101), UIManager.configureNextLayoutAnimation can just delegate to FabricUIManager.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D52347537

fbshipit-source-id: 840dd469c1a57a305dda8ae21ce6a5e8f8c4f9ad
2024-01-10 07:01:22 -08:00
Ramanpreet Nara 77f3edd32c UIManager: Delete replaceExistingNonRootView (#42065)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42065

We should delete from UIManager:
- There are no usages of this api at Meta.
- The only usages found on GitHub are from old forks of React Native: [Github search](https://github.com/search?q=replaceExistingNonRootView+language%3AJavaScript&type=code&p=5&l=JavaScript)

Changelog: [Android][Removed] - Delete UIManager.replaceExistingNonRootView

Reviewed By: sammy-SC

Differential Revision: D52345872

fbshipit-source-id: b61e49731c68fff1f9c4223924a95b4d1e4763c1
2024-01-10 07:01:22 -08:00
Ramanpreet Nara f4e0061533 UIManager: Delete removeSubviewsFromContainerWithID (#42066)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42066

We should just delete this UIManagerModule api:
- There are no usages of this api at Meta
- The only usages found on GitHub are from old forks of React Native: [GitHub search](https://github.com/search?q=removeSubviewsFromContainerWithID+language%3AJavaScript&type=code&p=5)

Changelog: [Android][Removed] - Delete UIManager.removeSubviewsFromContainerWithID

Reviewed By: sammy-SC

Differential Revision: D52345629

fbshipit-source-id: 74bb36600f218e5f882b338ff5d0bcf37d58c949
2024-01-10 07:01:22 -08:00
Ramanpreet Nara 9670bde5ab BridgelessUIManager: Improve error message for getViewManagerConfig() (#41998)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41998

Now the error message propts people to turn on the interop layer.

And, it adds more details to the suggestion to use hasViewManager(viewManagerName).

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D52002909

fbshipit-source-id: 80ea60b4f6a5fe15d773bb1f3f41de5ce43d6652
2024-01-10 07:01:22 -08:00
Ramanpreet Nara d825e7a5d4 BridgelessUIManager: Finish createView, updateView, setChildren, manageChildren (#42067)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42067

These methods should not be implemented in the new architecture.

The **only** code that called these UIManagerModule methods was the paper renderer. And the New Architecture should instead use the Fabric renderer.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D52345416

fbshipit-source-id: 76511aa97e5dfa938aca658af03fb43122547df1
2024-01-10 07:01:22 -08:00
Ramanpreet Nara 4ed4ea15f6 BridgelessUIManager: Align platform-only methods w/ PaperUIManager (#41997)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41997

Many methods on PaperUIMangaer are iOS only.

Many methods on PaperUIManager are Android  only.

This diff makes sure that BridgelessUIManager only exports Android methods on Android, and iOS methods on iOS.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D52012876

fbshipit-source-id: 6527048083eae93577a58d4b77f0645fab84217f
2024-01-10 07:01:22 -08:00
Moti Zilberman 4d22d02b77 C++ InspectorPackagerConnection: Indicate new implementation in /json response (#42200)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42200

Changelog: [Internal]

Quick hack to make it easy to determine whether a given build of React Native is using the C++ implementation of InspectorPackagerConnection or the legacy platform-specific implementation.

For now, we just append this information to the `title` field. Ultimately, rather than polluting the title, this should be an inert capability flag that gets reported via `inspector-proxy`. I'm not doing that yet since we have work in the pipeline to set up a proper capability flag system soon.

Reviewed By: huntie

Differential Revision: D52629415

fbshipit-source-id: a4e873f4be78ae49b35b94fd5d41d0e2efc02dbe
2024-01-10 06:48:03 -08:00
zhongwuzw 9525074a19 Fixes Reject error kind in Fabric (#41955)
Summary:
Fixes https://github.com/facebook/react-native/issues/41950 .

bypass-github-export-checks

## Changelog:

[IOS] [FIXED] - Fixes Reject error kind in Fabric

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

Test Plan: reject returns `Error`.

Reviewed By: javache

Differential Revision: D52622682

Pulled By: cipolleschi

fbshipit-source-id: 726e68d968d03505748191263b7e6b75a068c130
2024-01-10 05:09:25 -08:00
Alex Hunt 7d8af3b6ac Move InspectorFlags JNI wrapper into devsupport library (#42179)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42179

As titled, also moving `InspectorFlags.java` across packages.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D52367642

fbshipit-source-id: 01fabbb57942e8a61ce711e9e0beb564a30bbfbd
2024-01-10 04:51:38 -08:00
Riccardo Cipolleschi a4231a736d Back out "Update Yoga.podspec: fixes archiving for macos catalyst on react-native 0.73.1 in xcode"
Summary:
PR https://github.com/facebook/react-native/pull/42159 was working but it was the wrong fix.

The right fix is to use the `"PUBLIC_HEADERS_FOLDER_PATH"` Xcode build setting instead.

bypass-github-export-checks

## Changelog:
[iOS][Changed] - Revert "Update Yoga.podspec: fixes archiving for macos catalyst on react-native 0.73.1 in xcode"

## Facebook:
Original commit changeset: 21b9b3568986

Original Phabricator Diff: D52624342

Reviewed By: arushikesarwani94

Differential Revision: D52656133

fbshipit-source-id: 84a37fe3fca57d5e34139c17c6c1957fe8d40aaf
2024-01-10 04:38:53 -08:00
Ramanpreet Nara 7f2529de7b Refactor: ReactHost: Remove new prefix from task creation methods (#42169)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42169

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D52495531

fbshipit-source-id: 2651b462a0dba437c8652fefd38421f2d826935a
2024-01-09 19:07:01 -08:00
Ramanpreet Nara af004ce4e6 Refactor: ReactHost: Delete old task creation methods (#42168)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42168

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D52495533

fbshipit-source-id: 787919fa68a0308d5e5bc803c7f5f1221675cd09
2024-01-09 19:07:01 -08:00
Ramanpreet Nara 2e6afdc550 Refactor: ReactHost: Make getOrCreateStartTask confined to the ReactHost thread (#42167)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42167

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D52495534

fbshipit-source-id: bab3158dfdcf642efd5afed05ced27fb0d2594f7
2024-01-09 19:07:01 -08:00
Ramanpreet Nara 6b79c14e33 Refactor: ReactHost: Rename {new,old}Start to {new,old}GetOrCreateStartTask (#42166)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42166

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D52495535

fbshipit-source-id: 736e2c512710db0a51a5370a4f7e97ea87a7ce23
2024-01-09 19:07:01 -08:00
Ramanpreet Nara 466deff0de Refactor: ReactHost: Rename getOrCreateReactInstanceTask -> getOrCreateReactInstance (#42165)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42165

This will help avoid a name collision when we remove the new suffix from newGetOrCreateReactInstanceTask.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D52495532

fbshipit-source-id: 79a04cff51eef07b91876a1351b8444654a79274
2024-01-09 19:07:01 -08:00
Tim Yung 0fd7bd3a7f RN: Update {use,}Pressability Docblocks (#42187)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42187

Updates the docblocks for `Pressability` and `usePressability`, as suggested in the code review for {D52388699}.

Changelog:
[General][Changed] Updated Pressability/usePressability Docblocks

Reviewed By: sammy-SC

Differential Revision: D52604388

fbshipit-source-id: e82dd6caa46fe69281e996cbdb8b8e5105b46955
2024-01-09 15:38:07 -08:00
Eric Rozell f7f9250f6e Allow non-static LongLivedObjectCollections in TurboModuleBinding (#42194)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42194

Apps that have multiple concurrently running React instances may suffer from issues where tearing down one instance affects the bindings / LongLivedObjectCollection instance of another due to the use of static getter for LongLivedObjectCollection. This should allow host platforms, e.g., react-native-windows (which still forks the TurboModuleBinding C++ files [here](https://github.com/microsoft/react-native-windows/tree/main/vnext/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon) for the reasons already mentioned) to manage per instance LongLivedObjectCollections.

## Changelog

[Internal]

Reviewed By: christophpurrer

Differential Revision: D52581170

fbshipit-source-id: 791e3baeefaf23f544eeddd5a216735535523a9d
2024-01-09 12:23:40 -08:00
Luna e4f878df7c 0.71.15 changelog (#42193)
Summary:
Add changelog for 0.71.15

## Changelog:
[Internal] - Add changelog for 0.71.15

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

Test Plan: n/a

Reviewed By: christophpurrer

Differential Revision: D52609499

Pulled By: lunaleaps

fbshipit-source-id: 3ace729fac4962530178dc4acd2301e0919399fc
2024-01-09 11:31:11 -08:00
Samuel Susla 2b82832e59 check for prefix in automatic interop layer
Summary:
changelog: [internal]

This mimics what interop layer does in LegacyViewManagerInteropComponentDescriptor.

https://www.internalfb.com/code/fbsource/[f80a9affe2cc]/xplat/js/react-native-github/packages/react-native/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm?lines=62

Reviewed By: cipolleschi

Differential Revision: D52627132

fbshipit-source-id: 894a40b51ec4189a6bf22db4f612c0b14594d52a
2024-01-09 10:41:43 -08:00
Moti Zilberman e28d15fca5 RCTCxxInspectorPackagerConnection (#42037)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42037

Creates an Objective-C wrapper around the C++ version of `InspectorPackagerConnection` (introduced in D52134592), and uses it in React Native iOS apps (behind an internal flag that is off by default).

In future work, the flag will be turned on by default, then deleted, and eventually the legacy `RCTInspectorPackagerConnection` code will be deleted from React Native.

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D52225495

fbshipit-source-id: f1b9657ef0d665cf7892c15c34c5104e2777ec43
2024-01-09 10:41:13 -08:00
Moti Zilberman a9a736f2ad Java CxxInspectorPackagerConnection (#42018)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42018

Creates an JNI wrapper around the C++ version of `InspectorPackagerConnection` (introduced in D52134592), and uses it in React Native Android apps (behind an internal flag that is off by default).

In future work, the flag will be turned on by default, then deleted, and eventually the legacy `InspectorPackagerConnection.java` code will be deleted from React Native.

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D52231237

fbshipit-source-id: 5a0e3bd8b2b711c1c592db15c51df4c3cc89aaad
2024-01-09 10:11:41 -08:00
Kesha Antonov aa2d613cfa Update Yoga.podspec: fixes archiving for macos catalyst on react-native 0.73.1 in xcode (#42159)
Summary:
Hi

When I tried to archive macos catalyst app in Xcode I got error:

<img width="994" alt="Screenshot 2024-01-06 at 18 02 07" src="https://github.com/facebook/react-native/assets/11584712/5b334c79-c795-4c29-a6b5-65a024926cb7">
<img width="910" alt="Screenshot 2024-01-06 at 18 02 40" src="https://github.com/facebook/react-native/assets/11584712/dba51fc7-8b1e-4a00-b507-ea773c5b5fdf">

This PR fixes archiving

## Changelog:

[IOS] [FIXED] - fixed archiving for macos catalyst on react-native 0.73.1 in xcode

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

Test Plan: Try archive react-native tester app for macos catalyst in Xcode

Reviewed By: christophpurrer

Differential Revision: D52624342

Pulled By: arushikesarwani94

fbshipit-source-id: 21b9b3568986f63f169f11cedc6cea2237d3e2c5
2024-01-09 06:59:09 -08:00
Alexander Blom 40b0d1886a Replace ranges views with iterators (#42197)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42197

Some std::ranges functions don't work well (or at all) when using
clang, eg see
https://fb.workplace.com/groups/474291069286180/posts/9724112847637243

This works in clang 16, but not clang 15 which fbcode is on. Note that more complicated parts of ranges work, but not these simpler helpers, funnily enough :).

As I'm trying to make RN compile in fbcode, I need clang to work.

Moving them back to iterators, but using rbegin/rend making it fairly readable still.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D52481786

fbshipit-source-id: f37d4e1912b33eee392061dc787afaacd9554409
2024-01-09 05:25:21 -08:00
Riccardo Cipolleschi a8aa96c8af Unify folly_version and compiler_flags in a single function (#42153)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42153

This non functional change unifies Folly version and compiler flag in a single function, so that it would be easier to update it in the future.

## Changelog:
[Internal] - Unify folly version and compiler flags

Reviewed By: cortinico

Differential Revision: D52564771

fbshipit-source-id: 9b4b50560ddee05ce50465b6854666572148cb25
2024-01-09 02:43:52 -08:00
Kudo Chien de0c43ead4 Fix RCTAppSetupPrepareApp import error from .m (#42172)
Summary:
This PR tries to fix a build error when `import <React/RCTAppSetupUtils.h>` from *.m files. Since the `[[deprecated("")]]` syntax is a C++14 feature and it was placed inside the `RCT_EXTERN_C_BEGIN` block. If the file in imported from Objective-C *.m files or Swift files, it will have a syntax error. Instead of using the C++ syntax, this PR uses the `__deprecated_msg()` statement that is also used in other code in react-native and that is C supported syntax.

bypass-github-export-checks

## Changelog:

[IOS] [FIXED] - Fix RCTAppSetupPrepareApp.h import error from Objective-C *.m files

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

Test Plan:
- test building and importing **RCTAppSetupPrepareApp.h** from a *.m file
- test `RCTAppSetupPrepareApp(application, turboModuleEnabled)` will show a compile warning

Reviewed By: arushikesarwani94

Differential Revision: D52603421

Pulled By: cipolleschi

fbshipit-source-id: bfec8d0ba6378a265ad30dd8ca1d3ab15cff96ed
2024-01-09 02:34:49 -08:00
Joe Vilches f5b824af16 Java bindings for setAlwaysFormsContainingBlock (#42192)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42192

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

tsia

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D52608259

fbshipit-source-id: 647ec4e2fe180ace8d6b641e17cd610fa53fe845
2024-01-08 20:28:49 -08:00
Joe Vilches 8714e41b7c Support transforms forming containing blocks (#42191)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42191

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

React native supports transforms and if a node has a transform it will [form a containing block for absolute descendants regardless of position type](https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block). So we need to pass that information into Yoga to ensure this happens.

The verbiage for the field "alwaysFormsContainingBlock" is very specific. In a vacuum a node cannot simply "form a containing block". It only forms a containing block in reference to a different node. This can be illustrated in a scenario where we have a static node that is a flex container which has 1 absolute child and 1 relative child. This static node will form a containing block for the relative child but not the absolute one. We could just pass the information on rather something has a transform or not but Yoga is not supposed to know about transforms in general. As a result we have a notion of "always" forming a containing block. Since Yoga is a flexbox spec, non-absolute nodes' containing blocks will ways be their parent. If we add something like a transform to a node then that will also apply to absolute nodes - hence we can say the node will **always** form a CB, no matter who is the descendant.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D52521160

fbshipit-source-id: bab9319ffddec617f5281823930f2a00cc2967f2
2024-01-08 20:28:49 -08:00
Joe Vilches 022d148598 Remove default yoga style extranious code (#42190)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42190

Essentially undoing D51182861 that was put in place to support adding a default position type to Fabric. Previously I had already removed the code that set the default to something other than Yoga default, but I did not remove all this extra code that allows you to do that. Since we no longer need this we should remove it so as not to encourage messing with the defaults in such a way that they differ from Yoga defaults.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D52515993

fbshipit-source-id: fb4ab726cf73bf08fd6aa44b99196962a9839694
2024-01-08 20:28:49 -08:00
Joe Vilches de45105db6 Use default inequality operator for LayoutMetrics (#42189)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42189

tsia, we had the equality op defaulted so might as well do this for inequality

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D52515802

fbshipit-source-id: ce31a00eddda991221c91364508fed6df78fd5b4
2024-01-08 20:28:49 -08:00
fortmarek 05ca2c6d8d Add 0.73.2 changelog [skip ci] (#42186)
Summary:
Adds changelog for the 0.73.2 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.73.2 release.

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

Test Plan: Read the changelog 🤞

Reviewed By: huntie

Differential Revision: D52604441

Pulled By: lunaleaps

fbshipit-source-id: 3d67da6d8ff1e3afe9a875bd38eb851fc28cd7ac
2024-01-08 10:37:06 -08:00
William Fernandes 2e2f8a6689 Fix release build error due to a casing issue in hermes tarball path after download prebuilt tarball (#42160)
Summary:
In my mac, I use a case-sensitive volume and when I build a react-native 0.73 project it failed with an error that can't find the hermes release tarball to extract:
```
Node found at: /usr/local/bin/node
Preparing the final location
Extracting the tarball
tar: Error opening archive: Failed to open '/Volumes/Workspace/meet-art-link/ios/Pods/hermes-engine-artifacts/hermes-ios-0.73.1-Release.tar.gz'
```
Note the `...-Release.tar.gz` in the error. In the disk it's `...-release.tar.gz`.

The build fails in after download the release tarball in release mode because the hermes tarball name in the `replace_hermes_version.js` build script is capitalized, while the file is lowercase on disk.

The fix is to ensure the hermes tarball name's "build type" is lowercase just like the function that creates the tarballs in react-native release located in `hermes_utils.js` in `getHermesPrebuiltArtifactsTarballName()`.

Perhaps it's better to retrieve the tarball name from the same method it's generated? E.g.:
```js
const { getHermesPrebuiltArtifactsTarballName } = require('react-native/scripts/hermes/hermes-utils');

const tarballName = getHermesPrebuiltArtifactsTarballName(`${version}-${configuration}`);
const tarballURLPath = `${podsRoot}/hermes-engine-artifacts/${tarballName}`;
```
If yes, let me know to update the PR.

## Changelog:

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

Pick one each for the category and type tags:

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

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[iOS][Fixed] - Fix release build error due to a casing issue in hermes tarball path after download prebuilt tarball

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

Test Plan: Use a case sensitive volume or system and build react-native 0.73 in release mode, it will fail. Apply the patch in this PR and it will work fine.

Reviewed By: cortinico

Differential Revision: D52603439

Pulled By: cipolleschi

fbshipit-source-id: 41ed8d8202874f338e4aa3af88d9d28ec1b8b3d5
2024-01-08 10:01:05 -08:00
Dr. Sergey Pogodin c684f9fc62 Patches with-environment.sh script (#42184)
Summary:
Closes https://github.com/facebook/react-native/issues/42164

## Changelog:

[IOS] [FIXED] - Fixes `with-environment.sh` script for the case when Node can't be found prior to loading `.xcode.env`

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

Test Plan: This is a trivial update, no need for much testing.

Reviewed By: cortinico

Differential Revision: D52602653

Pulled By: cipolleschi

fbshipit-source-id: 0881456bf165d895252ae38cb7c7aee945cfaf52
2024-01-08 08:52:51 -08:00
Luna Wei fe0306d637 Support specifying dist-tags for monorepo package bumps (#42146)
Summary:
Currently our CI will auto-tag any `npm publish` as `latest` for the monorepo packages. This is because [we do not specify a tag](https://github.com/facebook/react-native/blob/main/scripts/monorepo/find-and-publish-all-bumped-packages.js#L104), so npm will [default to `latest`](https://docs.npmjs.com/cli/v10/commands/npm-dist-tag#description). We encountered a similar issue for `react-native` awhile ago and fixed that with [always specifying a tag](https://github.com/facebook/react-native/blob/main/scripts/npm-utils.js#L84), with the explicit opt-in for `latest`.

yarn and npm will resolve `*` dependencies using `latest`. This will be a problem for any React Native version that uses `*` deps. We have actively tried to remove these `*` versions but older patches may still contain them.

When we do a monorepo package bump, it may be for 0.71 and for a user who is initializing a 0.72 version project (that still has * deps), they will receive monorepo packages of version `0.71.x`, which is not compatible. (React Native monorepo packages do not faithfully follow semver)

This change allows us to specify what tags to use and suggest tags based on what branch you are on and asks for confirmation

```
> branch 0.73-stable
? Select suggested npm tags. (Press <space> to select, <a> to toggle all, <i> to invert selection)
❯◉ "0.73-stable"
 ◉ "latest"
? Confirm these tags for *ALL* packages being bumped: "0.73-stable","latest" (Y/n)

> branch 0.72-stable
? Select suggested npm tags. (Press <space> to select, <a> to toggle all, <i> to invert selection)
❯◉ "0.72-stable"
 ◯ "latest"
? Confirm these tags for *ALL* packages being bumped: "0.72-stable" (Y/n)

> branch main
? Select suggested npm tags. (Press <space> to select, <a> to toggle all, <i> to invert selection)
❯◉ "nightly"
? Confirm these tags for *ALL* packages being bumped: "nightly" (Y/n)
```

## Changelog:

[INTERNAL] [CHANGED] - Support dist-tags in publishing monorepo packages to avoid default "latest" tag.

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

Test Plan: `yarn test scripts/`

Reviewed By: NickGerleman

Differential Revision: D52551769

Pulled By: lunaleaps

fbshipit-source-id: 52f923464387cffdc6ca22c6f0a45425965a3680
2024-01-08 08:38:53 -08:00
Moti Zilberman 8c14997cbd C++ InspectorPackagerConnection: Reconnect on socket failures (#42158)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42158

Changelog: [Internal]

* Ports an existing Java/ObjC InspectorPackagerConnection behaviour to the C++ implementation: socket errors should trigger a reconnection. This was a simple omission in D52134592.
* Clarifies the relationship between the `didFailWithError` and `didClose` methods on `IWebSocketDelegate`: calling either one will terminate the connection (and trigger a reconnection), and it's legal to call `didClose` after `didFailWithError`.
  * I'm also adding logic to ensure we don't double-schedule reconnections if both methods are called.
* Cleans up the scaffolding comments from D52134592

Reviewed By: huntie

Differential Revision: D52576727

fbshipit-source-id: 07e5a5c36222dc7bede8bcb17a1f3ced2788736b
2024-01-08 05:59:08 -08:00
Riccardo Cipolleschi 51b7c681c9 Migrate boost download away from JFrog (#42118)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42118

JFrog CDN periodically gives us headaches when downloading boost.
this change moves from JFrog to the official CDN by boost.

## Changelog
[Internal] - Download boost directly from boost archives

Reviewed By: cortinico

Differential Revision: D52479171

fbshipit-source-id: a53a9cb2ea6dfdf2b82b3c8e69c697b24cc40cf2
2024-01-08 03:09:18 -08:00
Samuel Susla cabae397c6 add nullptr check to avoid crash in RCTScrollViewComponentView (#42156)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42156

changelog: [internal]

Add a missing nullptr check to prevent crash if called after component was reused

Reviewed By: fkgozali

Differential Revision: D52572807

fbshipit-source-id: 1b5b26996e562abbcb986865299e02df20b58043
2024-01-05 15:13:53 -08:00
Saad Najmi 016bb24eac Remove deprecated RCTBundleURLProvider options (#42114)
Summary:
https://github.com/facebook/react-native/commit/f7219ec02d71d2f0f6c71af4d5c3d4850a898fd8 deprecated some of the methods in `RCTBundleURLProvider, and is part of React Native version 0.73. Let's remove the deprecated options for React Native 0.74+

bypass-github-export-checks

## Changelog:

[IOS] [REMOVED] - Remove deprecated RCTBundleURLProvider options

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

Test Plan: CI should pass.

Reviewed By: huntie

Differential Revision: D52537732

Pulled By: cipolleschi

fbshipit-source-id: ea5d17c7c66a60bceb2a12f2e17e39be4c56d422
2024-01-05 11:54:30 -08:00
Joe Vilches a68451232f Add gtests for order index logic (#42022)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42022

Some tests to ensure that the order of nodes is correct as defiend by order index that is derived from zIndex + positioning. These tests do not ensure that the native platform then goes and lays them out correctly. That will be done later with e2e tests on catalyst

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D52295063

fbshipit-source-id: 8ae29fc50ad65db8e5c0ab28a132546d8489dffe
2024-01-05 11:33:40 -08:00
Joe Vilches 1838c16978 Stop applying zPosition for views (#42021)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42021

# Context
A while ago D48905010 was committed that set the CALayer's zPosition equal to the zIndex passed in via props. This was to avoid an issue like:  https://pxl.cl/40F72
where the rotating view would clip into the background.

There are a few issues here.
* The current zIndex code is designed to be cross platform on the C++ layer and not the native layer. This diverges from the Android behavior and adds a special case for this platform when we have the ability to share all of this logic
* Static nodes will apply a zIndex when they shouldn't. This code pre-empts the static check [here](https://www.internalfb.com/code/fbsource/[cf8ad268b4cf]/xplat/js/react-native-github/packages/react-native/ReactCommon/react/renderer/components/view/ConcreteViewShadowNode.h?lines=98) that zeroes out the "order index" for static nodes
* As a result of the above, static nodes can eclipse their children which should never happen because static nodes ignore zIndex values

# Reason for the clipping
The reason this clipping is happening is because the red/blue views share the same stacking context as the white background (as indicated by the vertical black line). {F1175070418}
This in combination with the fact that our zIndex implementation will NOT set iOS's zPosition means that these three views (red view, blue view, white background view) all have the same zPosition (0) and will be laid out in the order described by the orderIndex mentioned earlier. This index essentially just changes the document order that is used for tiebreakers when zPosition is tied.

So, all the views are on the same stacking context and they all have no zPosition set. Add the rotation that the colored views are doing and you get this clipping. Apple will change the "zPosition" in a sense for the parts of the view that should be perceived as "further away" due to the rotation. So, we clip into our background which has a lower order index but the same zPosition.

# This change
The fix here just makes it so that the rotating views are not on the same stacking context as the background so the changing zPosition from the rotation does not matter. This can be achieved by setting the zIndex of the container to any number (among other things). Note that this is only the case because the default position type is relative in this stack. Otherwise you would also need to set the position type as well. Now the stacking context looks like: {F1175083828} and the problem is solved!

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D52181701

fbshipit-source-id: 580f860273b9c8470181d92d7ad542546664ed77
2024-01-05 11:33:40 -08:00
Joe Vilches 8ad083916b Make it so that static is considered in zIndex tiebreakers (#42064)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42064

# Context
Dealing with how we should stack Views in a world with static is actually a bit complicated, despite the fact that static cannot get zIndex. The outline of everything can be found in this spec: https://www.w3.org/TR/CSS21/zindex.html. That is a bit dense, but mainly because there is much more functionality to consider in the browser than we need to in RN (like block layout, inline, floats, etc). Basically it comes down to this order, with larger numbers stacked on top of smaller ones:

1) Root
2) Negative zIndex positioned nodes (ties in document order)
3) Non positioned nodes in document order
4) Positioned nodes with no zIndex (or 0) in document order*
5) Positioned nodes with positive zIndex (ties in document order)

Document order is a pre-order traversal of the tree. The asterisk on 4 is where it gets a bit complicated. Even though there is no zIndex set, you should still treat these nodes as if they form a stacking context - with their descendants stacked relative to the parent stacking context like normal if they have zIndex set. Essentially what this means in our world is that a static child will not come before (under) a positioned parent if they share the same stacking context. Without this, you would need to form a stacking context on all positioned nodes with static children if you wanted them to appear at all since static comes before (under) positioned nodes.

# Implementation
Implementing this was a bit tricky. We had to go in pre-order traversal of the tree, but if we see a relative node it needs to form a "pseudo-stacking-context" to allow static to show over it, but if any of those descendants have a zIndex set, that should be relative to the parent stacking context like normal, not this "pseudo-stacking-context". Without static we take care of this just fine because it just ends up being a pre-order traversal of the tree, then sort by zIndex.

My approach was to ignore zIndex's at first and gather all nodes that share the same stacking context in an array as if none of them had any zIndex set. After that was gathered, then sort by zIndex to get the final order for said stacking context. The second part was already implemented. For the first part I just did a pre-order traversal of the tree (stopping at nodes that form stacking contexts) and:

* If a node was non static, add to the end of the list
* If a node was static, insert into the list right after the previously inserted static node that shares the same "psuedo-stacking-context", or the parent if there were none.
  * Since inserting into arrays is slow, I opted to use `std::list`

In effect this was a pre-order traversal where static nodes are "sorted" to come first in the list of children, which is what we want since these nodes should come under non-positioned nodes that have the same "pseudo-stacking-context".

My implementation is a bit slower. The previous one just visits all nodes once with a pre-order traversal. This will also do that and thanks to `std::list`, we have no non-constant time operations while coming in that order. After the fact, however, we need to convert back to `std::vector` which is the type used across the mounting layer, so we have to iterate over this list again. I think this is the fastest we can do this and it is optimized for a world where most nodes are relative (since it will be the new default).

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D52103057

fbshipit-source-id: 0b3fb28530cfc8ef248dbdc564b5c4b4a82045a4
2024-01-05 11:33:40 -08:00
Mateusz Wit 0c37f8c85c Fix remount of SectionList header and footer (#42080)
Summary:
By default SectionList overrides `stickyHeaderIndices` with generated array based on `sections` provided via props. With this changes list header and footer keeps mounted when sections prop is changing from empty list to filled list and vice versa.

## Changelog:

[General] [Fixed] - Fix remount of header and footer in `SectionList` while transiting between empty and filled state

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

Test Plan:
**Before:**
https://github.com/facebook/react-native/assets/16048381/18d31bc2-817e-4a8d-88a8-0ad19fc71816
**After:**
https://github.com/facebook/react-native/assets/16048381/e205faad-7d55-4f96-a866-56e5eca976b6

**Playground:**
https://snack.expo.dev/Ypb-SSHVz?platform=android

## Knowledge base
https://www.smashingmagazine.com/2021/08/react-children-iteration-methods/

Reviewed By: NickGerleman

Differential Revision: D52508916

Pulled By: cipolleschi

fbshipit-source-id: 430463261887e9551f10c5c2dae352e0060ad6c4
2024-01-05 09:11:58 -08:00
Kevin Gozali d50c9068a9 iOS: Fixed up remaining RCT_USE_HERMES usage --> USE_HERMES (#42148)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42148

https://github.com/facebook/react-native/pull/41625 cleaned up some usages, but there are some remaining ones.

Changelog: [iOS][Fixed] Further cleaned up RCT_USE_HERMES

Reviewed By: cipolleschi

Differential Revision: D52555309

fbshipit-source-id: e19d10de339636eca2f4762a78cebb282d0427d9
2024-01-05 09:11:41 -08:00
Oskar Kwaśniewski 782e9eace9 feat: refactor RCTKeyWindow to be more resilient and work in multi-window apps (#42036)
Summary:
This PRs refactors `RCTKeyWindow()` to be more resilient and work in multi-window apps. After my recent PR got merged (https://github.com/facebook/react-native/issues/41935) it significantly reduced the number of calls to `RCTKeyWindow()` and now it's called only when necessary. So this PR makes this function a bit more resource intensive but it guarantees that we will find current scene's key window.

This would also fix some brownfield scenarios where React Native is working in multi-window mode and in the future allow us to more easily adopt `UIWindowSceneDelegate`

bypass-github-export-checks

## Changelog:

[IOS] [CHANGED] - refactor `RCTKeyWindow` to be more resilient and work in multi-window apps

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

Test Plan:
Checkout RNTester example for Alerts and LoadingView.

https://github.com/facebook/react-native/assets/52801365/8cf4d698-db6d-4a12-8d8d-7a5acf34858b

Reviewed By: huntie

Differential Revision: D52431720

Pulled By: cipolleschi

fbshipit-source-id: 0d6ef1d46b2428c30c9f64dae66b95dbc69f0a3b
2024-01-05 07:04:55 -08:00
Wojciech Lewicki 613a5a7597 feat: make view recycling optional on iOS (#35378)
Summary:
This PR resolves the potential problem of misconfiguration of components after being recycled. Some of them have custom, sometimes native (e.g. connected to VCs) logic that messes up with the concept of recycling.

bypass-github-export-checks

## Changelog

Added `shouldBeRecycled` field checking to `RCTComponentViewClassDescriptor `, a check for it in `_enqueueComponentViewWithComponentHandle:(ComponentHandle)componentHandle
                         componentViewDescriptor:(RCTComponentViewDescriptor)componentViewDescriptor` method, and a default implementation in `RCTComponentViewDescriptor` returning `YES` in order not to change the default behavior.

[iOS] [Added] - Add `shouldBeRecycled` method on `iOS`.

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

Test Plan: Override this method in your custom `componentView` and see that the component is not recycled.

Reviewed By: javache

Differential Revision: D41381683

Pulled By: cipolleschi

fbshipit-source-id: 10fd1e88f99b3608767c0b57fad462837924f02a
2024-01-05 07:03:31 -08:00