react-native-reanimated 2.6.0 → 2.7.0

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 (111) hide show
  1. package/Common/cpp/SharedItems/ShareableValue.cpp +2 -2
  2. package/Common/cpp/Tools/RuntimeDecorator.cpp +0 -14
  3. package/android/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock +0 -0
  4. package/android/.gradle/7.2/executionHistory/executionHistory.bin +0 -0
  5. package/android/.gradle/7.2/executionHistory/executionHistory.lock +0 -0
  6. package/android/.gradle/7.2/fileHashes/fileHashes.bin +0 -0
  7. package/android/.gradle/7.2/fileHashes/fileHashes.lock +0 -0
  8. package/android/.gradle/7.2/fileHashes/resourceHashesCache.bin +0 -0
  9. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  10. package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
  11. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  12. package/android/.gradle/checksums/checksums.lock +0 -0
  13. package/android/.gradle/checksums/md5-checksums.bin +0 -0
  14. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  15. package/android/react-native-reanimated-64-hermes.aar +0 -0
  16. package/android/react-native-reanimated-64-jsc.aar +0 -0
  17. package/android/react-native-reanimated-65-hermes.aar +0 -0
  18. package/android/react-native-reanimated-65-jsc.aar +0 -0
  19. package/android/react-native-reanimated-66-hermes.aar +0 -0
  20. package/android/react-native-reanimated-66-jsc.aar +0 -0
  21. package/android/react-native-reanimated-67-hermes.aar +0 -0
  22. package/android/react-native-reanimated-67-jsc.aar +0 -0
  23. package/android/react-native-reanimated-68-hermes.aar +0 -0
  24. package/android/react-native-reanimated-68-jsc.aar +0 -0
  25. package/android/src/main/java/com/swmansion/reanimated/NativeProxy.java +11 -8
  26. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +13 -6
  27. package/ios/LayoutReanimation/REAAnimationsManager.h +1 -1
  28. package/ios/LayoutReanimation/REAAnimationsManager.m +2 -2
  29. package/ios/LayoutReanimation/REASnapshot.m +1 -1
  30. package/ios/LayoutReanimation/REAUIManager.h +1 -1
  31. package/ios/LayoutReanimation/REAUIManager.mm +4 -5
  32. package/ios/Nodes/REAAlwaysNode.h +1 -1
  33. package/ios/Nodes/REAAlwaysNode.m +5 -5
  34. package/ios/Nodes/REABezierNode.h +1 -1
  35. package/ios/Nodes/REABezierNode.m +4 -5
  36. package/ios/Nodes/REABlockNode.h +1 -1
  37. package/ios/Nodes/REABlockNode.m +2 -2
  38. package/ios/Nodes/REACallFuncNode.h +1 -1
  39. package/ios/Nodes/REACallFuncNode.m +5 -5
  40. package/ios/Nodes/REAClockNodes.h +1 -1
  41. package/ios/Nodes/REAClockNodes.m +4 -4
  42. package/ios/Nodes/REAConcatNode.h +1 -1
  43. package/ios/Nodes/REAConcatNode.m +3 -3
  44. package/ios/Nodes/REACondNode.h +1 -1
  45. package/ios/Nodes/REACondNode.m +3 -3
  46. package/ios/Nodes/READebugNode.h +1 -1
  47. package/ios/Nodes/READebugNode.m +3 -3
  48. package/ios/Nodes/REAEventNode.h +1 -2
  49. package/ios/Nodes/REAEventNode.m +3 -3
  50. package/ios/Nodes/REAFunctionNode.h +1 -1
  51. package/ios/Nodes/REAFunctionNode.m +3 -3
  52. package/ios/Nodes/REAJSCallNode.h +1 -1
  53. package/ios/Nodes/REAJSCallNode.m +3 -3
  54. package/ios/Nodes/REANode.m +2 -2
  55. package/ios/Nodes/REAOperatorNode.h +1 -1
  56. package/ios/Nodes/REAOperatorNode.m +2 -3
  57. package/ios/Nodes/REAParamNode.h +1 -1
  58. package/ios/Nodes/REAParamNode.m +4 -4
  59. package/ios/Nodes/REAPropsNode.h +1 -1
  60. package/ios/Nodes/REAPropsNode.m +4 -6
  61. package/ios/Nodes/REASetNode.h +1 -1
  62. package/ios/Nodes/REASetNode.m +4 -4
  63. package/ios/Nodes/REAStyleNode.h +1 -1
  64. package/ios/Nodes/REAStyleNode.m +2 -3
  65. package/ios/Nodes/REATransformNode.h +1 -1
  66. package/ios/Nodes/REATransformNode.m +2 -2
  67. package/ios/Nodes/REAValueNode.h +1 -3
  68. package/ios/Nodes/REAValueNode.m +1 -1
  69. package/ios/REAEventDispatcher.m +1 -1
  70. package/ios/REAModule.h +1 -1
  71. package/ios/REAModule.m +4 -5
  72. package/ios/REANodesManager.h +1 -2
  73. package/ios/REANodesManager.m +21 -23
  74. package/ios/Transitioning/RCTConvert+REATransition.h +1 -2
  75. package/ios/Transitioning/RCTConvert+REATransition.m +1 -1
  76. package/ios/Transitioning/REAAllTransitions.h +1 -1
  77. package/ios/Transitioning/REAAllTransitions.m +2 -3
  78. package/ios/Transitioning/REATransition.h +2 -3
  79. package/ios/Transitioning/REATransition.m +3 -4
  80. package/ios/Transitioning/REATransitionAnimation.m +1 -2
  81. package/ios/Transitioning/REATransitionManager.m +2 -4
  82. package/ios/Transitioning/REATransitionValues.m +2 -3
  83. package/ios/native/NativeMethods.h +1 -3
  84. package/ios/native/NativeMethods.mm +1 -1
  85. package/ios/native/NativeProxy.h +2 -2
  86. package/ios/native/NativeProxy.mm +14 -15
  87. package/ios/native/REAIOSErrorHandler.h +2 -4
  88. package/ios/native/REAIOSErrorHandler.mm +1 -1
  89. package/ios/native/REAIOSLogger.h +1 -3
  90. package/ios/native/REAIOSLogger.mm +1 -1
  91. package/ios/native/REAIOSScheduler.h +1 -3
  92. package/ios/native/REAIOSScheduler.mm +2 -2
  93. package/ios/native/REAInitializer.h +0 -7
  94. package/ios/native/REAInitializer.mm +2 -2
  95. package/ios/native/UIResponder+Reanimated.mm +3 -3
  96. package/ios/sensor/ReanimatedSensor.h +1 -1
  97. package/ios/sensor/ReanimatedSensor.m +1 -1
  98. package/ios/sensor/ReanimatedSensorContainer.h +1 -1
  99. package/ios/sensor/ReanimatedSensorContainer.m +2 -2
  100. package/lib/ConfigHelper.js +0 -1
  101. package/lib/reanimated2/Easing.js +9 -3
  102. package/lib/reanimated2/core.js +0 -36
  103. package/lib/reanimated2/globals.d.ts +1 -2
  104. package/lib/types/lib/reanimated2/commonTypes.d.ts +0 -1
  105. package/package.json +4 -6
  106. package/plugin.js +0 -12
  107. package/src/ConfigHelper.ts +0 -1
  108. package/src/reanimated2/Easing.ts +9 -3
  109. package/src/reanimated2/commonTypes.ts +0 -1
  110. package/src/reanimated2/core.ts +0 -47
  111. package/src/reanimated2/globals.d.ts +1 -2
