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.
- package/Common/cpp/SharedItems/ShareableValue.cpp +2 -2
- package/Common/cpp/Tools/RuntimeDecorator.cpp +0 -14
- package/android/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.2/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/7.2/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/7.2/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/7.2/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.2/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/android/react-native-reanimated-64-hermes.aar +0 -0
- package/android/react-native-reanimated-64-jsc.aar +0 -0
- package/android/react-native-reanimated-65-hermes.aar +0 -0
- package/android/react-native-reanimated-65-jsc.aar +0 -0
- package/android/react-native-reanimated-66-hermes.aar +0 -0
- package/android/react-native-reanimated-66-jsc.aar +0 -0
- package/android/react-native-reanimated-67-hermes.aar +0 -0
- package/android/react-native-reanimated-67-jsc.aar +0 -0
- package/android/react-native-reanimated-68-hermes.aar +0 -0
- package/android/react-native-reanimated-68-jsc.aar +0 -0
- package/android/src/main/java/com/swmansion/reanimated/NativeProxy.java +11 -8
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +13 -6
- package/ios/LayoutReanimation/REAAnimationsManager.h +1 -1
- package/ios/LayoutReanimation/REAAnimationsManager.m +2 -2
- package/ios/LayoutReanimation/REASnapshot.m +1 -1
- package/ios/LayoutReanimation/REAUIManager.h +1 -1
- package/ios/LayoutReanimation/REAUIManager.mm +4 -5
- package/ios/Nodes/REAAlwaysNode.h +1 -1
- package/ios/Nodes/REAAlwaysNode.m +5 -5
- package/ios/Nodes/REABezierNode.h +1 -1
- package/ios/Nodes/REABezierNode.m +4 -5
- package/ios/Nodes/REABlockNode.h +1 -1
- package/ios/Nodes/REABlockNode.m +2 -2
- package/ios/Nodes/REACallFuncNode.h +1 -1
- package/ios/Nodes/REACallFuncNode.m +5 -5
- package/ios/Nodes/REAClockNodes.h +1 -1
- package/ios/Nodes/REAClockNodes.m +4 -4
- package/ios/Nodes/REAConcatNode.h +1 -1
- package/ios/Nodes/REAConcatNode.m +3 -3
- package/ios/Nodes/REACondNode.h +1 -1
- package/ios/Nodes/REACondNode.m +3 -3
- package/ios/Nodes/READebugNode.h +1 -1
- package/ios/Nodes/READebugNode.m +3 -3
- package/ios/Nodes/REAEventNode.h +1 -2
- package/ios/Nodes/REAEventNode.m +3 -3
- package/ios/Nodes/REAFunctionNode.h +1 -1
- package/ios/Nodes/REAFunctionNode.m +3 -3
- package/ios/Nodes/REAJSCallNode.h +1 -1
- package/ios/Nodes/REAJSCallNode.m +3 -3
- package/ios/Nodes/REANode.m +2 -2
- package/ios/Nodes/REAOperatorNode.h +1 -1
- package/ios/Nodes/REAOperatorNode.m +2 -3
- package/ios/Nodes/REAParamNode.h +1 -1
- package/ios/Nodes/REAParamNode.m +4 -4
- package/ios/Nodes/REAPropsNode.h +1 -1
- package/ios/Nodes/REAPropsNode.m +4 -6
- package/ios/Nodes/REASetNode.h +1 -1
- package/ios/Nodes/REASetNode.m +4 -4
- package/ios/Nodes/REAStyleNode.h +1 -1
- package/ios/Nodes/REAStyleNode.m +2 -3
- package/ios/Nodes/REATransformNode.h +1 -1
- package/ios/Nodes/REATransformNode.m +2 -2
- package/ios/Nodes/REAValueNode.h +1 -3
- package/ios/Nodes/REAValueNode.m +1 -1
- package/ios/REAEventDispatcher.m +1 -1
- package/ios/REAModule.h +1 -1
- package/ios/REAModule.m +4 -5
- package/ios/REANodesManager.h +1 -2
- package/ios/REANodesManager.m +21 -23
- package/ios/Transitioning/RCTConvert+REATransition.h +1 -2
- package/ios/Transitioning/RCTConvert+REATransition.m +1 -1
- package/ios/Transitioning/REAAllTransitions.h +1 -1
- package/ios/Transitioning/REAAllTransitions.m +2 -3
- package/ios/Transitioning/REATransition.h +2 -3
- package/ios/Transitioning/REATransition.m +3 -4
- package/ios/Transitioning/REATransitionAnimation.m +1 -2
- package/ios/Transitioning/REATransitionManager.m +2 -4
- package/ios/Transitioning/REATransitionValues.m +2 -3
- package/ios/native/NativeMethods.h +1 -3
- package/ios/native/NativeMethods.mm +1 -1
- package/ios/native/NativeProxy.h +2 -2
- package/ios/native/NativeProxy.mm +14 -15
- package/ios/native/REAIOSErrorHandler.h +2 -4
- package/ios/native/REAIOSErrorHandler.mm +1 -1
- package/ios/native/REAIOSLogger.h +1 -3
- package/ios/native/REAIOSLogger.mm +1 -1
- package/ios/native/REAIOSScheduler.h +1 -3
- package/ios/native/REAIOSScheduler.mm +2 -2
- package/ios/native/REAInitializer.h +0 -7
- package/ios/native/REAInitializer.mm +2 -2
- package/ios/native/UIResponder+Reanimated.mm +3 -3
- package/ios/sensor/ReanimatedSensor.h +1 -1
- package/ios/sensor/ReanimatedSensor.m +1 -1
- package/ios/sensor/ReanimatedSensorContainer.h +1 -1
- package/ios/sensor/ReanimatedSensorContainer.m +2 -2
- package/lib/ConfigHelper.js +0 -1
- package/lib/reanimated2/Easing.js +9 -3
- package/lib/reanimated2/core.js +0 -36
- package/lib/reanimated2/globals.d.ts +1 -2
- package/lib/types/lib/reanimated2/commonTypes.d.ts +0 -1
- package/package.json +4 -6
- package/plugin.js +0 -12
- package/src/ConfigHelper.ts +0 -1
- package/src/reanimated2/Easing.ts +9 -3
- package/src/reanimated2/commonTypes.ts +0 -1
- package/src/reanimated2/core.ts +0 -47
- package/src/reanimated2/globals.d.ts +1 -2
package/ios/REANodesManager.m
CHANGED
|
@@ -1,29 +1,27 @@
|
|
|
1
|
-
#import
|
|
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,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,10 +1,8 @@
|
|
|
1
|
-
#import
|
|
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
|
|
package/ios/native/NativeProxy.h
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
#
|
|
2
|
-
#import <
|
|
3
|
-
#
|
|
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
|
-
#
|
|
10
|
-
#import
|
|
11
|
-
#
|
|
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,6 +1,6 @@
|
|
|
1
|
-
#import
|
|
2
|
-
#import
|
|
3
|
-
#import
|
|
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>
|
package/lib/ConfigHelper.js
CHANGED
|
@@ -53,7 +53,10 @@ function cubic(t) {
|
|
|
53
53
|
*/
|
|
54
54
|
function poly(n) {
|
|
55
55
|
'worklet';
|
|
56
|
-
return (t) =>
|
|
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) =>
|
|
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.
|
|
233
|
+
if (!_WORKLET && res && typeof res === 'function' && res.__workletHash) {
|
|
228
234
|
return createChecker(res, workletName, arguments);
|
|
229
235
|
}
|
|
230
236
|
return res;
|
package/lib/reanimated2/core.js
CHANGED
|
@@ -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
|
|
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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-reanimated",
|
|
3
|
-
"version": "2.
|
|
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/
|
|
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));
|
package/src/ConfigHelper.ts
CHANGED
|
@@ -109,7 +109,10 @@ function cubic(t: number): number {
|
|
|
109
109
|
*/
|
|
110
110
|
function poly(n: number): EasingFn {
|
|
111
111
|
'worklet';
|
|
112
|
-
return (t) =>
|
|
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) =>
|
|
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.
|
|
321
|
+
if (!_WORKLET && res && typeof res === 'function' && res.__workletHash) {
|
|
316
322
|
return createChecker(res, workletName, arguments);
|
|
317
323
|
}
|
|
318
324
|
return res;
|
package/src/reanimated2/core.ts
CHANGED
|
@@ -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
|
|
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;
|