react-native-reanimated 3.0.0-rc.4 → 3.0.0-rc.6
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/LayoutAnimations/LayoutAnimationsProxy.cpp +97 -15
- package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.h +32 -8
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +16 -1
- package/Common/cpp/NativeModules/NativeReanimatedModule.h +8 -1
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +17 -0
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.h +8 -0
- package/Common/cpp/ReanimatedRuntime/ReanimatedRuntime.cpp +2 -1
- package/Common/cpp/ReanimatedRuntime/ReanimatedRuntime.h +1 -0
- package/Common/cpp/Tools/RuntimeDecorator.cpp +2 -1
- package/android/CMakeLists.txt +1 -0
- package/android/build.gradle +9 -1
- package/android/src/fabric/java/com/swmansion/reanimated/NativeProxy.java +16 -25
- package/android/src/main/cpp/LayoutAnimations.cpp +42 -50
- package/android/src/main/cpp/LayoutAnimations.h +17 -3
- package/android/src/main/cpp/NativeProxy.cpp +55 -6
- package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +1 -1
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +208 -223
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/LayoutAnimations.java +7 -5
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/NativeMethodsHolder.java +5 -3
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ViewHierarchyObserver.java +1 -1
- package/android/src/paper/java/com/swmansion/reanimated/NativeProxy.java +20 -7
- package/android/src/reactNativeVersionPatch/nativeHierarchyManager/62/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +8 -44
- package/android/src/reactNativeVersionPatch/nativeHierarchyManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +15 -61
- package/ios/LayoutReanimation/REAAnimationsManager.h +18 -8
- package/ios/LayoutReanimation/REAAnimationsManager.m +197 -162
- package/ios/LayoutReanimation/REAUIManager.mm +63 -70
- package/ios/native/NativeProxy.mm +55 -48
- package/lib/commonjs/createAnimatedComponent.js +26 -26
- package/lib/commonjs/createAnimatedComponent.js.map +1 -1
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +4 -0
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/commonjs/reanimated2/core.js +9 -9
- package/lib/commonjs/reanimated2/core.js.map +1 -1
- package/lib/commonjs/reanimated2/globals.d.js.map +1 -1
- package/lib/commonjs/reanimated2/jestUtils.js +17 -9
- package/lib/commonjs/reanimated2/jestUtils.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/LayoutAnimationRepository.js +23 -62
- package/lib/commonjs/reanimated2/layoutReanimation/LayoutAnimationRepository.js.map +1 -1
- package/lib/module/createAnimatedComponent.js +27 -26
- package/lib/module/createAnimatedComponent.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +4 -0
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/module/reanimated2/core.js +7 -9
- package/lib/module/reanimated2/core.js.map +1 -1
- package/lib/module/reanimated2/globals.d.js.map +1 -1
- package/lib/module/reanimated2/jestUtils.js +17 -9
- package/lib/module/reanimated2/jestUtils.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/LayoutAnimationRepository.js +22 -61
- package/lib/module/reanimated2/layoutReanimation/LayoutAnimationRepository.js.map +1 -1
- package/package.json +2 -2
- package/src/createAnimatedComponent.tsx +48 -39
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +15 -0
- package/src/reanimated2/core.ts +19 -10
- package/src/reanimated2/globals.d.ts +10 -6
- package/src/reanimated2/jestUtils.ts +14 -6
- package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.ts +24 -50
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Default.js +0 -55
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Default.js.map +0 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Default.js +0 -40
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Default.js.map +0 -1
- package/src/reanimated2/layoutReanimation/defaultAnimations/Default.ts +0 -49
|
@@ -188,13 +188,21 @@ export const advanceAnimationByFrame = (count) => {
|
|
|
188
188
|
};
|
|
189
189
|
|
|
190
190
|
export const setUpTests = (userConfig = {}) => {
|
|
191
|
-
let expect;
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
} catch (_) {
|
|
195
|
-
// for Jest in version 28+
|
|
196
|
-
const { expect: expectModule } = require('@jest/globals');
|
|
191
|
+
let expect = global.expect;
|
|
192
|
+
if (expect === undefined) {
|
|
193
|
+
const expectModule = require('expect');
|
|
197
194
|
expect = expectModule;
|
|
195
|
+
// Starting from Jest 28, "expect" package uses named exports instead of default export.
|
|
196
|
+
// So, requiring "expect" package doesn't give direct access to "expect" function anymore.
|
|
197
|
+
// It gives access to the module object instead.
|
|
198
|
+
// We use this info to detect if the project uses Jest 28 or higher.
|
|
199
|
+
if (typeof expect === 'object') {
|
|
200
|
+
const jestGlobals = require('@jest/globals');
|
|
201
|
+
expect = jestGlobals.expect;
|
|
202
|
+
}
|
|
203
|
+
if (expect === undefined || expect.extend === undefined) {
|
|
204
|
+
expect = expectModule.default;
|
|
205
|
+
}
|
|
198
206
|
}
|
|
199
207
|
|
|
200
208
|
require('setimmediate');
|
|
@@ -1,75 +1,49 @@
|
|
|
1
1
|
/* global _stopObservingProgress, _startObservingProgress */
|
|
2
2
|
import { runOnUI } from '../core';
|
|
3
3
|
import { withStyleAnimation } from '../animation/styleAnimation';
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { LogBox } from 'react-native';
|
|
5
|
+
|
|
6
|
+
LogBox.ignoreLogs(['Overriding previous layout animation with']);
|
|
6
7
|
|
|
7
8
|
runOnUI(() => {
|
|
8
9
|
'worklet';
|
|
9
10
|
|
|
10
|
-
const configs: Record<string, any> = Object.create(null);
|
|
11
11
|
const enteringAnimationForTag: Record<string, any> = {};
|
|
12
12
|
|
|
13
13
|
global.LayoutAnimationRepository = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
configs[tag] = config;
|
|
17
|
-
enteringAnimationForTag[tag] = null;
|
|
18
|
-
},
|
|
19
|
-
removeConfig(tag) {
|
|
20
|
-
delete configs[tag];
|
|
21
|
-
delete enteringAnimationForTag[tag];
|
|
22
|
-
},
|
|
23
|
-
startAnimationForTag(tag, type, yogaValues) {
|
|
24
|
-
if (configs[tag] == null) {
|
|
25
|
-
return; // :(
|
|
26
|
-
}
|
|
27
|
-
const style = configs[tag][type](yogaValues);
|
|
14
|
+
startAnimationForTag(tag, type, yogaValues, config, viewSharedValue) {
|
|
15
|
+
const style = config(yogaValues);
|
|
28
16
|
let currentAnimation = style.animations;
|
|
29
|
-
if (type === 'entering') {
|
|
30
|
-
enteringAnimationForTag[tag] = style;
|
|
31
|
-
} else if (type === 'layout' && enteringAnimationForTag[tag] !== null) {
|
|
32
|
-
const entryAniamtion = enteringAnimationForTag[tag].animations;
|
|
33
|
-
const layoutAnimation = style.animations;
|
|
34
|
-
currentAnimation = {};
|
|
35
|
-
for (const key in entryAniamtion) {
|
|
36
|
-
currentAnimation[key] = entryAniamtion[key];
|
|
37
|
-
}
|
|
38
|
-
for (const key in layoutAnimation) {
|
|
39
|
-
currentAnimation[key] = layoutAnimation[key];
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const sv: { value: boolean; _value: boolean } = configs[tag].sv;
|
|
44
|
-
_stopObservingProgress(tag, false);
|
|
45
|
-
_startObservingProgress(tag, sv);
|
|
46
17
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
18
|
+
if (type === 'entering') {
|
|
19
|
+
enteringAnimationForTag[tag] = currentAnimation;
|
|
20
|
+
} else if (type === 'layout') {
|
|
21
|
+
// When layout animation is requested, but entering is still running, we merge
|
|
22
|
+
// new layout animation targets into the ongoing animation
|
|
23
|
+
const enteringAnimation = enteringAnimationForTag[tag];
|
|
24
|
+
if (enteringAnimation) {
|
|
25
|
+
currentAnimation = { ...enteringAnimation, ...style.animations };
|
|
53
26
|
}
|
|
54
27
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
28
|
+
_stopObservingProgress(tag, false, false);
|
|
29
|
+
viewSharedValue._value = Object.assign(
|
|
30
|
+
{},
|
|
31
|
+
viewSharedValue._value,
|
|
32
|
+
style.initialValues
|
|
33
|
+
);
|
|
58
34
|
const animation = withStyleAnimation(currentAnimation);
|
|
59
35
|
|
|
60
36
|
animation.callback = (finished?: boolean) => {
|
|
61
37
|
if (finished) {
|
|
62
|
-
|
|
38
|
+
delete enteringAnimationForTag[tag];
|
|
39
|
+
const shouldRemoveView = type === 'exiting';
|
|
40
|
+
_stopObservingProgress(tag, finished, shouldRemoveView);
|
|
63
41
|
}
|
|
64
42
|
style.callback && style.callback(finished);
|
|
65
43
|
};
|
|
66
44
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
configs[tag].sv.value = animation;
|
|
72
|
-
_startObservingProgress(tag, sv);
|
|
45
|
+
viewSharedValue.value = animation;
|
|
46
|
+
_startObservingProgress(tag, viewSharedValue, type);
|
|
73
47
|
},
|
|
74
48
|
};
|
|
75
49
|
})();
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.DefaultLayout = exports.DefaultExiting = exports.DefaultEntering = void 0;
|
|
7
|
-
|
|
8
|
-
const DefaultLayout = values => {
|
|
9
|
-
'worklet';
|
|
10
|
-
|
|
11
|
-
return {
|
|
12
|
-
initialValues: {
|
|
13
|
-
originX: values.targetOriginX,
|
|
14
|
-
originY: values.targetOriginY,
|
|
15
|
-
width: values.targetWidth,
|
|
16
|
-
height: values.targetHeight
|
|
17
|
-
},
|
|
18
|
-
animations: {}
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
exports.DefaultLayout = DefaultLayout;
|
|
23
|
-
|
|
24
|
-
const DefaultEntering = values => {
|
|
25
|
-
'worklet';
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
initialValues: {
|
|
29
|
-
originX: values.targetOriginX,
|
|
30
|
-
originY: values.targetOriginY,
|
|
31
|
-
width: values.targetWidth,
|
|
32
|
-
height: values.targetHeight
|
|
33
|
-
},
|
|
34
|
-
animations: {}
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
exports.DefaultEntering = DefaultEntering;
|
|
39
|
-
|
|
40
|
-
const DefaultExiting = values => {
|
|
41
|
-
'worklet';
|
|
42
|
-
|
|
43
|
-
return {
|
|
44
|
-
initialValues: {
|
|
45
|
-
originX: values.currentOriginX,
|
|
46
|
-
originY: values.currentOriginY,
|
|
47
|
-
width: values.currentWidth,
|
|
48
|
-
height: values.currentHeight
|
|
49
|
-
},
|
|
50
|
-
animations: {}
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
exports.DefaultExiting = DefaultExiting;
|
|
55
|
-
//# sourceMappingURL=Default.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["DefaultLayout","values","initialValues","originX","targetOriginX","originY","targetOriginY","width","targetWidth","height","targetHeight","animations","DefaultEntering","DefaultExiting","currentOriginX","currentOriginY","currentWidth","currentHeight"],"sources":["Default.ts"],"sourcesContent":["import {\n LayoutAnimationFunction,\n EntryAnimationsValues,\n ExitAnimationsValues,\n AnimationConfigFunction,\n} from '../animationBuilder/commonTypes';\n\nexport const DefaultLayout: LayoutAnimationFunction = (values) => {\n 'worklet';\n return {\n initialValues: {\n originX: values.targetOriginX,\n originY: values.targetOriginY,\n width: values.targetWidth,\n height: values.targetHeight,\n },\n animations: {},\n };\n};\n\nexport const DefaultEntering: AnimationConfigFunction<EntryAnimationsValues> = (\n values\n) => {\n 'worklet';\n return {\n initialValues: {\n originX: values.targetOriginX,\n originY: values.targetOriginY,\n width: values.targetWidth,\n height: values.targetHeight,\n },\n animations: {},\n };\n};\n\nexport const DefaultExiting: AnimationConfigFunction<ExitAnimationsValues> = (\n values\n) => {\n 'worklet';\n return {\n initialValues: {\n originX: values.currentOriginX,\n originY: values.currentOriginY,\n width: values.currentWidth,\n height: values.currentHeight,\n },\n animations: {},\n };\n};\n"],"mappings":";;;;;;;AAOO,MAAMA,aAAsC,GAAIC,MAAD,IAAY;EAChE;;EACA,OAAO;IACLC,aAAa,EAAE;MACbC,OAAO,EAAEF,MAAM,CAACG,aADH;MAEbC,OAAO,EAAEJ,MAAM,CAACK,aAFH;MAGbC,KAAK,EAAEN,MAAM,CAACO,WAHD;MAIbC,MAAM,EAAER,MAAM,CAACS;IAJF,CADV;IAOLC,UAAU,EAAE;EAPP,CAAP;AASD,CAXM;;;;AAaA,MAAMC,eAA+D,GAC1EX,MAD6E,IAE1E;EACH;;EACA,OAAO;IACLC,aAAa,EAAE;MACbC,OAAO,EAAEF,MAAM,CAACG,aADH;MAEbC,OAAO,EAAEJ,MAAM,CAACK,aAFH;MAGbC,KAAK,EAAEN,MAAM,CAACO,WAHD;MAIbC,MAAM,EAAER,MAAM,CAACS;IAJF,CADV;IAOLC,UAAU,EAAE;EAPP,CAAP;AASD,CAbM;;;;AAeA,MAAME,cAA6D,GACxEZ,MAD2E,IAExE;EACH;;EACA,OAAO;IACLC,aAAa,EAAE;MACbC,OAAO,EAAEF,MAAM,CAACa,cADH;MAEbT,OAAO,EAAEJ,MAAM,CAACc,cAFH;MAGbR,KAAK,EAAEN,MAAM,CAACe,YAHD;MAIbP,MAAM,EAAER,MAAM,CAACgB;IAJF,CADV;IAOLN,UAAU,EAAE;EAPP,CAAP;AASD,CAbM"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export const DefaultLayout = values => {
|
|
2
|
-
'worklet';
|
|
3
|
-
|
|
4
|
-
return {
|
|
5
|
-
initialValues: {
|
|
6
|
-
originX: values.targetOriginX,
|
|
7
|
-
originY: values.targetOriginY,
|
|
8
|
-
width: values.targetWidth,
|
|
9
|
-
height: values.targetHeight
|
|
10
|
-
},
|
|
11
|
-
animations: {}
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
export const DefaultEntering = values => {
|
|
15
|
-
'worklet';
|
|
16
|
-
|
|
17
|
-
return {
|
|
18
|
-
initialValues: {
|
|
19
|
-
originX: values.targetOriginX,
|
|
20
|
-
originY: values.targetOriginY,
|
|
21
|
-
width: values.targetWidth,
|
|
22
|
-
height: values.targetHeight
|
|
23
|
-
},
|
|
24
|
-
animations: {}
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
export const DefaultExiting = values => {
|
|
28
|
-
'worklet';
|
|
29
|
-
|
|
30
|
-
return {
|
|
31
|
-
initialValues: {
|
|
32
|
-
originX: values.currentOriginX,
|
|
33
|
-
originY: values.currentOriginY,
|
|
34
|
-
width: values.currentWidth,
|
|
35
|
-
height: values.currentHeight
|
|
36
|
-
},
|
|
37
|
-
animations: {}
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
//# sourceMappingURL=Default.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["DefaultLayout","values","initialValues","originX","targetOriginX","originY","targetOriginY","width","targetWidth","height","targetHeight","animations","DefaultEntering","DefaultExiting","currentOriginX","currentOriginY","currentWidth","currentHeight"],"sources":["Default.ts"],"sourcesContent":["import {\n LayoutAnimationFunction,\n EntryAnimationsValues,\n ExitAnimationsValues,\n AnimationConfigFunction,\n} from '../animationBuilder/commonTypes';\n\nexport const DefaultLayout: LayoutAnimationFunction = (values) => {\n 'worklet';\n return {\n initialValues: {\n originX: values.targetOriginX,\n originY: values.targetOriginY,\n width: values.targetWidth,\n height: values.targetHeight,\n },\n animations: {},\n };\n};\n\nexport const DefaultEntering: AnimationConfigFunction<EntryAnimationsValues> = (\n values\n) => {\n 'worklet';\n return {\n initialValues: {\n originX: values.targetOriginX,\n originY: values.targetOriginY,\n width: values.targetWidth,\n height: values.targetHeight,\n },\n animations: {},\n };\n};\n\nexport const DefaultExiting: AnimationConfigFunction<ExitAnimationsValues> = (\n values\n) => {\n 'worklet';\n return {\n initialValues: {\n originX: values.currentOriginX,\n originY: values.currentOriginY,\n width: values.currentWidth,\n height: values.currentHeight,\n },\n animations: {},\n };\n};\n"],"mappings":"AAOA,OAAO,MAAMA,aAAsC,GAAIC,MAAD,IAAY;EAChE;;EACA,OAAO;IACLC,aAAa,EAAE;MACbC,OAAO,EAAEF,MAAM,CAACG,aADH;MAEbC,OAAO,EAAEJ,MAAM,CAACK,aAFH;MAGbC,KAAK,EAAEN,MAAM,CAACO,WAHD;MAIbC,MAAM,EAAER,MAAM,CAACS;IAJF,CADV;IAOLC,UAAU,EAAE;EAPP,CAAP;AASD,CAXM;AAaP,OAAO,MAAMC,eAA+D,GAC1EX,MAD6E,IAE1E;EACH;;EACA,OAAO;IACLC,aAAa,EAAE;MACbC,OAAO,EAAEF,MAAM,CAACG,aADH;MAEbC,OAAO,EAAEJ,MAAM,CAACK,aAFH;MAGbC,KAAK,EAAEN,MAAM,CAACO,WAHD;MAIbC,MAAM,EAAER,MAAM,CAACS;IAJF,CADV;IAOLC,UAAU,EAAE;EAPP,CAAP;AASD,CAbM;AAeP,OAAO,MAAME,cAA6D,GACxEZ,MAD2E,IAExE;EACH;;EACA,OAAO;IACLC,aAAa,EAAE;MACbC,OAAO,EAAEF,MAAM,CAACa,cADH;MAEbT,OAAO,EAAEJ,MAAM,CAACc,cAFH;MAGbR,KAAK,EAAEN,MAAM,CAACe,YAHD;MAIbP,MAAM,EAAER,MAAM,CAACgB;IAJF,CADV;IAOLN,UAAU,EAAE;EAPP,CAAP;AASD,CAbM"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
LayoutAnimationFunction,
|
|
3
|
-
EntryAnimationsValues,
|
|
4
|
-
ExitAnimationsValues,
|
|
5
|
-
AnimationConfigFunction,
|
|
6
|
-
} from '../animationBuilder/commonTypes';
|
|
7
|
-
|
|
8
|
-
export const DefaultLayout: LayoutAnimationFunction = (values) => {
|
|
9
|
-
'worklet';
|
|
10
|
-
return {
|
|
11
|
-
initialValues: {
|
|
12
|
-
originX: values.targetOriginX,
|
|
13
|
-
originY: values.targetOriginY,
|
|
14
|
-
width: values.targetWidth,
|
|
15
|
-
height: values.targetHeight,
|
|
16
|
-
},
|
|
17
|
-
animations: {},
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const DefaultEntering: AnimationConfigFunction<EntryAnimationsValues> = (
|
|
22
|
-
values
|
|
23
|
-
) => {
|
|
24
|
-
'worklet';
|
|
25
|
-
return {
|
|
26
|
-
initialValues: {
|
|
27
|
-
originX: values.targetOriginX,
|
|
28
|
-
originY: values.targetOriginY,
|
|
29
|
-
width: values.targetWidth,
|
|
30
|
-
height: values.targetHeight,
|
|
31
|
-
},
|
|
32
|
-
animations: {},
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const DefaultExiting: AnimationConfigFunction<ExitAnimationsValues> = (
|
|
37
|
-
values
|
|
38
|
-
) => {
|
|
39
|
-
'worklet';
|
|
40
|
-
return {
|
|
41
|
-
initialValues: {
|
|
42
|
-
originX: values.currentOriginX,
|
|
43
|
-
originY: values.currentOriginY,
|
|
44
|
-
width: values.currentWidth,
|
|
45
|
-
height: values.currentHeight,
|
|
46
|
-
},
|
|
47
|
-
animations: {},
|
|
48
|
-
};
|
|
49
|
-
};
|