@@ -1,29 +1,27 @@
1
- #import "REANodesManager.h"
2
-
1
+ #import <RNReanimated/REAAlwaysNode.h>
2
+ #import <RNReanimated/REABezierNode.h>
3
+ #import <RNReanimated/REABlockNode.h>
4
+ #import <RNReanimated/REACallFuncNode.h>
5
+ #import <RNReanimated/REAClockNodes.h>
6
+ #import <RNReanimated/REAConcatNode.h>
7
+ #import <RNReanimated/REACondNode.h>
8
+ #import <RNReanimated/READebugNode.h>
9
+ #import <RNReanimated/REAEventNode.h>
10
+ #import <RNReanimated/REAFunctionNode.h>
11
+ #import <RNReanimated/REAJSCallNode.h>
12
+ #import <RNReanimated/REAModule.h>
13
+ #import <RNReanimated/REANode.h>
14
+ #import <RNReanimated/REANodesManager.h>
15
+ #import <RNReanimated/REAOperatorNode.h>
16
+ #import <RNReanimated/REAParamNode.h>
17
+ #import <RNReanimated/REAPropsNode.h>
18
+ #import <RNReanimated/REASetNode.h>
19
+ #import <RNReanimated/REAStyleNode.h>
20
+ #import <RNReanimated/REATransformNode.h>
21
+ #import <RNReanimated/REAValueNode.h>
3
22
  #import <React/RCTConvert.h>
