Commit Graph

12270 Commits

Author SHA1 Message Date
Nick Gerleman 1c57e969fb Test against XCode 14.3 and 15 (#41798)
Summary:
Apple will require XCode 15 next year to ship to the app store, and it aligns with how we build and test React Native internally.

XCode 15 and 14.3 add support for a lot of [missing C++ 20 features](https://developer.apple.com/xcode/cpp/#c++20) from earlier versions as well.

Last I was aware, Riccardo was onboard with bumping min supported in 0.74 to XCode 15. This change does a slightly more conservative bump to min 14.3, and main of 15.0 (though we might want to move these before 0.74 comes out).

All of this will get migrated over to GHA soon enough as well, but... formalizing this is the only thing blocking usage of C++ 20 ranges today.

Changelog:
[ios][breaking] - Require XCode >= 14.3

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

Test Plan:
1. CircleCI Passes
2. Can still boot RNTester from XCode with code signing related changes.

Reviewed By: cortinico

Differential Revision: D51840617

Pulled By: NickGerleman

fbshipit-source-id: 58f8951a436eb7c892a00432a8aad0ddd0a49da1
2023-12-05 15:35:05 -08:00
Ruslan Shestopalyuk e3d1e15939 Use okhttp4 for buck-based Android unit tests (#41812)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41812

# Changelog:
[Internal]-

This makes sure that unit tests that use okhttp, do consistently use okhttp v4 for both gradle and buck based workflows when running tests.

Reviewed By: christophpurrer

Differential Revision: D51864344

fbshipit-source-id: 7fd80fd1e7e9ccdc5ec75a41c5dd03f9fc2751a0
2023-12-05 14:30:40 -08:00
kassens (Meta Employee) b2d4236749 Flow: make more objects exact (#27790)
Summary:
Changelog: [Internal]

This makes a couple objects more exact. Nothing critical, just noticed
this old branch I had created when doing some Flow upgrades in the past.

DiffTrain build for commit https://github.com/facebook/react/commit/f498aa299292d4d1e999f66d1c769440ad10d57c.

Reviewed By: hoxyq

Differential Revision: D51824015

Pulled By: kassens

fbshipit-source-id: ecadc98ffb233d6458c65c38150a29ff65a10121
2023-12-05 14:09:39 -08:00
David Vacca 704f07b98e Extract binaryCompatibilityValidator into gradle.properties file (#41811)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41811

In this diff I'm extracting binaryCompatibilityValidator configuration into gradle.properties file. The goal is to reuse these properties from BUCK

changelog:[Internal] internal

Reviewed By: cortinico

Differential Revision: D51402033

fbshipit-source-id: 9b585dd07c5c00a39caadac47a2f0d605c5419f2
2023-12-05 13:36:34 -08:00
Nicola Corti ff77680387 Remove dead unit tests related to text/layout property settings. (#41804)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41804

Those 4 tests are Ignored since a while and I haven't found a easy way to re-enable them. I believe we can safely delete them.

Changelog:
[Internal] [Changed] - Remove dead unit tests related to text/layout property settings.

Reviewed By: sammy-SC

Differential Revision: D51848089

fbshipit-source-id: 89880f5402774cb0560ac8fe4ba21e1e44c24889
2023-12-05 10:50:55 -08:00
Krzysztof Moch 852f2b1758 refactor: convert NetworkingModuleTest to kotlin (#41792)
Summary:
Migrated `NetworkingModuleTest` to kotlin (part of https://github.com/facebook/react-native/issues/38825)

## Changelog:
[Android] [CHANGED] - NetworkingModuleTest.java -> NetworkingModuleTest.kt

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

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

Reviewed By: cortinico

Differential Revision: D51847402

Pulled By: rshest

fbshipit-source-id: 7a1938c575a7e5b22b6ff578e1f8d26b600f2c27
2023-12-05 09:01:08 -08:00
Christoph Purrer 19420b7e68 Use C++17 namespace for compoments (#41791)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41791

Same as https://github.com/facebook/react-native/pull/41771 - but this time for compoments

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D51804740

fbshipit-source-id: 87f4db5dabfce4639f16fdcb1b1df0fee338a555
2023-12-05 07:31:57 -08:00
Nicola Corti ee74b4c5d6 Re-enabled disabled tests ReactPropForShadowNodeSpecTest and ReactPropForShadowNodeSetterTest (#41788)
Summary:
X-link: https://github.com/facebook/yoga/pull/1494

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

Those tests are currently disabled due to Yoga attempting to do JNI calls.
I've added infra to bypass .so loading during tests, and we should be good to re-enable those tests by now.

Changelog:
[Internal] [Changed] - Re-enabled disabled tests ReactPropForShadowNodeSpecTest and ReactPropForShadowNodeSetterTest

Reviewed By: NickGerleman

Differential Revision: D51814491

fbshipit-source-id: adbbace19c94a0c6d8947f61221fafafd7797ac8
2023-12-05 07:14:20 -08:00
Nick Gerleman 363ee484bb Remove extraneous log statment (#41799)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41799

Noticed this when doing local build.

Changelog: [Internal]

Created from CodeHub with https://fburl.com/edit-in-codehub

Reviewed By: rshest

Differential Revision: D51845672

fbshipit-source-id: 2f24d69cea1a2fededed271865a5836e791cea41
2023-12-05 03:52:00 -08:00
Joe Vilches 0cc09f207f New file for layout methods related to absolute children (#41794)
Summary:
X-link: https://github.com/facebook/yoga/pull/1495

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

This is a copy of D51369722 to make it so that it preserves the file history

CalculateLayout.cpp is massive and approaching 3k lines. I added a few large functions dealing with layout of absolute nodes and was thinking it would be nice if that logic was just in its own file so it was more isolated and easier to reason about. So I made AbsoluteLayout.cpp and AbsoluteLayout.h to house this logic. In order for this to work I had to expose calculateLayoutInternal in CalculateLayout.h as layoutAbsoluteChild calls it. This is unideal and I would like to find a better way...

I also make LayoutUtils.h to house misc small helper methods as they are called in AbsoluteLayout.cpp and CalculateLayout.cpp

Reviewed By: NickGerleman

Differential Revision: D51824115

fbshipit-source-id: 9b27449e3c1516492c01e6167a6b2c4568a33807
2023-12-04 19:35:30 -08:00
Joe Vilches aa31c6cd75 Fix issue where start/end would not be respected in flex edge getters (#41682)
Summary:
X-link: https://github.com/facebook/yoga/pull/1479

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

There are two ways to get the value of a style for a specific edge right now:

1) From the inline start/end edge which is determined via the writing direction (ltr or rtl), assuming you do not have errata on
2) From the flex start/end edge which is determined via the flex direction (row, row-reverse, column, column-reverse)

There is a weird curiosity in the second case: you can define a style to be on the "start" or "end" edge when writing the stylex/css. The physical edge that this refers to is dependent on the writing direction. So `start` would be `left` in `ltr` and `right` in `rtl`, with `end` the opposite. It is **never** determined via the flex direction. Additionally, `start`/`end` takes precedence over the physical edge it corresponds to in the case both are defined.

So, all of this means that to actually get the value of a style from the flex start/end edges, we need to account for the case that one of these relative edges was defined and would overwrite any physical edge. Since this mapping is solely determined by the writing direction, we need to pass that in to all the flex start/end getters and do that logic. This is done in  `flexStartRelativeEdge`/`flexEndRelativeEdge` which was added earlier but for some reason only being used on border.

Reviewed By: NickGerleman

Differential Revision: D51293315

fbshipit-source-id: 26fafff54827134e7c5b10354ff9bfdf67096f5b
2023-12-04 19:35:30 -08:00
Joe Vilches 7459529ee4 Introduce positionAbsoluteChild (#41491)
Summary:
X-link: https://github.com/facebook/yoga/pull/1473

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

To simplify the logic a bit I introduce a new function called `positionAbsoluteChild`. This function will, eventually, be the **sole function that matters** when determining the layout position of an absolute node. Because [absolute nodes do not participate in flex layout](https://drafts.csswg.org/css-flexbox/#abspos-items), we can determine the position of said node independently of its siblings. The only information we need are the node itself, its parent, and its containing block - which we have all of in `layoutAbsoluteChild`.

Right now, however, this is purely a BE change with no functionality different. There was a big set of if statements at the end of `layoutAbsoluteChild` that would position the node on the main and cross axis for certain cases. The old code had it so that the main and cross axis had basically the same logic but the code was repeated. This puts that logic, as is, in `positionAbsoluteChild` and calls that from `layoutAbsoluteChild`.

I will soon edit this function to actually do what it is envisioned to do (i.e. be the sole place that position is set for absolute nodes).

Reviewed By: NickGerleman

Differential Revision: D51272855

fbshipit-source-id: 68fa1f0e0f4d595faf2af1d9eaceb467382ca406
2023-12-04 19:35:30 -08:00
Joe Vilches a48e0d590e Use containing block to adjust absolute child position (#41490)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41490

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

This change has most of the logic needed for supporting `position: static`. We do two things here that fix a lot of the broken static test:

1) We pass in the containing node to `layoutAbsoluteChild` and use it to properly position the child in the case that insets are defined.
2) We rewrite the absolute child's position to be relative to it's parent in the event that insets are defined for that child (and thus it is positioned relative to its CB). Yoga's layout position has always be relative to parent, so I feel it is easier to just adjust the coordinates of a node to adhere to that design rather than change the consumers of yoga.

The "hard" part of this algorithm is determining how to iterate the offset from the containing block needed to do this translation described above. That is handled in `layoutAbsoluteDescendants`.

Reviewed By: NickGerleman

Differential Revision: D51224327

fbshipit-source-id: ae6dc54fe2a71bebb4090ba21a0afb0125264cbc
2023-12-04 19:35:30 -08:00
Joe Vilches 43ab5fe38c Allow the containing block to set trailing position of absolute descendants (#41489)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41489

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

If we are going to allow the containing block to layout its absolute descendants and NOT the direct parent then we need to change step 11 which is concerned with setting the trailing position in the case we are row or column reverse. This is the very last step in the function and is positioned that way because it operates on the assumption that all children have their position set by this time. That is no longer a valid assumption if CBs layout their absolute children. In that case the CB also needs to take care of setting the position here.

Because of this problem I moved some things around. It now works like:

* If errata is set, the direct parent will set trailing position for all non absolute children in step 11
* If errata is set the CB will set trailing position of absolute descendants after they are laid out inside of layoutAbsoluteDescendants

Reviewed By: NickGerleman

Differential Revision: D51217291

fbshipit-source-id: a7eea0d3623f9041b73d609a1de2bfb0f0343a26
2023-12-04 19:35:30 -08:00
Joe Vilches 33d6a59bea Let containing blocks layout their absolute descendants, not parents (#41488)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41488

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

The way we plan on implementing `position: static` is by changing how we lay out absolutely positioned nodes. Instead of letting their direct parent lay them out we are going to let their containing block handle it. This is useful because by the time the containing block gets to this step it will already know its size, which is needed to ensure that absolute nodes can get the right value with percentage units. Additionally, it means that we can "translate" the position of the absolute nodes to be relative to their parent fairly easily, instead of some second pass that would not be possible with a different design.

This change just gets the core pieces of this process going. It makes it so that containing blocks will layout out absolute descendants that they contain. We also pass in the containing block size to the owner size args for `layoutAbsoluteChild`. This new path will only happen if we have the errata turned off. If there is no positioned ancestor for a given node we just assume the root is. This is not exactly how it works on the web - there is a notion of an initial containing block - but we are not implementing that as of right now.

Reviewed By: NickGerleman

Differential Revision: D51182593

fbshipit-source-id: 88b5730f7f4fec4f33ec64288618e23363091857
2023-12-04 19:35:30 -08:00
Joe Vilches e48da2aff3 Insets no longer apply to statically positioned nodes (#41369)
Summary:
X-link: https://github.com/facebook/yoga/pull/1454

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

One of the most basic aspects of statically positioned nodes is that [insets do not apply to them](https://developer.mozilla.org/en-US/docs/Web/CSS/position#static). So I put a guard inside `Node::relativePosition` where we take that into account when setting the position.

Reviewed By: NickGerleman

Differential Revision: D50507808

fbshipit-source-id: 7aab4138b06e60936db0ddb6019a9a30f1ded2db
2023-12-04 19:35:30 -08:00
Christoph Purrer b101dd0e34 Use C++17 namespace (#41771)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41771

Changelog: [Internal]

Since we are already enforcing C++20 (and 17), we can set the namespace declaration to the C++17 style

Reviewed By: NickGerleman

Differential Revision: D51789991

fbshipit-source-id: 165d7d4e652d60ab200e2355e084010a02f470a4
2023-12-04 19:07:51 -08:00
Christoph Purrer 974e584891 Update GenerateModuleH fixture (#41780)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41780

This updates our test fixture with more concrete examples from:
https://github.com/facebook/react-native/blob/main/packages/rn-tester/NativeCxxModuleExample/NativeCxxModuleExample.js

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D51804559

fbshipit-source-id: 3290bc5447e0b47551ad73f5b041e332443e71c6
2023-12-04 14:50:46 -08:00
Ruslan Lesiutin cd395b552b feat[ReactFabricPrivateInterface]: add getInternalInstanceHandleFromPublicInstance (#41786)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41786

Changelog: [Internal]

This is the preprequisite for https://github.com/facebook/react/pull/27783

Reviewed By: rubennorte

Differential Revision: D51808831

fbshipit-source-id: c8ddf67d7ad35a670fa462c246dcb7230ba47716
2023-12-04 13:06:16 -08:00
David Vacca e9b80971c7 Integrate binary-compatibility-validator into RN Android build system
Summary:
In this diff I'm integrating 'org.jetbrains.kotlinx.binary-compatibility-validator' into RN Android build gradle system.

The tool allows dumping binary API of a JVM part of a Kotlin library that is public in the sense of Kotlin visibilities and ensures that the public binary API wasn't changed in a way that makes this change binary incompatible

More context on https://github.com/Kotlin/binary-compatibility-validator#building-the-project-locally

bypass-github-export-checks

Reviewed By: cortinico

Differential Revision: D51262577

fbshipit-source-id: 1894f4e55a4019e3ce1585e9df12dee69944e5ce
2023-12-04 12:22:58 -08:00
Christoph Purrer a481ae7484 Remove flow exact object syntax {| brace pipe |} from TM example (#41779)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41779

Changelog: [Internal]

`exact_by_default` (https://flow.org/en/docs/types/objects/#exact-and-inexact-object-types) is turned on - https://github.com/facebook/react-native/blob/main/.flowconfig#L40 - so we don't need these extra `|`.

Reviewed By: rshest

Differential Revision: D51803601

fbshipit-source-id: bef3699333471948330c4ae541e7a7023a7b1485
2023-12-04 11:07:21 -08:00
Gijs Weterings e5df45c1c5 Stabilize View-backface-visibility-e2e.js (#41785)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41785

Changelog: [Internal] modify backface visibility e2e test to comfortably fit within user viewport

Reviewed By: makovkastar

Differential Revision: D51806469

fbshipit-source-id: a8a8a1426a154b452c29df07561b7302f3150bd1
2023-12-04 10:51:58 -08:00
Christoph Purrer 749b8dd2d4 Add logic to generate recursive TM members (#41768)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41768

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D51572375

fbshipit-source-id: e4ce0726c457ea02a7710ea1d21bbd697e35848a
2023-12-04 08:56:42 -08:00
Christoph Purrer ead73de464 Add a BinaryTreeNode example for Cxx TMs (#41767)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41767

Changelog: [Internal]

Adds a simple example showing a direct recursive node in a Cxx TM.

Currently we can't auto-generate [the necessary C++ Types](https://reactnative.dev/docs/next/the-new-architecture/cxx-custom-types#struct-generator) - but we can add it later if this scenarios becomes really common.

Direct recursive nodes, can't be value types - it would require infinite memory. Hence they are nullable and managed by a smart pointer.

Reviewed By: rshest

Differential Revision: D51784136

fbshipit-source-id: f6f0710d03583bdf1e6e72ba42d8df7f8ff8d915
2023-12-04 05:54:50 -08:00
Christoph Purrer 5754b4a123 Add GraphNode example for Cxx TMs (#41766)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41766

Changelog: [Internal]

Adds a simple example showing a recursive node, stored inside a collection in a Cxx TM.

Currently we can't auto-generate [the necessary C++ Types](https://reactnative.dev/docs/next/the-new-architecture/cxx-custom-types#struct-generator) - but we can add it later if this scenarios becomes really common.

Reviewed By: rshest

Differential Revision: D51783974

fbshipit-source-id: 7352db1a354cd7da32febc650f7cc5e10dd16d2d
2023-12-04 04:19:47 -08:00
Kacper Kafara 385473522c Fix typos in ReactCompoundViewGroup comments (#41729)
Summary:
Was stepping with debugger through the code & noticed few typos.

## 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] [FIXED] - Typos in `ReactCompoundViewGroup` comments

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

Test Plan: Typos in docs

Reviewed By: cortinico

Differential Revision: D51753447

Pulled By: arushikesarwani94

fbshipit-source-id: b373d67ca8b6c9f22d80ea1ccee98ecc5151b325
2023-12-01 21:23:06 -08:00
Arushi Kesarwani 5e406ccea0 Fixing Bridgeless Exception caused by the UIManager changes
Summary:
Forward-fixing the crash in Bridgeless mode caused by UIManagerProvider changes to replace JSI Module

bypass-github-export-checks

Reviewed By: philIip

Differential Revision: D51778494

fbshipit-source-id: f1837d7b164051e326e1227c432e493bad16cd51
2023-12-01 20:15:20 -08:00
Joe Vilches 01c627e392 Change strict layout conformance to not use the new static changes (#41733)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41733

I am currently implementing position: static in Yoga. I have a huge stack of changes that is ready to ship but we are waiting on the default position type to be relative before shipping. The reason being, my changes will affect a whole ton of styles where there is no position set so if we can make static no longer the default we can safely ship this new code. However, this will take a while and keeping up with this stack of diffs though merge conflicts, flakey tests, and general slowness for my IDE is getting annoying. So a solution here is to ship that stack and make it so that no one gets this functionality by changing the strict layout conformance to include the errata that is gating my changes. The end result being that the code can be shipped but will have no affect at the time being.

Right now, because that code is in a different branch and not on prod, this change will do nothing.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D51731778

fbshipit-source-id: f0b7fd8559adb19e1658b3ac64fcfc4c5f8ecdf7
2023-12-01 14:32:07 -08:00
Arushi Kesarwani c30f2b6205 Refactor DefaultReactNativeHost to use the new way of Fabric initialization (#41739)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41739

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

Reviewed By: philIip

Differential Revision: D51719555

fbshipit-source-id: bad471a8a273accecb0641ccaa77223534cd45fd
2023-12-01 12:19:07 -08:00
Christoph Purrer 288708f411 react-native: Platformize android|ios textinput (#41600)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41600

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D51515743

fbshipit-source-id: 156d9119d84d82f31b62b89b1916365547ce0afe
2023-12-01 10:34:12 -08:00
Arushi Kesarwani 75019c8707 Using UIManagerProvider instead of JSIModule in UIManagerHelper (#41738)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41738

Replacing the callsite to `context.getFabricUIManager()` in UIManagerHelper instead of `getJSIModule()`

Fixing the crash by directly making `getFabricUIManager()` of `ReactContext` independent of the assertion.

Reviewed By: philIip

Differential Revision: D51719040

fbshipit-source-id: f9118b16614724a1d6dabe59d5c4d25dd4bdbc73
2023-12-01 09:38:54 -08:00
Nicola Corti a3f238a44e AGP to 8.2.0 (#41747)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41747

Let's update AGP to the latest minor

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

Reviewed By: cipolleschi

Differential Revision: D51749138

fbshipit-source-id: fe473b6d1613b73e60e65848c20098e3f77d3a61
2023-12-01 08:41:02 -08:00
Nicola Corti 0e9c93c14d Gradle to 8.5 (#41748)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41748

Bumping to the latest stable of Gradle

Changelog:
[Internal] [Changed] - Gradle to 8.5

Reviewed By: cipolleschi

Differential Revision: D51749139

fbshipit-source-id: 2ee0f9a6c910dd5221f7f63c0c599d4ab181e10a
2023-12-01 08:41:02 -08:00
Tomasz Żelawski 1a0e1741c0 Add NDEBUG flag for Release builds for both architectures (#41715)
Summary:
Currently React Native defines `NDEBUG` flag for all pods in Fabric only. This is useful for other libraries, like Reanimated, because they have no easy way of defining their compilation flags (at least none that I know of). Therefore defining `NDEBUG` for both architectures would be beneficial.

## Changelog:

Pick one each for the category and type tags:

[IOS] [CHANGED] - Add `NDEBUG` flag for Release builds for both architectures

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

Test Plan:
Run ruby test suite.

## Notes

For the time being I just copied
`prepare_pod_target_installation_results_mock`
and
`def prepare_installer_for_cpp_flags`
to `utils-test.rb` since I wasn't sure how to handle the installer mock.

Reviewed By: cortinico

Differential Revision: D51708382

Pulled By: cipolleschi

fbshipit-source-id: ff206f8fc151934dbae89aacd1bc69c57b4f28ee
2023-12-01 07:03:26 -08:00
Pieter De Baets dbf0984682 Schedule CatalystInstanceImpl destruction using new thread (#41720)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41720

We currently go via the UI thread, so we can use AsyncTask to schedule the final bit of async ReactContext destruction. This is a requirement for the AsyncTask API, which is also deprecated. We should figure out a better way to schedule and re-use threads across React Native Android, but until then, we can just create a new Thread here, which is also what we do for instance creation.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D51706689

fbshipit-source-id: cf17e20e91b195b956b1701e6d91d563fdba4d15
2023-12-01 06:52:48 -08:00
Arushi Kesarwani f941f939bf Adding getFabricUIManager() APIs to ReactContext (#41728)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41728

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

Reviewed By: philIip

Differential Revision: D51718430

fbshipit-source-id: c897ab0ee9e755e3fdb3d1e5629177818870f293
2023-11-30 21:24:54 -08:00
Joe Vilches 89ec746b52 Change comment on Yoga measure modes in RN (#41732)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41732

Was reading the code in this file and noticed that this comment is no longer true after D51068417 (https://github.com/facebook/yoga/pull/1460). Updated the comment to reflect the current state of things

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D51730986

fbshipit-source-id: beaa5de9576d86e56def35f6e970376c7be8f7ee
2023-11-30 18:28:24 -08:00
Nick Gerleman 7e5f15b889 Remove unneeded const_cast (#41712)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41712

I fixed the const correctness of YGConfigGetErrata a while back when fixing up other YGConfig accessors.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D51689323

fbshipit-source-id: 1af3deb44ec03a8a65643fa1496c534ac8f6d057
2023-11-30 12:10:50 -08:00
Alex Taylor (alta) c98fa9ce8b Update hermes-parser and related packages in fbsource to 0.18.0 (#41689)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41689

Bump hermes-parser and related packages to 0.18.0.

Changelog: [internal]

Reviewed By: SamChou19815

Differential Revision: D51642821

fbshipit-source-id: b7abde7d3e0de195c18a5cb18d4cdd0a1d435127
2023-11-30 10:35:12 -08:00
Neil Dhar cfe129c832 Add JSI method for setting external memory size (#41436)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41436

Add a JSI API for associating some native memory with a JS object. This
is intended to provide a mechanism to trigger more frequent garbage
collection when JS retains large external memory allocations, in order
to avoid memory buildup.

This diff just adds the JSI method, without any implementations.

Changelog:
[General][Added] - Added JSI method for reporting native memory to the GC.

Reviewed By: tmikov

Differential Revision: D50524912

fbshipit-source-id: c8df0e18b0415d9523e0a00f6d0ed2faa648ac68
2023-11-30 08:58:02 -08:00
Pieter De Baets b41937e549 Fix ReactInstanceManager leak (#41719)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41719

We leak ReactInstanceManager into a static singleton in `ReactCxxErrorHandler.setHandleErrorFunc`. Clean it up in `destroy()`.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D51706624

fbshipit-source-id: 642825ba14ff0a9710b4435f5fb6026b3a81b711
2023-11-30 07:29:31 -08:00
Pieter De Baets 424ac63861 Clarify threading of OnViewAttach mount items (#41704)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41704

`mOnViewAttachItems` was set to be be concurrent, but this would be unexpected, as all mount item operations occur solely on the main thread.

Simplify this to be just a LinkedList and annotate the methods as being UI thread only.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D51662154

fbshipit-source-id: 9fe5784bce8a38d1339b5e3675791414676b6f4d
2023-11-30 04:38:19 -08:00
Krzysztof Piaskowy 31d8a93bf3 Fix Binding JNI type (#41657)
Summary:
New implementation:
This PR adds cast from interface Binding to BindingImpl class.

Previous implementation:
The changes made in this PR make the `mBinding` field of `FabricUIManager` visible for JNI.

Without these changes, calling the method `JFabricUIManager::getBinding()` would result in an error.

<img width="400" alt="Screenshot 2023-11-27 at 13 55 44" src="https://github.com/facebook/react-native/assets/36106620/04418291-8ce8-4bae-b16c-29a5c9f2ee52">

In the `react-native-reanimated` library, we utilize `JFabricUIManager::getBinding()`, and we have noticed this issue since version 0.73. This isn't perfect solution, but I'm not certain which change in RN or FBJNI is the source of the problem. If there are any alternative solutions worth considering, I am open to discussing them.

Usage of `getBinding()` in Reanimated:
https://github.com/software-mansion/react-native-reanimated/blob/main/android/src/main/cpp/NativeProxy.cpp#L57

## Changelog:

[ANDROID] [FIXED] - Fix type for unrecognisable field mBinding

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

Test Plan:
Just call `JFabricUIManager::getBinding` method (https://github.com/facebook/react-native/blob/v0.73.0-rc.5/packages/react-native/ReactAndroid/src/main/jni/react/fabric/JFabricUIManager.cpp#L14)

or run app with repro:
https://github.com/piaskowyk/missing-mBinding-repro
after the app lunch you will receive error from above screenshot.

Co-author: tomekzaw

Reviewed By: NickGerleman

Differential Revision: D51661873

Pulled By: javache

fbshipit-source-id: 1891c36bf25c503ebc9b0501211df03be6f74115
2023-11-30 04:32:16 -08:00
Joe Vilches 05ed0079ff Set up gating for position: relative as default (#41711)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41711

We want the default position to be relative for a number of reasons. This should be fine for the most part but putting a killswitch around this change just in case things blow up.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D51643446

fbshipit-source-id: 4f7d1e498eb663801ef6d88ba9cd9b64c781d66b
2023-11-29 20:35:14 -08:00
Ramanpreet Nara ee31ec9a3f Enable new lifecycle hooks by default everywhere (#41709)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41709

We shipped these new create()/reload()/destroy() methods to the Facebook app:
- Part 1: D50802718
- Part 2: D50803283

This diff just enables them everywhere, by default.

Created from CodeHub with https://fburl.com/edit-in-codehub

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D51590843

fbshipit-source-id: 02abeea78b7b7b844552989ad58d0a2f048424ad
2023-11-29 17:34:28 -08:00
Arushi Kesarwani c8db60c7aa Revert D50926218: Adding getFabricUIManager() APIs to ReactContext
Differential Revision:
D50926218

Original commit changeset: f311affb0f82

Original Phabricator Diff: D50926218

fbshipit-source-id: 313fd5aff1314860994487d1f4d17d2a2d5fe8c1
2023-11-29 12:01:12 -08:00
Arushi Kesarwani 93be03056b Revert D51224854: Refactor DefaultReactNativeHost to use the new way of Fabric initialization
Differential Revision:
D51224854

Original commit changeset: 2af802140436

Original Phabricator Diff: D51224854

fbshipit-source-id: 039337be7057c9625d4a6e53520a18cd5071813e
2023-11-29 12:01:12 -08:00
Rubén Norte 56291fadd4 Fix type definition of useMergeRefs (#41700)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41700

The type definition of `useMergeRefs` is incorrect, which forces all callsites to use `$FlowFixMe`. This fixes the definition and removes all the `$FlowFixMe`s caused by it.

Changelog: [internal]

Reviewed By: javache

Differential Revision: D51660716

fbshipit-source-id: 4d4d3a72bdca8c409fd1dda59cc2c94113b024bb
2023-11-29 12:00:29 -08:00
Rubén Norte c120ccb7ee Small refactor of image attached callbacks logic (#41701)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41701

I did a hotfix for this logic in D51618512. This does a small refactor to improve the code (moving more shared code to the hook and avoiding creating a closure unnecessarily in every call to it).

Changelog: [internal]

Reviewed By: javache

Differential Revision: D51660288

fbshipit-source-id: 472836840b19958402bd0de3e2c09c7cec004156
2023-11-29 12:00:29 -08:00
Nick Gerleman 10b3e0e868 Converge iOS oldarch scrollEventThrottle behavior (#41695)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41695

When I went to update documentation, I kinda internalized how inconsistent the API is if we don't change iOS Paper.

The potential for breaks is if an iOS-specific component ignores a warning, and uses `onScroll` without `scrollEventThrottle`, then relies on `onScroll` only being called once.

It didn't seem like we hit this scenario in practice when migrating Fabric ComponentView behavior, and components will need to support it in new arch anyway, so this change takes the less conservative option of unifying the behavior everywhere.

Changelog:
[iOS][Changed] - scrollEventThrottle no longer needs to be set for continuous scroll events

Reviewed By: cipolleschi

Differential Revision: D51647202

fbshipit-source-id: e2a57f3501b9096e4033cb198bbc214d53e9913c
2023-11-29 11:31:24 -08:00