Commit Graph

12270 Commits

Author SHA1 Message Date
Rubén Norte e91a577262 Clean up old code for microtasks in Hermes (#44708)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44708

Changelog: [internal]

We had a fallback to use a Hermes internal API if the native module exposing `queueMicrotask` wasn't available. This is no longer necessary as the module is available everywhere we enable the event loop, so we can remove it.

Reviewed By: christophpurrer

Differential Revision: D57922076

fbshipit-source-id: 0ca48abacd77a75ce8559db08f55c78a3e0ec815
2024-05-30 04:22:50 -07:00
Nick Gerleman cfbd15aff1 Add border clipping examples (#44711)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44711

This adds just the border clipping examples and tests from D57668976

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D57941945

fbshipit-source-id: 2234927cb944710c9d929d1d77087d3d2ecdbca6
2024-05-29 23:32:34 -07:00
Neil Agarwal 06512aa565 fix: use consistent version of glob in react-native (#44713)
Summary:
https://github.com/isaacs/node-glob/issues/493

Fixes https://github.com/facebook/react-native/issues/44712

## Changelog:
[General][Fixed] - Use consistent version of glob in react-native

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

Reviewed By: yungsters

Differential Revision: D57949442

Pulled By: NickGerleman

fbshipit-source-id: 9ea246c6b5307370628f34a78373a8bddb42420d
2024-05-29 23:21:24 -07:00
Kudo Chien bed487e24b Add BindingsInstaller for TurboModules on iOS (#44486)
Summary:
Add synchronous JS bindings installation for TurboModules. That would help some 3rd party JSI based modules to install JS bindings easier.
Re-create from https://github.com/facebook/react-native/issues/43110 but for iOS

## Changelog:

[IOS] [ADDED] - Add BindingsInstaller for TurboModules

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

Test Plan: Added test in RN-Tester TurboModule test case

Reviewed By: javache

Differential Revision: D57224891

Pulled By: philIip

fbshipit-source-id: fabe5c4f8d2087ac9a465f2cb90d884b83265a68
2024-05-29 20:34:25 -07:00
Eric Rozell 775713cef7 Make consistent focusable behavior (#44705)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44705

`focusable` props behaviors are inconsistent across different flavors of Touchable components. Some use the disabled prop to check if the component should be focusable, others do not.

This ensures all Touchable* component flavors use the disabled prop.

## Changelog

[General][Fixed] Fixed inconsistency in TouchableX component disabled / focusable behavior

Reviewed By: yungsters

Differential Revision: D57910488

fbshipit-source-id: af17227403338fcd5bebd9ba7c3172b4c6776e1f
2024-05-29 19:06:34 -07:00
Nick Gerleman 5fbebb4852 Cleanup ReactFeatureFlags.enableTextSpannableCache (#44706)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44706

We didn't ship this, and asking around, I don't think mdvacca was looking at this actively (though is on PTO right now).

Changelog: [Internal]

Reviewed By: rozele

Differential Revision: D57913491

fbshipit-source-id: 86afd5a6bb5e7ce6be540f2295aa407134a6d81c
2024-05-29 13:31:36 -07:00
Samuel Susla 3c31e9dd9f clip content offset when scroll view is restored from shadow tree (#44704)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44704

changelog: [internal]

Checkout the code comments for explanation.

Reviewed By: javache

Differential Revision: D57903106

fbshipit-source-id: 202edfa0b93ce222997ed793313cdc3ca32f8818
2024-05-29 10:01:46 -07:00
zhongwuzw 690df7a556 Fixes animated frame timing (#44622)
Summary:
Fixes https://github.com/facebook/react-native/issues/44608 .

## Changelog:

[IOS] [FIXED] - Fixes animated frame timing

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

Test Plan: Example in https://github.com/facebook/react-native/issues/44608 .

Reviewed By: sammy-SC

Differential Revision: D57559884

Pulled By: cipolleschi

fbshipit-source-id: 33eaf71c24eb83715403a67b3471dd1ac2dd9d2f
2024-05-29 08:16:42 -07:00
zhongwuzw f500b47a95 Bridgeless: Expose host delegate methods (#44158)
Summary:
Expose host delegate methods that users can do some customize work.

## Changelog:

[IOS] [ADDED] - Bridgeless: Expose host delegate methods

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

Test Plan: Users can do some customized work by `RCTRootViewFactory`.

Reviewed By: sammy-SC

Differential Revision: D56521470

Pulled By: cipolleschi

fbshipit-source-id: dd22d0978b9fd4385380945a514eb6596b7d874f
2024-05-29 08:14:09 -07:00
Renaud Chaput fc4e099920 Fix Privacy Manifest generator when it does not contain a NSPrivacyAccessedAPITypes key (#44628)
Summary:
XCode privacy files might not contain a `NSPrivacyAccessedAPITypes` key, which causes the following error:

```
[!] An error occurred while processing the post-install hook of the Podfile.

undefined method `each' for nil

node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:111:in `block (4 levels) in get_used_required_reason_apis'
node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:106:in `each'
node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:106:in `block (3 levels) in get_used_required_reason_apis'
```

## Changelog:

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

Pick one each for the category and type tags:

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

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

[IOS] [FIXED] - Privacy Manifest aggregation failing due to no `NSPrivacyAccessedAPITypes` key

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

Test Plan: I tested this patch on our own app and it solved the issue.

Reviewed By: christophpurrer

Differential Revision: D57618425

Pulled By: cipolleschi

fbshipit-source-id: 1a36ab5a1bb45b8507d3663b782c95258d97c8a4
2024-05-29 08:08:42 -07:00
Soe Lynn 805f1493c7 overflow props is not honored in ScrollView in new architecture (#44699)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44699

Changelog: [Internal]

In Fabric, overflow props for ScrollView is not passed down. Hence, the overflow props is ignored and FlatList content is always clipped.

Reported from OSS https://github.com/facebook/react-native/issues/44683

Reviewed By: sammy-SC

Differential Revision: D57895399

fbshipit-source-id: 6ce65bea0803971060e8229b66563123dd6fc114
2024-05-29 07:49:13 -07:00
Gijs Weterings f4ec8cbdba Add rntester_android as a valid app in ReactNativeCoreE2ESetup
Summary: Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D54662740

fbshipit-source-id: f845b127dc1cf5ef509eebea29c1c495a9ceb763
2024-05-29 07:06:19 -07:00
Edmond Chui 82a3bb8f75 add fusebox flag to error case of launch debugger event (#44696)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44696

Changelog: [Internal]

Add `prefers_fusebox_frontend` annotation to the error case for the launch debugger event

Reviewed By: hoxyq

Differential Revision: D57866634

fbshipit-source-id: fcd3655539c936d9965b0c79a47b1b58bb9a4e48
2024-05-29 06:00:36 -07:00
Rubén Norte dc3a530191 Clean up androidEnablePendingFabricTransactions feature flag (#44695)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44695

Changelog: [internal]

We tested this feature flag at Meta and it's neutral when used outside the event loop. We'll handle its effects on the event loop as part of the event loop experiment itself (when enabling paint blocking).

Reviewed By: tdn120

Differential Revision: D57861195

fbshipit-source-id: 11a208ef5433321a464cfc16f4ff026d52988b42
2024-05-29 05:00:12 -07:00
Vladyslav Krasnolutskyi a93a15aca3 Fix Animate.sequence restart issues (#44031)
Summary:
Currently, if the `Animated.sequence` animation is finished, and then the `start()` method is called without a `reset()` method being invoked beforehand, the failure happens: ```undefined is not an object (evaluating 'animations[current].start')```.
Use cases:
- sequence animation started, finished, and then started again
- sequence animation is used in `Animation.loop` with `resetBeforeIteration` set to `false`, which essentially does the same as the previous case

Related issues:
- https://github.com/facebook/react-native/issues/43120
- https://github.com/facebook/react-native/issues/37611

## Changelog:

[General] [Fixed] - Fix sequence restart failure

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

Test Plan: Test cases are included: 1 for regression and 2 for mentioned use cases in the summary

Reviewed By: cipolleschi

Differential Revision: D56015346

Pulled By: dmytrorykun

fbshipit-source-id: 8b0f46c8a33397fece807634463ce630c89d28af
2024-05-28 07:33:44 -07:00
Sachin Tewari 3c5a3e0a07 Cleanup ImageLoaderModule (#44693)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44693

Changelog: [Internal]
Kotlin related simplifications

Reviewed By: oprisnik

Differential Revision: D57858309

fbshipit-source-id: 02ae17db13f5877ab83b05beadff3ff666aeff81
2024-05-28 07:30:20 -07:00
Christoph Purrer 24aed6ec49 Align with code-gen output Sample Turbo Modules (#44640)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44640

These modules are manually typed and don't use `react-native-codgen` (as a show case to demonstrates what code-gen produces).

There are some typos in the manually written code and they don't exactly match the JS Spec used at runtime:

https://github.com/facebook/react-native/blob/main/packages/react-native/src/private/specs/modules/NativeSampleTurboModule.js#L45-L48

Changelog: [Internal][Fixed] Align with code-gen output Sample Turbo Modules

Reviewed By: rshest

Differential Revision: D57624824

fbshipit-source-id: 023f2318630aa342758d5ea495e6298cb8884ae1
2024-05-28 07:15:28 -07:00
Håkon Knutzen d93788301c Add missing call to super.viewDidLoad in RCTRedBox.mm (#44686)
Summary:
When running the Analyzer in Xcode, I got a warning denoting that `viewDidLoad` was not called on `super` in the overridden `RCTRedBox.viewDidLoad`. While I have not observed any anomalies, it is best practice to call on super in the overridden view controller life cycle methods.

## Changelog:

[iOS] [FIXED] - Add missing call to `[super viewDidLoad]` in `RCTRedBox.mm`.

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

Test Plan:
Running the RNTester yielded the following screenshot:

<img width="549" alt="Screenshot 2024-05-27 at 11 26 40" src="https://github.com/facebook/react-native/assets/2263015/b91e126c-9dc1-4e52-8a6b-50ea8bea2c3f">

Reviewed By: fabriziocucci

Differential Revision: D57856354

Pulled By: javache

fbshipit-source-id: d76a4779e02f40af69eed156489e57299968d4be
2024-05-28 04:54:09 -07:00
Tomek Zawadzki c73e22142e Expose mapbufferjni via prefab (#44684)
Summary:
The `mapbufferjni` was not exposed via prefab. I'm adding it to make possible for react-native-live-markdown to integrate on top of React Native via prefab. Based on https://github.com/facebook/react-native/issues/36166.

## 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
-->

[ANDROID] [CHANGED] - Expose `mapbufferjni` via prefab.

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

Reviewed By: fabriziocucci

Differential Revision: D57856389

Pulled By: javache

fbshipit-source-id: 9926b02724950f4025c7f867257e8229d44c43a3
2024-05-28 03:19:10 -07:00
Christoph Purrer ea3a7143b9 Align CodegenSchema.d.ts with CodegenSchema.js (#44629)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44629

Changelog: [General][Fixed] Align CodegenSchema.d.ts with CodegenSchema.js

Reviewed By: yungsters

Differential Revision: D57594059

fbshipit-source-id: 554afcb1520e291d5452f330137ea577000f2428
2024-05-27 19:15:42 -07:00
John Mavrantonakis c207708c4b Fix for Clang tidy, needed for fbcode include (#44655)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44655

Required to compile with clang

This is because previously it was comparing size_t with int which is not allowed under compilation with clang

Changelog: [Internal] [Fixed] - Replaced old style for loop with new style to avoid clang errors with size_t to int comparisons

Differential Revision: D57721635

fbshipit-source-id: 2738f7b415d668c37536f7f93b2e0985fa2cc5e6
2024-05-27 12:14:03 -07:00
Alex Hunt 29beea6b57 Split debugger flags into fuseboxEnabledDebug and fuseboxEnabledRelease (#44663)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44663

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D57733525

fbshipit-source-id: 70a7dacb641b75e73bd4f7e18bc5e3d04bc2c508
2024-05-27 09:27:47 -07:00
Alex Hunt 03b8b0997a Rename jsinspector-modern feature flag to fuseboxEnabled (#44661)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44661

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D57730920

fbshipit-source-id: 4761f7e8c2189ff5bfd5fa24891bba20c3750da8
2024-05-27 09:27:47 -07:00
Alex Hunt 352d4b1c83 Add default browser fallback to debugger launch flow (#44673)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44673

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D57726648

fbshipit-source-id: 66eaab1dd0d53fe2befb3dc96d5deb426b86e3e7
2024-05-27 02:53:36 -07:00
Alex Hunt 5d827d83c1 Simplify debugger launch flow to invoke Chrome directly, drop kill API (#44672)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44672

Swaps out and simplifies the internals of the debugger launch flow.

We observed that we could achieve better launch/windowing behaviour by passing the `--app` argument directly to the detected Chrome path.

This shares the user's default Chrome profile:
- Fixes unwanted behaviour such as a separate dock icon on macOS (which, when clicked, would launch an unwanted empty window).
- Enables settings persistence.

This change also removes the `LaunchedBrowser.kill` API.

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D57726649

fbshipit-source-id: fc3a715dc852a50559048d1d1c378f64aeb2013f
2024-05-27 02:53:36 -07:00
Alex Hunt 7e0f86f34b Revert debugger launch behaviour to default profile (#44638)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44638

Reverts the debugger launch flow to use the default `ChromeLauncher` profile. This is the approach used in the current `--experimental-debugger` experiment and by Expo.

This is motivated after a review of the tradeoffs of a guest profile — which allow us to programatically quit the browser process, however takes over system URL handling.

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D57619542

fbshipit-source-id: 3713e1cf8eed61e7a70ed1e4eb58f02da845155f
2024-05-27 02:53:36 -07:00
Alex Hunt a908387b73 Remove inspectorEnableCxxInspectorPackagerConnection flag (#44662)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44662

- Remove `inspectorEnableCxxInspectorPackagerConnection` feature flag.
- Replace existing checks with `getEnableModernCDPRegistry()`.

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D57730921

fbshipit-source-id: fd13b84a826a4fa5973053a721d311c7d68dd2f5
2024-05-26 10:48:48 -07:00
Alex Hunt e363eeb53e Update debugger-frontend from b453d8bd...bf5ec69 (#44675)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44675

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D57782487

fbshipit-source-id: 449180c0fcbb8ef043716bc954f149aec6b2a263
2024-05-26 10:05:58 -07:00
Liron Yahdav 840c31c3a4 Make SystraceSection feed into Instruments signposts API (#44496)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44496

When doing performance profiling on a React Native iOS app and trying to identify bottlenecks on the native side it can be helpful to correlate actions to what is happening inside React Native. We already have the SystraceSection class for this, but it does nothing in open source. This diff allows SystraceSection to feed into the Instruments signpost API on iOS/macOS.

Changelog:
[iOS][Added] - Add Instruments signposts API for SystraceSection

Reviewed By: sammy-SC

Differential Revision: D56280451

fbshipit-source-id: 4e962e932b6b6e09e5953abdc1aa621a2723c91e
2024-05-24 18:39:02 -07:00
Nick Gerleman 91d12d9b99 Revert D57668976: Simplify ReactViewGroup clip to border
Differential Revision:
D57668976

Original commit changeset: 8b8cf956dc86

Original Phabricator Diff: D57668976

fbshipit-source-id: 5147557c1f3561863b1ad9226ca6244ff94cb29c
2024-05-24 11:55:43 -07:00
Peter Abbondanzo ac51deeaf4 Add suppression for deprecated setters and getters (#44676)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44676

Some of the setters and getters in these functions, like [`getStatusBarColor`](https://developer.android.com/reference/android/view/Window#getStatusBarColor), have been marked as deprecated in [`VANILLA_ICE_CREAM`](https://developer.android.com/reference/android/os/Build.VERSION_CODES#VANILLA_ICE_CREAM). This change suppresses deprecation warnings until we can move to newer alternatives.

## Changelog

[Android] [Changed] - Added suppression for deprecated getter/setter usage in StatusBarModule

Reviewed By: sumkit

Differential Revision: D57780503

fbshipit-source-id: 6201f7a3e597fef420de0f80dd2243bee78bc583
2024-05-24 10:41:12 -07:00
Alex Hunt 06461c4ab5 Disable Fusebox in prod builds (temp) (#44664)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44664

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D57737342

fbshipit-source-id: 85bff2d2810e666a97b79b5d1fe598b6f8b68c68
2024-05-24 10:31:18 -07:00
Nishan c13790ff1d feat(android): percentage support in translate (#43193)
Summary:
This PR adds percentage support in translate properties for android. Isolating this PR for easier reviews.

## Changelog:
[Android] [ADDED] - Percentage support in translate
<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

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

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

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

Test Plan:
- Checkout TransformExample.js -> Translate percentage example.
- Added a simple test in `processTransform-test.js`. The regex is not perfect (values like 20px%, 20%px will pass, can be improved, let me know!)

Related PRs - https://github.com/facebook/react-native/pull/43191, https://github.com/facebook/react-native/pull/43192

Reviewed By: joevilches

Differential Revision: D57723216

Pulled By: NickGerleman

fbshipit-source-id: c9da007678341b62745df858f043821bcc662a98
2024-05-24 04:50:41 -07:00
Nick Gerleman 4294b2446a Simplify ReactViewGroup clip to border (#44646)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44646

We can remove most of the code for clipping children to border radius, and recalculating paths, in ReactViewGroup, and rely on the padding box path/rect already set.

I will move this to something more generic up the stack so other native components can reuse this logic.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D57668976

fbshipit-source-id: 8b8cf956dc8689827bccba5e41751b465fd85eeb
2024-05-24 04:42:27 -07:00
Peter Abbondanzo 1cc1673c32 xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/statusbar/StatusBarModule.java (#44656)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44656

## Changelog

[Android] [Changed] - Converted StatusBarModule to Kotlin

Reviewed By: andrewdacenko

Differential Revision: D57614041

fbshipit-source-id: 054b13cd286e9e9b7f870e66ff0e07def075a3c3
2024-05-24 04:35:42 -07:00
Pieter De Baets b2ced62d33 Shortcut emitDeviceEvent in bridgeless (2nd attempt) (#44590)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44590

emitDeviceEvent is frequently used for perf-critical operations such as sending network responses from native to JS. We don't need to go through JavaScriptModule Proxy (which is missing caching in bridgeless) and instead can immediately invoke the callable JS module.

Changelog: [Internal]

Reviewed By: philIip

Differential Revision: D57435750

fbshipit-source-id: 1c120073ac80afd95deb8e3e6f1c00c2d3d80133
2024-05-23 14:57:00 -07:00
Pieter De Baets 1343313dc6 Invoke callableModule factory once (#44576)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44576

Store callable modules as either a factory function or an object, so we can skip invoking the factory function for frequently accessed objects.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D57338528

fbshipit-source-id: cd39ccbe7168c6f093a0e62d5880cbbcd5209c8e
2024-05-23 12:33:41 -07:00
zhongwuzw 3f74f69cf0 Fixes race condition of m_batchHadNativeModuleOrTurboModuleCalls (#44653)
Summary:
Fixes https://github.com/facebook/react-native/issues/44649.

## Changelog:

[IOS] [FIXED] - Fixes race condition of m_batchHadNativeModuleOrTurboModuleCalls

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

Test Plan: Demo in https://github.com/facebook/react-native/issues/44649.

Reviewed By: fabriziocucci

Differential Revision: D57727886

Pulled By: sammy-SC

fbshipit-source-id: 967e2d8452cc477f2225151a46e9aa27698f4506
2024-05-23 11:11:27 -07:00
Samuel Susla 33b064bb9c enable preventDoubleTextMeasure optimisation by default (#44659)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44659

changelog: [internal]

Reviewed By: javache

Differential Revision: D57678341

fbshipit-source-id: cc6fbcfedccc0fd4610d52feee60b0fc35cc83b9
2024-05-23 10:58:01 -07:00
Christoph Purrer b7fc5867f2 Use hasteModuleName for C++ Turbo Module enums (#44631)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44631

Changelog:
[General][Breaking] Use hasteModuleName for C++ Turbo Module enums

This is a follow up to https://github.com/facebook/react-native/pull/44630

This changes the names of C++ Turbo Modules enums to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export enum EnumNone {
  NA,
  NB,
}

export interface Spec extends TurboModule {
  +getStrEnum: (arg: EnumNone) => EnumStr;t
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxEnumNone
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleEnumNone
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

Reviewed By: cipolleschi

Differential Revision: D57602082

fbshipit-source-id: 9ebd68b8059dfbc6e2ec11065915cf049aa3cb0b
2024-05-23 10:23:36 -07:00
szymonrybczak b98c5b960c fix: warn only in init command when CLI uses cached npx version (#44644)
Summary:
In https://github.com/facebook/react-native/pull/37510, a check was introduced to check if user is using `latest` version of `npx`, but right now it checks for every command executed, but it should only ensure that `latest` is included when creating a new project.

In this Pull Request I've added a condition to only warn if `init` was fired.

## Changelog:

[GENERAL] [FIXED] - Warn only in `init` command when CLI uses cached `npx` version

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

Test Plan: Warning about using `latest` version CLI should only be presented when running `init` command.

Reviewed By: arushikesarwani94

Differential Revision: D57681864

Pulled By: blakef

fbshipit-source-id: 5c81b9a08141396efcd24539b2560cea16028dd9
2024-05-23 09:43:02 -07:00
Christoph Purrer 053e302a00 Enable Plugin support for (RCT)SampleTurboModule (#44641)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44641

Changelog: [iOS][Fixed] Enable Plugin support for (RCT)SampleTurboModule

Reviewed By: javache

Differential Revision: D57625901

fbshipit-source-id: fe57777970b3b342be77ea9bb4e8e3f95d66471a
2024-05-23 09:41:46 -07:00
Moti Zilberman 5a6b64f2f9 Do not strip CxxInspectorPackagerConnection.DelegateImpl methods (#44650)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44650

Changelog: [Internal]

Adds the missing `DoNotStrip` annotations to methods of `CxxInspectorPackagerConnection.DelegateImpl` that are called from C++.

Reviewed By: huntie

Differential Revision: D57708376

fbshipit-source-id: 8a72b19211b60ce7a6049079e5ecfc2e96bc974f
2024-05-23 05:02:46 -07:00
Christoph Purrer 07261d0408 Use hasteModuleName for C++ Turbo Module structs (#44630)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44630

Changelog:
[General][Breaking] Use hasteModuleName for C++ Turbo Module structs

This changes the names of C++ Turbo Modules structs to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export type ValueStruct = {
  x: number,
  y: string,
  z: ObjectStruct,
};

export interface Spec extends TurboModule {
  +getValueStruct: () => ValueStruct
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxValueStruct
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleValueStruct
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

## Why?
- The `Cxx` extension is a temporary hint to react-native-codegen to enable extra capabilities and might disappear eventually
- The C++ base struct name should be 'stable'
- The name of the exported TM JS spec `TurboModuleRegistry.get<Spec>(...)` is abritrary, the hasteName is not
- The name of the RN JS TM spec must start with `Native` which better guarantees a consistent naming scheme for these generated base class
- The C++ Turbo Module base class has now the same prefix as the generated structs - `NativeMyAbcModule` for the example above

Reviewed By: cipolleschi

Differential Revision: D57599257

fbshipit-source-id: 4fafe6c7e920737fa766bd7e8e68e521f608e775
2024-05-23 03:28:52 -07:00
Fabrizio Cucci 95de14dc53 Drop unused code + minor lint fixes (#44645)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44645

Changelog: [Internal]

As per title.

Reviewed By: NickGerleman

Differential Revision: D57664819

fbshipit-source-id: 2388bd01c00d814a12de7f2e285b78f207e6012c
2024-05-22 12:11:33 -07:00
Rubén Norte b8f3478b37 Implement re-entrancy and unlocked scenarios for LazyShadowTreeRevisionConsistencyManager (#44620)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44620

We added a log message when trying to lock revisions in `LazyShadowTreeRevisionConsistencyManager` when they were already locked, and we've seen that being logged in existing experiments, which could indicate we're doing re-entrance from the JS runtime.

This protects against that case migrating the boolean flag to an integer.

Changelog: [internal]

Reviewed By: NickGerleman

Differential Revision: D57509193

fbshipit-source-id: 1712aa84d665c9dfe50630818e7f56de7d7e145c
2024-05-22 10:26:55 -07:00
Rubén Norte 98bf5ef080 Implement thread-safety for LazyShadowTreeRevisionConsistencyManager (#44619)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44619

Some methods in `LazyShadowTreeRevisionConsistencyManager` can be called in parallel when using synchronous state updates (which is also behind a flag). This implements thread-safety to cover that case so we don't have issues when testing that variant in production.

Changelog: [internal]

Reviewed By: NickGerleman

Differential Revision: D57506540

fbshipit-source-id: 362e1df534bc8c87289882236cfe0d7ee261f507
2024-05-22 10:26:55 -07:00
Jorge Cabiedes Acosta 494c86eb02 Add <named-color> to CSSParser (#44623)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44623

The syntax for <color> is defined as (https://www.w3.org/TR/css-color-4/#color-syntax):

```
<color> = <color-base> | currentColor | <system-color>

<color-base> = <hex-color> | <color-function> | <named-color> | transparent
<color-function> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hwb()> | <lab()> | <lch()> | <oklab()> | <oklch()> | <color()>
```

This diff implements in particular:
```
<color-base> = <named-color>
```

We create a map containing all hex value representations of each named color and directly return the RGBA Values

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D57553237

fbshipit-source-id: 7b5bbaf77424cc4a4c833d107ef89601f9fcd9a9
2024-05-22 09:12:51 -07:00
Moti Zilberman 9dfcb9ec3a Generate object previews for live console messages
Summary:
Changelog: [Internal]

bypass-github-export-checks

Currently, Hermes never generates object/array previews for values logged via the `console` API. This makes console logs significantly less readable than in Chrome. Here we enable the preview generation machinery that already exists in Hermes.

We conservatively mimic V8's behaviour of [only generating previews for immediately-emitted messages](https://source.chromium.org/chromium/chromium/src/+/main:v8/src/inspector/v8-console-agent-impl.cc;l=53,64;drc=451a101b0a8bbc323dbf5697dd956b55284ec9ee) and not for buffered messages. I don't know *why* V8 does this, but can only guess it's meant to improve the performance of starting a debugging session, by evaluating less code and sending smaller payloads. (Anyway, we can change our decision later.)

Reviewed By: dannysu

Differential Revision: D57617059

fbshipit-source-id: 1f5a71ce98ac915a5b874ed6c009d971405a9f2d
2024-05-21 15:17:34 -07:00
Joe Vilches ed3f2f40e1 Fix small props parsing bug for filter (#44637)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44637

Setting the wrong thing to {}. `result` should be set here just like in the other early returns.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D57617046

fbshipit-source-id: e47dbdb7821879ffa02d11b7e68eec1c9bfbdefd
2024-05-21 14:04:01 -07:00