Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42635
Changelog: [Internal]
Adds a RuntimeAgent interface to the modern CDP backend, plus an `InstanceTargetDelegate::createRuntimeAgent()` method. This allows the RN integration to provide an engine-specific CDP implementation.
This diff includes all the plumbing in Bridge and Bridgeless to route `createRuntimeAgent()` calls to the right place - ending up at `JSExecutor::createRuntimeAgent()` and `JSIRuntimeHolder::createInspectorAgent` respectively - at which point we currently return `nullptr` to signify that JS debugging isn't supported.
## Next steps
In upcoming diffs we'll add concrete implementations of `RuntimeAgent`, and teach both Bridge and Bridgeless to create them as appropriate:
* `HermesRuntimeAgent` for Hermes
* `FallbackRuntimeAgent` for all other JS engines (JSI or not)
We'll also (likely) add assertions to ensure that any JSI runtime that reports itself as "inspectable" (a flag used to control some of the in-app debugging UI) comes with a non-default `createRuntimeAgent()` implementation. We avoid this for now to prevent crashing the modern backend on Hermes.
NOTE: Like the rest of the modern CDP backend, the `RuntimeAgent` API is 100% experimental and subject to change without notice. A *future* version of this API will allow out-of-tree JSI engines to integrate with the modern CDP backend. Either way, it is intended strictly for the use case of integrating with a JS engine, not for adding any other framework-level CDP functionality.
Reviewed By: huntie
Differential Revision: D51231326
fbshipit-source-id: 81e87c5134df73cc4aac0f9d5793a5236b5720d6
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42783
This change will fix the publishing of Nightlies for React Native with the right version
## Changelog:
[Internal] - Update the package.json of react native correctly.
Reviewed By: cortinico, huntie
Differential Revision: D53309082
fbshipit-source-id: 2fa4d4fdf4f984603c6b3d3690fa3c464ee6d030
Summary:
On latest `main`, RN Tester was crashing for me just after loading the JS bundle with `java.lang.UnsatisfiedLinkError: dlopen failed: library "libreactfeatureflagsjni.so" not found`
It seems to be named `featureflagsjni` instead in [here](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/CMakeLists.txt#L11)
## Changelog:
No changelog needed
Pull Request resolved: https://github.com/facebook/react-native/pull/42770
Test Plan:
```bash
./gradlew :packages:rn-tester:android:app:installHermesDebug -PreactNativeArchitectures=arm64-v8a
```
Then run the app, the app was crashing before the fix, not crashing now
Reviewed By: javache
Differential Revision: D53268873
Pulled By: cortinico
fbshipit-source-id: f098ca12baadab358f72b1c9d5720123248b8e1a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42774
Reorganise release scripts so that command entry points are grouped based on execution context, which also reflects dependencies between scripts.
Also:
- Document the current behaviours of these scripts.
- Relocate utils out of the root contents.
- Replace `exec` call to `set-rn-version` script with function import.
NOTE: `yarn trigger-react-native-release` (documented command in release process) is unchanged, since this is aliased from `package.json`.
```
├── releases
│ ├── templates/
│ ├── utils/
│ ├── remove-new-arch-flags.js
│ ├── set-rn-version.js
│ └── update-template-package.js
├── releases-ci
│ ├── prepare-package-for-release.js
│ └── publish-npm.js
└── releases-local
└── trigger-react-native-release.js
```
Changelog: [Internal]
Reviewed By: cipolleschi
Differential Revision: D53274341
fbshipit-source-id: eec2befc43e7a47fd821b2e2bcc818ddffbb6cf7
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42781
Change in [31cf4c4ead](https://github.com/facebook/react-native/commit/31cf4c4eada59bde62f30e14024719779fc23a91) broke the template for bridgeless as we changed the signature of a method in the header of `RCTAppDelegate`.
This change aligns the API between RCTAppDelegate and the template's AppDelegate
## Changelog:
[iOS][Fixed] - Align the the bundleURL API from `RCTAppDelegate` to template's `AppDelegate`
Reviewed By: cortinico, dmytrorykun
Differential Revision: D53274434
fbshipit-source-id: 25bad702ba05db2e3a6a9449abbda7d8e2fdb8a0
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42771
This feature was first introduced here https://github.com/facebook/react-native/pull/34580
And then removed here https://github.com/facebook/react-native/pull/41654
The motivation for its removing was that Node resolver should handle all those cases for which `react-native.config.js` was used. But it turns out that it fails for the setup that `react-native-builder-bob` has.
This diff brings back support for defining external libraries in `react-native.config.js`.
Changelog: [iOS][Fixed] - Bring back support for defining external libraries in react-native.config.js
Reviewed By: cipolleschi
Differential Revision: D53267857
fbshipit-source-id: 7625dfe7b4a4651eb60eaec725f94f222a244e30
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42777
During view preallocation eventEmitter information is not being passed to the platform. This causes bugs with emision of events during initial rendering when using the new Fabric Event dispatching system.
e.g. Rendering a TextInput that has 'onFocus' event and also has autoFocus enabled.
The new Fabric Event dispatching system dispatch events earlier (this is expected)
In this diff I'm fixing this issue by ensuring that all preallocated views have an eventEmitter (when its shadowNode has an eventEmitter)
This was actually implemented in the past, but in order to optimize, we run an experiment (D29117957) and it was later deleted.
(D40356386). I didn't find details of the results of the experiment.
We could run another experiment to understand potential negative perf impact of this change, although I believe it's the right thing to do here.
Changelog: [Android][Fixed] Fix delivery of events during initial rendering in new architecture
Reviewed By: sammy-SC
Differential Revision: D53108114
fbshipit-source-id: 0b56b7495db63e4a478f4b34e91f4bcbf452ef92
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42748
React Native has globally enabled RTTI within `rn_xplat_cxx_library`, ahead of RTTI being forced on (regardless of flag) in Android apps (it was previously enabled everywhere but Android, which has caused us no small share of headaches, with public JSI APIs designed around clients using RTTI).
This diff:
1. Mechanically replaces usages of `traitCast` with equivalent calls to `dynamic_cast` or `dynamic_pointer_cast`
1. These have similar semantics as current iteration of `traitCast`, where we return `nullptr` for pointer form, or throw on invalid cast for reference form.
2. Removes `IdentifierTrait` as a requirement to cast to a ShadowNode
3. Removes the ShadowNode traits used solely as cast identities
This enables consistent usage of `dynamic_cast` (including for user defined ShadowNodes), and also exposes some places where `traitCast` allowed implicit const conversion.
The OSS builds should already have RTTI on, and will be able to use `dynamic_cast` on RN provided types (`traitCast` is not extendable).
Changelog:
[General][Breaking] - Delete traitCast and identifier traits
Reviewed By: sammy-SC
Differential Revision: D53215009
fbshipit-source-id: d20cbf66b725f5565fa5d03332010d87f2b08b61
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42721
If left and right are swapped, this code assumes every yoga layoutable shadownode is a view, and mutates its props as if they were ViewProps. This is not safe, and could lead to memory corruption.
Changelog: [Internal]
Reviewed By: rozele
Differential Revision: D53213652
fbshipit-source-id: c43e0f80fdd5889761317c1243ccc0ab392e3443
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42719
The task T175989432 started firing on October 30 2020, which correspond to the landing of D24512203. I believe disabling CustomDrawOrder could be a potential cause of T175989432, that's why in this diff I'm creating an experiment to understand what is the impact (negative or positive) of re-enabling CustomDrawOrder in RN Android
Original diff: D24512203
Changelog: [Internal] internal
Reviewed By: javache
Differential Revision: D53150292
fbshipit-source-id: f0abbc7d175c2cd717ce87bbe69aeaf3db0b0e5c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42776
Changelog: [Internal] set all monorepo packages (including react-native) to one version and update all inter-dependencies (including the template)
Reviewed By: huntie
Differential Revision: D53251917
fbshipit-source-id: 95330ca66dcb7234a3f09752ecc3ed9087ced4bf
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42744
This adds a nightlies-feedback workflow, which our partners can get permission to mirror the results of their nightlies CI workflows. We do this to use our internal tools that are restricted to Meta owned Github projects.
The benefit to partners is that they can add this step to their workflow:
```
- if: ${{ success() || failure() }}
env:
OUTCOME: ${{ contains(steps.*.conclusion, 'failure') && 'fail' || 'pass' }}
run: |
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/facebook/react-native/actions/workflows/nightlies-feedback.yml/dispatches \
-d "$(printf '{"ref":"main","inputs":{"outcome":"%s","stage":"needs_an_action","link":"http://github.com/some/action","version":"%s"}}' "$OUTCOME" "${{ inputs.version }}" )"
```
### Feedback:
It's complicated, but there are ways to simplify this for our users. I'd like to prove out that it's valuable first with Expo.
### Limits:
There's certainly a lot of room for improvement, which we could provide with a published action (populate the ref correctly, simplify gathering the outcome, labelling of failing step correctly, etc...).
### Changelog: [Internal]
Reviewed By: cipolleschi
Differential Revision: D53229996
fbshipit-source-id: 10e4ba5b5fd85935b1b03aaafa41ef8b96d2faca
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42743
When working on Mobile Home, we found a component (RNCSafeAreaView) that was going through the interop layer.
The component eits an event as soon as its content view changes, but this is too early: the block that emits the event is still nil at that point in time and that makes the app crash.
There might be other components with similarbehavior, therefore, we are fixing it at the interop layer, setting the props immediately after the component is created.
## Changelog:
[iOS][Fixed] - Immediately set props of Components that goes through the interop layer
Reviewed By: sammy-SC
Differential Revision: D53230471
fbshipit-source-id: 90a19e0e87fea381b348b5a7e723ab8b416b828c
Summary:
## Changelog:
Changelog: [Internal] Generated 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
Pull Request resolved: https://github.com/facebook/react-native/pull/42759
Reviewed By: cortinico
Differential Revision: D53268094
Pulled By: huntie
fbshipit-source-id: a18d513df4614be1b7715c9c69d8de58baac9548
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42762
This renames `performance.reactNativeStartupTiming` as `performance.rnStartupTiming` to align with the recommended vendor prefix for React Native.
This API is still private, so it's safe to rename.
Changelog: [internal]
Reviewed By: javache
Differential Revision: D53264515
fbshipit-source-id: 6e7a222901071594cac0ca8a0ac78e56e60ab132
Summary:
Some jobs are failing because we moved a file and we did not update the CI with the new path
## Changelog:
[Internal] - Update path to relocated file in CI
Pull Request resolved: https://github.com/facebook/react-native/pull/42767
Test Plan: CircleCI is green (a part from test_android, fixed by another PR)
Reviewed By: huntie, dmytrorykun
Differential Revision: D53266042
Pulled By: cipolleschi
fbshipit-source-id: 7e611b96c204cdbbf794a731fe0db58cb31657fb
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42720
The request ID was used for in-memory request caching purpose only. There wasn't much reason to use the sophisticated monotonic number, so let's just use a static 64-bit unsigned int counter. With the more-or-less unique UUID prefix, this should have an extremely low chance of collision.
Changelog: [Internal]
Reviewed By: philIip, sammy-SC
Differential Revision: D53205641
fbshipit-source-id: e6da12029624058dc877e9cbe2000af4df938870
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42727
All these classes are NullSafe, let's mark them as NullSafe(Local) to ensure lint detect errors in the future
changelog: [internal] internal
Reviewed By: NickGerleman
Differential Revision: D53200096
fbshipit-source-id: 2d965ebcb568e7bbff4b37db11070c5079fa6394
Summary:
The goal is to provide testing utilities that use Fabric and concurrent rendering by default to support the new RN architecture. Currently most testing is done through ReactTestRenderer, which is an overly-simplified rendering environment, non-concurrent by default, and over exposes internals. A dedicated RN environment in JS can allow for more realistic test execution.
This is the initial commit to create the `react-native-test-renderer` package. It currently only offers a simple toJSON() method on the root of a test, which is used for snapshot unit tests. We will be iterating here to add a query interface, event handling, and more.
## Changelog:
[GENERAL] [ADDED] - Added react-native-test-renderer package for Fabric rendered integration tests
Pull Request resolved: https://github.com/facebook/react-native/pull/42644
Test Plan:
```
$> cd packages/react-native-test-renderer
$> yarn jest
```
Output:
```
PASS src/renderer/__tests__/render-test.js
render
toJSON
✓ returns expected JSON output based on renderer component (7 ms)
Test Suites: 1 passed, 1 total
1 passed, 1 total
Snapshots: 1 passed, 1 total
Time: 2.869 s
```
Reviewed By: yungsters
Differential Revision: D53183101
Pulled By: jackpope
fbshipit-source-id: 8e29ba35f55f6c4eb2613ab106bc669d72f33d1d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42740
Follow-up to a CircleCI breakage introduced by D53001971.
This was missed by both the typechecker (no Flow in file) and CI (no PR-time jobs covering this script).
Changelog: [Internal]
Reviewed By: cortinico, GijsWeterings, cipolleschi
Differential Revision: D53228096
fbshipit-source-id: fbbe1538ee52b8452399d86489239434d3a068be
Summary:
When we changed dark mode, the semantic color was not applied because we use color components, it's not dynamic. So let's store the `UIColor` for semantic color directly.
https://github.com/facebook/react-native/assets/5061845/bd6d15fe-01eb-4ad7-9844-a19ef8585dae
## Changelog:
[IOS] [FIXED] - [Fabric] Fixes semantic color not work when dark mode changed
Pull Request resolved: https://github.com/facebook/react-native/pull/42737
Test Plan: semantic color changed when switch dark mode.
Reviewed By: christophpurrer
Differential Revision: D53226806
Pulled By: cipolleschi
fbshipit-source-id: 66d5417fa1bb6a5da498e903675a93b20d920c0a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42636
Changelog: [Internal]
Models the Native instance lifecycle in the modern CDP backend, by:
1. Registering the instance, once created, with `PageTarget`.
2. While an instance is registered, delegating messages from `PageAgent` to an internal `InstanceAgent`.
3. Unregistering the instance once it is invalidated and about to be destroyed.
We use this infrastructure to implement two simple behaviours that will be superseded in future diffs (mainly by delegating work to the JSVM), but that are useful as stubs for testing:
* Sending [`Runtime.executionContextDestroyed`](https://cdpstatus.reactnative.dev/devtools-protocol/tot/Runtime#event-executionContextDestroyed), [`Runtime.executionContextsCleared`](https://cdpstatus.reactnative.dev/devtools-protocol/tot/Runtime#event-executionContextsCleared), and [`Runtime.executionContextCreated`](https://cdpstatus.reactnative.dev/devtools-protocol/tot/Runtime#event-executionContextCreated) events to the frontend when reloading the instance.
* Implementing a toy version of [`Runtime.getHeapUsage`](https://cdpstatus.reactnative.dev/devtools-protocol/tot/Runtime#method-getHeapUsage) (that always reports zero memory usage) to exercise the Page→Instance message dispatching logic.
iOS Bridge/Bridgeless and `PageTargetTest` are the only integrations that exist as of this diff, and are all updated here; Android will follow later.
## Object lifetimes
* PageTarget owns an InstanceTarget that it creates (in `registerInstance`) and destroys (in `unregisterInstance`).
* `registerInstance` returns a raw `InstanceTarget&` reference, which becomes invalid upon calling `unregisterInstance`. It's the caller's responsibility to stop using the reference at the point of calling `unregisterInstance`.
* InstanceTarget holds a raw `InstanceTargetDelegate&` reference. It's the caller's responsibility to keep this reference valid at least until `unregisterInstance` returns.
## Thread safety
* As with PageTarget's constructor and destructor, It's the caller's responsibility to invoke `registerInstance` and `unregisterInstance` on the main thread (or using appropriate synchronisation).
* `InstanceAgent` handles messages on the same thread as `PageAgent` (typically the platform-specific main thread) and receives a copy of the same thread-safe `FrontendChannel` for sending messages back.
Reviewed By: huntie
Differential Revision: D51214056
fbshipit-source-id: 2dc2ff30d2dda6887871831a818aa117ca3e6e91
Summary:
Internally, we synched the windows folders in react-native. This added the `windows` folder in the `platform` folder of react/graphics.
This breaks the build for iOS internally as the `React-graphics` pod is now importing both the `ios` and the `windows` folders, but, of course, some of the Windows headers are not available to iOS.
This change excludes the windows folder from the iOS Pod, when building for Meta engineers.
## Changelog:
[internal] - exclude the `plafrom/windows` folder from the `React-graphics` pod.
Reviewed By: motiz88
Differential Revision: D53228890
fbshipit-source-id: 2be5b71f6556e5da76496f0d64a98318477ad3c5
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42731
This matches the behaviour we have for DefaultTurboModuleManagerDelegate, where we handle the lack of this being set gracefully. It's probably worth still logging this, as it may point at an incorrectly configured app.
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D53048064
fbshipit-source-id: 3ef10da3a7779a1274a1a1793387cf8cdf36c535
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42735
This realigns the NDK versions used to build the two tools.
Changelog:
[Internal] [Changed] - Bump FBJNI to 0.6.0
Reviewed By: cipolleschi
Differential Revision: D53223301
fbshipit-source-id: 640e9008ed460e58423fb26b6e7030e264ef9320
Summary:
After update to the latest `react-native` version
we discover that we are unable to use `number%` value for `translate*` props :
```tsx
StyleSheet.create({
root: {
transform: [
{ translateX: '-50%' },
// ^^^^^^ TS Error: Type string is not assignable to type AnimatableNumericValue | undefined
],
}
});
```
---
percentage values are supported, demo: https://snack.expo.dev/retyui/test-tstransform
## Changelog:
[GENERAL] [FIXED] - Update typescript definition of `translateX` & `translateX` to be able to use percentage values
Pull Request resolved: https://github.com/facebook/react-native/pull/42671
Test Plan: `yarn tsc --noEmit`
Reviewed By: rozele, cortinico
Differential Revision: D53146046
Pulled By: NickGerleman
fbshipit-source-id: 3486e7a9b55b98c36cc96b2bca4bb27841061e80
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42730
Reviewing and modernising this script as part of simplifying our release publish workflow.
- Drop unused `--dependency-versions` arg from CLI entry point
- Simplify templating approach
- Type as Flow
- Drop dependencies on `shelljs` and `yargs`
- Relocate under `scripts/releases/`
- Rewrite tests as snapshot tests
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D53001971
fbshipit-source-id: e55a71a0bb37e3e18ba1e582a5c46ddd58823d81
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42699
Changelog: [internal]
The test was fine on C++. The reason is probably that C++ destroys the process between tests (effectively resetting singletons) while iOS doesn't.
This fixes the test by implementing a correct `TearDown` method to reset the flags.
Reviewed By: rshest
Differential Revision: D53178474
fbshipit-source-id: 6a0f67f1a59fe47f73a495344d4c0daa8eafa3c4
Summary:
This PR resolves issues with retrieving appearance in multi-window apps by calling `RCTKeyWindow()` instead of retrieving the AppDelegate window property. It also does small optimization in the RCTAlertController.
## Changelog:
[IOS] [FIXED] - Fix retrieving current appearance in multi-window apps
Pull Request resolved: https://github.com/facebook/react-native/pull/42231
Test Plan: CI Green, it should work the same as before
Reviewed By: NickGerleman
Differential Revision: D52802756
Pulled By: cipolleschi
fbshipit-source-id: 60b5f7045f41be19caae5102f0dc321d4ecdcd2f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42714
For 0.74, we would like to have Bridgeless as the default when the New Architecture is enabled.
## Changelog:
[Android][Breaking] - Make bridgeless the default when the New Arch is enabled
Reviewed By: cortinico
Differential Revision: D52600227
fbshipit-source-id: 0d967c73cd805710c501c020ad892f059a0fb117
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42182
For 0.74, we would like to have Bridgeless as the default when the New Architecture is enabled.
## Changelog:
[iOS][Breaking] - Make bridgeless the default when the New Arch is enabled
Reviewed By: cortinico
Differential Revision: D52598104
fbshipit-source-id: a551bbdda7f7b76d1647036137983e39e612ea45
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42708
When pressing `r` on simulator in Bridgeless mode, we have a race condition between:
- RCTKeyCommands evaluating the blocks to be invoked
- ReactNative invalidating the DevMenu with the list of RCTKeyCommands (on which ReactNative is iterating).
The fix checks which commands need to be executed, stores them in an array and then iterates on the array, which is local to the function call, avoiding any concurrency issue.
## Changelog:
[iOS][Fixed] - Refactored RCT_handleKeyCommand to avoid concurrency issues
Reviewed By: motiz88
Differential Revision: D53186262
fbshipit-source-id: 60ae8974a9df7289395c8a9e9abe2e34e4c40309
Summary:
This API is better implemented as a component: PopupMenuAndroid. Please see the ancestor diff D52712758.
Changelog: [Android][Deprecated] Deprecate UIManager.showPopupMenu, and UIManager.dismissPopupMenu
Reviewed By: mdvacca
Differential Revision: D52887565
fbshipit-source-id: 42da6bdaa707395c5694ec8ae3eb77b64cdefb69
Summary:
In React Native 0.75, we will remove UIManager.showPopupMenu(), UIManager.dismissPopupMenu().
To replace that API, we are introducing this <PopupMenuAndroid> component. This component works in both Fabric and Paper!
For the usage, please see PopupMenuAndroidExample.js.
Changelog: [Android][Added] - Introduce PopupMenuAndroid to replace UIManager.showPopupMenu()
Reviewed By: mdvacca
Differential Revision: D52712758
fbshipit-source-id: a87628a168d64fabbcc4d0f7b694fa639a927448