Commit Graph

12270 Commits

Author SHA1 Message Date
Pieter De Baets f1dc061fce Use defaultSharedProps in ComponentView init (#41623)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41623

`static` fields require additional code to ensure the field is only ever initialized once. We already have a static "default props" field in the shadow node, so let's reuse that as much as possible.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D51547638

fbshipit-source-id: e4957ffb0f9352847b8cd8dc3a010dcfac8be699
2023-11-23 14:05:17 -08:00
Ruslan Shestopalyuk 342041e9ee Fix static view config not to filter out "onClick" events on Android (#41628)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41628

# Changelog:

Even though `onClick` is used on Android (e.g. via Pressability), the fact of having the handler registered didn't get through to the C++ side on New Architecture, because of being filtered out via the corresponding static view config.

As the result, there was no way to know on C++ side whether the corresponding event handler is registered for the view or not. Dynamic updates to the prop also wouldn't correctly propagate to C++, which may be a problem if a view gets e.g. the handler dynamically added.

Reviewed By: javache

Differential Revision: D51551255

fbshipit-source-id: 0783f5a27c7250f83fb357173bbe5be6213277e5
2023-11-23 10:34:32 -08:00
Ruslan Lesiutin b71bb81718 refactor[AppContainer]: remove innerView ref from state (#41613)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41613

Changelog: [Internal]

We were keeping ref in the AppContainer's state before migrating these components to functions.

We actually need a real ref here, so we can use `useImperativeHandle` on it later. These refs will be passed as an argument for DebuggingRegistry subscription, whichi will call them on all necessary AppContainers to highlight required components.

Reviewed By: javache

Differential Revision: D51536772

fbshipit-source-id: d49035874ce3c9b1acf08d5ab666886f68e6f40e
2023-11-23 07:53:24 -08:00
Ruslan Lesiutin ed1056e1c7 refactor: TraceUpdates native component -> DebuggingOverlay (#41562)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41562

Changelog: [Internal]

We will use this native component as a single layer for drawing debugging information: both for trace updates and inspected components from React DevTools.

Reviewed By: javache

Differential Revision: D51470789

fbshipit-source-id: 6c4633d2b70c2c2635a2bbfcd7adf1c727b73585
2023-11-23 07:53:24 -08:00
Ruslan Lesiutin 758e59f1d9 feat[TraceUpdateOverlay]: add iOS native component (#41563)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41563

Changelog:
[iOS][Added] - support "highlighting updates when components render" feature from React DevTools

Reviewed By: javache

Differential Revision: D51470012

fbshipit-source-id: ba4094ae24d14f58ad08acbb90333bbe49e043c9
2023-11-23 07:53:24 -08:00
Frieder Bluemle fd35c1db28 Update pkg/repo names in deprecation messages (#41618)
Summary:
Several deprecation warning messages related to components that were removed from `react-native` were outdated.
Some repositories have been moved, some packages were renamed/re-published under new names. A couple **never existed** (`react-native-community/segmented-checkbox` and `react-native-community/react-native-image-picker`).

This updates all messages to include links to the latest repositories and references to npm packages.

Because `react-native-community/art` is deprecated I've also slightly amended the message with the suggestion from its [repo readme](https://github.com/react-native-art/art#deprecated---this-package-is-deprecated-if-you-need-a-similar-package-please-consider-using-react-native-svg).

## Changelog:

[GENERAL] [FIXED] - Update pkg/repo names in deprecation messages

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

Test Plan: No code change, just documentation/text.

Reviewed By: cipolleschi

Differential Revision: D51546345

Pulled By: cortinico

fbshipit-source-id: 5d7176a70d94c8b1e8111f4d84fba89eacde456a
2023-11-23 07:49:14 -08:00
Nicola Corti 5ec2c01697 Fix projects being broken on dependencies starting with a.. (#41621)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41621

Currently, if you have a dependency that is alphabetically smaller than `app`, it's evaluation will happen before `app`.
This means that the namespace auto-discovery and the JVM toolchain configuration won't be working and the project will fail to buid.

This fixes it by introducing a root-project Gradle Plugin that takes care of enforcing the evaluation order on the `app` project.

Fixes #41620

Changelog:
[Android] [Fixed] - Fix projects being broken on dependencies starting with `a..`

Reviewed By: huntie

Differential Revision: D51547294

fbshipit-source-id: 65df7149548b7087dd8928e556fb803b3baf7b79
2023-11-23 06:59:18 -08:00
Dmitry Rykun 8a62d6135f Refactor generate-artifacts-executor.js: remove configFileDir CLI argument, use node resolution instead (#41557)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41557

The `configFileDir` CLI argument is used to help to find paths to the 3rd party dependencies of the app. Since we only care about dependencies listed in the root `package.json`, we can use `node` resolution instead of having to construct paths manually. In that case `configFileDir` becomes redundant.

Changelog: [iOS][Breaking] - Delete configFileDir CLI argument.

Reviewed By: cipolleschi

Differential Revision: D51303793

fbshipit-source-id: 46cb61197ddf51515af634c8fc6b85a8d218c51e
2023-11-23 06:07:28 -08:00
Jakub Grzywacz 1e68e48534 feat: selectionHandleColor prop on Android (#41092)
Summary:
This PR addresses the problem raised in the https://github.com/facebook/react-native/issues/41004 issue.

The current logic is that `selectionColor` on iOS sets the color of the selection, handles, and cursor. On Android it looks similar, while it doesn't change the color of the handles if the API level is higher than 27. In addition, on Android there was an option to set the color of the cursor by `cursorColor` prop, but it didn't work if the `selectionCursor` was set.

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

[GENERAL] [ADDED] - Make same behavior of the `selectionColor` prop on Android as iOS
[ANDROID] [ADDED] - Introduced `selectionHandleColor` as a separate prop
[ANDROID] [CHANGED] - Allowing `cursorColor` and `selectionHandleColor` to override `selectionColor` on Android

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

Test Plan:
Manual tests in rn-tester:

### `selectionColor` same as iOS, sets selection, handles and cursor color

_There is a way to set only "rectangle" color by setting other props as null_

![image](https://github.com/facebook/react-native/assets/39670088/9cba34c2-c9fc-4d84-a9cb-3b28a754671d)

### `selectionHandleColor`

![image](https://github.com/facebook/react-native/assets/39670088/8a7e488e-0e35-4646-9efe-4783420b41fa)

### `cursorColor`

![image](https://github.com/facebook/react-native/assets/39670088/06798b8a-851f-44c7-979e-a4e74681b29a)

Reviewed By: NickGerleman

Differential Revision: D51253298

Pulled By: javache

fbshipit-source-id: 290284aa38c6ba0aa6998b937258788ce6376431
2023-11-23 05:34:24 -08:00
Nick Gerleman 6b89dc1b97 Do not expose aggregate style edges (#41610)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41610

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

A reland of the main change in D50998164, moving away from exposing compound edge arrays directly.

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D51512611

fbshipit-source-id: 2d4ceb89c9d76317feb9074aa271358a3abc0ee1
2023-11-22 22:43:41 -08:00
Nick Gerleman 2d8ece4765 Inline yoga::Style::Edges debugStringConvertibleItem (#41609)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41609

Aggregate edges will no longer be exposed. Inline debugStringConvertibleItem string printing for it.

Previously included in D50998164

Changelog:
[Internal]

Reviewed By: joevilches

Differential Revision: D51510790

fbshipit-source-id: aaabaa4fdd899bd9c602b9a5ab5dd35265c7269b
2023-11-22 22:43:41 -08:00
Nick Gerleman 5e920ff800 Inline yoga::Style::Edges convertRawProp (#41611)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41611

Aggregate edges will no longer be exposed. Inline the convertRawProp parsing functions for it.

This is a little bit more code, but subjectively easier to reason about.

Previously included in D50998164

Changelog:
[Internal]

Reviewed By: joevilches

Differential Revision: D51510562

fbshipit-source-id: 30440e19422a3a3fb49a754b5ecd8279ce1521a2
2023-11-22 22:43:41 -08:00
Nick Gerleman d09b7b0382 Remove alias props for inset, insetInline, insetBlock (#41612)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41612

We never use the position edges for Yoga style. We should not keep extra props, and instead just parse directly into the Yoga style.

Previously included in D50998164

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D51508217

fbshipit-source-id: ff28cf7168446068b10901fbba258414b561f07f
2023-11-22 22:43:41 -08:00
Nick Gerleman c9c5651108 FP Tolerance in iOS Paper SafeAreaView debouncing (#41614)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41614

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

SafeAreaView works by adding padding in order to shift content out of the safe area. This may change the layout dimensions of the SafeAreaView, in turn effecting its safe area insets.

This can cause layout results to change, which in turn changes the inset value. Because of this, there is a tolerance, where safe area inset changes do not trigger a new update.

Yoga is instructed to round layout dimensions to the closest physical pixel, so a very small difference in layout may result being off by about a pixel. Right now the tolerance is exactly one physical pixel, and if there is FP error here, we may not pass the test, and start oscillating with different layout values.

After changing affected ShadowNode order to always be root-first, the first call to set the frame of the `SafeAreaView` happens when a non-zero-sized RootView is present, which I think may lead to a safe area inset update communicated that wasn't before? Or other cosmic butterflies. Layout rounds to one physical pixel in difference, and our tolerance is `0.00001` dips off (not helped that 1/3 screen scale cannot be represented as decimal, even without FP error).

This adds a small tolerance beyond just the pixel boundary, matching the logic in Fabric, which seems to resolve the issue.

Changelog:
[iOS][Fixed] - FP Tolerance in iOS Paper SafeAreaView debouncing

Reviewed By: philIip

Differential Revision: D51539091

fbshipit-source-id: 88bddc38c7cd8d93feef5f12da64b124af22f46d
2023-11-22 16:58:31 -08:00
Phillip Pan 072a2006e0 delete RCTBlockGuard (#41599)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41599

Changelog: [iOS][Breaking]

this is not used in our framework, delete. feel free to fork this implementation if you are using it or interested in using it

Reviewed By: cipolleschi

Differential Revision: D51516680

fbshipit-source-id: 4ca23a5b78bf18a84ea0ab4fe16419db7aea03d9
2023-11-22 15:51:20 -08:00
Arushi Kesarwani 0f239d3301 Fix ReactInstanceManager to initialize the UIManager (#41594)
Summary:
Adding `initialize()` to FabricUIManager just as was done by JSIModule

Without this change switching to UIManagerProvider would cause the UI to be Frozen and the events not correctly registered.

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

Reviewed By: javache

Differential Revision: D51456979

fbshipit-source-id: 8d97533340a88ec6bb2bf0f257b6acfaa59da471
2023-11-22 14:19:21 -08:00
Ramanpreet Nara 4e92016a09 Remove hard-coded SampleTurboModule exclude (#41574)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41574

The codegen scripts hard-code to exclude NativeSampleTurboModule.

This diff modifies the codegen infra (i.e: combine-js-to-schema-cli.js) to accept an argument: --exclude <regex>.

Auxiliary changes:
- Refactor argument parsing to rely on node's util.parseArgs

Changelog: [Internal]

Reviewed By: javache, dmytrorykun

Differential Revision: D51471526

fbshipit-source-id: 98b88058f8c4b6fa4d776d96a1eb0f15144906a8
2023-11-22 13:52:51 -08:00
Ramanpreet Nara 3ee4b8f5a1 Create genrule to generate appmodules.so (#41466)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41466

## Context
In open source, all apps use the same turbomodulemanager delegate (i.e: the default delegate).

This diff introduces the buck infra that makes the oss default delegate work for meta apps.

Concretely, we are going to make React Native use the same  delegate for **all** Meta apps.

Each Meta app will:
1. At build time, generate a unique TMProvider map
2. At app init time, initialize the default delegate with the TMProvider map.

## Implementation
**Step #1:** At build time, generate a unique TMProvider map

**Insight:** Buck genrules can accept, as input, the output of a buck query.

So, here's how we get this done:
1. Buck query (i.e: input to Genrule): Given the app's deps, query all the schemas in the app.
2. Genrule: Read the schemas to generate the TMProvider map. The TMProvider map will also contain **all** the app's C++ module codegen.

Concretely:
1. This diff introduces a macro: rn_codegen_appmodules(deps).
2. rn_codegen_appmodules(deps) generates appmodules.so, which contains the TMProvider map.

**Step #2:** At app init time, initialize the default delegate with the TMProvider map.

This is how we'll initialize the DefaultTurboModuleManagerDelegate:
1. DefaultTurboModuleManagerDelegate will load appmodules.so during init.
2. When loaded, appmodules.so will assign the code-generated TMProvider map to DefaultTurboModuleManagerDelegate.

## Impact
This should allow us to:
1. Get one step closer to getting rid of the `js1 build turbomodule-manager-delegates --target <app>` script
3. Remove the TurboModuleManagerDelegate from React Native's public API. (Because we use one delegate for all React Native apps in Meta and OSS)

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D50988397

fbshipit-source-id: 0ca5dec14e2dae89ec97f5d39a182c7937c5c7bf
2023-11-22 13:52:51 -08:00
Nick Gerleman d4399c5f15 Don't enable ordinalCount() or bitCount() for bitset enums
Summary:
Bitfield enums are not sequential, so use of these functions on these enums would be invalid.

I looked at whether we could trivially move `bitCount` to template based on `ordinalCount`. `bitCount` must be constexpr, since we use it directly as a bit-field size constant. `log2` and `ceil` to be constexpr, which isn't here until C++ 26.

Reviewed By: javache

Differential Revision: D51518899

fbshipit-source-id: 256f15bbed517be6f90bf43baa43ce96e9259a71
2023-11-22 11:06:31 -08:00
Intl Scheduler 4e59a2f791 translation auto-update for i18n/fb4a.config.json on master
Summary:
Chronos Job Instance ID: 1125907943710647
Sandcastle Job Instance ID: 22517999251971187
allow-large-files
ignore-conflict-markers
opt-out-review

Differential Revision: D51528777

fbshipit-source-id: bc9fd635117aac9dd50130f01bb317bb93ff7c36
2023-11-22 08:08:15 -08:00
Dmitry Rykun 980fb0cb51 Refactor generate-artifacts-executor.js: decouple schema and native files generation (#41555)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41555

This diff splits `generateNativeCodegenFiles` into two simpler steps: `generateSchemaInfos` and `generateCode`. `SchemaInfo` is a (library, schema) pair, it is convenient for further transformations.
Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D51204077

fbshipit-source-id: 8a1f585a79a2a0241b544a8a131b59250d803e2e
2023-11-22 07:59:54 -08:00
Dmitry Rykun 3ecf1bce1d Refactor generate-artifacts-executor.js: keep schema in memory instead of writing/reading from disk (#41554)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41554

This diff removes inefficiency where we first write schema to disk in `combine-js-to-schema.js`, and then read it from disk in `generate-specs-cli-executor.js`. With this change we can just pass it as an argument.
Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D51161162

fbshipit-source-id: 35d14ca3e53e4bf999520c635c66909c20081096
2023-11-22 06:57:03 -08:00
zhongwuzw e989d0bf77 Fix Fabric componentregistrynative spec not work (#41602)
Summary:
`componentregistry`'s `source_files` of spec contains the `componentregistrynative`'s `source_files`, it caused `componentregistrynative` spec not work.
![image](https://github.com/facebook/react-native/assets/5061845/9d8706d3-d5a4-4637-8cf4-db095264cda5)

cc. sammy-SC

## Changelog:

[IOS] [FIXED] -  Fix Fabric componentregistrynative spec not work

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

Test Plan: None.

Reviewed By: javache

Differential Revision: D51525001

Pulled By: cipolleschi

fbshipit-source-id: 63f4ecb640f513170824cee6cbc800e805a81adb
2023-11-22 05:18:30 -08:00
Dmitry Rykun 9071a3a0b0 Delete node calls from generate-artifacts-executor.js (#41534)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41534

This diff deletes calls to `node` from `generate-artifacts-executor.js`, and replaces them with normal `requires` of JS sources.
This is a squashed version of (D51116291 ... D51158799).
The following sequence of changes has been made:
1. Require and directly invoke `generate-specs-cli-executor` instead of using `node`.
2. Use `codegen-util` to get `RNCodegen` in `generate-provider-cli.js`.
3. Use `RNCodegen` directly instead of using `node`.
4. Move all implementation code from `combine-js-to-schema-cli.js` to `combine-js-to-schema.js`.
5. Decouple building the codegen from getting the codegen CLI.
6. Use `combine-js-to-schema` directly instead of using `node`.
7. Delete unit test that was testing node invocation.
8. Delete `nodeBinary` argument form `generate-codegen-artifacts.js` and its callsites.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D51158845

fbshipit-source-id: 5e039801c8045a42349f7cb6ca28e2df24634589
2023-11-22 05:18:15 -08:00
Samuel Susla 81e368e1d3 introduce ShadowNode::IdentityTrait (#41603)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41603

changelog: [internal]

`ShadowNode::IdentityTrait` was already a thing. Let's make it available in ConcreteComponentDescriptor.

Reviewed By: rshest

Differential Revision: D51471666

fbshipit-source-id: 7919a9b7238d766ee3913a5ab239bf254fab0996
2023-11-22 04:33:02 -08:00
Samuel Susla 91d4b1bd80 pass RawProps by rvalue (#41604)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41604

changelog: [internal]

Remove const requirement when using RawProps and prefer passing it by rvalue.

Reviewed By: javache

Differential Revision: D51471667

fbshipit-source-id: 479bcebe642e168ff1f110e7b2bfaf20a3e82821
2023-11-22 04:33:02 -08:00
Riccardo Cipolleschi 951efc8ce2 Remove some usages of RCT_NEW_ARCH_ENABLED (#41589)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41589

This is a cleanup diffs that removes some of the usages of RCT_NEW_ARCH_ENABLED.
Now that we are shipping all the pods, there is no need to conditionally compile-out part of the codebase depending on whether the new architecture is running or not.

This change will not alter the behavior of the app.

## Changelog:
[iOS][Breaking] - Remove some usages of RCT_NEW_ARCH_ENABLED. The change should be transparent BUT some **Swift** libraries might get broken by this change.

Reviewed By: dmytrorykun

Differential Revision: D51498730

fbshipit-source-id: c83416480eea1f7bbc55f72c31e7b69ad0e9e01a
2023-11-22 03:50:29 -08:00
Riccardo Cipolleschi 6b5320540a Always install all the pods (#41588)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41588

This change always installs all the Pods for both architecture.
This unify the behavior between iOS and Android.

## Changelog:
[Internal] - Always install all the pods

## Facebook:
The inly four pods that are changed when flipping between the new and the old arch with RNTester are:
- MyNativeView
- NativeCxxModuleExample
- React-RCTAppDelegate
- ScreenshotManager
The only change there is the RCt_NEW_ARCH_ENABLED flag being set or not in those pods

Reviewed By: dmytrorykun

Differential Revision: D51494498

fbshipit-source-id: 4cafdef4a4c2b86381067373aed27ed18524e4be
2023-11-22 03:50:29 -08:00
Riccardo Cipolleschi a6076924bf Remove unused flag in Old Architecture codegen (#41579)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41579

This change remove a flag that is unused.

## Changelog
[Internal] - Remove unused Flag

Reviewed By: dmytrorykun

Differential Revision: D51493765

fbshipit-source-id: f8cbce991d80d4f51363cdd4f379e6b214b2b2df
2023-11-22 03:50:29 -08:00
Riccardo Cipolleschi 13d08f146b Remove RN_FABRIC_ENABLED flag (#41561)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41561

The RN_FABRIC_ENABLED has been deprecated and superseded by the RCT_NEW_ARCH_ENABLED for a while now.

This change removes it, from the codebase as now we always have the Fabric pod available to the codebase.

## Changelog
[Internal] - Remove RN_FABRIC_ENABLED flag

Reviewed By: dmytrorykun

Differential Revision: D51468332

fbshipit-source-id: 6b2fc554e6bf5ac748b9e45d7c14f9ba9b57820c
2023-11-22 03:50:29 -08:00
Nicola Corti 0cbd2a345d Update Element Inspector string to "Toggle" (#41595)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41595

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

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

Reviewed By: cipolleschi

Differential Revision: D51503403

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

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

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

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

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

bypass-github-export-checks

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D51512872

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

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

This was previously part of D50998164

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D51503493

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

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

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

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D51478403

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

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

Changelog: [Internal]

Reviewed By: fabriziocucci

Differential Revision: D51499256

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

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

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D51498070

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

changelog: [internal]

Reviewed By: rshest

Differential Revision: D51499449

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

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

Reviewed By: christophpurrer

Differential Revision: D51500901

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

# Changelog:

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

Reviewed By: christophpurrer

Differential Revision: D51495143

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

changelog: [internal]

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

Reviewed By: christophpurrer

Differential Revision: D51468580

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

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

Reviewed By: javache

Differential Revision: D51346658

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

# Changelog:

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

Reviewed By: christophpurrer

Differential Revision: D51495144

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

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

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

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

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D51463600

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

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D51479729

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

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

Changelog: [Internal]

Reviewed By: huntie, arushikesarwani94

Differential Revision: D51447882

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

# Changelog:
[Internal]-

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

Reviewed By: GijsWeterings

Differential Revision: D51493466

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

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

## Motivation

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

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

Reviewed By: cipolleschi

Differential Revision: D51256486

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

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

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D51111416

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

Changelog: [Internal]

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

Reviewed By: javache

Differential Revision: D51346659

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

## Changelog:
[Internal] -

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

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

Differential Revision: D51479305

fbshipit-source-id: 72afb7dfd0ba32f96af4f9a6564b3b8121a597c7
2023-11-20 18:10:55 -08:00