Commit Graph

38536 Commits

Author SHA1 Message Date
Nicola Corti 0cbd2a345d Update Element Inspector string to "Toggle" (#41595)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41595

Instead of having to select between Enable/Hide the Element Inspector String, let's just use "Toggle".

Changelog:
[Internal] [Changed] - Update Element Inspector string to "Toggle"

Reviewed By: cipolleschi

Differential Revision: D51503403

fbshipit-source-id: 2ad24df8324eb789b0016fe7ac5d439cba6f5952
2023-11-22 03:37:13 -08:00
Dark Knight 2a4338d091 Revert D51346658: Multisect successfully blamed "D51346658: [RN][Android] Handle all incoming Inspector messages on main thread, downgrade some errors to logs" for otest failure
Summary:
This diff is reverting D51346658
D51346658: [RN][Android] Handle all incoming Inspector messages on main thread, downgrade some errors to logs by motiz88 has been identified to be causing the following test failure:

Tests affected:
- [xplat/endtoend/jest-e2e/apps/facebook_xplat/ReactNativeTTRCTester/__tests__/ReactNativeTTRCTester-storeOrNetworkWithoutCachedContent-android-e2e.js](https://www.internalfb.com/intern/test/281475019301167/)

Here's the Multisect link:
https://www.internalfb.com/multisect/3539088
Here are the tasks that are relevant to this breakage:

We're generating a revert to back out the changes in this diff, please note the backout may land if someone accepts it.

If you believe this diff has been generated in error you may Commandeer and Abandon it.

bypass-github-export-checks

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D51512872

fbshipit-source-id: 8bc8e12b651f91a6f74243a0a85fca7fd1953bdb
2023-11-21 23:48:48 -08:00
Nick Gerleman 08f89eb2ae Remove yoga::Style::Edges usage in AndroidTextInputComponentDescriptor (#41598)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41598

This code merges native, Android provided theme text input padding, with Yoga style. We are removing operations on all edges as aggregate, so this replaces that.

This was previously part of D50998164

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D51503493

fbshipit-source-id: c6e2f3183a05861745fdd8f044d12e3dd8205804
2023-11-21 23:17:32 -08:00
Nick Gerleman c4519a01ac Remove composite border comparisons (#41568)
Summary:
X-link: https://github.com/facebook/yoga/pull/1475

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

Removes cases where we rely on comparing composite of Yoga edges, since we are removing that internal API (public API is already one at a time). Extracted from D50998164, with more sound facility for looping through edges.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D51478403

fbshipit-source-id: 162170b91345ff86db44a49a04a2345f0fbd0911
2023-11-21 23:17:32 -08:00
Pieter De Baets bf4e229668 Clear mLastQueriedSurfaceMountingManager on stopSurface (#41590)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41590

Causing a small leak while we wait for the surface to be fully destroyed.

Changelog: [Internal]

Reviewed By: fabriziocucci

Differential Revision: D51499256

fbshipit-source-id: 8f9e65898dcb9e0261502028874378ec9cc0f3fc
2023-11-21 13:44:18 -08:00
Kevin Gozali c497fc61b5 RNTester iOS: setup Meta internal app init logic (#41591)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41591

For internal build integration, invoke Meta internal app setup logic. This has no effect in OSS.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D51498070

fbshipit-source-id: 48658d2c3136023d80fbd9a2fdc29996616e1eee
2023-11-21 13:43:16 -08:00
Samuel Susla 0d715cd016 add unit tests for EventTarget (#41596)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41596

changelog: [internal]

Reviewed By: rshest

Differential Revision: D51499449

fbshipit-source-id: 782108edf24af1c91d77c664bc496b466995621e
2023-11-21 13:31:50 -08:00
Arushi Kesarwani a6964b3629 Fix ReactNativeHost to have default UIManagerProvider as null (#41593)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41593

Fixing fallback to `getJSIModule()` by defaulting `getUIManagerProvider()` correctly to null

Reviewed By: christophpurrer

Differential Revision: D51500901

fbshipit-source-id: 91b692e6c88d736970b652179e14bc524a411d0e
2023-11-21 11:27:26 -08:00
Ruslan Shestopalyuk ac1cdaa716 Make ImageManager implementation overridable (#41582)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41582

# Changelog:

This will allow to have custom `ImageManager` implementations on new platforms.

Reviewed By: christophpurrer

Differential Revision: D51495143

fbshipit-source-id: bbd03bdad1b87fd53e70a886f1fdc74f371987c8
2023-11-21 10:51:40 -08:00
Samuel Susla 1e43d2b9bd remove unused argument from RawProps (#41565)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41565

changelog: [internal]

this argument is never used, let's remove it.

Reviewed By: christophpurrer

Differential Revision: D51468580

fbshipit-source-id: aec029bc78b5490686a36ac8a5f5d0342bd28d50
2023-11-21 10:37:54 -08:00
Moti Zilberman 16ad818d21 Handle all incoming Inspector messages on main thread, downgrade some errors to logs
Summary:
Changelog: [Internal]

* Updates `InspectorPackagerConnection.java`, `DevServerHelper.java` and `DevSupportManagerBase.java` to perform all connection management and message dispatching for the inspector socket on the main thread. This is in support of a new CDP implementation in React Native that will strictly assume it's called on the main thread (thus avoiding the need for explicit locking in many places).
* Downgrades JSON parsing errors and duplicate connection errors from exceptions to logs, matching the [iOS implementation](https://github.com/facebook/react-native/blob/main/packages/react-native/React/Inspector/RCTInspectorPackagerConnection.m).

Reviewed By: javache

Differential Revision: D51346658

fbshipit-source-id: 3d0d5588a824c1b28da5499ef9d040998a941288
2023-11-21 09:56:55 -08:00
Ruslan Shestopalyuk 7625a50296 Share ImageRequest implementation across the platforms (#41581)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41581

# Changelog:

There was nothing platform-specific in `ImageRequest` implementation, defined on iOS, so might as well share across platforms.

Reviewed By: christophpurrer

Differential Revision: D51495144

fbshipit-source-id: ef15c5c8c6b07c1a87ca83eb15b5997ba703fbcc
2023-11-21 09:08:10 -08:00
Nick Gerleman d9d81a755e Terminate on logic error in createNode HostFunction (#41567)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41567

Sometimes `createNode` calls into is throwing `std::out_of_range_error` or `std::length_error` in response to both vector and string operations.

Instead of propagating `std::logic_error`, which indicates a defect in native code, terminate, so we can get an actionable native stack trace.

`createNode` and `cloneNode` also both ocasionally see `bad_alloc`, but this is not usually an instance of a defect at the allocation-site, and throwing would be more graceful.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D51463600

fbshipit-source-id: 870cbf3538d8ccbc01ded2868781a63ba12a941c
2023-11-21 09:03:51 -08:00
Christoph Purrer 99d407da46 ios|android textInput > Remove #ifdef ANDROID when not needed (#41569)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41569

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D51479729

fbshipit-source-id: 0dd78e568b98c93446a59e5f1242d26a24d9fff2
2023-11-21 08:07:37 -08:00
Moti Zilberman b58cba7ef2 Rename JSEngineInstance -> JSRuntimeFactory (#41548)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41548

`JSEngineInstance` is a misnomer - this interface actually creates `jsi::Runtime`s and doesn't represent an "instance of a JS engine". This diff renames it to `JSRuntimeFactory`.

Changelog: [Internal]

Reviewed By: huntie, arushikesarwani94

Differential Revision: D51447882

fbshipit-source-id: e118fe5c202607500a62d8e15afec088c4946969
2023-11-21 07:06:22 -08:00
Ruslan Shestopalyuk ce0dabddf3 Extract ImageSize type from NativeImageLoader interface (re-submit) (#41577)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41577

# Changelog:
[Internal]-

The change is equivalent in terms of API, however this makes it work nicer with C++ codegen and easier to use with a pure C++ implementation of the native module.

Reviewed By: GijsWeterings

Differential Revision: D51493466

fbshipit-source-id: bf9105670ae56a191ab2e6c8cfb794c2fecd4809
2023-11-21 05:14:14 -08:00
Dmitry Rykun 33a44e68fc Refactor generate-artifacts-executor.js: delete configFilename and configKey arguments (#41533)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41533

This diff removes `configFilename` and `configKey` arguments from iOS codegen CLI. Now we always expect them to be `package.json` and `codegenConfig` respectively.

## Motivation

The existing implementation expects every library to have its codegen config in a file with `configFilename` name. `configFilename` is passed as a single CLI argument and applied to every app dependency. I.e. if `configFilename = codegen.config.json` then we expect to find this file in *every* third-party library. That is weird expectation. This customisation option is unsound. Same with `configKey`. It is much simpler to just stick with convention that `configFilename = "package.json"` and `configKey = "codegenConfig"`.

Changelog: [General][Breaking] - Delete `configFilename` and `configKey` arguments from iOS codegen CLI. Now we always expect them to be `package.json` and `codegenConfig` respectively.

Reviewed By: cipolleschi

Differential Revision: D51256486

fbshipit-source-id: fe190b514be7c4e489c7be01294958cf3254602a
2023-11-21 03:53:33 -08:00
Dmitry Rykun d1e03f5606 Refactor generate-artifacts-executor.js: return libraries array instead of using an inout argument (#41531)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41531

This diff converts in-out `libraries` argument of codegen library lookup functions to a normal return value. This makes these functions simpler to reason about, and simplifies subsequent refactors.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D51111416

fbshipit-source-id: 12b5dda4d326e3f1c866c16f7bcd17080be54b58
2023-11-21 03:12:08 -08:00
Moti Zilberman a1b67f955e Handle all incoming Inspector messages on main thread (#41503)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41503

Changelog: [Internal]

Updates RCTInspectorPackagerConnection to dispatch all messages on the main thread (which is SocketRocket's default behaviour). This is in support of a new CDP implementation in React Native that will strictly assume it's called on the main thread (thus avoiding the need for explicit locking in many places).

Reviewed By: javache

Differential Revision: D51346659

fbshipit-source-id: c529b0aea97f7732cea58a4dc66993c5c8259958
2023-11-20 21:56:41 -08:00
Ruslan Shestopalyuk 781b637db4 Do not filter out Image.source prop when sending it C++ on New Architecture on Android (#41570)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41570

## Changelog:
[Internal] -

This fixes a subtle problem whereas an update to `Image.source` (or `Image.src`) prop on JS side may not end up getting propagated to the C++ side, with New Architecture.

As the result, this can lead to some weird corner cases, whereas e.g. layout doesn't update after the image's size changes.

Differential Revision: D51479305

fbshipit-source-id: 72afb7dfd0ba32f96af4f9a6564b3b8121a597c7
2023-11-20 18:10:55 -08:00
Ramanpreet Nara 3f12c45f65 Fix CircleCI failure with cxxreactpackage (#41571)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41571

The original diff:  D51166523

## The Failure
https://app.circleci.com/pipelines/github/facebook/react-native/36821/workflows/7e360d9d-0a8e-4bf9-87d8-91c4cf3db3ca/jobs/1221118

```
CMake Error at CMakeLists.txt:28 (add_subdirectory):
    The source directory

      /root/react-native/packages/react-native/ReactAndroid/src/main/jni/react/runtime/cxxreactpackage

    does not contain a CMakeLists.txt file.
```

## The Fix
Rename CMakeList.txt to CMakeList*s*.txt

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D51481098

fbshipit-source-id: 32d71f3fdfe0c473f9b30a278603cf1153cd1df8
2023-11-20 17:33:28 -08:00
Christoph Purrer e364553492 RNTester-ios / RCTAppDelegate > correctly check for USE_HERMES Flag (#41573)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41573

Changelog: [iOS][Fixed] RNTester-ios / RCTAppDelegate > correctly check for USE_HERMES Flag

On iOS we check for ENV flags if Hermes should be used:
- https://github.com/facebook/react-native/blob/b4d4aef057ebf90176287f22d72b4b3b8b280c9a/packages/react-native/React-Core.podspec#L24
- https://github.com/facebook/react-native/blob/b4d4aef057ebf90176287f22d72b4b3b8b280c9a/packages/react-native/React/React-RCTFabric.podspec#L90

and add necessary C++ packages based on that flag.

In code we do check for those imports
https://github.com/facebook/react-native/blob/b4d4aef057ebf90176287f22d72b4b3b8b280c9a/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.h#L16-L27

and decided if we should use Hermes or not.

However the .mm check is faulty and does not check for the `RCT_USE_HERMES` flag set in code.

Reviewed By: fkgozali

Differential Revision: D51483740

fbshipit-source-id: 428c27aae80fe6f9799cf6ae21a5d3801fe6ca11
2023-11-20 16:25:46 -08:00
Nick Gerleman b4d4aef057 Fix modulemap typo (#41564)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41564

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

Fixes https://github.com/facebook/yoga/issues/1468

We build with Swift, but don't build something consuming Yoga module, and don't use modulemap and CocoaPods. This is a gap in validation we should figure out, but in the meantime, we should fix the typo.

Reviewed By: christophpurrer

Differential Revision: D51472493

fbshipit-source-id: 60e05cc49969f51d5fc4856cf25ce2afede72f36
2023-11-20 14:10:56 -08:00
Kevin Gozali c7bd397dac RNTester iOS: require arm64 device capabilities (#41551)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41551

We have since targeted iOS min SDK 13.4, it's time to move to `arm64`.

Reference: https://developer.apple.com/documentation/bundleresources/information_property_list/uirequireddevicecapabilities?language=objc

Changelog: [iOS][Fixed] Move UIRequiredDeviceCapabilities for RNTester to arm64

Reviewed By: cipolleschi

Differential Revision: D51461103

fbshipit-source-id: 726ca1f37d249092e8f10c2043d0b696bf64aa7d
2023-11-20 14:02:00 -08:00
Pieter De Baets 228193dad5 Do not suppress IllegalArgumentExceptions during TurboModule creation (#41509)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41509

We currently ignore `IllegalArgumentException` being thrown from TurboModule getters, as it was deemed acceptable to use that to signal a Package didn't have that module. This however can mask legitimate errors thrown during a TurboModule constructor.

TurboReactPackage#getModule is already marked as allowing nullable returns, so let's leave the use of exceptions for exceptional scenarios.

Changelog: [Android][Changed] Use null to signal a missing TurboModule instead of IllegalArgumentException.

Reviewed By: RSNara

Differential Revision: D51395165

fbshipit-source-id: 1eea1db6c7e3313a36d24e7837b36a3d0fccc718
2023-11-20 13:01:04 -08:00
Arushi Kesarwani e8323781fa Fix ReactInstanceManager to add getJSIModule() as an alternate path (#41495)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41495

Fix ReactInstanceManager for adding the callsite of `getJSIModule()` as an alternate path to new way of Fabric initialization in order to make Catalyst and RN-Tester work with the changes for Fabric initialization

Reviewed By: javache

Differential Revision: D51338036

fbshipit-source-id: 49badac52f1032f1032a989b76dd422e3cf7582f
2023-11-20 10:26:27 -08:00
Dmitry Rykun 6321371212 Refactor generate-artifacts-executor.js: various cleanups (#41528)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41528

This diff makes some minor cleanups in `generate-artifacts-executor.js`. Specifically:
1. remove unused argument `iosOutputDir`
2. remove unused `libraryConfig.library` property
3. Fix typo in `handleReactNativeCo`**r**`eLibraries` function name

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D51115394

fbshipit-source-id: 8ee9b5f35cf254510714a023dab32077c700e061
2023-11-20 07:30:55 -08:00
Riccardo Cipolleschi 0056fc89ff Cleanup fabricEnabled callsites (#41556)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41556

Followup after [#41500](https://github.com/facebook/react-native/pull/41500) to cleanup some callsites that does not need the flag anymore.

## Changelog
[Internal] - Callsite cleanup

Reviewed By: dmytrorykun

Differential Revision: D51465124

fbshipit-source-id: 61c0ac047f6eeb528f9a8aafd6d3f339c0399be9
2023-11-20 06:41:25 -08:00
Oskar Kwaśniewski e2d708875c fix: typo in cli.js (#41523)
Summary:
This PR fixes a typo in `cli.js`.

## 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] [FIXED] - typo in react-native/cli.js

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

Test Plan: Not needed

Reviewed By: christophpurrer

Differential Revision: D51452866

Pulled By: arushikesarwani94

fbshipit-source-id: 61f1da70621bfe1a159ec63da0014141b182c5ac
2023-11-19 22:46:36 -08:00
Ramanpreet Nara 9fd1c6872f Integrate default tmm delegate with CxxReactPackage (#41464)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41464

Now, DefaultTurboModuleManagerDelegate can be created with a CxxReactPackage.

If it exists, DefaultTurobModuleManager will use the CxxReactPackage to create C++-only turbo modules.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D51166524

fbshipit-source-id: 2fdc404e79213d685c4f41b2a152b68226bb71b2
2023-11-19 18:46:12 -08:00
Ramanpreet Nara a2558d15ab Introduce CxxReactPackage
Summary:
CxxReactPackage is supposed to be the way apps register C++-only turbo modules with React Native.

Applications are meant to subclass this jni::HybridObject.

Since this is a jni::HybridObject, applications are meant to create this CxxReactPackage in java, and initialize it with java dependencies.

React Native will reach into its c++ part, and use it create C++-only turbo modules.

NOTE: This is a **temporary** abstraction meant to unblock the stable API effort of removing the turbomodulemanagerdelegate builder from ReactHostDelegate:

https://www.internalfb.com/code/fbsource/[e7efced3018f6178b7187a2358f3b76d40e2b43c]/xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostDelegate.kt?lines=50-51

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D51166523

fbshipit-source-id: 51a22411239fbba32f3a70cc363e59947c2782dc
2023-11-19 18:46:12 -08:00
Ramanpreet Nara 1394cf7da7 Make default classes load their own so's (#41467)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41467

Make the DefaultTurboModuleManagerDelegate and the DefaultComponentRegistry load their own so's when they're created.

**Motivation:** We are going to use these two classes in Meta apps. And Meta apps will not invoke DefaultNewArchitectureEntryPoint.load.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D51036133

fbshipit-source-id: 5ebd4d3b85f435229c9b5950493310aa7fa36ba0
2023-11-19 18:46:12 -08:00
Ramanpreet Nara 66051047e0 Make default tmm delegate provide eager initialized module names (#41544)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41544

## Change
Extend DefaultTurboModuleManagerDelegate's API so that it specify which modules should be eagerly initialized.

## Rationale
This information was originally stored on the module's ReactModuleInfo object.

But, we're running an experiment (i.e: lazy mode) that gets rid of the ReactModuleInfo object. See D51093697 for more details.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D51307434

fbshipit-source-id: 6d867436588de2f9b8dd084327e74bd51ed61a2d
2023-11-19 18:46:12 -08:00
Ramanpreet Nara 90b2c3fe43 Merge ReactModuleInfo removal logic into core (#41468)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41468

Currently ReactPackageTurboModuleManagerDelegate uses ReactModuleInfos to create turbo modules. We want to see if it's possible to remove ReactModuleInfo from React Native's public API.

Therefore, we are forking the implementation of each each method inside ReactPackageTurboModuleManagerDelegate:
- **lazy mode:** doesn't use ReactModuleInfo
- **control:** uses ReactModuleInfo

This optimization was previosuly implemented outside of ReactPackageTurboModuleManagerDelegate. But, to simplify things, we are just pulling it inside the ReactPackageTurboModuleManagerDelegate.

Changelog: [Internal]

Reviewed By: philIip, mdvacca

Differential Revision: D51093697

fbshipit-source-id: 6eb11020e0bf87eb704b35b990a0f14f157eea66
2023-11-19 18:46:12 -08:00
Phillip Pan 9b1f8a81e9 hook up RCTDeprecation to [RCTBridgeModule bridge] (#41415)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41415

Changelog: [iOS][Deprecated]

an example of RCT_DEPRECATION in action. you will get a build time warning if `RCT_DEPRECATED_DECLARATIONS` is enabled.

Reviewed By: cipolleschi

Differential Revision: D51184572

fbshipit-source-id: a0bcb4c69e63620bbdf2e2a7afb25c649fcaa100
2023-11-18 22:13:40 -08:00
Phillip Pan e7500df57a RCTDeprecation cocoapods integration (#41416)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41416

Changelog: [Internal]

cocoapods boilerplate to integrate the first RCTFoundation library. decided to split this up so we can reference it easily in the future when adding new libs

Reviewed By: cipolleschi

Differential Revision: D51184321

fbshipit-source-id: 28696f0a8e43e0bcd24a37956823fb544ecd84be
2023-11-18 22:13:40 -08:00
Phillip Pan c06beaeed1 RCTDeprecation BUCK integration (#41417)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41417

Changelog: [Internal]

BUCK boilerplate to integrate the first RCTFoundation library. decided to split this up so we can reference it easily in the future when adding new libs

Reviewed By: cipolleschi

Differential Revision: D51101009

fbshipit-source-id: fe828b64c7fd939f8576a496478b6a401bfae69c
2023-11-18 22:13:40 -08:00
Phillip Pan e9ecc65652 introduce RCTFoundation (#41418)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41418

Changelog: [iOS][Added]

creating a top level directory for shared lightweight utility functions

open to suggs on naming and rules we want to enforce

Reviewed By: shwanton, christophpurrer

Differential Revision: D51170983

fbshipit-source-id: 8bc0a193b486f5a0653ad58d92a034cacede2d61
2023-11-18 22:13:40 -08:00
Phillip Pan 9af8f78d3b introduce ReactApple (#41419)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41419

Changelog: [iOS][something]

Creating a new top level directory for Apple platform specific code.

Reviewed By: christophpurrer

Differential Revision: D51170984

fbshipit-source-id: 1a453c9ae9142167afef5ac4a348c644fa6f1ab3
2023-11-18 22:13:40 -08:00
Ruslan Shestopalyuk 917fd25cbb Temporarily back out ImageLoaderModule type extraction (#41547)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41547

# Changelog:
[Internal]-

Pending figuring out why it might break backwards compatibility (which it shouldn't, in practice).

Reviewed By: GijsWeterings

Differential Revision: D51447646

fbshipit-source-id: c3a4511badc6c1346655f3a1a20050ad719b095b
2023-11-18 04:51:25 -08:00
Gijs Weterings 73411f4e08 Back out "Restore InspectorProxy tests - fix Windows by Babel-ignoring node_modules consistently"
Summary: Changelog: Internal

Reviewed By: gsathya

Differential Revision: D51447333

fbshipit-source-id: 56eb839671ca62269d59d48fd3c83df4f42a5111
2023-11-18 02:04:44 -08:00
Alexander Oprisnik 3bee205c62 Use visibility events for React image component (#41538)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41538

Changelog: [internal]

Reviewed By: rubennorte

Differential Revision: D51368688

fbshipit-source-id: 8de0d8f81c7454444c484311a37e56d9a4c35c01
2023-11-17 18:16:48 -08:00
Alex Hunt 361a944348 Remove "Open Debugger" action under JSC (#41535)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41535

## Context

**Remote JS Debugging removal**

In React Native 0.73, we have deprecated Remote JS Debugging (execution of JavaScript in a separate V8 process) and also removed the Dev Menu launcher (https://github.com/facebook/react-native/pull/36754).

## This diff

Follows D46187942 — this option wasn't correctly removed for Android when running JSC. This is now consistent with iOS.

Changelog:
[Android][Changed] "Open Debugger" is no longer available for remote JS debugging from the Dev Menu (non-Hermes). Please use `NativeDevSettings.setIsDebuggingRemotely()`.

Reviewed By: blakef

Differential Revision: D50555095

fbshipit-source-id: 1aeb48ab1390dc12ce300d6f321c30de5343cf0a
2023-11-17 15:42:59 -08:00
Ruslan Shestopalyuk f4d006a785 Optional prop for RNTesterApp to provide custom test lists (#41537)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41537

# Changelog:
[Internal] -

This allows to optionally provide a custom list of component/api test clauses into `RNTesterApp`.

Reviewed By: christophpurrer

Differential Revision: D51429407

fbshipit-source-id: 3ee35f13f6156fd055f6e0cbc788b7cf01c22b36
2023-11-17 13:10:39 -08:00
Rubén Norte ba43dd2513 Revert D51394187: delete ShadowNodeFamily::instanceHandle_
Differential Revision:
D51394187

Original commit changeset: 3add711a3954

Original Phabricator Diff: D51394187

fbshipit-source-id: 881fb82c949fef05f001fec57f62911a3a5dc482
2023-11-17 10:12:42 -08:00
Ruslan Shestopalyuk d9fa64ee3e Extract return types in NativeImageLoader specs (#41529)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41529

# Changelog:
[Internal]-

The change is equivalent in terms of API, however this makes it work nicer with C++ codegen and easier to use with a pure C++ implementation of the native module.

Reviewed By: christophpurrer

Differential Revision: D51426015

fbshipit-source-id: aae4d91bb93834e1a9c14a21417724a348de0bd7
2023-11-17 08:55:17 -08:00
Rob Hogan 59a2282b29 Restore InspectorProxy tests - fix Windows by Babel-ignoring node_modules consistently (#41526)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41526

CI failures in Windows JS tests recently (https://github.com/facebook/react-native/pull/41463) were caused by the triggering of Babel registration during tests, due to an import of `packages/dev-middleware` (index), breaking subsequent transformation of other tests.

## Root cause
Example of a problematic import:
https://github.com/facebook/react-native/blob/a5d8ea4579c630af1e4e0fe1d99ad9dc0915df86/packages/dev-middleware/src/__tests__/ServerUtils.js#L15

..which triggers a Babel registration:
https://github.com/facebook/react-native/blob/a5d8ea4579c630af1e4e0fe1d99ad9dc0915df86/packages/dev-middleware/src/index.js#L16-L18

That registration behaves differently on Windows due to the `ignore: [/\/node_modules\/\]`, which doesn't match against Windows path separators - Babel matches against system separators.

In particular, this changed whether `node_modules/flow-parser` was transformed when loading the RN Babel transformer. Transforming this file causes a `console.warn` from Babel due to its size:
> [BABEL] Note: The code generator has deoptimised the styling of /Users/robhogan/workspace/react-native/node_modules/flow-parser/flow_parser.js as it exceeds the max of 500KB.

This throws due to our setup:
https://github.com/facebook/react-native/blob/a5d8ea4579c630af1e4e0fe1d99ad9dc0915df86/packages/react-native/jest/local-setup.js#L27

This all manifests as the first test following a Babel registration (within the same Jest worker) that requires the RN Babel transformer throwing during script transformation.

## This change
This is the minimally disruptive change that makes Babel registration behaviour consistent between Windows and other platforms. The more durable solution here would be *not* to rely on any Babel registration for Jest, which has its own `ScriptTransformer` mechanism for running code from source. Given the fragile way our internal+OSS Babel set up hangs together that's a higher-risk change, so I'll follow up separately.

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D51424802

fbshipit-source-id: 8b733c0c159ee84690aef04abced682d126c6d27
2023-11-17 08:53:14 -08:00
Rubén Norte 5e7be7e3ab Add experimental global callback for attached images (#41525)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41525

This creates an experimental mechanism to get notifications when image instances are created anywhere in the app.

This can be useful to set up things like image performance tracking automatically without having to use a custom component and manually access refs from image components.

Changelog: [internal]

Reviewed By: oprisnik

Differential Revision: D49962063

fbshipit-source-id: b991a808aaa723bea98c27812892cfa468f025a6
2023-11-17 08:23:11 -08:00
zhongwuzw 02bb50d9ce Fix assert cxx example crash the app when tap Run all tests (#41521)
Summary:
When I tap the `Run all tests` button in CxxModuleExample, App crashed because our `assert` examples directoly.
![image](https://github.com/facebook/react-native/assets/5061845/6d3fbbc1-9d41-419a-9074-898e839ee51a)
I moved the error report examples to individual section so `Run all tests` not crash.
![image](https://github.com/facebook/react-native/assets/5061845/4b781b40-0606-4d40-a752-1cd716073e33)

## Changelog:
[INTERNAL] [FIXED] - [RN-Tester] Fix assert cxx example crash the app when tap `Run all tests`

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

Test Plan: None.

Reviewed By: christophpurrer

Differential Revision: D51423538

Pulled By: rshest

fbshipit-source-id: 1e2844aa9011de4476ec4b134d43daa3260a73d5
2023-11-17 06:10:00 -08:00
Riccardo Cipolleschi 1204696f08 Defragment Codegen in OSS between Old and New Architecture (#41500)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41500

Right now, the old architecture uses Codegen in a slightly different way w.r.t. the New Architecture.
In the Old Architecture, codegen is used to generate some basic TM and components that are part of Core.

Both architectures use the same scripts that actually generates the code, but they are invoked differently.

This is causing some maintenance costs that we would like to reduce.

## Changelog:
[Internal] - Defragment how Codegen is run between old and new architecture

Reviewed By: dmytrorykun

Differential Revision: D51349874

fbshipit-source-id: 188d3ed436a30a77bd42a26306d4a08666d3a00b
2023-11-17 04:17:58 -08:00