@hot-updater/react-native 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/HotUpdater.podspec +1 -2
  2. package/android/build.gradle +16 -3
  3. package/android/generated/java/com/hotupdater/NativeHotUpdaterSpec.java +54 -0
  4. package/android/generated/jni/CMakeLists.txt +36 -0
  5. package/android/generated/jni/HotUpdaterSpec-generated.cpp +56 -0
  6. package/android/generated/jni/HotUpdaterSpec.h +31 -0
  7. package/android/generated/jni/react/renderer/components/HotUpdaterSpec/HotUpdaterSpecJSI-generated.cpp +57 -0
  8. package/android/generated/jni/react/renderer/components/HotUpdaterSpec/HotUpdaterSpecJSI.h +103 -0
  9. package/android/react-native-helpers.gradle +42 -0
  10. package/android/src/main/java/com/hotupdater/HotUpdater.kt +151 -240
  11. package/android/src/main/java/com/hotupdater/HotUpdaterModule.kt +52 -40
  12. package/android/src/main/java/com/hotupdater/HotUpdaterPackage.kt +25 -24
  13. package/android/src/main/java/com/hotupdater/ReactIntegrationManagerBase.kt +34 -0
  14. package/android/src/newarch/HotUpdaterSpec.kt +3 -2
  15. package/android/src/newarch/ReactIntegrationManager.kt +46 -0
  16. package/android/src/oldarch/HotUpdaterSpec.kt +12 -8
  17. package/android/src/oldarch/ReactIntegrationManager.kt +41 -0
  18. package/dist/index.d.mts +71 -0
  19. package/dist/index.d.ts +43 -52
  20. package/dist/index.js +2366 -139
  21. package/dist/index.mjs +2411 -0
  22. package/ios/HotUpdater/HotUpdater.h +8 -4
  23. package/ios/HotUpdater/HotUpdater.mm +167 -116
  24. package/ios/generated/HotUpdaterSpec/HotUpdaterSpec-generated.mm +67 -0
  25. package/ios/generated/HotUpdaterSpec/HotUpdaterSpec.h +67 -0
  26. package/ios/generated/HotUpdaterSpecJSI-generated.cpp +57 -0
  27. package/ios/generated/HotUpdaterSpecJSI.h +103 -0
  28. package/package.json +26 -10
  29. package/react-native.config.js +12 -0
  30. package/src/const.ts +1 -0
  31. package/src/ensureBundles.ts +21 -0
  32. package/src/global.d.ts +3 -0
  33. package/src/index.ts +27 -5
  34. package/src/init.tsx +25 -7
  35. package/src/native.ts +50 -42
  36. package/src/specs/{NativeHotUpdaterModule.ts → NativeHotUpdater.ts} +6 -7
  37. package/src/store.ts +48 -0
  38. package/dist/index.cjs +0 -220
  39. package/dist/index.d.cts +0 -80
  40. package/src/checkForUpdate.test.ts +0 -517
  41. package/src/checkForUpdate.ts +0 -111
  42. package/src/utils.ts +0 -2
@@ -11,11 +11,10 @@ Pod::Spec.new do |s|
11
11
  s.license = package["license"]
12
12
  s.authors = package["author"]
13
13
 
14
- s.platforms = { :ios => "11.0" }
14
+ s.platforms = { :ios => min_ios_version_supported }
15
15
  s.source = { :git => "https://github.com/gronxb/hot-updater.git", :tag => "#{s.version}" }
16
16
 
17
17
  s.source_files = "ios/**/*.{h,m,mm}"
18
- s.public_header_files = ['ios/HotUpdater/HotUpdater.h']
19
18
 
20
19
  s.dependency "SSZipArchive", "~> 2.2.2"
21
20
 
@@ -14,12 +14,18 @@ buildscript {
14
14
  }
15
15
  }
16
16
 
17
+ def reactNativeArchitectures() {
18
+ def value = rootProject.getProperties().get("reactNativeArchitectures")
19
+ return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
20
+ }
21
+
17
22
  def isNewArchitectureEnabled() {
18
23
  return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
19
24
  }
20
25
 
21
26
  apply plugin: "com.android.library"
22
27
  apply plugin: "kotlin-android"