4
-
5
23
  #import <React/RCTShadowView.h>
6
24
  #import <stdatomic.h>
7
- #import "Nodes/REAAlwaysNode.h"
8
- #import "Nodes/REABezierNode.h"
9
- #import "Nodes/REABlockNode.h"
10
- #import "Nodes/REACallFuncNode.h"
11
- #import "Nodes/REAClockNodes.h"
12
- #import "Nodes/REAConcatNode.h"
13
- #import "Nodes/REACondNode.h"
14
- #import "Nodes/READebugNode.h"
15
- #import "Nodes/REAEventNode.h"
16
- #import "Nodes/REAFunctionNode.h"
17
- #import "Nodes/REAJSCallNode.h"
18
- #import "Nodes/REANode.h"
19
- #import "Nodes/REAOperatorNode.h"
20
- #import "Nodes/REAParamNode.h"
21
- #import "Nodes/REAPropsNode.h"
22
- #import "Nodes/REASetNode.h"
23
- #import "Nodes/REAStyleNode.h"
24
- #import "Nodes/REATransformNode.h"
25
- #import "Nodes/REAValueNode.h"
26
- #import "REAModule.h"
27
25
 
28
26
  // Interface below has been added in order to use private methods of RCTUIManager,
29
27
  // RCTUIManager#UpdateView is a React Method which is exported to JS but in
@@ -1,7 +1,6 @@
1
+ #import <RNReanimated/REATransition.h>
1
2
  #import <React/RCTConvert.h>
2
3
 
3
- #import "REATransition.h"
4
-
5
4
  @interface RCTConvert (REATransition)
6
5
 
7
6
  + (REATransitionType)REATransitionType:(id)json;
@@ -1,4 +1,4 @@
1
- #import "RCTConvert+REATransition.h"
1
+ #import <RNReanimated/RCTConvert+REATransition.h>
2
2
 
3
3
  @implementation RCTConvert (REATransition)
4
4
 
@@ -1,4 +1,4 @@
1
- #import "REATransition.h"
1
+ #import <RNReanimated/REATransition.h>
2
2
 
3
3
  @interface REATransitionGroup : REATransition
4
4
  @property (nonatomic) BOOL sequence;
@@ -1,8 +1,7 @@
1
+ #import <RNReanimated/RCTConvert+REATransition.h>
2
+ #import <RNReanimated/REAAllTransitions.h>
1
3
  #import <React/RCTViewManager.h>
2
4
 
3
- #import "RCTConvert+REATransition.h"
4
- #import "REAAllTransitions.h"
5
-
6
5
  @interface REASnapshotRemover : NSObject <CAAnimationDelegate>
7
6
  @end
8
7
 
@@ -1,10 +1,9 @@
1
1
  #import <QuartzCore/QuartzCore.h>
2
+ #import <RNReanimated/REATransitionAnimation.h>
3
+ #import <RNReanimated/REATransitionValues.h>
2
4
  #import <React/RCTView.h>
3
5
  #import <UIKit/UIKit.h>
4
6
 
5
- #import "REATransitionAnimation.h"
6
- #import "REATransitionValues.h"
7
-
8
7
  // TODO: fix below implementation
9
8
  #define IS_LAYOUT_ONLY(view) ([view isKindOfClass:[RCTView class]] && view.backgroundColor == nil)
10
9
 
@@ -1,12 +1,11 @@
1
1
  #import <QuartzCore/QuartzCore.h>
2
+ #import <RNReanimated/RCTConvert+REATransition.h>
3
+ #import <RNReanimated/REATransition.h>
4
+ #import <RNReanimated/REATransitionValues.h>
2
5
  #import <React/RCTConvert.h>
3
6
  #import <React/RCTViewManager.h>
4
7
  #import <UIKit/UIKit.h>
5
8
 
6
- #import "RCTConvert+REATransition.h"
7
- #import "REATransition.h"
8
- #import "REATransitionValues.h"
9
-
10
9
  #define DEFAULT_PROPAGATION_SPEED 3
11
10
 
12
11
  @interface REATransitionGroup : REATransition
