getJSIModuleProvider() {
- final ComponentFactory componentFactory = new ComponentFactory();
- CoreComponentsRegistry.register(componentFactory);
-
- // Here we register a Components Registry.
- // The one that is generated with the template contains no
- // components and just provides you the one from React Native core.
- MainComponentsRegistry.register(componentFactory);
-
- final ReactInstanceManager reactInstanceManager =
- getReactInstanceManager();
-
- ViewManagerRegistry viewManagerRegistry = new ViewManagerRegistry(
- reactInstanceManager.getOrCreateViewManagers(
- reactApplicationContext));
-
- return new FabricJSIModuleProvider(
- reactApplicationContext,
- componentFactory,
- ReactNativeConfig.DEFAULT_CONFIG,
- viewManagerRegistry);
- }
- });
- return specs;
- }
- };
- }
-}
diff --git a/native/android/app/src/main/java/app/comm/android/newarchitecture/components/MainComponentsRegistry.java b/native/android/app/src/main/java/app/comm/android/newarchitecture/components/MainComponentsRegistry.java
deleted file mode 100644
--- a/native/android/app/src/main/java/app/comm/android/newarchitecture/components/MainComponentsRegistry.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package app.comm.android.newarchitecture.components;
-
-import com.facebook.jni.HybridData;
-import com.facebook.proguard.annotations.DoNotStrip;
-import com.facebook.react.fabric.ComponentFactory;
-import com.facebook.soloader.SoLoader;
-
-/**
- * Class responsible to load the custom Fabric Components. This class has native
- * methods and needs a corresponding C++ implementation/header file to work
- * correctly (already placed inside the jni/ folder for you).
- *
- * Please note that this class is used ONLY if you opt-in for the New
- * Architecture (see the `newArchEnabled` property). Is ignored otherwise.
- */
-@DoNotStrip
-public class MainComponentsRegistry {
- static {
- SoLoader.loadLibrary("fabricjni");
- }
-
- @DoNotStrip private final HybridData mHybridData;
-
- @DoNotStrip
- private native HybridData initHybrid(ComponentFactory componentFactory);
-
- @DoNotStrip
- private MainComponentsRegistry(ComponentFactory componentFactory) {
- mHybridData = initHybrid(componentFactory);
- }
-
- @DoNotStrip
- public static MainComponentsRegistry register(
- ComponentFactory componentFactory) {
- return new MainComponentsRegistry(componentFactory);
- }
-}
diff --git a/native/android/app/src/main/java/app/comm/android/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java b/native/android/app/src/main/java/app/comm/android/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java
deleted file mode 100644
--- a/native/android/app/src/main/java/app/comm/android/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package app.comm.android.newarchitecture.modules;
-
-import com.facebook.jni.HybridData;
-import com.facebook.react.ReactPackage;
-import com.facebook.react.ReactPackageTurboModuleManagerDelegate;
-import com.facebook.react.bridge.ReactApplicationContext;
-import com.facebook.soloader.SoLoader;
-import java.util.List;
-
-/**
- * Class responsible to load the TurboModules. This class has native methods and
- * needs a corresponding C++ implementation/header file to work correctly
- * (already placed inside the jni/ folder for you).
- *
- *
Please note that this class is used ONLY if you opt-in for the New
- * Architecture (see the `newArchEnabled` property). Is ignored otherwise.
- */
-public class MainApplicationTurboModuleManagerDelegate
- extends ReactPackageTurboModuleManagerDelegate {
-
- private static volatile boolean sIsSoLibraryLoaded;
-
- protected MainApplicationTurboModuleManagerDelegate(
- ReactApplicationContext reactApplicationContext,
- List packages) {
- super(reactApplicationContext, packages);
- }
-
- protected native HybridData initHybrid();
-
- native boolean canCreateTurboModule(String moduleName);
-
- public static class Builder
- extends ReactPackageTurboModuleManagerDelegate.Builder {
- protected MainApplicationTurboModuleManagerDelegate
- build(ReactApplicationContext context, List packages) {
- return new MainApplicationTurboModuleManagerDelegate(context, packages);
- }
- }
-
- @Override
- protected synchronized void maybeLoadOtherSoLibraries() {
- if (!sIsSoLibraryLoaded) {
- // If you change the name of your application .so file in the Android.mk
- // file, make sure you update the name here as well.
- SoLoader.loadLibrary("comm_appmodules");
- sIsSoLibraryLoaded = true;
- }
- }
-}
diff --git a/native/android/app/src/main/jni/CMakeLists.txt b/native/android/app/src/main/jni/CMakeLists.txt
deleted file mode 100644
--- a/native/android/app/src/main/jni/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-cmake_minimum_required(VERSION 3.13)
-# Define the library name here.
-project(comm_appmodules)
-# This file includes all the necessary to
-# let you build your application with the New Architecture.
-include(${REACT_ANDROID_DIR}/cmake-utils/ReactNative-application.cmake)
diff --git a/native/android/app/src/main/jni/MainApplicationModuleProvider.h b/native/android/app/src/main/jni/MainApplicationModuleProvider.h
deleted file mode 100644
--- a/native/android/app/src/main/jni/MainApplicationModuleProvider.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#pragma once
-
-#include
-#include
-
-#include
-
-namespace facebook {
-namespace react {
-
-std::shared_ptr MainApplicationModuleProvider(
- const std::string &moduleName,
- const JavaTurboModule::InitParams ¶ms);
-
-} // namespace react
-} // namespace facebook
diff --git a/native/android/app/src/main/jni/MainApplicationModuleProvider.cpp b/native/android/app/src/main/jni/MainApplicationModuleProvider.cpp
deleted file mode 100644
--- a/native/android/app/src/main/jni/MainApplicationModuleProvider.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-#include "MainApplicationModuleProvider.h"
-
-#include
-#include
-
-namespace facebook {
-namespace react {
-
-std::shared_ptr MainApplicationModuleProvider(
- const std::string &moduleName,
- const JavaTurboModule::InitParams ¶ms) {
- // Here you can provide your own module provider for TurboModules coming from
- // either your application or from external libraries. The approach to follow
- // is similar to the following (for a library called `samplelibrary`:
- //
- // auto module = samplelibrary_ModuleProvider(moduleName, params);
- // if (module != nullptr) {
- // return module;
- // }
- // return rncore_ModuleProvider(moduleName, params);
-
- // Module providers autolinked by RN CLI
- auto rncli_module = rncli_ModuleProvider(moduleName, params);
- if (rncli_module != nullptr) {
- return rncli_module;
- }
-
- return rncore_ModuleProvider(moduleName, params);
-}
-
-} // namespace react
-} // namespace facebook
diff --git a/native/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h b/native/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h
deleted file mode 100644
--- a/native/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#include
-#include
-
-#include
-#include
-
-namespace facebook {
-namespace react {
-
-class MainApplicationTurboModuleManagerDelegate
- : public jni::HybridClass<
- MainApplicationTurboModuleManagerDelegate,
- TurboModuleManagerDelegate> {
- public:
- // Adapt it to the package you used for your Java class.
- static constexpr auto kJavaDescriptor =
- "Lapp/comm/android/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate;";
-
- static jni::local_ref initHybrid(jni::alias_ref);
-
- static void registerNatives();
-
- std::shared_ptr getTurboModule(
- const std::string &name,
- const std::shared_ptr &jsInvoker) override;
- std::shared_ptr getTurboModule(
- const std::string &name,
- const JavaTurboModule::InitParams ¶ms) override;
-
- /**
- * Test-only method. Allows user to verify whether a TurboModule can be
- * created by instances of this class.
- */
- bool canCreateTurboModule(const std::string &name);
-};
-
-} // namespace react
-} // namespace facebook
diff --git a/native/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.cpp b/native/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.cpp
deleted file mode 100644
--- a/native/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-#include "MainApplicationTurboModuleManagerDelegate.h"
-#include "MainApplicationModuleProvider.h"
-
-namespace facebook {
-namespace react {
-
-jni::local_ref
-MainApplicationTurboModuleManagerDelegate::initHybrid(
- jni::alias_ref) {
- return makeCxxInstance();
-}
-
-void MainApplicationTurboModuleManagerDelegate::registerNatives() {
- registerHybrid({
- makeNativeMethod(
- "initHybrid", MainApplicationTurboModuleManagerDelegate::initHybrid),
- makeNativeMethod(
- "canCreateTurboModule",
- MainApplicationTurboModuleManagerDelegate::canCreateTurboModule),
- });
-}
-
-std::shared_ptr
-MainApplicationTurboModuleManagerDelegate::getTurboModule(
- const std::string &name,
- const std::shared_ptr &jsInvoker) {
- // Not implemented yet: provide pure-C++ NativeModules here.
- return nullptr;
-}
-
-std::shared_ptr
-MainApplicationTurboModuleManagerDelegate::getTurboModule(
- const std::string &name,
- const JavaTurboModule::InitParams ¶ms) {
- return MainApplicationModuleProvider(name, params);
-}
-
-bool MainApplicationTurboModuleManagerDelegate::canCreateTurboModule(
- const std::string &name) {
- return getTurboModule(name, nullptr) != nullptr ||
- getTurboModule(name, {.moduleName = name}) != nullptr;
-}
-
-} // namespace react
-} // namespace facebook
diff --git a/native/android/app/src/main/jni/MainComponentsRegistry.h b/native/android/app/src/main/jni/MainComponentsRegistry.h
deleted file mode 100644
--- a/native/android/app/src/main/jni/MainComponentsRegistry.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#pragma once
-
-#include
-#include
-#include
-#include
-
-namespace facebook {
-namespace react {
-
-class MainComponentsRegistry
- : public facebook::jni::HybridClass {
- public:
- // Adapt it to the package you used for your Java class.
- constexpr static auto kJavaDescriptor =
- "Lapp/comm/android/newarchitecture/components/MainComponentsRegistry;";
-
- static void registerNatives();
-
- MainComponentsRegistry(ComponentFactory *delegate);
-
- private:
- static std::shared_ptr
- sharedProviderRegistry();
-
- static jni::local_ref initHybrid(
- jni::alias_ref,
- ComponentFactory *delegate);
-};
-
-} // namespace react
-} // namespace facebook
diff --git a/native/android/app/src/main/jni/MainComponentsRegistry.cpp b/native/android/app/src/main/jni/MainComponentsRegistry.cpp
deleted file mode 100644
--- a/native/android/app/src/main/jni/MainComponentsRegistry.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-#include "MainComponentsRegistry.h"
-
-#include
-#include
-#include
-#include
-#include
-
-namespace facebook {
-namespace react {
-
-MainComponentsRegistry::MainComponentsRegistry(ComponentFactory *delegate) {}
-
-std::shared_ptr
-MainComponentsRegistry::sharedProviderRegistry() {
- auto providerRegistry = CoreComponentsRegistry::sharedProviderRegistry();
-
- // Autolinked providers registered by RN CLI
- rncli_registerProviders(providerRegistry);
-
- // Custom Fabric Components go here. You can register custom
- // components coming from your App or from 3rd party libraries here.
- //
- // providerRegistry->add(concreteComponentDescriptorProvider<
- // AocViewerComponentDescriptor>());
- return providerRegistry;
-}
-
-jni::local_ref
-MainComponentsRegistry::initHybrid(
- jni::alias_ref,
- ComponentFactory *delegate) {
- auto instance = makeCxxInstance(delegate);
-
- auto buildRegistryFunction =
- [](EventDispatcher::Weak const &eventDispatcher,
- ContextContainer::Shared const &contextContainer)
- -> ComponentDescriptorRegistry::Shared {
- auto registry = MainComponentsRegistry::sharedProviderRegistry()
- ->createComponentDescriptorRegistry(
- {eventDispatcher, contextContainer});
-
- auto mutableRegistry =
- std::const_pointer_cast(registry);
-
- mutableRegistry->setFallbackComponentDescriptor(
- std::make_shared(
- ComponentDescriptorParameters{
- eventDispatcher, contextContainer, nullptr}));
-
- return registry;
- };
-
- delegate->buildRegistryFunction = buildRegistryFunction;
- return instance;
-}
-
-void MainComponentsRegistry::registerNatives() {
- registerHybrid({
- makeNativeMethod("initHybrid", MainComponentsRegistry::initHybrid),
- });
-}
-
-} // namespace react
-} // namespace facebook
diff --git a/native/android/app/src/main/jni/OnLoad.cpp b/native/android/app/src/main/jni/OnLoad.cpp
deleted file mode 100644
--- a/native/android/app/src/main/jni/OnLoad.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#include
-#include "MainApplicationTurboModuleManagerDelegate.h"
-#include "MainComponentsRegistry.h"
-
-JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *) {
- return facebook::jni::initialize(vm, [] {
- facebook::react::MainApplicationTurboModuleManagerDelegate::
- registerNatives();
- facebook::react::MainComponentsRegistry::registerNatives();
- });
-}
diff --git a/native/android/build.gradle b/native/android/build.gradle
--- a/native/android/build.gradle
+++ b/native/android/build.gradle
@@ -1,51 +1,40 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
- ext {
- buildToolsVersion = "34.0.0"
- minSdkVersion = 23
- compileSdkVersion = 34
- targetSdkVersion = 34
-
- // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
- ndkVersion = "23.1.7779620"
- }
- repositories {
- google()
- mavenCentral()
- }
- dependencies {
- classpath("com.android.tools.build:gradle:7.2.2")
- classpath("com.facebook.react:react-native-gradle-plugin")
- classpath("de.undercouch:gradle-download-task:5.0.1")
- classpath("com.google.gms:google-services:4.3.14")
- classpath('org.ajoberstar:grgit:1.7.2')
-
- // NOTE: Do not place your application dependencies here; they belong
- // in the individual module build.gradle files
- }
+ repositories {
+ google()
+ mavenCentral()
+ }
+ dependencies {
+ classpath('com.android.tools.build:gradle')
+ classpath('com.facebook.react:react-native-gradle-plugin')
+ classpath("de.undercouch:gradle-download-task:5.0.1")
+ classpath("com.google.gms:google-services:4.3.14")
+ classpath('org.ajoberstar:grgit:1.7.2')
+ classpath('org.jetbrains.kotlin:kotlin-gradle-plugin')
+ }
}
+def reactNativeAndroidDir = new File(
+ providers.exec {
+ workingDir(rootDir)
+ commandLine("node", "--print", "require.resolve('react-native/package.json')")
+ }.standardOutput.asText.get().trim(),
+ "../android"
+)
+
allprojects {
- repositories {
- maven {
- // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
- url(new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), "../android"))
- }
- maven {
- // Android JSC is installed from npm
- url(new File(["node", "--print", "require.resolve('jsc-android/package.json')"].execute(null, rootDir).text.trim(), "../dist"))
- }
- mavenCentral {
- // We don't want to fetch react-native from Maven Central as there are
- // older versions over there.
- content {
- excludeGroup "com.facebook.react"
- }
- }
- google()
- gradlePluginPortal()
- maven { url 'https://www.jitpack.io' }
- jcenter()
+ repositories {
+ maven {
+ // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
+ url(reactNativeAndroidDir)
}
+
+ google()
+ mavenCentral()
+ maven { url 'https://www.jitpack.io' }
+ }
}
+
+apply plugin: "expo-root-project"
+apply plugin: "com.facebook.react.rootproject"
diff --git a/native/android/gradle.properties b/native/android/gradle.properties
--- a/native/android/gradle.properties
+++ b/native/android/gradle.properties
@@ -21,8 +21,6 @@
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
-# Automatically convert third-party libraries to use AndroidX
-android.enableJetifier=true
expo.jsEngine=hermes
@@ -46,6 +44,10 @@
# are providing them.
newArchEnabled=false
+# Use this property to enable or disable the Hermes JS engine.
+# If set to false, you will be using JSC instead.
+hermesEnabled=true
+
GLOG_VERSION=0.4.0
# Version of OpenSSL library to build and link
diff --git a/native/android/gradle/wrapper/gradle-wrapper.properties b/native/android/gradle/wrapper/gradle-wrapper.properties
--- a/native/android/gradle/wrapper/gradle-wrapper.properties
+++ b/native/android/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/native/android/settings.gradle b/native/android/settings.gradle
--- a/native/android/settings.gradle
+++ b/native/android/settings.gradle
@@ -1,23 +1,47 @@
-rootProject.name = 'Comm'
+pluginManagement {
+ def reactNativeGradlePlugin = new File(
+ providers.exec {
+ workingDir(rootDir)
+ commandLine("node", "--print", "require.resolve('@react-native/gradle-plugin/package.json', { paths: [require.resolve('react-native/package.json')] })")
+ }.standardOutput.asText.get().trim()
+ ).getParentFile().absolutePath
+ includeBuild(reactNativeGradlePlugin)
+
+ def expoPluginsPath = new File(
+ providers.exec {
+ workingDir(rootDir)
+ commandLine("node", "--print", "require.resolve('expo-modules-autolinking/package.json', { paths: [require.resolve('expo/package.json')] })")
+ }.standardOutput.asText.get().trim(),
+ "../android/expo-gradle-plugin"
+ ).absolutePath
+ includeBuild(expoPluginsPath)
+}
+
+plugins {
+ id("com.facebook.react.settings")
+ id("expo-autolinking-settings")
+}
+
+extensions.configure(com.facebook.react.ReactSettingsExtension) { ex ->
+ if (System.getenv('EXPO_USE_COMMUNITY_AUTOLINKING') == '1') {
+ ex.autolinkLibrariesFromCommand()
+ } else {
+ ex.autolinkLibrariesFromCommand(expoAutolinking.rnConfigCommand)
+ }
+}
-apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle");
-useExpoModules()
+expoAutolinking.useExpoModules()
-apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute(null, rootDir).text.trim(), "../native_modules.gradle");
-applyNativeModulesSettingsGradle(settings)
+rootProject.name = 'Comm'
+
+expoAutolinking.useExpoVersionCatalog()
include ':reactnativekeyboardinput'
project(':reactnativekeyboardinput').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-keyboard-input/lib/android')
include ':app'
-includeBuild('../../node_modules/react-native-gradle-plugin')
-if (settings.hasProperty("newArchEnabled") && settings.newArchEnabled == "true") {
- include(":ReactAndroid")
- project(":ReactAndroid").projectDir = file('../node_modules/react-native/ReactAndroid')
- include(":ReactAndroid:hermes-engine")
- project(":ReactAndroid:hermes-engine").projectDir = file('../node_modules/react-native/ReactAndroid/hermes-engine')
-}
+includeBuild(expoAutolinking.reactNativeGradlePlugin)
// We need to include '.gitmodules' for our 'GitModules' custom task
org.apache.tools.ant.DirectoryScanner.removeDefaultExclude("**/.gitmodules")