Skip to content

Commit

Permalink
Hook the default-app-setup OnLoad.cpp file with the cxxModuleProvider…
Browse files Browse the repository at this point in the history
… from RNCLI (#43049)

Summary:
Pull Request resolved: #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 react-native-community/cli#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
  • Loading branch information
cortinico authored and facebook-github-bot committed Feb 20, 2024
1 parent 488dd78 commit 4ecf57e
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 4ecf57e

Please sign in to comment.