react-native-reanimated 2.4.1 → 2.5.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/AnimatedSensor/AnimatedSensorModule.cpp +72 -0
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +30 -1
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +64 -39
- package/Common/cpp/Tools/RuntimeDecorator.cpp +2 -0
- package/Common/cpp/headers/AnimatedSensor/AnimatedSensorModule.h +41 -0
- package/Common/cpp/headers/NativeModules/NativeReanimatedModule.h +14 -0
- package/Common/cpp/headers/NativeModules/NativeReanimatedModuleSpec.h +14 -0
- package/Common/cpp/headers/SharedItems/MutableValue.h +4 -1
- package/Common/cpp/headers/SharedItems/ShareableValue.h +3 -0
- package/Common/cpp/headers/SharedItems/ValueWrapper.h +3 -0
- package/Common/cpp/headers/Tools/PlatformDepMethodsHolder.h +11 -0
- package/Common/cpp/headers/Tools/RuntimeDecorator.h +2 -0
- package/README.md +2 -2
- package/android/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.2/dependencies-accessors/gc.properties +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/fileChanges/last-build.bin +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/7.2/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- 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/.gradle/vcs-1/gc.properties +0 -0
- package/android/CMakeLists.txt +198 -0
- package/android/README.md +15 -0
- package/android/build.gradle +686 -73
- package/android/empty.cpp +1 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/android/gradle.properties +25 -0
- package/android/gradlew +234 -0
- package/android/gradlew.bat +89 -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/rnVersionPatch/62/layoutReanimation/ReanimatedNativeHierarchyManager.java +412 -0
- package/android/rnVersionPatch/62/layoutReanimation/ReanimatedUIImplementation.java +68 -0
- package/android/rnVersionPatch/63/layoutReanimation/ReanimatedUIImplementation.java +68 -0
- package/android/rnVersionPatch/64/layoutReanimation/ReanimatedUIImplementation.java +68 -0
- package/android/rnVersionPatch/65/.gitkeep +0 -0
- package/android/rnVersionPatch/66/.gitkeep +0 -0
- package/android/rnVersionPatch/67/.gitkeep +0 -0
- package/android/rnVersionPatch/68/.gitkeep +0 -0
- package/android/rnVersionPatch/backup/.gitkeep +0 -0
- package/android/settings.gradle +1 -0
- package/android/spotless.gradle +9 -0
- package/android/src/{AndroidManifest.xml → main/AndroidManifest.xml} +0 -0
- package/android/src/main/cpp/AndroidErrorHandler.cpp +42 -0
- package/android/src/main/cpp/AndroidLogger.cpp +27 -0
- package/android/src/main/cpp/AndroidScheduler.cpp +59 -0
- package/android/src/main/cpp/JNIHelper.cpp +59 -0
- package/android/src/main/cpp/LayoutAnimations.cpp +103 -0
- package/android/src/main/cpp/NativeProxy.cpp +327 -0
- package/android/src/main/cpp/OnLoad.cpp +17 -0
- package/android/src/main/cpp/TurboModule.cpp +44 -0
- package/android/src/main/cpp/headers/AndroidErrorHandler.h +30 -0
- package/android/src/main/cpp/headers/AndroidLogger.h +16 -0
- package/android/src/main/cpp/headers/AndroidScheduler.h +41 -0
- package/android/src/main/cpp/headers/JNIHelper.h +30 -0
- package/android/src/main/cpp/headers/LayoutAnimations.h +42 -0
- package/android/src/main/cpp/headers/NativeProxy.h +170 -0
- package/android/src/main/cpp/headers/TurboModule.h +70 -0
- package/android/src/main/java/com/facebook/react/uimanager/UIManagerReanimatedHelper.java +15 -0
- package/android/src/main/java/com/swmansion/common/GestureHandlerStateManager.java +5 -0
- package/android/src/main/java/com/swmansion/reanimated/AndroidErrorHandler.java +8 -0
- package/android/src/main/java/com/swmansion/reanimated/CopiedEvent.java +43 -0
- package/android/src/main/java/com/swmansion/reanimated/MapUtils.java +26 -0
- package/android/src/main/java/com/swmansion/reanimated/NativeMethodsHelper.java +117 -0
- package/android/src/main/java/com/swmansion/reanimated/NativeProxy.java +285 -0
- package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +682 -0
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedJSIModulePackage.java +29 -0
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedModule.java +251 -0
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedPackage.java +96 -0
- package/android/src/main/java/com/swmansion/reanimated/Scheduler.java +51 -0
- package/android/src/main/java/com/swmansion/reanimated/UpdateContext.java +11 -0
- package/android/src/main/java/com/swmansion/reanimated/Utils.java +32 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +517 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/LayoutAnimations.java +56 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/NativeMethodsHolder.java +11 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +410 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedUIImplementation.java +68 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +292 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/Snapshot.java +121 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ViewHierarchyObserver.java +12 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/AlwaysNode.java +29 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/BezierNode.java +87 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/BlockNode.java +24 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/CallFuncNode.java +49 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/ClockNode.java +38 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/ClockOpNode.java +73 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/ConcatNode.java +36 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/CondNode.java +41 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/DebugNode.java +33 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/EventNode.java +83 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/FinalNode.java +5 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/FunctionNode.java +20 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/JSCallNode.java +41 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/Node.java +139 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/NoopNode.java +37 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/OperatorNode.java +377 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/ParamNode.java +71 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/PropsNode.java +153 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/SetNode.java +32 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/StyleNode.java +40 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/TransformNode.java +84 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/ValueNode.java +40 -0
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensor.java +41 -0
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorContainer.java +40 -0
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorListener.java +31 -0
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorType.java +35 -0
- package/android/src/main/java/com/swmansion/reanimated/transitions/ChangeTransition.java +84 -0
- package/android/src/main/java/com/swmansion/reanimated/transitions/SaneSidePropagation.java +25 -0
- package/android/src/main/java/com/swmansion/reanimated/transitions/Scale.java +86 -0
- package/android/src/main/java/com/swmansion/reanimated/transitions/TransitionModule.java +41 -0
- package/android/src/main/java/com/swmansion/reanimated/transitions/TransitionUtils.java +161 -0
- package/ios/LayoutReanimation/REAAnimationsManager.m +14 -4
- package/ios/REAModule.m +8 -9
- package/ios/REANodesManager.h +4 -1
- package/ios/REANodesManager.m +75 -3
- package/ios/native/NativeProxy.mm +76 -4
- package/ios/sensor/ReanimatedSensor.h +21 -0
- package/ios/sensor/ReanimatedSensor.m +169 -0
- package/ios/sensor/ReanimatedSensorContainer.h +13 -0
- package/ios/sensor/ReanimatedSensorContainer.m +41 -0
- package/ios/sensor/ReanimatedSensorType.h +7 -0
- package/lib/ConfigHelper.js +2 -2
- package/lib/createAnimatedComponent.js +3 -4
- package/lib/reanimated1/core/AnimatedFunction.js +1 -1
- package/lib/reanimated1/derived/interpolate.js +2 -4
- package/lib/reanimated2/Colors.js +2 -1
- package/lib/reanimated2/NativeReanimated/NativeReanimated.js +25 -12
- package/lib/reanimated2/NativeReanimated/index.js +0 -4
- package/lib/reanimated2/ViewDescriptorsSet.js +2 -2
- package/lib/reanimated2/animation/styleAnimation.js +2 -1
- package/lib/reanimated2/core.js +30 -24
- package/lib/reanimated2/globals.d.ts +6 -0
- package/lib/reanimated2/hook/index.js +1 -0
- package/lib/reanimated2/hook/useAnimatedSensor.js +66 -0
- package/lib/reanimated2/interpolation.js +1 -1
- package/lib/reanimated2/jestUtils.js +9 -4
- package/lib/reanimated2/js-reanimated/JSReanimated.js +23 -2
- package/lib/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +8 -0
- package/lib/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +2 -1
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +32 -42
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Fade.js +20 -38
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Flip.js +32 -44
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +8 -16
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +6 -10
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Roll.js +8 -12
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +20 -36
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Slide.js +16 -20
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +8 -12
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +32 -48
- package/lib/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +22 -18
- package/lib/reanimated2/mock.js +3 -2
- package/mock.js +4 -4
- package/package.json +42 -36
- package/plugin.js +2 -0
- package/react-native-reanimated.d.ts +41 -12
- package/src/ConfigHelper.ts +4 -4
- package/src/createAnimatedComponent.tsx +3 -3
- package/src/reanimated1/core/AnimatedFunction.js +1 -1
- package/src/reanimated1/derived/interpolate.js +2 -4
- package/src/reanimated2/Colors.ts +2 -1
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +42 -15
- package/src/reanimated2/NativeReanimated/index.ts +0 -6
- package/src/reanimated2/ViewDescriptorsSet.ts +2 -3
- package/src/reanimated2/animation/index.ts +1 -0
- package/src/reanimated2/animation/styleAnimation.ts +10 -7
- package/src/reanimated2/animation/timing.ts +3 -1
- package/src/reanimated2/animation/util.ts +10 -11
- package/src/reanimated2/commonTypes.ts +20 -0
- package/src/reanimated2/component/FlatList.tsx +2 -1
- package/src/reanimated2/core.ts +34 -26
- package/src/reanimated2/globals.d.ts +6 -0
- package/src/reanimated2/hook/index.ts +1 -0
- package/src/reanimated2/hook/useAnimatedSensor.ts +91 -0
- package/src/reanimated2/hook/utils.ts +2 -1
- package/src/reanimated2/interpolation.ts +2 -6
- package/src/reanimated2/jestUtils.ts +9 -4
- package/src/reanimated2/js-reanimated/JSReanimated.ts +25 -2
- package/src/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.ts +13 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/Keyframe.ts +2 -3
- package/src/reanimated2/layoutReanimation/defaultAnimations/Bounce.ts +51 -21
- package/src/reanimated2/layoutReanimation/defaultAnimations/Fade.ts +40 -10
- package/src/reanimated2/layoutReanimation/defaultAnimations/Flip.ts +48 -12
- package/src/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.ts +16 -4
- package/src/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.ts +8 -2
- package/src/reanimated2/layoutReanimation/defaultAnimations/Roll.ts +16 -4
- package/src/reanimated2/layoutReanimation/defaultAnimations/Rotate.ts +32 -8
- package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +32 -10
- package/src/reanimated2/layoutReanimation/defaultAnimations/Stretch.ts +16 -4
- package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +64 -16
- package/src/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.ts +2 -1
- package/src/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.ts +26 -19
- package/src/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.ts +2 -1
- package/src/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.ts +2 -1
- package/src/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.ts +2 -1
- package/src/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.ts +2 -1
- package/src/reanimated2/mock.ts +3 -2
- package/android/react-native-reanimated-63-hermes.aar +0 -0
- package/android/react-native-reanimated-63-jsc.aar +0 -0
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedProxyPackage.java +0 -15
- package/libSo/fbjni/jni/arm64-v8a/libfbjni.so +0 -0
- package/libSo/fbjni/jni/armeabi-v7a/libfbjni.so +0 -0
- package/libSo/fbjni/jni/x86/libfbjni.so +0 -0
- package/libSo/fbjni/jni/x86_64/libfbjni.so +0 -0
|
@@ -9,15 +9,14 @@ export class ZoomIn extends ComplexAnimationBuilder {
|
|
|
9
9
|
const [animation, config] = this.getAnimationAndConfig();
|
|
10
10
|
const delay = this.getDelay();
|
|
11
11
|
const callback = this.callbackV;
|
|
12
|
+
const initialValues = this.initialValues;
|
|
12
13
|
return () => {
|
|
13
14
|
'worklet';
|
|
14
15
|
return {
|
|
15
16
|
animations: {
|
|
16
17
|
transform: [{ scale: delayFunction(delay, animation(1, config)) }],
|
|
17
18
|
},
|
|
18
|
-
initialValues: {
|
|
19
|
-
transform: [{ scale: 0 }],
|
|
20
|
-
},
|
|
19
|
+
initialValues: Object.assign({ transform: [{ scale: 0 }] }, initialValues),
|
|
21
20
|
callback: callback,
|
|
22
21
|
};
|
|
23
22
|
};
|
|
@@ -36,6 +35,7 @@ export class ZoomInRotate extends ComplexAnimationBuilder {
|
|
|
36
35
|
const delay = this.getDelay();
|
|
37
36
|
const rotate = this.rotateV ? this.rotateV : '0.3';
|
|
38
37
|
const callback = this.callbackV;
|
|
38
|
+
const initialValues = this.initialValues;
|
|
39
39
|
return () => {
|
|
40
40
|
'worklet';
|
|
41
41
|
return {
|
|
@@ -45,9 +45,7 @@ export class ZoomInRotate extends ComplexAnimationBuilder {
|
|
|
45
45
|
{ rotate: delayFunction(delay, animation(0, config)) },
|
|
46
46
|
],
|
|
47
47
|
},
|
|
48
|
-
initialValues: {
|
|
49
|
-
transform: [{ scale: 0 }, { rotate: rotate }],
|
|
50
|
-
},
|
|
48
|
+
initialValues: Object.assign({ transform: [{ scale: 0 }, { rotate: rotate }] }, initialValues),
|
|
51
49
|
callback: callback,
|
|
52
50
|
};
|
|
53
51
|
};
|
|
@@ -65,6 +63,7 @@ export class ZoomInLeft extends ComplexAnimationBuilder {
|
|
|
65
63
|
const [animation, config] = this.getAnimationAndConfig();
|
|
66
64
|
const delay = this.getDelay();
|
|
67
65
|
const callback = this.callbackV;
|
|
66
|
+
const initialValues = this.initialValues;
|
|
68
67
|
return () => {
|
|
69
68
|
'worklet';
|
|
70
69
|
return {
|
|
@@ -74,9 +73,7 @@ export class ZoomInLeft extends ComplexAnimationBuilder {
|
|
|
74
73
|
{ scale: delayFunction(delay, animation(1, config)) },
|
|
75
74
|
],
|
|
76
75
|
},
|
|
77
|
-
initialValues: {
|
|
78
|
-
transform: [{ translateX: -width }, { scale: 0 }],
|
|
79
|
-
},
|
|
76
|
+
initialValues: Object.assign({ transform: [{ translateX: -width }, { scale: 0 }] }, initialValues),
|
|
80
77
|
callback: callback,
|
|
81
78
|
};
|
|
82
79
|
};
|
|
@@ -94,6 +91,7 @@ export class ZoomInRight extends ComplexAnimationBuilder {
|
|
|
94
91
|
const [animation, config] = this.getAnimationAndConfig();
|
|
95
92
|
const delay = this.getDelay();
|
|
96
93
|
const callback = this.callbackV;
|
|
94
|
+
const initialValues = this.initialValues;
|
|
97
95
|
return () => {
|
|
98
96
|
'worklet';
|
|
99
97
|
return {
|
|
@@ -103,9 +101,7 @@ export class ZoomInRight extends ComplexAnimationBuilder {
|
|
|
103
101
|
{ scale: delayFunction(delay, animation(1, config)) },
|
|
104
102
|
],
|
|
105
103
|
},
|
|
106
|
-
initialValues: {
|
|
107
|
-
transform: [{ translateX: width }, { scale: 0 }],
|
|
108
|
-
},
|
|
104
|
+
initialValues: Object.assign({ transform: [{ translateX: width }, { scale: 0 }] }, initialValues),
|
|
109
105
|
callback: callback,
|
|
110
106
|
};
|
|
111
107
|
};
|
|
@@ -123,6 +119,7 @@ export class ZoomInUp extends ComplexAnimationBuilder {
|
|
|
123
119
|
const [animation, config] = this.getAnimationAndConfig();
|
|
124
120
|
const delay = this.getDelay();
|
|
125
121
|
const callback = this.callbackV;
|
|
122
|
+
const initialValues = this.initialValues;
|
|
126
123
|
return () => {
|
|
127
124
|
'worklet';
|
|
128
125
|
return {
|
|
@@ -132,9 +129,7 @@ export class ZoomInUp extends ComplexAnimationBuilder {
|
|
|
132
129
|
{ scale: delayFunction(delay, animation(1, config)) },
|
|
133
130
|
],
|
|
134
131
|
},
|
|
135
|
-
initialValues: {
|
|
136
|
-
transform: [{ translateY: -height }, { scale: 0 }],
|
|
137
|
-
},
|
|
132
|
+
initialValues: Object.assign({ transform: [{ translateY: -height }, { scale: 0 }] }, initialValues),
|
|
138
133
|
callback: callback,
|
|
139
134
|
};
|
|
140
135
|
};
|
|
@@ -152,6 +147,7 @@ export class ZoomInDown extends ComplexAnimationBuilder {
|
|
|
152
147
|
const [animation, config] = this.getAnimationAndConfig();
|
|
153
148
|
const delay = this.getDelay();
|
|
154
149
|
const callback = this.callbackV;
|
|
150
|
+
const initialValues = this.initialValues;
|
|
155
151
|
return () => {
|
|
156
152
|
'worklet';
|
|
157
153
|
return {
|
|
@@ -161,9 +157,7 @@ export class ZoomInDown extends ComplexAnimationBuilder {
|
|
|
161
157
|
{ scale: delayFunction(delay, animation(1, config)) },
|
|
162
158
|
],
|
|
163
159
|
},
|
|
164
|
-
initialValues: {
|
|
165
|
-
transform: [{ translateY: height }, { scale: 0 }],
|
|
166
|
-
},
|
|
160
|
+
initialValues: Object.assign({ transform: [{ translateY: height }, { scale: 0 }] }, initialValues),
|
|
167
161
|
callback: callback,
|
|
168
162
|
};
|
|
169
163
|
};
|
|
@@ -181,6 +175,7 @@ export class ZoomInEasyUp extends ComplexAnimationBuilder {
|
|
|
181
175
|
const [animation, config] = this.getAnimationAndConfig();
|
|
182
176
|
const delay = this.getDelay();
|
|
183
177
|
const callback = this.callbackV;
|
|
178
|
+
const initialValues = this.initialValues;
|
|
184
179
|
return (values) => {
|
|
185
180
|
'worklet';
|
|
186
181
|
return {
|
|
@@ -190,9 +185,7 @@ export class ZoomInEasyUp extends ComplexAnimationBuilder {
|
|
|
190
185
|
{ scale: delayFunction(delay, animation(1, config)) },
|
|
191
186
|
],
|
|
192
187
|
},
|
|
193
|
-
initialValues: {
|
|
194
|
-
transform: [{ translateY: -values.targetHeight }, { scale: 0 }],
|
|
195
|
-
},
|
|
188
|
+
initialValues: Object.assign({ transform: [{ translateY: -values.targetHeight }, { scale: 0 }] }, initialValues),
|
|
196
189
|
callback: callback,
|
|
197
190
|
};
|
|
198
191
|
};
|
|
@@ -210,6 +203,7 @@ export class ZoomInEasyDown extends ComplexAnimationBuilder {
|
|
|
210
203
|
const [animation, config] = this.getAnimationAndConfig();
|
|
211
204
|
const delay = this.getDelay();
|
|
212
205
|
const callback = this.callbackV;
|
|
206
|
+
const initialValues = this.initialValues;
|
|
213
207
|
return (values) => {
|
|
214
208
|
'worklet';
|
|
215
209
|
return {
|
|
@@ -219,9 +213,7 @@ export class ZoomInEasyDown extends ComplexAnimationBuilder {
|
|
|
219
213
|
{ scale: delayFunction(delay, animation(1, config)) },
|
|
220
214
|
],
|
|
221
215
|
},
|
|
222
|
-
initialValues: {
|
|
223
|
-
transform: [{ translateY: values.targetHeight }, { scale: 0 }],
|
|
224
|
-
},
|
|
216
|
+
initialValues: Object.assign({ transform: [{ translateY: values.targetHeight }, { scale: 0 }] }, initialValues),
|
|
225
217
|
callback: callback,
|
|
226
218
|
};
|
|
227
219
|
};
|
|
@@ -239,15 +231,14 @@ export class ZoomOut extends ComplexAnimationBuilder {
|
|
|
239
231
|
const [animation, config] = this.getAnimationAndConfig();
|
|
240
232
|
const delay = this.getDelay();
|
|
241
233
|
const callback = this.callbackV;
|
|
234
|
+
const initialValues = this.initialValues;
|
|
242
235
|
return () => {
|
|
243
236
|
'worklet';
|
|
244
237
|
return {
|
|
245
238
|
animations: {
|
|
246
239
|
transform: [{ scale: delayFunction(delay, animation(0, config)) }],
|
|
247
240
|
},
|
|
248
|
-
initialValues: {
|
|
249
|
-
transform: [{ scale: 1 }],
|
|
250
|
-
},
|
|
241
|
+
initialValues: Object.assign({ transform: [{ scale: 1 }] }, initialValues),
|
|
251
242
|
callback: callback,
|
|
252
243
|
};
|
|
253
244
|
};
|
|
@@ -266,6 +257,7 @@ export class ZoomOutRotate extends ComplexAnimationBuilder {
|
|
|
266
257
|
const delay = this.getDelay();
|
|
267
258
|
const rotate = this.rotateV ? this.rotateV : '0.3';
|
|
268
259
|
const callback = this.callbackV;
|
|
260
|
+
const initialValues = this.initialValues;
|
|
269
261
|
return () => {
|
|
270
262
|
'worklet';
|
|
271
263
|
return {
|
|
@@ -275,9 +267,7 @@ export class ZoomOutRotate extends ComplexAnimationBuilder {
|
|
|
275
267
|
{ rotate: delayFunction(delay, animation(rotate, config)) },
|
|
276
268
|
],
|
|
277
269
|
},
|
|
278
|
-
initialValues: {
|
|
279
|
-
transform: [{ scale: 1 }, { rotate: '0' }],
|
|
280
|
-
},
|
|
270
|
+
initialValues: Object.assign({ transform: [{ scale: 1 }, { rotate: '0' }] }, initialValues),
|
|
281
271
|
callback: callback,
|
|
282
272
|
};
|
|
283
273
|
};
|
|
@@ -295,6 +285,7 @@ export class ZoomOutLeft extends ComplexAnimationBuilder {
|
|
|
295
285
|
const [animation, config] = this.getAnimationAndConfig();
|
|
296
286
|
const delay = this.getDelay();
|
|
297
287
|
const callback = this.callbackV;
|
|
288
|
+
const initialValues = this.initialValues;
|
|
298
289
|
return () => {
|
|
299
290
|
'worklet';
|
|
300
291
|
return {
|
|
@@ -304,9 +295,7 @@ export class ZoomOutLeft extends ComplexAnimationBuilder {
|
|
|
304
295
|
{ scale: delayFunction(delay, animation(0, config)) },
|
|
305
296
|
],
|
|
306
297
|
},
|
|
307
|
-
initialValues: {
|
|
308
|
-
transform: [{ translateX: 0 }, { scale: 1 }],
|
|
309
|
-
},
|
|
298
|
+
initialValues: Object.assign({ transform: [{ translateX: 0 }, { scale: 1 }] }, initialValues),
|
|
310
299
|
callback: callback,
|
|
311
300
|
};
|
|
312
301
|
};
|
|
@@ -324,6 +313,7 @@ export class ZoomOutRight extends ComplexAnimationBuilder {
|
|
|
324
313
|
const [animation, config] = this.getAnimationAndConfig();
|
|
325
314
|
const delay = this.getDelay();
|
|
326
315
|
const callback = this.callbackV;
|
|
316
|
+
const initialValues = this.initialValues;
|
|
327
317
|
return () => {
|
|
328
318
|
'worklet';
|
|
329
319
|
return {
|
|
@@ -333,9 +323,7 @@ export class ZoomOutRight extends ComplexAnimationBuilder {
|
|
|
333
323
|
{ scale: delayFunction(delay, animation(0, config)) },
|
|
334
324
|
],
|
|
335
325
|
},
|
|
336
|
-
initialValues: {
|
|
337
|
-
transform: [{ translateX: 0 }, { scale: 1 }],
|
|
338
|
-
},
|
|
326
|
+
initialValues: Object.assign({ transform: [{ translateX: 0 }, { scale: 1 }] }, initialValues),
|
|
339
327
|
callback: callback,
|
|
340
328
|
};
|
|
341
329
|
};
|
|
@@ -353,6 +341,7 @@ export class ZoomOutUp extends ComplexAnimationBuilder {
|
|
|
353
341
|
const [animation, config] = this.getAnimationAndConfig();
|
|
354
342
|
const delay = this.getDelay();
|
|
355
343
|
const callback = this.callbackV;
|
|
344
|
+
const initialValues = this.initialValues;
|
|
356
345
|
return () => {
|
|
357
346
|
'worklet';
|
|
358
347
|
return {
|
|
@@ -362,9 +351,7 @@ export class ZoomOutUp extends ComplexAnimationBuilder {
|
|
|
362
351
|
{ scale: delayFunction(delay, animation(0, config)) },
|
|
363
352
|
],
|
|
364
353
|
},
|
|
365
|
-
initialValues: {
|
|
366
|
-
transform: [{ translateY: 0 }, { scale: 1 }],
|
|
367
|
-
},
|
|
354
|
+
initialValues: Object.assign({ transform: [{ translateY: 0 }, { scale: 1 }] }, initialValues),
|
|
368
355
|
callback: callback,
|
|
369
356
|
};
|
|
370
357
|
};
|
|
@@ -382,6 +369,7 @@ export class ZoomOutDown extends ComplexAnimationBuilder {
|
|
|
382
369
|
const [animation, config] = this.getAnimationAndConfig();
|
|
383
370
|
const delay = this.getDelay();
|
|
384
371
|
const callback = this.callbackV;
|
|
372
|
+
const initialValues = this.initialValues;
|
|
385
373
|
return () => {
|
|
386
374
|
'worklet';
|
|
387
375
|
return {
|
|
@@ -391,9 +379,7 @@ export class ZoomOutDown extends ComplexAnimationBuilder {
|
|
|
391
379
|
{ scale: delayFunction(delay, animation(0, config)) },
|
|
392
380
|
],
|
|
393
381
|
},
|
|
394
|
-
initialValues: {
|
|
395
|
-
transform: [{ translateY: 0 }, { scale: 1 }],
|
|
396
|
-
},
|
|
382
|
+
initialValues: Object.assign({ transform: [{ translateY: 0 }, { scale: 1 }] }, initialValues),
|
|
397
383
|
callback: callback,
|
|
398
384
|
};
|
|
399
385
|
};
|
|
@@ -411,6 +397,7 @@ export class ZoomOutEasyUp extends ComplexAnimationBuilder {
|
|
|
411
397
|
const [animation, config] = this.getAnimationAndConfig();
|
|
412
398
|
const delay = this.getDelay();
|
|
413
399
|
const callback = this.callbackV;
|
|
400
|
+
const initialValues = this.initialValues;
|
|
414
401
|
return (values) => {
|
|
415
402
|
'worklet';
|
|
416
403
|
return {
|
|
@@ -422,9 +409,7 @@ export class ZoomOutEasyUp extends ComplexAnimationBuilder {
|
|
|
422
409
|
{ scale: delayFunction(delay, animation(0, config)) },
|
|
423
410
|
],
|
|
424
411
|
},
|
|
425
|
-
initialValues: {
|
|
426
|
-
transform: [{ translateY: 0 }, { scale: 1 }],
|
|
427
|
-
},
|
|
412
|
+
initialValues: Object.assign({ transform: [{ translateY: 0 }, { scale: 1 }] }, initialValues),
|
|
428
413
|
callback: callback,
|
|
429
414
|
};
|
|
430
415
|
};
|
|
@@ -442,6 +427,7 @@ export class ZoomOutEasyDown extends ComplexAnimationBuilder {
|
|
|
442
427
|
const [animation, config] = this.getAnimationAndConfig();
|
|
443
428
|
const delay = this.getDelay();
|
|
444
429
|
const callback = this.callbackV;
|
|
430
|
+
const initialValues = this.initialValues;
|
|
445
431
|
return (values) => {
|
|
446
432
|
'worklet';
|
|
447
433
|
return {
|
|
@@ -453,9 +439,7 @@ export class ZoomOutEasyDown extends ComplexAnimationBuilder {
|
|
|
453
439
|
{ scale: delayFunction(delay, animation(0, config)) },
|
|
454
440
|
],
|
|
455
441
|
},
|
|
456
|
-
initialValues: {
|
|
457
|
-
transform: [{ translateY: 0 }, { scale: 1 }],
|
|
458
|
-
},
|
|
442
|
+
initialValues: Object.assign({ transform: [{ translateY: 0 }, { scale: 1 }] }, initialValues),
|
|
459
443
|
callback: callback,
|
|
460
444
|
};
|
|
461
445
|
};
|
|
@@ -74,24 +74,28 @@ export class EntryExitTransition extends BaseAnimationBuilder {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
const mergedTransform = ((_c = exitingValues.initialValues.transform) !== null && _c !== void 0 ? _c : []).concat(((_d = enteringValues.animations.transform) !== null && _d !== void 0 ? _d : []).map((value) => {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
else
|
|
90
|
-
return {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
77
|
+
const objectKeys = Object.keys(value);
|
|
78
|
+
if ((objectKeys === null || objectKeys === void 0 ? void 0 : objectKeys.length) < 1) {
|
|
79
|
+
console.error(`[Reanimated]: \${value} is not a valid Transform object`);
|
|
80
|
+
return value;
|
|
81
|
+
}
|
|
82
|
+
const transformProp = objectKeys[0];
|
|
83
|
+
const current = value[transformProp].current;
|
|
84
|
+
if (typeof current === 'string') {
|
|
85
|
+
if (current.includes('deg'))
|
|
86
|
+
return {
|
|
87
|
+
[transformProp]: '0deg',
|
|
88
|
+
};
|
|
89
|
+
else
|
|
90
|
+
return {
|
|
91
|
+
[transformProp]: '0',
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
else if (transformProp.includes('translate')) {
|
|
95
|
+
return { [transformProp]: 0 };
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
return { [transformProp]: 1 };
|
|
95
99
|
}
|
|
96
100
|
return value;
|
|
97
101
|
}));
|
package/lib/reanimated2/mock.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/* eslint-disable
|
|
2
|
+
/* eslint-disable node/no-callback-literal */
|
|
3
3
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
4
4
|
// @ts-nocheck
|
|
5
5
|
const NOOP = () => {
|
|
@@ -58,7 +58,8 @@ const ReanimatedV2 = {
|
|
|
58
58
|
elastic: ID,
|
|
59
59
|
back: ID,
|
|
60
60
|
bounce: ID,
|
|
61
|
-
bezier: ID,
|
|
61
|
+
bezier: () => ({ factory: ID }),
|
|
62
|
+
bezierFn: ID,
|
|
62
63
|
in: ID,
|
|
63
64
|
out: ID,
|
|
64
65
|
inOut: ID,
|
package/mock.js
CHANGED
|
@@ -28,7 +28,7 @@ function simulateCallbackFactory(...params) {
|
|
|
28
28
|
callback &&
|
|
29
29
|
setTimeout(() => {
|
|
30
30
|
// user defined callback
|
|
31
|
-
// eslint-disable-next-line
|
|
31
|
+
// eslint-disable-next-line node/no-callback-literal
|
|
32
32
|
callback(...params);
|
|
33
33
|
}, 0);
|
|
34
34
|
};
|
|
@@ -73,9 +73,9 @@ function createMockComponent(name) {
|
|
|
73
73
|
|
|
74
74
|
function createTransitioningComponent(Component) {
|
|
75
75
|
return class extends React.Component {
|
|
76
|
-
static displayName = `Transitioning.${
|
|
77
|
-
Component.name ||
|
|
78
|
-
|
|
76
|
+
static displayName = `Transitioning.${
|
|
77
|
+
Component.displayName || Component.name || 'Component'
|
|
78
|
+
}`;
|
|
79
79
|
|
|
80
80
|
setNativeProps() {
|
|
81
81
|
// noop
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-reanimated",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.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",
|
|
@@ -18,14 +18,20 @@
|
|
|
18
18
|
"format:common": "find Common/ -iname *.h -o -iname *.cpp | xargs clang-format -i",
|
|
19
19
|
"release": "npm login && release-it",
|
|
20
20
|
"type:check": "yarn tsc --noEmit",
|
|
21
|
-
"type:generate": "yarn type:generate:clean && yarn type:generate:cp-js-src && yarn type:generate:tsc && yarn type:generate:remove.ts && yarn type:generate:remove.tsx",
|
|
21
|
+
"type:generate": "yarn type:generate:clean && yarn type:generate:cp-js-src && yarn type:generate:tsc && yarn type:generate:remove.ts && yarn type:generate:remove.tsx && yarn type:generate:remove.js:from-src",
|
|
22
22
|
"type:generate:clean": "rm -rf lib/ && mkdir lib/",
|
|
23
23
|
"type:generate:cp-js-src": "cp -RL src/* lib/",
|
|
24
24
|
"type:generate:tsc": "yarn tsc",
|
|
25
25
|
"type:generate:remove.ts": "find ./lib -type f -name \"*.ts\" -and -not -name \"*.d.ts\" -delete",
|
|
26
26
|
"type:generate:remove.tsx": "find ./lib -type f -name \"*.tsx\" -and -not -name \"*.d.ts\" -delete",
|
|
27
|
+
"type:generate:remove.js:from-src": "find ./src/reanimated2 -type f -name \"*.js\" -delete",
|
|
27
28
|
"prepare": "husky install",
|
|
28
|
-
"circular_dependency_check": "yarn madge --extensions js,ts,tsx --circular ./src"
|
|
29
|
+
"circular_dependency_check": "yarn madge --extensions js,ts,tsx --circular ./src",
|
|
30
|
+
"setup": "yarn && cd Example && yarn && cd ios && pod install --verbose && cd ../..",
|
|
31
|
+
"clean": "rm -rf node_modules && cd Example && rm -rf node_modules && cd ios && pod deintegrate && cd ../..",
|
|
32
|
+
"reset": "yarn clean && yarn setup",
|
|
33
|
+
"clean:deep": "cd android && rm -rf .cxx .gradle build && cd ../Example/android && rm -rf .gradle build app/build && cd ../.. && yarn clean",
|
|
34
|
+
"reset:deep": "yarn clean:deep && yarn setup"
|
|
29
35
|
},
|
|
30
36
|
"main": "lib/Animated.js",
|
|
31
37
|
"module": "lib/Animated",
|
|
@@ -36,7 +42,6 @@
|
|
|
36
42
|
"Common/",
|
|
37
43
|
"src/",
|
|
38
44
|
"lib/",
|
|
39
|
-
"libSo/",
|
|
40
45
|
"android/src/main/AndroidManifest.xml",
|
|
41
46
|
"android/src/main/java/",
|
|
42
47
|
"android/build.gradle",
|
|
@@ -69,56 +74,57 @@
|
|
|
69
74
|
},
|
|
70
75
|
"homepage": "https://github.com/software-mansion/react-native-reanimated#readme",
|
|
71
76
|
"dependencies": {
|
|
72
|
-
"@babel/plugin-transform-object-assign": "^7.
|
|
77
|
+
"@babel/plugin-transform-object-assign": "^7.16.7",
|
|
73
78
|
"@types/invariant": "^2.2.35",
|
|
74
79
|
"invariant": "^2.2.4",
|
|
75
80
|
"lodash.isequal": "^4.5.0",
|
|
76
|
-
"
|
|
77
|
-
"
|
|
81
|
+
"react-native-screens": "^3.11.1",
|
|
82
|
+
"setimmediate": "^1.0.5",
|
|
78
83
|
"string-hash-64": "^1.0.3"
|
|
79
84
|
},
|
|
80
85
|
"peerDependencies": {
|
|
86
|
+
"@babel/preset-typescript": "*",
|
|
81
87
|
"react": "*",
|
|
82
88
|
"react-native": "*",
|
|
83
89
|
"react-native-gesture-handler": "*"
|
|
84
90
|
},
|
|
85
91
|
"devDependencies": {
|
|
86
|
-
"@babel/core": "^7.
|
|
87
|
-
"@babel/plugin-proposal-class-properties": "^7.7
|
|
88
|
-
"@babel/preset-env": "^7.
|
|
89
|
-
"@babel/preset-typescript": "^7.7
|
|
90
|
-
"@react-native-community/bob": "^0.
|
|
92
|
+
"@babel/core": "^7.17.2",
|
|
93
|
+
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
|
94
|
+
"@babel/preset-env": "^7.16.11",
|
|
95
|
+
"@babel/preset-typescript": "^7.16.7",
|
|
96
|
+
"@react-native-community/bob": "^0.17.1",
|
|
91
97
|
"@react-native-community/eslint-config": "^0.0.5",
|
|
92
|
-
"@testing-library/jest-native": "^
|
|
98
|
+
"@testing-library/jest-native": "^4.0.4",
|
|
93
99
|
"@testing-library/react-hooks": "^5.0.3",
|
|
94
100
|
"@testing-library/react-native": "^7.1.0",
|
|
95
|
-
"@types/babel-types": "^7.0.
|
|
96
|
-
"@types/babel__core": "^7.1.
|
|
97
|
-
"@types/babel__generator": "^7.6.
|
|
98
|
-
"@types/babel__traverse": "^7.
|
|
99
|
-
"@types/jest": "^
|
|
100
|
-
"@types/react-native": "^0.
|
|
101
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
102
|
-
"@typescript-eslint/parser": "^
|
|
103
|
-
"babel-eslint": "^10.0
|
|
104
|
-
"babel-jest": "^
|
|
101
|
+
"@types/babel-types": "^7.0.11",
|
|
102
|
+
"@types/babel__core": "^7.1.18",
|
|
103
|
+
"@types/babel__generator": "^7.6.4",
|
|
104
|
+
"@types/babel__traverse": "^7.14.2",
|
|
105
|
+
"@types/jest": "^27.4.0",
|
|
106
|
+
"@types/react-native": "^0.66.15",
|
|
107
|
+
"@typescript-eslint/eslint-plugin": "^5.11.0",
|
|
108
|
+
"@typescript-eslint/parser": "^5.11.0",
|
|
109
|
+
"babel-eslint": "^10.1.0",
|
|
110
|
+
"babel-jest": "^27.5.1",
|
|
105
111
|
"babel-plugin-module-resolver": "^4.1.0",
|
|
106
|
-
"clang-format": "^1.
|
|
107
|
-
"eslint": "^
|
|
108
|
-
"eslint-config-prettier": "^
|
|
109
|
-
"eslint-config-standard": "^
|
|
110
|
-
"eslint-import-resolver-babel-module": "^5.
|
|
111
|
-
"eslint-plugin-import": "^2.
|
|
112
|
-
"eslint-plugin-node": "^
|
|
113
|
-
"eslint-plugin-promise": "^
|
|
114
|
-
"eslint-plugin-standard": "^
|
|
115
|
-
"husky": "^7.0.
|
|
116
|
-
"jest": "^
|
|
112
|
+
"clang-format": "^1.6.0",
|
|
113
|
+
"eslint": "^8.8.0",
|
|
114
|
+
"eslint-config-prettier": "^8.3.0",
|
|
115
|
+
"eslint-config-standard": "^16.0.3",
|
|
116
|
+
"eslint-import-resolver-babel-module": "^5.3.1",
|
|
117
|
+
"eslint-plugin-import": "^2.25.4",
|
|
118
|
+
"eslint-plugin-node": "^11.1.0",
|
|
119
|
+
"eslint-plugin-promise": "^6.0.0",
|
|
120
|
+
"eslint-plugin-standard": "^5.0.0",
|
|
121
|
+
"husky": "^7.0.4",
|
|
122
|
+
"jest": "^27.5.1",
|
|
117
123
|
"lint-staged": "^11.2.0",
|
|
118
124
|
"madge": "^5.0.1",
|
|
119
|
-
"prettier": "^2.
|
|
125
|
+
"prettier": "^2.5.1",
|
|
120
126
|
"react": "17.0.2",
|
|
121
|
-
"react-native": "0.
|
|
127
|
+
"react-native": "0.68.0-rc.2",
|
|
122
128
|
"react-native-codegen": "^0.0.7",
|
|
123
129
|
"react-native-gesture-handler": "^1.6.1",
|
|
124
130
|
"react-test-renderer": "17.0.2",
|
package/plugin.js
CHANGED
|
@@ -39,16 +39,24 @@ declare module 'react-native-reanimated' {
|
|
|
39
39
|
PanGestureHandlerGestureEvent,
|
|
40
40
|
} from 'react-native-gesture-handler';
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
import('./src/reanimated2/globals');
|
|
43
|
+
|
|
44
|
+
export type TimingAnimation =
|
|
45
|
+
import('./src/reanimated2/animation/index').TimingAnimation;
|
|
46
|
+
export type SpringAnimation =
|
|
47
|
+
import('./src/reanimated2/animation/index').SpringAnimation;
|
|
48
|
+
export type DecayAnimation =
|
|
49
|
+
import('./src/reanimated2/animation/index').DecayAnimation;
|
|
50
|
+
export type DelayAnimation =
|
|
51
|
+
import('./src/reanimated2/animation/commonTypes').DelayAnimation;
|
|
52
|
+
export type RepeatAnimation =
|
|
53
|
+
import('./src/reanimated2/animation/index').RepeatAnimation;
|
|
54
|
+
export type SequenceAnimation =
|
|
55
|
+
import('./src/reanimated2/animation/index').SequenceAnimation;
|
|
56
|
+
export type StyleLayoutAnimation =
|
|
57
|
+
import('./src/reanimated2/animation/index').StyleLayoutAnimation;
|
|
58
|
+
export type Animation<T> =
|
|
59
|
+
import('./src/reanimated2/commonTypes').Animation<T>;
|
|
52
60
|
|
|
53
61
|
namespace Animated {
|
|
54
62
|
type Nullable<T> = T | null | undefined;
|
|
@@ -150,7 +158,7 @@ declare module 'react-native-reanimated' {
|
|
|
150
158
|
? T['style']
|
|
151
159
|
: Record<string, unknown>;
|
|
152
160
|
|
|
153
|
-
export type AnimateProps<P extends
|
|
161
|
+
export type AnimateProps<P extends object> = {
|
|
154
162
|
[K in keyof P]: P[K] | AnimatedNode<P[K]>;
|
|
155
163
|
} & {
|
|
156
164
|
style?: StyleProp<AnimateStyle<StylesOrDefault<P>>>;
|
|
@@ -481,6 +489,23 @@ declare module 'react-native-reanimated' {
|
|
|
481
489
|
targetGlobalOriginY: number;
|
|
482
490
|
}
|
|
483
491
|
|
|
492
|
+
export enum SensorType {
|
|
493
|
+
ACCELEROMETER = 1,
|
|
494
|
+
GYROSCOPE = 2,
|
|
495
|
+
GRAVITY = 3,
|
|
496
|
+
MAGNETIC_FIELD = 4,
|
|
497
|
+
ROTATION = 5,
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
export type SensorConfig = {
|
|
501
|
+
interval: number;
|
|
502
|
+
};
|
|
503
|
+
|
|
504
|
+
export function useAnimatedSensor(
|
|
505
|
+
sensorType: SensorType,
|
|
506
|
+
userConfig?: SensorConfig
|
|
507
|
+
);
|
|
508
|
+
|
|
484
509
|
export interface ExitAnimationsValues {
|
|
485
510
|
currentOriginX: number;
|
|
486
511
|
currentOriginY: number;
|
|
@@ -557,9 +582,10 @@ declare module 'react-native-reanimated' {
|
|
|
557
582
|
finished?: boolean,
|
|
558
583
|
current?: AnimatableValue
|
|
559
584
|
) => void;
|
|
585
|
+
export type EasingFunctionFactory = { factory: () => EasingFunction };
|
|
560
586
|
export interface WithTimingConfig {
|
|
561
587
|
duration?: number;
|
|
562
|
-
easing?: EasingFunction;
|
|
588
|
+
easing?: EasingFunction | EasingFunctionFactory;
|
|
563
589
|
}
|
|
564
590
|
export interface WithDecayConfig {
|
|
565
591
|
deceleration?: number;
|
|
@@ -829,6 +855,9 @@ declare module 'react-native-reanimated' {
|
|
|
829
855
|
callback: (finished: boolean) => void
|
|
830
856
|
): ComplexAnimationBuilder;
|
|
831
857
|
|
|
858
|
+
static withInitialValues(values: StyleProps): BaseAnimationBuilder;
|
|
859
|
+
withInitialValues(values: StyleProps): BaseAnimationBuilder;
|
|
860
|
+
|
|
832
861
|
static easing(easingFunction: EasingFunction): ComplexAnimationBuilder;
|
|
833
862
|
easing(easingFunction: EasingFunction): ComplexAnimationBuilder;
|
|
834
863
|
static springify(): ComplexAnimationBuilder;
|
package/src/ConfigHelper.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { configureProps as jsiConfigureProps } from './reanimated2/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Styles allowed to be direcly updated in UI thread
|
|
@@ -107,9 +107,9 @@ let NATIVE_THREAD_PROPS_WHITELIST: Record<string, boolean> = {
|
|
|
107
107
|
};
|
|
108
108
|
|
|
109
109
|
function configureProps(): void {
|
|
110
|
-
|
|
111
|
-
Object.keys(
|
|
112
|
-
Object.keys(
|
|
110
|
+
jsiConfigureProps(
|
|
111
|
+
Object.keys(UI_THREAD_PROPS_WHITELIST),
|
|
112
|
+
Object.keys(NATIVE_THREAD_PROPS_WHITELIST)
|
|
113
113
|
);
|
|
114
114
|
}
|
|
115
115
|
|
|
@@ -194,6 +194,7 @@ export default function createAnimatedComponent(
|
|
|
194
194
|
_viewTag = -1;
|
|
195
195
|
_isFirstRender = true;
|
|
196
196
|
animatedStyle: { value: StyleProps } = { value: {} };
|
|
197
|
+
initialStyle = {};
|
|
197
198
|
sv: SharedValue<null | Record<string, unknown>> | null;
|
|
198
199
|
_propsAnimated?: PropsAnimated;
|
|
199
200
|
_component: ComponentRef | null = null;
|
|
@@ -606,13 +607,12 @@ export default function createAnimatedComponent(
|
|
|
606
607
|
// this is how we recognize styles returned by useAnimatedStyle
|
|
607
608
|
style.viewsRef.add(this);
|
|
608
609
|
if (this._isFirstRender) {
|
|
609
|
-
|
|
610
|
+
this.initialStyle = {
|
|
610
611
|
...style.initial.value,
|
|
611
612
|
...initialUpdaterRun<StyleProps>(style.initial.updater),
|
|
612
613
|
};
|
|
613
|
-
} else {
|
|
614
|
-
return style.initial.value;
|
|
615
614
|
}
|
|
615
|
+
return this.initialStyle;
|
|
616
616
|
} else {
|
|
617
617
|
return style;
|
|
618
618
|
}
|
|
@@ -37,7 +37,7 @@ export function createAnimatedFunction(cb) {
|
|
|
37
37
|
for (let i = 0; i < params.length; i++) {
|
|
38
38
|
params[i] = createAnimatedParam();
|
|
39
39
|
}
|
|
40
|
-
// eslint-disable-next-line
|
|
40
|
+
// eslint-disable-next-line node/no-callback-literal
|
|
41
41
|
const what = cb(...params);
|
|
42
42
|
const func = new AnimatedFunction(what, ...params);
|
|
43
43
|
return (...args) => {
|