react-native-reanimated 3.17.3 → 3.17.4

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.
Files changed (47) hide show
  1. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  2. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  3. package/lib/module/createAnimatedComponent/InlinePropManager.js +1 -1
  4. package/lib/module/createAnimatedComponent/InlinePropManager.js.map +1 -1
  5. package/lib/module/createAnimatedComponent/PropsFilter.js +7 -8
  6. package/lib/module/createAnimatedComponent/PropsFilter.js.map +1 -1
  7. package/lib/module/hook/useAnimatedStyle.js +2 -2
  8. package/lib/module/hook/useAnimatedStyle.js.map +1 -1
  9. package/lib/module/layoutReanimation/defaultAnimations/Pinwheel.js +4 -4
  10. package/lib/module/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -1
  11. package/lib/module/layoutReanimation/defaultAnimations/Zoom.js +2 -2
  12. package/lib/module/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
  13. package/lib/module/platform-specific/jsVersion.js +1 -1
  14. package/lib/module/processBoxShadow.js +57 -44
  15. package/lib/module/processBoxShadow.js.map +1 -1
  16. package/lib/module/screenTransition/styleUpdater.js +1 -1
  17. package/lib/module/screenTransition/styleUpdater.js.map +1 -1
  18. package/lib/module/updateProps/index.js +5 -0
  19. package/lib/module/updateProps/index.js.map +1 -0
  20. package/lib/module/updateProps/processTransformOrigin.js +115 -0
  21. package/lib/module/updateProps/processTransformOrigin.js.map +1 -0
  22. package/lib/module/{UpdateProps.js → updateProps/updateProps.js} +10 -11
  23. package/lib/module/updateProps/updateProps.js.map +1 -0
  24. package/lib/typescript/createAnimatedComponent/PropsFilter.d.ts +1 -1
  25. package/lib/typescript/createAnimatedComponent/PropsFilter.d.ts.map +1 -1
  26. package/lib/typescript/platform-specific/jsVersion.d.ts +1 -1
  27. package/lib/typescript/processBoxShadow.d.ts.map +1 -1
  28. package/lib/typescript/updateProps/index.d.ts +3 -0
  29. package/lib/typescript/updateProps/index.d.ts.map +1 -0
  30. package/lib/typescript/updateProps/processTransformOrigin.d.ts +2 -0
  31. package/lib/typescript/updateProps/processTransformOrigin.d.ts.map +1 -0
  32. package/lib/typescript/{UpdateProps.d.ts → updateProps/updateProps.d.ts} +3 -7
  33. package/lib/typescript/updateProps/updateProps.d.ts.map +1 -0
  34. package/package.json +7 -7
  35. package/src/createAnimatedComponent/InlinePropManager.ts +1 -1
  36. package/src/createAnimatedComponent/PropsFilter.tsx +12 -8
  37. package/src/hook/useAnimatedStyle.ts +2 -2
  38. package/src/layoutReanimation/defaultAnimations/Pinwheel.ts +4 -4
  39. package/src/layoutReanimation/defaultAnimations/Zoom.ts +2 -2
  40. package/src/platform-specific/jsVersion.ts +1 -1
  41. package/src/processBoxShadow.ts +60 -48
  42. package/src/screenTransition/styleUpdater.ts +1 -1
  43. package/src/updateProps/index.ts +4 -0
  44. package/src/updateProps/processTransformOrigin.ts +145 -0
  45. package/src/{UpdateProps.ts → updateProps/updateProps.ts} +23 -28
  46. package/lib/module/UpdateProps.js.map +0 -1
  47. package/lib/typescript/UpdateProps.d.ts.map +0 -1
