react-native-reanimated 2.3.0-beta.4 → 2.3.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/Tools/RuntimeDecorator.cpp +17 -0
- package/android/build.gradle +2 -0
- package/android/expo/linking.gradle +34 -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 +64 -19
- package/ios/native/REAInitializer.mm +3 -4
- package/lib/Animated.js +3 -5
- package/lib/createAnimatedComponent.js +4 -2
- package/lib/index.js +3 -5
- package/lib/reanimated1/core/Core.test.js +1 -1
- 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 +3 -0
- package/lib/reanimated2/globals.d.ts +3 -0
- 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 +15 -15
- 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 +2 -2
- 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/package.json +3 -2
- package/plugin.js +2 -1
- package/react-native-reanimated.d.ts +37 -21
- package/src/Animated.js +3 -5
- package/src/createAnimatedComponent.tsx +13 -5
- package/src/reanimated1/core/Core.test.js +1 -1
- 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 +3 -0
- package/src/reanimated2/globals.d.ts +3 -0
- 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 +48 -33
- 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 +8 -8
- 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
|
@@ -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,7 +117,7 @@ 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
123
|
originY: -height,
|
|
@@ -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
|
};
|
|
@@ -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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-reanimated",
|
|
3
|
-
"version": "2.3.0
|
|
3
|
+
"version": "2.3.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",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"react-native-reanimated.d.ts",
|
|
49
49
|
"mock.js",
|
|
50
50
|
"plugin.js",
|
|
51
|
+
"expo-module.config.json",
|
|
51
52
|
"!__snapshots__",
|
|
52
53
|
"!*.test.js",
|
|
53
54
|
"!*.test.js.map"
|
|
@@ -115,7 +116,7 @@
|
|
|
115
116
|
"lint-staged": "^11.2.0",
|
|
116
117
|
"prettier": "^2.2.1",
|
|
117
118
|
"react": "17.0.2",
|
|
118
|
-
"react-native": "0.67.0-rc.
|
|
119
|
+
"react-native": "0.67.0-rc.4",
|
|
119
120
|
"react-native-codegen": "^0.0.7",
|
|
120
121
|
"react-native-gesture-handler": "^1.6.1",
|
|
121
122
|
"react-test-renderer": "17.0.2",
|
package/plugin.js
CHANGED
|
@@ -146,7 +146,7 @@ const gestureHandlerGestureObjects = new Set([
|
|
|
146
146
|
'LongPress',
|
|
147
147
|
'ForceTouch',
|
|
148
148
|
'Native',
|
|
149
|
-
'
|
|
149
|
+
'Manual',
|
|
150
150
|
'Race',
|
|
151
151
|
'Simultaneous',
|
|
152
152
|
'Exclusive',
|
|
@@ -156,6 +156,7 @@ const gestureHandlerBuilderMethods = new Set([
|
|
|
156
156
|
'onBegin',
|
|
157
157
|
'onStart',
|
|
158
158
|
'onEnd',
|
|
159
|
+
'onFinalize',
|
|
159
160
|
'onUpdate',
|
|
160
161
|
'onTouchesDown',
|
|
161
162
|
'onTouchesMove',
|
|
@@ -26,6 +26,7 @@ declare module 'react-native-reanimated' {
|
|
|
26
26
|
Text as ReactNativeText,
|
|
27
27
|
Image as ReactNativeImage,
|
|
28
28
|
ScrollView as ReactNativeScrollView,
|
|
29
|
+
FlatList as ReactNativeFlatList,
|
|
29
30
|
NativeScrollEvent,
|
|
30
31
|
NativeSyntheticEvent,
|
|
31
32
|
ColorValue,
|
|
@@ -256,6 +257,10 @@ declare module 'react-native-reanimated' {
|
|
|
256
257
|
getNode(): ReactNativeScrollView;
|
|
257
258
|
}
|
|
258
259
|
export class Code extends Component<CodeProps> {}
|
|
260
|
+
export class FlatList extends Component<AnimateProps<FlatList>> {
|
|
261
|
+
itemLayoutAnimation: ILayoutAnimationBuilder;
|
|
262
|
+
getNode(): ReactNativeFlatList;
|
|
263
|
+
}
|
|
259
264
|
|
|
260
265
|
type Options<P> = {
|
|
261
266
|
setNativeProps: (ref: any, props: P) => void;
|
|
@@ -451,34 +456,45 @@ declare module 'react-native-reanimated' {
|
|
|
451
456
|
animations: AnimateStyle;
|
|
452
457
|
};
|
|
453
458
|
|
|
454
|
-
export
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
}
|
|
459
|
+
export interface EntryAnimationsValues {
|
|
460
|
+
targetOriginX: number;
|
|
461
|
+
targetOriginY: number;
|
|
462
|
+
targetWidth: number;
|
|
463
|
+
targetHeight: number;
|
|
464
|
+
targetGlobalOriginX: number;
|
|
465
|
+
targetGlobalOriginY: number;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
export interface ExitAnimationsValues {
|
|
469
|
+
currentOriginX: number;
|
|
470
|
+
currentOriginY: number;
|
|
471
|
+
currentWidth: number;
|
|
472
|
+
currentHeight: number;
|
|
473
|
+
currentGlobalOriginX: number;
|
|
474
|
+
currentGlobalOriginY: number;
|
|
475
|
+
}
|
|
476
|
+
|
|
462
477
|
export type EntryExitAnimationFunction = (
|
|
463
|
-
targetValues:
|
|
478
|
+
targetValues: EntryAnimationsValues | ExitAnimationsValues
|
|
464
479
|
) => LayoutAnimation;
|
|
465
480
|
|
|
466
481
|
export type LayoutAnimationsValues = {
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
482
|
+
currentOriginX: number;
|
|
483
|
+
currentOriginY: number;
|
|
484
|
+
currentWidth: number;
|
|
485
|
+
currentHeight: number;
|
|
486
|
+
currentGlobalOriginX: number;
|
|
487
|
+
currentGlobalOriginY: number;
|
|
488
|
+
targetOriginX: number;
|
|
489
|
+
targetOriginY: number;
|
|
490
|
+
targetWidth: number;
|
|
491
|
+
targetHeight: number;
|
|
492
|
+
targetGlobalOriginX: number;
|
|
493
|
+
targetGlobalOriginY: number;
|
|
479
494
|
windowWidth: number;
|
|
480
495
|
windowHeight: number;
|
|
481
496
|
};
|
|
497
|
+
|
|
482
498
|
export type LayoutAnimationFunction = (
|
|
483
499
|
targetValues: LayoutAnimationsValues
|
|
484
500
|
) => LayoutAnimation;
|
package/src/Animated.js
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LogBox } from 'react-native';
|
|
2
2
|
import createAnimatedComponent from './createAnimatedComponent';
|
|
3
3
|
import {
|
|
4
4
|
addWhitelistedNativeProps,
|
|
5
5
|
addWhitelistedUIProps,
|
|
6
6
|
} from './ConfigHelper';
|
|
7
7
|
import * as reanimated1 from './reanimated1';
|
|
8
|
+
import ReanimatedComponents from './reanimated2/component';
|
|
8
9
|
|
|
9
10
|
const Animated = {
|
|
10
11
|
// components
|
|
11
|
-
|
|
12
|
-
Text: createAnimatedComponent(Text),
|
|
13
|
-
Image: createAnimatedComponent(Image),
|
|
14
|
-
ScrollView: createAnimatedComponent(ScrollView),
|
|
12
|
+
...ReanimatedComponents,
|
|
15
13
|
createAnimatedComponent,
|
|
16
14
|
// configuration
|
|
17
15
|
addWhitelistedNativeProps,
|
|
@@ -36,7 +36,7 @@ import { initialUpdaterRun } from './reanimated2/animation';
|
|
|
36
36
|
import {
|
|
37
37
|
BaseAnimationBuilder,
|
|
38
38
|
EntryExitAnimationFunction,
|
|
39
|
-
|
|
39
|
+
ILayoutAnimationBuilder,
|
|
40
40
|
} from './reanimated2/layoutReanimation';
|
|
41
41
|
import { SharedValue, StyleProps } from './reanimated2/commonTypes';
|
|
42
42
|
import {
|
|
@@ -100,12 +100,17 @@ function onlyAnimatedStyles(styles: StyleProps[]) {
|
|
|
100
100
|
return styles.filter((style) => style?.viewDescriptors);
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
function isSameAnimatedStyle(
|
|
103
|
+
function isSameAnimatedStyle(
|
|
104
|
+
style1?: StyleProps,
|
|
105
|
+
style2?: StyleProps
|
|
106
|
+
): boolean {
|
|
104
107
|
// We cannot use equality check to compare useAnimatedStyle outputs directly.
|
|
105
108
|
// Instead, we can compare its viewsRefs.
|
|
106
|
-
return style1
|
|
109
|
+
return style1?.viewsRef === style2?.viewsRef;
|
|
107
110
|
}
|
|
108
111
|
|
|
112
|
+
const isSameAnimatedProps = isSameAnimatedStyle;
|
|
113
|
+
|
|
109
114
|
const has = <K extends string>(
|
|
110
115
|
key: K,
|
|
111
116
|
x: unknown
|
|
@@ -133,7 +138,7 @@ export type AnimatedComponentProps<P extends Record<string, unknown>> = P & {
|
|
|
133
138
|
animatedStyle?: StyleProps;
|
|
134
139
|
layout?:
|
|
135
140
|
| BaseAnimationBuilder
|
|
136
|
-
|
|
|
141
|
+
| ILayoutAnimationBuilder
|
|
137
142
|
| typeof BaseAnimationBuilder;
|
|
138
143
|
entering?:
|
|
139
144
|
| BaseAnimationBuilder
|
|
@@ -481,7 +486,10 @@ export default function createAnimatedComponent(
|
|
|
481
486
|
});
|
|
482
487
|
|
|
483
488
|
// detach old animatedProps
|
|
484
|
-
if (
|
|
489
|
+
if (
|
|
490
|
+
prevAnimatedProps &&
|
|
491
|
+
!isSameAnimatedProps(prevAnimatedProps, this.props.animatedProps)
|
|
492
|
+
) {
|
|
485
493
|
prevAnimatedProps.viewDescriptors!.remove(viewTag as number);
|
|
486
494
|
}
|
|
487
495
|
|
|
@@ -5,7 +5,7 @@ import renderer from 'react-test-renderer';
|
|
|
5
5
|
|
|
6
6
|
jest.mock('../../ReanimatedEventEmitter');
|
|
7
7
|
jest.mock('../../ReanimatedModule');
|
|
8
|
-
jest.mock('../../reanimated2/NativeReanimated');
|
|
8
|
+
jest.mock('../../reanimated2/NativeReanimated/NativeReanimated');
|
|
9
9
|
|
|
10
10
|
describe('Core Animated components', () => {
|
|
11
11
|
xit('fails if something other then a node or function that returns a node is passed to Animated.Code exec prop', () => {
|