mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Hook the default-app-setup OnLoad.cpp file with the cxxModuleProvider from RNCLI (#43049)
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
This commit is contained in:
@@ -62,8 +62,16 @@ void registerComponents(
|
||||
std::shared_ptr<TurboModule> cxxModuleProvider(
|
||||
const std::string& name,
|
||||
const std::shared_ptr<CallInvoker>& jsInvoker) {
|
||||
// Not implemented yet: provide pure-C++ NativeModules here.
|
||||
return nullptr;
|
||||
// Here you can provide your CXX Turbo Modules coming from
|
||||
// either your application or from external libraries. The approach to follow
|
||||
// is similar to the following (for a module called `NativeCxxModuleExample`):
|
||||
//
|
||||
// if (name == NativeCxxModuleExample::kModuleName) {
|
||||
// return std::make_shared<NativeCxxModuleExample>(jsInvoker);
|
||||
// }
|
||||
|
||||
// And we fallback to the CXX module providers autolinked by RN CLI
|
||||
return rncli_cxxModuleProvider(name, jsInvoker);
|
||||
}
|
||||
|
||||
std::shared_ptr<TurboModule> javaModuleProvider(
|
||||
|
||||
Reference in New Issue
Block a user