@@ -1,7 +1,6 @@
1
+ #import <RNReanimated/REATransitionAnimation.h>
1
2
  #import <UIKit/UIKit.h>
2
3
 
3
- #import "REATransitionAnimation.h"
4
-
5
4
  #define DEFAULT_DURATION 0.25
6
5
 
7
6
  #if TARGET_IPHONE_SIMULATOR
@@ -1,10 +1,8 @@
1
- #import "REATransitionManager.h"
2
-
1
+ #import <RNReanimated/REATransition.h>
2
+ #import <RNReanimated/REATransitionManager.h>
3
3
  #import <React/RCTUIManager.h>
4
4
  #import <React/RCTUIManagerObserverCoordinator.h>
5
5
 
6
- #import "REATransition.h"
7
-
8
6
  @interface REATransitionManager () <RCTUIManagerObserver>
9
7
  @end
10
8
 
@@ -1,9 +1,8 @@
1
+ #import <RNReanimated/REATransition.h>
2
+ #import <RNReanimated/REATransitionValues.h>
1
3
  #import <React/RCTView.h>
2
4
  #import <React/RCTViewManager.h>
3
5
 
4
- #import "REATransition.h"
5
- #import "REATransitionValues.h"
6
-
7
6
  @implementation REATransitionValues
8
7
 
9
8
  - (instancetype)initWithView:(UIView *)view forRoot:(UIView *)root
@@ -1,11 +1,9 @@
1
1
  #import <Foundation/Foundation.h>
2
- #import <RNGestureHandlerStateManager.h>
2
+ #import <RNReanimated/RNGestureHandlerStateManager.h>
3
3
  #import <React/RCTUIManager.h>
4
4
  #include <string>
5
- #import <string>
6
5
  #include <utility>
7
6
  #include <vector>
8
- #import <vector>
9
7
 
