react-native-reanimated 4.0.1 → 4.0.3
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/reanimated/CSS/interpolation/groups/ArrayPropertiesInterpolator.cpp +13 -8
- package/Common/cpp/reanimated/CSS/interpolation/groups/RecordPropertiesInterpolator.cpp +13 -11
- package/Common/cpp/reanimated/CSS/interpolation/styles/TransitionStyleInterpolator.cpp +4 -3
- package/Common/cpp/reanimated/Fabric/updates/UpdatesRegistryManager.cpp +13 -14
- package/Common/cpp/reanimated/Fabric/updates/UpdatesRegistryManager.h +4 -2
- package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy.h +2 -2
- package/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.cpp +207 -23
- package/android/build.gradle +11 -15
- package/android/src/main/java/com/swmansion/reanimated/NativeProxy.java +93 -8
- package/lib/module/animation/spring/springUtils.js +3 -1
- package/lib/module/animation/spring/springUtils.js.map +1 -1
- package/lib/module/createAnimatedComponent/AnimatedComponent.js +0 -10
- package/lib/module/createAnimatedComponent/AnimatedComponent.js.map +1 -1
- package/lib/module/createAnimatedComponent/JSPropsUpdater.js +0 -5
- package/lib/module/createAnimatedComponent/JSPropsUpdater.js.map +1 -1
- package/lib/module/createAnimatedComponent/NativeEventsManager.js +1 -1
- package/lib/module/createAnimatedComponent/NativeEventsManager.js.map +1 -1
- package/lib/module/css/managers/CSSAnimationsManager.web.js +3 -1
- package/lib/module/css/managers/CSSAnimationsManager.web.js.map +1 -1
- package/lib/module/initializers.js +6 -1
- package/lib/module/initializers.js.map +1 -1
- package/lib/module/layoutReanimation/animationsManager.js +8 -5
- package/lib/module/layoutReanimation/animationsManager.js.map +1 -1
- package/lib/module/layoutReanimation/web/animationParser.js.map +1 -1
- package/lib/module/layoutReanimation/web/config.js.map +1 -1
- package/lib/module/layoutReanimation/web/createAnimation.js +12 -0
- package/lib/module/layoutReanimation/web/createAnimation.js.map +1 -1
- package/lib/module/platform-specific/jsVersion.js +1 -1
- package/lib/typescript/animation/spring/springUtils.d.ts.map +1 -1
- package/lib/typescript/createAnimatedComponent/AnimatedComponent.d.ts +0 -1
- package/lib/typescript/createAnimatedComponent/AnimatedComponent.d.ts.map +1 -1
- package/lib/typescript/createAnimatedComponent/JSPropsUpdater.d.ts +0 -1
- package/lib/typescript/createAnimatedComponent/JSPropsUpdater.d.ts.map +1 -1
- package/lib/typescript/css/managers/CSSAnimationsManager.web.d.ts.map +1 -1
- package/lib/typescript/layoutReanimation/animationsManager.d.ts.map +1 -1
- package/lib/typescript/layoutReanimation/web/animationParser.d.ts +3 -0
- package/lib/typescript/layoutReanimation/web/animationParser.d.ts.map +1 -1
- package/lib/typescript/layoutReanimation/web/config.d.ts +1 -1
- package/lib/typescript/layoutReanimation/web/config.d.ts.map +1 -1
- package/lib/typescript/layoutReanimation/web/createAnimation.d.ts.map +1 -1
- package/lib/typescript/platform-specific/jsVersion.d.ts +1 -1
- package/package.json +2 -2
- package/scripts/reanimated_utils.rb +1 -1
- package/src/animation/spring/springUtils.ts +3 -4
- package/src/createAnimatedComponent/AnimatedComponent.tsx +0 -16
- package/src/createAnimatedComponent/JSPropsUpdater.ts +0 -6
- package/src/createAnimatedComponent/NativeEventsManager.ts +1 -1
- package/src/css/managers/CSSAnimationsManager.web.ts +3 -1
- package/src/initializers.ts +5 -1
- package/src/layoutReanimation/animationsManager.ts +8 -5
- package/src/layoutReanimation/web/animationParser.ts +3 -0
- package/src/layoutReanimation/web/config.ts +4 -1
- package/src/layoutReanimation/web/createAnimation.ts +15 -0
- package/src/platform-specific/jsVersion.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JSPropsUpdater.d.ts","sourceRoot":"","sources":["../../../src/createAnimatedComponent/JSPropsUpdater.ts"],"names":[],"mappings":";AAIA,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACrB,0BAA0B,EAC1B,eAAe,EACf,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AAEvB,cAAM,oBAAqB,YAAW,eAAe;IACnD,OAAO,CAAC,MAAM,CAAC,sBAAsB,CAGjC
|
|
1
|
+
{"version":3,"file":"JSPropsUpdater.d.ts","sourceRoot":"","sources":["../../../src/createAnimatedComponent/JSPropsUpdater.ts"],"names":[],"mappings":";AAIA,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACrB,0BAA0B,EAC1B,eAAe,EACf,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AAEvB,cAAM,oBAAqB,YAAW,eAAe;IACnD,OAAO,CAAC,MAAM,CAAC,sBAAsB,CAGjC;IAEG,iBAAiB,CACtB,iBAAiB,EAAE,qBAAqB,EACxC,OAAO,EAAE,MAAM,EAAE;IAYZ,mBAAmB,CAAC,iBAAiB,EAAE,qBAAqB;IAS5D,WAAW,CAAC,UAAU,EAAE,gBAAgB,EAAE;CAMlD;AAED,cAAM,iBAAkB,YAAW,eAAe;IACzC,iBAAiB,CACtB,kBAAkB,EAAE,KAAK,CAAC,SAAS,CACjC,sBAAsB,CAAC,qBAAqB,CAAC,CAC9C,GACC,0BAA0B;IAKvB,mBAAmB,CACxB,kBAAkB,EAAE,KAAK,CAAC,SAAS,CACjC,sBAAsB,CAAC,qBAAqB,CAAC,CAC9C,GACC,0BAA0B;IAKvB,WAAW,CAAC,WAAW,EAAE,gBAAgB,EAAE;CAGnD;AAaD,QAAA,MAAM,cAAc,0CAAuB,CAAC;AAE5C,eAAe,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CSSAnimationsManager.web.d.ts","sourceRoot":"","sources":["../../../../src/css/managers/CSSAnimationsManager.web.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,oBAAoB,MAAM,gCAAgC,CAAC;AASlE,OAAO,KAAK,EAIV,8BAA8B,EAC/B,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAGjE,eAAO,MAAM,sBAAsB,cACtB,8BAA8B,CAAC,eAAe,CAAC,qEAEQ,CAAC;AASrE,MAAM,CAAC,OAAO,OAAO,oBAAqB,YAAW,qBAAqB;IACxE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwB;IAGhD,OAAO,CAAC,kBAAkB,CAA0C;gBAExD,OAAO,EAAE,qBAAqB;IAM1C,MAAM,CAAC,mBAAmB,EAAE,8BAA8B,GAAG,IAAI;IAgDjE,cAAc,IAAI,IAAI;
|
|
1
|
+
{"version":3,"file":"CSSAnimationsManager.web.d.ts","sourceRoot":"","sources":["../../../../src/css/managers/CSSAnimationsManager.web.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,oBAAoB,MAAM,gCAAgC,CAAC;AASlE,OAAO,KAAK,EAIV,8BAA8B,EAC/B,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAGjE,eAAO,MAAM,sBAAsB,cACtB,8BAA8B,CAAC,eAAe,CAAC,qEAEQ,CAAC;AASrE,MAAM,CAAC,OAAO,OAAO,oBAAqB,YAAW,qBAAqB;IACxE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwB;IAGhD,OAAO,CAAC,kBAAkB,CAA0C;gBAExD,OAAO,EAAE,qBAAqB;IAM1C,MAAM,CAAC,mBAAmB,EAAE,8BAA8B,GAAG,IAAI;IAgDjE,cAAc,IAAI,IAAI;IAMtB,OAAO,CAAC,MAAM;IAwBd,OAAO,CAAC,wBAAwB;IA2BhC,OAAO,CAAC,oBAAoB;CA4C7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animationsManager.d.ts","sourceRoot":"","sources":["../../../src/layoutReanimation/animationsManager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"animationsManager.d.ts","sourceRoot":"","sources":["../../../src/layoutReanimation/animationsManager.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEV,4BAA4B,EAG7B,MAAM,gBAAgB,CAAC;AA0BxB,iBAAS,4BAA4B,IAAI;IACvC,KAAK,EAAE,4BAA4B,CAAC;IACpC,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B,CA8DA;AASD,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAC9C,OAAO,4BAA4B,CACpC,CAAC"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { EasingFunction } from '../../commonTypes';
|
|
2
|
+
import type { EasingFunctionFactory } from '../../Easing';
|
|
1
3
|
export interface ReanimatedWebTransformProperties {
|
|
2
4
|
translateX?: string;
|
|
3
5
|
translateY?: string;
|
|
@@ -14,6 +16,7 @@ export interface ReanimatedWebTransformProperties {
|
|
|
14
16
|
export interface AnimationStyle {
|
|
15
17
|
opacity?: number;
|
|
16
18
|
transform?: ReanimatedWebTransformProperties[];
|
|
19
|
+
easing?: EasingFunction | EasingFunctionFactory;
|
|
17
20
|
}
|
|
18
21
|
export interface AnimationData {
|
|
19
22
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animationParser.d.ts","sourceRoot":"","sources":["../../../../src/layoutReanimation/web/animationParser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"animationParser.d.ts","sourceRoot":"","sources":["../../../../src/layoutReanimation/web/animationParser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAI1D,MAAM,WAAW,gCAAgC;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,gCAAgC,EAAE,CAAC;IAC/C,MAAM,CAAC,EAAE,cAAc,GAAG,qBAAqB,CAAC;CACjD;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACtC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,OAAO,CAAC,EAAE,GAAG,CAAC;CACf;AAED,wBAAgB,iCAAiC,CAC/C,eAAe,EAAE,aAAa,UA2D/B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { LayoutAnimationType, ReduceMotion, StyleProps } from '../../commonTypes';
|
|
2
2
|
import type { AnimationData, AnimationStyle } from './animationParser';
|
|
3
3
|
export type AnimationCallback = ((finished: boolean) => void) | null;
|
|
4
|
-
export type KeyframeDefinitions = Record
|
|
4
|
+
export type KeyframeDefinitions = Record<`${number}` | 'from' | 'to', AnimationStyle>;
|
|
5
5
|
export type InitialValuesStyleProps = Omit<StyleProps, 'opacity'> & {
|
|
6
6
|
opacity?: number;
|
|
7
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/layoutReanimation/web/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EACZ,UAAU,EACX,MAAM,mBAAmB,CAAC;AAoC3B,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEvE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;AAErE,MAAM,MAAM,mBAAmB,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/layoutReanimation/web/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EACZ,UAAU,EACX,MAAM,mBAAmB,CAAC;AAoC3B,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEvE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;AAErE,MAAM,MAAM,mBAAmB,GAAG,MAAM,CACtC,GAAG,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,EAC3B,cAAc,CACf,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,GAAG;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,mBAAmB,CAAC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,UAAU;IAClB,IAAI,MAAM,CAAC;IACX,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,CAAC;CACpC;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,aAAa,CAAC,EAAE,UAAU,CAAC;CAC5B;AAED,oBAAY,cAAc;IACxB,MAAM,IAAA;IACN,SAAS,IAAA;IACT,MAAM,IAAA;IACN,OAAO,IAAA;IACP,MAAM,IAAA;IACN,UAAU,IAAA;CACX;AAED,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAoBxD,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoBtB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAnimation.d.ts","sourceRoot":"","sources":["../../../../src/layoutReanimation/web/createAnimation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAGV,cAAc,EACf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC7E,OAAO,EAAkB,cAAc,EAAE,MAAM,UAAU,CAAC;AA0C1D,wBAAgB,6BAA6B,CAC3C,mBAAmB,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"createAnimation.d.ts","sourceRoot":"","sources":["../../../../src/layoutReanimation/web/createAnimation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAGV,cAAc,EACf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC7E,OAAO,EAAkB,cAAc,EAAE,MAAM,UAAU,CAAC;AA0C1D,wBAAgB,6BAA6B,CAC3C,mBAAmB,EAAE,mBAAmB,UAoCzC;AAED,wBAAgB,gCAAgC,CAC9C,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,uBAAuB,UA6DvC;AAQD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,cAAc;;;EAkE/B"}
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* version used to build the native part of the library in runtime. Remember to
|
|
4
4
|
* keep this in sync with the version declared in `package.json`
|
|
5
5
|
*/
|
|
6
|
-
export declare const jsVersion = "4.0.
|
|
6
|
+
export declare const jsVersion = "4.0.3";
|
|
7
7
|
//# sourceMappingURL=jsVersion.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-reanimated",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"description": "More powerful alternative to Animated library for React Native.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"@babel/core": "^7.0.0-0",
|
|
94
94
|
"react": "*",
|
|
95
95
|
"react-native": "*",
|
|
96
|
-
"react-native-worklets": ">=0.
|
|
96
|
+
"react-native-worklets": ">=0.4.0"
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
99
|
"@babel/cli": "^7.20.0",
|
|
@@ -65,7 +65,7 @@ end
|
|
|
65
65
|
|
|
66
66
|
def assert_minimal_react_native_version(config)
|
|
67
67
|
# If you change the minimal React Native version remember to update Compatibility Table in docs
|
|
68
|
-
minimalReactNativeVersion =
|
|
68
|
+
minimalReactNativeVersion = 78
|
|
69
69
|
if config[:react_native_minor_version] < minimalReactNativeVersion
|
|
70
70
|
raise "[Reanimated] Unsupported React Native version. Please use React Native 0.#{minimalReactNativeVersion} or newer."
|
|
71
71
|
end
|
|
@@ -354,10 +354,9 @@ export function isAnimationTerminatingCalculation(
|
|
|
354
354
|
const { toValue, velocity, startValue, current, initialEnergy } = animation;
|
|
355
355
|
|
|
356
356
|
if (config.overshootClamping) {
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
) {
|
|
357
|
+
const leftBound = startValue >= 0 ? toValue : toValue + startValue;
|
|
358
|
+
const rightBound = leftBound + Math.abs(startValue);
|
|
359
|
+
if (current < leftBound || current > rightBound) {
|
|
361
360
|
return true;
|
|
362
361
|
}
|
|
363
362
|
}
|
|
@@ -3,7 +3,6 @@ import '../layoutReanimation/animationsManager';
|
|
|
3
3
|
|
|
4
4
|
import type React from 'react';
|
|
5
5
|
|
|
6
|
-
import { getReduceMotionFromConfig } from '../animation/util';
|
|
7
6
|
import { maybeBuild } from '../animationBuilder';
|
|
8
7
|
import { IS_JEST, IS_WEB } from '../common';
|
|
9
8
|
import type { StyleProps } from '../commonTypes';
|
|
@@ -327,13 +326,6 @@ export default class AnimatedComponent
|
|
|
327
326
|
return;
|
|
328
327
|
}
|
|
329
328
|
|
|
330
|
-
if (this._isReducedMotion(currentConfig)) {
|
|
331
|
-
if (!previousConfig) {
|
|
332
|
-
return;
|
|
333
|
-
}
|
|
334
|
-
currentConfig = undefined;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
329
|
updateLayoutAnimations(
|
|
338
330
|
type === LayoutAnimationType.ENTERING
|
|
339
331
|
? this.reanimatedID
|
|
@@ -350,14 +342,6 @@ export default class AnimatedComponent
|
|
|
350
342
|
);
|
|
351
343
|
}
|
|
352
344
|
|
|
353
|
-
_isReducedMotion(config?: LayoutAnimationOrBuilder): boolean {
|
|
354
|
-
return config &&
|
|
355
|
-
'getReduceMotion' in config &&
|
|
356
|
-
typeof config.getReduceMotion === 'function'
|
|
357
|
-
? getReduceMotionFromConfig(config.getReduceMotion())
|
|
358
|
-
: getReduceMotionFromConfig();
|
|
359
|
-
}
|
|
360
|
-
|
|
361
345
|
// This is a component lifecycle method from React, therefore we are not calling it directly.
|
|
362
346
|
// It is called before the component gets rerendered. This way we can access components' position before it changed
|
|
363
347
|
// and later on, in componentDidUpdate, calculate translation for layout transition.
|
|
@@ -17,12 +17,6 @@ class JSPropsUpdaterNative implements IJSPropsUpdater {
|
|
|
17
17
|
AnimatedComponentType
|
|
18
18
|
>();
|
|
19
19
|
|
|
20
|
-
constructor() {
|
|
21
|
-
runOnUI(() => {
|
|
22
|
-
global._tagToJSPropNamesMapping = {};
|
|
23
|
-
})();
|
|
24
|
-
}
|
|
25
|
-
|
|
26
20
|
public registerComponent(
|
|
27
21
|
animatedComponent: AnimatedComponentType,
|
|
28
22
|
jsProps: string[]
|
|
@@ -103,7 +103,7 @@ export class NativeEventsManager implements INativeEventsManager {
|
|
|
103
103
|
// On the first render of a component, we may already receive a resolved view tag.
|
|
104
104
|
return this.#managedComponent.getComponentViewTag();
|
|
105
105
|
}
|
|
106
|
-
if (componentAnimatedRef
|
|
106
|
+
if (componentAnimatedRef?.__nativeTag) {
|
|
107
107
|
return componentAnimatedRef.__nativeTag ?? -1;
|
|
108
108
|
}
|
|
109
109
|
/*
|
|
@@ -91,7 +91,9 @@ export default class CSSAnimationsManager implements ICSSAnimationsManager {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
unmountCleanup(): void {
|
|
94
|
-
//
|
|
94
|
+
// We use setTimeout to ensure that the animation is removed after the
|
|
95
|
+
// component is unmounted (it puts the detach call at the end of the event loop)
|
|
96
|
+
setTimeout(this.detach.bind(this));
|
|
95
97
|
}
|
|
96
98
|
|
|
97
99
|
private detach() {
|
package/src/initializers.ts
CHANGED
|
@@ -24,5 +24,9 @@ export function initializeReanimatedModule(
|
|
|
24
24
|
|
|
25
25
|
registerLoggerConfig(DEFAULT_LOGGER_CONFIG);
|
|
26
26
|
if (!SHOULD_BE_USE_WEB) {
|
|
27
|
-
executeOnUIRuntimeSync(
|
|
27
|
+
executeOnUIRuntimeSync(() => {
|
|
28
|
+
'worklet';
|
|
29
|
+
global._tagToJSPropNamesMapping = {};
|
|
30
|
+
registerLoggerConfig(DEFAULT_LOGGER_CONFIG);
|
|
31
|
+
})();
|
|
28
32
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
import {
|
|
2
|
+
import { executeOnUIRuntimeSync } from 'react-native-worklets';
|
|
3
3
|
|
|
4
4
|
import { withStyleAnimation } from '../animation';
|
|
5
|
+
import { SHOULD_BE_USE_WEB } from '../common';
|
|
5
6
|
import type {
|
|
6
7
|
LayoutAnimation,
|
|
7
8
|
LayoutAnimationStartFunction,
|
|
@@ -100,10 +101,12 @@ function createLayoutAnimationManager(): {
|
|
|
100
101
|
};
|
|
101
102
|
}
|
|
102
103
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
if (!SHOULD_BE_USE_WEB) {
|
|
105
|
+
executeOnUIRuntimeSync(() => {
|
|
106
|
+
'worklet';
|
|
107
|
+
global.LayoutAnimationsManager = createLayoutAnimationManager();
|
|
108
|
+
})();
|
|
109
|
+
}
|
|
107
110
|
|
|
108
111
|
export type LayoutAnimationsManager = ReturnType<
|
|
109
112
|
typeof createLayoutAnimationManager
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
import type { EasingFunction } from '../../commonTypes';
|
|
4
|
+
import type { EasingFunctionFactory } from '../../Easing';
|
|
3
5
|
import type { WebEasingsNames } from './Easing.web';
|
|
4
6
|
import { WebEasings } from './Easing.web';
|
|
5
7
|
|
|
@@ -20,6 +22,7 @@ export interface ReanimatedWebTransformProperties {
|
|
|
20
22
|
export interface AnimationStyle {
|
|
21
23
|
opacity?: number;
|
|
22
24
|
transform?: ReanimatedWebTransformProperties[];
|
|
25
|
+
easing?: EasingFunction | EasingFunctionFactory;
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
export interface AnimationData {
|
|
@@ -43,7 +43,10 @@ import type { AnimationData, AnimationStyle } from './animationParser';
|
|
|
43
43
|
|
|
44
44
|
export type AnimationCallback = ((finished: boolean) => void) | null;
|
|
45
45
|
|
|
46
|
-
export type KeyframeDefinitions = Record<
|
|
46
|
+
export type KeyframeDefinitions = Record<
|
|
47
|
+
`${number}` | 'from' | 'to',
|
|
48
|
+
AnimationStyle
|
|
49
|
+
>;
|
|
47
50
|
|
|
48
51
|
export type InitialValuesStyleProps = Omit<StyleProps, 'opacity'> & {
|
|
49
52
|
opacity?: number;
|
|
@@ -68,6 +68,21 @@ export function createCustomKeyFrameAnimation(
|
|
|
68
68
|
|
|
69
69
|
animationData.name = generateNextCustomKeyframeName();
|
|
70
70
|
|
|
71
|
+
// Move keyframe easings one keyframe up (our LA Keyframe definition is different
|
|
72
|
+
// from the CSS keyframes and expects easing to be present in the keyframe to which
|
|
73
|
+
// we animate instead of the keyframe we animate from)
|
|
74
|
+
const offsets = Object.keys(
|
|
75
|
+
keyframeDefinitions
|
|
76
|
+
) as (keyof KeyframeDefinitions)[];
|
|
77
|
+
|
|
78
|
+
for (let i = 1; i < offsets.length; i++) {
|
|
79
|
+
const style = keyframeDefinitions[offsets[i]];
|
|
80
|
+
if (style.easing) {
|
|
81
|
+
keyframeDefinitions[offsets[i - 1]].easing = style.easing;
|
|
82
|
+
delete style.easing;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
71
86
|
const parsedKeyframe = convertAnimationObjectToKeyframes(animationData);
|
|
72
87
|
|
|
73
88
|
insertWebAnimation(animationData.name, parsedKeyframe);
|