28
+ apply from: "$projectDir/react-native-helpers.gradle"
23
29
 
24
30
  if (isNewArchitectureEnabled()) {
25
31
  apply plugin: "com.facebook.react"
@@ -86,8 +92,9 @@ android {
86
92
  if (isNewArchitectureEnabled()) {
87
93
  java.srcDirs += [
88
94
  "src/newarch",
89
- // This is needed to build Kotlin project with NewArch enabled
90
- "${project.buildDir}/generated/source/codegen/java"
95
+ // Codegen specs
96
+ "generated/java",
97
+ "generated/jni"
91
98
  ]
92
99
  } else {
93
100
  java.srcDirs += ["src/oldarch"]
@@ -107,7 +114,13 @@ dependencies {
107
114
  // For < 0.71, this will be from the local maven repo
108
115
  // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
109
116
  //noinspection GradleDynamicVersion
110
- implementation "com.facebook.react:react-native:+"
117
+ if (project.ext.shouldConsumeReactNativeFromMavenCentral()) {
118
+ // noinspection GradleDynamicVersion
119
+ implementation 'com.facebook.react:react-android:+'
120
+ } else {
121
+ // noinspection GradleDynamicVersion
122
+ implementation 'com.facebook.react:react-native:+'
123
+ }
111
124
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
112
125
  }
113
126
 
@@ -0,0 +1,54 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJavaSpec.js
9
+ *
10
+ * @nolint
11
+ */
12
+
13
+ package com.hotupdater;
14
+
15
+ import com.facebook.proguard.annotations.DoNotStrip;
16
+ import com.facebook.react.bridge.Promise;
17
+ import com.facebook.react.bridge.ReactApplicationContext;
18
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
19
+ import com.facebook.react.bridge.ReactMethod;
20
+ import com.facebook.react.turbomodule.core.interfaces.TurboModule;
21
+ import javax.annotation.Nonnull;
22
+
23
+ public abstract class NativeHotUpdaterSpec extends ReactContextBaseJavaModule implements TurboModule {
24
+ public static final String NAME = "HotUpdater";
25
+
26
+ public NativeHotUpdaterSpec(ReactApplicationContext reactContext) {
27
+ super(reactContext);
28
+ }
29
+
30
+ @Override
31
+ public @Nonnull String getName() {
32
+ return NAME;
33
+ }
34
+
35
+ @ReactMethod
36
+ @DoNotStrip
37
+ public abstract void reload();
38
+
39
+ @ReactMethod
40
+ @DoNotStrip
41
+ public abstract void updateBundle(String bundleId, String zipUrl, Promise promise);
42
+
43
+ @ReactMethod
44
+ @DoNotStrip
45
+ public abstract void getAppVersion(Promise promise);
46
+
47
+ @ReactMethod
48
+ @DoNotStrip
49
+ public abstract void addListener(String eventName);
50
+
51
+ @ReactMethod
52
+ @DoNotStrip
53
+ public abstract void removeListeners(double count);
54
+ }
@@ -0,0 +1,36 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ #
3
+ # This source code is licensed under the MIT license found in the
4
+ # LICENSE file in the root directory of this source tree.
5
+
6
+ cmake_minimum_required(VERSION 3.13)
7
+ set(CMAKE_VERBOSE_MAKEFILE on)
8
+
9
+ file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/HotUpdaterSpec/*.cpp)
10
+
11
+ add_library(
12
+ react_codegen_HotUpdaterSpec
13
+ OBJECT
14
+ ${react_codegen_SRCS}
15
+ )
16
+
17
+ target_include_directories(react_codegen_HotUpdaterSpec PUBLIC . react/renderer/components/HotUpdaterSpec)
18
+
19
+ target_link_libraries(
20
+ react_codegen_HotUpdaterSpec
21
+ fbjni
22
+ jsi
23
+ # We need to link different libraries based on whether we are building rncore or not, that's necessary
24
+ # because we want to break a circular dependency between react_codegen_rncore and reactnative
25
+ reactnative
26
+ )
27
+
28
+ target_compile_options(
29
+ react_codegen_HotUpdaterSpec
30
+ PRIVATE
31
+ -DLOG_TAG=\"ReactNative\"
32
+ -fexceptions
33
+ -frtti
34
+ -std=c++20
35
+ -Wall
36
+ )
@@ -0,0 +1,56 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJniCpp.js
9
+ */
10
+
11
+ #include "HotUpdaterSpec.h"
12
+
13
+ namespace facebook::react {
14
+
15
+ static facebook::jsi::Value __hostFunction_NativeHotUpdaterSpecJSI_reload(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
16
+ static jmethodID cachedMethodId = nullptr;
17
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "reload", "()V", args, count, cachedMethodId);
18
+ }
19
+
20
+ static facebook::jsi::Value __hostFunction_NativeHotUpdaterSpecJSI_updateBundle(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
21
+ static jmethodID cachedMethodId = nullptr;
22
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "updateBundle", "(Ljava/lang/String;Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
23
+ }
24
+
25
+ static facebook::jsi::Value __hostFunction_NativeHotUpdaterSpecJSI_getAppVersion(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
26
+ static jmethodID cachedMethodId = nullptr;
27
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "getAppVersion", "(Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
28
+ }
29
+
30
+ static facebook::jsi::Value __hostFunction_NativeHotUpdaterSpecJSI_addListener(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
31
+ static jmethodID cachedMethodId = nullptr;
32
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "addListener", "(Ljava/lang/String;)V", args, count, cachedMethodId);
33
+ }
34
+
35
+ static facebook::jsi::Value __hostFunction_NativeHotUpdaterSpecJSI_removeListeners(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
36
+ static jmethodID cachedMethodId = nullptr;
37
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "removeListeners", "(D)V", args, count, cachedMethodId);
38
+ }
39
+
40
+ NativeHotUpdaterSpecJSI::NativeHotUpdaterSpecJSI(const JavaTurboModule::InitParams &params)
41
+ : JavaTurboModule(params) {
42
+ methodMap_["reload"] = MethodMetadata {0, __hostFunction_NativeHotUpdaterSpecJSI_reload};
43
+ methodMap_["updateBundle"] = MethodMetadata {2, __hostFunction_NativeHotUpdaterSpecJSI_updateBundle};
44
+ methodMap_["getAppVersion"] = MethodMetadata {0, __hostFunction_NativeHotUpdaterSpecJSI_getAppVersion};
45
+ methodMap_["addListener"] = MethodMetadata {1, __hostFunction_NativeHotUpdaterSpecJSI_addListener};
46
+ methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativeHotUpdaterSpecJSI_removeListeners};
47
+ }
48
+
49
+ std::shared_ptr<TurboModule> HotUpdaterSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params) {
50
+ if (moduleName == "HotUpdater") {
51
+ return std::make_shared<NativeHotUpdaterSpecJSI>(params);
52
+ }
53
+ return nullptr;
54
+ }
55
+
56
+ } // namespace facebook::react
@@ -0,0 +1,31 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJniH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include <ReactCommon/JavaTurboModule.h>
14
+ #include <ReactCommon/TurboModule.h>
15
+ #include <jsi/jsi.h>
16
+
17
+ namespace facebook::react {
18
+
19
+ /**
20
+ * JNI C++ class for module 'NativeHotUpdater'
21
+ */
22
+ class JSI_EXPORT NativeHotUpdaterSpecJSI : public JavaTurboModule {
23
+ public:
24
+ NativeHotUpdaterSpecJSI(const JavaTurboModule::InitParams &params);
25
+ };
26
+
27
+
28
+ JSI_EXPORT
29
+ std::shared_ptr<TurboModule> HotUpdaterSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params);
30
+
31
+ } // namespace facebook::react
@@ -0,0 +1,57 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateModuleCpp.js
8
+ */
9
+
10
+ #include "HotUpdaterSpecJSI.h"
11
+
12
+ namespace facebook::react {
13
+
14
+ static jsi::Value __hostFunction_NativeHotUpdaterCxxSpecJSI_reload(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
15
+ static_cast<NativeHotUpdaterCxxSpecJSI *>(&turboModule)->reload(
16
+ rt
17
+ );
18
+ return jsi::Value::undefined();
19
+ }
20
+ static jsi::Value __hostFunction_NativeHotUpdaterCxxSpecJSI_updateBundle(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
21
+ return static_cast<NativeHotUpdaterCxxSpecJSI *>(&turboModule)->updateBundle(
22
+ rt,
23
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
24
+ count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt)
25
+ );
26
+ }
27
+ static jsi::Value __hostFunction_NativeHotUpdaterCxxSpecJSI_getAppVersion(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
28
+ return static_cast<NativeHotUpdaterCxxSpecJSI *>(&turboModule)->getAppVersion(
29
+ rt
30
+ );
31
+ }
32
+ static jsi::Value __hostFunction_NativeHotUpdaterCxxSpecJSI_addListener(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
33
+ static_cast<NativeHotUpdaterCxxSpecJSI *>(&turboModule)->addListener(
34
+ rt,
35
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
36
+ );
37
+ return jsi::Value::undefined();
38
+ }
39
+ static jsi::Value __hostFunction_NativeHotUpdaterCxxSpecJSI_removeListeners(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
40
+ static_cast<NativeHotUpdaterCxxSpecJSI *>(&turboModule)->removeListeners(
41
+ rt,
42
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber()
43
+ );
44
+ return jsi::Value::undefined();
45
+ }
46
+
47
+ NativeHotUpdaterCxxSpecJSI::NativeHotUpdaterCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
48
+ : TurboModule("HotUpdater", jsInvoker) {
49
+ methodMap_["reload"] = MethodMetadata {0, __hostFunction_NativeHotUpdaterCxxSpecJSI_reload};
50
+ methodMap_["updateBundle"] = MethodMetadata {2, __hostFunction_NativeHotUpdaterCxxSpecJSI_updateBundle};
51
+ methodMap_["getAppVersion"] = MethodMetadata {0, __hostFunction_NativeHotUpdaterCxxSpecJSI_getAppVersion};
52
+ methodMap_["addListener"] = MethodMetadata {1, __hostFunction_NativeHotUpdaterCxxSpecJSI_addListener};
53
+ methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativeHotUpdaterCxxSpecJSI_removeListeners};
54
+ }
55
+
56
+
57
+ } // namespace facebook::react
@@ -0,0 +1,103 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateModuleH.js
8
+ */
9
+
10
+ #pragma once
11
+
12
+ #include <ReactCommon/TurboModule.h>
13
+ #include <react/bridging/Bridging.h>
14
+
15
+ namespace facebook::react {
16
+
17
+
18
+ class JSI_EXPORT NativeHotUpdaterCxxSpecJSI : public TurboModule {
19
+ protected:
20
+ NativeHotUpdaterCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
21
+
22
+ public:
23
+ virtual void reload(jsi::Runtime &rt) = 0;
24
+ virtual jsi::Value updateBundle(jsi::Runtime &rt, jsi::String bundleId, jsi::String zipUrl) = 0;
25
+ virtual jsi::Value getAppVersion(jsi::Runtime &rt) = 0;
26
+ virtual void addListener(jsi::Runtime &rt, jsi::String eventName) = 0;
27
+ virtual void removeListeners(jsi::Runtime &rt, double count) = 0;
28
+
29
+ };
30
+
31
+ template <typename T>
32
+ class JSI_EXPORT NativeHotUpdaterCxxSpec : public TurboModule {
33
+ public:
34
+ jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
35
+ return delegate_.get(rt, propName);
36
+ }
37
+
38
+ static constexpr std::string_view kModuleName = "HotUpdater";
39
+
40
+ protected:
41
+ NativeHotUpdaterCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
42
+ : TurboModule(std::string{NativeHotUpdaterCxxSpec::kModuleName}, jsInvoker),
43
+ delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
44
+
45
+
46
+ private:
47
+ class Delegate : public NativeHotUpdaterCxxSpecJSI {
48
+ public:
49
+ Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
50
+ NativeHotUpdaterCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
51
+
52
+ }
53
+
54
+ void reload(jsi::Runtime &rt) override {
55
+ static_assert(
56
+ bridging::getParameterCount(&T::reload) == 1,
57
+ "Expected reload(...) to have 1 parameters");
58
+
59
+ return bridging::callFromJs<void>(
60
+ rt, &T::reload, jsInvoker_, instance_);
61
+ }
62
+ jsi::Value updateBundle(jsi::Runtime &rt, jsi::String bundleId, jsi::String zipUrl) override {
63
+ static_assert(
64
+ bridging::getParameterCount(&T::updateBundle) == 3,
65
+ "Expected updateBundle(...) to have 3 parameters");
66
+
67
+ return bridging::callFromJs<jsi::Value>(
68
+ rt, &T::updateBundle, jsInvoker_, instance_, std::move(bundleId), std::move(zipUrl));
69
+ }
70
+ jsi::Value getAppVersion(jsi::Runtime &rt) override {
71
+ static_assert(
72
+ bridging::getParameterCount(&T::getAppVersion) == 1,
73
+ "Expected getAppVersion(...) to have 1 parameters");
74
+
75
+ return bridging::callFromJs<jsi::Value>(
76
+ rt, &T::getAppVersion, jsInvoker_, instance_);
77
+ }
78
+ void addListener(jsi::Runtime &rt, jsi::String eventName) override {
79
+ static_assert(
80
+ bridging::getParameterCount(&T::addListener) == 2,
81
+ "Expected addListener(...) to have 2 parameters");
82
+
83
+ return bridging::callFromJs<void>(
84
+ rt, &T::addListener, jsInvoker_, instance_, std::move(eventName));
85
+ }
86
+ void removeListeners(jsi::Runtime &rt, double count) override {
87
+ static_assert(
88
+ bridging::getParameterCount(&T::removeListeners) == 2,
89
+ "Expected removeListeners(...) to have 2 parameters");
90
+
91
+ return bridging::callFromJs<void>(
92
+ rt, &T::removeListeners, jsInvoker_, instance_, std::move(count));
93
+ }
94
+
95
+ private:
96
+ friend class NativeHotUpdaterCxxSpec;
97
+ T *instance_;
98
+ };
99
+
100
+ Delegate delegate_;
101
+ };
102
+
103
+ } // namespace facebook::react
@@ -0,0 +1,42 @@
1
+ def safeAppExtGet(prop, fallback) {
2
+ def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') }
3
+ appProject?.ext?.has(prop) ? appProject.ext.get(prop) : fallback
4
+ }
5
+
6
+ // Let's detect react-native's directory, it will be used to determine RN's version
7
+ // https://github.com/software-mansion/react-native-reanimated/blob/36c291a15880c78a94dd125c51484630546ceb7c/packages/react-native-reanimated/android/build.gradle#L73
8
+ def resolveReactNativeDirectory() {
9
+ def reactNativeLocation = safeAppExtGet("REACT_NATIVE_NODE_MODULES_DIR", null)
10
+ if (reactNativeLocation != null) {
11
+ return file(reactNativeLocation)
12
+ }
13
+
14
+ // Fallback to node resolver for custom directory structures like monorepos.
15
+ def reactNativePackage = file(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim())
16
+ if (reactNativePackage.exists()) {
17
+ return reactNativePackage.parentFile
18
+ }
19
+
20
+ throw new GradleException(
21
+ "${project.name}: unable to resolve react-native location in " +
22
+ "node_modules. You should project extension property (in app/build.gradle) " +
23
+ "`REACT_NATIVE_NODE_MODULES_DIR` with path to react-native."
24
+ )
25
+ }
26
+
27
+ // https://github.com/software-mansion/react-native-reanimated/blob/cda4627c3337c33674f05f755b7485165c6caca9/android/build.gradle#L199#L205
28
+ def reactNativeRootDir = resolveReactNativeDirectory()
29
+
30
+ def reactProperties = new Properties()
31
+ file("$reactNativeRootDir/ReactAndroid/gradle.properties").withInputStream { reactProperties.load(it) }
32
+
33
+ def REACT_NATIVE_VERSION = reactProperties.getProperty("VERSION_NAME")
34
+ def REACT_NATIVE_MINOR_VERSION = REACT_NATIVE_VERSION.startsWith("0.0.0-") ? 1000 : REACT_NATIVE_VERSION.split("\\.")[1].toInteger()
35
+
36
+ project.ext.resolveReactNativeDirectory = { ->
37
+ return resolveReactNativeDirectory()
38
+ }
39
+
40
+ project.ext.shouldConsumeReactNativeFromMavenCentral = { ->
41
+ return REACT_NATIVE_MINOR_VERSION >= 71
42
+ }