Commit Graph

38536 Commits

Author SHA1 Message Date
Arushi Kesarwani ce54772778 Delete getJSIModule() from context (#42097)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42097

Since we switched all apps from `getJSIModule()` to `getFabricUIManager()` from `ReactContext` and it's subclasses it's safe to delete this method.

NOTE: The fallback for FabricUIManager is still catalystInstance.getJSIModule() that's still there for backwards comptability just deleting the indirection through ReactContext

Changelog:
[Internal] Internal

Reviewed By: christophpurrer

Differential Revision: D51748655

fbshipit-source-id: dbf1a661f9e380307614662dd6079110f878d143
2024-01-01 21:07:09 -08:00
Saad Najmi 157cb0e02b Deprecate [RCTConvert UIBarStyle:] (#42100)
Summary:
The enums [UIBarStyleBlackOpaque](https://developer.apple.com/documentation/uikit/uibarstyle/uibarstyleblackopaque) and [UIBarStyleBlackTranslucent](https://developer.apple.com/documentation/uikit/uibarstyle/uibarstyleblacktranslucent) have been deprecated since iOS 13, already below React Native's minimum OS of iOS 13.4. Indeed, they are not available on visionOS and tvOS, making this a source of extra diffs.

Rather than deprecate and remove those options, I noticed that we don't actually use that `RCTConvert` method in the core repo, and haven't since `0.58-stable` (presumably before the lean core effort). Let's just remove it, it's a conversion that should be easy enough to replicate elsewhere. However, removal is a breaking change, so let's deprecate it for one release (0.74) and remove it for the next one (0.75). For posterity, tracking deprecation with https://github.com/microsoft/react-native-macos/issues/2008 and removal with https://github.com/microsoft/react-native-macos/issues/2009 .

## Changelog:

[IOS] [DEPRECATED] - Deprecate `[RCTConvert UIBarStyle:]`

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

Test Plan: CI should pass

Reviewed By: shwanton

Differential Revision: D52458912

Pulled By: NickGerleman

fbshipit-source-id: 5614b6624b9b929ba601ac976149b2002163ff54
2023-12-31 09:15:19 -08:00
Kevin Gozali 95bed60a1e iOS: renamed experimental new-arch-only flag to clarify its intent (#42072)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42072

This existing flag was for experimental (WIP) purpose only, and is undocumented, by design. Let's rename it so to make it clear. Libraries/Apps should not use this flag.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D52424750

fbshipit-source-id: 742fc6e31d1887e68439849e157dd23aaa054e36
2023-12-29 14:13:40 -08:00
Luna Wei b5e08e80d9 Remove * dependencies on @react-native (#42081)
Summary:
See https://github.com/facebook/react-native/issues/41929 for an issue on multiple monorepo packages being installed. The reason is that `*` resolves to whatever is tagged `latest` on npm.

We still need to fix the fact that our monorepo publish script will update the latest tag everytime we publish. For now, we should remove these from `main` and we will also update this in the 0.73 release branch.

I've left the two peer dependencies on `react-native` to keep at `*`.
```
virtualized-lists/package.json
30:    "react-native": "*"

rn-tester/package.json
32:    "react-native": "*"
```

As a peer-dependency this won't be a problem in terms of installing a second `react-native`. I thought about updating these to `nightly`, but that would install multiple nightly react-natives as the tag will be updated with each nightly release. I think for now this is fine and something we can revisit.

Things left to do
[ ] Fix monorepo publish script to not update `--latest`
[ ] Remove ^ dependencies on monorepo packages: https://github.com/facebook/react-native/pull/41958
[ ] Re-evaluate how we bump and align monorepo packages when we cut a release branch. I forget if we manually update this when we cut or if there is a script. We may want to change the script and have `main` dependencies point to some fake version like `1000.0.0` and only update these on nightly publishes. Regardless, this will need some discussion.

## Changelog:

[GENERAL] [CHANGED] - Be explicit about what monorepo versions we are using

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

Test Plan: N/A

Reviewed By: cortinico, cipolleschi

Differential Revision: D52435234

Pulled By: lunaleaps

fbshipit-source-id: 67da029d2b637e3997c12c21fe2a9ab9bc344399
2023-12-28 09:54:00 -08:00
Arushi Kesarwani e2fb88e6fd Deprecate old JSI module APIs (#42085)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42085

Deprecating the old JSI module APIs: `getJSIModule(JSIModuleType moduleType)`, `addJSIModules(List<JSIModuleSpec> jsiModules)` and `setTurboModuleManager(JSIModule getter)` to further delete them in future release. Deprecating them as of now to cater the OSS use-cases

Changelog:
[Internal] internal

Reviewed By: christophpurrer

Differential Revision: D50927292

fbshipit-source-id: 1d25f9f28b8aaf34979a90e4792317b263ae1714
2023-12-28 07:39:48 -08:00
Oscar Franco 655b12dbfa Unhandled promise rejection - attach non-standard Error object stack info if possible (#42079)
Summary:
This is a continuation of my [last PR](https://github.com/facebook/react-native/pull/40914) which improved the symbolication of unhandled promise rejections.

While I was developing another library I noticed I still got an error stack of the log adding and not of the error itself. The library I'm trying to debug does not throw a standard error object but rather a custom one, but it still contains the stack field. By passing this stack field to the logbox call I was able to get a better symbolicated stack trace. The exact line of the failure is not displayed but at least the correct file is.

## Changelog:

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

Pick one each for the category and type tags:

[GENERAL] [ADDED] - Unhandled promise rejection - attach non-standard Error object stack info if possible

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

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

Test Plan:
Test any unhandled promise rejection with a non-standard error (line 23, toString must not return `[object Error]`) and see if the correct (or at least a better) stack trace is shown.

Here is the one I got before and after this change:

<img src="https://github.com/facebook/react-native/assets/1634213/3d07faad-9535-42c9-8032-b4d8fe407e88" width="200" />

<img src="https://github.com/facebook/react-native/assets/1634213/2c39bd82-c7a1-4f58-8ac4-5c479bb96b6e" width="200" />

Reviewed By: huntie

Differential Revision: D52431711

Pulled By: cipolleschi

fbshipit-source-id: be2172d3b1e2fc3f72812faac372c83bc6dface2
2023-12-28 04:23:58 -08:00
Kræn Hansen e85d51c6f1 Detect ccache and provide a default configuration (#42051)
Summary:
Building native modules from source, may take a long time. Xcode already helps bring this down, by providing incremental builds, as long as the user doesn't delete their `ios/build` directory. But in some situations, i.e. when iterating the native code of an app or library or when the developer need to delete that `ios/build` directory, it's advantageous to use a compiler cache, such as ccache. This is already outlined in our ["Speeding up your Build phase"](https://reactnative.dev/docs/build-speed#xcode-specific-setup) guide.

But setting up an Xcode project to use Ccache with the correct configuration, isn't trivial in a way that doesn't require symlinking `clang` and `clang++` or passing configuration via environment variables on every `npm run ios` invokation.

This PR takes its inspiration from the existing guide on [setting up Ccache for Xcode](https://reactnative.dev/docs/build-speed#xcode-specific-setup), but applies the build settings only if an installation of `ccache` is detected and the feature is explicitly opted into via an argument to the `react_native_post_install` function or a `USE_CCACHE` environment variable. It uses two shell scripts to wrap the call to `ccache`, which both injects a default `CCACHE_CONFIGPATH` environment variable (i.e. it won't override this if already provided, to allow for customisations on CI), pointing to a `ccache.config` which works well with React Native projects (it has the same values as the guide mentions).

For context, I posted about this change in the ios channel of the contributors Discord server, where I discussed it with cipolleschi and saadnajmi

### Additional output printed when running `pod install`

#### When `ccache_available and ccache_enabled`

```
[Ccache]: Ccache found at /opt/homebrew/bin/ccache
[Ccache]: Setting CC, LD, CXX & LDPLUSPLUS build settings
```

#### When `ccache_available and !ccache_enabled`

```
[Ccache]: Ccache found at /opt/homebrew/bin/ccache
[Ccache]: Pass ':ccache_enabled => true' to 'react_native_post_install' in your Podfile or set environment variable 'USE_CCACHE=1' to increase the speed of subsequent builds
```

#### When `!ccache_available and ccache_enabled`

```
[!] [Ccache]: Install ccache or ensure your neither passing ':ccache_enabled => true' nor setting environment variable 'USE_CCACHE=1'
```

#### Otherwise

If the user doesn't have ccache installed and doesn't explicitly opt into this feature, nothing will be printed.

bypass-github-export-checks

## Changelog:

[IOS] [ADDED] - Added better support for `ccache`, to speed up subsequent builds of native code. After installing `ccache` and running `pod install`, the Xcode project is injected with compiler and linker build settings pointing scripts that loads a default  Ccache configuration and invokes the `ccache` executable.

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

Test Plan:
I've tested this manually - would love some inspiration on how to automate this, if the reviewer deem it needed.
To test this locally:
1. Install Ccache and make sure the `ccache` executable is in your `PATH` (verify by running `ccache --version`)
2. Create a new template app instance and apply the changes of this PR to the `node_modules/react-native` package.
3. Set the `USE_CCACHE` environment variable using `export USE_CCACHE=1`.
4. Run `pod install` in the `ios` directory.
5. Check the stats of Ccache (running `ccache -s`).
6. Run `npm run ios` or build the project from Xcode.
7. Check the Ccache stats again to verify ccache is intercepting compilation ("Cacheable calls" should ideally be 100%).
8. To check the speed gain:
  a. Delete the `ios/builds` directory
  b. Zero out the ccache stats (by running `ccache -z`)
  c. Run `pod install` again (only needed if you ran the initial `pod install` with new architecture enabled `RCT_NEW_ARCH_ENABLED=1`).
  d. Run `npm run ios` or build the project from Xcode.
  e. This last step should be significantly faster and you should see "Hits" under "Local storage" in the ccache stats approach 100%.

Reviewed By: huntie

Differential Revision: D52431507

Pulled By: cipolleschi

fbshipit-source-id: 6cfe39acd6250fae03959f0ee74d1f2fc46b0827
2023-12-28 01:42:01 -08:00
JorenVos e25a9b4c5d Fix support for --sourcemap-output path containing spaces in Xcode projects (#40937)
Summary:
This PR contains the changes from https://github.com/facebook/react-native/pull/30981 that got closed due to inactivity.

Many thanks to nickdowell for this bug report & fix. We encountered this error in our project when we had an Xcode scheme that contains a space (like `AppName alpha`).

This change fixes the generation of source maps for Xcode projects where the output path contains spaces.

The `EXTRA_ARGS` environment variable, being a plain string, would be split into arguments by whitespace - so a path containing spaces was being treated as several arguments rather than one.

This change uses an array to contain the arguments instead, allowing the proper handling of arguments that may contain spaces.

bypass-github-export-checks

## Changelog:

[iOS] [Fixed] - Fix support for --sourcemap-output path containing spaces

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

Test Plan:
Tested using a sample project with the following "Bundle React Native code and images" Xcode build phase

```
export SOURCEMAP_FILE="$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/main.jsbundle.map"
set -e
export NODE_BINARY=node
../node_modules/react-native/scripts/react-native-xcode.sh
```

and a `CONFIGURATION_BUILD_DIR` that contains spaces - `~/Library/Xcode/Derived Data`. **You can also try an XCode-scheme that contains a space.**

### Before

```
+ EXTRA_ARGS=
+ case "$PLATFORM_NAME" in
+ BUNDLE_PLATFORM=ios
+ EMIT_SOURCEMAP=
+ [[ ! -z /Users/nick/Library/Developer/Xcode/Derived Data/RN064-cpnwckdferodycbevupbrkjydate/Build/Products/Release-iphonesimulator/RN064.app/main.jsbundle.map ]]
+ EMIT_SOURCEMAP=true
+ PACKAGER_SOURCEMAP_FILE=
+ [[ true == true ]]
+ [[ '' == true ]]
+ PACKAGER_SOURCEMAP_FILE='/Users/nick/Library/Developer/Xcode/Derived Data/RN064-cpnwckdferodycbevupbrkjydate/Build/Products/Release-iphonesimulator/RN064.app/main.jsbundle.map'
+ EXTRA_ARGS=' --sourcemap-output /Users/nick/Library/Developer/Xcode/Derived Data/RN064-cpnwckdferodycbevupbrkjydate/Build/Products/Release-iphonesimulator/RN064.app/main.jsbundle.map'
+ node /Users/nick/Desktop/RN064/node_modules/react-native/cli.js bundle --entry-file index.js --platform ios --dev false --reset-cache --bundle-output '/Users/nick/Library/Developer/Xcode/Derived Data/RN064-cpnwckdferodycbevupbrkjydate/Build/Products/Release-iphonesimulator/main.jsbundle' --assets-dest '/Users/nick/Library/Developer/Xcode/Derived Data/RN064-cpnwckdferodycbevupbrkjydate/Build/Products/Release-iphonesimulator/RN064.app' --sourcemap-output /Users/nick/Library/Developer/Xcode/Derived Data/RN064-cpnwckdferodycbevupbrkjydate/Build/Products/Release-iphonesimulator/RN064.app/main.jsbundle.map
                    Welcome to Metro!
              Fast - Scalable - Integrated

info Writing bundle output to:, /Users/nick/Library/Developer/Xcode/Derived Data/RN064-cpnwckdferodycbevupbrkjydate/Build/Products/Release-iphonesimulator/main.jsbundle
info Writing sourcemap output to:, /Users/nick/Library/Developer/Xcode/Derived
```
Note the incorrect sourcemap output path.

### After

```
+ EXTRA_ARGS=()
+ case "$PLATFORM_NAME" in
+ BUNDLE_PLATFORM=ios
+ EMIT_SOURCEMAP=
+ [[ ! -z /Users/nick/Library/Developer/Xcode/Derived Data/RN064-cpnwckdferodycbevupbrkjydate/Build/Products/Release-iphonesimulator/RN064.app/main.jsbundle.map ]]
+ EMIT_SOURCEMAP=true
+ PACKAGER_SOURCEMAP_FILE=
+ [[ true == true ]]
+ [[ '' == true ]]
+ PACKAGER_SOURCEMAP_FILE='/Users/nick/Library/Developer/Xcode/Derived Data/RN064-cpnwckdferodycbevupbrkjydate/Build/Products/Release-iphonesimulator/RN064.app/main.jsbundle.map'
+ EXTRA_ARGS+=("--sourcemap-output")
+ EXTRA_ARGS+=("$PACKAGER_SOURCEMAP_FILE")
+ node /Users/nick/Desktop/RN064/node_modules/react-native/cli.js bundle --entry-file index.js --platform ios --dev false --reset-cache --bundle-output '/Users/nick/Library/Developer/Xcode/Derived Data/RN064-cpnwckdferodycbevupbrkjydate/Build/Products/Release-iphonesimulator/main.jsbundle' --assets-dest '/Users/nick/Library/Developer/Xcode/Derived Data/RN064-cpnwckdferodycbevupbrkjydate/Build/Products/Release-iphonesimulator/RN064.app' --sourcemap-output '/Users/nick/Library/Developer/Xcode/Derived Data/RN064-cpnwckdferodycbevupbrkjydate/Build/Products/Release-iphonesimulator/RN064.app/main.jsbundle.map'
                    Welcome to Metro!
              Fast - Scalable - Integrated

info Writing bundle output to:, /Users/nick/Library/Developer/Xcode/Derived Data/RN064-cpnwckdferodycbevupbrkjydate/Build/Products/Release-iphonesimulator/main.jsbundle
info Writing sourcemap output to:, /Users/nick/Library/Developer/Xcode/Derived Data/RN064-cpnwckdferodycbevupbrkjydate/Build/Products/Release-iphonesimulator/RN064.app/main.jsbundle.map
```
sourcemap output path fixed 🎉

Reviewed By: arushikesarwani94

Differential Revision: D52431057

Pulled By: cipolleschi

fbshipit-source-id: 528217c84fe3f467a30baa15cfa4dcb2ed713165
2023-12-28 00:58:17 -08:00
Arushi Kesarwani b507e11867 Make TurboModuleManager not implement JSIModule (#42060)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42060

For removal of JSIModule getting rid of the inheritance relationship b/w interfaces TurboModuleManager & JSIModule by directly defining `invalidate()`. `initialize()` here isn't being used hence not defining it.

Changelog:
[Internal] internal

Reviewed By: philIip, mdvacca

Differential Revision: D49977957

fbshipit-source-id: 8de644b1f344d8ce8d4a78655556829f860a2b10
2023-12-27 21:02:07 -08:00
Nicola Corti d992abc56d Move legacy tests from OSS to fbandroid/java/com/facebook/fbreact (#41802)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41802

Those tests are not executing at all, they're just compiled.
Our internal infra is still depending on some bits of it though, so I'm moving them to `fbandroid/java/com/facebook/fbreact

Changelog:
[Internal] [Changed] - Move legacy tests from OSS to  fbandroid/java/com/facebook/fbreact

Reviewed By: rshest

Differential Revision: D51805702

fbshipit-source-id: 2c5cec68efa9854184e981220202d8f356ff690a
2023-12-27 17:34:29 -08:00
Nicola Corti c75abefea6 Convert the last Unit Tests to Kotlin (#42078)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42078

Resubmit of D51891716 and D52033328

I'm doing a pass and converting the last Java Unit Tests we had to Kotlin
I've also re-enabled multiple tests that were disabled in the past.

Changelog:
[Internal] [Changed] - Convert the last Unit Tests to Kotlin

Reviewed By: rshest

Differential Revision: D52430728

fbshipit-source-id: e6b4a6ed88d852024d959cf5148e992e97a84434
2023-12-27 08:52:29 -08:00
Janic Duplessis ac9b87cd57 Fix comment about adding packages in android template (#41856)
Summary:
I noticed this comment is still in Java in the Kotlin template. It also doesn't really work anymore since there is no packages variable.

To fix it I completed the comment with all code needed for it to work in kotlin. I think an older version of the template used to be more like:

```kotlin
val packages = PackageList(this).packages
// packages.add(MyReactNativePackage())
return packages
```

But then it requires adding a lint suppress annotation since packages variable can be simplified. I think this is simpler even if it makes the comment a few more lines.

## Changelog:

[GENERAL] [FIXED] - Fix comment about adding packages in android template

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

Test Plan: Tested that uncommenting that code works

Reviewed By: cipolleschi

Differential Revision: D51987483

Pulled By: cortinico

fbshipit-source-id: d0135b5b536960017ccc7b25f92c75b3bd863cd9
2023-12-27 08:47:02 -08:00
Ruslan Shestopalyuk ffe219cd06 Avoid using std::views::filter to fix issues with macosx-x86_64 toolchain (#42076)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42076

## Changelog:
[Internal] -

In https://github.com/facebook/react-native/pull/41519 we introduced usage of C++20s range operations, which broke MacOSX desktop builds for the x86_64 targets (e.g. on Intel Mac laptops).

This appears to be a [known issue](https://stackoverflow.com/questions/73929080/error-with-clang-15-and-c20-stdviewsfilter), fixed in the later clang versions, however we need to support the earlier ones as well.

This changes the code to use the good old imperative style to do the same thing, but without using `std::views::filter`, thus working around the problem.

Reviewed By: christophpurrer

Differential Revision: D52428984

fbshipit-source-id: 6d0a390549c462b7040b5c0e669c00932bd99af7
2023-12-27 03:58:08 -08:00
Arushi Kesarwani c2c346ccaf Get rid of old APIs in FabricUIManagerProvider (#42059)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42059

Getting rid of old APIs in FabricUIManagerProvider and also clearing it of the inheritance dependency it has on JSIModule post it's references have been cleared.

Reviewed By: christophpurrer

Differential Revision: D51001239

fbshipit-source-id: c3d4650c292e957e9f939304662932c11af7a24f
2023-12-26 23:25:06 -08:00
Arushi Kesarwani cd5f6aa47c Tests to get rid of JSI module (#42058)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42058

Getting rid of JSIModule from tests

Changelog:
[Internal] internal

Reviewed By: christophpurrer

Differential Revision: D50925102

fbshipit-source-id: bce1c9459ae2c4d690712e2c09a7e935fa8e4427
2023-12-26 23:25:06 -08:00
Arushi Kesarwani 6555205539 Refactor React to get rid of JSIModule (#42069)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42069

 Refactor React to get rid of JSIModule and its dependencies now that the changes are rolled out for all internal apps.

Changelog:
[Internal] Internal

Reviewed By: christophpurrer

Differential Revision: D51058885

fbshipit-source-id: 07a7335235605fbc07657f8da8588ec548bce797
2023-12-26 23:25:06 -08:00
Ramanpreet Nara e75f050f1f BridgelessUIManager: Pull already implemented methods out (#42068)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42068

These methods are overriden in UIManager.js

Let's pull them out, so that we don't get distracted by them.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D52350348

fbshipit-source-id: 3d4b446c40be9d8797ec787f45335f42f8982956
2023-12-26 18:48:54 -08:00
Ramanpreet Nara 963ce9bdc6 BridgelessUIManager: Use blocks for all functions (#41999)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41999

Just a cosmetic change, that will remove noise from the subsequent diffs.

Now, all the raiseSoftError are on similar columns in the file.

Changelog: [internal]

Reviewed By: cortinico

Differential Revision: D52041976

fbshipit-source-id: bc22add358becf1ad8d5f7602253e2af28697d42
2023-12-26 18:48:54 -08:00
Kevin Gozali 5d520abd4c RNTester iOS: internal profiling test setup (#42071)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42071

Proxying background handling to set up Meta internal test infra.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D52420805

fbshipit-source-id: a68645b7b630f976dfd9e863b0c985c738c658ec
2023-12-26 15:26:57 -08:00
Ramanpreet Nara 55e4543eea BridgelessUIManager: Refactor how constants are retrieved and cached (#42000)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42000

I think this makes BridgelessUIManager easier to read: if the getUIManagerConstants method exists, get the cached constants.

Also, this unifies the nomenclature between PaperUIManager and BridgleessUIManager. That way, it's easy to compare/constrast the two files.

Changelog: [Internal]

Reviewed By: dmytrorykun, luluwu2032

Differential Revision: D52002910

fbshipit-source-id: 01bfbd5fedbe3f995b4a1f68309714d84027133b
2023-12-25 19:23:14 -08:00
Ramanpreet Nara 09ab59ab25 BridgelessUIManager: Make error reporting more readable (#42001)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42001

## Rational
Every call-site was calling into console.error.
Some call-sites were using string concatination.

This diff introduces a new error reporting method: raiseSoftError, that hides all the string concatination and console.errors.

I believe this makes the error reporting logic within BridgelessUIManager more readable.

Changelog: [Internal]

Reviewed By: luluwu2032

Differential Revision: D52002911

fbshipit-source-id: 186842a4835ca65f326dda35b1c0db50f8ff149c
2023-12-25 19:23:14 -08:00
David Angulo 192a88d522 docs: bump minSdk to 23 (#42034)
Summary:
The Android minSdk has been bumped in https://github.com/facebook/react-native/pull/38874 but not in the README.

## Changelog:
[General] [Fixed] - Updated docs to match Android 6.0 (API 23) minimum requirement.

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

Test Plan: N/A

Reviewed By: fkgozali

Differential Revision: D52364522

Pulled By: arushikesarwani94

fbshipit-source-id: b04b5aa94b629380b559b2717e12a882f8817a6f
2023-12-21 22:29:00 -08:00
Facebook Community Bot c54bfe4522 Re-sync with internal repository (#42046)
The internal and external repositories are out of sync. This Pull Request attempts to brings them back in sync by patching the GitHub repository. Please carefully review this patch. You must disable ShipIt for your project in order to merge this pull request. DO NOT IMPORT this pull request. Instead, merge it directly on GitHub using the MERGE BUTTON. Re-enable ShipIt after merging.
2023-12-21 19:22:02 -08:00
Kevin Gozali d5797aef98 RNTester: fixed up ScrollViewExample test name (#42043)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42043

It had a typo: pressableStickyHeader vs pressableStickyHeaders

Changelog: [Internal]

Reviewed By: lunaleaps

Differential Revision: D52378237

fbshipit-source-id: b0ee4029797868298c00aab74808fce73e59e357
2023-12-21 17:56:18 -08:00
Vincent Riemer 0be527b060 Clean up stale mobileconfig reading for pointer events (#41946)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41946

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D52090274

fbshipit-source-id: 592c03c841ca26509d39ef597cab776c8fa84fcb
2023-12-21 16:08:49 -08:00
David Vacca fa470ef6ae Rename prefix of binaryCompatibilityValidator properties (#42041)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42041

binaryCompatibilityValidator is a generic library, it shouldn't have referecences to react. I'm renaming:

```
react.internal.binaryCompatibilityValidator...
```

by

```
binaryCompatibilityValidator...
```

changelog: [internal] internal

Reviewed By: philIip

Differential Revision: D52380035

fbshipit-source-id: fc71595939e7f71b135acc44a9918f09361a604f
2023-12-21 15:49:29 -08:00
Nick Gerleman 9271957437 Move trailing position functions (#42031)
Summary:
X-link: https://github.com/facebook/yoga/pull/1533

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

I have some reservations about  some of the conditional setting of trailing position in general, and some of the repeated transformations that neccesitates this, but these functions don't belong in `CalculateLayout.h`. For now, just move these to their own header.

Reviewed By: joevilches

Differential Revision: D52292121

fbshipit-source-id: 4a998a4390a8d045af45f5424adaf049ed635e7a
2023-12-21 13:48:11 -08:00
Nick Gerleman ff8938c602 Remove duplicate declaration of calculateLayoutInternal (#42030)
Summary:
X-link: https://github.com/facebook/yoga/pull/1532

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

as per title

Reviewed By: joevilches

Differential Revision: D52289613

fbshipit-source-id: 51a810dda32e6fe44be05a42fe21d78aede52d30
2023-12-21 13:48:11 -08:00
Vincent Riemer 72b876a5a4 Refactor hover tracking logic to the shared C++ renderer (#41519)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41519

Changelog: [Internal] - Refactor hover tracking logic to the shared c++ renderer

This diff refactors our hover tracking logic out of the platform (in this case only iOS, integrating Android is going to require extra work due to their pointer events being untyped) and puts it into the event intercepting infra in Fabric's C++ core. This is a big-ish diff so I'm going to try my best to use this summary to guide you through the changes.

To begin with — the changes inside `RCTSurfacePointerHandler.mm` are mostly about removing the existing hover tracking logic. The logic of the hover tracking is largely the same between the objective-c and c++ implementations with minor tweaks in order to be a better citizen when it comes to storing node references. One small "addition" to this file is explicitly firing a `pointerleave` event from the iOS layer when we detect that the pointer has left the app entirely because the C++ would otherwise not know when the pointer leaves the app. We don't need to include a special case for `pointerenter` because we can derive that in C++ from the first `pointermove` event that gets sent once the pointer re-enters the app's root view.

Next I think it makes most sense to continue onto the `PointerEventsProcessor.h/mm` which is the central class we're working in. One small change is adding a flag to the `ActivePointer` struct (`shouldLeaveWhenReleased`) which we will set during `ActivePointer` registration — setting to false if the pointer in question exists in the (also) newly added `previousHoverTrackersPerPointer_` registry. This logic is primarily used for knowing later when the pointer is released and whether we should emit the synthetic leave/out event on release. If the pointer existed in `previousHoverTrackersPerPointer_` **before** the `ActivePointer` registration that implies that the pointer is capable of hovering to some degree and we should **not** emit those leave/out events yet.

The real meat & potatoes of this diff is the `handleIncomingPointerEventOnNode` method which matches the `handleIncomingPointerEvent` method we removed from `RCTSurfacePointerHandler.mm`. This method derives the enter/leave/over/out pointer events by comparing the current event's target path (list of nodes from the root node to the target node of the event) to the previously recorded event target path. The representation of this event path is through the new `PointerHoverTracker` class which stores a pointer to just the root node and the target node as we can recreate the entire event path from these.

For over/out events all that matters is when the deepest-most target changes which is checked in `handleIncomingPointerEventOnNode` by leveraging `PointerHoverTracker`'s `hasSameTarget` method. For enter/leave events we need to fire discrete events for every node in the path which has either been removed or added, so the `diffEventPath` method was introduced on `PointerHoverTracker` to provide that.

Reviewed By: yungsters

Differential Revision: D51317492

fbshipit-source-id: e15ac3a396d5afa7ab921e4589861b43b07a33b5
2023-12-21 12:45:54 -08:00
Riccardo Cipolleschi 3b80531f32 Move prop diffing for Interop Layer to Adapter
Summary:
We have 1 coordinator per class but 1 adapter per instance.
Currently, the `oldProps` are stored in the coordinator and not into the adapter.
Therefore, when we create multiple instances of the same legacy component, the props might get messy or not updated properly.

This change moves the `oldProps` and the diffing code to the Adapter rather than to the coordinator, making them instance-specific.

## Changelog:
[iOS][Fixed] - Move old props and prop diffing to the interop layer adapter

Reviewed By: sammy-SC

Differential Revision: D52368222

fbshipit-source-id: 0f0c47b586fe61404250c5bfe51a7e2c63012815
2023-12-21 12:01:02 -08:00
Dmitry Rykun 06a053f54e Improve codegen logging formatting (#42013)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42013

The existing codegen logging is quite wild. This diff makes it slightly nicer.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D52328744

fbshipit-source-id: 1466de2d1188d35a746ab94ce9fc60ef08e3ddda
2023-12-21 11:06:12 -08:00
Dmitry Rykun a612053510 Introduce "npx react-native codegen" command (#41925)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41925

This diff introduces the `npx react-native codegen` command.
It runs the codegen for the `package.json` file in current working directory.

Changelog: [General][Added] - Introduce "npx react-native codegen" command.

Reviewed By: cipolleschi

Differential Revision: D51495465

fbshipit-source-id: 1fd4c3645235a12f68f9032349a443b92b4764b8
2023-12-21 10:20:30 -08:00
Luna Wei 07a159f279 Bump minimum version of activesupport for CVE-2023-38037 (#42023)
Summary:
Bump activesupport to minimum 6.1.7.5 CVE-2023-38037. More details https://github.com/advisories/GHSA-cr5q-6q9f-rq6q

Updated the gemfile and then ran `bundle install` at the root

## Changelog:

[IOS] [SECURITY] - Bump activesupport to minimum 6.1.7.5 CVE-2023-38037.

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

Reviewed By: cipolleschi

Differential Revision: D52346223

Pulled By: lunaleaps

fbshipit-source-id: f8141048b68cde9c58eb23ee2d41cb4a6becb6ef
2023-12-21 10:08:28 -08:00
Dmitry Rykun 7b10609276 Introduce the "platform" option to generate-codegen-artifacts.js (#42012)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42012

Up until now `generate-codegen-artifacts.js` has been iOS only. But its logic is actually quite general, and this diff makes it platform agnostic.

Changelog: [General][Added] - Introduce the "platform" option to generate-codegen-artifacts.js

Reviewed By: RSNara

Differential Revision: D52257542

fbshipit-source-id: b7e698c779f7c6dae9b0de98a19ba452111fea5e
2023-12-21 08:29:20 -08:00
Samuel Susla 4885743998 use Pressable over TouchableWithoutFeedback (#42016)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42016

changelog: [internal]

TouchableWithoutFeedback is broken with React 18. Before we fix it, let's use Pressable in tests.

Reviewed By: fkgozali

Differential Revision: D52328529

fbshipit-source-id: 1d7d5032ffaf7f8ff5ffa47af2a87b733fd2e840
2023-12-21 06:37:23 -08:00
Alex Hunt 7eed8816a8 Remove exclude for normalize-colors in template test setup (#42033)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42033

Intends to fix failing `test_*_template` jobs in CircleCI, broken after D52337762.

Changelog: [Internal]

Reviewed By: motiz88, cipolleschi

Differential Revision: D52364225

fbshipit-source-id: 0e088f300fc8f38dc439446a29d81f2bec2e5d51
2023-12-21 05:25:06 -08:00
Moti Zilberman 210a7c2223 Create new inspector flag for enabling the C++ packager connection implementation (#42035)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42035

In upcoming diffs we will begin integrating the new C++ `InspectorPackagerConnection` (D52134592) into React Native on Android and iOS. This diff adds a shared C++ flag that is the source of truth for whether the new implementation should be enabled.

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D52335446

fbshipit-source-id: 7f16ffc1728c8de7d4fbf090268ffed6fbaa879f
2023-12-21 05:09:10 -08:00
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. (https://github.com/facebook/react-native/commit/3f629049ba9773793978cf9093c7a71af15e3e8d)
- `react-native@0.69` removed built-in prop types. (https://github.com/facebook/react-native/commit/3e229f27bc9c7556876ff776abf70147289d544b)
- `react-native@0.71` restored built-in prop types, along with bug fixes to isolate deprecated usage. (https://github.com/facebook/react-native/commit/b966d297245a4c1e2c744cfe571396cfa7e5ffd3)

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