Summary:
This change align the `getSurfacePresenter` and `getModuleRegistry` to the iOS convention for which these should be computed properties with no `get` prefix in their name.
We want to land this change and to pick it in 0.74 so we can remove the `get` versions in 0.75.
## Changelog:
[iOS][Deprecated] - Deprecate `getSurfacePresenter` and `getModuleRegistry` for `surfacePresenter` and moduleRegistry` props.
Reviewed By: javache
Differential Revision: D54253805
fbshipit-source-id: e9ff7db744a73a3bd0f8ae1d87875e54ddd9a1a4
Summary:
This diff removes extra argument from the `extractLibrariesFromJSON` call inside `findLibrariesFromReactNativeConfig`.
This should fix the iOS failurte discribed in https://github.com/facebook/react-native/issues/43204
Changelog: [iOS][Fixed] - Codegen correctly handles react-native.config.js.
Reviewed By: cipolleschi
Differential Revision: D54248400
fbshipit-source-id: 2ae5d0d29f49725877559a5b0edd7d59f8bdefaa
Summary:
Changelog: [General][Fixed] Re-enable listing Hermes debugger targets in chrome://inspect, broken in 0.74 RC
Fixes https://github.com/facebook/react-native/issues/43259.
Reverts D52958725 and fixes the original `Content-Length` Unicode bug using a different approach.
Reviewed By: fabriziocucci
Differential Revision: D54409847
fbshipit-source-id: ed5bb464ab67f37535947646b124814d8bbf797c
Summary:
Those files should not stay in the root `/app` folder but inside the `/app/gradle/wrapper` folder.
I've noticed this in the Upgrade Helper UI hence I'm removing them.
Changelog:
[Internal] [Changed] - Remove accidental files included inside the template
Reviewed By: mdvacca
Differential Revision: D54122995
fbshipit-source-id: 8873a91ffbea20f609c7aabd428a815c77a38db5
Summary:
RN-Tester is currently instacrashing on fast-refresh (pressing r on Metro) as it ends up on `onJSBundleLoadedFromServer`
which throws an exception on Bridgeless mode. I'm fixing it by following the same logic as `onReloadWithJSDebugger`.
Changelog:
[Android] [Fixed] - Do not crash on onJSBundleLoadedFromServer when fast-refreshing on bridgeless mode
Reviewed By: huntie
Differential Revision: D54121838
fbshipit-source-id: 82d98ec0c5b2295f5751525368c956574dd7f3a0
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43049
This connects the OnLoad.cpp file used by OSS apps with the `rncli_cxxModuleProvider`.
This method is created by the CLI and takes care of querying all the TM CXX Modules discovered and returning them.
This PR is currently waiting on https://github.com/react-native-community/cli/pull/2296
Changelog:
[Internal] [Changed] - Hook the default-app-setup OnLoad.cpp file with the cxxModuleProvider from RNCLI
Reviewed By: cipolleschi
Differential Revision: D53812109
fbshipit-source-id: 47bc0ea699516993070cfa0127de97853acf8890
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43070
**Context**
The `codegenNativeComponent` function is a hint for the codegen that the file that contains it is a Native Component spec. Static ViewConfig codegen overwrites this function call by the generated ViewConfig.
If this function is not overwritten by the codegen, it has runtime behaviour that falls back to `requireNativeComponent`. At the time when this system was built `requireNativeComponent` was not supported in Bridgeless mode because it is relied on some Bridge-only functionality. That's why it outputs error in Bridgeless mode.
---
This is not the case any more, we now have interop layers which provide the functionality needed by `requireNativeComponent`.
The SVC codegen is implemented as [Babel plugin](https://github.com/facebook/react-native/tree/main/packages/babel-plugin-codegen). The are scenarios when it is not run for the native component specs:
- If the plugin is not used for whatever reason.
- If Babel is not used for whatever reason.
In order to not to regress the DevX for such cases, we've turned the error into the warning.
**Note:** we use `console.info('⚠️...` instead of `console.warn('...`. That's because `console.warn` also prints a stack trace in the console, and we didn't want to create too much noise.
Changelog: [General][Changed] - codegenNativeComponent show warning and not error if not code generated at build time.
Reviewed By: huntie, rshest
Differential Revision: D53761805
fbshipit-source-id: c924c7668e6d2e45b920672b8a309221be767a73
Summary:
De-duplicate the logic for counting attachments.
This is a minor improvement in the context of my multi-PR work on https://github.com/react-native-community/discussions-and-proposals/issues/695.
## 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
-->
[INTERNAL] [CHANGE] - De-duplicate the logic for counting attachments
Pull Request resolved: https://github.com/facebook/react-native/pull/42596
Reviewed By: rshest
Differential Revision: D53917281
Pulled By: cipolleschi
fbshipit-source-id: cdb9bc834bddd7deffc60f33578464733982fedf
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43105
This is a quality of like improvement for the project we create for the final users.
Codegen generates code in `rncore`, within `node_modules`. This is not the perfect approach but it is working so far.
To make it more robust, we added a small script in React-Fabric podspec to check that codegen run properly when building.
In this way, if a user run `yarn install` and, for any reason, react-native is regenerated, we can provide a better DevX to our users with an actionable message on how to fix the build problem.
##Changelog
[iOS][Added] - Add error message if codegen has not run properly
Reviewed By: cortinico
Differential Revision: D53927788
fbshipit-source-id: a01a33086e4a0a1b0ada6c83283a5fd3fb5ee3eb
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43098
Changelog: [Internal]
Wraps Hermes's `CDPHandler::getState()` API in an engine-agnostic abstraction (`RuntimeAgentDelegate::getExportedState`).
An Agent's lifetime ends when its Target is destroyed, but it can occasionally be useful to persist some state for the "next" Target+Agent of the same type (in the same session) to read.
`RuntimeAgentDelegate` is polymorphic and can't just write arbitrary data to SessionState. Instead, it can now *export* a state object that we'll store and pass to the next `RuntimeTargetDelegate::createAgentDelegate` call.
Reviewed By: huntie
Differential Revision: D53919696
fbshipit-source-id: a8e9b921bc8fc2d195c5dddea9537e6ead3d0358
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43054
Changelog: [iOS][Android][Added] Experimental macro to autolink C++ turbomodules
This implementation is inspired by RCT_EXPORT_MODULE on iOS. We keep a global data structure that maps module names to a lambda that returns the C++ turbomodule. This will come with a hit to startup time. the only way to avoid that is a solution that does static analysis of the list of C++ turbomodules being linked to the library.
Reviewed By: fkgozali
Differential Revision: D53602544
fbshipit-source-id: 8ea49fa576dc718f44b1595b68ab7c606c2db605
Summary:
Changelog: [Internal]
Ports RN's Hermes CDP integration tests to `TYPED_TEST` so we can easily run them against a different Hermes engine adapter in another diff.
bypass-github-export-checks
Reviewed By: huntie
Differential Revision: D53810359
fbshipit-source-id: fb9717bbdc1346ed26b9c8796c13bac641bc5a60
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43091
Fix typo in unit test
Changelog:
[Internal] [Changed] - Fix typo in unit test
Reviewed By: mdvacca
Differential Revision: D53918471
fbshipit-source-id: 0453c01fab1dc04397058577ea61b50994124cf0
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43090
I'm removing test_windows from CircleCI as the job is often flaky for various reasons.
The cost of maintainaining it is so high at the moment, and it brings little to no value to our developers.
We'll re-evaluate what to do with it once we move to GHA.
Changelog:
[Internal] [Changed] - Remove test_windows from CircleCI
Reviewed By: cipolleschi
Differential Revision: D53918601
fbshipit-source-id: b76c92f1eb3d2302595773dff9f8bbc292c0bfcf
Summary:
Changelog: [Internal]
Hermes:
Adds the missing `validateExecutionContext` call to `Runtime.evaluate`.
React Native:
Adds an integration test case to cover the expected behaviour around targeting `Runtime.evaluate` by execution context.
bypass-github-export-checks
Reviewed By: huntie
Differential Revision: D53776532
fbshipit-source-id: 66676383ba5b373fdbf2deb8c75f22791b07e300
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43075
There is a `\` in the new_architecture.rb file that should not be there.
## Changelog:
[Internal] - remove unnecessary character
Reviewed By: cortinico
Differential Revision: D53886548
fbshipit-source-id: a614368bed9f467b80c3384e4adc4be2cbcaba2d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43081
When Hermes i used, it is hermes that provides JSI to React Native and not React-jsi.
This is required to fix the ODR violatons.
Dynamic frameworks requires that all the dependencies are declared explicitly, and missing the `hermes-engine` dependency was breaking the dependency graph.
## Changelog
[Internal] - Make JSIInspector depends o hermes-engine
Reviewed By: motiz88
Differential Revision: D53901016
fbshipit-source-id: a511719647e6203d082696fd572593fd851a1dde
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43065
Changelog: [Internal]
Implements support for [`Runtime.addBinding`](https://cdpstatus.reactnative.dev/devtools-protocol/tot/Runtime#method-addBinding) in the new RN CDP backend.
This implementation is mostly complete and matches Chrome's behaviour, but does not include the ability to target bindings by execution context (the optional `executionContextId` and `executionContextName` params) - that will come in a separate diff for ease of review/landing.
Incidentally, this diff also introduces the `JsiIntegrationPortableTest::expectMessageFromPage` helper, which allows us to "asynchronously" extract the contents of an expected message. For consistency and clarity, we refactor all the other `EXPECT_CALL(this->fromPage(), onMessage(JsonEq(...)))` assertions to use it as well.
Reviewed By: huntie
Differential Revision: D53266709
fbshipit-source-id: 046326acdf5dacc18e179e43589cdd2d012f353a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43064
Changelog: [Internal]
Aligns React Native's CDP backend with V8's behaviour of assigning a sequential ID (here unique within a given PageTarget) to each execution context.
Reviewed By: huntie
Differential Revision: D53776531
fbshipit-source-id: 950599c323f416e8180e42281d94ae9c00f15fb0
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43063
Changelog: [Internal]
Moves the responsibility for managing CDP execution contexts out of the Runtime and into the Instance.
This includes the responsibilities to:
1. Assign execution context IDs/names
2. Emit events when execution contexts are created/destroyed
3. Route CDP messages to the correct Runtime
**Re 1:** We currently assign a *constant* execution context ID, which diverges from V8's implementation but is in line with what Hermes has done so far. I'll follow up separately to assign (locally) unique IDs, since this diff is long enough already.
**Re 3:** Right now, the message routing responsibility is mostly theoretical: only one Runtime exists at a time and "routing" can be done by RuntimeAgent simply deciding whether or not to act on a message (since it receives all messages by default and knows its own `ExecutionContextDescription`). True multi-Runtime / multi-context support is firmly a future concern, and we can revisit this ( = probably hoist more logic into Instance) when we get there.
In the `ExecutionContextNotifications` integration test we can see that a few minor bugs in the current Hermes-based implementation are fixed, and also that execution context management is now engine-agnostic (so we can use `JsiIntegrationPortableTest` instead of `JsiIntegrationHermesTest`).
Reviewed By: huntie
Differential Revision: D53759776
fbshipit-source-id: 50ac126789c95b25f845780df2c3346ec345d5d5
Summary:
While looking at another issue, I realized that in some cases the script was adding the same flags twice and it was leaving the RCT_NEW_ARCH_ENABLED behind.
## Changelog:
[iOS][Fixed] - Pass the right flags to libraries
Pull Request resolved: https://github.com/facebook/react-native/pull/43071
Test Plan: Fixed Unit tests
Reviewed By: huntie
Differential Revision: D53860576
Pulled By: cipolleschi
fbshipit-source-id: 1f6f4852df8d316293b93d7c5fbef09a249893a5
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43060
When inestigating the reason why [`react-native-view-shot`]() ws not working, we realized that there are many libraries that follows this pattern:
```objc
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
if (UIView *view = viewRegistry[reactTag]) {
//do something with the View
}
}];
```
The problem is that, with the New Architecture, that view registry is usually empty, because the components are registered and tracked in another place.
This make many libraries stop working when used with the New Architecture.
This change introduces a class that behaves like a dictionary but that forward the calls to retrieve the view to the right place, in order to get the view that is needed.
Noticably, this approach allow us also to remove some shenanigans we were applying to make sure that the interop layer could access the views wrapped in it, so the current solution is more general and should work in multiple situations.
## Changelog
[iOS][Fixed] - Make sure that `addUIBlock` provides a Dictionary-look-alike object that returns the right views when queried.
Reviewed By: sammy-SC
Differential Revision: D53826203
fbshipit-source-id: 08d359676d69777b88fa9b18dc141187ac42dbce
Summary:
This is a preliminary change which converts RCTConvert to an objectiveC++ file. This is required by the next diffs in the stack.
## Changelog
[iOS][Changed] - Make RCTConvert an Objective-C++ (`.mm`) file in prep for DisplayP3 changes
Reviewed By: javache
Differential Revision: D53520228
fbshipit-source-id: cf45c42955401b4e14fe68221129077817b2598e