Summary:
Brings in line with rest of code base and avoids running into this error
```
‘sharedApplication’ is unavailable: not available on iOS (App Extension) — Use view controller based solutions where appropriate instead.
```
when `Requires Only App-Extension-Safe-API` is set to Yes.
## Changelog
[iOS] [Fixed] - Update usage of UIApplication.sharedApplication in RCTKeyCommands
Pull Request resolved: https://github.com/facebook/react-native/pull/34787
Test Plan: Setting `Requires Only App-Extension-Safe-API` to Yes before this change means the app will not compile, after the change it does.
Reviewed By: dmytrorykun
Differential Revision: D39812410
Pulled By: cipolleschi
fbshipit-source-id: 78d185ba20301b10609e4a387f000f0cfda55663
Summary:
Within the `hermes-engine.podspec` contained in the RN repo (at `react-native/main/sdks/hermes-engine/`), there's a bit of logic that triggers `./utils/build-ios-framework.sh` and `./utils/build-mac-framework.sh` .
The issue is that we all thought that that `./utils/build-ios-framework.sh` would invoke the React native version of the scripts (since the podspec file lives right next to the `utils` folder) but, in reality, it doesn't. It just so happens that the Hermes repo has a root level `utils` folder which is (you guessed it) where the Hermes variation of those build scripts live.
So, when running the pod install command in a react-native project (build from source), it will go and download the hermes source code (since the `source[:git]` gets set) but then it will use the **hermes** variation of the `build-*.sh` scripts.
[Read more here](https://github.com/facebook/react-native/pull/34513#issuecomment-1248286691).
This PR is taking kudo's proposed [patch here](https://github.com/reactwg/react-native-new-architecture/discussions/68#discussioncomment-3654191) - props for the fix go to him.
## Changelog
<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[iOS] [Fixed] - Change hermes logic in build scripts for Apple to use the correct files
Pull Request resolved: https://github.com/facebook/react-native/pull/34710
Test Plan: Tested by kudo in his work, and in my PR locally - [see here](https://github.com/facebook/react-native/pull/34513#issuecomment-1249431302).
Reviewed By: cortinico
Differential Revision: D39647057
Pulled By: cipolleschi
fbshipit-source-id: 6520e248801a307ca2f8886a3853dd1ff4af193d
Summary:
Changelog: [Internal][Bridgeless][iOS]
# Before diff
Be in Venice > run Metro > run FBiOS > navigate to any RN surface.
`UIManagerBinding createAndInstallIfNeeded` happens After `ReactInstance loadScript -> evaluateJavaScript`: install Fabric UIManager before main bundle execution
Reviewed By: RSNara
Differential Revision: D39760231
fbshipit-source-id: f17bf02e9b1fb0f9b0ff24c86aa6dc9349c42192
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34776
CocoaPods is not used when Hermes is built in Circle CI, so we cannot rely on the React Native CocoaPods scripts to be loaded.
The get_hermes_build_type function is removed from the RN CocoaPods scripts and in its place, the ENV['PRODUCTION'] envvar is accessed directly.
Changelog: [Internal]
Reviewed By: cipolleschi
Differential Revision: D39778190
fbshipit-source-id: 12083b7b4533b4ad7bb7a08612883983a0583616
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34761
Separate debug and release tarballs are built in CI. Use the appropriate Hermes artifacts tarball when building hermes-engine.
Add hermes.rb tests.
Changelog:
[iOS] [Changed] - Remove debugger from Hermes when building for release
Reviewed By: cipolleschi
Differential Revision: D39698499
fbshipit-source-id: e6b10d34c7f94c2f86fc47d8b97466011aaa75cc
Summary:
Fix remaining NDK comment for new architecture
## Changelog
<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[General] [Fixed] - Fix remaining NDK comment for new architecture
Pull Request resolved: https://github.com/facebook/react-native/pull/34769
Reviewed By: cipolleschi
Differential Revision: D39762860
Pulled By: cortinico
fbshipit-source-id: 35a3c9fed58d32bd6dc16c0d6bb217a3c2849612
Summary:
We want to fix the order of execution of layout, layout effects and passive effects in React Native, but the use of the Fabric background executor for layout complicates this (and other things).
This brings back a flag to disable this background thread to do layout synchronously in JavaScript, before the execution of layout effects and passive effects.
This is expected to regress performance on some screens, so we need to address the antipatterns in those screens before shipping this.
Changelog: [internal]
Reviewed By: javache
Differential Revision: D39727131
fbshipit-source-id: 4323b089234d3304ca3bfe5697668fb44ac64c12
Summary:
Currently, fbios link groups depend on supermodules to generate. To continue supporting
link groups while allowing us to migrate off supermodules, we'll add a `fbios_link_group` label on all fbios targets to persist the current hierarchical information.
Reviewed By: jkeljo
Differential Revision: D39543862
fbshipit-source-id: 2abe5b3ee883e77336076d88436a1c84139b5a97
Summary:
Aside from the log output, these changes do not change the behavior of the hermes-engine Pod.
Removed unused git branch checks.
Use react_native_path var to build filepaths.
Edit Hermes build from source log message to be consistent with other logs.
Changelog: [Internal]
Reviewed By: cipolleschi
Differential Revision: D39699165
fbshipit-source-id: 7e389eb5315fc5a2510b84eddac2f499a3e65157
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34704
Create separate hermes-engine tarballs for release and debug builds, and only include the debugger in debug builds.
Changes the hermes-engine podspec to use a debug Hermes build by default in order to preserve the inclusion of the debugger.
Upcoming changes should split the hermes-engine Pod to allow Xcode to use release and debug builds as needed.
Changelog:
[iOS][Changed] - Use debug Hermes builds by default
Reviewed By: cipolleschi
Differential Revision: D39326467
fbshipit-source-id: 94c5fe7db80194d22fced6717c5efc7accd36d48
Summary:
In `buildEventSchema` and `buildPropSchema`, they check into property types to see if the given property could be converted into an event schema or a property schema. The original implementation only handles limited cases, I refactor them and make them easier to maintain.
In `getPropertyType` in `events.js`, it handles `(T)` at a wrong place, fixed.
In `getPropertyType` in `props.js`, it doesn't handle `(T)`, fixed.
And I also fixed some other issues to make the codegen reports error better.
There are many duplicated test cases that cover every piece of the code, I changed some of them so that it tests both original cases and new cases.
## Changelog
[General] [Changed] - Handle (T) and undefined properly in turbo module component codegen
Pull Request resolved: https://github.com/facebook/react-native/pull/34693
Test Plan: `yarn jest` passed in `packages/react-native-codegen`
Reviewed By: NickGerleman
Differential Revision: D39647075
Pulled By: cipolleschi
fbshipit-source-id: 8e1df2b54aab37b7151d0bf74260e2eba0602777
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34746
The changes made in
https://github.com/facebook/react-native/pull/34694
introduced the need to have the env variable TMP_PUBLISH_DIR for the publishing and set-rn-version scripts to work.
This break any usage of set-rn-version when the env variable is not set upfront.
With this change, we are creating a temp folder in the scope that requires it (e.g. set-rn-version.js) and then passing the path to the save/revert functions.
## Changelog
[Internal] [Added] - Do not depend on an ENV variable when publishing and setting the RN version.
Reviewed By: cipolleschi
Differential Revision: D39683565
fbshipit-source-id: 21d85d1c16c4cb7324636ceb5eba626ff8cbb775
Summary:
This updates the `transform` property to support string values as requested on https://github.com/facebook/react-native/issues/34425. This also updates the existing unit tests of the `processTransform` function ensuring the style processing works as expected and updates the TransformExample on RNTester in order to facilitate the manual QA of this.
## Changelog
[General] [Added] - Add string support to the transform property
Pull Request resolved: https://github.com/facebook/react-native/pull/34660
Test Plan:
1. Open the RNTester app and navigate to the Transforms page
2. Check the transform style through the `Transform using a string` section
https://user-images.githubusercontent.com/11707729/189550548-ee3c14dd-11c6-4fd1-bd74-f6b52ecb9eae.mov
Reviewed By: lunaleaps
Differential Revision: D39423409
Pulled By: cipolleschi
fbshipit-source-id: 0d7b79178eb33f34ae55a070ce094360b544361f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34754
This Diff is the second step of enabling the CodeGen to parse and generate a NativeState for the components.
The feature has been largely requested by the OSS community but it could be also helpful for people in Meta.
## Changelog
[General][Added] - Always generate an empty NativeState for Fabric Components
Reviewed By: cortinico
Differential Revision: D39696435
fbshipit-source-id: e24768af78f59696c0b4db009e8065bb5c89316b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34750
This Diff is the first step of enabling the CodeGen to parse and generate a NativeState for the components.
The feature has been largely requested by the OSS community but it could be also helpful for people in Meta.
To allow the generation of custom `NativeState`, we first have to always generate a `ViewEventEmitter`: that's because the `ConcreteShadowNode` template lists the Generics with this order: `Name`, `Props`, `EventEmitter`, Others...
If we skip the `EventEmitters` and we put the `State`, React Native would think that the State is actually an `EventEmitter` and the build step will fail.
## Changelog
[General][Added] - Always generate a ViewEventEmitter for Fabric Components
Reviewed By: cortinico
Differential Revision: D39509869
fbshipit-source-id: 390cc146ef013baf1ed09d55a0182a5aeb5b9d9e
Summary:
This PR adds [verdaccio](https://github.com/verdaccio/verdaccio) to release packages in the `packages` directory during the E2E test on CI.
The rationale behind this is the following:
- Firstly, we wanted to push the [monorepo RFC](https://github.com/react-native-community/discussions-and-proposals/pull/480). We hit an issue when renaming the packages to follow the same convention caused by the e2e test using the template to fail. This is because the template installs packages from the live version of npm – and if you just rename a package in a given PR without releasing it, the package understandably can't be installed since it's not published, yet – as you can see [here](https://app.circleci.com/pipelines/github/facebook/react-native/15286/workflows/149df51f-f59b-4eb3-b92c-20c513111f04/jobs/282135?invite=true#step-108-283).
- Secondly, the current e2e test on `main` does not actually test the latest code of the packages in the `packages` directory as it simply downloads the latest versions from npm. This creates a divide between what's tested and what users should expect when using nightlies or when a new minor is released.
## Changelog
<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[Internal] [Changed] - Use verdaccio for template e2e test
Pull Request resolved: https://github.com/facebook/react-native/pull/34577
Test Plan: `test_js` CI check should pass. Additionally, I have temporarily updated the [PR](https://github.com/facebook/react-native/pull/34572) renaming `assets` to `assets-registry` to include the verdaccio changes – the `test_js` passes there, additionally proving merging this PR will unblock us with the rename PRs.
Reviewed By: cipolleschi
Differential Revision: D39723048
Pulled By: cortinico
fbshipit-source-id: aeff3811967360740df3b3dbf1df50e506fb72d8
Summary:
when specifying dev server without port, e.g. http://www.example.com/, there are some issues.
1. redbox error
<img src="https://user-images.githubusercontent.com/46429/190540390-8ee420f2-7642-427b-9f2e-e0c6d31015f8.png" width="30%">
2. showing -1 in loading view
<img src="https://user-images.githubusercontent.com/46429/190540727-158f35ad-359f-443a-a4b0-768dd2f7e400.png" width="50%">
the root cause is coming from [`java.net.URL.getPort()` will return -1 when the url doesn't have a port](https://developer.android.com/reference/java/net/URL#getPort()). this pr replaces the parser to [`okhttp3.HttpUrl`](https://square.github.io/okhttp/4.x/okhttp/okhttp3/-http-url/#port) that it will have default port 80 for http or port 443 for https. the two call paths should only serve http/https address, not file:// address. it should be safe to change from java.net.URL to okhttp3.HttpUrl.
not fully related, in the case above, android will connect to `ws://www.example.com/:8097` for react-devtools
we should strip the trailing slash in *setUpReactDevTools.js*
## Changelog
[Android] [Fixed] - Fix port as -1 if dev server without specifying port on Android
Pull Request resolved: https://github.com/facebook/react-native/pull/34705
Test Plan:
test on rn-tester with the following steps
1. `yarn start`
2. open another terminal and run `ngrok http 8081` and it will return a tunnel url, e.g. `71a1-114-36-194-97.jp.ngrok.io`
3. open dev setting in app and change the dev server to `71a1-114-36-194-97.jp.ngrok.io`
5. reload the app
Reviewed By: cipolleschi
Differential Revision: D39573988
Pulled By: cortinico
fbshipit-source-id: 397df90ab30533207bd87a3f069132d97c22c7fd
Summary:
## Summary
In the past, NativeAnimatedModule could animate **both** Paper **and** Fabric components.
For Fabric nodes, we needed to manually flush NativeAnimatedModule's operations queue. So, we started tracking which nodes were Fabric owned in NativeAnimatedModule.
## Changes
With bridgeless mode, all components must be Fabric-owned. So, should be able to remove this fabric ownership tracking logic and **always flush.**
## Is this safe?
In the worst case, we over-flush. This doesn't seem bad. cc sammy-SC.
## Do we still need flushing?
Arguably, all this manual flushing should be unnecessary, because we already migrated AnimatedModule's Paper integration to RCTSurfacePresenterObserver, here: D14336760 (544d9fb10b). So, do we still need this flushing?
Yes. Here's what happens when you disable all the manual flushing in bridgeless mode: https://pxl.cl/2dqPf.
Long-term, we need to re-think this operations queuing in NativeAnimatedTurboModule. I left my thoughts in T130668424 (Investigation - Day 5).
Changelog: [Internal]
Reviewed By: p-sun
Differential Revision: D39592477
fbshipit-source-id: e971edc0d99661a37b5f430bce46c78acaa121c0
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34747
Just a minor cleanup after the AGP bump.
Changelog:
[Internal] [Changed] - Cleanup of ReactAndroid/build.gradle after AGP 7.3.x bump
Reviewed By: cipolleschi
Differential Revision: D39687286
fbshipit-source-id: 441e449b51b25e4152cf1e7e7e22c7c9f1432d05
Summary:
This behaviour diverges from the original SafeAreaView implementation and causes issues when you try to use SafeAreaView in non-root placements (not recommended)
Changelog: [iOS][Internal]
Reviewed By: sammy-SC
Differential Revision: D39497303
fbshipit-source-id: 03bc288557f611bd4a8c16b3a6df8887e89ee9ec
Summary:
When `GenerateRCTThirdPartyFabricComponentsProviderCpp.js` generates `RCTThirdPartyFabricComponentsProvider.mm` an edge case happens in the following situation:
- The same library exports multiple modules with one component each (i.e. one component per file);
- The **first component** is excluded for iOS via the `excludedPlatforms` property in *codegenNativeComponent*.
A "loose" comma appears in the generated template, breaking the code.
```c++
Class<RCTComponentViewProtocol> RCTThirdPartyFabricComponentsProvider(const char *name) {
static std::unordered_map<std::string, Class (*)(void)> sFabricComponentsClassMap = {
, // <-- the offending comma
{"NativeComponent2", NativeComponent2Cls}, // rnmylibrary
};
}
```
At some point, `GenerateRCTThirdPartyFabricComponentsProviderCpp.js` does not properly filter out empty arrays resulting from excluded components. This does not seem to be a problem when the excluded component is not the first being processed, as the comma gets added at the end of the previous line, after the comment with the name of the library.
## Changelog
<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[iOS] [Fixed] - Fix error in the Codegen template for ThirdPartyFabricComponentsProvider
Pull Request resolved: https://github.com/facebook/react-native/pull/34738
Test Plan:
<!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes the user interface. -->
This is the schema that leads to the bug. Notice that the first component was excluded for iOS.
```json
{
"modules": {
"ComponentFile1": {
"type": "Component",
"components": {
"NativeComponent1": {
"excludedPlatforms": ["iOS"]
"extendsProps": [
{
"type": "ReactNativeBuiltInType",
"knownTypeName": "ReactNativeCoreViewProps"
}
],
"events": [],
"props": [],
"commands": []
}
}
},
"ComponentFile2": {
"type": "Component",
"components": {
"NativeComponent2": {
"extendsProps": [
{
"type": "ReactNativeBuiltInType",
"knownTypeName": "ReactNativeCoreViewProps"
}
],
"events": [],
"props": [],
"commands": []
}
}
}
}
```
`GenerateRCTThirdPartyFabricComponentsProviderCpp.js` should generate a template without the comma in the wrong position (before NativeComponent2).
I also added an additional test case to cover this problem. All the other tests passed.
Reviewed By: sammy-SC
Differential Revision: D39686573
Pulled By: cipolleschi
fbshipit-source-id: 6054464d024218eb0b2e02974aa5cc7c8aebbbc9
Summary:
Checking if Hermes is enabled is failing because there is no `podfile.lock` file in the directory where this script is executed and `USE_HERMES` will be set to `false` which will prevent building Hermes binary jsbundle.
## Changelog
[iOS] [Fixed] - `HERMES_ENABLED` check fixed in react-native-xcode.sh
Pull Request resolved: https://github.com/facebook/react-native/pull/34675
Test Plan:
1. Enable Hermes
2. Make a release build
3. Verify the `main.jsbundle` file is Hermes binary bundle
Reviewed By: cortinico
Differential Revision: D39686608
Pulled By: cipolleschi
fbshipit-source-id: 237c77ced484d4ab77e576c7a2bb7b6826228017
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34739
AGP 7.3.0 just got released which is glorious!
This allows us to remove a lot of unnecessary boilerplate to handle correct task ordering
inside the template
This requires "react-native-gradle-plugin" version 0.71.1 to be published on NPM.
Changelog:
[Android] [Changed] - Bump AGP to 7.3.0 inside the template
Reviewed By: mdvacca, dmytrorykun
Differential Revision: D39653419
fbshipit-source-id: 517363c952cbad2be0f2766c0a2b7daf3e75048b
Summary:
As we're shipping the AGP 7.3.x bump which requires
changes of the Gradle Plugin, I'm bumping a version so I can use it
already in the new template.
Changelog:
[Internal] [Changed] - Bump react-native-gradle-plugin to 0.71.1
Reviewed By: mdvacca, dmytrorykun
Differential Revision: D39653418
fbshipit-source-id: 9e898530345f1a3461c44c04b4cc5e7736a0f6a5
Summary:
`verifyVirtualizedList` chokes on missing displayName in DEV, due to a mistake in D39648806 (a0d1585cdb). Not sure why this isn't triggered in Jest tests (maybe it is able to fill displayName via transform?), but this fixes the issue in dev mode.
Changelog:
[Internal][Fixed] - Fix crash in DEV when VirtualizedList_EXPERIMENTAL is loaded
Reviewed By: mdvacca
Differential Revision: D39670991
fbshipit-source-id: b1a784aa3fffdc5f2f025eb1f689307132aad9b6
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34724
Following on from the recent upgrade from Jest 26->27, this brings us up to present day Jest 29 for tests of React Native itself, Metro, and Meta-internal code. An update to the template for RN apps will follow.
Changelog:
[Internal][Fixed] Update to Jest 29
Reviewed By: huntie
Differential Revision: D39543504
fbshipit-source-id: b47fdb678212b475881ec19085f6cd45a4530333
Summary: Changelog: [Internal] - A refactor to pass the object PointerEventState containing relevant state / and also properties for pointerEvent objects
Reviewed By: vincentriemer
Differential Revision: D39626285
fbshipit-source-id: e2ff5313ef03d7d2d36c35ca459950ec07650df2
Summary:
Changelog: [Internal]
Stop using `TouchEventCoalescingKeyHelper` for tracking and stop making the distinction between traditional touch events (down, up, move) vs hover only events. The only events that currently coalesce are `onpointermove` events. This change uses just one counter now that we increment whenever some non-move event is fired.
Let me know if there's a simpler way to ensure counter doesn't overflow.
This change also ensures we're overriding `getCoalescingKey` which isn't used by Fabric but for old event emitter it might be (which we use for native animations). Part of that requires the `coalescingKey` to be a short so updated to that.
There was also a bug where I forgot to pass `mLastButtonState` to one of the dispatch calls. Will be wrokign on refactor so its less argument soup.
Reviewed By: javache
Differential Revision: D39530927
fbshipit-source-id: 689fa98580b206a480cc08121971cdf96bdbbfaa
Summary:
The prop is removed as part of D39589089 (bc5cb7cd79) (no longer does anything). Remove from the TS declarations.
Changelog:
[General][Removed] - Remove listKey from TS typings
Reviewed By: lunaleaps
Differential Revision: D39650827
fbshipit-source-id: dd9b5eccba1b9f6964a6d60ea5bae9913e8396e3
Summary: Changelog: [Internal] - Update the base accessibility props to include the added aria props. See https://github.com/facebook/react-native/compare/0.70-stable...main for changes.
Reviewed By: cipolleschi
Differential Revision: D39633224
fbshipit-source-id: 6c08ab8540b8b6e2b57f066a35754376c5ae3d68
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34707
AGP 7.3.0 just got released which is glorious!
This allows us to remove a lot of unnecessary boilerplate to handle correct task ordering
on both React Android & the template
Changelog:
[Android] [Changed] - Bump AGP to 7.3.0
Reviewed By: mdvacca
Differential Revision: D39553534
fbshipit-source-id: 9680893e9f48cac867206aeb7eb468dbf91c1643
Summary:
This PR refactors the Animated directory to use ESModule imports/exports instead of using a mixture of the 2 module formats, as requested on https://github.com/facebook/react-native/issues/34425.
## Changelog
[Internal] [Changed] - Convert all files in the Animated directory to use ESModule imports/exports
Pull Request resolved: https://github.com/facebook/react-native/pull/34539
Test Plan: This doesn't really add or modify any existing features so checking if CI passes should be enough
Reviewed By: yungsters
Differential Revision: D39235720
Pulled By: yungsters
fbshipit-source-id: 84b4c0a71dc9fca1ab7053263f1cf7c336df58c1
Summary:
VirtualizedList uses a combination of ES6 and CommonJS imports/exports. This moves fully to ES6 imports and exports, in the experimental version (which should soon replace the original).
Changelog:
[Internal][Changed] - Move VirtualizedList_EXPERIMENTAL to ES6 import/export
Reviewed By: rshest
Differential Revision: D39648806
fbshipit-source-id: a5da40f62a6010cd5b9894b02a91af86d3a8b995
Summary:
VirtualizedList is large and complicated, getting larger and more complicated. This splits out a subcomponent, the cell renderer into its own file, since it is relatively isolated already. This uses the copy from VirtualizedList_EXPERIMENTAL, whose only real difference is exposing focus capture events to the containing VirtualizedList.
Changelog:
[Internal][Changed] - Extract VirtualizedListCellRenderer
Reviewed By: rshest
Differential Revision: D39648087
fbshipit-source-id: bb7c2eff0c658713c256650596f86e8788019baf
Summary:
Now that the prop noops, remove the usages of the property. This is the point of no return for the prop.
Replaced listKey usage with a combination of `flow check`, regex replace, manual inspection.
Changelog:
[General][Removed] - Remove usages of listKey
Reviewed By: fred2028
Differential Revision: D39589089
fbshipit-source-id: 722ebb7dce038a2709656394b7d736e72f488bb7