10
8
  namespace reanimated {
11
9
 
@@ -1,4 +1,4 @@
1
- #import "NativeMethods.h"
1
+ #import <RNReanimated/NativeMethods.h>
2
2
  #import <React/RCTEventDispatcher.h>
3
3
  #import <React/RCTScrollView.h>
4
4
 
@@ -1,7 +1,7 @@
1
- #import <React/RCTEventDispatcher.h>
2
-
3
1
  #if __cplusplus
2
+
4
3
  #import <RNReanimated/NativeReanimatedModule.h>
4
+ #import <React/RCTEventDispatcher.h>
5
5
  #include <memory>
6
6
 
7
7
  namespace reanimated {
@@ -1,22 +1,21 @@
1
- #if TARGET_IPHONE_SIMULATOR
2
- #import <dlfcn.h>
3
- #endif
4
-
1
+ #import <RNReanimated/LayoutAnimationsProxy.h>
2
+ #import <RNReanimated/NativeMethods.h>
3
+ #import <RNReanimated/NativeProxy.h>
4
+ #import <RNReanimated/REAAnimationsManager.h>
5
+ #import <RNReanimated/REAIOSErrorHandler.h>
6
+ #import <RNReanimated/REAIOSScheduler.h>
7
+ #import <RNReanimated/REAModule.h>
8
+ #import <RNReanimated/REANodesManager.h>
9
+ #import <RNReanimated/REAUIManager.h>
10
+ #import <RNReanimated/RNGestureHandlerStateManager.h>
11
+ #import <RNReanimated/ReanimatedSensorContainer.h>
5
12
  #import <React/RCTFollyConvert.h>
6
13
  #import <React/RCTUIManager.h>
7
14
  #import <folly/json.h>
8
15
 
9
- #import <RNGestureHandlerStateManager.h>
10
- #import "LayoutAnimationsProxy.h"
11
- #import "NativeMethods.h"
12
- #import "NativeProxy.h"
13
- #import "REAAnimationsManager.h"
14
- #import "REAIOSErrorHandler.h"
15
- #import "REAIOSScheduler.h"
16
- #import "REAModule.h"
17
- #import "REANodesManager.h"
18
- #import "REAUIManager.h"
19
- #import "ReanimatedSensorContainer.h"
16
+ #if TARGET_IPHONE_SIMULATOR
17
+ #import <dlfcn.h>
18
+ #endif
20
19
 
21
20
  #if __has_include(<reacthermes/HermesExecutorFactory.h>)
22
21
  #import <reacthermes/HermesExecutorFactory.h>
@@ -1,9 +1,7 @@
1
- #pragma once
2
-
1
+ #import <RNReanimated/ErrorHandler.h>
2
+ #import <RNReanimated/Scheduler.h>
3
3
  #include <memory>
4
4
  #include <string>
5
- #include "ErrorHandler.h"
6
- #include "Scheduler.h"
7
5
 
8
6
  namespace reanimated {
9
7
 
@@ -1,5 +1,5 @@
1
- #include "REAIOSErrorHandler.h"
2
1
  #import <Foundation/Foundation.h>
2
+ #import <RNReanimated/REAIOSErrorHandler.h>
3
3
  #import <React/RCTLog.h>
4
4
 
5
5
  namespace reanimated {
@@ -1,7 +1,5 @@
1
- #pragma once
2
-
1
+ #import <RNReanimated/ReanimatedHiddenHeaders.h>
3
2
  #include <stdio.h>
4
- #include "ReanimatedHiddenHeaders.h"
5
3
 
6
4
  namespace reanimated {
7
5
 
@@ -1,5 +1,5 @@
1
- #include "REAIOSLogger.h"
2
1
  #import <Foundation/Foundation.h>
2
+ #import <RNReanimated/REAIOSLogger.h>
3
3
 
4
4
  namespace reanimated {
5
5
 
@@ -1,10 +1,8 @@
1
- #pragma once
2
-
1
+ #import <RNReanimated/Scheduler.h>
3
2
  #import <React/RCTUIManager.h>
4
3
  #import <ReactCommon/CallInvoker.h>
5
4
  #include <stdio.h>
6
5
  #include <memory>
7
- #include "Scheduler.h"
8
6
 
9
7
  namespace reanimated {
10
8
 
@@ -1,5 +1,5 @@
1
- #include "REAIOSScheduler.h"
2
- #include "RuntimeManager.h"
1
+ #import <RNReanimated/REAIOSScheduler.h>
2
+ #import <RNReanimated/RuntimeManager.h>
3
3
 
4
4
  namespace reanimated {
5
5
 
@@ -1,10 +1,3 @@
1
- //
2
- // REAInitializer.h
3
- // RNReanimated
4
- //
5
- // Created by Szymon Kapala on 27/07/2021.
6
- //
7
-
8
1
  #import <Foundation/Foundation.h>
9
2
  #import <RNReanimated/NativeProxy.h>
10
3
  #import <RNReanimated/REAEventDispatcher.h>
@@ -1,5 +1,5 @@
1
- #import "REAInitializer.h"
2
- #import "REAUIManager.h"
1
+ #import <RNReanimated/REAInitializer.h>
2
+ #import <RNReanimated/REAUIManager.h>
3
3
 
4
4
  @interface RCTEventDispatcher (Reanimated)
5
5
 
@@ -1,6 +1,6 @@
1
- #import "REAInitializer.h"
2
- #import "REAUIManager.h"
3
- #import "UIResponder+Reanimated.h"
1
+ #import <RNReanimated/REAInitializer.h>
2
+ #import <RNReanimated/REAUIManager.h>
3
+ #import <RNReanimated/UIResponder+Reanimated.h>
4
4
 
5
5
  #if __has_include(<reacthermes/HermesExecutorFactory.h>)
6
6
  #import <reacthermes/HermesExecutorFactory.h>
@@ -1,7 +1,7 @@
1
1
  #if __has_include(<CoreMotion/CoreMotion.h>)
2
2
  #import <CoreMotion/CoreMotion.h>
3
3
  #endif
4
- #import "ReanimatedSensorType.h"
4
+ #import <RNReanimated/ReanimatedSensorType.h>
5
5
 
6
6
  @interface ReanimatedSensor : NSObject {
7
7
  ReanimatedSensorType _sensorType;
@@ -1,4 +1,4 @@
1
- #import "ReanimatedSensor.h"
1
+ #import <RNReanimated/ReanimatedSensor.h>
2
2
 
3
3
  #if __has_include(<CoreMotion/CoreMotion.h>)
4
4
  @implementation ReanimatedSensor
@@ -1,4 +1,4 @@
1
- #import "ReanimatedSensorType.h"
1
+ #import <RNReanimated/ReanimatedSensorType.h>
2
2
 
3
3
  @interface ReanimatedSensorContainer : NSObject {
4
4
  NSNumber *_nextSensorId;
@@ -1,6 +1,6 @@
1
- #import "ReanimatedSensorContainer.h"
2
1
  #import <Foundation/Foundation.h>
3
- #import "ReanimatedSensor.h"
2
+ #import <RNReanimated/ReanimatedSensor.h>
3
+ #import <RNReanimated/ReanimatedSensorContainer.h>
4
4
 
5
5
  static NSNumber *_nextSensorId = nil;
6
6
 
@@ -76,7 +76,6 @@ let NATIVE_THREAD_PROPS_WHITELIST = {
76
76
  borderTopLeftRadius: true,
77
77
  borderTopRightRadius: true,
78
78
  borderTopStartRadius: true,
79
- opacity: true,
80
79
  elevation: true,
81
80
  fontSize: true,
82
81
  lineHeight: true,
@@ -53,7 +53,10 @@ function cubic(t) {
53
53
  */
54
54
  function poly(n) {
55
55
  'worklet';
56
- return (t) => Math.pow(t, n);
56
+ return (t) => {
57
+ 'worklet';
58
+ return Math.pow(t, n);
59
+ };
57
60
  }
58
61
  /**
59
62
  * A sinusoidal function.
@@ -110,7 +113,10 @@ function elastic(bounciness = 1) {
110
113
  */
111
114
  function back(s = 1.70158) {
112
115
  'worklet';
113
- return (t) => t * t * ((s + 1) * t - s);
116
+ return (t) => {
117
+ 'worklet';
118
+ return t * t * ((s + 1) * t - s);
119
+ };
114
120
  }
115
121
  /**
116
122
  * Provides a simple bouncing effect.
@@ -224,7 +230,7 @@ function createChecker(worklet, workletName, prevArgs) {
224
230
  }
225
231
  // @ts-ignore this is implicitly any - TODO
226
232
  const res = worklet.apply(this, arguments);
227
- if (!_WORKLET && res && typeof res === 'function' && res.__worklet) {
233
+ if (!_WORKLET && res && typeof res === 'function' && res.__workletHash) {
228
234
  return createChecker(res, workletName, arguments);
229
235
  }
230
236
  return res;
@@ -2,9 +2,6 @@
2
2
  import NativeReanimatedModule from './NativeReanimated';
3
3
  import { Platform } from 'react-native';
4
4
  import { nativeShouldBeMock, shouldBeUseWeb, isWeb } from './PlatformChecker';
5
- global.__reanimatedWorkletInit = function (worklet) {
6
- worklet.__worklet = true;
7
- };
8
5
  if (global._setGlobalConsole === undefined) {
9
6
  // it can happen when Reanimated plugin wasn't added, but the user uses the only API from version 1
10
7
  global._setGlobalConsole = () => {
@@ -31,39 +28,6 @@ export const isConfiguredCheck = () => {
31
28
  throw new Error('If you want to use Reanimated 2 then go through our installation steps https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation');
32
29
  }
33
30
  };
34
- function _toArrayReanimated(object) {
35
- 'worklet';
36
- if (Array.isArray(object)) {
37
- return object;
38
- }
39
- if (typeof Symbol !== 'undefined' &&
40
- (typeof Symbol === 'function' ? Symbol.iterator : '@@iterator') in
41
- Object(object)) {
42
- return Array.from(object);
43
- }
44
- throw new Error('Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
45
- }
46
- function _mergeObjectsReanimated() {
47
- 'worklet';
48
- // we can't use rest parameters in worklets at the moment
49
- // eslint-disable-next-line prefer-rest-params
50
- const arr = Array.from(arguments);
51
- return Object.assign.apply(null, [arr[0], ...arr.slice(1)]);
52
- }
53
- global.__reanimatedWorkletInit = function (worklet) {
54
- worklet.__worklet = true;
55
- if (worklet._closure) {
56
- const closure = worklet._closure;
57
- Object.keys(closure).forEach((key) => {
58
- if (key === '_toConsumableArray') {
59
- closure[key] = _toArrayReanimated;
60
- }
61
- if (key === '_objectSpread') {
62
- closure[key] = _mergeObjectsReanimated;
63
- }
64
- });
65
- }
66
- };
67
31
  function pushFrame(frame) {
68
32
  NativeReanimatedModule.pushFrame(frame);
69
33
  }
@@ -1,4 +1,4 @@
1
- import { AnimatedStyle, StyleProps, WorkletFunction } from './commonTypes';
1
+ import { AnimatedStyle, StyleProps } from './commonTypes';
2
2
  import { ReanimatedConsole } from './core';
3
3
  import { MeasuredDimensions } from './NativeMethods';
4
4
  import { NativeReanimated } from './NativeReanimated/NativeReanimated';
@@ -32,7 +32,6 @@ declare global {
32
32
  };
33
33
  namespace NodeJS {
34
34
  interface Global {
35
- __reanimatedWorkletInit: (worklet: WorkletFunction) => void;
36
35
  _setGlobalConsole: (console?: ReanimatedConsole) => void;
37
36
  _log: (s: string) => void;
38
37
  _setGestureState: () => void;
@@ -17,7 +17,6 @@ export interface WorkletFunction {
17
17
  _closure?: Context;
18
18
  __workletHash?: number;
19
19
  __optimalization?: number;
20
- __worklet?: boolean;
21
20
  }
22
21
  export interface BasicWorkletFunction<T> extends WorkletFunction {
23
22
  (): T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-reanimated",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "description": "More powerful alternative to Animated library for React Native.",
5
5
  "scripts": {
6
6
  "start": "node node_modules/react-native/local-cli/cli.js start",
@@ -75,24 +75,22 @@
75
75
  "homepage": "https://github.com/software-mansion/react-native-reanimated#readme",
76
76
  "dependencies": {
77
77
  "@babel/plugin-transform-object-assign": "^7.16.7",
78
+ "@babel/preset-typescript": "^7.16.7",
78
79
  "@types/invariant": "^2.2.35",
79
80
  "invariant": "^2.2.4",
80
81
  "lodash.isequal": "^4.5.0",
81
- "react-native-screens": "^3.11.1",
82
82
  "setimmediate": "^1.0.5",
83
83
  "string-hash-64": "^1.0.3"
84
84
  },
85
85
  "peerDependencies": {
86
- "@babel/preset-typescript": "*",
86
+ "@babel/core": "^7.0.0-0",
87
87
  "react": "*",
88
- "react-native": "*",
89
- "react-native-gesture-handler": "*"
88
+ "react-native": "*"
90
89
  },
91
90
  "devDependencies": {
92
91
  "@babel/core": "^7.17.2",
93
92
  "@babel/plugin-proposal-class-properties": "^7.16.7",
94
93
  "@babel/preset-env": "^7.16.11",
95
- "@babel/preset-typescript": "^7.16.7",
96
94
  "@react-native-community/bob": "^0.17.1",
97
95
  "@react-native-community/eslint-config": "^0.0.5",
98
96
  "@testing-library/jest-native": "^4.0.4",
package/plugin.js CHANGED
@@ -511,18 +511,6 @@ function makeWorklet(t, fun, fileName) {
511
511
  );
512
512
  }
513
513
 
514
- statements.push(
515
- t.expressionStatement(
516
- t.callExpression(
517
- t.memberExpression(
518
- t.identifier('global'),
519
- t.identifier('__reanimatedWorkletInit'),
520
- false
521
- ),
522
- [privateFunctionId]
523
- )
524
- )
525
- );
526
514
  statements.push(t.returnStatement(privateFunctionId));
527
515
 
528
516
  const newFun = t.functionExpression(fun.id, [], t.blockStatement(statements));
@@ -78,7 +78,6 @@ let NATIVE_THREAD_PROPS_WHITELIST: Record<string, boolean> = {
78
78
  borderTopLeftRadius: true,
79
79
  borderTopRightRadius: true,
80
80
  borderTopStartRadius: true,
81
- opacity: true,
82
81
  elevation: true,
83
82
  fontSize: true,
84
83
  lineHeight: true,
@@ -109,7 +109,10 @@ function cubic(t: number): number {
109
109
  */
110
110
  function poly(n: number): EasingFn {
111
111
  'worklet';
112
- return (t) => Math.pow(t, n);
112
+ return (t) => {
113
+ 'worklet';
114
+ return Math.pow(t, n);
115
+ };
113
116
  }
114
117
 
115
118
  /**
@@ -171,7 +174,10 @@ function elastic(bounciness = 1): EasingFn {
171
174
  */
172
175
  function back(s = 1.70158): (t: number) => number {
173
176
  'worklet';
174
- return (t) => t * t * ((s + 1) * t - s);
177
+ return (t) => {
178
+ 'worklet';
179
+ return t * t * ((s + 1) * t - s);
180
+ };
175
181
  }
176
182
 
177
183
  /**
@@ -312,7 +318,7 @@ function createChecker(
312
318
  }
313
319
  // @ts-ignore this is implicitly any - TODO
314
320
  const res = worklet.apply(this, arguments);
315
- if (!_WORKLET && res && typeof res === 'function' && res.__worklet) {
321
+ if (!_WORKLET && res && typeof res === 'function' && res.__workletHash) {
316
322
  return createChecker(res, workletName, arguments);
317
323
  }
318
324
  return res;
@@ -51,7 +51,6 @@ export interface WorkletFunction {
51
51
  _closure?: Context;
52
52
  __workletHash?: number;
53
53
  __optimalization?: number;
54
- __worklet?: boolean;
55
54
  }
56
55
 
57
56
  export interface BasicWorkletFunction<T> extends WorkletFunction {
@@ -4,7 +4,6 @@ import { Platform } from 'react-native';
4
4
  import { nativeShouldBeMock, shouldBeUseWeb, isWeb } from './PlatformChecker';
5
5
  import {
6
6
  BasicWorkletFunction,
7
- WorkletFunction,
8
7
  ComplexWorkletFunction,
9
8
  SharedValue,
10
9
  AnimationObject,
@@ -14,10 +13,6 @@ import {
14
13
  import { Descriptor } from './hook/commonTypes';
15
14
  import JSReanimated from './js-reanimated/JSReanimated';
16
15
 
17
- global.__reanimatedWorkletInit = function (worklet: WorkletFunction) {
18
- worklet.__worklet = true;
19
- };
20
-
21
16
  if (global._setGlobalConsole === undefined) {
22
17
  // it can happen when Reanimated plugin wasn't added, but the user uses the only API from version 1
23
18
  global._setGlobalConsole = () => {
@@ -74,48 +69,6 @@ export const isConfiguredCheck: () => void = () => {
74
69
  }
75
70
  };
76
71
 
77
- function _toArrayReanimated<T>(object: Iterable<T> | ArrayLike<T> | T[]): T[] {
78
- 'worklet';
79
- if (Array.isArray(object)) {
80
- return object;
81
- }
82
- if (
83
- typeof Symbol !== 'undefined' &&
84
- (typeof Symbol === 'function' ? Symbol.iterator : '@@iterator') in
85
- Object(object)
86
- ) {
87
- return Array.from(object);
88
- }
89
- throw new Error(
90
- 'Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
91
- );
92
- }
93
-
94
- function _mergeObjectsReanimated(): unknown {
95
- 'worklet';
96
- // we can't use rest parameters in worklets at the moment
97
- // eslint-disable-next-line prefer-rest-params
98
- const arr = Array.from(arguments);
99
- return Object.assign.apply(null, [arr[0], ...arr.slice(1)]);
100
- }
101
-
102
- global.__reanimatedWorkletInit = function (worklet: WorkletFunction) {
103
- worklet.__worklet = true;
104
-
105
- if (worklet._closure) {
106
- const closure = worklet._closure;
107
- Object.keys(closure).forEach((key) => {
108
- if (key === '_toConsumableArray') {
109
- closure[key] = _toArrayReanimated;
110
- }
111
-
112
- if (key === '_objectSpread') {
113
- closure[key] = _mergeObjectsReanimated;
114
- }
115
- });
116
- }
117
- };
118
-
119
72
  function pushFrame(frame: (timestamp: Timestamp) => void): void {
120
73
  (NativeReanimatedModule as JSReanimated).pushFrame(frame);
121
74
  }
@@ -1,4 +1,4 @@
1
- import { AnimatedStyle, StyleProps, WorkletFunction } from './commonTypes';
1
+ import { AnimatedStyle, StyleProps } from './commonTypes';
2
2
  import { ReanimatedConsole } from './core';
3
3
  import { MeasuredDimensions } from './NativeMethods';
4
4
  import { NativeReanimated } from './NativeReanimated/NativeReanimated';
@@ -32,7 +32,6 @@ declare global {
32
32
  };
33
33
  namespace NodeJS {
34
34
  interface Global {
35
- __reanimatedWorkletInit: (worklet: WorkletFunction) => void;
36
35
  _setGlobalConsole: (console?: ReanimatedConsole) => void;
37
36
  _log: (s: string) => void;
38
37
  _setGestureState: () => void;