Summary:
`butter::small_vector` is backed by a `folly:small_vector` on non-Android platforms in release mode.
It uses the small vector optimization, keeping a fixed size buffer, then falling back to heap allocation.
When I was debugging through props parsing code to figure out a prop not getting passed to Fabric (was being filtered in ViewConfig), I noticed this vector is filled with 199 elements for ViewProps. So It always overflows the current capacity and falls back to heap allocation. This bumps the capacity basde on what I observed with some more headroom.
Changelog:
[Internal]
Reviewed By: sammy-SC
Differential Revision: D47981105
fbshipit-source-id: 3870d8e4fee9748c487d01cc82284de865ea370d
Summary:
This PR splits the build of Hermes for iOS in multiple jobs.
Before, we were building all the slices of Hermes serially. So, we were:
- building the hermesc
- building hermes for iPhone
- building hermes for iPhonesimulator
- building hermes for Macos
- building hermes for Catalyst
- packaging the framework
This job was taking up to 45-50 minutes.
The the four slices (iPhone, iPhonesimulator, Macos, Catalyst) can be parallelized to harvest a speedup in execution.
The following tables contains the executions before and after this change.
- Full Clean Build -> Before: 51' 35" | After: 17'33" ( 3x improvement)
| BEFORE | AFTER |
| --- | --- |
| <img width="1164" alt="Screenshot 2023-07-28 at 11 48 24" src="https://github.com/facebook/react-native/assets/11162307/49cc519c-16f0-4868-b847-602b1cb21f3e"> | <img width="1120" alt="Screenshot 2023-07-28 at 11 16 32" src="https://github.com/facebook/react-native/assets/11162307/85034cd7-751e-4056-ae4f-ed09ac8343e8"> |
| Total time (critical path): `build_hermes_macos-Debug` = 51' 35" | Total time (critical path): `build_hermesc_apple` (2' 56") + `build_apple_slices_hermes-Debug-macosx` (9'23") + `build_hermes_macos-Debug` (5'14") = 17'33" |
- Fully Cached Build -> Before: 4'35" | After: 32" ( 9x improvement)
| BEFORE | AFTER |
| --- | --- |
| <img width="497" alt="Screenshot 2023-07-28 at 14 38 12" src="https://github.com/facebook/react-native/assets/11162307/978eba4d-3524-45ab-bfa5-d9cb9ba63df1"> | <img width="1099" alt="Screenshot 2023-07-28 at 16 12 17" src="https://github.com/facebook/react-native/assets/11162307/f2a8f0bb-545c-4d6f-9b81-cda87151bb62"> |
| Total Time (critical path): `build_hermes_macos-Debug` (4'35") | Total Time (critical path): `build_hermesc_apple` (7") + `build_apple_slices_hermes-Debug-macosx` (7") + `build_hermes_macos-Debug` (32") = 46" |
## Changelog:
[Internal] - Split hermes build to speedup CI and Release
Pull Request resolved: https://github.com/facebook/react-native/pull/38619
Test Plan:
- CircleCI stays green
- Hermes artifact still works for RNTester and app from the template
Reviewed By: cortinico, dmytrorykun
Differential Revision: D47896833
Pulled By: cipolleschi
fbshipit-source-id: 3b9e8d5de9b2a6fb6671444fda09d77b96123ac2
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38749
changelog: [internal]
# Request for comment
I'll gate this and extend this to TextInput if we think this is appropriate solution.
## Problem
Paragraph and TextInput have custom measure functions. They outsource measurements to the host platform. On Android, this means going through JNI (expensive).
When we architected YogaLayoutableShadowNode, we made intentional decision to dirty those nodes on every clone. This was to lower the complexity.
## Solution
One possible to solution is to just check if children, props or textAttributes have changed. If not, nothing has affected the layout and it is safe to mark the node as clean.
Reviewed By: NickGerleman
Differential Revision: D47914641
fbshipit-source-id: ab448fa18599eb2266984eba9f5d935caad1caed
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38748
changelog: [internal]
Android was setting flag `swapLeftAndRightInRTL` to true regardless if the context was RTL or LTR. This causes unnecessary tree traversal + invalidation of all yoga nodes. This is a completely unnecessary work when layout direction is left to right.
To fix this, I made sure Android not longer sets `swapLeftAndRightInRTL` to true and in Fabric we only check the flag for RTL context.
Reviewed By: NickGerleman
Differential Revision: D47913605
fbshipit-source-id: 1d938b0dc9ba16a73b076f626055055162e3495f
Summary:
This job is now unnecessary and we can safely remove it as its work is effectively already
executed by the `test_android` job and is causing us just to spent more CI credits.
Changelog:
[Internal] [Changed] - Remove test_android_docker_image
Reviewed By: cipolleschi
Differential Revision: D47716008
fbshipit-source-id: 68ff2b28da8cfb69e013476f84e903cf3001d5d3
Summary:
This PR is small cleanup in scripts in `rn-tester-e2e` package, it creates unified script so that we can easily pass platform as an argument. Context: https://github.com/facebook/react-native/pull/36267#discussion_r1269378065
## Changelog:
[INTERNAL] [CHANGED] - Unify `test-e2e` command in `rn-tester-e2e` package
Pull Request resolved: https://github.com/facebook/react-native/pull/38701
Test Plan: CI Green ✅
Reviewed By: NickGerleman, cipolleschi
Differential Revision: D47949821
Pulled By: cortinico
fbshipit-source-id: 90bbc96281e89dec505999ff5e51db7ca78da6dc
Summary:
If another pod wants to depend on `React-RCTAppDelegate` and is written in Swift, the user needs to enable modular headers for this pod in the Podfile. This is not very convenient as this cannot be changed as part of the podspec, thus requires additional steps from the user. In Expo, our autolinking just fixes that automatically for all pods that require it (not only for RN's pods).
## Changelog:
[IOS] [CHANGED] - Set DEFINES_MODULE xcconfig in React-RCTAppDelegate to generate a module map for this pod
Pull Request resolved: https://github.com/facebook/react-native/pull/38717
Test Plan:
- rn-tester builds
- `pod install` with a dependency containing Swift code and depending on `React-RCTAppDelegate` no longer requires the user to use modular headers for this pod
Reviewed By: NickGerleman
Differential Revision: D47955835
Pulled By: cipolleschi
fbshipit-source-id: 779516a8396925e52c28b87d6fcf096357333bf5
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38673
This diff adds performance comparison examples to RNTester. In each of the comparison we have bad and good examples, which could be used for the following purposes:
- Collect common performance pitfalls
- Use as testbed on performance tools and metrics for validation hypothesis
Changelog:
[Internal] - Add performance comparison example in RNTester
Reviewed By: rshest
Differential Revision: D47821109
fbshipit-source-id: ea0242ea50724d27c7713bb116335a465e24d1a7
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38659
Run JSI tests against all the Hermes implementations exposed by
`APITestFactory`. To build with the older version of gtest available in
Hermes, the test needed to be slightly modified.
Changelog: [Internal]
Reviewed By: avp
Differential Revision: D47373805
fbshipit-source-id: 58958b4a60dac25f1b7defa490b888f21a665b0c
Summary:
Match the `react` dependency minor of `18.2` and specify a min version of `18.2.6`, which is the first version which includes `React.JSX` namespace. This enables usage of `React.JSX.Element`, now default as part of the template.
Note that `18.2.6` satisfied the previous semver, so new templates are already pulling in a version even newer than this, but updating projects may not do this automatically.
Changelog:
[General][Fixed] - Bump template types/react to 18.2.6
Pull Request resolved: https://github.com/facebook/react-native/pull/38713
Test Plan: CircleCI will build and typecheck a new template app.
Reviewed By: yungsters
Differential Revision: D47943524
Pulled By: NickGerleman
fbshipit-source-id: 49e587f8c2ebfce9fd1f00793a858d72ac0aa09e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38710
Fix a race condition when multiple consumers try to access ReactMarker and trigger calls to native module. Even though ReactMarker uses `ConcurrentLinkedQueue`, the loop itself could race and cause NPE.
Changelog:
[Android][Fixed] - Fix race condition with ReactMarker calls to its native module
Reviewed By: rshest
Differential Revision: D47933993
fbshipit-source-id: a56e5e4f3564922d534235991da5b6842248bf24
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38699
Reduce visibility of ReactHost.prerenderSurface since this is only used from ReactSurface
changelog: [internal] internal
Reviewed By: christophpurrer
Differential Revision: D47915588
fbshipit-source-id: 953b04b531d718434170d63e9f66d22758d26ddf
Summary:
[Codegen 131] This PR add a function `emitUnionProp` to the parser-primitives, as requested on https://github.com/facebook/react-native/issues/34872
## Changelog:
[INTERNAL] [ADDED] - Add `emitUnionProp` function to parser-primitives
Pull Request resolved: https://github.com/facebook/react-native/pull/38705
Test Plan: `yarn test react-native-codegen`
Reviewed By: christophpurrer
Differential Revision: D47921708
Pulled By: rshest
fbshipit-source-id: c2c081c6317928e5eb8b0c1d0640c7b7f40a4b0b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38680
Upgrades to the recently published versions of `deprecated-react-native-listview` and `deprecated-react-native-prop-types`.
Changelog:
[Internal]
Reviewed By: NickGerleman
Differential Revision: D47893357
fbshipit-source-id: 430cbb51086cfd1c346a6a5c15b2e90358ab6565
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38648https://github.com/facebook/react-native/pull/38475 made this code no longer no-op on Android, which caused regressions documented in https://github.com/facebook/react-native/issues/38470#issuecomment-1639620459 due to VirtualizedList having more out-of-date information.
We are already coalescing scroll events on both Android and iOS, which will ensure we are not flooded with events. VirtualizedList also already inserts an artificial 50ms delay to new renders by default when high priority work is not happening (see `updateCellsBatchingPeriod`). This limits the heavy work done by VirtualizedList (no new renders or expensive math on scroll events), while letting the list still have the most recent events.
We can eventually remove this once VirtualizedList is able to use OffScreen universally.
Changelog:
[General][Changed] - Remove default 50ms Scroll Event Throttling in VirtualizedList
Reviewed By: ryancat
Differential Revision: D47823772
fbshipit-source-id: 55d22a1074235ccc1b2cf167f6b1758640c79edb
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38703
This change consolidates the pattern for setting up out-of-tree platform options for core classes like ViewProps and ViewEventEmitter. A similar pattern was used for Touch.h. As we move towards documenting how to build an out-of-tree platform, it would be nice to specify a set of HostPlatformX classes that need to be implemented and made resolvable from specific header paths.
At this point, there is:
- HostPlatformViewProps
- HostPlatformViewEventEmitter
- HostPlatformViewTraitsInitializer
- HostPlatformTouch
- HostPlatformColor
The other benefit of this pattern is to DRY helper aliases like SharedViewEventEmitter and SharedViewProps.
## Changelog:
[General] [Added] - Use more consistent pattern for out-of-tree platform Fabric C++ class extensions
Reviewed By: christophpurrer
Differential Revision: D47917598
fbshipit-source-id: 58ee9677eefd34eb0bc2d321103314642c457cd8
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38681
Desktop platforms send additional information with onTouch(Start|Move|End|Cancel) events, including modifier keys and mouse button information.
This information has not historically been available for mobile platforms, so rather than blindly adding the fields, this change adds a hook for out-of-tree platforms to extend the data in nativeEvent payload for Fabric Touch events.
## Changelog:
[General] [Added] - Support customization of underlying Touch event representation in out-of-tree platforms
Reviewed By: christophpurrer
Differential Revision: D47896016
fbshipit-source-id: 02e3fce854302412381b0bd9254474c6bb5c63ac
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38668
On other platforms (e.g., react-native-windows), it's possible that platform colors may not be efficiently represented as int32_t values. In the case of react-native-windows, Color can either be an ARGB value or a list of fallback strings for platform colors.
This change should decouple how platforms represent color values, allowing them to manage how they are used at the point they are used.
## Changelog:
[General] [Added] - Support customization of underlying Color representation in out-of-tree platforms
Reviewed By: NickGerleman
Differential Revision: D47873465
fbshipit-source-id: 1dbb36be409c04ce87b356d75503ec0cf88f1c5b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38582
Some out of tree platforms may have extra events (e.g., events for different input modalities) that don't exist on other platforms.
For example, react-native-windows and react-native-macos have `onKeyUp` and `onKeyDown` that can be emitted from any native component.
This change provides a hook for out of platforms to customize which events can be emitted from all native components.
## Changelog:
[General] [Added] - Support additional View events in out of tree platform Fabric implementations
Reviewed By: christophpurrer
Differential Revision: D47721603
fbshipit-source-id: 5ae2ff0f6c1b1dfd72b0a310c1309a85e6b170b1
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38580
We already have a differential between Android and iOS View props that force view flattening (or unflattening) behaviors. Other out-of-tree platforms may have a need to customize view flattening behaviors.
This change adds a ViewTraitsInitializer header that out of tree platforms can inject to include platform-specific ViewProps fields when considering view flattening behaviors.
## Changelog:
[General] [Added] - Support customization of View traits for flattening in out of tree platform Fabric implementations
Reviewed By: christophpurrer
Differential Revision: D47721377
fbshipit-source-id: b7d6dda2f20e153a0277861d04709090756c96ce
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38549
Out of tree platforms may need different implementations of ViewProps. In fact, Android does already with props like `needsOffscreenAlphaCompositing` and `focusable`. This diff is not opinionated on whether these props should actually be shared on all platforms. Props like `focusable` may be a good candidate for generalizing to all platforms. However, there will always be a need for one platform to experiment with a new prop while it's not available yet on another, especially when considering out of tree platforms.
This diff moves the existing ViewProps class to BaseViewProps, aliases ViewProps as BaseViewProps for iOS for now, and moves Android-specific view props to it's own header and implementation.
## Changelog:
[General] [Added] - Support additional View props in out of tree platform Fabric implementations
Reviewed By: christophpurrer
Differential Revision: D47492635
fbshipit-source-id: 5739174a2b1d28ba84f4398ccc1cc0b846ebea79
Summary:
[Codegen 135] This PR introduces `getPaperTopLevelNameDeprecated` to parser base class and abstracts the logic out of typescript and parser events as requested on https://github.com/facebook/react-native/issues/34872
## Changelog:
[Internal] [Changed] - Add `getPaperTopLevelNameDeprecated` to parser base class and update usages.
Pull Request resolved: https://github.com/facebook/react-native/pull/38683
Test Plan:
Run `yarn jest react-native-codegen` locally and ensure CI is green
## Screenshot of test passing locally:
<img width="1060" alt="Screenshot 2023-07-30 at 10 04 24 AM" src="https://github.com/facebook/react-native/assets/64726664/3f61377b-9f44-45e8-bece-d4fd6bcc4567">
Reviewed By: cipolleschi
Differential Revision: D47902816
Pulled By: rshest
fbshipit-source-id: 6fab53e02cfc3f0aaa3ffd795c3fe1d2f723e060
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38690
Bridgeless mode needs static view configs support. Let's not not enable it until this support is shipped to OSS.
Changelog: [Internal]
Reviewed By: cipolleschi
Differential Revision: D47913713
fbshipit-source-id: 207be574295455cc215f907803b596bf48dca88b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38540
Changelog: [Internal]
this is never set to yes, clean it up
we need to decide if this is actually part of our feature set
Reviewed By: cipolleschi
Differential Revision: D47620233
fbshipit-source-id: 6f530015da0645d721bef7ff7c5d512113273b1a
Summary:
[Codegen 130] This PR add a `getLiteralValue` function to the Parser interface, which returns the literal value of an union represented, given an option. as requested on https://github.com/facebook/react-native/issues/34872
## Changelog:
[INTERNAL] [ADDED] - Add `getLiteralValue` function to codegen Parser
Pull Request resolved: https://github.com/facebook/react-native/pull/38651
Test Plan: Run `yarn jest react-native-codegen` and ensure CI is green
Reviewed By: cipolleschi
Differential Revision: D47912960
Pulled By: rshest
fbshipit-source-id: d9426fef4c0f92c5244d5c4c72202ec29099b76e
Summary:
This added React-ImageManager to the use_frameworks! - a lot of rpm modules podspec need this.
bypass-github-export-checks
## Changelog:
[iOS] [FIXED] - Add React-ImageManager path to work with use_frameworks!
For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
Pull Request resolved: https://github.com/facebook/react-native/pull/38247
Test Plan: Should not be breaking - it will add to the header_search_paths React-ImageManager
Reviewed By: dmytrorykun
Differential Revision: D47593749
Pulled By: cipolleschi
fbshipit-source-id: a66e90707e5fa73573deab1f04e8d8693869a90c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38686
In this diff I'm introducing the FrameworkAPI annotation to document APIs that are provided ONLY for frameworks
changelog: [internal] internal
Reviewed By: cortinico
Differential Revision: D47839411
fbshipit-source-id: 254a1f6cd42279478fba0ddb3f3736bb2b675bae