react-native-reanimated 4.4.1 → 4.4.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.
Files changed (95) hide show
  1. package/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperationInterpolator.cpp +12 -5
  2. package/Common/cpp/reanimated/CSS/misc/ViewStylesRepository.cpp +63 -36
  3. package/Common/cpp/reanimated/CSS/misc/ViewStylesRepository.h +6 -8
  4. package/Common/cpp/reanimated/CSS/svg/values/SVGStrokeDashArray.cpp +5 -0
  5. package/Common/cpp/reanimated/Fabric/ReanimatedMountHook.cpp +25 -12
  6. package/Common/cpp/reanimated/Fabric/ReanimatedMountHook.h +3 -0
  7. package/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.cpp +54 -24
  8. package/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.h +13 -6
  9. package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.cpp +6 -2
  10. package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.h +44 -1
  11. package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.cpp +125 -43
  12. package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.cpp +228 -102
  13. package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.h +4 -0
  14. package/Common/cpp/reanimated/LayoutAnimations/SharedTransitions.cpp +8 -3
  15. package/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.cpp +7 -21
  16. package/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.h +0 -16
  17. package/android/CMakeLists.txt +6 -0
  18. package/android/build.gradle.kts +21 -1
  19. package/android/src/main/java/com/swmansion/reanimated/NativeProxy.kt +46 -2
  20. package/android/src/main/java/com/swmansion/reanimated/keyboard/KeyboardAnimationCallback.kt +8 -1
  21. package/apple/reanimated/apple/ReanimatedModule.mm +12 -1
  22. package/compatibility.json +1 -1
  23. package/lib/module/PropsRegistryGarbageCollector.js +3 -6
  24. package/lib/module/PropsRegistryGarbageCollector.js.map +1 -1
  25. package/lib/module/animation/styleAnimation.js +4 -3
  26. package/lib/module/animation/styleAnimation.js.map +1 -1
  27. package/lib/module/common/constants/platform.js +4 -4
  28. package/lib/module/common/constants/platform.js.map +1 -1
  29. package/lib/module/createAnimatedComponent/AnimatedComponent.js +1 -1
  30. package/lib/module/createAnimatedComponent/AnimatedComponent.js.map +1 -1
  31. package/lib/module/createAnimatedComponent/getViewInfo.js +3 -1
  32. package/lib/module/createAnimatedComponent/getViewInfo.js.map +1 -1
  33. package/lib/module/css/component/AnimatedComponent.js +0 -2
  34. package/lib/module/css/component/AnimatedComponent.js.map +1 -1
  35. package/lib/module/css/native/managers/CSSManager.js +5 -5
  36. package/lib/module/css/native/managers/CSSManager.js.map +1 -1
  37. package/lib/module/css/native/managers/CSSTransitionsManager.js +8 -1
  38. package/lib/module/css/native/managers/CSSTransitionsManager.js.map +1 -1
  39. package/lib/module/css/svg/native/processors/stroke.js +9 -5
  40. package/lib/module/css/svg/native/processors/stroke.js.map +1 -1
  41. package/lib/module/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +6 -3
  42. package/lib/module/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -1
  43. package/lib/module/layoutReanimation/animationsManager.js +39 -11
  44. package/lib/module/layoutReanimation/animationsManager.js.map +1 -1
  45. package/lib/module/mappers.js +1 -1
  46. package/lib/module/mappers.js.map +1 -1
  47. package/lib/module/platform-specific/findHostInstance.js +8 -5
  48. package/lib/module/platform-specific/findHostInstance.js.map +1 -1
  49. package/lib/module/platform-specific/jsVersion.js +1 -1
  50. package/lib/module/updateProps/updateProps.js +3 -2
  51. package/lib/module/updateProps/updateProps.js.map +1 -1
  52. package/lib/module/valueSetter.js +6 -7
  53. package/lib/module/valueSetter.js.map +1 -1
  54. package/lib/typescript/PropsRegistryGarbageCollector.d.ts +0 -1
  55. package/lib/typescript/PropsRegistryGarbageCollector.d.ts.map +1 -1
  56. package/lib/typescript/animation/styleAnimation.d.ts +1 -1
  57. package/lib/typescript/animation/styleAnimation.d.ts.map +1 -1
  58. package/lib/typescript/common/constants/platform.d.ts.map +1 -1
  59. package/lib/typescript/createAnimatedComponent/AnimatedComponent.d.ts.map +1 -1
  60. package/lib/typescript/createAnimatedComponent/commonTypes.d.ts +0 -1
  61. package/lib/typescript/createAnimatedComponent/commonTypes.d.ts.map +1 -1
  62. package/lib/typescript/createAnimatedComponent/getViewInfo.d.ts.map +1 -1
  63. package/lib/typescript/css/component/AnimatedComponent.d.ts +0 -1
  64. package/lib/typescript/css/component/AnimatedComponent.d.ts.map +1 -1
  65. package/lib/typescript/css/native/managers/CSSTransitionsManager.d.ts +5 -1
  66. package/lib/typescript/css/native/managers/CSSTransitionsManager.d.ts.map +1 -1
  67. package/lib/typescript/css/svg/native/processors/stroke.d.ts.map +1 -1
  68. package/lib/typescript/layoutReanimation/animationBuilder/ComplexAnimationBuilder.d.ts +17 -14
  69. package/lib/typescript/layoutReanimation/animationBuilder/ComplexAnimationBuilder.d.ts.map +1 -1
  70. package/lib/typescript/layoutReanimation/animationsManager.d.ts.map +1 -1
  71. package/lib/typescript/platform-specific/findHostInstance.d.ts.map +1 -1
  72. package/lib/typescript/platform-specific/jsVersion.d.ts +1 -1
  73. package/lib/typescript/platform-specific/types.d.ts +1 -0
  74. package/lib/typescript/platform-specific/types.d.ts.map +1 -1
  75. package/lib/typescript/updateProps/updateProps.d.ts.map +1 -1
  76. package/package.json +3 -3
  77. package/scripts/reanimated_utils.rb +7 -0
  78. package/src/PropsRegistryGarbageCollector.ts +3 -6
  79. package/src/animation/styleAnimation.ts +5 -3
  80. package/src/common/constants/platform.ts +4 -4
  81. package/src/createAnimatedComponent/AnimatedComponent.tsx +3 -1
  82. package/src/createAnimatedComponent/commonTypes.ts +0 -1
  83. package/src/createAnimatedComponent/getViewInfo.ts +3 -1
  84. package/src/css/component/AnimatedComponent.tsx +0 -2
  85. package/src/css/native/managers/CSSManager.ts +8 -8
  86. package/src/css/native/managers/CSSTransitionsManager.ts +9 -2
  87. package/src/css/svg/native/processors/stroke.ts +9 -6
  88. package/src/layoutReanimation/animationBuilder/ComplexAnimationBuilder.ts +39 -36
  89. package/src/layoutReanimation/animationsManager.ts +41 -11
  90. package/src/mappers.ts +1 -1
  91. package/src/platform-specific/findHostInstance.ts +7 -7
  92. package/src/platform-specific/jsVersion.ts +1 -1
  93. package/src/platform-specific/types.ts +2 -0
  94. package/src/updateProps/updateProps.ts +3 -2
  95. package/src/valueSetter.ts +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"ComplexAnimationBuilder.d.ts","sourceRoot":"","sources":["../../../../src/layoutReanimation/animationBuilder/ComplexAnimationBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,iBAAiB,EAEjB,cAAc,EACd,wBAAwB,EACxB,UAAU,EACX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;;;GAIG;AACH,KAAK,2BAA2B,GAAG,OAAO,oBAAoB,GAC5D,CAAC,UAAU,sBAAsB,CAAC,CAAC;AAErC,qBAAa,sBAAuB,SAAQ,oBAAoB;IAC9D,OAAO,CAAC,EAAE,cAAc,GAAG,qBAAqB,CAAC;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,cAAc,EAAE,CAAC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AG,IAAI;IAKjD;;;;OAIG;IACH,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAC7B,IAAI,EAAE,4BAA4B,CAAC,OAAO,CAAC,EAC3C,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,GACvB,uBAAuB,CAAC,OAAO,CAAC;IAKnC,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI;CAIjD"}
