react-native-reanimated 2.3.0-beta.2 → 2.3.1
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/NativeModules/NativeReanimatedModule.cpp +12 -3
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +13 -0
- package/Common/cpp/Registries/EventHandlerRegistry.cpp +2 -2
- package/Common/cpp/Registries/MapperRegistry.cpp +5 -5
- package/Common/cpp/SharedItems/FrozenObject.cpp +1 -3
- package/Common/cpp/SharedItems/ShareableValue.cpp +8 -10
- package/Common/cpp/Tools/FeaturesConfig.cpp +5 -0
- package/Common/cpp/Tools/JSIStoreValueUser.cpp +8 -8
- package/Common/cpp/Tools/Mapper.cpp +1 -1
- package/Common/cpp/Tools/RuntimeDecorator.cpp +40 -4
- package/Common/cpp/Tools/WorkletEventHandler.cpp +3 -1
- package/Common/cpp/headers/NativeModules/NativeReanimatedModule.h +5 -0
- package/Common/cpp/headers/NativeModules/NativeReanimatedModuleSpec.h +6 -1
- package/Common/cpp/headers/Registries/EventHandlerRegistry.h +1 -0
- package/Common/cpp/headers/Registries/MapperRegistry.h +1 -0
- package/Common/cpp/headers/SharedItems/FrozenObject.h +4 -0
- package/Common/cpp/headers/SharedItems/HostFunctionHandler.h +2 -0
- package/Common/cpp/headers/SharedItems/MutableValue.h +2 -0
- package/Common/cpp/headers/SharedItems/MutableValueSetterProxy.h +3 -1
- package/Common/cpp/headers/SharedItems/RemoteObject.h +4 -1
- package/Common/cpp/headers/SharedItems/ShareableValue.h +2 -0
- package/Common/cpp/headers/SharedItems/SharedParent.h +9 -9
- package/Common/cpp/headers/SharedItems/ValueWrapper.h +32 -28
- package/Common/cpp/headers/SpecTools/ErrorHandler.h +1 -0
- package/Common/cpp/headers/Tools/FeaturesConfig.h +19 -0
- package/Common/cpp/headers/Tools/JSIStoreValueUser.h +2 -5
- package/Common/cpp/headers/Tools/Mapper.h +2 -0
- package/Common/cpp/headers/Tools/PlatformDepMethodsHolder.h +5 -0
- package/Common/cpp/headers/Tools/ReanimatedHiddenHeaders.h +1 -5
- package/Common/cpp/headers/Tools/RuntimeDecorator.h +10 -7
- package/Common/cpp/headers/Tools/Scheduler.h +2 -0
- package/Common/cpp/headers/Tools/WorkletEventHandler.h +2 -1
- package/Common/cpp/hidden_headers/Logger.h +2 -2
- package/Common/cpp/hidden_headers/LoggerInterface.h +1 -1
- package/README.md +1 -1
- package/RNReanimated.podspec +21 -3
- package/android/build.gradle +33 -13
- package/android/expo/linking.gradle +46 -0
- package/android/expo/src/main/java/com/swmansion/reanimated/EXReanimatedAdapter.java +12 -0
- package/android/expo/src/main/java/expo/modules/adapters/reanimated/EXReanimatedPackage.java +26 -0
- package/android/react-native-reanimated-63-hermes.aar +0 -0
- package/android/react-native-reanimated-63-jsc.aar +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/expo-module.config.json +3 -0
- package/ios/LayoutReanimation/REAAnimationsManager.m +65 -19
- package/ios/LayoutReanimation/REAUIManager.mm +101 -61
- package/ios/Nodes/REAPropsNode.m +1 -1
- package/ios/REAEventDispatcher.m +1 -1
- package/ios/REAModule.h +0 -2
- package/ios/REAModule.m +0 -3
- package/ios/REANodesManager.m +1 -0
- package/ios/RNGestureHandlerStateManager.h +5 -0
- package/ios/native/NativeMethods.h +5 -0
- package/ios/native/NativeMethods.mm +14 -6
- package/ios/native/NativeProxy.h +1 -0
- package/ios/native/NativeProxy.mm +84 -63
- package/ios/native/REAIOSErrorHandler.mm +19 -15
- package/ios/native/REAIOSLogger.mm +10 -6
- package/ios/native/REAIOSScheduler.mm +17 -10
- package/ios/native/REAInitializer.mm +39 -37
- package/ios/native/UIResponder+Reanimated.mm +2 -2
- package/lib/Animated.js +11 -5
- package/lib/ConfigHelper.js +121 -138
- package/lib/ReanimatedEventEmitter.js +0 -1
- package/lib/ReanimatedModule.js +0 -1
- package/lib/ReanimatedModule.macos.js +0 -1
- package/lib/ReanimatedModule.native.js +5 -6
- package/lib/ReanimatedModule.windows.js +0 -1
- package/lib/ReanimatedModuleCompat.js +64 -35
- package/lib/createAnimatedComponent.js +469 -499
- package/lib/index.js +11 -5
- package/lib/reanimated1/core/Core.test.js +1 -1
- package/lib/reanimated2/NativeMethods.js +7 -0
- package/lib/reanimated2/NativeReanimated/NativeReanimated.js +3 -0
- package/lib/reanimated2/PropAdapters.js +0 -1
- package/lib/reanimated2/UpdateProps.js +1 -1
- package/lib/reanimated2/ViewDescriptorsSet.js +4 -2
- package/lib/reanimated2/animation/spring.js +2 -0
- package/lib/reanimated2/animation/styleAnimation.js +5 -1
- package/lib/reanimated2/animation/util.js +23 -0
- package/lib/reanimated2/component/FlatList.js +30 -0
- package/lib/reanimated2/component/WrappedComponents.js +9 -0
- package/lib/reanimated2/component/index.js +4 -0
- package/lib/reanimated2/core.js +34 -6
- package/lib/reanimated2/globals.d.ts +8 -0
- package/lib/reanimated2/js-reanimated/JSReanimated.js +4 -0
- package/lib/reanimated2/js-reanimated/Mapper.js +4 -3
- package/lib/reanimated2/js-reanimated/MapperRegistry.js +3 -6
- package/lib/reanimated2/js-reanimated/MutableValue.js +0 -2
- package/lib/reanimated2/js-reanimated/index.js +10 -8
- package/lib/reanimated2/layoutReanimation/LayoutAnimationRepository.js +14 -5
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Default.js +14 -14
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Flip.js +8 -8
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +16 -16
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Slide.js +16 -16
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +4 -4
- package/lib/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +20 -8
- package/lib/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +3 -3
- package/lib/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +8 -8
- package/lib/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +10 -10
- package/lib/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +8 -8
- package/lib/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +8 -8
- package/lib/reanimated2/mock.js +3 -1
- package/lib/setAndForwardRef.js +14 -48
- package/mock.js +1 -1
- package/package.json +27 -23
- package/plugin.js +111 -110
- package/react-native-reanimated.d.ts +56 -27
- package/src/Animated.js +11 -5
- package/src/{ConfigHelper.js → ConfigHelper.ts} +15 -7
- package/src/{ReanimatedEventEmitter.js → ReanimatedEventEmitter.ts} +0 -0
- package/src/{ReanimatedModule.js → ReanimatedModule.macos.ts} +0 -0
- package/src/{ReanimatedModule.native.js → ReanimatedModule.native.ts} +0 -0
- package/src/{ReanimatedModule.macos.js → ReanimatedModule.ts} +0 -0
- package/src/{ReanimatedModule.windows.js → ReanimatedModule.windows.ts} +0 -0
- package/src/ReanimatedModuleCompat.ts +51 -0
- package/src/{createAnimatedComponent.js → createAnimatedComponent.tsx} +278 -124
- package/src/reanimated1/core/Core.test.js +1 -1
- package/src/reanimated2/NativeMethods.ts +13 -1
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +5 -11
- package/src/reanimated2/PropAdapters.ts +0 -1
- package/src/reanimated2/UpdateProps.ts +1 -1
- package/src/reanimated2/ViewDescriptorsSet.ts +6 -2
- package/src/reanimated2/animation/commonTypes.ts +4 -4
- package/src/reanimated2/animation/decay.ts +2 -2
- package/src/reanimated2/animation/delay.ts +3 -3
- package/src/reanimated2/animation/index.ts +7 -7
- package/src/reanimated2/animation/repeat.ts +4 -4
- package/src/reanimated2/animation/sequence.ts +2 -2
- package/src/reanimated2/animation/spring.ts +6 -5
- package/src/reanimated2/animation/styleAnimation.ts +24 -12
- package/src/reanimated2/animation/timing.ts +5 -5
- package/src/reanimated2/animation/util.ts +45 -6
- package/src/reanimated2/component/FlatList.tsx +44 -0
- package/src/reanimated2/component/WrappedComponents.ts +11 -0
- package/src/reanimated2/component/index.ts +9 -0
- package/src/reanimated2/core.ts +62 -17
- package/src/reanimated2/globals.d.ts +8 -0
- package/src/reanimated2/hook/useAnimatedStyle.ts +2 -2
- package/src/reanimated2/js-reanimated/JSReanimated.ts +15 -26
- package/src/reanimated2/js-reanimated/Mapper.ts +22 -9
- package/src/reanimated2/js-reanimated/MapperRegistry.ts +22 -19
- package/src/reanimated2/js-reanimated/MutableValue.ts +11 -11
- package/src/reanimated2/js-reanimated/index.ts +31 -14
- package/src/reanimated2/layoutReanimation/{LayoutAnimationRepository.tsx → LayoutAnimationRepository.ts} +18 -5
- package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +39 -20
- package/src/reanimated2/layoutReanimation/animationBuilder/index.ts +5 -1
- package/src/reanimated2/layoutReanimation/defaultAnimations/Default.ts +21 -15
- package/src/reanimated2/layoutReanimation/defaultAnimations/Flip.ts +29 -24
- package/src/reanimated2/layoutReanimation/defaultAnimations/Rotate.ts +61 -34
- package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +49 -34
- package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +17 -12
- package/src/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.ts +20 -8
- package/src/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.ts +9 -9
- package/src/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.ts +8 -8
- package/src/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.ts +20 -14
- package/src/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.ts +14 -8
- package/src/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.ts +24 -12
- package/src/reanimated2/mock.ts +3 -1
- package/src/{setAndForwardRef.js → setAndForwardRef.ts} +12 -2
- package/src/ReanimatedModuleCompat.js +0 -37
|
@@ -22,8 +22,8 @@ export class RotateInDownLeft extends ComplexAnimationBuilder {
|
|
|
22
22
|
opacity: 0,
|
|
23
23
|
transform: [
|
|
24
24
|
{ rotate: '-90deg' },
|
|
25
|
-
{ translateX: values.
|
|
26
|
-
{ translateY: -(values.
|
|
25
|
+
{ translateX: values.targetWidth / 2 - values.targetHeight / 2 },
|
|
26
|
+
{ translateY: -(values.targetWidth / 2 - values.targetHeight / 2) },
|
|
27
27
|
],
|
|
28
28
|
},
|
|
29
29
|
callback: callback,
|
|
@@ -58,8 +58,8 @@ export class RotateInDownRight extends ComplexAnimationBuilder {
|
|
|
58
58
|
opacity: 0,
|
|
59
59
|
transform: [
|
|
60
60
|
{ rotate: '90deg' },
|
|
61
|
-
{ translateX: -(values.
|
|
62
|
-
{ translateY: -(values.
|
|
61
|
+
{ translateX: -(values.targetWidth / 2 - values.targetHeight / 2) },
|
|
62
|
+
{ translateY: -(values.targetWidth / 2 - values.targetHeight / 2) },
|
|
63
63
|
],
|
|
64
64
|
},
|
|
65
65
|
callback: callback,
|
|
@@ -94,8 +94,8 @@ export class RotateInUpLeft extends ComplexAnimationBuilder {
|
|
|
94
94
|
opacity: 0,
|
|
95
95
|
transform: [
|
|
96
96
|
{ rotate: '90deg' },
|
|
97
|
-
{ translateX: values.
|
|
98
|
-
{ translateY: values.
|
|
97
|
+
{ translateX: values.targetWidth / 2 - values.targetHeight / 2 },
|
|
98
|
+
{ translateY: values.targetWidth / 2 - values.targetHeight / 2 },
|
|
99
99
|
],
|
|
100
100
|
},
|
|
101
101
|
callback: callback,
|
|
@@ -130,8 +130,8 @@ export class RotateInUpRight extends ComplexAnimationBuilder {
|
|
|
130
130
|
opacity: 0,
|
|
131
131
|
transform: [
|
|
132
132
|
{ rotate: '-90deg' },
|
|
133
|
-
{ translateX: -(values.
|
|
134
|
-
{ translateY: values.
|
|
133
|
+
{ translateX: -(values.targetWidth / 2 - values.targetHeight / 2) },
|
|
134
|
+
{ translateY: values.targetWidth / 2 - values.targetHeight / 2 },
|
|
135
135
|
],
|
|
136
136
|
},
|
|
137
137
|
callback: callback,
|
|
@@ -159,10 +159,10 @@ export class RotateOutDownLeft extends ComplexAnimationBuilder {
|
|
|
159
159
|
transform: [
|
|
160
160
|
{ rotate: delayFunction(delay, animation('90deg', config)) },
|
|
161
161
|
{
|
|
162
|
-
translateX: delayFunction(delay, animation(values.
|
|
162
|
+
translateX: delayFunction(delay, animation(values.currentWidth / 2 - values.currentHeight / 2, config)),
|
|
163
163
|
},
|
|
164
164
|
{
|
|
165
|
-
translateY: delayFunction(delay, animation(values.
|
|
165
|
+
translateY: delayFunction(delay, animation(values.currentWidth / 2 - values.currentHeight / 2, config)),
|
|
166
166
|
},
|
|
167
167
|
],
|
|
168
168
|
},
|
|
@@ -195,10 +195,10 @@ export class RotateOutDownRight extends ComplexAnimationBuilder {
|
|
|
195
195
|
transform: [
|
|
196
196
|
{ rotate: delayFunction(delay, animation('-90deg', config)) },
|
|
197
197
|
{
|
|
198
|
-
translateX: delayFunction(delay, animation(-(values.
|
|
198
|
+
translateX: delayFunction(delay, animation(-(values.currentWidth / 2 - values.currentHeight / 2), config)),
|
|
199
199
|
},
|
|
200
200
|
{
|
|
201
|
-
translateY: delayFunction(delay, animation(values.
|
|
201
|
+
translateY: delayFunction(delay, animation(values.currentWidth / 2 - values.currentHeight / 2, config)),
|
|
202
202
|
},
|
|
203
203
|
],
|
|
204
204
|
},
|
|
@@ -231,10 +231,10 @@ export class RotateOutUpLeft extends ComplexAnimationBuilder {
|
|
|
231
231
|
transform: [
|
|
232
232
|
{ rotate: delayFunction(delay, animation('-90deg', config)) },
|
|
233
233
|
{
|
|
234
|
-
translateX: delayFunction(delay, animation(values.
|
|
234
|
+
translateX: delayFunction(delay, animation(values.currentWidth / 2 - values.currentHeight / 2, config)),
|
|
235
235
|
},
|
|
236
236
|
{
|
|
237
|
-
translateY: delayFunction(delay, animation(-(values.
|
|
237
|
+
translateY: delayFunction(delay, animation(-(values.currentWidth / 2 - values.currentHeight / 2), config)),
|
|
238
238
|
},
|
|
239
239
|
],
|
|
240
240
|
},
|
|
@@ -267,10 +267,10 @@ export class RotateOutUpRight extends ComplexAnimationBuilder {
|
|
|
267
267
|
transform: [
|
|
268
268
|
{ rotate: delayFunction(delay, animation('90deg', config)) },
|
|
269
269
|
{
|
|
270
|
-
translateX: delayFunction(delay, animation(-(values.
|
|
270
|
+
translateX: delayFunction(delay, animation(-(values.currentWidth / 2 - values.currentHeight / 2), config)),
|
|
271
271
|
},
|
|
272
272
|
{
|
|
273
|
-
translateY: delayFunction(delay, animation(-(values.
|
|
273
|
+
translateY: delayFunction(delay, animation(-(values.currentWidth / 2 - values.currentHeight / 2), config)),
|
|
274
274
|
},
|
|
275
275
|
],
|
|
276
276
|
},
|
|
@@ -13,10 +13,10 @@ export class SlideInRight extends ComplexAnimationBuilder {
|
|
|
13
13
|
'worklet';
|
|
14
14
|
return {
|
|
15
15
|
animations: {
|
|
16
|
-
originX: delayFunction(delay, animation(values.
|
|
16
|
+
originX: delayFunction(delay, animation(values.targetOriginX, config)),
|
|
17
17
|
},
|
|
18
18
|
initialValues: {
|
|
19
|
-
originX: values.
|
|
19
|
+
originX: values.targetOriginX + width,
|
|
20
20
|
},
|
|
21
21
|
callback: callback,
|
|
22
22
|
};
|
|
@@ -39,10 +39,10 @@ export class SlideInLeft extends ComplexAnimationBuilder {
|
|
|
39
39
|
'worklet';
|
|
40
40
|
return {
|
|
41
41
|
animations: {
|
|
42
|
-
originX: delayFunction(delay, animation(values.
|
|
42
|
+
originX: delayFunction(delay, animation(values.targetOriginX, config)),
|
|
43
43
|
},
|
|
44
44
|
initialValues: {
|
|
45
|
-
originX: values.
|
|
45
|
+
originX: values.targetOriginX - width,
|
|
46
46
|
},
|
|
47
47
|
callback: callback,
|
|
48
48
|
};
|
|
@@ -65,10 +65,10 @@ export class SlideOutRight extends ComplexAnimationBuilder {
|
|
|
65
65
|
'worklet';
|
|
66
66
|
return {
|
|
67
67
|
animations: {
|
|
68
|
-
originX: delayFunction(delay, animation(Math.max(values.
|
|
68
|
+
originX: delayFunction(delay, animation(Math.max(values.currentOriginX + width, width), config)),
|
|
69
69
|
},
|
|
70
70
|
initialValues: {
|
|
71
|
-
originX: values.
|
|
71
|
+
originX: values.currentOriginX,
|
|
72
72
|
},
|
|
73
73
|
callback: callback,
|
|
74
74
|
};
|
|
@@ -91,10 +91,10 @@ export class SlideOutLeft extends ComplexAnimationBuilder {
|
|
|
91
91
|
'worklet';
|
|
92
92
|
return {
|
|
93
93
|
animations: {
|
|
94
|
-
originX: delayFunction(delay, animation(Math.min(values.
|
|
94
|
+
originX: delayFunction(delay, animation(Math.min(values.currentOriginX - width, -width), config)),
|
|
95
95
|
},
|
|
96
96
|
initialValues: {
|
|
97
|
-
originX: values.
|
|
97
|
+
originX: values.currentOriginX,
|
|
98
98
|
},
|
|
99
99
|
callback: callback,
|
|
100
100
|
};
|
|
@@ -117,10 +117,10 @@ export class SlideInUp extends ComplexAnimationBuilder {
|
|
|
117
117
|
'worklet';
|
|
118
118
|
return {
|
|
119
119
|
animations: {
|
|
120
|
-
originY: delayFunction(delay, animation(values.
|
|
120
|
+
originY: delayFunction(delay, animation(values.targetOriginY, config)),
|
|
121
121
|
},
|
|
122
122
|
initialValues: {
|
|
123
|
-
originY: height,
|
|
123
|
+
originY: -height,
|
|
124
124
|
},
|
|
125
125
|
callback: callback,
|
|
126
126
|
};
|
|
@@ -143,10 +143,10 @@ export class SlideInDown extends ComplexAnimationBuilder {
|
|
|
143
143
|
'worklet';
|
|
144
144
|
return {
|
|
145
145
|
animations: {
|
|
146
|
-
originY: delayFunction(delay, animation(values.
|
|
146
|
+
originY: delayFunction(delay, animation(values.targetOriginY, config)),
|
|
147
147
|
},
|
|
148
148
|
initialValues: {
|
|
149
|
-
originY: values.
|
|
149
|
+
originY: values.targetOriginY + height,
|
|
150
150
|
},
|
|
151
151
|
callback: callback,
|
|
152
152
|
};
|
|
@@ -169,9 +169,9 @@ export class SlideOutUp extends ComplexAnimationBuilder {
|
|
|
169
169
|
'worklet';
|
|
170
170
|
return {
|
|
171
171
|
animations: {
|
|
172
|
-
originY: delayFunction(delay, animation(Math.min(values.
|
|
172
|
+
originY: delayFunction(delay, animation(Math.min(values.currentOriginY - height, -height), config)),
|
|
173
173
|
},
|
|
174
|
-
initialValues: { originY: values.
|
|
174
|
+
initialValues: { originY: values.currentOriginY },
|
|
175
175
|
callback: callback,
|
|
176
176
|
};
|
|
177
177
|
};
|
|
@@ -193,9 +193,9 @@ export class SlideOutDown extends ComplexAnimationBuilder {
|
|
|
193
193
|
'worklet';
|
|
194
194
|
return {
|
|
195
195
|
animations: {
|
|
196
|
-
originY: delayFunction(delay, animation(Math.max(values.
|
|
196
|
+
originY: delayFunction(delay, animation(Math.max(values.currentOriginY + height, height), config)),
|
|
197
197
|
},
|
|
198
|
-
initialValues: { originY: values.
|
|
198
|
+
initialValues: { originY: values.currentOriginY },
|
|
199
199
|
callback: callback,
|
|
200
200
|
};
|
|
201
201
|
};
|
|
@@ -191,7 +191,7 @@ export class ZoomInEasyUp extends ComplexAnimationBuilder {
|
|
|
191
191
|
],
|
|
192
192
|
},
|
|
193
193
|
initialValues: {
|
|
194
|
-
transform: [{ translateY: -values.
|
|
194
|
+
transform: [{ translateY: -values.targetHeight }, { scale: 0 }],
|
|
195
195
|
},
|
|
196
196
|
callback: callback,
|
|
197
197
|
};
|
|
@@ -220,7 +220,7 @@ export class ZoomInEasyDown extends ComplexAnimationBuilder {
|
|
|
220
220
|
],
|
|
221
221
|
},
|
|
222
222
|
initialValues: {
|
|
223
|
-
transform: [{ translateY: values.
|
|
223
|
+
transform: [{ translateY: values.targetHeight }, { scale: 0 }],
|
|
224
224
|
},
|
|
225
225
|
callback: callback,
|
|
226
226
|
};
|
|
@@ -417,7 +417,7 @@ export class ZoomOutEasyUp extends ComplexAnimationBuilder {
|
|
|
417
417
|
animations: {
|
|
418
418
|
transform: [
|
|
419
419
|
{
|
|
420
|
-
translateY: delayFunction(delay, animation(-values.
|
|
420
|
+
translateY: delayFunction(delay, animation(-values.currentHeight, config)),
|
|
421
421
|
},
|
|
422
422
|
{ scale: delayFunction(delay, animation(0, config)) },
|
|
423
423
|
],
|
|
@@ -448,7 +448,7 @@ export class ZoomOutEasyDown extends ComplexAnimationBuilder {
|
|
|
448
448
|
animations: {
|
|
449
449
|
transform: [
|
|
450
450
|
{
|
|
451
|
-
translateY: delayFunction(delay, animation(values.
|
|
451
|
+
translateY: delayFunction(delay, animation(values.currentHeight, config)),
|
|
452
452
|
},
|
|
453
453
|
{ scale: delayFunction(delay, animation(0, config)) },
|
|
454
454
|
],
|
|
@@ -24,16 +24,28 @@ export class CurvedTransition extends BaseAnimationBuilder {
|
|
|
24
24
|
'worklet';
|
|
25
25
|
return {
|
|
26
26
|
initialValues: {
|
|
27
|
-
originX: values.
|
|
28
|
-
originY: values.
|
|
29
|
-
width: values.
|
|
30
|
-
height: values.
|
|
27
|
+
originX: values.currentOriginX,
|
|
28
|
+
originY: values.currentOriginY,
|
|
29
|
+
width: values.currentWidth,
|
|
30
|
+
height: values.currentHeight,
|
|
31
31
|
},
|
|
32
32
|
animations: {
|
|
33
|
-
originX: delayFunction(delay, withTiming(values.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
originX: delayFunction(delay, withTiming(values.targetOriginX, {
|
|
34
|
+
duration,
|
|
35
|
+
easing: easing.easingX,
|
|
36
|
+
})),
|
|
37
|
+
originY: delayFunction(delay, withTiming(values.targetOriginY, {
|
|
38
|
+
duration,
|
|
39
|
+
easing: easing.easingY,
|
|
40
|
+
})),
|
|
41
|
+
width: delayFunction(delay, withTiming(values.targetWidth, {
|
|
42
|
+
duration,
|
|
43
|
+
easing: easing.easingWidth,
|
|
44
|
+
})),
|
|
45
|
+
height: delayFunction(delay, withTiming(values.targetHeight, {
|
|
46
|
+
duration,
|
|
47
|
+
easing: easing.easingHeight,
|
|
48
|
+
})),
|
|
37
49
|
},
|
|
38
50
|
callback: callback,
|
|
39
51
|
};
|
|
@@ -60,7 +60,7 @@ export class EntryExitTransition extends BaseAnimationBuilder {
|
|
|
60
60
|
(_a = animations.transform) === null || _a === void 0 ? void 0 : _a.push({
|
|
61
61
|
[transformProp]: delayFunction(delay + exitingDuration, withSequence(withTiming(enteringValues.initialValues.transform
|
|
62
62
|
? enteringValues.initialValues.transform[index][transformProp]
|
|
63
|
-
: 0, { duration:
|
|
63
|
+
: 0, { duration: exitingDuration }), value[transformProp])),
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
});
|
|
@@ -96,8 +96,8 @@ export class EntryExitTransition extends BaseAnimationBuilder {
|
|
|
96
96
|
return value;
|
|
97
97
|
}));
|
|
98
98
|
return {
|
|
99
|
-
initialValues: Object.assign(Object.assign({}, exitingValues.initialValues), { originX: values.
|
|
100
|
-
animations: Object.assign({ originX: delayFunction(delay + exitingDuration, withTiming(values.
|
|
99
|
+
initialValues: Object.assign(Object.assign({}, exitingValues.initialValues), { originX: values.currentOriginX, originY: values.currentOriginY, width: values.currentWidth, height: values.currentHeight, transform: mergedTransform }),
|
|
100
|
+
animations: Object.assign({ originX: delayFunction(delay + exitingDuration, withTiming(values.targetOriginX, { duration: exitingDuration })), originY: delayFunction(delay + exitingDuration, withTiming(values.targetOriginY, { duration: exitingDuration })), width: delayFunction(delay + exitingDuration, withTiming(values.targetWidth, { duration: exitingDuration })), height: delayFunction(delay + exitingDuration, withTiming(values.targetHeight, { duration: exitingDuration })) }, animations),
|
|
101
101
|
callback: callback,
|
|
102
102
|
};
|
|
103
103
|
};
|
|
@@ -14,17 +14,17 @@ export class FadingTransition extends BaseAnimationBuilder {
|
|
|
14
14
|
return {
|
|
15
15
|
initialValues: {
|
|
16
16
|
opacity: 1,
|
|
17
|
-
originX: values.
|
|
18
|
-
originY: values.
|
|
19
|
-
width: values.
|
|
20
|
-
height: values.
|
|
17
|
+
originX: values.currentOriginX,
|
|
18
|
+
originY: values.currentOriginY,
|
|
19
|
+
width: values.currentWidth,
|
|
20
|
+
height: values.currentHeight,
|
|
21
21
|
},
|
|
22
22
|
animations: {
|
|
23
23
|
opacity: delayFunction(delay, withSequence(withTiming(0, { duration: duration }), withTiming(1, { duration: duration }))),
|
|
24
|
-
originX: delayFunction(delay + duration, withTiming(values.
|
|
25
|
-
originY: delayFunction(delay + duration, withTiming(values.
|
|
26
|
-
width: delayFunction(delay + duration, withTiming(values.
|
|
27
|
-
height: delayFunction(delay + duration, withTiming(values.
|
|
24
|
+
originX: delayFunction(delay + duration, withTiming(values.targetOriginX, { duration: 50 })),
|
|
25
|
+
originY: delayFunction(delay + duration, withTiming(values.targetOriginY, { duration: 50 })),
|
|
26
|
+
width: delayFunction(delay + duration, withTiming(values.targetWidth, { duration: 50 })),
|
|
27
|
+
height: delayFunction(delay + duration, withTiming(values.targetHeight, { duration: 50 })),
|
|
28
28
|
},
|
|
29
29
|
callback: callback,
|
|
30
30
|
};
|
|
@@ -13,22 +13,22 @@ export class JumpingTransition extends BaseAnimationBuilder {
|
|
|
13
13
|
const config = { duration: duration * 2 };
|
|
14
14
|
return (values) => {
|
|
15
15
|
'worklet';
|
|
16
|
-
const d = Math.max(Math.abs(values.
|
|
16
|
+
const d = Math.max(Math.abs(values.targetOriginX - values.currentOriginX), Math.abs(values.targetOriginY - values.currentOriginY));
|
|
17
17
|
return {
|
|
18
18
|
initialValues: {
|
|
19
|
-
originX: values.
|
|
20
|
-
originY: values.
|
|
21
|
-
width: values.
|
|
22
|
-
height: values.
|
|
19
|
+
originX: values.currentOriginX,
|
|
20
|
+
originY: values.currentOriginY,
|
|
21
|
+
width: values.currentWidth,
|
|
22
|
+
height: values.currentHeight,
|
|
23
23
|
},
|
|
24
24
|
animations: {
|
|
25
|
-
originX: delayFunction(delay, withTiming(values.
|
|
26
|
-
originY: delayFunction(delay, withSequence(withTiming(Math.min(values.
|
|
25
|
+
originX: delayFunction(delay, withTiming(values.targetOriginX, config)),
|
|
26
|
+
originY: delayFunction(delay, withSequence(withTiming(Math.min(values.targetOriginY, values.currentOriginY) - d, {
|
|
27
27
|
duration,
|
|
28
28
|
easing: Easing.out(Easing.exp),
|
|
29
|
-
}), withTiming(values.
|
|
30
|
-
width: delayFunction(delay, withTiming(values.
|
|
31
|
-
height: delayFunction(delay, withTiming(values.
|
|
29
|
+
}), withTiming(values.targetOriginY, Object.assign(Object.assign({}, config), { duration, easing: Easing.bounce })))),
|
|
30
|
+
width: delayFunction(delay, withTiming(values.targetWidth, config)),
|
|
31
|
+
height: delayFunction(delay, withTiming(values.targetHeight, config)),
|
|
32
32
|
},
|
|
33
33
|
callback: callback,
|
|
34
34
|
};
|
|
@@ -11,16 +11,16 @@ export class LinearTransition extends ComplexAnimationBuilder {
|
|
|
11
11
|
'worklet';
|
|
12
12
|
return {
|
|
13
13
|
initialValues: {
|
|
14
|
-
originX: values.
|
|
15
|
-
originY: values.
|
|
16
|
-
width: values.
|
|
17
|
-
height: values.
|
|
14
|
+
originX: values.currentOriginX,
|
|
15
|
+
originY: values.currentOriginY,
|
|
16
|
+
width: values.currentWidth,
|
|
17
|
+
height: values.currentHeight,
|
|
18
18
|
},
|
|
19
19
|
animations: {
|
|
20
|
-
originX: delayFunction(delay, animation(values.
|
|
21
|
-
originY: delayFunction(delay, animation(values.
|
|
22
|
-
width: delayFunction(delay, animation(values.
|
|
23
|
-
height: delayFunction(delay, animation(values.
|
|
20
|
+
originX: delayFunction(delay, animation(values.targetOriginX, config)),
|
|
21
|
+
originY: delayFunction(delay, animation(values.targetOriginY, config)),
|
|
22
|
+
width: delayFunction(delay, animation(values.targetWidth, config)),
|
|
23
|
+
height: delayFunction(delay, animation(values.targetHeight, config)),
|
|
24
24
|
},
|
|
25
25
|
callback: callback,
|
|
26
26
|
};
|
|
@@ -16,16 +16,16 @@ export class SequencedTransition extends BaseAnimationBuilder {
|
|
|
16
16
|
'worklet';
|
|
17
17
|
return {
|
|
18
18
|
initialValues: {
|
|
19
|
-
originX: values.
|
|
20
|
-
originY: values.
|
|
21
|
-
width: values.
|
|
22
|
-
height: values.
|
|
19
|
+
originX: values.currentOriginX,
|
|
20
|
+
originY: values.currentOriginY,
|
|
21
|
+
width: values.currentWidth,
|
|
22
|
+
height: values.currentHeight,
|
|
23
23
|
},
|
|
24
24
|
animations: {
|
|
25
|
-
originX: delayFunction(delay, withSequence(withTiming(reverse ? values.
|
|
26
|
-
originY: delayFunction(delay, withSequence(withTiming(reverse ? values.
|
|
27
|
-
width: delayFunction(delay, withSequence(withTiming(reverse ? values.
|
|
28
|
-
height: delayFunction(delay, withSequence(withTiming(reverse ? values.
|
|
25
|
+
originX: delayFunction(delay, withSequence(withTiming(reverse ? values.currentOriginX : values.targetOriginX, config), withTiming(values.targetOriginX, config))),
|
|
26
|
+
originY: delayFunction(delay, withSequence(withTiming(reverse ? values.targetOriginY : values.currentOriginY, config), withTiming(values.targetOriginY, config))),
|
|
27
|
+
width: delayFunction(delay, withSequence(withTiming(reverse ? values.currentWidth : values.targetWidth, config), withTiming(values.targetWidth, config))),
|
|
28
|
+
height: delayFunction(delay, withSequence(withTiming(reverse ? values.targetHeight : values.currentHeight, config), withTiming(values.targetHeight, config))),
|
|
29
29
|
},
|
|
30
30
|
callback: callback,
|
|
31
31
|
};
|
package/lib/reanimated2/mock.js
CHANGED
|
@@ -6,14 +6,16 @@ const NOOP = () => {
|
|
|
6
6
|
// noop
|
|
7
7
|
};
|
|
8
8
|
const ID = (t) => t;
|
|
9
|
+
const IMMEDIATE_CB_INVOCATION = (cb) => cb();
|
|
9
10
|
const ReanimatedV2 = {
|
|
10
11
|
useSharedValue: (v) => ({ value: v }),
|
|
11
12
|
useDerivedValue: (a) => ({ value: a() }),
|
|
12
13
|
useAnimatedScrollHandler: () => NOOP,
|
|
13
14
|
useAnimatedGestureHandler: () => NOOP,
|
|
14
|
-
useAnimatedStyle:
|
|
15
|
+
useAnimatedStyle: IMMEDIATE_CB_INVOCATION,
|
|
15
16
|
useAnimatedRef: () => ({ current: null }),
|
|
16
17
|
useAnimatedReaction: NOOP,
|
|
18
|
+
useAnimatedProps: IMMEDIATE_CB_INVOCATION,
|
|
17
19
|
withTiming: (toValue, _, cb) => {
|
|
18
20
|
cb && cb(true);
|
|
19
21
|
return toValue;
|
package/lib/setAndForwardRef.js
CHANGED
|
@@ -1,53 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* imported from react-native
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* getForwardedRef: () => this.props.forwardedRef,
|
|
19
|
-
* setLocalRef: ref => {
|
|
20
|
-
* this._nativeRef = ref;
|
|
21
|
-
* },
|
|
22
|
-
* });
|
|
23
|
-
*
|
|
24
|
-
* render() {
|
|
25
|
-
* return <View ref={this._setNativeRef} />;
|
|
26
|
-
* }
|
|
27
|
-
* }
|
|
28
|
-
*
|
|
29
|
-
* const MyViewWithRef = React.forwardRef((props, ref) => (
|
|
30
|
-
* <MyView {...props} forwardedRef={ref} />
|
|
31
|
-
* ));
|
|
32
|
-
*
|
|
33
|
-
* module.exports = MyViewWithRef;
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
function setAndForwardRef({ getForwardedRef, setLocalRef }) {
|
|
37
|
-
return function forwardRef(ref) {
|
|
38
|
-
const forwardedRef = getForwardedRef();
|
|
39
|
-
|
|
40
|
-
setLocalRef(ref);
|
|
41
|
-
|
|
42
|
-
// Forward to user ref prop (if one has been specified)
|
|
43
|
-
if (typeof forwardedRef === 'function') {
|
|
44
|
-
// Handle function-based refs. String-based refs are handled as functions.
|
|
45
|
-
forwardedRef(ref);
|
|
46
|
-
} else if (typeof forwardedRef === 'object' && forwardedRef != null) {
|
|
47
|
-
// Handle createRef-based refs
|
|
48
|
-
forwardedRef.current = ref;
|
|
49
|
-
}
|
|
50
|
-
};
|
|
4
|
+
function setAndForwardRef({ getForwardedRef, setLocalRef, }) {
|
|
5
|
+
return function forwardRef(ref) {
|
|
6
|
+
const forwardedRef = getForwardedRef();
|
|
7
|
+
setLocalRef(ref);
|
|
8
|
+
// Forward to user ref prop (if one has been specified)
|
|
9
|
+
if (typeof forwardedRef === 'function') {
|
|
10
|
+
// Handle function-based refs. String-based refs are handled as functions.
|
|
11
|
+
forwardedRef(ref);
|
|
12
|
+
}
|
|
13
|
+
else if (typeof forwardedRef === 'object' && forwardedRef != null) {
|
|
14
|
+
// Handle createRef-based refs
|
|
15
|
+
forwardedRef.current = ref;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
51
18
|
}
|
|
52
|
-
|
|
53
19
|
export default setAndForwardRef;
|
package/mock.js
CHANGED
package/package.json
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-reanimated",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.1",
|
|
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",
|
|
7
|
-
"test": "yarn run format && yarn run lint
|
|
7
|
+
"test": "yarn run format:js && yarn run lint:js && yarn run test:unit",
|
|
8
8
|
"test:unit": "jest",
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"lint
|
|
12
|
-
"lint
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
9
|
+
"lint": "yarn lint:js && yarn lint:cpp && yarn lint:java",
|
|
10
|
+
"lint:js": "eslint --ext '.js,.ts,.tsx' src/ && yarn prettier --check src/",
|
|
11
|
+
"lint:java": "./android/gradlew -p android spotlessCheck -q",
|
|
12
|
+
"lint:cpp": "./scripts/cpplint.sh",
|
|
13
|
+
"format": "yarn format:js && yarn format:java && yarn format:ios && yarn format:android && yarn format:common",
|
|
14
|
+
"format:js": "prettier --write --list-different './src/'",
|
|
15
|
+
"format:java": "node ./scripts/format-java.js",
|
|
16
|
+
"format:ios": "find ios/ -iname *.h -o -iname *.m -o -iname *.mm -o -iname *.cpp | xargs clang-format -i",
|
|
17
|
+
"format:android": "find android/src/ -iname *.h -o -iname *.cpp | xargs clang-format -i",
|
|
18
|
+
"format:common": "find Common/ -iname *.h -o -iname *.cpp | xargs clang-format -i",
|
|
18
19
|
"release": "npm login && release-it",
|
|
19
20
|
"type:check": "yarn tsc --noEmit",
|
|
20
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",
|
|
@@ -22,7 +23,8 @@
|
|
|
22
23
|
"type:generate:cp-js-src": "cp -RL src/ lib/",
|
|
23
24
|
"type:generate:tsc": "yarn tsc",
|
|
24
25
|
"type:generate:remove.ts": "find ./lib -type f -name \"*.ts\" -and -not -name \"*.d.ts\" -delete",
|
|
25
|
-
"type:generate:remove.tsx": "find ./lib -type f -name \"*.tsx\" -and -not -name \"*.d.ts\" -delete"
|
|
26
|
+
"type:generate:remove.tsx": "find ./lib -type f -name \"*.tsx\" -and -not -name \"*.d.ts\" -delete",
|
|
27
|
+
"prepare": "husky install"
|
|
26
28
|
},
|
|
27
29
|
"main": "lib/Animated.js",
|
|
28
30
|
"module": "lib/Animated",
|
|
@@ -46,6 +48,7 @@
|
|
|
46
48
|
"react-native-reanimated.d.ts",
|
|
47
49
|
"mock.js",
|
|
48
50
|
"plugin.js",
|
|
51
|
+
"expo-module.config.json",
|
|
49
52
|
"!__snapshots__",
|
|
50
53
|
"!*.test.js",
|
|
51
54
|
"!*.test.js.map"
|
|
@@ -66,6 +69,7 @@
|
|
|
66
69
|
"homepage": "https://github.com/software-mansion/react-native-reanimated#readme",
|
|
67
70
|
"dependencies": {
|
|
68
71
|
"@babel/plugin-transform-object-assign": "^7.10.4",
|
|
72
|
+
"@types/invariant": "^2.2.35",
|
|
69
73
|
"invariant": "^2.2.4",
|
|
70
74
|
"lodash.isequal": "^4.5.0",
|
|
71
75
|
"mockdate": "^3.0.2",
|
|
@@ -107,28 +111,28 @@
|
|
|
107
111
|
"eslint-plugin-node": "^10.0.0",
|
|
108
112
|
"eslint-plugin-promise": "^4.2.1",
|
|
109
113
|
"eslint-plugin-standard": "^4.0.1",
|
|
110
|
-
"husky": "^
|
|
114
|
+
"husky": "^7.0.0",
|
|
111
115
|
"jest": "^26.6.3",
|
|
112
|
-
"lint-staged": "^
|
|
116
|
+
"lint-staged": "^11.2.0",
|
|
113
117
|
"prettier": "^2.2.1",
|
|
114
118
|
"react": "17.0.2",
|
|
115
|
-
"react-native": "0.
|
|
119
|
+
"react-native": "0.67.0-rc.4",
|
|
116
120
|
"react-native-codegen": "^0.0.7",
|
|
117
121
|
"react-native-gesture-handler": "^1.6.1",
|
|
118
122
|
"react-test-renderer": "17.0.2",
|
|
119
|
-
"release-it": "^13.
|
|
123
|
+
"release-it": "^13.7.2",
|
|
120
124
|
"typescript": "^4.1.3"
|
|
121
125
|
},
|
|
122
126
|
"lint-staged": {
|
|
123
127
|
"*.(js|ts|tsx)": [
|
|
124
|
-
"eslint --ext '.js,.ts,.tsx' src/ --ignore-pattern src/reanimated1 --ignore-pattern react-native-reanimated.d.ts",
|
|
128
|
+
"eslint --ext '.js,.ts,.tsx' src/ --ignore-pattern src/reanimated1 --ignore-pattern react-native-reanimated.d.ts --ignore-pattern docs",
|
|
125
129
|
"prettier --write"
|
|
126
|
-
]
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
"
|
|
130
|
-
|
|
131
|
-
}
|
|
130
|
+
],
|
|
131
|
+
"**/*.{h,cpp}": "yarn lint:cpp",
|
|
132
|
+
"android/src/**/*.java": "yarn format:java",
|
|
133
|
+
"android/src/**/*.{h,cpp}": "yarn format:android",
|
|
134
|
+
"ios/**/*.{h,m,mm,cpp}": "yarn format:ios",
|
|
135
|
+
"Common/**/*.{h,cpp}": "yarn format:common"
|
|
132
136
|
},
|
|
133
137
|
"release-it": {
|
|
134
138
|
"hooks": {
|