@@ -0,0 +1,115 @@
1
+ 'use strict';
2
+
3
+ import { ReanimatedError } from "../errors.js";
4
+ const INDEX_X = 0;
5
+ const INDEX_Y = 1;
6
+ const INDEX_Z = 2;
7
+
8
+ // Implementation based on https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/StyleSheet/processTransformOrigin.js
9
+ function validateTransformOrigin(transformOrigin) {
10
+ 'worklet';
11
+
12
+ if (transformOrigin.length !== 3) {
13
+ throw new ReanimatedError('Transform origin must have exactly 3 values.');
14
+ }
15
+ const [x, y, z] = transformOrigin;
16
+ if (!(typeof x === 'number' || typeof x === 'string' && x.endsWith('%'))) {
17
+ throw new ReanimatedError(`Transform origin x-position must be a number or a percentage string. Passed value: ${x}.`);
18
+ }
19
+ if (!(typeof y === 'number' || typeof y === 'string' && y.endsWith('%'))) {
20
+ throw new ReanimatedError(`Transform origin y-position must be a number or a percentage string. Passed value: ${y}.`);
21
+ }
22
+ if (typeof z !== 'number') {
23
+ throw new ReanimatedError(`Transform origin z-position must be a number. Passed value: ${z}.`);
24
+ }
25
+ }
26
+ export function processTransformOrigin(transformOriginIn) {
27
+ 'worklet';
28
+
29
+ let transformOrigin = Array.isArray(transformOriginIn) ? transformOriginIn : ['50%', '50%', 0];
30
+ if (typeof transformOriginIn === 'string') {
31
+ const transformOriginString = transformOriginIn;
32
+ const regex = /(top|bottom|left|right|center|\d+(?:%|px)|0)/gi;
33
+ const transformOriginArray = ['50%', '50%', 0];
34
+ let index = INDEX_X;
35
+ let matches;
36
+ while (matches = regex.exec(transformOriginString)) {
37
+ let nextIndex = index + 1;
38
+ const value = matches[0];
39
+ const valueLower = value.toLowerCase();
40
+ switch (valueLower) {
41
+ case 'left':
42
+ case 'right':
43
+ {
44
+ if (index !== INDEX_X) {
45
+ throw new ReanimatedError(`Transform-origin ${value} can only be used for x-position`);
46
+ }
47
+ transformOriginArray[INDEX_X] = valueLower === 'left' ? 0 : '100%';
48
+ break;
49
+ }
50
+ case 'top':
51
+ case 'bottom':
52
+ {
53
+ if (index === INDEX_Z) {
54
+ throw new ReanimatedError(`Transform-origin ${value} can only be used for y-position`);
55
+ }
56
+ transformOriginArray[INDEX_Y] = valueLower === 'top' ? 0 : '100%';
57
+
58
+ // Handle [[ center | left | right ] && [ center | top | bottom ]] <length>?
59
+ if (index === INDEX_X) {
60
+ const horizontal = regex.exec(transformOriginString);
61
+ if (horizontal == null) {
62
+ break;
63
+ }
64
+ switch (horizontal?.[0].toLowerCase()) {
65
+ case 'left':
66
+ transformOriginArray[INDEX_X] = 0;
67
+ break;
68
+ case 'right':
69
+ transformOriginArray[INDEX_X] = '100%';
70
+ break;
71
+ case 'center':
72
+ transformOriginArray[INDEX_X] = '50%';
73
+ break;
74
+ default:
75
+ throw new ReanimatedError(`Could not parse transform-origin: ${transformOriginString}`);
76
+ }
77
+ nextIndex = INDEX_Z;
78
+ }
79
+ break;
80
+ }
81
+ case 'center':
82
+ {
83
+ if (index === INDEX_Z) {
84
+ throw new ReanimatedError(`Transform-origin value ${value} cannot be used for z-position`);
85
+ }
86
+ transformOriginArray[index] = '50%';
87
+ break;
88
+ }
89
+ default:
90
+ {
91
+ if (value.endsWith('%')) {
92
+ transformOriginArray[index] = value;
93
+ } else {
94
+ const numericValue = parseFloat(value);
95
+ if (isNaN(numericValue)) {
96
+ throw new ReanimatedError(`Invalid numeric value in transform-origin: ${value}`);
97
+ }
98
+ transformOriginArray[index] = numericValue;
99
+ }
100
+ break;
101
+ }
102
+ }
103
+ index = nextIndex;
104
+ }
105
+ transformOrigin = transformOriginArray;
106
+ }
107
+ if (typeof transformOriginIn !== 'string' && !Array.isArray(transformOriginIn)) {
108
+ throw new ReanimatedError(`Invalid transformOrigin type: ${typeof transformOriginIn}`);
109
+ }
110
+ if (__DEV__) {
111
+ validateTransformOrigin(transformOrigin);
112
+ }
113
+ return transformOrigin;
114
+ }
115
+ //# sourceMappingURL=processTransformOrigin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ReanimatedError","INDEX_X","INDEX_Y","INDEX_Z","validateTransformOrigin","transformOrigin","length","x","y","z","endsWith","processTransformOrigin","transformOriginIn","Array","isArray","transformOriginString","regex","transformOriginArray","index","matches","exec","nextIndex","value","valueLower","toLowerCase","horizontal","numericValue","parseFloat","isNaN","__DEV__"],"sourceRoot":"../../../src","sources":["updateProps/processTransformOrigin.ts"],"mappings":"AAAA,YAAY;;AACZ,SAASA,eAAe,QAAQ,cAAW;AAE3C,MAAMC,OAAO,GAAG,CAAC;AACjB,MAAMC,OAAO,GAAG,CAAC;AACjB,MAAMC,OAAO,GAAG,CAAC;;AAEjB;AACA,SAASC,uBAAuBA,CAACC,eAAuC,EAAE;EACxE,SAAS;;EACT,IAAIA,eAAe,CAACC,MAAM,KAAK,CAAC,EAAE;IAChC,MAAM,IAAIN,eAAe,CAAC,8CAA8C,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,GAAG,KAAK;YACnC;UACF;QACA;UAAS;YACP,IAAII,KAAK,CAACZ,QAAQ,CAAC,GAAG,CAAC,EAAE;cACvBO,oBAAoB,CAACC,KAAK,CAAC,GAAGI,KAAK;YACrC,CAAC,MAAM;cACL,MAAMI,YAAY,GAAGC,UAAU,CAACL,KAAK,CAAC;cACtC,IAAIM,KAAK,CAACF,YAAY,CAAC,EAAE;gBACvB,MAAM,IAAI1B,eAAe,CACvB,8CAA8CsB,KAAK,EACrD,CAAC;cACH;cACAL,oBAAoB,CAACC,KAAK,CAAC,GAAGQ,YAAY;YAC5C;YACA;UACF;MACF;MAEAR,KAAK,GAAGG,SAAS;IACnB;IAEAhB,eAAe,GAAGY,oBAAoB;EACxC;EAEA,IACE,OAAOL,iBAAiB,KAAK,QAAQ,IACrC,CAACC,KAAK,CAACC,OAAO,CAACF,iBAAiB,CAAC,EACjC;IACA,MAAM,IAAIZ,eAAe,CACvB,iCAAiC,OAAOY,iBAAiB,EAC3D,CAAC;EACH;EAEA,IAAIiB,OAAO,EAAE;IACXzB,uBAAuB,CAACC,eAAe,CAAC;EAC1C;EAEA,OAAOA,eAAe;AACxB","ignoreList":[]}
@@ -1,11 +1,12 @@
1
- /* eslint-disable @typescript-eslint/no-redundant-type-constituents */
1
+ /* eslint-disable @typescript-eslint/no-redundant-type-constituents, @typescript-eslint/no-explicit-any */
2
2
  'use strict';