1
+ {"version":3,"file":"ComplexAnimationBuilder.d.ts","sourceRoot":"","sources":["../../../../src/layoutReanimation/animationBuilder/ComplexAnimationBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,iBAAiB,EAEjB,cAAc,EACd,wBAAwB,EACxB,UAAU,EACX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;;;;;;GAOG;AACH,KAAK,2BAA2B,GAAG,OAAO,oBAAoB,GAC5D,CAAC,UAAU,sBAAsB,CAAC,CAAC;AAErC,qBAAa,sBAAuB,SAAQ,oBAAoB;IAC9D,OAAO,CAAC,EAAE,cAAc,GAAG,qBAAqB,CAAC;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC,SAAS,OAAO,oBAAoB,EAC3D,IAAI,EAAE,CAAC,KACJ,YAAY,CAAC,CAAC,CAAC,CAAC;IAErB;;;;;;;OAOG;IACH,MAAM,CAAC,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OAAO,CAAC,CAAC;IACjC,YAAY,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAEhC;;;;OAIG;IACH,MAAM,CAAC,iBAAiB,CAAC,OAAO,EAC9B,IAAI,EAAE,4BAA4B,CAAC,OAAO,CAAC,EAC3C,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,GACvB,uBAAuB,CAAC,OAAO,CAAC;IAKnC,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI;IAKjD;;;;OAIG;IACH,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAC7B,IAAI,EAAE,4BAA4B,CAAC,OAAO,CAAC,EAC3C,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,GACvB,uBAAuB,CAAC,OAAO,CAAC;IAKnC,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI;CAIjD"}
@@ -1 +1 @@
1
- {"version":3,"file":"animationsManager.d.ts","sourceRoot":"","sources":["../../../src/layoutReanimation/animationsManager.ts"],"names":[],"mappings":"AAMA,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,CA6DA;AAUD,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAC9C,OAAO,4BAA4B,CACpC,CAAC"}
1
+ {"version":3,"file":"animationsManager.d.ts","sourceRoot":"","sources":["../../../src/layoutReanimation/animationsManager.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAEV,4BAA4B,EAG7B,MAAM,gBAAgB,CAAC;AAiCxB,iBAAS,4BAA4B,IAAI;IACvC,KAAK,EAAE,4BAA4B,CAAC;IACpC,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B,CAoFA;AAUD,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAC9C,OAAO,4BAA4B,CACpC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"findHostInstance.d.ts","sourceRoot":"","sources":["../../../src/platform-specific/findHostInstance.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wCAAwC,CAAC;AAC7F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAsC5C,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,8BAA8B,GAAG,oBAAoB,GACzD,YAAY,CAqBd"}
1
+ {"version":3,"file":"findHostInstance.d.ts","sourceRoot":"","sources":["../../../src/platform-specific/findHostInstance.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wCAAwC,CAAC;AAC7F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAwC5C,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,8BAA8B,GAAG,oBAAoB,GACzD,YAAY,CAmBd"}
@@ -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.4.1";
6
+ export declare const jsVersion = "4.4.3";
7
7
  //# sourceMappingURL=jsVersion.d.ts.map
@@ -1,6 +1,7 @@
1
1
  export type HostInstance = {
2
2
  __internalInstanceHandle?: Record<string, unknown>;
3
3
  __nativeTag?: number;
4
+ __viewConfig?: Record<string, unknown>;
4
5
  _viewConfig?: Record<string, unknown>;
5
6
  };
6
7
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/platform-specific/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,GAAG;IACzB,wBAAwB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACvC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/platform-specific/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,GAAG;IACzB,wBAAwB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEvC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACvC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"updateProps.d.ts","sourceRoot":"","sources":["../../../src/updateProps/updateProps.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAYvC,OAAO,KAAK,EACV,aAAa,EAGd,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAEV,WAAW,EACZ,MAAM,wCAAwC,CAAC;AAGhD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAMtD,QAAA,IAAI,WAAW,EAAE,CACf,eAAe,EAAE,sBAAsB,EACvC,OAAO,EAAE,WAAW,EACpB,eAAe,CAAC,EAAE,OAAO,KACtB,IAAI,CAAC;AA6CV,eAAO,MAAM,sBAAsB,GACjC,iBAAiB,sBAAsB,EAEvC,SAAS,aAAa,CAAC,GAAG,CAAC,EAE3B,gBAAgB,SAAS,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,EAE7C,UAAU,CAAC,CAAC,OAAO,EAAE,aAAa,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,EAAE,KAClD,IAUF,CAAC;AAEF,eAAe,WAAW,CAAC;AA0G3B;;;GAGG;AACH,UAAU,sBAAsB;IAC9B,KAAK,EAAE,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;CAC/B"}
1
+ {"version":3,"file":"updateProps.d.ts","sourceRoot":"","sources":["../../../src/updateProps/updateProps.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAYvC,OAAO,KAAK,EACV,aAAa,EAGd,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAEV,WAAW,EACZ,MAAM,wCAAwC,CAAC;AAGhD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAMtD,QAAA,IAAI,WAAW,EAAE,CACf,eAAe,EAAE,sBAAsB,EACvC,OAAO,EAAE,WAAW,EACpB,eAAe,CAAC,EAAE,OAAO,KACtB,IAAI,CAAC;AA6CV,eAAO,MAAM,sBAAsB,GACjC,iBAAiB,sBAAsB,EAEvC,SAAS,aAAa,CAAC,GAAG,CAAC,EAE3B,gBAAgB,SAAS,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,EAE7C,UAAU,CAAC,CAAC,OAAO,EAAE,aAAa,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,EAAE,KAClD,IAUF,CAAC;AAEF,eAAe,WAAW,CAAC;AA2G3B;;;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": "4.4.1",
3
+ "version": "4.4.3",
4
4
  "description": "More powerful alternative to Animated library for React Native.",
5
5
  "keywords": [
6
6
  "react-native",
@@ -101,7 +101,7 @@
101
101
  "peerDependencies": {
102
102
  "react": "*",
103
103
  "react-native": "0.83 - 0.86",
104
- "react-native-worklets": "0.9.x"
104
+ "react-native-worklets": "0.9.x || 0.10.x"
105
105
  },
106
106
  "devDependencies": {
107
107
  "@babel/core": "7.28.4",
@@ -135,7 +135,7 @@
135
135
  "react-native": "0.85.2",
136
136
  "react-native-svg": "15.15.4",
137
137
  "react-native-web": "0.21.1",
138
- "react-native-worklets": "0.9.1",
138
+ "react-native-worklets": "0.9.3",
139
139
  "react-test-renderer": "19.2.3",
140
140
  "typescript": "5.9.3"
141
141
  },
@@ -59,6 +59,13 @@ def assert_conflicting_feature_flags(feature_flags)
59
59
  if ios_sync_ui_props && shared_element_transitions
60
60
  raise "[Reanimated] The feature flags `IOS_SYNCHRONOUSLY_UPDATE_UI_PROPS` and `ENABLE_SHARED_ELEMENT_TRANSITIONS` cannot be enabled simultaneously. Please disable one of them in your package.json"
61
61
  end
62
+
63
+ use_animation_backend = feature_flags['USE_ANIMATION_BACKEND'] == 'true'
64
+ force_react_render_for_settled_animations = feature_flags['FORCE_REACT_RENDER_FOR_SETTLED_ANIMATIONS'] == 'true'
65
+
66
+ if use_animation_backend && force_react_render_for_settled_animations
67
+ raise "[Reanimated] The feature flags `USE_ANIMATION_BACKEND` and `FORCE_REACT_RENDER_FOR_SETTLED_ANIMATIONS` cannot be enabled simultaneously. If you want to use the animation backend, you need to explicitly disable `FORCE_REACT_RENDER_FOR_SETTLED_ANIMATIONS` feature flag (enabled by default) in your package.json"
68
+ end
62
69
  end
63
70
 
64
71
  def get_static_feature_flags()
@@ -11,7 +11,6 @@ import { ReanimatedModule } from './ReanimatedModule';
11
11
  const FLUSH_INTERVAL_MS = 500;
12
12
 
13
13
  export const PropsRegistryGarbageCollector = {
14
- viewsCount: 0,
15
14
  viewsMap: new Map<number, IAnimatedComponentInternal>(),
16
15
  intervalId: null as NodeJS.Timeout | null,
17
16
 
@@ -25,16 +24,14 @@ export const PropsRegistryGarbageCollector = {
25
24
  return;
26
25
  }
27
26
  this.viewsMap.set(viewTag, component);
28
- this.viewsCount++;
29
- if (this.viewsCount === 1) {
27
+ if (this.viewsMap.size === 1) {
30
28
  this.registerInterval();
31
29
  }
32
30
  },
33
31
 
34
32
  unregisterView(viewTag: number) {
35
- this.viewsMap.delete(viewTag);
36
- this.viewsCount--;
37
- if (this.viewsCount === 0) {
33
+ const deleted = this.viewsMap.delete(viewTag);
34
+ if (deleted && this.viewsMap.size === 0) {
38
35
  this.unregisterInterval();
39
36
  }
40
37
  },
@@ -73,7 +73,8 @@ interface NestedObjectEntry<T> {
73
73
 
74
74
  export function withStyleAnimation(
75
75
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
76
- styleAnimations: AnimatedStyle<any>
76
+ styleAnimations: AnimatedStyle<any>,
77
+ callback?: (finished: boolean) => void
77
78
  ): StyleLayoutAnimation {
78
79
  'worklet';
79
80
  return defineAnimation<StyleLayoutAnimation>({}, () => {
@@ -236,7 +237,7 @@ export function withStyleAnimation(
236
237
  }
237
238
  };
238
239
 
239
- const callback = (finished: boolean): void => {
240
+ const styleAnimationCallback = (finished: boolean): void => {
240
241
  if (!finished) {
241
242
  const animationsToCheck: NestedObjectValues<AnimationObject>[] = [
242
243
  styleAnimations,
@@ -267,6 +268,7 @@ export function withStyleAnimation(
267
268
  }
268
269
  }
269
270
  }
271
+ callback?.(finished);
270
272
  };
271
273
 
272
274
  return {
@@ -275,7 +277,7 @@ export function withStyleAnimation(
275
277
  onStart,
276
278
  current: {},
277
279
  styleAnimations,
278
- callback,
280
+ callback: styleAnimationCallback,
279
281
  } as StyleLayoutAnimation;
280
282
  });
281
283
  }
@@ -10,12 +10,12 @@ function isWindowAvailable() {
10
10
  }
11
11
 
12
12
  export const IS_ANDROID: boolean = /* @__PURE__ */ (() =>
13
- Platform.OS === 'android')();
14
- export const IS_IOS: boolean = /* @__PURE__ */ (() => Platform.OS === 'ios')();
15
- export const IS_WEB: boolean = Platform.OS === 'web';
13
+ Platform?.OS === 'android')();
14
+ export const IS_IOS: boolean = /* @__PURE__ */ (() => Platform?.OS === 'ios')();
15
+ export const IS_WEB: boolean = Platform?.OS === 'web';
16
16
  export const IS_JEST: boolean = !!process.env.JEST_WORKER_ID;
17
17
  /** @knipIgnore */
18
- export const IS_WINDOWS: boolean = Platform.OS === 'windows';
18
+ export const IS_WINDOWS: boolean = Platform?.OS === 'windows';
19
19
 
20
20
  export const IS_WINDOW_AVAILABLE: boolean = isWindowAvailable();
21
21
 
@@ -51,7 +51,9 @@ if (IS_WEB) {
51
51
  }
52
52
 
53
53
  const FORCE_REACT_RENDER_FOR_SETTLED_ANIMATIONS =
54
- getStaticFeatureFlag('FORCE_REACT_RENDER_FOR_SETTLED_ANIMATIONS') && !IS_WEB;
54
+ getStaticFeatureFlag('FORCE_REACT_RENDER_FOR_SETTLED_ANIMATIONS') &&
55
+ !getStaticFeatureFlag('USE_ANIMATION_BACKEND') &&
56
+ !IS_WEB;
55
57
 
56
58
  export type Options<P> = {
57
59
  setNativeProps?: (ref: AnimatedComponentRef, props: P) => void;
@@ -127,7 +127,6 @@ export interface AnimatedComponentRef extends Component {
127
127
  export interface IAnimatedComponentInternalBase {
128
128
  ChildComponent: AnyComponent;
129
129
  _componentRef: AnimatedComponentRef | HTMLElement | null;
130
- _hasAnimatedRef: boolean;
131
130
  _viewInfo?: ViewInfo;
132
131
 
133
132
  /**
@@ -20,7 +20,9 @@ export function getViewInfo(element: HostInstance): {
20
20
  viewTag?: number;
21
21
  } {
22
22
  return {
23
- reactViewName: (element?._viewConfig?.uiViewClassName ??
23
+ reactViewName: (element?.__viewConfig?.uiViewClassName ??
24
+ // ReactFabricHostComponent (e.g. react-native-macos) exposes `_viewConfig`.
25
+ element?._viewConfig?.uiViewClassName ??
24
26
  element?.__internalInstanceHandle?.type ??
25
27
  element?.__internalInstanceHandle?.elementType) as string,
26
28
  viewTag: element?.__nativeTag,
@@ -45,7 +45,6 @@ export default class AnimatedComponent<
45
45
  _viewInfo?: ViewInfo;
46
46
  _cssStyle: CSSStyle = {}; // RN style object with Reanimated CSS properties
47
47
  _componentRef: AnimatedComponentRef | HTMLElement | null = null;
48
- _hasAnimatedRef = false;
49
48
  // Used only on web
50
49
  _componentDOMRef: HTMLElement | null = null;
51
50
  _willUnmount: boolean = false;
@@ -136,7 +135,6 @@ export default class AnimatedComponent<
136
135
  // Component can specify ref which should be animated when animated version of the component is created.
137
136
  // Otherwise, we animate the component itself.
138
137
  if (componentRef && componentRef.getAnimatableRef) {
139
- this._hasAnimatedRef = true;
140
138
  return componentRef.getAnimatableRef();
141
139
  }
142
140
  // Case for SVG components on Web
@@ -61,20 +61,20 @@ export default class CSSManager implements ICSSManager {
61
61
  ? this.propsBuilder.build(filteredStyle)
62
62
  : undefined;
63
63
 
64
+ const transitionDetached = this.cssTransitionsManager.update(
65
+ transitionProperties,
66
+ normalizedStyle ?? {}
67
+ );
68
+
69
+ // Record the committed style as the base so animations and (on Android) a
70
+ // detaching transition can revert to it instead of interpolator defaults.
64
71
  if (
65
72
  normalizedStyle &&
66
- (hasAnimation ||
67
- // We also need to update the current style on Android when the
68
- // transition is detached.
69
- (IS_ANDROID && !hasTransition && this.hadTransitionLastUpdate))
73
+ (hasAnimation || (IS_ANDROID && transitionDetached))
70
74
  ) {
71
75
  setViewStyle(this.viewTag, normalizedStyle);
72
76
  }
73
77
 
74
- this.cssTransitionsManager.update(
75
- transitionProperties,
76
- normalizedStyle ?? {}
77
- );
78
78
  this.cssAnimationsManager.update(animationProperties);
79
79
 
80
80
  this.hadTransitionLastUpdate = hasTransition;
@@ -30,10 +30,14 @@ export default class CSSTransitionsManager implements ICSSTransitionsManager {
30
30
  this.shadowNodeWrapper = shadowNodeWrapper;
31
31
  }
32
32
 
33
+ /**
34
+ * @returns Whether this update detached a running transition (its props were
35
+ * removed, or normalized to an empty config, e.g. when duration is 0).
36
+ */
33
37
  update(
34
38
  transitionProperties: CSSTransitionProperties | null,
35
39
  nextProps: UnknownRecord = {}
36
- ): void {
40
+ ): boolean {
37
41
  const transitionConfig =
38
42
  transitionProperties &&
39
43
  normalizeCSSTransitionProperties(transitionProperties);
@@ -47,8 +51,9 @@ export default class CSSTransitionsManager implements ICSSTransitionsManager {
47
51
  if (!prevProps || !transitionConfig) {
48
52
  if (this.hasTransition) {
49
53
  this.detach();
54
+ return true;
50
55
  }
51
- return;
56
+ return false;
52
57
  }
53
58
 
54
59
  // Trigger transition for changed properties only
@@ -62,6 +67,8 @@ export default class CSSTransitionsManager implements ICSSTransitionsManager {
62
67
  runCSSTransition(this.shadowNodeWrapper, config);
63
68
  this.hasTransition = true;
64
69
  }
70
+
71
+ return false;
65
72
  }
66
73
 
67
74
  unmountCleanup(): void {
@@ -18,18 +18,21 @@ export const processStrokeDashArray: ValueProcessor<
18
18
  if (isLength(value)) {
19
19
  result = [value];
20
20
  } else if (Array.isArray(value)) {
21
- // We have to repeat the same pattern twice if the number of elements is odd
22
- // "If the number of values is odd, the pattern behaves as if it was duplicated
23
- // to yield an even number of values"
24
- // (https://www.w3.org/TR/fill-stroke-3/#valdef-stroke-dasharray-length-percentage)
25
- result =
26
- value.length % 2 === 0 || value.length < 3 ? value : value.concat(value);
21
+ result = [...value];
27
22
  } else if (value === 'none') {
28
23
  return 'none';
29
24
  } else {
30
25
  throw new Error(`[Reanimated] ${ERROR_MESSAGES.invalidDashArray(value)}`);
31
26
  }
32
27
 
28
+ // Per the SVG spec an odd-length dash array is repeated to an even length.
29
+ // react-native-svg's extractStroke does this, but animated values bypass it
30
+ // and an odd-length array crashes Android's DashPathEffect, so we repeat here.
31
+ // https://www.w3.org/TR/fill-stroke-3/#valdef-stroke-dasharray-length-percentage
32
+ if (result.length % 2 === 1) {
33
+ result = result.concat(result);
34
+ }
35
+
33
36
  if (__DEV__) {
34
37
  isValidDashArray(result);
35
38
  }
@@ -12,9 +12,12 @@ import type { EasingFunctionFactory } from '../../Easing';
12
12
  import { BaseAnimationBuilder } from './BaseAnimationBuilder';
13
13
 
14
14
  /**
15
- * `this` type for static methods on {@link AnimationConfigBuilder}. Represents a
16
- * subclass constructor exposing the shared config-only static API inherited
17
- * from {@link BaseAnimationBuilder}.
15
+ * `this` constraint for static modifiers on {@link AnimationConfigBuilder}.
16
+ * Represents a subclass constructor exposing the shared config-only static API
17
+ * inherited from {@link BaseAnimationBuilder}. The modifiers bind `this` to a
18
+ * concrete subtype of this so the chain preserves the receiver's instance type
19
+ * (e.g. `SharedTransition.springify(...)` stays a `SharedTransition`) instead
20
+ * of collapsing to `AnimationConfigBuilder`.
18
21
  */
19
22
  type AnimationConfigBuilderClass = typeof BaseAnimationBuilder &
20
23
  (new () => AnimationConfigBuilder);
@@ -41,10 +44,10 @@ export class AnimationConfigBuilder extends BaseAnimationBuilder {
41
44
  * @param easingFunction - An easing function which defines the animation
42
45
  * curve.
43
46
  */
44
- static easing(
45
- this: AnimationConfigBuilderClass,
47
+ static easing<T extends AnimationConfigBuilderClass>(
48
+ this: T,
46
49
  easingFunction: EasingFunction | EasingFunctionFactory
47
- ): AnimationConfigBuilder {
50
+ ): InstanceType<T> {
48
51
  const instance = this.createInstance();
49
52
  return instance.easing(easingFunction);
50
53
  }
@@ -64,10 +67,10 @@ export class AnimationConfigBuilder extends BaseAnimationBuilder {
64
67
  *
65
68
  * @param degree - The rotation degree.
66
69
  */
67
- static rotate(
68
- this: AnimationConfigBuilderClass,
70
+ static rotate<T extends AnimationConfigBuilderClass>(
71
+ this: T,
69
72
  degree: string
70
- ): AnimationConfigBuilder {
73
+ ): InstanceType<T> {
71
74
  const instance = this.createInstance();
72
75
  return instance.rotate(degree);
73
76
  }
@@ -85,10 +88,10 @@ export class AnimationConfigBuilder extends BaseAnimationBuilder {
85
88
  * @param duration - An optional duration of the spring animation (in
86
89
  * milliseconds).
87
90
  */
88
- static springify(
89
- this: AnimationConfigBuilderClass,
91
+ static springify<T extends AnimationConfigBuilderClass>(
92
+ this: T,
90
93
  duration?: number
91
- ): AnimationConfigBuilder {
94
+ ): InstanceType<T> {
92
95
  const instance = this.createInstance();
93
96
  return instance.springify(duration);
94
97
  }
@@ -106,10 +109,10 @@ export class AnimationConfigBuilder extends BaseAnimationBuilder {
106
109
  *
107
110
  * @param dampingRatio - How damped the spring is.
108
111
  */
109
- static dampingRatio(
110
- this: AnimationConfigBuilderClass,
112
+ static dampingRatio<T extends AnimationConfigBuilderClass>(
113
+ this: T,
111
114
  dampingRatio: number
112
- ): AnimationConfigBuilder {
115
+ ): InstanceType<T> {
113
116
  const instance = this.createInstance();
114
117
  return instance.dampingRatio(dampingRatio);
115
118
  }
@@ -127,10 +130,10 @@ export class AnimationConfigBuilder extends BaseAnimationBuilder {
127
130
  * @param value - Decides how quickly a spring stops moving. Higher damping
128
131
  * means the spring will come to rest faster.
129
132
  */
130
- static damping(
131
- this: AnimationConfigBuilderClass,
133
+ static damping<T extends AnimationConfigBuilderClass>(
134
+ this: T,
132
135
  value: number
133
- ): AnimationConfigBuilder {
136
+ ): InstanceType<T> {
134
137
  const instance = this.createInstance();
135
138
  return instance.damping(value);
136
139
  }
@@ -148,10 +151,10 @@ export class AnimationConfigBuilder extends BaseAnimationBuilder {
148
151
  * @param mass - The weight of the spring. Reducing this value makes the
149
152
  * animation faster.
150
153
  */
151
- static mass(
152
- this: AnimationConfigBuilderClass,
154
+ static mass<T extends AnimationConfigBuilderClass>(
155
+ this: T,
153
156
  mass: number
154
- ): AnimationConfigBuilder {
157
+ ): InstanceType<T> {
155
158
  const instance = this.createInstance();
156
159
  return instance.mass(mass);
157
160
  }
@@ -168,10 +171,10 @@ export class AnimationConfigBuilder extends BaseAnimationBuilder {
168
171
  *
169
172
  * @param stiffness - How bouncy the spring is.
170
173
  */
171
- static stiffness(
172
- this: AnimationConfigBuilderClass,
174
+ static stiffness<T extends AnimationConfigBuilderClass>(
175
+ this: T,
173
176
  stiffness: number
174
- ): AnimationConfigBuilder {
177
+ ): InstanceType<T> {
175
178
  const instance = this.createInstance();
176
179
  return instance.stiffness(stiffness);
177
180
  }
@@ -189,10 +192,10 @@ export class AnimationConfigBuilder extends BaseAnimationBuilder {
189
192
  * @param overshootClamping - Whether a spring can bounce over the final
190
193
  * position.
191
194
  */
192
- static overshootClamping(
193
- this: AnimationConfigBuilderClass,
195
+ static overshootClamping<T extends AnimationConfigBuilderClass>(
196
+ this: T,
194
197
  overshootClamping: number
195
- ): AnimationConfigBuilder {
198
+ ): InstanceType<T> {
196
199
  const instance = this.createInstance();
197
200
  return instance.overshootClamping(overshootClamping);
198
201
  }
@@ -206,10 +209,10 @@ export class AnimationConfigBuilder extends BaseAnimationBuilder {
206
209
  * @deprecated Use {@link energyThreshold} instead. This method currently does
207
210
  * nothing and will be removed in the upcoming major version.
208
211
  */
209
- static restDisplacementThreshold(
210
- this: AnimationConfigBuilderClass,
212
+ static restDisplacementThreshold<T extends AnimationConfigBuilderClass>(
213
+ this: T,
211
214
  _restDisplacementThreshold: number
212
- ): AnimationConfigBuilder {
215
+ ): InstanceType<T> {
213
216
  return this.createInstance();
214
217
  }
215
218
 
@@ -225,10 +228,10 @@ export class AnimationConfigBuilder extends BaseAnimationBuilder {
225
228
  * @deprecated Use {@link energyThreshold} instead. This method currently does
226
229
  * nothing and will be removed in a future version.
227
230
  */
228
- static restSpeedThreshold(
229
- this: AnimationConfigBuilderClass,
231
+ static restSpeedThreshold<T extends AnimationConfigBuilderClass>(
232
+ this: T,
230
233
  _restSpeedThreshold: number
231
- ): AnimationConfigBuilder {
234
+ ): InstanceType<T> {
232
235
  return this.createInstance();
233
236
  }
234
237
 
@@ -248,10 +251,10 @@ export class AnimationConfigBuilder extends BaseAnimationBuilder {
248
251
  * @param energyThreshold - Relative energy threshold below which the spring
249
252
  * will snap to `toValue` without further oscillations. Defaults to 6e-9.
250
253
  */
251
- static energyThreshold(
252
- this: AnimationConfigBuilderClass,
254
+ static energyThreshold<T extends AnimationConfigBuilderClass>(
255
+ this: T,
253
256
  energyThreshold: number
254
- ): AnimationConfigBuilder {
257
+ ): InstanceType<T> {
255
258
  const instance = this.createInstance();
256
259
  return instance.energyThreshold(energyThreshold);
257
260
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { runOnUISync } from 'react-native-worklets';
4
4
 
5
- import { withStyleAnimation } from '../animation';
5
+ import { cancelAnimation, withStyleAnimation } from '../animation';
6
6
  import { SHOULD_BE_USE_WEB } from '../common';
7
7
  import type {
8
8
  LayoutAnimation,
@@ -11,28 +11,35 @@ import type {
11
11
  SharedValue,
12
12
  } from '../commonTypes';
13
13
  import { LayoutAnimationType } from '../commonTypes';
14
+ import { getStaticFeatureFlag } from '../featureFlags';
14
15
  import { makeMutableUI } from '../mutables';
15
16
 
16
17
  const TAG_OFFSET = 1e9;
17
18
 
19
+ const USE_ANIMATION_BACKEND = getStaticFeatureFlag('USE_ANIMATION_BACKEND');
20
+
18
21
  function startObservingProgress(
19
22
  tag: number,
20
- sharedValue: SharedValue<Record<string, unknown>>
23
+ sharedValue: SharedValue<Record<string, unknown>>,
24
+ scheduleFlush: () => void
21
25
  ): void {
22
26
  'worklet';
23
27
  sharedValue.addListener(tag + TAG_OFFSET, () => {
24
28
  global._notifyAboutProgress(tag, sharedValue.value);
29
+ scheduleFlush();
25
30
  });
26
31
  }
27
32
 
28
33
  function stopObservingProgress(
29
34
  tag: number,
30
35
  sharedValue: SharedValue<number>,
36
+ scheduleFlush: () => void,
31
37
  removeView = false
32
38
  ): void {
33
39
  'worklet';
34
40
  sharedValue.removeListener(tag + TAG_OFFSET);
35
41
  global._notifyAboutEnd(tag, removeView);
42
+ scheduleFlush();
36
43
  }
37
44
 
38
45
  function createLayoutAnimationManager(): {
@@ -43,6 +50,27 @@ function createLayoutAnimationManager(): {
43
50
  const currentAnimationForTag = new Map();
44
51
  const mutableValuesForTag = new Map();
45
52
 
53
+ // Flush layout-animation progress once per frame via the frame finalizer
54
+ // (after all `requestAnimationFrame` callbacks), reusing the same
55
+ // `_maybeFlushUIUpdatesQueue` path as animated-prop updates.
56
+ // This finalizer runs after the mapper run (which re-queues itself a frame
57
+ // ahead, so it sits earlier in the finalizer queue). When a mapper-driven
58
+ // animation is also active, its flush runs first and already commits the
59
+ // layout-animation updates too, so our `_maybeFlushUIUpdatesQueue` here is a
60
+ // no-op; when only layout animations run, this is the single flush.
61
+ // The backend drives its own flush from `runGrandCallback`, so this is non-backend only.
62
+ let flushRequested = false;
63
+ const scheduleFlush = () => {
64
+ if (USE_ANIMATION_BACKEND || flushRequested) {
65
+ return;
66
+ }
67
+ flushRequested = true;
68
+ globalThis.requestAnimationFrameFinalizer(() => {
69
+ flushRequested = false;
70
+ global._maybeFlushUIUpdatesQueue();
71
+ });
72
+ };
73
+
46
74
  return {
47
75
  start(
48
76
  tag: number,
@@ -70,25 +98,23 @@ function createLayoutAnimationManager(): {
70
98
  value = makeMutableUI(style.initialValues);
71
99
  mutableValuesForTag.set(tag, value);
72
100
  } else {
73
- stopObservingProgress(tag, value);
101
+ stopObservingProgress(tag, value, scheduleFlush);
74
102
  value._value = style.initialValues;
75
103
  }
76
104
 
77
- const animation = withStyleAnimation(currentAnimation);
78
-
79
- animation.callback = (finished?: boolean) => {
105
+ const animation = withStyleAnimation(currentAnimation, (finished) => {
80
106
  if (finished) {
81
107
  currentAnimationForTag.delete(tag);
82
108
  mutableValuesForTag.delete(tag);
83
109
  const shouldRemoveView = type === LayoutAnimationType.EXITING;
84
- stopObservingProgress(tag, value, shouldRemoveView);
110
+ stopObservingProgress(tag, value, scheduleFlush, shouldRemoveView);
85
111
  }
86
112
  if (style.callback) {
87
- style.callback(finished === undefined ? false : finished);
113
+ style.callback(finished);
88
114
  }
89
- };
115
+ });
90
116
 
91
- startObservingProgress(tag, value);
117
+ startObservingProgress(tag, value, scheduleFlush);
92
118
  value.value = animation;
93
119
  },
94
120
  stop(tag: number) {
@@ -96,7 +122,11 @@ function createLayoutAnimationManager(): {
96
122
  if (!value) {
97
123
  return;
98
124
  }
99
- stopObservingProgress(tag, value);
125
+ // native already made its cleanup, so we just do cleanup here on JS side
126
+ value.removeListener(tag + TAG_OFFSET);
127
+ cancelAnimation(value);
128
+ currentAnimationForTag.delete(tag);
129
+ mutableValuesForTag.delete(tag);
100
130
  },
101
131
  };
102
132
  }
package/src/mappers.ts CHANGED
@@ -103,13 +103,13 @@ function createMapperRegistry() {
103
103
  updateMappersOrder();
104
104
  }
105
105
  if (isAnyMapperDirty) {
106
+ isAnyMapperDirty = false;
106
107
  for (const mapper of sortedMappers) {
107
108
  if (mapper.dirty) {
108
109
  mapper.dirty = false;
109
110
  mapper.worklet();
110
111
  }
111
112
  }
112
- isAnyMapperDirty = false;
113
113
  }
114
114
  } finally {
115
115
  processingMappers = false;