Commit Graph

12270 Commits

Author SHA1 Message Date
Ramanpreet Nara c0375b8dad CxxReactPackage: Make initHybrid static (#41681)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41681

## Rationale

Make initHybrid static. So that the derived class can initialize the C++ part with constructor arguments.

**Note:** This diff just applies the fix from D51550623. into CxxReactPackage.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D51642219

fbshipit-source-id: 095e452e03848379288af960969789aa5e9c0542
2023-11-29 10:28:53 -08:00
Nicola Corti bae52388d2 Fix broken RN Tester custom ViewManager (#41708)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41708

RN-Tester is currently instacrashing due to a method accepting a `Float?` rather than a `Float`.
`Float` from Kotlin gets converted to Java's `float`, while `Float?` gets converted to the boxed type, which is not recognized by the framework and is making the app crash.

On top of this, the implementation of `setColor` was wrong as we don't properly handle the null case. Fixing it here as well.

Changelog:
[Internal] [Changed] - Fix broken RN Tester custom ViewManager

Reviewed By: NickGerleman

Differential Revision: D51667346

fbshipit-source-id: b7498a520936f81a0524ba53dc7230ad7ef57bf8
2023-11-29 09:40:05 -08:00
Moti Zilberman 54761213f6 Stop logging CREATE_I18N_ASSETS_MODULE events (#41703)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41703

TSIA

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D51661861

fbshipit-source-id: 6fd5e253d9113f6acf7f4fe889f35f9aa580797e
2023-11-29 08:18:50 -08:00
Marcel Canhisares 3654089b0e (refactor): kotlinify layout property applicator test (#41649)
Summary:
This PR converts to kotlin the java code for LayoutPropertyApplicatorTest, as requested in: https://github.com/facebook/react-native/issues/38825

## Changelog:

[INTERNAL][CHANGED]: Convert LayoutPropertyApplicatorTest to Kotlin

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

Test Plan: `./gradlew :packages:react-native:ReactAndroid:test `

Reviewed By: rshest

Differential Revision: D51614921

Pulled By: cortinico

fbshipit-source-id: 06ee403a496f34afc9abeabc0c406391e316538a
2023-11-29 07:25:26 -08:00
Oskar Kwaśniewski 4ccd6e1242 feat: allow OOT platforms to use custom resolver.resolveRequest (#41697)
Summary:
Currently, when we have an additional platform in `react-native.config.js`, users cannot use custom `resolver.resolveRequest` functions as they are overwritten by `reactNativePlatformResolver`. Goal of this PR is to allow OOT platforms to use additional custom resolvers besides remapping react native imports.

## Changelog:

[GENERAL] [FIXED] - Allow Out Of Tree platforms to pass custom resolvers

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

Test Plan:
1. Add additional platform in `react-native.config.js`
2. Pass custom resolver to `metro.config.js`:

```js
resolveRequest: (context, moduleName, platform) => {
      console.log('resolveRequest', moduleName, platform);
      return context.resolveRequest(context, moduleName, platform);
 }
```
3. Check if user's `resolveRequest` function is called.

Reviewed By: huntie

Differential Revision: D51659721

Pulled By: robhogan

fbshipit-source-id: 952589b59a6fa34e9406d36c900be53a7c1a79c3
2023-11-29 05:53:54 -08:00
Will Schurman bb075d785d Fix android root view group removal during instance re-creation (#41678)
Summary:
This is my proposed solution to https://github.com/facebook/react-native/issues/41677.

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

## Changelog:

[ANDROID] [FIXED] - Fix android root view group removal during instance re-creation

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

Test Plan:
Both with fabric enabled and disabled (new architecture):

1. Clone repro repo: https://github.com/wschurman/rn-reload-repro
2. Build and run on android (I use android studio)
3. Click reload button, see timestamp doesn't change (indicating that the view is not removed)
4. Apply this PR as a patch.
5. Re-build and run.
6. Click reload button, see view is correctly disposed of and the new view is set.

Reviewed By: cortinico

Differential Revision: D51658524

Pulled By: javache

fbshipit-source-id: d9a026cde677ad1ec113230bc31bd9297bca8bfc
2023-11-29 04:53:31 -08:00
Riccardo Cipolleschi 4a35f2512e Make sure that third party libraries include Fabric code (#41669)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41669

In some previous changes ([a607692](https://github.com/facebook/react-native/commit/a6076924bf43dff6cf4d38d51df279edba3882d0) and [6b53205](https://github.com/facebook/react-native/commit/6b5320540adfe16803ef41353f23115d08819309)) we make sure to always include all the pods (including Fabric) and we unify codegen to run in the same way on both architectures.
While doing so, we enabled codegen to run on libraries tat already migrated to Fabric.
These makes those libraries to fail when building as they were not including the Fabric code when the New Architecture is disabled.

This change will make sue that the code is always included, thus the library should always build, and it also make sure that we can control the New/Old Architecture at build time.

## Changelog
[iOS][Changed] - Make sure that libraries always include Fabric code also in the old architecture

Reviewed By: dmytrorykun

Differential Revision: D51617542

fbshipit-source-id: 883d1e258c341feb0405ad389bb8af34d64b59b8
2023-11-29 04:17:48 -08:00
Arushi Kesarwani 667d85bdda Refactor DefaultReactNativeHost to use the new way of Fabric initialization (#41496)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41496

Refactoring `DefaultReactNativeHost` to use the new way of Fabric initialization through `FabricUIManagerProviderImpl`

Reviewed By: christophpurrer

Differential Revision: D51224854

fbshipit-source-id: 2af8021404365fa2adc9388f44bcc7c6301137dc
2023-11-28 23:34:57 -08:00
Nick Gerleman 56b57e2db4 Ship "disableScrollEventThrottleRequirement" (#41676)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41676

This has been used in a significant amount of production for about 2 months, with no consistently statistically significant metric impact. Let's ship it.

Note that we would not want to keep this change in a holdout if we remove the warning, since new usages could be added that relied on the behavior not in the holdout.

It didn't seem worth the churn to make the same change to Paper, which leaves a question on how to handle the JS-side warning. Instead of jimmying in impl detection, I thought it might be more sane to remove the warning, though that also has a potential hit to Paper DevX.

Changelog:
[iOS][Changed] - `scrollEventThrottle` no longer needs to be set for continuous scroll events when using the new architecture.

Reviewed By: javache

Differential Revision: D51608970

fbshipit-source-id: 193019de208f3088519e6f6333dbec4e6b45a1eb
2023-11-28 20:06:12 -08:00
Xin Chen 44109dc2c0 Fix warm start logging for ReactMarker (#41693)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41693

This diff fixes app warm start time. Before this change, we cache the first time when app start timing is logged, and ignore future loggings. Some apps are warm started and the startup time should be updated.

Reviewed By: dmitry-voronkevich

Differential Revision: D50481710

fbshipit-source-id: 03e00b75ee7ac578209ae3478adabe567e92a950
2023-11-28 19:27:51 -08:00
Nick Gerleman 88a55baeaa Change default back to position: "relative" (#41480)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41480

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

The previous version of static didn't do anything inside of Yoga. Now that we're making it do something, this changes the default back to relative so that users with no errata set don't see their deafult styles changing.

Reviewed By: joevilches

Differential Revision: D51182955

fbshipit-source-id: c0ea357694e1367fb6786f1907dfff784b19a4bc
2023-11-28 18:51:34 -08:00
Nick Gerleman fa436b4a63 Explicitly default Fabric to position: "static" (#41481)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41481

This will allow us to keep RN on it's "pseudo-static" mode, while changing the Yoga default back to relative, to avoid breaking existing layouts.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D51182861

fbshipit-source-id: 25489d7f0642c4ff78340438c2b266e95a5fb207
2023-11-28 18:51:34 -08:00
Arushi Kesarwani 2ddd9cd5f5 Adding getFabricUIManager() APIs to ReactContext (#41506)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41506

Adding APIs for `getFabricUIManager()` to ReactContext and it's subclasses. This will replace the `getJSIModule()` post JSI module deletion.

Thereby replacing the callsite to context.getFabricUIManager() in UIManagerHelper.

NOTE: This still has fallback to getJSIModule() in case the UIManagerProvider is not set

Changelog:
[Internal] internal

Reviewed By: philIip

Differential Revision: D50926218

fbshipit-source-id: f311affb0f82895b254fd4664aa8ea23ab31bac0
2023-11-28 18:29:04 -08:00
Neil Dhar 02b94476af Handle UTF8 in native exception message (#41575)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41575

We currently do not validate the incoming native exception message
before passing it to the char* constructor of TwineChar16.

Treat it as UTF-8 and convert it to UTF-16 before creating the
JavaScript exception.

Changelog: [Internal]

Reviewed By: tmikov

Differential Revision: D49551640

fbshipit-source-id: 762f8038b29818d804bda5a7f3b4762621c94336
2023-11-28 16:50:06 -08:00
Ramanpreet Nara 9e4fa20b75 Extend default tmmdelegate to support many cxxreactpackages (#41680)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41680

Just like how React Native can have n ReactPackages, it will support n CxxReactPackages.

This way, many applications can share common CxxReactPackages.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D51484844

fbshipit-source-id: b9b70cab719e80a7ff7e635057d710f1a86fb1c9
2023-11-28 16:46:27 -08:00
Rubén Norte 40c7736a1d Fix incorrect wrapping of refs in Image component (#41679)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41679

This fixes a bug in the original implementation of image attached callbacks (still experimental). The problem was that we were unconditionally caching the ref passed to the underlying image component, which meant that whenever users passed new ref setters we wouldn't call them again.

This fixes that by forcing the creation of a new ref value whenever a new ref is passed to the image component.

Changelog: [internal]

Reviewed By: jehartzog

Differential Revision: D51618512

fbshipit-source-id: ac15160c528563c2131e8b3444dea4a6096f20bc
2023-11-28 16:36:35 -08:00
zhongwuzw aa9e824a75 Move ActionSheet UI operation to main thread (#41666)
Summary:
Fixes UI operation not on the main thread.
![image](https://github.com/facebook/react-native/assets/5061845/276f7e9c-dcf8-4ba1-af2d-c9fa990d41a1)

![image](https://github.com/facebook/react-native/assets/5061845/cfe85921-3cc9-4f32-b794-a6a8bc00ee1d)

## Changelog:

[IOS] [FIXED] - Move ActionSheet UI operation to main thread

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

Test Plan: None.

Reviewed By: philIip

Differential Revision: D51613525

Pulled By: cipolleschi

fbshipit-source-id: e5f543bbcc9bc0f5b6dda5bc2deb20279e851946
2023-11-28 15:14:54 -08:00
Ramanpreet Nara 129bd9d813 Ensure C++ default tmmd can access the CxxReactPackage (#41673)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41673

## The Problem
The cxxReactPackage property isn't initialized by the time initHybrid was executed. So, initHybrid was being called with null as the cxxReactPackage.

Why;
1. The default turbomodule manager delegate receives cxxReactPackage as a constructor param.
2. Java then executes all the constructors of the class hierarchy. This executes initHybrid.
3. Java finally initializes the properties of the derived class: default tmmd.cxxReactPackage (i.e: the parameter to initHybrid). **This is too late**

## The Fix
Refactor the code such that hybrid data creation doesn't depend on property initialization:
1. Create a static initHybrid method in default tmmd.
2. Call this static method with the cxxReactPackage, and assign the resultant HybridData to mHybridData (in tmmd).

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D51550623

fbshipit-source-id: ed2b7587351cfca408cda3c8cef4dcf7547e5f1e
2023-11-28 13:17:22 -08:00
Ramanpreet Nara 4c1bdea81d CxxReactPackage: Load So's during class loads (#41674)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41674

The problem: The Java runtime couldn't find CatalystCxxReactPackage.initHybrid.

Why: I think is because CxxReactPackage loads CatalystCxxReactPackage's so in its constructor. This might be too late to load the derived class's so.

So, I just switched derived delegates to load the so in the static initializer (i.e: the recomended approch for so loading):

https://www.internalfb.com/code/fbsource/[91c4e41c49ed191ac864250ccaec52c01ddaeccc]/fbandroid/libraries/soloader/java/com/facebook/soloader/SoLoader.java?lines=52-54%2C60-61%2C63-67

This way:
1. The So's are loaded plenty early (the method not found error went away).
2. We don't create our own so loading infra, which complicates this abstraction, and makes it harder to work with, even more.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D51550622

fbshipit-source-id: f4782d6fa9387f21fbf611191e9483e2a58b3a34
2023-11-28 13:17:22 -08:00
Ramanpreet Nara 00e70354ca CxxReactPackage: Use hungarian notation for hybridData (#41675)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41675

FBJni expects the HybridData object to exist on the mHybridData property of the java object. So, we have to call this propery mHybridData.

Otherwise, this fbjni class just won't work.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D51550621

fbshipit-source-id: d169266474717f0a38799ede7c07af57461012b7
2023-11-28 13:17:22 -08:00
Nicholas Block 528f97152b Backout - Schedule a Choreographer callback only if there is ongoing animation
Summary: caused performace problems with react app

Reviewed By: gpalves

Differential Revision: D51617862

fbshipit-source-id: 38c0c06dacdd7aa862fd523a7ce136e54ed55fa2
2023-11-28 08:57:23 -08:00
Samuel Susla a8fc20616f do not use ShadowNode::defaultSharedProps in UIManager::clone (#41667)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41667

changelog: [internal]

I made a mistake during refactor in D51471667 where I removed the check if rawProps is nullptr. We must check if props are empty during `UIManager::clone`, leaving the check for `ConcreteComponentDescriptor::cloneProps` does not lead to the same result.

There is a deeper problem here that needs to be analysed but this should resolve the lunch blocker.

Reviewed By: javache

Differential Revision: D51614396

fbshipit-source-id: 055694c4a71a914d8732a3632c50026cc24cbe7d
2023-11-28 08:10:17 -08:00
Nicola Corti 25196ba24f Fix several build warnings on RN Tester Android (#41660)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41660

While working on other things, I noticed those warnings firing on console which I'm fixing here.

Changelog:
[Internal] [Changed] - Fix several build warnings on RN Tester Android

Reviewed By: cipolleschi

Differential Revision: D51589072

fbshipit-source-id: 1ddb29afd0d150f1ccbc7a8def9f27ecedb69724
2023-11-28 07:08:54 -08:00
Nicola Corti 4f3094aba4 Kotlin to 1.8.22 (#41661)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41661

This aligns the Kotlin version used inside fbsource to the one used for React Native GitHub

Changelog:
[Internal] [Changed] - Kotlin to 1.8.22

Reviewed By: NickGerleman

Differential Revision: D51587726

fbshipit-source-id: 5f985bd50c7688e4d369184b79dbf1bdc799876e
2023-11-28 03:53:47 -08:00
Gabriel Donadel 94c7661206 Update 'cannot calculate shadow efficiently' log message (#39700)
Summary:
While working in an app I kept getting these `View X of type Y has a shadow set but cannot calculate shadow efficiently. Consider setting a background color to fix this` warnings even though I had added a background color to that view. Upon inspecting RCTView.m I notice that what is actually required to fix this is a solid background

To make this a bit clearer to developers I believe we should update this log message to explicitly say "solid background" instead of "background"

## Changelog:

[IOS] [CHANGED] - Update 'cannot calculate shadow efficiently' log message to explicitly say solid background

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

Test Plan: N / A

Reviewed By: christophpurrer

Differential Revision: D51584574

Pulled By: javache

fbshipit-source-id: b1741f7002ebb876e4a50959bef7f39df76a5c3c
2023-11-28 03:24:25 -08:00
Nick Gerleman 9078db77a9 Remove NumericBitfield (#41394)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41394

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

Now that are enums are unsigned, and we don't have BitfieldRef, we can convert the last remaining user of NumericBitfield to a plain old bitfield,  for better readability (e.g. the default values), debugability, and less complexity. We also break a cycle which lets us properly group public vs private members.

Reviewed By: joevilches

Differential Revision: D51159415

fbshipit-source-id: 7842a8330eed6061b863de3f175c761dcf4aa2be
2023-11-27 21:20:20 -08:00
Nick Gerleman 495fee4ff2 Remove yoga::Style::BitfieldRef (#41393)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41393

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

Removes the last of the non setter-style style setters.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D51155925

fbshipit-source-id: 2921c87d95ad36495b7013e592d5169015321545
2023-11-27 21:20:20 -08:00
Nick Gerleman 3294bc737c Remove yoga::Style::Ref (#41389)
Summary:
X-link: https://github.com/facebook/yoga/pull/1462

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

Moves the last usages of `yoga::Style::Ref` to setters.

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D51154501

fbshipit-source-id: 52dbca7a76de500a8841387eb59fded463864de7
2023-11-27 21:20:20 -08:00
Oskar Kwaśniewski dc36be335f chore: remove duplicated pod 'Yoga' in RNTester (#41627)
Summary:
This PR removes duplicated `pod 'Yoga'` as it is already declared in `use_react_native`.

## Changelog:

[INTERNAL] [REMOVED] - duplicated pod 'Yoga' in RNTester

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

Test Plan: CI Green

Reviewed By: christophpurrer

Differential Revision: D51603340

Pulled By: NickGerleman

fbshipit-source-id: 89e77e5a544cb54d77b969462130725853b36d5d
2023-11-27 16:53:31 -08:00
Phillip Pan 09a289542c dispatch RCTNativeAnimatedTurboModule methods onto UIManager queue (#41472)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41472

Changelog: [Internal]

this module doesn't work correctly with synchronous void methods, fixing it here

Reviewed By: cipolleschi

Differential Revision: D51293023

fbshipit-source-id: 86b19eceac8f28142351961e061f07f57ed98bca
2023-11-27 15:04:20 -08:00
Nicola Corti e979a456eb AGP to 8.1.4 (#41662)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41662

This bumps AGP to the latest bugfix version

Changelog:
[Internal] [Changed] - AGP to 8.1.4

Reviewed By: NickGerleman

Differential Revision: D51589071

fbshipit-source-id: cd62c94a75b1718572acd1f45f817b16b7d5ed11
2023-11-27 14:52:15 -08:00
Bill Alves 86c5abac2a avoid scheduling frame callback if there are no events (#41658)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41658

changelog: [internal]

FabricEventDispatcher does not need to run on every frame. Whenever a new event is added to Fabric's event queue, it will call `FabricUIManager.onRequestEventBeat` in Java. This in turn calls `FabricEventDispatcher.maybePostFrameCallbackFromNonUI` and adds a frame callback on the Choreographer.

This makes code simpler, as we do not need to manage the frame callback subscription.

Reviewed By: sammy-SC

Differential Revision: D50604303

fbshipit-source-id: ce2c7b77678bfc14aa7ecac71e40f78263c7036a
2023-11-27 11:49:47 -08:00
Riccardo Cipolleschi 3a045b6026 Unify usage of USE_HERMES flag (#41625)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41625

To tell React Native whether we are building with hermes or not on iOS, we were using 2 different build time flags:
- USE_HERMES
- RCT_USE_HERMES

The first was widely used by the OSS use case, while the latter was set internally.
Worse than that, their default values were the opposite and we were never setting the RCT_USE_HERMES explicitly with Cocoapods, while there was some piece of code that was trying to "smartly" detect whether Hermes was included or not.

This change unifies the behavior, removing the "smartness" in favor od a declarative approach.

## Changelog:
[Internal] - Unify the USE_HERMES flags

Reviewed By: christophpurrer

Differential Revision: D51549284

fbshipit-source-id: 829ad361e185d5b4fa227605523af3a8e590e95c
2023-11-27 10:46:13 -08:00
Riccardo Cipolleschi 6d9d6def98 Back out "RNTester-ios / RCTAppDelegate > correctly check for USE_HERMES Flag" (#41626)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41626

In the codebase, we never set the RCT_USE_HERMES flag.

When we install the pods, we use the USE_HERMES flag and we set USE_HERMES as a build setting. So, the RCT_USE_HERMES flag will always be not set for the OSS.

https://pxl.cl/3RRxr

## Changelog:
[iOS][Fixed] - use the right USE_HERMES flag

## Facebook:
This change was incorrect as in OSS we never set the RCT_USE_HERMES flag, while we actually set the USE_HERMES one.

I will align the BUCK RNTester setup in the next diff of the stackog:

Reviewed By: dmytrorykun

Differential Revision: D51547810

fbshipit-source-id: 1da5b3a48a83a8ba49cf65382927bed2f9fc893d
2023-11-27 10:46:13 -08:00
Bill Alves f9315c6ee1 Schedule a Choreographer callback only if there is ongoing animation
Summary:
changelog: [internal]
From sammy-SC, we would like to minimize the number of times that React Native schedules Choreographer calls. For animations, we do not need choreographer running on every frame, it only needs to run on frames that have an animation active. This diff modifies the frame callbacks such that Choreographer calls are only enqueued if there is an ongoing animation.

Reviewed By: sammy-SC

Differential Revision: D50647971

fbshipit-source-id: d77b246beafc5c658c738e574b0e02dd68fadce9
2023-11-27 10:41:10 -08:00
Dmitry Rykun eb7e10bc0e Refactor generate-artifacts-executor.js: give library lookup functions more accurate names (#41560)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41560

This diff gives some functions and variables more accurate names:
1. `appRoot` -> `projectRoot`
2. `handleThirdPartyLibraries` -> `findExternalLibraries`
3. `handleLibrariesFromReactNativeConfig` -> `findLibrariesFromReactNativeConfig`
4. `handleInAppLibraries` -> `findProjectRootLibraries`

It also removes `isAppRootValid` check that checks that `appRoot != null`, it is redundant since `appRoot`(now `projectRoot`) is required by the CLI.

	Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D51309027

fbshipit-source-id: c5e34c2aa788a7795c68697a0fa9ddf0163cec0e
2023-11-27 09:45:55 -08:00
Dmitry Rykun 834447424f Refactor generate-artifacts-executor.js: process react-native as a normal dependency (#41558)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41558

Now that the previous diff in the stack (D51303793) provides proper dependency path resolution, we can process `react-native` as a normal dependency, and remove a special code path for it.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D51256764

fbshipit-source-id: 2a11641e9362d7bfad1ff9995b4f3bb4c92d9c0f
2023-11-27 07:37:56 -08:00
zhongwuzw 03a840e0a9 Update AcitvityIndicator spec default value (#41638)
Summary:
Update AcitvityIndicator spec default value. https://reactnative.dev/docs/activityindicator

## Changelog:

[GENERAL] [FIXED] - Update AcitvityIndicator spec default value

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

Test Plan:
Codegen generates native code correctly.
![image](https://github.com/facebook/react-native/assets/5061845/ae087e06-d996-4aa1-bd41-da84bc50bdd7)

Reviewed By: christophpurrer

Differential Revision: D51584438

Pulled By: javache

fbshipit-source-id: ee0df8314597457fd35f86008a96264be3f761ba
2023-11-27 07:09:34 -08:00
Dmitry Rykun ca39a11b27 Refactor generate-artifacts-executor.js: delete handleLibrariesFromReactNativeConfig (#41654)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41654

This diff removes support for defining external codegen targets in `react-native.config.js` for iOS. Now  you can simply add your external dependency to the project's `package.json` and it will be resolved as a normal Node packages.

## Motivation

The need for defining external codegen targets in `react-native.config.js` historically appeared due to limitations of how codegen searched for external dependencies. Basically we performed search only in the project directory. External dependency paths had to be listed in `react-native.config.js`.

After D51303793 has landed we don't need this any longer. We can simply rely on Node resolution to find those external dependencies.

Changelog: [iOS][Breaking] - Defining external codegen targets in `react-native.config.js` is not supported anymore. Define them as normal dependencies in `package.json`.

Reviewed By: cipolleschi

Differential Revision: D51308595

fbshipit-source-id: 97841a3a8c295aa717c577bb188d48373b04ba38
2023-11-27 06:57:53 -08:00
Christoph Purrer ef9c164f5f Simplify C++ TM struct generation (#41645)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41645

Right now, when defining concrete structs and Bridging headers for Cxx TMs we need to define their member types twice:
```
using ConstantsStruct =
    NativeCxxModuleExampleCxxBaseConstantsStruct<bool, int32_t, std::string>;

template <>
struct Bridging<ConstantsStruct>
    : NativeCxxModuleExampleCxxBaseConstantsStructBridging<
          bool,
          int32_t,
          std::string> {};
```
Now we only need to define those once
```
using ConstantsStruct =
    NativeCxxModuleExampleCxxConstantsStruct<bool, int32_t, std::string>;

template <>
struct Bridging<ConstantsStruct>
    : NativeCxxModuleExampleCxxConstantsStructBridging<ConstantsStruct> {};
```

This change keeps the existing base types untouched - but they will be removed in the next RN version.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D51571453

fbshipit-source-id: 2783bd48bf786ffa80d322d06456b5d6f2d7ba8a
2023-11-27 03:43:28 -08:00
Intl Scheduler b50a7093bc translation auto-update for i18n/fb4a.config.json on master
Summary:
Chronos Job Instance ID: 1125907943844335
Sandcastle Job Instance ID: 1121001921
allow-large-files
ignore-conflict-markers
opt-out-review

Differential Revision: D51576545

fbshipit-source-id: 726fda7e125295492881cb43bfbd7249cdf0b022
2023-11-26 08:33:33 -08:00
Nick Gerleman b5f04d11e8 YGEdge -> yoga::Edge (#41391)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41391

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

Converts usages of `YGEdge` within internal APIs to `yoga::Edge` scoped enum.

With the exception of YGUnit which is in its own state of transition, this is the last public yoga enum to need to be moved to scoped enum form for usages internal to the Yoga public API.

Changelog: [internal]

Reviewed By: rshest

Differential Revision: D51152779

fbshipit-source-id: 06554f67bfd7709cbc24fdd9a5474e897e9e95d8
2023-11-25 20:41:22 -08:00
Nick Gerleman 925525a719 Use CSS terminology for sizing rules (#41390)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41390

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

Yoga passes `MeasureMode`/`YGMeasureMode` to express constraints in how a box should be measured, given definite or indefinite available space.

This is modeled after Android [MeasureSpec](https://developer.android.com/reference/android/view/View.MeasureSpec), with a table above `calculateLayoutImpl()` explaining the CSS terms they map to. This can be confusing when flipping between the spec, and code.

This switches internal usages to the CSS terms, but leaves around `YGMeasureMode` since it is the public API passed to measure functions.

Reviewed By: joevilches

Differential Revision: D51068417

fbshipit-source-id: 0a76266a4e7e0cc39996164607229c3c41de2818
2023-11-25 20:41:22 -08:00
Nick Gerleman 237b94cddc CompactValue -> Style::Length (#41392)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41392

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

We're moving `CompactValue` to be an internal detail of `yoga::Style`, where users outside of the style will be dealing with a resolved/non-compact representation.

This change renames usages of `CompactValue` to `Style::Length`, which will be Yoga's representation for CSS input lengths. Right now one is just a type alias of the other, but this will let us change the internals of CompactValue with the rest of the world looking the same.

A few factory functions are added to `yoga::value` for creating CSS values. There are some shenanigans around how we want to represent CSS pixels (one YGUnitPoint), when we also end up adding CSS points (slightly larger than one YGUnitPoint). For now, I reused `point` until making other changes.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D51000389

fbshipit-source-id: 00f55e72bfb8aa291b53308f8a62ac8797be490f
2023-11-25 20:41:22 -08:00
Riccardo Cipolleschi caae388912 Fix React-Codegen dependencies on FabricImage (#41640)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41640

react-native-svg reported that the SVG library was not building on the latest RC of React Native because Codegen was not finding the proper files.

By inspecting an example app with SVG, we realized that React-Codegen was not depending on `React-FabricImage`, while having access to their headers.

We added the dependency, but them the build was failing due to a circular dependency because the `React-ImageManager` was dependeing on `React-RCTImage`.
This dependency is conceptually wrong (a piece of Core should not depend on Library which depends on Core... 😑) and I verified that by removing that dependency the framework continue to build.

## Changelog:
[Internal] - Fixed dependencies of Codegen on React-Image

Reviewed By: cortinico

Differential Revision: D51564037

fbshipit-source-id: 8e7108b83f878be1063df5562311d862d4998121
2023-11-25 11:39:15 -08:00
Nick Gerleman 4016bfbc37 Fix AndroidTextInputProps Detection of Padding (#41643)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41643

Code in `AndroidTextInputComponentDescriptor` will rewrite Yoga props for padding based on Android theme, if a value isn't supplied. It determines this by adding props in `AndroidTextInputProps` which reads Yoga RawProps to tell if they were set.

RawProps are keyed using separate prefix/name/suffix, instead of the combined string name of the prop. This means that searching for the name `paddingLeft`, would be different from reading one with a name of `padding` and a suffix of `Left`.

This updates the keying, based on the changes in D51510562.

We should refactor this in the future (D20109605, introducing this code, admitted as much). We already have a phase, for aliased props, where we transform input props into the Yoga style (they don't need to be 1:1). This doesn't depend on RawProps, extra props, or prop mutations.

Changelog:
[Android][Fixed] - Fix AndroidTextInputProps Detection of Padding

Reviewed By: GijsWeterings

Differential Revision: D51566900

fbshipit-source-id: ca744b23d71382941903da42d86ad3eef7b65de8
2023-11-25 11:09:53 -08:00
Moti Zilberman c464b215e5 Create JSRuntime interface (#41549)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41549

Changelog: [Internal]

Introduces the `JSRuntime` interface as a straightforward wrapper around `jsi::Runtime`, and refactors `ReactInstance` to hold a `JSRuntime` instead of a `jsi::Runtime`. In an upcoming diff we'll add debugging-related methods to `JSRuntime` and specialise their implementations for Hermes.

NOTE: `JSRuntime` is somewhat analogous to `JSExecutor` in the Bridge architecture.

Reviewed By: huntie

Differential Revision: D51447934

fbshipit-source-id: cfcab9ae0dd3d2a34c064abaac6cb676f435e216
2023-11-24 12:04:59 -08:00
Kevin Gozali 0363485069 RNTester: add the ability to open a specific example from incoming URL (#41642)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41642

This allows opening an example within RNTester without tapping the module card. If the app receives an openURL request with the format `rntester://example/<key>`, open that example (if exists) directly. Such URL request may come from various sources (e.g. custom test run, etc).

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D51543385

fbshipit-source-id: f9a01963cefb4602b629da0b01be6e334c28a912
2023-11-24 11:37:37 -08:00
Samuel Susla 67c852e82f filter out yoga style props during folly::dynamic conversion (#41607)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41607

X-link: https://github.com/facebook/hermes/pull/1198

changelog: [internal]

Reviewed By: javache

Differential Revision: D51471665

fbshipit-source-id: 0633422d356c2f2419ea87b2a2ad6b5ea64c99f6
2023-11-24 04:09:14 -08:00
Intl Scheduler e441b06c68 translation auto-update for i18n/fb4a.config.json on master
Summary:
Chronos Job Instance ID: 1125907943766151
Sandcastle Job Instance ID: 36028798137823401
allow-large-files
ignore-conflict-markers
opt-out-review

Differential Revision: D51557751

fbshipit-source-id: 388d4f43881424ff389cc541602730aa32199693
2023-11-23 23:35:40 -08:00