Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39534
Fetching native view configs is computationally intensive work, so if some component has both native and static VCs, we should try static first.
This diff changes the `NativeComponentRegistry` so it tries to get static view config first, and then native view config as a fallback.
This diff also removes setting `RuntimeConfigProvider` from RNTester. As it was there for the same purpose of inverting that precedence.
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D49413562
fbshipit-source-id: d65776cd43eaa97d880b76385423c65e4e8744ba
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39527
So that Templace is able to switch to Bridgeless
Reviewed By: fkgozali
Differential Revision: D49150891
fbshipit-source-id: 782a6ffc4f8b21c0106458f6f16043df65ccd183
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39566
Fixes running the `build.sh` script for `react-native-codegen` when on [EdenFS](https://github.com/facebook/sapling). This would previously fail due a filesystem "unable to copy extended attributes" error.
This only affects development within the React Native monorepo. Practically, this equates to a workflow improvement for Meta engineers when creating `RNTester` builds.
NOTE: **This is temporary**. The change from `mv` to `cp -R` makes this script more expensive, which will make Android builds via Gradle take slightly longer. I have a WIP cleanup planned which will 1/ move `react-native-codegen` to the [shared monorepo build setup](https://github.com/facebook/react-native/pull/38718), and 2/ drop this step entirely from the Android Gradle build.
Changelog: [Internal]
Reviewed By: christophpurrer
Differential Revision: D49468891
fbshipit-source-id: 25d5db81798cf8ab150a135174a45f4d4c2cb5a2
Summary:
X-link: https://github.com/facebook/yoga/pull/1402
Pull Request resolved: https://github.com/facebook/react-native/pull/39567
This change hides away most usages of YGDimension as an index. We do this for a couple reasons:
1. Right now the style interface may return a full array of resolved edge or dimension values, as a CompactValue. As we abstract away from CompactValue, and move towards ValuePool, this will no longer be the internal interface, and cheap to return. We instead change the interface to return a single value at once, which lets us resolve values lazily.
2. As we move internal usage to scoped enums, enums are not implicitly convertible to intergers (broadly a good thing). Hiding the enum as index prevents the need for callers to cast or convert to underlying.
Instead of making a new version of `IdxRef` for this, I converted to a more traditional setter. I will be making similar changes later for other styles, when I hide CompactValue from the public interface.
To review I would recommend filtering to changes in `xplat`, or viewing this in a single one of the OSS PRs exported. Everything apart from the below 20 files is a mirror.
{F1096792573}
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D49362819
fbshipit-source-id: 30d730d78e62f36597d43f477120f65694e51ea3
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39561
Trying to investigate an issue where Systrace events aren't properly ended. For correctness, we should make sure to always end markers that we started.
Reviewed By: sammy-SC
Differential Revision: D49413689
fbshipit-source-id: e48e3aef20602e0af9deb924244cdfaf614d11f2
Summary:
issue: https://github.com/facebook/react-native/issues/39441
For the following reasons, I have replaced an object used for id management inside BlobRegistry with `Map`.
- The polyfill used for `fetch`, [whatwg-fetch](https://github.com/JakeChampion/fetch), returns responses as `Blob` objects.
- When a `Blob` is created, it is registered with blobID in the [BlobRegistry](https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Blob/BlobRegistry.js), which is not automatically released.
- This issue was previously reported in https://github.com/facebook/react-native/issues/19248 and was fixed by modifying whatwg-fetch. However, with the implementation of automatic garbage collection in https://github.com/facebook/react-native/issues/24405, the implementation was reverted in commit bccc92dfdd, returning to the original behavior.
- Although https://github.com/facebook/react-native/issues/24405 enables `Blob` objects to be garbage collected, the Blob IDs registered in the BlobRegistry remain, causing the count to increase each time `fetch` is called.
- As a result, the `Property storage exceeds 196607 properties` error occurs
To address this issue, I have modified the implementation of `BlobRegistry` to use a `Map` instead of an object. By using a `Map`, there is no limit to the number of entries.
## Changelog:
[Internal] - [Fixed] - Fixed a bug that caused a "Property storage exceeds 196607 properties" error when sending a certain number of `fetch` requests.
Pull Request resolved: https://github.com/facebook/react-native/pull/39528
Test Plan:
I've added a new tests in `packages/react-native/Libraries/Blob/__tests__/BlobRegistry-test.js` and confirmed the test pass before and after changes.
```
$ yarn run test
...
Test Suites: 1 skipped, 219 passed, 219 of 220 total
Tests: 2 skipped, 4017 passed, 4019 total
Snapshots: 1154 passed, 1154 total
Time: 10.525 s
Ran all test suites.
✨ Done in 12.52s.
```
Reviewed By: javache
Differential Revision: D49423213
Pulled By: NickGerleman
fbshipit-source-id: d5f73d7f5e34d1d2c3969b7dfbc45d3e6196aa30
Summary:
Remove Xcode 15 `_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION` workaround for boost. If we update boost, we don't need the workaround anymore.
This PR is based on https://github.com/facebook/react-native/issues/39552. Not sure how Meta internally deal with stacked PRs. This PR just adds a new commit based on https://github.com/facebook/react-native/issues/39552 anyway.
## Changelog:
[IOS][CHANGED] - Remove Xcode 15 `_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION` workaround for boost
Pull Request resolved: https://github.com/facebook/react-native/pull/39555
Test Plan: RNTester + Xcode 15
Reviewed By: cortinico
Differential Revision: D49454494
Pulled By: cipolleschi
fbshipit-source-id: aacabaa130b61598cf8bd206fdbb96d3b50ba74f
Summary:
Original commit changeset: f069fea8918f
Original Phabricator Diff: D49186069
bypass-github-export-checks
theory: getKeyWindowTraitCollection could get run in an async block, so there's a race to set the value. currently it gets read as nil on the first attempt
Reviewed By: sammy-SC
Differential Revision: D49449392
fbshipit-source-id: 3c71403fb30fa873a49bdc754c77797ed292a3f0
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39273
Upgrade Metro dependencies to 0.79.1 in `react-native`
This includes Metro breaking changes for disabling global package resolution by default and adds features like: Haste packages, enable resolution through symlinks and passing custom customTransformOptions and customResolverOptions to bundle_build_started log event so as to refine the bundling message. It also fixes arbitrary transformation of Babel plugins during registration in `metro-babel-register` and fixes "unexpected null" crash when handling a batch of file changes and symlinks with indirections.
**Full Metro Changelog:** https://github.com/facebook/metro/releases/tag/v0.79.1https://github.com/facebook/metro/releases/tag/v0.79.0
Changelog:
[General][Changed] Upgraded Metro to 0.79.1
Reviewed By: motiz88, mdvacca
Differential Revision: D48922815
fbshipit-source-id: 37aea6194fe587e0d094c96ceec1122c588f0fbb
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39543
As per title, this is a test package that should not be public, nor published.
## Changelog:
[Internal] - Make the react-native-codegen-test package private
Reviewed By: cortinico
Differential Revision: D49418378
fbshipit-source-id: 2bea9a42c647b2aed97a1b27a74a9d611b254f1f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39535
## Changelog:
[Internal] -
When looking up a mark by name (to be used by a measure for timing), there was a potential racing condition, which would cause issues if there is another thread e.g. logging a mark at the same time.
This fixes it.
Reviewed By: dmytrorykun
Differential Revision: D49416336
fbshipit-source-id: 28e20956f9aeafd79eb07130ea9dcd269086ea63
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37880
This adds systrace sections for the most relevant parts of `RuntimeScheduler`. This helps us identify how things are scheduled, which in this case makes it obvious we're not dispatching events the most efficient way (as top-level callbacks in the runtime executor instead of as tasks in the scheduler).
Changelog: [internal]
Reviewed By: rshest
Differential Revision: D46556399
fbshipit-source-id: 93a13a2c5ec18a34712546889de21792671d5d2c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37881
Small refactor in preparation to add systrace markers for several methods in RuntimeScheduler.
Changelog: [internal]
Reviewed By: rshest
Differential Revision: D46556398
fbshipit-source-id: a0b92ea9173a55ec5a845bcfa278018ec3349e1f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39525
Switches `EventEmitter#emit` to use `Array.from` instead of the spread operator.
This should be functionally identical (with marginally less overhead of the runtime having to determine the type of `registrations`), but there seems to be [some unexpected Babel configurations in the community](https://github.com/facebook/react-native/issues/35577#issuecomment-1723218934) that causes this line of code to do the wrong things.
Although we should independently root cause the Babel plugin configuration problems, this change might provide immediate relief and is also not any worse (e.g. in terms of code readability). This also adds a descriptive comment explaining the intention of the call to `Array.from`.
Changelog:
[Fixed][General] - Fix a potential bug in `EventEmitter` when used with certain Babel configurations that incorrectly polyfill the spread operator for iterables.
Reviewed By: javache
Differential Revision: D49389813
fbshipit-source-id: 7caf63734fc047496afe2f1ed6d918c22747258a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39522
changelog: [internal]
butter is not used in these modules. Remove it as dependency.
Reviewed By: rubennorte
Differential Revision: D49368308
fbshipit-source-id: 4251ea29033db9a03a75840609d909e68aed8c6c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39485
X-link: https://github.com/facebook/yoga/pull/1393
These were previously packed into structs to allow zero initializing all the flags at once without needing a ctor. C++ 20 has in-class member initializer support for bitfields, which makes these look more like normal member variables.
Setting enum values is a bit jank right now, due to relying on C enums which are effectively int32_t, along with GCC `-Wconversion` being a bit aggressive in needing to explicitly mask. I have some ideas to fix this later (e.g. using scoped enums internally).
bypass-github-export-checks
Changelog:
[General][Breaking] - Require C++ 20 when including renderer headers
Reviewed By: sammy-SC
Differential Revision: D49265967
fbshipit-source-id: 6ab935a866196df06e742c821f3af88eb4d18e1a
Summary:
X-link: https://github.com/facebook/yoga/pull/1382
Pull Request resolved: https://github.com/facebook/react-native/pull/39437
Have been running into places where C++ 20 makes life easier for use like `std::bit_cast` (that one is easy to polyfill), in-class member initializer support for bitfields, designated initializers, defaulted comparison operator, concepts instead of SFINAE, and probably more.
Our other infra is in the process of making this jump, or already has. This tests it out everywhere, across the various reference builds, to see if we have any issues.
This is a bit more aggressive than I had previously communicated, but n - 1 is going to be a better long term place than n - 2.
If we wanted to use `std::bit_cast` we would need one of:
1. GCC 11+ (~2.5 years old)
1. Clang 14 (~2.5 years old)
1. VS 16.11 (~2 years old)
For mobile this means:
1. NDK 26 (still in Beta 😭)
1. XCode 14.3.0 (~6 months old)
https://en.cppreference.com/w/cpp/compiler_support/20
That isn't quite doable yet, but we can start taking advantage of language features in the meantime. More of these will be supported in older toolchains.
Anyone needing support for older C++ versions can lag behind on more recent changes. E.g. Yoga 2.0 supports C++ 14.
bypass-github-export-checks
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D49261607
fbshipit-source-id: ceb06eac20dfe93352d7b796d6847a7314069cf3
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39521
Minor Dev Menu changes:
- Improve guidance when failing to connect to the debugger.
- Align "Show Element Inspector" wording on iOS.
Changelog: [Internal]
Reviewed By: blakef
Differential Revision: D49375789
fbshipit-source-id: 092da6cae1a62a1bcc4dc877ab01369db6876741
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39495
We've put `[self unstable_registerLegacyComponents]` inside `#if RCT_NEW_ARCH_ENABLED` block, but we've missed the fact that it was inside the `else` clause of the `if (enableBridgeless)` statement. So it wasn't actually enabled for bridgeless mode regardless of `RCT_NEW_ARCH_ENABLED`.
This diff fixes that, and registers legacy components for the bridgeless mode as well.
Changelog: [Internal]
Reviewed By: NickGerleman, cipolleschi
Differential Revision: D49323913
fbshipit-source-id: 5b8e4ffc6ea1cdf5bbdecbddd5274d70c9b2eeab
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39502
This diff adds the parsing of the package.json to retrieve the version of react native and it matches it against a regex to decide whether to enable or not the New Architecture.
This change depends on [this CLI's PR](https://github.com/react-native-community/cli/pull/2076).
## Changelog:
[Android][Added] - Parse RN Version to decide whether to enable the New Arch or not.
Reviewed By: cortinico
Differential Revision: D49270012
fbshipit-source-id: 5164a1ddd26f1822c0d717a7a9e2416ec38d78a2
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39501
This change introduce a new model to parse the React Native package.json.
The objects are not connected but they will be used in the next diff
## Changelog:
[Android][Added] - Add a couple of types in the RNGP for json parsing.
Reviewed By: cortinico
Differential Revision: D49270044
fbshipit-source-id: 42a855bb85a5f8e1b1249ab3ebee974ce3fb93fd
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39500
When working on RNTeaster, we discovered that the Kotlin migration. broke something.
This diff make sure we can test RNTester
## Changelog:
[Internal] - Make RNTester's New Architecture Example execute again
Reviewed By: cortinico
Differential Revision: D49154282
fbshipit-source-id: cb1f6b076b129dc088cf2cbb5799b373b6afdcda
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39516
With Xcode15, Apple rewrote the C++ linker.
This is a breaking change that does not work with weak symbols.
As a workaround, apple is suggesting to add `-ld_classic` to the linker in order to readd support for weak symbols. The flag does not exists for Xcode 14.3 or lower, so we need to add it conditionally.
With this change, we introduce a couple of checks in the Hermes build logic:
1. Detect the version of Xcode that is used
2. Add the new flag to `HERMES_EXTRA_LINKER_FLAGS` if Xcode version is 15.
## Changelog:
[Internal] - Make hermes build properly with Xcode 15
Reviewed By: cortinico, dmytrorykun
Differential Revision: D49368675
fbshipit-source-id: 62d8ed81855c426f56ed94b6a2d6da2eb882b355
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39443
This task is unused in CI now and we can safely remove it from our build files.
Changelog:
[Internal] [Changed] - Remove unused downloadAll task
Reviewed By: mdvacca, cipolleschi
Differential Revision: D49233339
fbshipit-source-id: 558b44612b71bb1cb220cc21b8339835ae235302
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39481
This function is hardcoded to `true` and is never used, so I'm removing it.
I found no relevant usages in OSS so that can probably go.
Also see: https://github.com/facebook/react-native/issues/39292 where it got reported.
Changelog:
[Android] [Removed] - Remove unused `canLoadFile` function from HermesExecutor.java
Reviewed By: yungsters, mdvacca
Differential Revision: D49320244
fbshipit-source-id: e680aeb9a9e9e837c35b61eef43b3744ee68a726
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39474
When it comes to Xcode 15 RC, we are aware of two issues:
1. `unary_function` and `binary_function` not available in Cxx17
2. [Weak linking](https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Linking) is not supported anymore.
This change should fix both of the issues, adding the flags to allow for `unary_function`and `binary_function` to be called and adding the `-Wl -ld_classic` flag to `OTHER_LDFLAGS` in case Xcode 15 is detected.
## Changelog:
[Internal] - add the `_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION` and the `-Wl -ld_classic` flags to projects when needed
Reviewed By: dmytrorykun
Differential Revision: D49319256
fbshipit-source-id: bb895f1e60db915db79684f71fa436ce80b42111
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39478
When testing Xcode 15, we realized that a few pods we do not control directly have the IPHONEOS_DEPLOYMENT_TARGET set to old versions of iOS.
We can update that setting to silence the warning with Cocoapods and this is what this script does.
Notice that bumping that setting generated other warning as some APIs have been deprecated.
## Changelog:
[Internal] - Bump min IPHONEOS_DEPLOYMENT_TARGET for 3rd party pods
Reviewed By: dmytrorykun
Differential Revision: D49274837
fbshipit-source-id: 584d105c76d654daa2ecf5eb2f1b9381e70f567a