Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ android {
resValue "string", "app_name", project.ext.react.appName

def cppStd = reactNativeVersion >= v(0, 74, 0) ? "-std=c++20" : "-std=c++17"
if (reactNativeVersion >= v(0, 76, 0) || enableNewArchitecture) {
if (enableNewArchitecture) {
externalNativeBuild {
cmake {
arguments "-DANDROID_STL=c++_shared",
Expand Down
6 changes: 1 addition & 5 deletions android/app/src/main/jni/AutolinkingCompat.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,14 @@
#define autolinking_cxxModuleProvider facebook::react::autolinking_cxxModuleProvider
#define autolinking_registerProviders facebook::react::autolinking_registerProviders

#elif __has_include(<rncli.h>) // < 0.75
#else // < 0.75

#include <rncli.h>

#define autolinking_ModuleProvider facebook::react::rncli_ModuleProvider
#define autolinking_cxxModuleProvider facebook::react::rncli_cxxModuleProvider
#define autolinking_registerProviders facebook::react::rncli_registerProviders

#else // Autolinking is handled elsewhere in the old architecture (paper)

#define REACTAPP_LEGACY_AUTOLINKING 1

#endif // __has_include(<autolinking.h>)

#endif // REACTAPP_JNI_AUTOLINKINGCOMPAT_H_
2 changes: 0 additions & 2 deletions android/app/src/main/jni/ComponentsRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ void ComponentsRegistry::registerNatives()

facebook::react::DefaultComponentsRegistry::registerComponentDescriptorsFromEntryPoint =
[](std::shared_ptr<ComponentDescriptorProviderRegistry const> registry) {
#ifndef REACTAPP_LEGACY_AUTOLINKING
// Register providers generated by `@react-native-community/cli`
autolinking_registerProviders(registry);
#endif // !REACTAPP_LEGACY_AUTOLINKING
};
}

Expand Down
4 changes: 0 additions & 4 deletions android/app/src/main/jni/OnLoad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ using facebook::react::TurboModule;

namespace
{
#ifndef REACTAPP_LEGACY_AUTOLINKING
std::shared_ptr<TurboModule> cxxModuleProvider(const std::string &name,
const std::shared_ptr<CallInvoker> &jsInvoker)
{
Expand All @@ -43,18 +42,15 @@ namespace
// And we fallback to the module providers autolinked by RN CLI
return autolinking_ModuleProvider(name, params);
}
#endif // !REACTAPP_LEGACY_AUTOLINKING
} // namespace

JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *)
{
return facebook::jni::initialize(vm, [] {
#ifndef REACTAPP_LEGACY_AUTOLINKING
DefaultTurboModuleManagerDelegate::cxxModuleProvider = &cxxModuleProvider;
DefaultTurboModuleManagerDelegate::javaModuleProvider = &javaModuleProvider;
DefaultComponentsRegistry::registerComponentDescriptorsFromEntryPoint =
&autolinking_registerProviders;
#endif // !REACTAPP_LEGACY_AUTOLINKING
});
}

Expand Down
2 changes: 0 additions & 2 deletions android/app/src/main/jni/TurboModuleManagerDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@ std::shared_ptr<TurboModule> TurboModuleManagerDelegate::getTurboModule(StringRe
std::shared_ptr<TurboModule> TurboModuleManagerDelegate::getTurboModule(
StringRef name, const JavaTurboModule::InitParams &params)
{
#ifndef REACTAPP_LEGACY_AUTOLINKING
// Try autolinked module providers first
auto module = autolinking_ModuleProvider(name, params);
if (module != nullptr) {
return module;
}
#endif // !REACTAPP_LEGACY_AUTOLINKING

return rncore_ModuleProvider(name, params);
}
Expand Down
Loading