react-native-reanimated 3.0.0-rc.2 → 3.0.0-rc.4

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 (154) hide show
  1. package/Common/cpp/AnimatedSensor/AnimatedSensorModule.cpp +3 -0
  2. package/Common/cpp/{headers/AnimatedSensor → AnimatedSensor}/AnimatedSensorModule.h +0 -0
  3. package/Common/cpp/Fabric/FabricUtils.cpp +1 -1
  4. package/Common/cpp/{headers/Fabric → Fabric}/FabricUtils.h +0 -0
  5. package/Common/cpp/Fabric/ReanimatedUIManagerBinding.cpp +2 -0
  6. package/Common/cpp/{headers/Fabric → Fabric}/ReanimatedUIManagerBinding.h +0 -0
  7. package/Common/cpp/{headers/Fabric → Fabric}/ShadowTreeCloner.h +1 -1
  8. package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.cpp +2 -0
  9. package/Common/cpp/{headers/LayoutAnimations → LayoutAnimations}/LayoutAnimationsProxy.h +0 -0
  10. package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +6 -1
  11. package/Common/cpp/{headers/NativeModules → NativeModules}/NativeReanimatedModule.h +5 -0
  12. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +2 -0
  13. package/Common/cpp/{headers/NativeModules → NativeModules}/NativeReanimatedModuleSpec.h +1 -1
  14. package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.cpp +93 -0
  15. package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.h +125 -0
  16. package/Common/cpp/ReanimatedRuntime/ReanimatedRuntime.cpp +50 -0
  17. package/Common/cpp/ReanimatedRuntime/ReanimatedRuntime.h +27 -0
  18. package/Common/cpp/ReanimatedRuntime/RuntimeInitialization.md +194 -0
  19. package/Common/cpp/{headers/Registries → Registries}/EventHandlerRegistry.h +0 -0
  20. package/Common/cpp/Registries/MapperRegistry.cpp +3 -1
  21. package/Common/cpp/{headers/Registries → Registries}/MapperRegistry.h +0 -0
  22. package/Common/cpp/{headers/Registries → Registries}/NewestShadowNodesRegistry.h +0 -0
  23. package/Common/cpp/Registries/WorkletsCache.cpp +8 -1
  24. package/Common/cpp/{headers/Registries → Registries}/WorkletsCache.h +0 -0
  25. package/Common/cpp/{headers/SharedItems → SharedItems}/FrozenObject.h +0 -0
  26. package/Common/cpp/{headers/SharedItems → SharedItems}/HostFunctionHandler.h +0 -0
  27. package/Common/cpp/SharedItems/MutableValue.cpp +2 -0
  28. package/Common/cpp/{headers/SharedItems → SharedItems}/MutableValue.h +0 -0
  29. package/Common/cpp/{headers/SharedItems → SharedItems}/MutableValueSetterProxy.h +0 -0
  30. package/Common/cpp/{headers/SharedItems → SharedItems}/RemoteObject.h +0 -0
  31. package/Common/cpp/{headers/SharedItems → SharedItems}/RuntimeManager.h +0 -0
  32. package/Common/cpp/SharedItems/ShareableValue.cpp +6 -2
  33. package/Common/cpp/{headers/SharedItems → SharedItems}/ShareableValue.h +0 -0
  34. package/Common/cpp/{headers/SharedItems → SharedItems}/SharedParent.h +0 -0
  35. package/Common/cpp/{headers/SharedItems → SharedItems}/ValueWrapper.h +0 -0
  36. package/Common/cpp/{headers/SpecTools → SpecTools}/ErrorHandler.h +0 -0
  37. package/Common/cpp/{headers/Tools → Tools}/FeaturesConfig.h +0 -0
  38. package/Common/cpp/Tools/JSIStoreValueUser.cpp +2 -2
  39. package/Common/cpp/{headers/Tools → Tools}/JSIStoreValueUser.h +0 -0
  40. package/Common/cpp/{headers/Tools → Tools}/Mapper.h +0 -0
  41. package/Common/cpp/{headers/Tools → Tools}/PlatformDepMethodsHolder.h +0 -0
  42. package/Common/cpp/{headers/Tools → Tools}/ReanimatedHiddenHeaders.h +1 -1
  43. package/Common/cpp/{headers/Tools → Tools}/RuntimeDecorator.h +0 -0
  44. package/Common/cpp/{headers/Tools → Tools}/Scheduler.h +0 -0
  45. package/Common/cpp/Tools/SingleInstanceChecker.h +58 -0
  46. package/Common/cpp/{headers/Tools → Tools}/WorkletEventHandler.h +0 -0
  47. package/RNReanimated.podspec +21 -85
  48. package/android/CMakeLists.txt +62 -58
  49. package/android/build.gradle +421 -114
  50. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  51. package/android/src/fabric/java/com/swmansion/reanimated/NativeProxy.java +10 -8
  52. package/android/src/main/cpp/AndroidErrorHandler.cpp +3 -4
  53. package/android/src/main/cpp/{headers/AndroidErrorHandler.h → AndroidErrorHandler.h} +1 -4
  54. package/android/src/main/cpp/AndroidLogger.cpp +4 -1
  55. package/android/src/main/cpp/{headers/AndroidLogger.h → AndroidLogger.h} +0 -0
  56. package/android/src/main/cpp/{headers/AndroidScheduler.h → AndroidScheduler.h} +0 -0
  57. package/android/src/main/cpp/{headers/JNIHelper.h → JNIHelper.h} +0 -0
  58. package/android/src/main/cpp/{headers/LayoutAnimations.h → LayoutAnimations.h} +0 -0
  59. package/android/src/main/cpp/NativeProxy.cpp +12 -28
  60. package/android/src/main/cpp/{headers/NativeProxy.h → NativeProxy.h} +3 -1
  61. package/android/src/main/cpp/{headers/TurboModule.h → TurboModule.h} +0 -0
  62. package/android/src/main/java/com/swmansion/reanimated/ReanimatedMessageQueueThreadBase.java +72 -0
  63. package/android/src/main/java/com/swmansion/reanimated/keyboardObserver/ReanimatedKeyboardEventListener.java +2 -1
  64. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +1 -1
  65. package/android/src/paper/java/com/swmansion/reanimated/NativeProxy.java +7 -7
  66. package/android/{rnVersionPatch/62 → src/reactNativeVersionPatch/UIImplementation/64/com/swmansion/reanimated}/layoutReanimation/ReanimatedUIImplementation.java +0 -0
  67. package/android/src/{main/java → reactNativeVersionPatch/UIImplementation/latest}/com/swmansion/reanimated/layoutReanimation/ReanimatedUIImplementation.java +0 -0
  68. package/android/src/reactNativeVersionPatch/messageQueueThread/67/com/swmansion/reanimated/ReanimatedMessageQueueThread.java +12 -0
  69. package/android/src/reactNativeVersionPatch/messageQueueThread/latest/com/swmansion/reanimated/ReanimatedMessageQueueThread.java +12 -0
  70. package/android/{rnVersionPatch/62 → src/reactNativeVersionPatch/nativeHierarchyManager/62/com/swmansion/reanimated}/layoutReanimation/ReanimatedNativeHierarchyManager.java +0 -0
  71. package/android/src/{main/java → reactNativeVersionPatch/nativeHierarchyManager/latest}/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +0 -0
  72. package/ios/REAModule.mm +29 -0
  73. package/ios/keyboardObserver/REAKeyboardEventObserver.m +1 -1
  74. package/ios/native/NativeProxy.mm +12 -19
  75. package/ios/native/REAInitializer.h +2 -2
  76. package/ios/native/REAInitializer.mm +2 -2
  77. package/ios/native/REAMessageThread.h +22 -0
  78. package/ios/native/REAMessageThread.mm +38 -0
  79. package/ios/native/UIResponder+Reanimated.mm +1 -1
  80. package/lib/commonjs/createAnimatedComponent.js +2 -5
  81. package/lib/commonjs/createAnimatedComponent.js.map +1 -1
  82. package/lib/commonjs/reanimated2/NativeMethods.js +67 -31
  83. package/lib/commonjs/reanimated2/NativeMethods.js.map +1 -1
  84. package/lib/commonjs/reanimated2/animation/delay.js +0 -12
  85. package/lib/commonjs/reanimated2/animation/delay.js.map +1 -1
  86. package/lib/commonjs/reanimated2/animation/repeat.js +0 -24
  87. package/lib/commonjs/reanimated2/animation/repeat.js.map +1 -1
  88. package/lib/commonjs/reanimated2/animation/sequence.js +0 -12
  89. package/lib/commonjs/reanimated2/animation/sequence.js.map +1 -1
  90. package/lib/commonjs/reanimated2/commonTypes.js.map +1 -1
  91. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryJS.js +4 -4
  92. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -1
  93. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js +51 -19
  94. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
  95. package/lib/commonjs/reanimated2/globals.d.js.map +1 -1
  96. package/lib/commonjs/reanimated2/hook/index.js +8 -0
  97. package/lib/commonjs/reanimated2/hook/index.js.map +1 -1
  98. package/lib/commonjs/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
  99. package/lib/commonjs/reanimated2/hook/useFrameCallback.js.map +1 -1
  100. package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js +33 -0
  101. package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js.map +1 -0
  102. package/lib/commonjs/reanimated2/utils.js +12 -3
  103. package/lib/commonjs/reanimated2/utils.js.map +1 -1
  104. package/lib/module/createAnimatedComponent.js +2 -5
  105. package/lib/module/createAnimatedComponent.js.map +1 -1
  106. package/lib/module/reanimated2/NativeMethods.js +68 -30
  107. package/lib/module/reanimated2/NativeMethods.js.map +1 -1
  108. package/lib/module/reanimated2/animation/delay.js +0 -10
  109. package/lib/module/reanimated2/animation/delay.js.map +1 -1
  110. package/lib/module/reanimated2/animation/repeat.js +0 -20
  111. package/lib/module/reanimated2/animation/repeat.js.map +1 -1
  112. package/lib/module/reanimated2/animation/sequence.js +0 -10
  113. package/lib/module/reanimated2/animation/sequence.js.map +1 -1
  114. package/lib/module/reanimated2/commonTypes.js.map +1 -1
  115. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js +4 -4
  116. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -1
  117. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js +51 -19
  118. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
  119. package/lib/module/reanimated2/globals.d.js.map +1 -1
  120. package/lib/module/reanimated2/hook/index.js +1 -0
  121. package/lib/module/reanimated2/hook/index.js.map +1 -1
  122. package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
  123. package/lib/module/reanimated2/hook/useFrameCallback.js.map +1 -1
  124. package/lib/module/reanimated2/hook/useScrollViewOffset.js +21 -0
  125. package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -0
  126. package/lib/module/reanimated2/utils.js +13 -3
  127. package/lib/module/reanimated2/utils.js.map +1 -1
  128. package/package.json +10 -6
  129. package/plugin.js +105 -47
  130. package/react-native-reanimated.d.ts +13 -9
  131. package/scripts/reanimated_utils.rb +77 -0
  132. package/src/createAnimatedComponent.tsx +2 -3
  133. package/src/reanimated2/NativeMethods.ts +91 -44
  134. package/src/reanimated2/animation/delay.ts +0 -12
  135. package/src/reanimated2/animation/repeat.ts +0 -25
  136. package/src/reanimated2/animation/sequence.ts +0 -13
  137. package/src/reanimated2/commonTypes.ts +9 -0
  138. package/src/reanimated2/frameCallback/FrameCallbackRegistryJS.ts +6 -9
  139. package/src/reanimated2/frameCallback/FrameCallbackRegistryUI.ts +78 -27
  140. package/src/reanimated2/globals.d.ts +56 -14
  141. package/src/reanimated2/hook/index.ts +1 -0
  142. package/src/reanimated2/hook/useAnimatedScrollHandler.ts +3 -1
  143. package/src/reanimated2/hook/useFrameCallback.ts +2 -1
  144. package/src/reanimated2/hook/useScrollViewOffset.ts +37 -0
  145. package/src/reanimated2/utils.ts +12 -5
  146. package/android/rnVersionPatch/63/layoutReanimation/ReanimatedUIImplementation.java +0 -68
  147. package/android/rnVersionPatch/64/layoutReanimation/ReanimatedUIImplementation.java +0 -68
  148. package/android/rnVersionPatch/65/.gitkeep +0 -0
  149. package/android/rnVersionPatch/66/.gitkeep +0 -0
  150. package/android/rnVersionPatch/67/.gitkeep +0 -0
  151. package/android/rnVersionPatch/68/.gitkeep +0 -0
  152. package/android/rnVersionPatch/backup/.gitkeep +0 -0
  153. package/android/src/main/java/com/swmansion/reanimated/AndroidErrorHandler.java +0 -8
  154. package/android/src/main/java/com/swmansion/reanimated/ReanimatedJSIModulePackage.java +0 -29
