diff --git a/example/android/app/src/main/java/com/example/MainApplication.java b/example/android/app/src/main/java/com/example/MainApplication.java index 5993e643..02aec8ef 100644 --- a/example/android/app/src/main/java/com/example/MainApplication.java +++ b/example/android/app/src/main/java/com/example/MainApplication.java @@ -14,9 +14,6 @@ import java.lang.reflect.InvocationTargetException; import java.util.List; -import com.facebook.react.bridge.JSIModulePackage; // <- add -import com.swmansion.reanimated.ReanimatedJSIModulePackage; // <- add - public class MainApplication extends Application implements ReactApplication { @@ -40,11 +37,6 @@ protected List getPackages() { protected String getJSMainModuleName() { return "index"; } - - @Override - protected JSIModulePackage getJSIModulePackage() { - return new ReanimatedJSIModulePackage(); // <- add - } }; private final ReactNativeHost mNewArchitectureNativeHost = diff --git a/example/android/app/src/main/jni/Android.mk b/example/android/app/src/main/jni/Android.mk index e82e2023..881e032e 100644 --- a/example/android/app/src/main/jni/Android.mk +++ b/example/android/app/src/main/jni/Android.mk @@ -6,7 +6,7 @@ include $(REACT_ANDROID_DIR)/Android-prebuilt.mk include $(CLEAR_VARS) LOCAL_PATH := $(THIS_DIR) # You can customize the name of your application .so file here. -LOCAL_MODULE := rndiffapp_appmodules +LOCAL_MODULE := example_appmodules LOCAL_C_INCLUDES := $(LOCAL_PATH) LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) diff --git a/example/android/app/src/main/jni/MainApplicationModuleProvider.cpp b/example/android/app/src/main/jni/MainApplicationModuleProvider.cpp index 640a5baa..038ffbea 100644 --- a/example/android/app/src/main/jni/MainApplicationModuleProvider.cpp +++ b/example/android/app/src/main/jni/MainApplicationModuleProvider.cpp @@ -1,7 +1,9 @@ #include "MainApplicationModuleProvider.h" #include + namespace facebook { namespace react { + std::shared_ptr MainApplicationModuleProvider( const std::string moduleName, const JavaTurboModule::InitParams ¶ms) { @@ -16,5 +18,6 @@ std::shared_ptr MainApplicationModuleProvider( // return rncore_ModuleProvider(moduleName, params); return rncore_ModuleProvider(moduleName, params); } + } // namespace react } // namespace facebook diff --git a/example/android/app/src/main/jni/MainApplicationModuleProvider.h b/example/android/app/src/main/jni/MainApplicationModuleProvider.h index 88e992ce..4edeefb9 100644 --- a/example/android/app/src/main/jni/MainApplicationModuleProvider.h +++ b/example/android/app/src/main/jni/MainApplicationModuleProvider.h @@ -1,38 +1,15 @@ -#include "MainApplicationTurboModuleManagerDelegate.h" -#include "MainApplicationModuleProvider.h" +#pragma once + +#include +#include +#include + 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( - std::string name) { - return getTurboModule(name, nullptr) != nullptr || - getTurboModule(name, {.moduleName = name}) != nullptr; -} + +std::shared_ptr MainApplicationModuleProvider( + const std::string moduleName, + const JavaTurboModule::InitParams ¶ms); + } // namespace react } // namespace facebook diff --git a/example/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.cpp b/example/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.cpp new file mode 100644 index 00000000..bc8c4979 --- /dev/null +++ b/example/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.cpp @@ -0,0 +1,41 @@ +#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( + std::string name) { + return getTurboModule(name, nullptr) != nullptr || + getTurboModule(name, {.moduleName = name}) != nullptr; +} + +} // namespace react +} // namespace facebook diff --git a/example/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h b/example/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h index 5a6167ba..1357b3ce 100644 --- a/example/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h +++ b/example/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h @@ -2,8 +2,10 @@ #include #include #include + namespace facebook { namespace react { + class MainApplicationTurboModuleManagerDelegate : public jni::HybridClass< MainApplicationTurboModuleManagerDelegate, @@ -11,7 +13,7 @@ class MainApplicationTurboModuleManagerDelegate public: // Adapt it to the package you used for your Java class. static constexpr auto kJavaDescriptor = - "Lcom/rndiffapp/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate;"; + "Lcom/example/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate;"; static jni::local_ref initHybrid(jni::alias_ref); static void registerNatives(); std::shared_ptr getTurboModule( @@ -26,5 +28,6 @@ class MainApplicationTurboModuleManagerDelegate */ bool canCreateTurboModule(std::string name); }; + } // namespace react } // namespace facebook diff --git a/example/android/app/src/main/jni/MainComponentsRegistry.cpp b/example/android/app/src/main/jni/MainComponentsRegistry.cpp index d62dcb55..5926a960 100644 --- a/example/android/app/src/main/jni/MainComponentsRegistry.cpp +++ b/example/android/app/src/main/jni/MainComponentsRegistry.cpp @@ -3,8 +3,10 @@ #include #include #include + namespace facebook { namespace react { + MainComponentsRegistry::MainComponentsRegistry(ComponentFactory *delegate) {} std::shared_ptr MainComponentsRegistry::sharedProviderRegistry() { @@ -44,5 +46,6 @@ void MainComponentsRegistry::registerNatives() { makeNativeMethod("initHybrid", MainComponentsRegistry::initHybrid), }); } + } // namespace react } // namespace facebook diff --git a/example/android/app/src/main/jni/MainComponentsRegistry.h b/example/android/app/src/main/jni/MainComponentsRegistry.h index ca3636ae..d7ef4c88 100644 --- a/example/android/app/src/main/jni/MainComponentsRegistry.h +++ b/example/android/app/src/main/jni/MainComponentsRegistry.h @@ -3,14 +3,16 @@ #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 = - "Lcom/rndiffapp/newarchitecture/components/MainComponentsRegistry;"; + "Lcom/example/newarchitecture/components/MainComponentsRegistry;"; static void registerNatives(); MainComponentsRegistry(ComponentFactory *delegate); private: @@ -20,5 +22,6 @@ class MainComponentsRegistry jni::alias_ref, ComponentFactory *delegate); }; + } // namespace react } // namespace facebook diff --git a/example/android/app/src/main/jni/OnLoad.cpp b/example/android/app/src/main/jni/OnLoad.cpp index ddd99a4c..c569b6e8 100644 --- a/example/android/app/src/main/jni/OnLoad.cpp +++ b/example/android/app/src/main/jni/OnLoad.cpp @@ -1,6 +1,7 @@ #include #include "MainApplicationTurboModuleManagerDelegate.h" #include "MainComponentsRegistry.h" + JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *) { return facebook::jni::initialize(vm, [] { facebook::react::MainApplicationTurboModuleManagerDelegate:: diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 6fc38ba1..892c8b82 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -351,7 +351,7 @@ PODS: - React-perflogger (= 0.68.4) - RNCMaskedView (0.2.8): - React-Core - - RNGestureHandler (2.1.1): + - RNGestureHandler (2.8.0): - React-Core - RNReanimated (2.13.0): - DoubleConversion @@ -588,7 +588,7 @@ SPEC CHECKSUMS: React-runtimeexecutor: 088723cf020113e64736a709f52719dbb359c73e ReactCommon: 1a4f19f3b4366feec03a98bdbb200b6085c5000f RNCMaskedView: bc0170f389056201c82a55e242e5d90070e18e5a - RNGestureHandler: e1ad51d31a580755079d5124d3ab66f0fcaa8311 + RNGestureHandler: 62232ba8f562f7dea5ba1b3383494eb5bf97a4d3 RNReanimated: b21b362b4b8ca921932e8b1718e88cf3a36f157e RNScreens: 34cc502acf1b916c582c60003dc3089fa01dc66d SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608 diff --git a/example/package.json b/example/package.json index 143279ab..6d310237 100644 --- a/example/package.json +++ b/example/package.json @@ -18,10 +18,10 @@ "@reduxjs/toolkit": "^1.7.1", "react": "17.0.2", "react-native": "0.68.4", - "react-native-gesture-handler": "2.1.1", + "react-native-gesture-handler": "2.8.0", "react-native-reanimated": "^2.10.0", "react-native-safe-area-context": "^3.3.2", - "react-native-screens": "^3.14.0", + "react-native-screens": "^3.18.2", "react-redux": "^7.2.6" }, "devDependencies": { diff --git a/example/yarn.lock b/example/yarn.lock index f78377bf..9ceda176 100644 --- a/example/yarn.lock +++ b/example/yarn.lock @@ -5871,10 +5871,10 @@ react-native-codegen@^0.0.18: jscodeshift "^0.13.1" nullthrows "^1.1.1" -react-native-gesture-handler@2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/react-native-gesture-handler/-/react-native-gesture-handler-2.1.1.tgz#1d417bc7b551ec76129ce09861b3a01622b4ef99" - integrity sha512-1+qMhsXKKWTPAFi2ZY8rEhP/4xIevWNb1zLU9MzJkr7tRIEW4G+ipxjLyCw+7hQeqeeIbyZ8kkTyHAUuwTrHDA== +react-native-gesture-handler@2.8.0: + version "2.8.0" + resolved "https://registry.yarnpkg.com/react-native-gesture-handler/-/react-native-gesture-handler-2.8.0.tgz#ef9857871c10663c95a51546225b6e00cd4740cf" + integrity sha512-poOSfz/w0IyD6Qwq7aaIRRfEaVTl1ecQFoyiIbpOpfNTjm2B1niY2FLrdVQIOtIOe+K9nH55Qal04nr4jGkHdQ== dependencies: "@egjs/hammerjs" "^2.0.17" hoist-non-react-statics "^3.3.0" @@ -5905,7 +5905,7 @@ react-native-safe-area-context@^3.3.2: resolved "https://registry.yarnpkg.com/react-native-safe-area-context/-/react-native-safe-area-context-3.4.1.tgz#c967a52903d55fe010b2428e5368b42f1debc0a7" integrity sha512-xfpVd0CiZR7oBhuwJ2HcZMehg5bjha1Ohu1XHpcT+9ykula0TgovH2BNU0R5Krzf/jBR1LMjR6VabxdlUjqxcA== -react-native-screens@^3.14.0: +react-native-screens@^3.18.2: version "3.18.2" resolved "https://registry.yarnpkg.com/react-native-screens/-/react-native-screens-3.18.2.tgz#d7ab2d145258d3db9fa630fa5379dc4474117866" integrity sha512-ANUEuvMUlsYJ1QKukEhzhfrvOUO9BVH9Nzg+6eWxpn3cfD/O83yPBOF8Mx6x5H/2+sMy+VS5x/chWOOo/U7QJw==