3
3
 
4
- import { processColorsInProps } from "./Colors.js";
5
- import { ReanimatedError } from "./errors.js";
6
- import { isFabric, isJest, shouldBeUseWeb } from "./PlatformChecker.js";
7
- import { _updatePropsJS } from "./ReanimatedModule/js-reanimated/index.js";
8
- import { runOnUIImmediately } from "./threads.js";
4
+ import { processColorsInProps } from "../Colors.js";
5
+ import { ReanimatedError } from "../errors.js";
6
+ import { isFabric, isJest, shouldBeUseWeb } from "../PlatformChecker.js";
7
+ import { _updatePropsJS } from "../ReanimatedModule/js-reanimated/index.js";
8
+ import { runOnUIImmediately } from "../threads.js";
9
+ import { processTransformOrigin } from "./processTransformOrigin.js";
9
10
  let updateProps;
10
11
  if (shouldBeUseWeb()) {
11
12
  updateProps = (viewDescriptors, updates, isAnimatedProps) => {
@@ -21,10 +22,8 @@ if (shouldBeUseWeb()) {
21
22
  'worklet';
22
23
 
23
24
  processColorsInProps(updates);
24
- if (updates.transformOrigin) {
25
- if (!Array.isArray(updates.transformOrigin)) {
26
- throw new ReanimatedError('Please use transformOrigin in array form');
27
- }
25
+ if ('transformOrigin' in updates) {
26
+ updates.transformOrigin = processTransformOrigin(updates.transformOrigin);
28
27
  }
29
28
  global.UpdatePropsManager.update(viewDescriptors, updates);
30
29
  };
@@ -113,4 +112,4 @@ if (shouldBeUseWeb()) {
113
112
  * This used to be `SharedValue<Descriptors[]>` but objects holding just a
114
113
  * single `value` prop are fine too.
115
114
  */
116
- //# sourceMappingURL=UpdateProps.js.map
115
+ //# sourceMappingURL=updateProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["processColorsInProps","ReanimatedError","isFabric","isJest","shouldBeUseWeb","_updatePropsJS","runOnUIImmediately","processTransformOrigin","updateProps","viewDescriptors","updates","isAnimatedProps","value","forEach","viewDescriptor","component","tag","transformOrigin","global","UpdatePropsManager","update","updatePropsJestWrapper","animatedValues","adapters","adapter","current","createUpdatePropsManager","operations","push","shadowNodeWrapper","length","queueMicrotask","flush","_updatePropsFabric","name","_updatePropsPaper","maybeThrowError","Proxy","get","set"],"sourceRoot":"../../../src","sources":["updateProps/updateProps.ts"],"mappings":"AAAA;AACA,YAAY;;AAIZ,SAASA,oBAAoB,QAAQ,cAAW;AAMhD,SAASC,eAAe,QAAQ,cAAW;AAE3C,SAASC,QAAQ,EAAEC,MAAM,EAAEC,cAAc,QAAQ,uBAAoB;AAErE,SAASC,cAAc,QAAQ,4CAAmC;AAClE,SAASC,kBAAkB,QAAQ,eAAY;AAC/C,SAASC,sBAAsB,QAAQ,6BAA0B;AAEjE,IAAIC,WAIK;AAET,IAAIJ,cAAc,CAAC,C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AG,EAAEA,CAAA,KAAM;MACTH,eAAe,CAAC,CAAC;MACjB,OAAO,KAAK;IACd;EACF,CACF,CAAC;AACH,CAAC,MAAM;EACL9B,kBAAkB,CAAC,MAAM;IACvB,SAAS;;IACTY,MAAM,CAACC,kBAAkB,GAAGO,wBAAwB,CAAC,CAAC;EACxD,CAAC,CAAC,CAAC,CAAC;AACN;;AAEA;AACA;AACA;AACA","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import type { IAnimatedComponentInternal, IPropsFilter } from './commonTypes';
3
3
  export declare class PropsFilter implements IPropsFilter {
4
- private _initialStyle;
4
+ private _initialPropsMap;
5
5
  filterNonAnimatedProps(component: React.Component<unknown, unknown> & IAnimatedComponentInternal): Record<string, unknown>;
6
6
  }
7
7
  //# sourceMappingURL=PropsFilter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PropsFilter.d.ts","sourceRoot":"","sources":["../../../src/createAnimatedComponent/PropsFilter.tsx"],"names":[],"mappings":";AAOA,OAAO,KAAK,EAGV,0BAA0B,EAE1B,YAAY,EACb,MAAM,eAAe,CAAC;AASvB,qBAAa,WAAY,YAAW,YAAY;IAC9C,OAAO,CAAC,aAAa,CAAM;IAEpB,sBAAsB,CAC3B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,0BAA0B,GACxE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAgE3B"}
1
+ {"version":3,"file":"PropsFilter.d.ts","sourceRoot":"","sources":["../../../src/createAnimatedComponent/PropsFilter.tsx"],"names":[],"mappings":";AAQA,OAAO,KAAK,EAGV,0BAA0B,EAE1B,YAAY,EACb,MAAM,eAAe,CAAC;AASvB,qBAAa,WAAY,YAAW,YAAY;IAC9C,OAAO,CAAC,gBAAgB,CAA8C;IAE/D,sBAAsB,CAC3B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,0BAA0B,GACxE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAmE3B"}
@@ -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 = "3.17.3";
6
+ export declare const jsVersion = "3.17.4";
7
7
  //# sourceMappingURL=jsVersion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"processBoxShadow.d.ts","sourceRoot":"","sources":["../../src/processBoxShadow.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAkB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,GAAG,CAAC;AAqGpC,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC;IACvC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,iCA6EjD"}
1
+ {"version":3,"file":"processBoxShadow.d.ts","sourceRoot":"","sources":["../../src/processBoxShadow.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAkB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,GAAG,CAAC;AAyGpC,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC;IACvC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,iCAqFjD"}
@@ -0,0 +1,3 @@
1
+ export { default as updateProps } from './updateProps';
2
+ export { updatePropsJestWrapper } from './updateProps';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/updateProps/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function processTransformOrigin(transformOriginIn: Array<string | number> | string | undefined): Array<string | number>;
2
+ //# sourceMappingURL=processTransformOrigin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processTransformOrigin.d.ts","sourceRoot":"","sources":["../../../src/updateProps/processTransformOrigin.ts"],"names":[],"mappings":"AA+BA,wBAAgB,sBAAsB,CACpC,iBAAiB,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,GAAG,SAAS,GAC7D,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CA+GxB"}
@@ -1,13 +1,9 @@
1
1
  import type { MutableRefObject } from 'react';
2
- import type { AnimatedStyle, StyleProps } from './commonTypes';
3
- import type { Descriptor } from './hook/commonTypes';
2
+ import type { AnimatedStyle, StyleProps } from '../commonTypes';
3
+ import type { Descriptor } from '../hook/commonTypes';
4
4
  declare let updateProps: (viewDescriptors: ViewDescriptorsWrapper, updates: StyleProps | AnimatedStyle<any>, isAnimatedProps?: boolean) => void;
5
5
  export declare const updatePropsJestWrapper: (viewDescriptors: ViewDescriptorsWrapper, updates: AnimatedStyle<any>, animatedValues: MutableRefObject<AnimatedStyle<any>>, adapters: ((updates: AnimatedStyle<any>) => void)[]) => void;
6
6
  export default updateProps;
7
- export interface UpdatePropsManager {
8
- update(viewDescriptors: ViewDescriptorsWrapper, updates: StyleProps | AnimatedStyle<any>): void;
9
- flush(): void;
10
- }
11
7
  /**
12
8
  * This used to be `SharedValue<Descriptors[]>` but objects holding just a
13
9
  * single `value` prop are fine too.
@@ -15,4 +11,4 @@ export interface UpdatePropsManager {
15
11
  interface ViewDescriptorsWrapper {
16
12
  value: Readonly<Descriptor[]>;
17
13
  }
18
- //# sourceMappingURL=UpdateProps.d.ts.map
14
+ //# sourceMappingURL=updateProps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateProps.d.ts","sourceRoot":"","sources":["../../../src/updateProps/updateProps.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAG9C,OAAO,KAAK,EACV,aAAa,EAEb,UAAU,EACX,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAOtD,QAAA,IAAI,WAAW,EAAE,CACf,eAAe,EAAE,sBAAsB,EACvC,OAAO,EAAE,UAAU,GAAG,aAAa,CAAC,GAAG,CAAC,EACxC,eAAe,CAAC,EAAE,OAAO,KACtB,IAAI,CAAC;AAqBV,eAAO,MAAM,sBAAsB,oBAChB,sBAAsB,WAC9B,cAAc,GAAG,CAAC,kBACX,iBAAiB,cAAc,GAAG,CAAC,CAAC,uBAC/B,cAAc,GAAG,CAAC,KAAK,IAAI,QAC/C,IAUF,CAAC;AAEF,eAAe,WAAW,CAAC;AAyF3B;;;GAGG;AACH,UAAU,sBAAsB;IAC9B,KAAK,EAAE,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;CAC/B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-reanimated",
3
- "version": "3.17.3",
3
+ "version": "3.17.4",
4
4
  "description": "More powerful alternative to Animated library for React Native.",
5
5
  "scripts": {
6
6
  "test": "jest",
@@ -102,10 +102,10 @@
102
102
  "@babel/core": "^7.25.2",
103
103
  "@babel/preset-env": "^7.25.3",
104
104
  "@babel/types": "^7.20.0",
105
- "@react-native/babel-preset": "0.78.0",
106
- "@react-native/eslint-config": "0.78.0",
107
- "@react-native/metro-config": "0.78.0",
108
- "@react-native/typescript-config": "0.78.0",
105
+ "@react-native/babel-preset": "0.79.0-rc.4",
106
+ "@react-native/eslint-config": "0.79.0-rc.4",
107
+ "@react-native/metro-config": "0.79.0-rc.4",
108
+ "@react-native/typescript-config": "0.79.0-rc.4",
109
109
  "@testing-library/jest-native": "^4.0.4",
110
110
  "@testing-library/react-hooks": "^8.0.0",
111
111
  "@testing-library/react-native": "^13.0.1",
@@ -144,9 +144,9 @@
144
144
  "madge": "^5.0.1",
145
145
  "prettier": "^3.3.3",
146
146
  "react": "19.0.0",
147
- "react-native": "0.78.0",
147
+ "react-native": "0.79.0-rc.4",
148
148
  "react-native-builder-bob": "patch:react-native-builder-bob@npm%3A0.33.1#~/.yarn/patches/react-native-builder-bob-npm-0.33.1-383d9e23a5.patch",
149
- "react-native-gesture-handler": "2.24.0",
149
+ "react-native-gesture-handler": "2.25.0",
150
150
  "react-native-web": "0.19.13",
151
151
  "react-test-renderer": "19.0.0",
152
152
  "shelljs": "^0.8.5",
@@ -3,7 +3,7 @@ import type { StyleProps } from '../commonTypes';
3
3
  import { adaptViewConfig } from '../ConfigHelper';
4
4
  import { isSharedValue } from '../isSharedValue';
5
5
  import { startMapper, stopMapper } from '../mappers';
6
- import updateProps from '../UpdateProps';
6
+ import { updateProps } from '../updateProps';
7
7
  import type { ViewDescriptorsSet } from '../ViewDescriptorsSet';
8
8
  import { makeViewDescriptorsSet } from '../ViewDescriptorsSet';
9
9
  import type {
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { initialUpdaterRun } from '../animation';
4
4
  import type { StyleProps } from '../commonTypes';
5
+ import type { AnimatedStyleHandle } from '../hook/commonTypes';
5
6
  import { isSharedValue } from '../isSharedValue';
6
7
  import { isChromeDebugger } from '../PlatformChecker';
7
8
  import { WorkletEventHandler } from '../WorkletEventHandler';
@@ -21,7 +22,7 @@ function dummyListener() {
21
22
  }
22
23
 
23
24
  export class PropsFilter implements IPropsFilter {
24
- private _initialStyle = {};
25
+ private _initialPropsMap = new Map<AnimatedStyleHandle, StyleProps>();
25
26
 
26
27
  public filterNonAnimatedProps(
27
28
  component: React.Component<unknown, unknown> & IAnimatedComponentInternal
@@ -29,22 +30,25 @@ export class PropsFilter implements IPropsFilter {
29
30
  const inputProps =
30
31
  component.props as AnimatedComponentProps<InitialComponentProps>;
31
32
  const props: Record<string, unknown> = {};
33
+
32
34
  for (const key in inputProps) {
33
35
  const value = inputProps[key];
34
36
  if (key === 'style') {
35
37
  const styleProp = inputProps.style;
36
38
  const styles = flattenArray<StyleProps>(styleProp ?? []);
39
+
37
40
  const processedStyle: StyleProps[] = styles.map((style) => {
38
41
  if (style && style.viewDescriptors) {
39
- // this is how we recognize styles returned by useAnimatedStyle
42
+ const handle = style as AnimatedStyleHandle;
43
+
40
44
  if (component._isFirstRender) {
41
- this._initialStyle = {
42
- ...style.initial.value,
43
- ...this._initialStyle,
44
- ...initialUpdaterRun<StyleProps>(style.initial.updater),
45
- };
45
+ this._initialPropsMap.set(handle, {
46
+ ...handle.initial.value,
47
+ ...initialUpdaterRun(handle.initial.updater),
48
+ } as StyleProps);
46
49
  }
47
- return this._initialStyle;
50
+
51
+ return this._initialPropsMap.get(handle) ?? {};
48
52
  } else if (hasInlineStyles(style)) {
49
53
  return getInlineStyle(style, component._isFirstRender);
50
54
  } else {
@@ -20,7 +20,7 @@ import type { AnimatedProps } from '../createAnimatedComponent/commonTypes';
20
20
  import { ReanimatedError } from '../errors';
21
21
  import { isJest, shouldBeUseWeb } from '../PlatformChecker';
22
22
  import { processBoxShadow } from '../processBoxShadow';
23
- import updateProps, { updatePropsJestWrapper } from '../UpdateProps';
23
+ import { updateProps, updatePropsJestWrapper } from '../updateProps';
24
24
  import type { ViewDescriptorsSet } from '../ViewDescriptorsSet';
25
25
  import { makeViewDescriptorsSet } from '../ViewDescriptorsSet';
26
26
  import type {
@@ -212,7 +212,7 @@ function styleUpdater(
212
212
  let hasAnimations = false;
213
213
  let frameTimestamp: number | undefined;
214
214
  let hasNonAnimatedValues = false;
215
- if (!SHOULD_BE_USE_WEB && typeof newValues.boxShadow === 'string') {
215
+ if (!SHOULD_BE_USE_WEB && newValues.boxShadow) {
216
216
  processBoxShadow(newValues);
217
217
  }
218
218
  for (const key in newValues) {
@@ -44,7 +44,7 @@ export class PinwheelIn
44
44
  scale: delayFunction(delay, animation(1, config)),
45
45
  },
46
46
  {
47
- rotate: delayFunction(delay, animation('0', config)),
47
+ rotate: delayFunction(delay, animation('0rad', config)),
48
48
  },
49
49
  ],
50
50
  },
@@ -55,7 +55,7 @@ export class PinwheelIn
55
55
  scale: 0,
56
56
  },
57
57
  {
58
- rotate: '5',
58
+ rotate: '5rad',
59
59
  },
60
60
  ],
61
61
  ...initialValues,
@@ -104,7 +104,7 @@ export class PinwheelOut
104
104
  scale: delayFunction(delay, animation(0, config)),
105
105
  },
106
106
  {
107
- rotate: delayFunction(delay, animation('5', config)),
107
+ rotate: delayFunction(delay, animation('5rad', config)),
108
108
  },
109
109
  ],
110
110
  },
@@ -115,7 +115,7 @@ export class PinwheelOut
115
115
  scale: 1,
116
116
  },
117
117
  {
118
- rotate: '0',
118
+ rotate: '0rad',
119
119
  },
120
120
  ],
121
121
  ...initialValues,
@@ -95,7 +95,7 @@ export class ZoomInRotate
95
95
  ],
96
96
  },
97
97
  initialValues: {
98
- transform: [{ scale: 0 }, { rotate }],
98
+ transform: [{ scale: 0 }, { rotate: `${rotate}rad` }],
99
99
  ...initialValues,
100
100
  },
101
101
  callback,
@@ -469,7 +469,7 @@ export class ZoomOutRotate
469
469
  ],
470
470
  },
471
471
  initialValues: {
472
- transform: [{ scale: 1 }, { rotate: '0' }],
472
+ transform: [{ scale: 1 }, { rotate: '0rad' }],
473
473
  ...initialValues,
474
474
  },
475
475
  callback,
@@ -4,4 +4,4 @@
4
4
  * version used to build the native part of the library in runtime. Remember to
5
5
  * keep this in sync with the version declared in `package.json`
6
6
  */
7
- export const jsVersion = '3.17.3';
7
+ export const jsVersion = '3.17.4';
@@ -7,6 +7,12 @@
7
7
  import type { BoxShadowValue, OpaqueColorValue } from 'react-native';
8
8
 
9
9
  import type { StyleProps } from '.';
10
+ import { ReanimatedError } from './errors';
11
+
12
+ const isLength = (value: string) => {
13
+ 'worklet';
14
+ return value.endsWith('px') || !isNaN(Number(value));
15
+ };
10
16
 
11
17
  function parseBoxShadowString(rawBoxShadows: string): Array<BoxShadowValue> {
12
18
  'worklet';
@@ -29,52 +35,54 @@ function parseBoxShadowString(rawBoxShadows: string): Array<BoxShadowValue> {
29
35
  // split rawBoxShadow string by all whitespaces that are not in parenthesis
30
36
  const args = rawBoxShadow.split(/\s+(?![^(]*\))/);
31
37
  for (const arg of args) {
32
- if (arg === 'inset') {
33
- if (boxShadow.inset != null) {
38
+ if (isLength(arg)) {
39
+ switch (lengthCount) {
40
+ case 0:
41
+ offsetX = arg;
42
+ lengthCount++;
43
+ break;
44
+ case 1:
45
+ if (keywordDetectedAfterLength) {
46
+ return [];
47
+ }
48
+ offsetY = arg;
49
+ lengthCount++;
50
+ break;
51
+ case 2:
52
+ if (keywordDetectedAfterLength) {
53
+ return [];
54
+ }
55
+ boxShadow.blurRadius = arg;
56
+ lengthCount++;
57
+ break;
58
+ case 3:
59
+ if (keywordDetectedAfterLength) {
60
+ return [];
61
+ }
62
+ boxShadow.spreadDistance = arg;
63
+ lengthCount++;
64
+ break;
65
+ default:
66
+ return [];
67
+ }
68
+ } else if (arg === 'inset') {
69
+ if (boxShadow.inset) {
34
70
  return [];
35
71
  }
36
- if (offsetX != null) {
72
+ if (offsetX !== null) {
37
73
  keywordDetectedAfterLength = true;
38
74
  }
39
75
  boxShadow.inset = true;
40
76
  continue;
41
- }
42
-
43
- switch (lengthCount) {
44
- case 0:
45
- offsetX = arg;
46
- lengthCount++;
47
- break;
48
- case 1:
49
- if (keywordDetectedAfterLength) {
50
- return [];
51
- }
52
- offsetY = arg;
53
- lengthCount++;
54
- break;
55
- case 2:
56
- if (keywordDetectedAfterLength) {
57
- return [];
58
- }
59
- boxShadow.blurRadius = arg;
60
- lengthCount++;
61
- break;
62
- case 3:
63
- if (keywordDetectedAfterLength) {
64
- return [];
65
- }
66
- boxShadow.spreadDistance = arg;
67
- lengthCount++;
68
- break;
69
- case 4:
70
- if (keywordDetectedAfterLength) {
71
- return [];
72
- }
73
- boxShadow.color = arg;
74
- lengthCount++;
75
- break;
76
- default:
77
+ } else {
78
+ if (boxShadow.color) {
77
79
  return [];
80
+ }
81
+ if (offsetX != null) {
82
+ keywordDetectedAfterLength = true;
83
+ }
84
+ boxShadow.color = arg;
85
+ continue;
78
86
  }
79
87
  }
80
88
 
@@ -96,11 +104,7 @@ function parseLength(length: string): number | null {
96
104
  const argsWithUnitsRegex = /([+-]?\d*(\.\d+)?)([\w\W]+)?/g;
97
105
  const match = argsWithUnitsRegex.exec(length);
98
106
 
99
- if (!match || Number.isNaN(match[1])) {
100
- return null;
101
- }
102
-
103
- if (match[3] != null && match[3] !== 'px') {
107
+ if (!match || !isLength(length)) {
104
108
  return null;
105
109
  }
106
110
 
@@ -122,13 +126,21 @@ export function processBoxShadow(props: StyleProps) {
122
126
 
123
127
  const rawBoxShadows = props.boxShadow;
124
128
 
125
- if (rawBoxShadows === '') {
129
+ if (rawBoxShadows === null) {
126
130
  return result;
127
131
  }
128
132
 
129
- const boxShadowList = parseBoxShadowString(
130
- (rawBoxShadows as string).replace(/\n/g, ' ')
131
- );
133
+ let boxShadowList: Array<BoxShadowValue>;
134
+
135
+ if (typeof rawBoxShadows === 'string') {
136
+ boxShadowList = parseBoxShadowString(rawBoxShadows.replace(/\n/g, ' '));
137
+ } else if (Array.isArray(rawBoxShadows)) {
138
+ boxShadowList = rawBoxShadows;
139
+ } else {
140
+ throw new ReanimatedError(
141
+ `Box shadow value must be an array of shadow objects or a string. Received: ${JSON.stringify(rawBoxShadows)}`
142
+ );
143
+ }
132
144
 
133
145
  for (const rawBoxShadow of boxShadowList) {
134
146
  const parsedBoxShadow: ParsedBoxShadow = {
@@ -2,7 +2,7 @@
2
2
  import type { ShadowNodeWrapper } from '../commonTypes';
3
3
  import type { Descriptor } from '../hook/commonTypes';
4
4
  import { isFabric } from '../PlatformChecker';
5
- import updateProps from '../UpdateProps';
5
+ import { updateProps } from '../updateProps';
6
6
  import type {
7
7
  PanGestureHandlerEventPayload,
8
8
  ScreenTransitionConfig,
@@ -0,0 +1,4 @@
1
+ 'use strict';
2
+
3
+ export { default as updateProps } from './updateProps';
4
+ export { updatePropsJestWrapper } from './updateProps';