Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: TurboModule support and indentation
  • Loading branch information
thymikee committed May 18, 2022
commit 98bb2b7b41b444c202ee9b336fec4787f80ccfeb
21 changes: 13 additions & 8 deletions packages/platform-android/native_modules.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ namespace facebook {
namespace react {

std::shared_ptr<TurboModule> rncli_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams &params) {
{{ rncliCppModuleProviders }}
{{ rncliCppModuleProviders }}
return nullptr;
}

void rncli_registerProviders(std::shared_ptr<ComponentDescriptorProviderRegistry const> providerRegistry) {
{{ rncliCppComponentDescriptors }}
{{ rncliCppComponentDescriptors }}
return;
}

Expand Down Expand Up @@ -281,21 +281,26 @@ class ReactNativeModules {

if (packages.size() > 0) {
rncliCppIncludes = packages.collect {
"#include <${it.libraryName}.h>\n#include <react/renderer/components/${it.libraryName}/ComponentDescriptors.h>"
def result = "#include <${it.libraryName}.h>"
if (it.componentDescriptors.size() > 0) {
result += "\n#include <react/renderer/components/${it.libraryName}/ComponentDescriptors.h>"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things here:

  1. Please export to a constant the react/renderer/components/ and ComponentDescriptors.h
  2. There might be some escaping to do. I'll check and get back to you

}
result
}.join('\n')
rncliCppModuleProviders = packages.collect {
"""
auto module_${it.libraryName} = ${it.libraryName}_ModuleProvider(moduleName, params);
""" auto module_${it.libraryName} = ${it.libraryName}_ModuleProvider(moduleName, params);
if (module_${it.libraryName} != nullptr) {
return module_${it.libraryName};
}"""
}.join("\n")
rncliCppComponentDescriptors = packages.collect {
def result = ""
if (it.componentDescriptors.size() > 0) {
it.componentDescriptors.collect {
"providerRegistry->add(concreteComponentDescriptorProvider<${it}>());"
result += it.componentDescriptors.collect {
" providerRegistry->add(concreteComponentDescriptorProvider<${it}>());"
}.join('\n')
}
}
result
}.join("\n")
}

Expand Down