@@ -4,6 +4,8 @@
4
4
  #include "ShareableValue.h"
5
5
  #include "SharedParent.h"
6
6
 
7
+ #include <string>
8
+
7
9
  namespace reanimated {
8
10
 
9
11
  void MutableValue::setValue(jsi::Runtime &rt, const jsi::Value &newValue) {
@@ -1,4 +1,5 @@
1
1
  #include <cxxabi.h>
2
+ #include <utility>
2
3
 
3
4
  #ifdef RCT_NEW_ARCH_ENABLED
4
5
  #include <react/renderer/uimanager/primitives.h>
@@ -10,6 +11,7 @@
10
11
  #include "RemoteObject.h"
11
12
  #include "RuntimeDecorator.h"
12
13
  #include "RuntimeManager.h"
14
+ #include "ShareableValue.h"
13
15
  #include "SharedParent.h"
14
16
 
15
17
  namespace reanimated {
@@ -412,8 +414,10 @@ jsi::Value ShareableValue::toJSValue(jsi::Runtime &rt) {
412
414
  } else {
413
415
  res = funPtr->call(rt, args, count);
414
416
  }
415
- } catch (jsi::JSError &e) {
416
- throw e;
417
+ } catch (std::exception &e) {
418
+ std::string str = e.what();
419
+ runtimeManager->errorHandler->setError(str);
420
+ runtimeManager->errorHandler->raise();
417
421
  } catch (...) {
418
422
  if (demangleExceptionName(
419
423
  abi::__cxa_current_exception_type()->name()) ==
@@ -1,6 +1,6 @@
1
1
  #include "JSIStoreValueUser.h"
2
2
  #include "RuntimeManager.h"
3
- #ifdef ONANDROID
3
+ #ifdef ANDROID
4
4
  #include <AndroidScheduler.h>
5
5
  #endif
6
6
 
@@ -32,7 +32,7 @@ StoreUser::~StoreUser() {
32
32
  std::shared_ptr<Scheduler> strongScheduler = scheduler.lock();
33
33
  if (strongScheduler != nullptr) {
34
34
  std::shared_ptr<StaticStoreUser> sud = storeUserData;
35
- #ifdef ONANDROID
35
+ #ifdef ANDROID
36
36
  jni::ThreadScope::WithClassLoader([&] {
37
37
  strongScheduler->scheduleOnUI([id, sud]() {
38
38
  const std::lock_guard<std::recursive_mutex> lock(sud->storeMutex);
File without changes
@@ -1,6 +1,6 @@
1
1
  #pragma once
2
2
 
3
- #if defined(ONANDROID)
3
+ #ifdef ANDROID
4
4
  #include "Logger.h"
5
5
  #include "LoggerInterface.h"
6
6
  #include "SpeedChecker.h"
File without changes
@@ -0,0 +1,58 @@
1
+ #pragma once
2
+
3
+ #ifdef DEBUG
4
+
5
+ #include <cxxabi.h>
6
+
7
+ #include <iostream>
8
+ #include <string>
9
+
10
+ namespace reanimated {
11
+
12
+ // This is a class that counts how many instances of a different class there
13
+ // are. It is meant only to be used with classes that should only have one
14
+ // instance.
15
+
16
+ template <class T>
17
+ class SingleInstanceChecker {
18
+ public:
19
+ SingleInstanceChecker();
20
+ ~SingleInstanceChecker();
21
+
22
+ private:
23
+ void assertWithMessage(bool condition, std::string message) {
24
+ if (!condition) {
25
+ std::cerr << message << std::endl;
26
+ assert(condition);
27
+ }
28
+ }
29
+
30
+ // A static field will exist separately for every class template.
31
+ // This has to be inline for automatic initialization.
32
+ inline static int instanceCount_;
33
+ };
34
+
35
+ template <class T>
36
+ SingleInstanceChecker<T>::SingleInstanceChecker() {
37
+ int status = 0;
38
+ std::string className =
39
+ __cxxabiv1::__cxa_demangle(typeid(T).name(), nullptr, nullptr, &status);
40
+
41
+ // Only one instance should exist, but it is possible for two instances
42
+ // to co-exist during a reload.
43
+ assertWithMessage(
44
+ instanceCount_ <= 1,
45
+ "More than one instance of " + className +
46
+ " present. This may indicate a memory leak due to a retain cycle.");
47
+
48
+ instanceCount_++;
49
+ }
50
+
51
+ template <class T>
52
+ SingleInstanceChecker<T>::~SingleInstanceChecker() {
53
+ instanceCount_--;
54
+ }
55
+
56
+ } // namespace reanimated
57
+
58
+ #endif // DEBUG
@@ -1,85 +1,23 @@
1
1
  require "json"
2
+ require_relative './scripts/reanimated_utils'
2
3
 
3
- package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
-
5
- reactVersion = '0.0.0'
6
- reactTargetTvOS = false
7
- isUserApp = false
8
-
9
- begin
10
- # user app
11
- # /appName/node_modules/react-native-reanimated/RNReanimated.podspec
12
- # /appName/node_modules/react-native/package.json
13
- reactJson = JSON.parse(File.read(File.join(__dir__, "..", "..", "node_modules", "react-native", "package.json")))
14
- reactVersion = reactJson["version"]
15
- reactTargetTvOS = reactJson["name"] == "react-native-tvos"
16
- isUserApp = true
17
- rescue
18
- begin
19
- # monorepo
20
- # /monorepo/packages/appName/node_modules/react-native-reanimated/RNReanimated.podspec
21
- # /monorepo/node_modules/react-native/package.json
22
- reactJson = JSON.parse(File.read(File.join(__dir__, "..", "..", "..", "..", "node_modules", "react-native", "package.json")))
23
- reactVersion = reactJson["version"]
24
- reactTargetTvOS = reactJson["name"] == "react-native-tvos"
25
- rescue
26
- begin
27
- # Example app in reanimated repo
28
- # /react-native-reanimated/RNReanimated.podspec
29
- # /react-native-reanimated/{Example,FabricExample,TVOSExample}/node_modules/react-native/package.json
30
- if ENV["ReanimatedTVOSExample"] == "1" then
31
- appName = "TVOSExample"
32
- elsif ENV["RCT_NEW_ARCH_ENABLED"] == "1" then
33
- appName = "FabricExample"
34
- else
35
- appName = "Example"
36
- end
37
- reactJson = JSON.parse(File.read(File.join(__dir__, appName, "node_modules", "react-native", "package.json")))
38
- reactVersion = reactJson["version"]
39
- reactTargetTvOS = ENV["ReanimatedTVOSExample"] == "1"
40
- rescue
41
- # should never happen
42
- reactVersion = '0.68.0'
43
- puts "[RNReanimated] Unable to recognize your `react-native` version! Default `react-native` version: " + reactVersion
44
- end
45
- end
46
- end
47
-
48
- if isUserApp
49
- libInstances = %x[find ../../ -name "package.json" | grep "/react-native-reanimated/package.json"]
50
- libInstancesArray = libInstances.split("\n")
51
- if libInstancesArray.length() > 1
52
- parsedLocation = ''
53
- for location in libInstancesArray
54
- location['../../'] = '- '
55
- location['/package.json'] = ''
56
- parsedLocation += location + "\n"
57
- end
58
- raise "[Reanimated] Multiple versions of Reanimated were detected. Only one instance of react-native-reanimated can be installed in a project. You need to resolve the conflict manually. Check out the documentation: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/troubleshooting#multiple-versions-of-reanimated-were-detected \n\nConflict between: \n" + parsedLocation
59
- end
60
- end
61
-
62
- rnVersion = reactVersion.split('.')[1]
4
+ reanimated_package_json = JSON.parse(File.read(File.join(__dir__, "package.json")))
5
+ config = find_config()
6
+ assert_no_multiple_instances(config)
7
+ assert_no_reanimated2_with_new_architecture(reanimated_package_json)
63
8
 
64
9
  fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
65
-
66
- folly_prefix = ""
67
- if rnVersion.to_i >= 64
68
- folly_prefix = "RCT-"
69
- end
70
-
71
- folly_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32 -DRNVERSION=' + rnVersion
10
+ folly_prefix = config[:react_native_minor_version] >= 64 ? 'RCT-' : ''
11
+ folly_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32 -DREACT_NATIVE_MINOR_VERSION=' + config[:react_native_minor_version].to_s
72
12
  folly_compiler_flags = folly_flags + ' ' + '-Wno-comma -Wno-shorten-64-to-32'
73
13
  boost_compiler_flags = '-Wno-documentation'
74
- fabric_flags = ''
75
- if fabric_enabled
76
- fabric_flags = '-DRN_FABRIC_ENABLED -DRCT_NEW_ARCH_ENABLED'
77
- end
14
+ fabric_flags = fabric_enabled ? '-DRN_FABRIC_ENABLED -DRCT_NEW_ARCH_ENABLED' : ''
78
15
 
79
16
  Pod::Spec.new do |s|
17
+
80
18
  s.name = "RNReanimated"
81
- s.version = package["version"]
82
- s.summary = package["description"]
19
+ s.version = reanimated_package_json["version"]
20
+ s.summary = reanimated_package_json["description"]
83
21
  s.description = <<-DESC
84
22
  RNReanimated
85
23
  DESC
@@ -92,23 +30,24 @@ Pod::Spec.new do |s|
92
30
 
93
31
  s.source_files = [
94
32
  "ios/**/*.{mm,h,m}",
95
- "Common/cpp/**/*.cpp",
96
- "Common/cpp/headers/**/*.h"
33
+ "Common/cpp/**/*.{cpp,h}"
97
34
  ]
98
35
 
99
36
  s.preserve_paths = [
100
37
  "Common/cpp/hidden_headers/**"
101
38
  ]
102
39
 
103
- s.pod_target_xcconfig = {
40
+ s.pod_target_xcconfig = {
104
41
  "USE_HEADERMAP" => "YES",
105
42
  "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_TARGET_SRCROOT)\" \"$(PODS_ROOT)/#{folly_prefix}Folly\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/Headers/Private/React-Core\"",
43
+ "FRAMEWORK_SEARCH_PATHS" => "\"${PODS_CONFIGURATION_BUILD_DIR}/React-hermes\"",
106
44
  "CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
107
45
  }
108
- s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
109
- s.xcconfig = {
110
- "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/glog\" \"$(PODS_ROOT)/#{folly_prefix}Folly\" \"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-hermes\" \"${PODS_ROOT}/Headers/Public/hermes-engine\"",
111
- "OTHER_CFLAGS" => "$(inherited)" + " " + folly_flags + " " + fabric_flags }
46
+ s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags + ' -DHERMES_ENABLE_DEBUGGER'
47
+ s.xcconfig = {
48
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/glog\" \"$(PODS_ROOT)/#{folly_prefix}Folly\" \"$(PODS_ROOT)/Headers/Public/React-hermes\" \"$(PODS_ROOT)/Headers/Public/hermes-engine\" \"$(PODS_ROOT)/#{config[:react_native_common_dir]}\"",
49
+ "OTHER_CFLAGS" => "$(inherited)" + " " + folly_flags + " " + fabric_flags
50
+ }
112
51
 
113
52
  s.requires_arc = true
114
53
 
@@ -128,7 +67,7 @@ Pod::Spec.new do |s|
128
67
  s.dependency 'React-Core'
129
68
  s.dependency 'React-CoreModules'
130
69
  s.dependency 'React-Core/DevSupport'
131
- if !reactTargetTvOS
70
+ if !config[:is_tvos_target]
132
71
  s.dependency 'React-RCTActionSheet'
133
72
  end
134
73
  s.dependency 'React-RCTNetwork'
@@ -147,12 +86,9 @@ Pod::Spec.new do |s|
147
86
  s.dependency 'DoubleConversion'
148
87
  s.dependency 'glog'
149
88
 
150
- if reactVersion.match(/^0.62/)
89
+ if config[:react_native_minor_version] == 62
151
90
  s.dependency 'ReactCommon/callinvoker'
152
91
  else
153
92
  s.dependency 'React-callinvoker'
154
93
  end
155
-
156
-
157
94
  end
158
-
@@ -1,17 +1,20 @@
1
1
  project(Reanimated)
2
- cmake_minimum_required(VERSION 3.12.0)
2
+ cmake_minimum_required(VERSION 3.8)
3
3
 
4
4
  set (CMAKE_VERBOSE_MAKEFILE ON)
5
5
  set (CMAKE_CXX_STANDARD 17)
6
- set (DEFAULT_FLAGS "-DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_MEMRCHR=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DFOLLY_HAVE_RECVMMSG=1 -DFOLLY_HAVE_PTHREAD=1 -DON_ANDROID -DONANDROID -DANDROID -DRNVERSION=${RNVERSION} -fexceptions -fno-omit-frame-pointer -frtti -Wno-sign-compare -std=c++17 -Wall")
6
+ set (DEFAULT_FLAGS "-DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_MEMRCHR=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DFOLLY_HAVE_RECVMMSG=1 -DFOLLY_HAVE_PTHREAD=1 -DANDROID -DREACT_NATIVE_MINOR_VERSION=${REACT_NATIVE_MINOR_VERSION} -DHERMES_ENABLE_DEBUGGER=${HERMES_ENABLE_DEBUGGER} -fexceptions -fno-omit-frame-pointer -frtti -Wno-sign-compare -std=c++17 -Wall -Werror")
7
7
  if(${IS_NEW_ARCHITECTURE_ENABLED})
8
8
  set (ALL_FLAGS "${DEFAULT_FLAGS} -DRCT_NEW_ARCH_ENABLED")
9
9
  else()
10
10
  set (ALL_FLAGS ${DEFAULT_FLAGS})
11
11
  endif()
12
+ if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
13
+ set (ALL_FLAGS "${ALL_FLAGS} -DDEBUG")
14
+ endif()
12
15
  set (CMAKE_CXX_FLAGS ${ALL_FLAGS})
13
16
 
14
- if(${NATIVE_DEBUG})
17
+ if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
15
18
  set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g")
16
19
  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")
17
20
  endif()
@@ -23,25 +26,20 @@ set (PACKAGE_NAME "reanimated")
23
26
  set (BUILD_DIR ${CMAKE_SOURCE_DIR}/build)
24
27
  set (SRC_DIR ${CMAKE_SOURCE_DIR}/src)
25
28
 
26
- set (ignoreMe "${PLAYGROUND_APP_NAME}")
27
-
28
- if(${CLIENT_SIDE_BUILD})
29
- set (COMMON_SRC_DIR "${CMAKE_SOURCE_DIR}/../Common")
30
- else()
31
- set (COMMON_SRC_DIR "${SRC_DIR}/main/Common")
32
- endif()
33
-
29
+ set (COMMON_SRC_DIR "${CMAKE_SOURCE_DIR}/../Common")
34
30
  if(${IS_NEW_ARCHITECTURE_ENABLED})
35
31
  if(${CLIENT_SIDE_BUILD})
36
32
  set (RN_SO_DIR "${CMAKE_SOURCE_DIR}/../../../android/app/build/react-ndk/exported")
37
- set (FBJNI_HEADERS_DIR "${CMAKE_SOURCE_DIR}/../../react-native/ReactAndroid/src/main/jni/first-party/fbjni/headers")
33
+ set (FBJNI_HEADERS_DIR "${REACT_NATIVE_DIR}/ReactAndroid/src/main/jni/first-party/fbjni/headers")
38
34
  else()
35
+ # Reanimated Playground app
39
36
  set (RN_SO_DIR "${CMAKE_SOURCE_DIR}/../${PLAYGROUND_APP_NAME}/android/app/build/react-ndk/exported")
40
- set (FBJNI_HEADERS_DIR "${CMAKE_SOURCE_DIR}/../${PLAYGROUND_APP_NAME}/node_modules/react-native/ReactAndroid/src/main/jni/first-party/fbjni/headers")
37
+ set (FBJNI_HEADERS_DIR "${REACT_NATIVE_DIR}/ReactAndroid/src/main/jni/first-party/fbjni/headers")
38
+
41
39
  endif()
42
40
  else()
43
- set (RN_SO_DIR ${NODE_MODULES_DIR}/react-native/ReactAndroid/src/main/jni/first-party/react/jni)
44
- set (FBJNI_HEADERS_DIR "${NODE_MODULES_DIR}/react-native/ReactAndroid/src/main/jni/first-party/fbjni/headers")
41
+ set (RN_SO_DIR ${REACT_NATIVE_DIR}/ReactAndroid/src/main/jni/first-party/react/jni)
42
+ set (FBJNI_HEADERS_DIR "${REACT_NATIVE_DIR}/ReactAndroid/src/main/jni/first-party/fbjni/headers")
45
43
  endif()
46
44
 
47
45
  file (GLOB LIBRN_DIR "${RN_SO_DIR}/${ANDROID_ABI}")
@@ -49,28 +47,17 @@ file (GLOB LIBRN_DIR "${RN_SO_DIR}/${ANDROID_ABI}")
49
47
  file(GLOB_RECURSE SOURCES_COMMON CONFIGURE_DEPENDS "${COMMON_SRC_DIR}/cpp/**.cpp")
50
48
  file(GLOB_RECURSE SOURCES_ANDROID CONFIGURE_DEPENDS "${SRC_DIR}/main/cpp/**.cpp")
51
49
 
52
- if(${REACT_NATIVE_TARGET_VERSION} LESS 66)
50
+ if(${REACT_NATIVE_MINOR_VERSION} LESS 66)
53
51
  set (
54
52
  INCLUDE_JSI_CPP
55
- "${NODE_MODULES_DIR}/react-native/ReactCommon/jsi/jsi/jsi.cpp"
53
+ "${REACT_NATIVE_DIR}/ReactCommon/jsi/jsi/jsi.cpp"
56
54
  )
57
55
  set (
58
56
  INCLUDE_JSIDYNAMIC_CPP
59
- "${NODE_MODULES_DIR}/react-native/ReactCommon/jsi/jsi/JSIDynamic.cpp"
57
+ "${REACT_NATIVE_DIR}/ReactCommon/jsi/jsi/JSIDynamic.cpp"
60
58
  )
61
59
  endif()
62
60
 
63
- if(${IS_NEW_ARCHITECTURE_ENABLED})
64
- set(
65
- FABRIC_UTILS_CPP
66
- "${COMMON_SRC_DIR}/cpp/Fabric/FabricUtils.cpp"
67
- )
68
- set(
69
- REANIMATED_UI_MANAGER_BINDING_CPP
70
- "${COMMON_SRC_DIR}/cpp/Fabric/ReanimatedUIManagerBinding.cpp"
71
- )
72
- endif()
73
-
74
61
  add_library(
75
62
  ${PACKAGE_NAME}
76
63
  SHARED
@@ -78,8 +65,6 @@ add_library(
78
65
  ${SOURCES_ANDROID}
79
66
  ${INCLUDE_JSI_CPP}
80
67
  ${INCLUDE_JSIDYNAMIC_CPP}
81
- ${FABRIC_UTILS_CPP}
82
- ${REANIMATED_UI_MANAGER_BINDING_CPP}
83
68
  )
84
69
 
85
70
  # includes
@@ -94,29 +79,31 @@ target_include_directories(
94
79
  "${BUILD_DIR}/third-party-ndk/double-conversion"
95
80
  "${BUILD_DIR}/third-party-ndk/folly"
96
81
  "${BUILD_DIR}/third-party-ndk/glog/exported"
97
- "${NODE_MODULES_DIR}/react-native/React"
98
- "${NODE_MODULES_DIR}/react-native/React/Base"
99
- "${NODE_MODULES_DIR}/react-native/ReactAndroid/src/main/jni"
100
- "${NODE_MODULES_DIR}/react-native/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni"
101
- "${NODE_MODULES_DIR}/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/jni"
102
- "${NODE_MODULES_DIR}/react-native/ReactCommon"
103
- "${NODE_MODULES_DIR}/react-native/ReactCommon/callinvoker"
104
- "${NODE_MODULES_DIR}/react-native/ReactCommon/jsi"
105
- "${NODE_MODULES_DIR}/react-native/ReactCommon/react/renderer/graphics/platform/cxx"
106
- "${NODE_MODULES_DIR}/react-native/ReactCommon/runtimeexecutor"
107
- "${NODE_MODULES_DIR}/react-native/ReactCommon/turbomodule/core"
108
- "${NODE_MODULES_DIR}/react-native/ReactCommon/turbomodule"
109
- "${NODE_MODULES_DIR}/react-native/ReactCommon/yoga"
110
- "${COMMON_SRC_DIR}/cpp/headers/Tools"
111
- "${COMMON_SRC_DIR}/cpp/headers/SpecTools"
112
- "${COMMON_SRC_DIR}/cpp/headers/NativeModules"
113
- "${COMMON_SRC_DIR}/cpp/headers/SharedItems"
114
- "${COMMON_SRC_DIR}/cpp/headers/Registries"
115
- "${COMMON_SRC_DIR}/cpp/headers/LayoutAnimations"
116
- "${COMMON_SRC_DIR}/cpp/headers/AnimatedSensor"
117
- "${COMMON_SRC_DIR}/cpp/headers/Fabric"
82
+ "${REACT_NATIVE_DIR}/React"
83
+ "${REACT_NATIVE_DIR}/React/Base"
84
+ "${REACT_NATIVE_DIR}/ReactAndroid/src/main/jni"
85
+ "${REACT_NATIVE_DIR}/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni"
86
+ "${REACT_NATIVE_DIR}/ReactAndroid/src/main/java/com/facebook/react/fabric/jni"
87
+ "${REACT_NATIVE_DIR}/ReactCommon"
88
+ "${REACT_NATIVE_DIR}/ReactCommon/callinvoker"
89
+ "${REACT_NATIVE_DIR}/ReactCommon/jsi"
90
+ "${REACT_NATIVE_DIR}/ReactCommon/hermes"
91
+ "${REACT_NATIVE_DIR}/ReactCommon/react/renderer/graphics/platform/cxx"
92
+ "${REACT_NATIVE_DIR}/ReactCommon/runtimeexecutor"
93
+ "${REACT_NATIVE_DIR}/ReactCommon/turbomodule/core"
94
+ "${REACT_NATIVE_DIR}/ReactCommon/turbomodule"
95
+ "${REACT_NATIVE_DIR}/ReactCommon/yoga"
96
+ "${COMMON_SRC_DIR}/cpp/Tools"
97
+ "${COMMON_SRC_DIR}/cpp/SpecTools"
98
+ "${COMMON_SRC_DIR}/cpp/NativeModules"
99
+ "${COMMON_SRC_DIR}/cpp/SharedItems"
100
+ "${COMMON_SRC_DIR}/cpp/ReanimatedRuntime"
101
+ "${COMMON_SRC_DIR}/cpp/Registries"
102
+ "${COMMON_SRC_DIR}/cpp/LayoutAnimations"
103
+ "${COMMON_SRC_DIR}/cpp/AnimatedSensor"
104
+ "${COMMON_SRC_DIR}/cpp/Fabric"
118
105
  "${COMMON_SRC_DIR}/cpp/hidden_headers"
119
- "${SRC_DIR}/main/cpp/headers"
106
+ "${SRC_DIR}/main/cpp"
120
107
  )
121
108
 
122
109
  find_library(
@@ -142,7 +129,7 @@ find_library(
142
129
  NO_CMAKE_FIND_ROOT_PATH
143
130
  )
144
131
 
145
- if(${REACT_NATIVE_TARGET_VERSION} LESS 69)
132
+ if(${REACT_NATIVE_MINOR_VERSION} LESS 69)
146
133
  find_library(
147
134
  FOLLY_LIB
148
135
  folly_json
@@ -158,7 +145,7 @@ else()
158
145
  )
159
146
  endif()
160
147
 
161
- if(${REACT_NATIVE_TARGET_VERSION} LESS 66)
148
+ if(${REACT_NATIVE_MINOR_VERSION} LESS 66)
162
149
  set (JSI_LIB "")
163
150
  else()
164
151
  find_library(
@@ -250,7 +237,7 @@ target_link_libraries(
250
237
 
251
238
  if(${JS_RUNTIME} STREQUAL "hermes")
252
239
  string(APPEND CMAKE_CXX_FLAGS " -DJS_RUNTIME_HERMES=1")
253
- if(${REACT_NATIVE_TARGET_VERSION} LESS 69)
240
+ if(${REACT_NATIVE_MINOR_VERSION} LESS 69)
254
241
  # From `hermes-engine` npm package
255
242
  target_include_directories(
256
243
  ${PACKAGE_NAME}
@@ -266,6 +253,18 @@ if(${JS_RUNTIME} STREQUAL "hermes")
266
253
  "${JS_RUNTIME_DIR}/public"
267
254
  )
268
255
  endif()
256
+ if (${HERMES_ENABLE_DEBUGGER})
257
+ find_library(
258
+ HERMES_EXECUTOR_LIB
259
+ hermes-executor-debug
260
+ PATHS ${LIBRN_DIR}
261
+ NO_CMAKE_FIND_ROOT_PATH
262
+ )
263
+ target_link_libraries(
264
+ ${PACKAGE_NAME}
265
+ ${HERMES_EXECUTOR_LIB}
266
+ )
267
+ endif()
269
268
  target_link_libraries(
270
269
  ${PACKAGE_NAME}
271
270
  "${BUILD_DIR}/third-party-ndk/hermes/jni/${ANDROID_ABI}/libhermes.so"
@@ -289,7 +288,6 @@ elseif(${JS_RUNTIME} STREQUAL "v8")
289
288
  ${V8EXECUTOR_LIB}
290
289
  )
291
290
  else()
292
- set (ignoreMe "${JS_RUNTIME_DIR}")
293
291
  string(APPEND CMAKE_CXX_FLAGS " -DJS_RUNTIME_JSC=1")
294
292
  find_library(
295
293
  JSEXECUTOR_LIB
@@ -319,7 +317,7 @@ if(${IS_NEW_ARCHITECTURE_ENABLED})
319
317
  )
320
318
  endif()
321
319
 
322
- if(${REACT_NATIVE_TARGET_VERSION} LESS 64)
320
+ if(${REACT_NATIVE_MINOR_VERSION} LESS 64)
323
321
  add_library(
324
322
  turbomodulejsijni
325
323
  # Sets the library as a shared library.
@@ -328,3 +326,9 @@ if(${REACT_NATIVE_TARGET_VERSION} LESS 64)
328
326
  ./empty.cpp
329
327
  )
330
328
  endif()
329
+
330
+ # Resolves "CMake Warning: Manually-specified variables were not used by the project"
331
+ # when any of the following variables is not used in some build configuration.
332
+ set (ignoreMe "${CLIENT_SIDE_BUILD}")
333
+ set (ignoreMe "${JS_RUNTIME_DIR}")
334
+ set (ignoreMe "${PLAYGROUND_APP_NAME}")