Commit Graph
31547 Commits
Author SHA1 Message Date
aleqsioandFacebook GitHub Bot 00b366159d Hotfix privacy manifest aggregation script (#44390)
Summary:
As pointed out by liamjones here:
https://github.com/facebook/react-native/pull/44214#discussion_r1587755403

The original PR did introduce a bug in the `find/first` check, but in my testing, we do need to look at `group.name`, so let's make sure we check both.

This also makes it play nice with an existing file even if it is added to a different directory, by appending to it instead of forcing it to exist in the main group.

## Changelog:

[IOS] [FIXED] - Fix privacy aggregation

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

Test Plan: Tested on rn-tester

Reviewed By: cipolleschi

Differential Revision: D56893594

Pulled By: philIip

fbshipit-source-id: b92589bc2bed9d07e9af20c56a8b9f6c61d864f0
2024-05-02 11:40:07 -07:00
George ZaharievandFacebook GitHub Bot 55dc853d07 Update hermes-parser and related packages in fbsource to 0.21.0
Summary:
Bump hermes-parser and related packages to [0.21.0](https://github.com/facebook/hermes/blob/main/tools/hermes-parser/js/CHANGELOG.md).

Changelog: [internal]

Reviewed By: pieterv

Differential Revision: D56857738

fbshipit-source-id: 6027f529df8a5e1e3cf3b2d383f399f9e1050e96
2024-05-02 10:30:44 -07:00
Alex HuntandFacebook GitHub Bot 185f63b0db Add experiment to configure internal debugger branding (#44388)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44388

Towards the open source rollout of the `rn_fusebox.ts` entry point.

NOTE: Requires https://github.com/facebookexperimental/rn-chrome-devtools-frontend/pull/59, but can (and should) be landed safely beforehand.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D56883040

fbshipit-source-id: acee5d53c0f93ef9dc2d498001291b1e35237824
2024-05-02 09:15:30 -07:00
Alex HuntandFacebook GitHub Bot 817f610983 Update debugger-frontend from 24b0c81...141c8c93
Summary:
This is a major sync, featuring our recent rebase of `chromium/6344`.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D56884975

fbshipit-source-id: bc91f66bfc92464ab8fa99893ab0181077041b79
2024-05-02 09:15:24 -07:00
Blake FriedmanandFacebook GitHub Bot b38f80aeb6 update shared build to strip Babel wrapper (#44339)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44339

We require the wrapper code for in repository calls to these packages directly from node (i.e. using CommonJS).  This wrapper code typically sits at the entrypoint of the build packages (i.e. `index.js`).

NOTE: This unblocks an issue preventing me from landing further work on the `helloworld` cli replacing the community template.

## Problem:
The [flow-api-translator](https://www.npmjs.com/package/flow-api-translator) library doesn't allow CommonJS `module.exports` when generating TypeScript Type Defintions.

## Change
1. At the built time, this strips out our wrapper code and sets up the dist/ folder appropriately for npm distribution.
2. Updated the `package.json` files to consistently share Flow types

Changelog: [Internal] refactor build packages output to remove wrapper.

NOTE: Added better error messages when users deviated from the current pattern:
{F1501571608}

Reviewed By: huntie

Differential Revision: D56762162

fbshipit-source-id: f110b31e4ad780998dbc81a2482891ac8d8c6458
2024-05-02 04:00:21 -07:00
Pieter De BaetsandFacebook GitHub Bot d280772ea4 Remove manual flattening of pointerEvents in View (#44352)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44352

Confirmed in https://github.com/facebook/react/commit/d779eba4b375134f373b7dfb9ea98d01c84bc48e that style properties already take priority over direct props, so we can avoid flattening style here.

Changelog: [General][Fixed] Small performance tweak to View wrapper to avoid unnecessary style flattening.

Reviewed By: sammy-SC

Differential Revision: D56740899

fbshipit-source-id: ceec3e9665e2f69637c832af7dc59ce2feb65e24
2024-05-01 22:50:10 -07:00
Arushi KesarwaniandFacebook GitHub Bot 63043b79be Fix shouldShowDevMenuOrReload in RELEASE
Summary:
In RELEASE mode, the `devSupportManager` received is ReleaseDevSupportManager for which `showDevOptionsDialog()` & `handleReloadJS()` is a no-op
https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/ReleaseDevSupportManager.java

Which is expected since this is a capability only in Dev mode(useDeveloperSupport = true). However, ATM `shouldShowDevMenuOrReload()` returns true in RELEASE as well which is a bug.

Since there is no need for `shouldShowDevMenuOrReload()` in RELEASE, changing it's logic to introduce that check, early exit and return false in case of RELEASE.

Changelog:
[Android][Fixed] shouldShowDevMenuOrReload() in RELEASE mode

Reviewed By: RSNara

Differential Revision: D56851473

fbshipit-source-id: e9e12b0bec8aead5e9227fcd676459ca54490b61
2024-05-01 21:27:58 -07:00
Arushi KesarwaniandFacebook GitHub Bot bdcc979bab Fix onKeyLongPress() in RELEASE
Summary:
In RELEASE mode, the `devSupportManager` received is ReleaseDevSupportManager for which `showDevOptionsDialog()` is a no-op
https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/ReleaseDevSupportManager.java#L66

Which is expected since this is a capability only in Dev mode(useDeveloperSupport = true). However, ATM `onKeyLongPresss()` returns true in RELEASE as well which is a bug.

Since there is no need for `onKeyLongPress()` in RELEASE, changing it's logic to introduce that check and return false in case of RELEASE.

Changelog:
[Android][Fixed] onKeyLongPress() in RELEASE mode

Reviewed By: christophpurrer, RSNara

Differential Revision: D56850466

fbshipit-source-id: 92d2c8572b32d065f5f9d54e22588bb085b9dcc9
2024-05-01 21:27:58 -07:00
Eric RozellandFacebook GitHub Bot 67bc65df85 Add C++ header for default TurboModules and cross-platform reuse (#44361)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44361

In order to keep all platforms in sync (Android, iOS, Windows, etc.), it makes sense to consolidate all C++ TurboModules that we want available by default on all platforms to a shared C++ header / implementation.

This moves the duplicated code from Android and iOS to such a shared module provider and updates relevant build specs.

## Changelog

[Internal]

Reviewed By: christophpurrer

Differential Revision: D56835783

fbshipit-source-id: 7322ed054ded5749973885c63257e5caf23b3fc3
2024-05-01 20:16:16 -07:00
John WardandFacebook GitHub Bot 0383669a4b Only schedule Choreographer callbacks if there's an active animation
Summary:
Changelog: [Internal]
A very similar diff was attempted with D50647971 and reverted in D51617862. The main difference here is all behavior is gated behind the feature flag. Before, we were enqueuing the extra frame callback on start_animating_node even if ondemand choreographer was disabled.

Reviewed By: javache

Differential Revision: D56085369

fbshipit-source-id: fa6335303fe98199b18fa2b4819110afb8efcc0d
2024-05-01 16:41:53 -07:00
Arushi KesarwaniandFacebook GitHub Bot dfa6519749 getJavaScriptContextHolder() in BridgelessReactContext (#44360)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44360

Support `getJavaScriptContextHolder()` in BridgelessReactContext

Changelog:
[Android][Added] - getJavaScriptContextHolder() supported in BridgelessReactContext since it's supported in ReactContext[Bridge]

Reviewed By: philIip, RSNara

Differential Revision: D56834958

fbshipit-source-id: e274adc01b0993012f36224d5afaa3918997c13c
2024-05-01 16:10:04 -07:00
Kudo ChienandFacebook GitHub Bot 539922339b fix ReactActivity.getReactDelegate().reload() (#44223)
Summary:
fixing some problem for `ReactActivity.getReactDelegate().reload()` from https://github.com/facebook/react-native/issues/43521:
- the `reload()` does not work for bridge mode on release build

## Changelog:

[ANDROID] [FIXED] - Fixed app reloading for `ReactActivity.getReactDelegate().reload()`.

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

Test Plan:
tried to temporary change toast.show as reload and test from rn-tester
```diff
 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/toast/ToastModule.kt
+++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/toast/ToastModule.kt
@@ -10,6 +10,7 @@ package com.facebook.react.modules.toast
 import android.view.Gravity
 import android.widget.Toast
 import com.facebook.fbreact.specs.NativeToastAndroidSpec
+import com.facebook.react.ReactActivity
 import com.facebook.react.bridge.NativeModule
 import com.facebook.react.bridge.ReactApplicationContext
 import com.facebook.react.bridge.UiThreadUtil
@@ -30,9 +31,11 @@ public class ToastModule(reactContext: ReactApplicationContext) :
       )

   override public fun show(message: String?, durationDouble: Double) {
-    val duration = durationDouble.toInt()
-    UiThreadUtil.runOnUiThread(
-        Runnable { Toast.makeText(getReactApplicationContext(), message, duration).show() })
+//    val duration = durationDouble.toInt()
+//    UiThreadUtil.runOnUiThread(
+//        Runnable { Toast.makeText(getReactApplicationContext(), message, duration).show() })
+    val activity = reactApplicationContext.currentActivity as? ReactActivity
+    activity?.reactDelegate?.reload()
   }

   override public fun showWithGravity(
```

tried for different mode
- [x] bridge mode + debug build
- [x] bridgeless mode + debug build
- [x] bridge mode + release build
- [x] bridgeless mode + release build

Reviewed By: fkgozali

Differential Revision: D56795975

Pulled By: arushikesarwani94

fbshipit-source-id: 895eab1927ba6db748ebb32c0fd5313f19cf9d1b
2024-05-01 15:21:44 -07:00
Pieter De BaetsandFacebook GitHub Bot 90663081de Expose BaseJavaModule constructors through ViewManager
Summary:
ViewManagers are all BaseJavaModule, and thus have access to methods like `getReactApplicationContext`. We don't expose the appropriate constructors though to pass this context down from the base class.

Not a breaking change, as the no-arg constructor is still used implicitly.

Changelog: [Android][Fixed] ViewManagers can pass context to their base class.

Reviewed By: fabriziocucci

Differential Revision: D56804318

fbshipit-source-id: b0e6b15dfd7786073da058beccfaba2ff30daf5a
2024-05-01 11:49:53 -07:00
Tim YungandFacebook GitHub Bot 387250112e RN: Configure no-string-refs as Error
Summary:
In a future release of React Native, string refs will no longer be supported. This increases the severity of the `no-string-refs` lint rule to convey this.

Changelog:
[General][Changed] - `no-string-refs` is now a lint error

Reviewed By: kassens

Differential Revision: D56826663

fbshipit-source-id: 603f5b205bb9fd8a5dcb8ee917f6a2ba1ac47e6e
2024-05-01 10:21:18 -07:00
Moti ZilbermanandFacebook GitHub Bot 694e8e7dce Document HostFunction dtor threading requirement
Summary:
Changelog: [Internal]

Updates the doc comment on `Function::createFromHostFunction` to
mention that (a copy of) the provided `std::function` may be destroyed
on an arbitrary thread, much like `HostObject` (where this is already
documented).

Reviewed By: neildhar

Differential Revision: D56628194

fbshipit-source-id: 1939602135e83a9c36896c395816054376026edc
2024-05-01 09:25:12 -07:00
Samuel SuslaandFacebook GitHub Bot d77f806960 pass trait when shadow node is cloned from update state (#44355)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44355

changelog: [internal]

Reviewed By: cipolleschi

Differential Revision: D56765820

fbshipit-source-id: 5bfd2231883c25a0d9149bb07d529da796fd921e
2024-05-01 06:02:06 -07:00
Riccardo CipolleschiandFacebook GitHub Bot f19371f28d Remove getSurfacePresenter and getModuleRegistry from RCTHost
Summary:
This change removes a couple of method from RCTHost which were not following the iOS convention for names.

We deprecated them in 0.74 and now that the branch is cut, we can remove them.

## Changelog:
[iOS][Breaking] - Remove `getSurfacePresenter` and `getModuleRegistry` from RCTHost

Reviewed By: sammy-SC

Differential Revision: D56633554

fbshipit-source-id: 88fd1525bfe68ca1f6c2d8403d0dec505a23e9f8
2024-05-01 03:54:55 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 94537c7beb Honor requiresMainQueueSetup in bridgeless mode for ViewManagers
Summary:
We [received an issue](https://github.com/react-native-maps/react-native-maps/issues/5042) in OSS where a ViewManager was configured to be initialized on the main queue, but it wasn't.
This was creating a soft crash and showing a RedBox to the user.
The library was going through the Interop Layer.

This change makes sure that, if the ViewManager is configured to be setup in the main queue, we retrieve the constants from the Main Queue

## Changelog
[iOS][Fixed] - Extract the constants from ViewManagers in the UI Thread if needed.

Reviewed By: sammy-SC

Differential Revision: D56762253

fbshipit-source-id: ca807b34d6e61418da9fd6a639a05f3394879f7c
2024-05-01 03:53:10 -07:00
Rubén NorteandFacebook GitHub Bot c3b7aac143 Migrate enableGranularShadowTreeStateReconciliation from CoreFeatures to ReactNativeFeatureFlags
Summary:
Changelog: [internal]

Migrating this feature flag (which is currently unused) to the new system, so we can test it in production and ship it soon.

Reviewed By: NickGerleman

Differential Revision: D56766553

fbshipit-source-id: 42d44cdd163568564e789cdffe1683e78fe91b53
2024-05-01 03:41:42 -07:00
Gijs WeteringsandFacebook GitHub Bot 237ddb4dbf Fix Circle CI builds due to incorrect UnsupportedEnumDeclarationParserError import
Summary:
Changelog: [Internal]

The import style used
```
npm ERR! /home/circleci/react-native/packages/react-native-codegen/lib/parsers/typescript/modules/index.js:13
npm ERR! import {UnsupportedEnumDeclarationParserError} from '../../errors';
npm ERR! ^^^^^^
npm ERR!
npm ERR! SyntaxError: Cannot use import statement outside a module
npm ERR!     at internalCompileFunction (node:internal/vm:73:18)
npm ERR!     at wrapSafe (node:internal/modules/cjs/loader:1175:20)
npm ERR!     at Module._compile (node:internal/modules/cjs/loader:1219:27)
npm ERR!     at Module._extensions..js (node:internal/modules/cjs/loader:1309:10)
npm ERR!     at Module.load (node:internal/modules/cjs/loader:1113:32)
npm ERR!     at Module._load (node:internal/modules/cjs/loader:960:12)
npm ERR!     at Module.require (node:internal/modules/cjs/loader:1137:19)
npm ERR!     at require (node:internal/modules/helpers:121:18)
npm ERR!     at Object.<anonymous> (/home/circleci/react-native/packages/react-native-codegen/lib/parsers/typescript/parser.js:60:19)
npm ERR!     at Module._compile (node:internal/modules/cjs/loader:1255:14)
```
is not supported.

Reviewed By: philIip

Differential Revision: D56809538

fbshipit-source-id: 4b42f9e964d49c4fe3c3a4020eb2b3860fdd810c
2024-05-01 03:16:15 -07:00
Soe LynnandFacebook GitHub Bot a9a7382d95 Fix findNodeAtPoint returns incorrect view
Summary:
This work is based on Ruslan's https://www.internalfb.com/intern/diff/D56185630/

Changelog: [Internal]
`Expectation`: In React DevTools, user should be able to select an element on screen and it will show you what React component rendered it. This doesn't work in RN app that is using JS navigation

`Root Cause`:
In Fabric, when we try to find `ShadowNode` in the `ShadowTree`, `pointerEvents` props are not considered during the lookup of node using coordinate. Hence, in React DevTools when we inspect element, it was hightlighting the overlay `View` with `pointerEvents` props `box-none` was getting highlighted instead of its children view in the hierarchy.

Reviewed By: javache

Differential Revision: D56334314

fbshipit-source-id: ebfe58c5a1516add347c2c21ab5d075f804df8a9
2024-05-01 00:51:59 -07:00
Nick GerlemanandFacebook GitHub Bot 7f5bff48dd Remove "deduplicated" Spannable path
Summary:
This removes the bulk of code added in https://github.com/facebook/react-native/pull/39630.

We're not shipping it, as it caused performance regressions.

Changelog:
[Internal]

Reviewed By: christophpurrer

Differential Revision: D56796936

fbshipit-source-id: 82f3a51cf145bc1695d70393e1f050685a1e6174
2024-04-30 22:30:05 -07:00
Christoph PurrerandFacebook GitHub Bot 536edf3726 Don't support float enums
Summary:
Changelog: [General][BREAKING] Don't support 'float' enums in Turbo Modules

- The current implementation of 'float enums' in C++ does not work as invalid results are returned.
- At potential fix could still cause rounding errors when crossing language bounaries, e.g. `4.6` can become `4.5599999942..`
- C++ enum classes don't support float: https://eel.is/c++draft/dcl.enum#2.sentence-4

> The type-specifier-seq of an enum-base shall name an integral type; any cv-qualification is ignored.

Hence removing the feature of `float enums` for now

Reviewed By: NickGerleman

Differential Revision: D52120405

fbshipit-source-id: 3685ad0629e16ff9db424ba67e07d09df6027553
2024-04-30 21:52:09 -07:00
Jakub PiaseckiandFacebook GitHub Bot 12aef32b82 Apply padding to the text attachements (#44258)
Summary:
Paddings are not applied to inline views in text, this PR fixes that.

Closes https://github.com/facebook/react-native/issues/42099

## Changelog:

[GENERAL] [FIXED] - Fixed padding not being applied to inline views in text

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

Test Plan:
<details>
<summary>A simple test case</summary>

```jsx
      <Text style={{paddingHorizontal: 40, paddingVertical: 40, backgroundColor: 'green', width: 300 }}>
        <View style={{backgroundColor: 'red', width: 50, height: 50}} />
        foobar foobar
        <View style={{backgroundColor: 'red', width: 50, height: 50}} />
      </Text>
```

|iOS before|iOS after|Android before|Android after|
|-|-|-|-|
|<img width="502" alt="Screenshot 2024-04-25 at 17 17 50" src="https://github.com/facebook/react-native/assets/21055725/e6981de0-6714-4bb0-a006-547b30374b8a">|<img width="546" alt="Screenshot 2024-04-25 at 17 15 56" src="https://github.com/facebook/react-native/assets/21055725/51e8458b-ad4e-4755-865c-664414bfee55">|<img width="457" alt="Screenshot 2024-04-26 at 11 18 17" src="https://github.com/facebook/react-native/assets/21055725/ac351eff-6d24-40a0-bf7e-0cf3782e9368">|<img width="457" alt="Screenshot 2024-04-26 at 11 17 11" src="https://github.com/facebook/react-native/assets/21055725/3284a79a-157d-43ea-b080-849520e2ee7d">|

</details>

Reviewed By: christophpurrer

Differential Revision: D56789213

Pulled By: NickGerleman

fbshipit-source-id: 2dd0e4bf291e20b3e4c4d73f58079d1abafc3f8e
2024-04-30 20:59:35 -07:00
Alan LeeandFacebook GitHub Bot 639d890dff add missing struct member initialization in Props.h (#44294)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44294

**Problem:**

It was discovered while testing 3 party library, generated member variables in a C++ `struct` in `Props.h` is not initialized.
Also `WithDefault` would not work as well.
(For the problematic case it was a `boolean` but would also apply to other primitive types.)

If there is no default initialization and the component prop is optional and the user of the native component does not set the prop then the variable is never initialized and this is problematic for primitive types in C++ where no initialization results in an undefined behavior.

**Proposed solution:**

(Following C++Core Guideline of [always initialize](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-always).)
Reusing `generatePropsString()` used by `ClassTemplate` to generate props for `StructTemplate` as well.
updated relevant test snapshots.
This change is only concerning the `Props.h` file.

**Changelog:**
[General][Fixed] - fixed `Props.h` created from codegen missing default initializers in C++ `struct`

Reviewed By: cipolleschi

Differential Revision: D56659457

fbshipit-source-id: 0d21ad20c0491a7e8bb718cd3156da65def72f23
2024-04-30 18:29:31 -07:00
aleqsioandFacebook GitHub Bot 61f584c3af Implement privacy manifest aggregation (#44214)
Summary:
As of now, Apple does not respect privacy manifests added as cocoapods resource bundles. This forces react-native developers to manually copy `.xcprivacy` files content for each native dependency that accesses restricted reason APIs to the root file.

This PR adds an aggregation step that crawls through pod dependencies to collect all reasons into the root privacy info file.

## Changelog:

[IOS][ADDED] – Add privacy manifest aggregation.

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

Test Plan:
When run on RNTester, it appends aggregated entries (while keeping existing ones) to existing .xcprivacy file without modifing .pbxproj:
![image](https://github.com/facebook/react-native/assets/5597580/1d07a07d-bbec-4266-a599-a8d629078971)

When run on RNTester with the xcprivacy file removed from xcode beforehand, it creates a new .xcprivacy file, and adds it to Compile Bundle Resources in the same way as in the new template:
![image](https://github.com/facebook/react-native/assets/5597580/f80a3b4e-e41a-4906-8e2f-06cca0bc225a)

When run on RNTester with an empty .xcprivacy file, it appends aggregated entries from pods AND reasons for react-native core.

When run with `privacy_file_aggregation_enabled: false` in `use_react_native`, it falls back to existing behavior:
![image](https://github.com/facebook/react-native/assets/5597580/4519bba1-c80e-4cd0-b19c-bbbebfa8493b)

Reviewed By: cipolleschi

Differential Revision: D56481045

Pulled By: philIip

fbshipit-source-id: 1841bad821511c734d0cc0fcff5065ed92af76d8
2024-04-30 18:19:28 -07:00
Christoph PurrerandFacebook GitHub Bot c96c893374 Support emitting typed RCTDeviceEmitter events
Summary:
This enables to code-gen base C++ types for custom exported JS types from a RN TM spec - which have been previously excluded from code-gen as these aren't used in any function.

The only work around so far was to ‘register’ a random function using the custom type which should be used for RCTDeviceEventEmitter events

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D56685903

fbshipit-source-id: add9ca40018b91c9fca98609ba3d1f85d3affec1
2024-04-30 11:16:57 -07:00
Rubén NorteandFacebook GitHub Bot cfbee0b7ec Add test for LazyShadowTreeRevisionConsistencyManager and fix bugs
Summary:
Changelog: [internal]

`LazyShadowTreeRevisionConsistencyManager` wasn't correctly updating the locked revision, because `emplace` is a no-op if there's already a value for the key in the `unordered_map`.

This fixes the issue and adds tests that actually showed it.

Reviewed By: sammy-SC

Differential Revision: D56761941

fbshipit-source-id: 340e9195b14460a591c48186bd365688c74ade04
2024-04-30 10:29:22 -07:00
hurali97andFacebook GitHub Bot 9cfc71dc66 changelog: 0.72.14 (#44333)
Summary:
## 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
-->

Changelog: [Internal] Generated changelog

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

Reviewed By: cortinico

Differential Revision: D56756077

Pulled By: cipolleschi

fbshipit-source-id: 4e8d2f6b83499bd89d6a60de4eede385b7a8ac3c
2024-04-30 09:15:55 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 9bdd777fd7 Avoid calling abstract methods in RCTComposedViewRegistry
Summary:
`RCTComposedViewRegistry` extends `NSMutableDictionary` which is a clustered class in iOS.
NSMutableDictionary is techncially an abstract class, but when instantiated by `[NSMutableDictionary new];` the system will return one of concrete classes that inherit from `NSMutableDictionary`, opaquely from the perspective of the caller.

By calling `super`, we are actually calling the not implemented method for the abstract class. If this happen, this can crash the app.

Given that the `RCTComposedViewRegistry` is extending the dictionary only for its interface but is using other mechanisms as storage, is it fair to return `NULL`if the storages don't have the requested view.

## Changelog
[iOS][Fixed] -  Avoid calling abstract methods in RCTComposedViewRegistry

Reviewed By: cortinico

Differential Revision: D56755427

fbshipit-source-id: f5c56dc59ccc6b30c00199b4196c42eb9b021e2b
2024-04-30 08:42:42 -07:00
Nicola CortiandFacebook GitHub Bot 44e78ff74a Fix accidentally broken build_android job
Summary:
I accidentally broke build_android.
Here the two fixes:
1. Make sure the constructor of PackageList2 are actually called `PackageList2`
2. Make sure the package of `OSSLibraryExamplePackage` is `com.facebook.react.osslibraryexample`

Changelog:
[Internal] [Changed] - Fix accidentally broken build_android job

Reviewed By: dmytrorykun

Differential Revision: D56756601

fbshipit-source-id: 862597ca829d702d880624d29276193f8548715d
2024-04-30 08:02:20 -07:00
Moti ZilbermanandFacebook GitHub Bot 845a879442 Lift console method bodies out of installConsoleHandler
Summary:
Changelog: [Internal]

The bodies of all `console` methods are currently written as lambdas within `installConsoleHandler` but actually capture nothing meaningful from that scope. This diff rewrites them as free functions instead.

To enable the "forwarding console methods" to be written as free functions, we also replace the runtime loop over `kForwardingConsoleMethods` with a compile-time equivalent using macros. (This technique is inspired by the Hermes source code, which uses it heavily for compile-time code generation.)

Reviewed By: huntie

Differential Revision: D56679956

fbshipit-source-id: babf368ecacb9dc426b2356a4a2091881ca1023e
2024-04-30 05:38:32 -07:00
Moti ZilbermanandFacebook GitHub Bot 38f8b8e099 Remove unnecessary std::function indirection in console
Summary:
Changelog: [Internal]

Switches to constrained `auto` instead of `std::function` to represent intermediate function types in `RuntimeTargetConsole::installConsoleHandler`. This removes some indirection and potential runtime overhead.

Reviewed By: huntie

Differential Revision: D56675188

fbshipit-source-id: 76cbf8b8be9ca1a9466efbcd187bddd60c921019
2024-04-30 05:38:32 -07:00
Nicola CortiandFacebook GitHub Bot c57ca2c3b4 RNGP - Move the generateAutolinkingNewArchitectureFiles task to core autolinking
Summary:
This diff is part of RFC0759
https://github.com/react-native-community/discussions-and-proposals/pull/759

Here I'm moving the New Architecture C++ Autolinking from the CLI to core.
It follows the same logic as this:
https://github.com/react-native-community/cli/blob/73f880c3d87cdde81204364289f2f488a473c52b/packages/cli-platform-android/native_modules.gradle#L544-L550

Changelog:
[Internal] [Changed] - RNGP - Move the generateAutolinkingNewArchitectureFiles task to core autolinking

Reviewed By: cipolleschi, blakef

Differential Revision: D55475594

fbshipit-source-id: d3768d932032e8e98f992d5f1bc54c439520873d
2024-04-30 04:33:56 -07:00
Nicola CortiandFacebook GitHub Bot 0d37d0a4b7 RNGP - Move generateAutolinkingPackageList to core autolinking
Summary:
This diff is part of RFC0759
https://github.com/react-native-community/discussions-and-proposals/pull/759

Here I'm moving over the task to generate the Package List for Autolinking inside RNGP.
The logic is the same as this one:
https://github.com/react-native-community/cli/blob/73f880c3d87cdde81204364289f2f488a473c52b/packages/cli-platform-android/native_modules.gradle#L217

The class is generated as PackageList2 to avoid a duplicate class build failure with the current Autolinking from CLI.

Changelog:
[Internal] [Changed] - RNGP - Move generateAutolinkingPackageList to core autolinking

Reviewed By: cipolleschi

Differential Revision: D56637394

fbshipit-source-id: 929b42af3a0e1951cb7a0f4ace47bbbb84000780
2024-04-30 04:33:56 -07:00
Rubén NorteandFacebook GitHub Bot cc5bab83ab Use private fields in performance APIs
Summary:
Changelog: [internal]

This migrates all the classes related to performance in `react-native/src/private` to use private fields instead of regular fields prefixed with `_`.

Reviewed By: yungsters

Differential Revision: D55931659

fbshipit-source-id: e8b2018048dbb6c8d6e8a4d143357bf2ac39dd1e
2024-04-30 04:32:10 -07:00
Rubén NorteandFacebook GitHub Bot 59688a1aee Migrate a bunch of classes in react-native/src/private to use private fields
Summary:
Changelog: [internal]

Quick refactor to use private fields instead of fields with a naming convention, in classes in `react-native/src/private`.

Reviewed By: yungsters

Differential Revision: D56700382

fbshipit-source-id: ee0a7b30a9da20c31b92878be3316227b2d0a0c4
2024-04-30 04:31:00 -07:00
Thibault MalbrancheandFacebook GitHub Bot 0ee79be405 chore: changelog for 0.73.8 (#44331)
Summary:
Adds changelog for the 0.73.8 patch.

## Changelog:

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

Pick one each for the category and type tags:

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

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

[Internal] [Changed] - Add 0.73.8 changelog

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

Reviewed By: cortinico

Differential Revision: D56753881

Pulled By: cipolleschi

fbshipit-source-id: eed053cd39a768d6acb40a037a4218ee5e1fbbf8
2024-04-30 04:19:32 -07:00
Rubén NorteandFacebook GitHub Bot c3a1ae3c3e Add comment to indicate how to update generated files for feature flags in ReactNativeFeatureFlags.config.js
Summary:
Changelog: [internal]

We have a comment explaining how to update all generated files everywhere but here.

Reviewed By: NickGerleman

Differential Revision: D56717344

fbshipit-source-id: cc538e37dd6ab09f67d67bb13ce4e560870d44d0
2024-04-30 03:25:59 -07:00
Nicola CortiandFacebook GitHub Bot 8f1b27001f RNGP - Autolinking - Add model classes for parsing the config output
Summary:
This diff is part of RFC0759
https://github.com/react-native-community/discussions-and-proposals/pull/759

Here I'm creating data classes that will allow us to parse the `config` JSON output.
Code is pretty straightforward and follows the structure as the `config` command output.

Changelog:
[Internal] [Changed] - RNGP - Autolinking - Add model classes for parsing the `config` output

Reviewed By: cipolleschi, blakef

Differential Revision: D55475595

fbshipit-source-id: 3457c008ff0c5bce2b47fd637c7b10a5e7427c01
2024-04-30 02:49:48 -07:00
Nicola CortiandFacebook GitHub Bot 1df1570810 RNGP - Setup the RunAutolinkingConfigTask to run the config command
Summary:
This diff is part of RFC0759
https://github.com/react-native-community/discussions-and-proposals/pull/759

Here I'm creating the `runAutolinkingConfig` task.

This task is responsible of either:
- Invoking the `npx react-native-community/cli config` command (or the one specified by the user)
- Copying the config output file specified by the user (if any).

The task re-executes only if any of the lockfile are actually changed otherwise it just returns as "UP-TO-DATE"

This allows us to

Changelog:
[Internal] [Changed] - RNGP - Setup the RunAutolinkingConfigTask to run the config command

Reviewed By: cipolleschi, blakef

Differential Revision: D55475596

fbshipit-source-id: 3c687f965c59eb82fc447546ebd936ba401f34f2
2024-04-30 02:49:48 -07:00
Danny SuandFacebook GitHub Bot 6262158c11 Pass StackTrace directly to Hermes ConsoleMessage
Summary:
Hermes' ConsoleMessage constructor now accepts StackTrace, so the construction can be done in one go.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D56738060

fbshipit-source-id: 709b47d8f9cf69994e4c5eaa4f9310e70a4d9ed0
2024-04-30 00:19:48 -07:00
Ruslan ShestopalyukandFacebook GitHub Bot 7b3c622219 Hoist TextInput.autoCapitalize to BaseTextInputProps on C++ side
Summary:
## Changelog:
[Internal]-

Even though `TextInput.autoCapitalize` is supposed to be cross-platform, on the C++ side of the props data structures it was only exposed as an Android-specific one.

This would have it still work on the iOS side (as the corresponding prop is passed to Objective C around the C++ structs anyway), however it may also cause subtle scenarios, whereas the prop changes dynamically on the iOS side, but this doesn't get reflected on the native side.

This change fixes this problem by simply hoisting the prop into the `BaseTextInputProps`, which makes it available across all platforms, as it should be.

Differential Revision: D56726940

fbshipit-source-id: 9ba18f1f92095874e07207650b46655c331f3e91
2024-04-29 23:45:49 -07:00
Danny SuandFacebook GitHub Bot 35c7956baf Remove RuntimeAdapter.h from HermesRuntimeAgentDelegate
Summary:
RuntimeAdapter.h is only needed when using CDPHandler, which the new code path doesn't need.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D56738299

fbshipit-source-id: 8cb512a3dc8dc303851871021e04aab94aa25d1e
2024-04-29 23:41:50 -07:00
Pieter De BaetsandFacebook GitHub Bot dd51b38101 Fix missing close for canceled bundle downloads
Summary:
`Response` is `Closeable`, so we must close it even if the download is no longer relevant. Found while running with StrictMode enabled and reloading quickly multiple times.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D56629079

fbshipit-source-id: 041bf295313cbf78b7f2bb6580c50fdc2a324728
2024-04-29 21:10:28 -07:00
Edmond ChuiandFacebook GitHub Bot b7de916664 move launch ID gen out of dev-middleware
Summary: Changelog: [General][Removed] `launchId` query param for `/debugger-frontend` is no longer generated automatically for each `/open-debugger` call. Caller of `/open-debugger` is now responsible for generating the `launchId`, which will be passed along to `/debugger-frontend`.

Reviewed By: robhogan

Differential Revision: D55164645

fbshipit-source-id: b83303eda77b6fb86ebf50f699d9f308676533c6
2024-04-29 11:55:28 -07:00
Edmond ChuiandFacebook GitHub Bot 820d1e1ff4 add fields to launch_debugger_frontend
Summary: Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D56610268

fbshipit-source-id: 37abee41dd068f3cafa19466b914545f6460a3f0
2024-04-29 11:55:28 -07:00
Nick VlugandFacebook GitHub Bot eb01a8f0c5 Remove duplicated use_hermes in RCTAppDelecate podspec (#44299)
Summary:
remove duplicated use hermes variable in RCTAppDelecate podsec file.

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

Test Plan:
Default setup flow (ios)

## Changelog:
[Internal] [Changed] - Remove duplicated use hermes variable in RCTAppDelecate podsec file.

Reviewed By: cipolleschi

Differential Revision: D56693121

Pulled By: arushikesarwani94

fbshipit-source-id: 2bbe4090d94cadd128be9c5d233a63499f735e68
2024-04-29 10:40:06 -07:00
Alex HuntandFacebook GitHub Bot 548fcd8b3b Update "Open Debugger" to print extended Flipper guidance
Summary:
Supports the removal of Flipper from the template in 0.74, paried with additional blog post messaging: https://reactnative.dev/blog/2024/04/22/release-0.74#removal-of-flipper-react-native-plugin.

Changelog:
[General][Changed] - Update "Open Debugger" action to print extended Flipper guidance

Reviewed By: cipolleschi

Differential Revision: D56705236

fbshipit-source-id: d7e869625262ebb02bc2454c924f832cccfbcd31
2024-04-29 10:18:45 -07:00
Marc RousavyandFacebook GitHub Bot 8ce4bf1893 fix: Fix missing space (#44311)
Summary:
Just a minor fix to fix a missing space in the debug message.

Fixes a missing space in the message

```
Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'MmkvPlatformContext' could not be found. Verify that a module by this name is registered in the native binary.Bridgeless mode: false. TurboModule interop: false. Modules loaded: {"NativeModules":["PlatformConstants","LogBox","Timing","AppState","SourceCode","BlobModule","WebSocketModule","SettingsManager","DevSettings","RedBox","Networking","Appearance","DevLoadingView","UIManager","DeviceInfo","ImageLoader","LinkingManager"],"TurboModules":[],"NotFound":["NativePerformanceCxx","NativePerformanceObserverCxx","BugReporting","HeadlessJsTaskSupport","SoundManager","IntentAndroid","MmkvPlatformContext","MmkvCxx"]}
```

## 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] - Fixed missing space in TurboModule.getEnforcing error message

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

Reviewed By: christophpurrer

Differential Revision: D56702036

Pulled By: rshest

fbshipit-source-id: e339a6ee8c265b2c6d27184e8e9941f3f02e3c85
2024-04-29 09:21:23 -07:00