Commit Graph

38536 Commits

Author SHA1 Message Date
Marco Caldera 320e51f4c4 Unify findComponentConfig return statement (#36446)
Summary:
> [Codegen 100] Create a createComponentConfig function in the parser-commons.js file. It takes the foundConfig and the commandTypeNames as parameters and returns the component config object. Extract the return statements ([Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/components/index.js#L115-L126) [TS](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/components/index.js#L116-L127)) and use those implementations in that function.

Part of Issue https://github.com/facebook/react-native/issues/34872

In case I should already add better typing I can update the PR while clarifying the type definitions.

## Changelog

[INTERNAL] [CHANGED] - Move the return statement of `findComponentConfig` to `parsers-commons.js` merging Flow and TS implementation.

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

Test Plan: `yarn lint && yarn run flow && yarn test react-native-codegen`

Reviewed By: cortinico

Differential Revision: D44005899

Pulled By: rshest

fbshipit-source-id: 19a4a05476156cbc2d824c9c32a7909c06a382ff
2023-03-14 05:30:39 -07:00
Ruslan Shestopalyuk dc7941d732 Shim implementation for NativePerformance on JS side
Summary:
Changelog: [Internal]

Implements a shim for the NativePerformance TurboModule, which can be used as a mock to unit test the JS side of WebPerformance functionality (in particular, the higher level API logic of `Performance` and `PerformanceObserver` implementations in JS) without need to have the native NativePerformance implementation available (which would otherwise require running some heavy weight e2e tests).

Reviewed By: rubennorte

Differential Revision: D43985454

fbshipit-source-id: da10387c1d70cb0300c077972d3925bc2fad4f5e
2023-03-14 04:48:02 -07:00
Rubén Norte 803bb16531 Prepare for next React Native sync with new instance format (#36438)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36438

This makes the `react-native` repository compatible with the next sync from react after the changes in https://github.com/facebook/react/pull/26321 land.

That PR is changing the format of the Fabric instance and we have a few instances where we assume the internal structure of that instance in the repository.

Changelog: [internal]

Reviewed By: yungsters

Differential Revision: D43980374

fbshipit-source-id: 718b504ff7c5bb6088c553e0256489b04d92b653
2023-03-13 05:47:18 -07:00
Rubén Norte 4ffe69db10 Improve type definition for FabricUIManager
Summary:
This migrates FabricUIManager to Flow strict.

Changelog: [internal]

Reviewed By: yungsters

Differential Revision: D43773032

fbshipit-source-id: 45484f9b710d8de92bbfa6b58ced4209afee437e
2023-03-13 05:47:18 -07:00
Riccardo Cipolleschi 348a99a7c8 Fix CircleCI removing lambda in Java (#36458)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36458

Our CircleCI infra does not support lambda yet.
Over the weekend, a stack of multiple Android changes landed and one of those diff had a lambda that was not fixed. See this [workflow](https://app.circleci.com/pipelines/github/facebook/react-native/20276/workflows/e73bf98e-12e0-47e3-8bff-a42f6c40798e/jobs/474761).

After the lambda was fixed, another issue related to the `reactApplicationContext` being accessed from an inner class without being `final` [occurred](https://app.circleci.com/pipelines/github/facebook/react-native/20286/workflows/70dab2f0-ee71-4510-8611-c5d29ea4cfae/jobs/475379).

This change should fix these problems.

## Changelog
[Android][Fixed] - Make CircleCI green

Reviewed By: cortinico

Differential Revision: D44019871

fbshipit-source-id: 1a6e39446b0ba2f5a395f54b58a70b67590ee154
2023-03-13 04:59:22 -07:00
Ramanpreet Nara cfa03db98b Refactor: In JavaTurboModule, use jobject to hold module object
Summary:
## Rationale
JavaTurboModule holds the module object as a JTurboModule. With the TurboModule inteorp layer, JavaTurboModule will also need to hold NativeModule objects.

## Changes
So, this diff makes JavaTurboModule hold the module object as a jobject instead.

This shouldn't impact method dispatch, because method dispatch doesn't rely on the JTurboModule interface.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D43918939

fbshipit-source-id: 7cc43dfe2df7571e39bcf4d6f362dde0e500e2fe
2023-03-11 16:59:39 -08:00
Ramanpreet Nara 43ef2ffe78 Refactor: Move HostFunction management logic to TurboModule::get()
Summary:
## Rationale
Better separation of concerns. Less confusion. All the logic around TurboModule HostFunction management is in TurboModule::get(). And TurboModule::createHostFunction() is only responsible for creating the HostFunction. Also, there aren't two TurboModule::get functions, each with different/unclear responsibilities.

## Motivation
The interop layer (i.e: D43918998) will have to override TurboModule::createHostFunction():
- TurboModule::createHostFunction() relies on static functions for method dispatch.
- The interop layer cannot use static functions for method dispatch: interop modules' methods are only be discoverable at runtime.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D43918940

fbshipit-source-id: f2ffd210329a10967e9b2f0c925f4990cb470083
2023-03-11 16:59:39 -08:00
Ramanpreet Nara cb18bf8c09 Refactor: Make getOrCreateModule() return NativeModule
Summary:
TurboModuleManager.getOrCreateModule() is responsible for creating TurboModules.

In the future, we'll need this method to create interop NativeModules (i.e: NativeModules that don't implement TurboModule). So, this diff changes the implementation of the method to create NativeModule objects.

In the future, we'll extend the TurboModule create algorithm to create legacy NativeModules, by integrating with TurboModuleManager.getLegacyModule(): D43751055

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D43801536

fbshipit-source-id: d86ef915248d40bea56c6103796a37dd7fb5992a
2023-03-11 16:59:39 -08:00
Ramanpreet Nara 6b42b86620 Refactor: Rename TurboModule create method to getOrCreateModule()
Summary:
Readability.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D43801530

fbshipit-source-id: c33ac91af4614804c5b6566776a1650d4f7855f4
2023-03-11 16:59:39 -08:00
Ramanpreet Nara c1c17e299e Refactor: Make ModuleHolder hold NativeModules vs TurboModules
Summary:
We'll re-use the ModuleHolder inside TurboModuleManager to cache legacy NativeModules (i.e: NativeModules that don't implement TurboModule).

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D43801533

fbshipit-source-id: 160c6be06fe148595de89770ed78f51248fcda37
2023-03-11 16:59:39 -08:00
Ramanpreet Nara c338ae64e7 Refactor: Rename TurboModuleProvider -> ModuleProvider<T>
Summary:
In the future, we'll re-use this interface to create NativeModule objects as well.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D43801529

fbshipit-source-id: 90376086744dc996274663792289e3eba7be56c1
2023-03-11 16:59:39 -08:00
Ramanpreet Nara 1b73d1142c Refactor: Rename mTurboModuleCleanupStarted -> mModuleCleanupStarted
Summary:
- Right now, in the TurboModuleManager, "module" refers to TurboModules.
- In the future, we'll use this cleanup lock for interop modules as well (i.e: NativeModules that don't conform to TurboModule).

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D43801535

fbshipit-source-id: cecccf8d0005ef11bb0c864515fd284292582e64
2023-03-11 16:59:39 -08:00
Ramanpreet Nara 842800f83c Refactor: Rename mTurboModuleCleanupLock to mModuleCleanupLock
Summary:
- Right now, in the TurboModuleManager, "module" refers to TurboModules.
- In the future, we'll use this cleanup lock for interop modules as well (i.e: NativeModules that don't conform to TurboModule).

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D43801534

fbshipit-source-id: 1ece9faa1ed564b7024098406deaa60b8a904478
2023-03-11 16:59:39 -08:00
Ramanpreet Nara b6b28d084d Refactor: Rename TurboModuleHolder -> ModuleHolder
Summary:
- Right now, in the TurboModuleManager, "module" refers to TurboModules.
- In the future, we'll use this cleanup lock for interop modules as well (i.e: NativeModules that don't conform to TurboModule).

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D43784169

fbshipit-source-id: dca227374e8d7de319f4fd5556d200ba8b9ac77c
2023-03-11 16:59:39 -08:00
Ramanpreet Nara 5a5aa30f70 Add todo: Output validation log when ReactInstancePackages are detected
Summary:
The New Architecture Validation logging should output an error whenever ReactInstancePackages are used. These packages get access to the ReactInstanceManager, which isn't available in Bridgeless mode.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D43255702

fbshipit-source-id: 1df8c2941805bb773a127408fbf7871674b0cb7c
2023-03-11 16:59:39 -08:00
Ramanpreet Nara a09a6d4d44 Add ReactPackage support to TurboModule system
Summary:
Make the TurboModule system understand ReactPackages.

**Note:** The TurboModule system can only create TurboModules in LazyReactPackages.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D43255701

fbshipit-source-id: 74d034732d0a6fb32197b15bb54cac9161abc294
2023-03-11 16:59:39 -08:00
Ramanpreet Nara 1c5ba299b3 Add LazyReactPackage support to TurboModule system
Summary:
Make the TurboModule system understand LazyReactPackages.

**Note:** The TurboModule system can only create TurboModules in LazyReactPackages.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D43254982

fbshipit-source-id: 4260cc7dc1d28b1ad6268087720c6e02cfc20d32
2023-03-11 16:59:39 -08:00
Ramanpreet Nara 5097763f53 Refactor: Make RPTMMD generic to all ReactPackages
Summary:
## Problem
The TurboModule system can only create modules in TurboReactPackages. We want to change this. The TurboModule system should integrate with all of React Native's ReactPackages.

## Changes
ReactPackageTurboModuleManagerDelegate integrates the TurboModule system with React Native's ReactPackage infra.

This diff refactors ReactPackageTurboModuleManagerDelegate, so that it can eventually support many different types of ReactPackages.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D43066961

fbshipit-source-id: d793e14353382dc4cf9ea4af5a7ffe5c83e3baf6
2023-03-11 16:59:39 -08:00
Ramanpreet Nara 355e7c4c76 Create a feature flag for the TurboModule interop layer
Summary:
The TurboModule interop layer is a new mode for the TurboModule system.

Goal: Make the TurboModule system incrementally adoptable in **Bridgeless mode.**

What it does: Run all legacy modules through the TurboModule system in Bridgeless mode.

How to enable it:
1. Enable Bridgeless Mode: ReactFeatureFlags.enableBridgelessArchitecture = true.
2. Set ReactFeatureFlags.useTurboModuleInterop = true.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D43715758

fbshipit-source-id: 89470a28d1f37b9010beb84e43f62425473de8b5
2023-03-11 16:59:39 -08:00
Ruslan Shestopalyuk 48c7adc3bf Logging in GlobalPerformanceLogger via WebPerformance API (#36402)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36402

## Changelog:

[Internal] -

Makes `GlobalPerformanceLogger` (`IPerformanceLogger` API), additionally use the native WebPerformance implementation (`Performance` and `PerformanceObserver` APIs) to log points/timespans as marks/measures correspondingly.

This will ultimately help to converge performance logging facilities across platforms and language boundaries.

In a shorter term, it can serve as a good case study of using the Web Performance API implementation.

Note that this implementation is disabled by default (controlled by the RN feature flag), and will be enabled separately via na experiment.

Reviewed By: rubennorte

Differential Revision: D43873560

fbshipit-source-id: 22e2d787c8f22d2f67556dfe4bf175743eca2caf
2023-03-10 12:37:51 -08:00
Tarun Chauhan 3cd97e4994 extract buildModuleSchema to parsers-commons (#36330)
Summary:
> Extract the buildModuleSchema function ([Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/modules/index.js#L571), [TypeScript](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/modules/index.js#L584))in the parsers-commons.js function. The two functions are almost identical except for the filter(property =>) at the end of the function, which is different based on the language.

Part of Codegen Issue https://github.com/facebook/react-native/issues/34872
Depends on Codegen 74, Codegen 84.

## 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] - Extract buildModuleSchema from Flow and TypeScript parsers modules to parsers-commons

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

Test Plan:
`yarn lint && yarn run flow && yarn test react-native-codegen
`

Reviewed By: christophpurrer

Differential Revision: D43833653

Pulled By: cipolleschi

fbshipit-source-id: 4d67cb5ef746ecd7ace4b91eb30d36e96252e779
2023-03-10 07:58:32 -08:00
Lulu Wu e68f513879 Fix circleCI failure
Summary:
Fix circle CI failure, error:
```
stderr: : warning: unknown enum constant androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX

: warning: unknown enum constant kotlin.annotations.jvm.MigrationStatus.STRICT

  reason: class file for kotlin.annotations.jvm.MigrationStatus not found
/root/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java:105: error: local variable launchOptions is accessed from within inner class; needs to be declared final
            return ReactActivityDelegate.this.createRootView(launchOptions);
                                                             ^
/root/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java👎 note: Some input files use or override a deprecated API.

/root/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java👎 note: Recompile with -Xlint:deprecation for details.

/root/react-native/ReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.java👎 note: Some input files use unchecked or unsafe operations.

/root/react-native/ReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.java👎 note: Recompile with -Xlint:unchecked for details.

Errors: 1. Warnings: 2.

```
https://app.circleci.com/pipelines/github/facebook/react-native/20239/workflows/31711cb5-6603-432e-a869-d76c9391536e/jobs/473257?invite=true#step-107-261

Changelog:
[Android][Changed] - Fix circle CI failure

Reviewed By: cipolleschi

Differential Revision: D43976548

fbshipit-source-id: 2d50d37bbc78cb1264af9d6fffbfe60f24326cec
2023-03-10 05:40:24 -08:00
Riccardo Cipolleschi a5866ca3aa Add Fabric Interop constants example (#36417)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36417

This changes adds an example to RNTester to verify that the Interop Layer can process constants in Fabric as it used to do in Paper.

## Changelog:
[iOS][Added] - Add example in the Interop Layer to use constants

Reviewed By: cortinico

Differential Revision: D43911916

fbshipit-source-id: 1d4b630d45d21904c53d85b97607ebb7fb8a62fc
2023-03-10 04:52:44 -08:00
Riccardo Cipolleschi c005830958 Add Fabric Interop event example
Summary:
This changes adds an example to RNTester to verify that the Interop Layer can process bubbling events in Fabric as it used to do in Paper.

## Changelog:
[iOS][Added] - Add example in the Interop Layer to use events

Reviewed By: sammy-SC

Differential Revision: D43911390

fbshipit-source-id: ae75db25078669676e5a609e090f1e9674026391
2023-03-10 04:52:44 -08:00
Lulu Wu e26092aec3 Enable Venice
Summary:
Make Venice available in Catalyst Android, to enable set ```ReactFeatureFlags.enableBridgelessArchitecture``` to true in CatalystApplication.java

**Note**: right now not every piece works with Venice enabled, but the main functionalities (Fabric components, playground) mostly work, the rest issues will be gradually fixed.

Changelog:
[Internal][Changed] - Enable Venice in Catalyst Android

Reviewed By: NickGerleman

Differential Revision: D43711737

fbshipit-source-id: 6ecb7e2b09c5b7feaa00b90076a2a894c08affc9
2023-03-09 15:10:00 -08:00
Lulu Wu ad7bf51b7b Reland "[Catalyst][Android] Migrate packages to not eager initialize view managers"
Summary:
The original diff D43711708 was reverted due to a problem caused on Ads Manager App Android. Re-land while make sure Ads Manager not broken.

Changelog:
[Android][Changed] - Re-land "Migrate packages to not eager initialize view managers"

Reviewed By: RSNara

Differential Revision: D43907600

fbshipit-source-id: 92f99fd3f9ba90d1798d4ec9c03feff00070a47c
2023-03-09 15:10:00 -08:00
Sam Zhou af86b4a56f Remove inference_mode config now that LTI is the default
Summary: Changelog: [Internal]

Reviewed By: mroch

Differential Revision: D43850503

fbshipit-source-id: d95206ad63ec034aab0edad55cd77e5f85deadc9
2023-03-09 11:01:31 -08:00
Ruslan Lesiutin 8d8b44a5e3 Add option to commit with generic message (#36421)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36421

Changelog: [Internal]

Adding an extra choice for commit question, user can now choose between three options:
1. Commit with generic message, no further actions needed
2. Commit with custom message, intercative VIM input will open
3. Not committing anything

Reviewed By: cortinico

Differential Revision: D43943526

fbshipit-source-id: 014215105d192961486b7d1c697f491697492812
2023-03-09 09:19:17 -08:00
Riccardo Cipolleschi 50068d0070 Improve robustness of iOS CircleCI Pipelines (#36419)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36419

After migrating to Xcode 14.2.0, some contributors were receiving CircleCI Machines that were not able to install Ruby 3.2.0.

This change should improve the robustness of the pipelines, ensuring that `ruby-build` can always find the version of Ruby it needs

## Changelog:
[internal] - Make sure CircleCI always find the right version of Ruby

Reviewed By: cortinico

Differential Revision: D43944878

fbshipit-source-id: 89d9fcc6ae346003e96c2a8f4103a83a7d2f3204
2023-03-09 08:40:05 -08:00
Xin Chen 0018a695da Refactor startup performance API implementation
Summary:
Refactor the startup performance API so that we are not using a vector to store only a few startup metrics values. This makes the metrics more strictly typed and concise.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D43860049

fbshipit-source-id: 2c2102de2b64e2c5cda509ac26f0d1d072287083
2023-03-09 08:34:58 -08:00
Lorenzo Sciandra bcec590071 add 0.71.4 changelog (#36405)
Summary:
Adds changelog for new patch.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[Internal] [Changed] - add changelog entry for 0.71.4

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

Test Plan: N/A

Reviewed By: christophpurrer

Differential Revision: D43910075

Pulled By: cipolleschi

fbshipit-source-id: 4f0b7fb45c07895dbddedd08553b84460043c948
2023-03-09 01:27:43 -08:00
Nick Gerleman c376e78224 Delete refs to unmounted CellRenderers
Summary:
VirtualizedList today will keep refs to cells around, long after they have been unmounted. This leaks memory, and is not needed.

Changelog:
[General][Fixed] - Delete refs to unmounted CellRenderers

Reviewed By: yungsters

Differential Revision: D43835135

fbshipit-source-id: 2104cae977a4e2e9e1a2738e1523ac1796293b4f
2023-03-08 18:59:13 -08:00
Nicola Corti 5ac7c7f9a5 RNGP - Add librrc_legacyviewmanagerinterop to pickfirst config block
Summary:
This adds `librrc_legacyviewmanagerinterop.so` to the pickFirst block inside RNGP.
While testing the Fabric Interop layer, I realized that I forgot to add it here and now the build
fires a warning as follows:

```
> Task :app:mergeDebugNativeLibs
2 files found for path 'lib/arm64-v8a/librrc_legacyviewmanagerinterop.so'. This version of the Android Gradle Plugin chooses the file from the app or dynamic-feature module, but this can cause unexpected behavior or errors at runtime. Future versions of the Android Gradle Plugin may throw an error in this case.
Inputs:
 - /private/tmp/RNNightly/android/app/build/intermediates/cxx/Debug/194810a4/obj/arm64-v8a/librrc_legacyviewmanagerinterop.so
 - /Users/ncor/.gradle/caches/transforms-3/ba1c1d3560a64e70d8218910c5a43605/transformed/jetified-react-android-0.0.0-20230302-2110-caf80d442-SNAPSHOT-debug/jni/arm64-v8a/librrc_legacyviewmanagerinterop.so
```

Changelog:
[Internal] [Changed] - RNGP - Add librrc_legacyviewmanagerinterop to pickfirst config block

Reviewed By: cipolleschi

Differential Revision: D43772845

fbshipit-source-id: cf34bb128b76f18e802a94c41c773f7cb2b7ec4a
2023-03-08 15:08:15 -08:00
Nick Gerleman a37163f21b Allow RNTester Jest E2E Examples to Run in Paper + Catalyst
Reviewed By: rshest

Differential Revision: D43718044

fbshipit-source-id: baee21db05100e8ef113fb70aac6dc83828d829f
2023-03-08 14:58:36 -08:00
Nick Gerleman 3f54d95e12 Wrap ReactNativeCoreE2E Surface in ScrollView
Summary:
Faacebook:
For both Paper and Fabric, at least on Android, RNTester TextInputs using the default style render as collapsed. This seems to be an interaction between the TextInputs being set as `flex: 1`, and being rooted in a ScrollView.

The issue still seems to happen when the outer container is large enough, but non-scrolling, which seems like a layout bug. But we can for now root the E2E container in a ScrollView (which we probably want to do anyway to allow long examples).

Changelog:
[Internal]

Reviewed By: mdvacca

Differential Revision: D43714494

fbshipit-source-id: ef1f8929ceeaef0d2c87262cf0446e0c6644cc9d
2023-03-08 14:58:36 -08:00
Samuel Susla d41e95fb1a Cache NSTextStorage
Summary:
changelog: [internal]

This diff introduces a mechanism to cache NSTextStorage on Paragraph's state. The old renderer already has caching for NSTextStorage: https://github.com/facebook/react-native/blob/main/Libraries/Text/Text/RCTTextShadowView.m#L21

Fabric will store `NSTextStorage` inside `ParagraphLayoutManager` which is owned by state.

There is one notable change which is not gated: Paragraph's state strongly owns `TextLayoutManager`, not `ParagraphShadowNode` like previously. This shouldn't change anything

Reviewed By: mdvacca

Differential Revision: D43692171

fbshipit-source-id: efe6077222a30ab6d89abd9916534b9a96e745d4
2023-03-08 08:36:08 -08:00
Saad Najmi a5bc6f0574 Remove assumptions on super's description (#36374)
Summary:
This is a change upstreamed from our fork, React Native macOS: https://github.com/microsoft/react-native-macos/pull/1088

Original description:

>We hit some crashes where replacing the chars in the string in the description was happening at an invalid range. That caused investigation into what these description methods are doing. We shouldn't have code assuming super's description will return in a certain format. Instead, just append any additional info we want to add to the end of the description.

## Changelog

[IOS] [CHANGED] -Remove assumptions on super's description

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

Test Plan: CI should pass

Reviewed By: cipolleschi

Differential Revision: D43906367

Pulled By: javache

fbshipit-source-id: f83a67c5890ad1f8a73bc644be1f0f8b22b1a371
2023-03-08 07:41:07 -08:00
Pieter De Baets 06e55ec5ea Avoid double glog init internally
Summary:
glog logging was being sent to adb logcat twice since `fbgloginit` uses `force_static = True` and was being linked as two separate copies.

Changelog: [Internal]

Reviewed By: sshic

Differential Revision: D43842295

fbshipit-source-id: da4233d29dbddc2b3cefdca979c873479672b11c
2023-03-08 05:38:55 -08:00
Riccardo Cipolleschi d72697ca95 Prepare to break the Dependency Cycle between React-graphics and React-Fabric (#36385)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36385

This change moves the `graphics/conversions.h` files from `ReactCommon/react/renderer/graphics` to `ReactCommon/react/renderer/core`, renaming it to `graphicsConversions.h`.

This is required because React-Fabric imports graphics, but graphics imports React-Fabric due to this file.

The change would be breaking, but we don't want to break the ecosystem without even a warning. So, we put back the `conversions.h` file, which now just `include` the new one and outputs a warning when building. This actually maintain the dep cycle for the current version, but at least users are warned.

## Changelog:
[iOS][Deprecated] - Deprecate the `ReactCommon/react/renderer/graphics/conversions.h` in favor of `ReactCommon/react/core/graphicsConversions.h`

Reviewed By: cortinico, dmytrorykun

Differential Revision: D43836261

fbshipit-source-id: ffe53a8ce2b0ea2dd1e1e5aaf6b3d3c5b57ad46d
2023-03-08 03:59:55 -08:00
Riccardo Cipolleschi a055e07c3e Use the new CLI properties for codegen the legacy components
Summary:
This change updates the way in which we consume the list of components from the `react-native.config.js` files so that it is aligned to what Android does.

## Changelog:
[iOS][Changed] - Update how the `react-native.config.js` is consumed to add elements in the interop layer.

Reviewed By: cortinico

Differential Revision: D43875395

fbshipit-source-id: e359c98a9144f4efe62967096d48318491718958
2023-03-08 02:28:32 -08:00
Nick Gerleman 7858a2147f Enforce compatibility with exactOptionalPropertyTypes (#36345)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36345

`exactOptionalPropertyTypes` is a TypeScript 4.4+ option set by users which changes behavior of optional properties, to disable accepting explicit `undefined`.

This is not enabled when using `--strict`, and is stricter than Flow, leading to most of the typings having an `| undefined` unique to TypeScript (added with https://github.com/DefinitelyTyped/DefinitelyTyped/commit/694c663a9486dbe7794d5eb894a691ee9ded318a).

We have not always followed this (I have myself previously assumed the two are equivalent). We can enforce that the convention is followed with a plugin `eslint-plugin-redundant-undefined`. This forces us to declare that every optional property accepts an explicit undefined (which Flow would allow). Alternatively, if we do not want to support this, we can enable the existing dtslint rule `no-redundant-undefined`.

Changelog:
[General][Fixed] - Enforce compatibility with `exactOptionalPropertyTypes`

Reviewed By: lunaleaps

Differential Revision: D43700862

fbshipit-source-id: 996094762b28918177521a9471d868ba87f0f263
2023-03-08 00:14:56 -08:00
Xin Chen f4e56fdf19 Refactor performance memory API implementation
Summary:
This diff refactors performance memory API and the RN Tester example.

- The returned value from C++ is number, so no need to cast
- Reuse `MemoryInfo` in RNTester example

Changelog:
[General][Internal] - Code refactor for performance memory API implementation

Reviewed By: rubennorte

Differential Revision: D43523878

fbshipit-source-id: 37d1f6a829a8eac45f7e3791ad36be0c199c6041
2023-03-07 18:32:20 -08:00
Genki Kondo 96659f8e83 Fix overflowInset to take into account hitSlop
Summary:
Previously, the touch area could never extend past the parent view bounds. Thus, hitSlop would not have any effect if it extended beyond any ancestor view's view bounds.

In this diff, we apply hitSlop when calculating overflowInset. Specifically, we make sure to union the hit slop areas of all children when calculating the contentFrame.

overflowInset is then used for hit testing (as in [TouchTargetHelper.java](https://www.internalfb.com/code/fbsource/[b0f630bb24271d8ed543e98ff144590290e19805]/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/uimanager/TouchTargetHelper.java?lines=195)).

A risk is that other optimizations that may potentially rely on overflowInset beyond hit testing (such as clipToBounds) may not be as efficient with a large hitSlop.

Changelog:
[General][Fixed] - Fix touch handling so that hitSlop can extend beyond parent view bounds.

Reviewed By: javache

Differential Revision: D43854774

fbshipit-source-id: 160bef135b8487c28c4ada662577c35a7a36f484
2023-03-07 12:30:14 -08:00
Riccardo Cipolleschi f264fe12df Bump Xcode to 14.2.0 in circleCI (#36388)
Summary:
In CricleCI we are still using Xcode 14.0.1.
This version will be removed from CircleCI this Thursday, so we have to update it.

## Changelog
[Internal] - Bump xcode in CircleCI to 14.2.0

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

Test Plan: CircleCI should be Green

Reviewed By: dmytrorykun

Differential Revision: D43873750

Pulled By: cipolleschi

fbshipit-source-id: 8b796c0961647fce103d2659036bf5f9037fe90a
2023-03-07 08:45:22 -08:00
Pieter De Baets 3a06cca9dc Add feature flag to use JSI NativeState instead of HostObject (#36395)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36395

NativeState is a lighter-weight alternative to HostObject, which may simplify some of our use-cases of interacting with JS in the renderer. The down-side is that this approach doesn't allow exposing custom props or functions.

This diffs adds new feature flags to enable experimenting with this functionality and measure any perf impact.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D41553421

fbshipit-source-id: 3065bd7b60f0fa7b63c390e92a785582eee7e613
2023-03-07 08:11:02 -08:00
Ryan Schoppmeyer 4a925c43c2 Support HermesAPILeanOrFull in react native apps (#36202)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36202

This changes all of the in-built dependencies in react native app components upon hermes from HermesAPI to HermesAPIFullOrLean.

HermesAPI (full) includes the bytecode compiler and thus has support for eval().
HermesAPILean does not include the bytecode compiler. It throws at runtime if eval is called. The native dependencies are significantly smaller without the bytecode compiler.

The HermesAPIFullOrLean target toggles between full and lean modes based on the value of buckconfig field `hermes.lean_vm` (default is false). Therefore, without overriding this config option, this change is a no-op and should result in react native apps being built with exactly the same dependencies as before.

If you do specify it, you lose eval support at runtime and gain an apk size savings of a few hundred kB after compression.

This also removes the vestigial `hermes_api_dep()` build macro.

skip-frl-buck-targeting

Reviewed By: javache

Differential Revision: D43283200

fbshipit-source-id: 0157be4a9339f70e73d29d694c18b31805107000
2023-03-07 06:33:14 -08:00
Pieter De Baets 419025df22 Remove unused LongLivedObject include (#36391)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36391

This include isn't required and was causing issues in the Cocoapods build.

Changelog: [iOS][Fixed] Unbreak cocoapods build

Reviewed By: cipolleschi

Differential Revision: D43870523

fbshipit-source-id: 7e31049d19ef025e9e16284712fb2a80dbdf235e
2023-03-07 04:43:37 -08:00
Janic Duplessis 59c4db85fb Add fabric support for maintainVisibleContentPosition on iOS (#36095)
Summary:
Reland of https://github.com/facebook/react-native/issues/35319 with a fix for custom pull to refresh components.

Custom pull to refresh component in fabric will need to conform to the `RCTCustomPullToRefreshViewProtocol` protocol, this way we know that the view is a pull to refresh and not the content view.

## Changelog

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

Pick one each for the category and type tags:

[IOS] [ADDED] - Add fabric support for maintainVisibleContentPosition on iOS

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

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

Test Plan:
This will need to be tested internally in the product the crash happened.

Take a local build of Wilde open Marketplace.

Reviewed By: jacdebug

Differential Revision: D43128163

Pulled By: cipolleschi

fbshipit-source-id: 6cf8ddff92aeb446072a3d847434e21b9e38af61
2023-03-07 04:20:31 -08:00
MaeIg a448c6d80f Extract the functions to compute partial properties in the Flow and TypeScript parsers. (#36373)
Summary:
This PR aims to extract  the switch(configType) block from the buildSchema function into a separate function in a shared file between typescript and flow. It is a task of https://github.com/facebook/react-native/issues/34872:
> [Codegen 77 - assigned to MaeIg] Extract the functions to compute partial properties from the index.js file ([Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/modules/index.js#L180-L194) and [TypeScript](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/modules/index.js#L261-L278))in the Flow and TypeScript parsers.

## 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] - Extract the functions to compute partial properties in the Flow and TypeScript parsers.

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

Test Plan:
yarn flow:
<img width="560" alt="image" src="https://user-images.githubusercontent.com/40902940/222934040-97e88691-c1d6-44a1-b7ee-e500b4698cd2.png">

yarn lint:
<img width="509" alt="image" src="https://user-images.githubusercontent.com/40902940/222934137-05b6f1fd-a755-4323-baac-5954d36fd613.png">

yarn test
<img width="388" alt="image" src="https://user-images.githubusercontent.com/40902940/222934145-76a2bc38-7469-4c30-9301-bc21cfadded4.png">

Reviewed By: cipolleschi

Differential Revision: D43867937

Pulled By: rshest

fbshipit-source-id: f78fe399ff7d7d2cf8f44d1165418566b0a25628
2023-03-07 03:15:52 -08:00
Pieter De Baets b73dd6726d Use WeakObject for new turbomodule binding mechanism
Summary:
A previous version of this experiment saw crashes on iOS once rolled out. Switching to WeakObject to make sure we're not accessing invalid references, and setting up the ability to experiment with this on iOS.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D41552667

fbshipit-source-id: dc0c54edc2ad18c1947941119ffd50038a47c5f6
2023-03-07 01:17:44 -08:00