@react-native-ohos/react-native-reanimated 4.0.2-beta.1 → 4.1.0-beta.1

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 (196) hide show
  1. package/CHANGELOG.md +1070 -0
  2. package/LICENSE +21 -0
  3. package/README.md +842 -0
  4. package/compatibility.json +20 -26
  5. package/harmony/reanimated/BuildProfile.ets +1 -1
  6. package/harmony/reanimated/index.ets +4 -2
  7. package/harmony/reanimated/oh-package-lock.json5 +1 -1
  8. package/harmony/reanimated/oh-package.json5 +1 -1
  9. package/harmony/reanimated/src/main/cpp/CMakeLists.txt +23 -9
  10. package/harmony/reanimated/src/main/cpp/Common/NativeView/CMakeLists.txt +56 -0
  11. package/harmony/reanimated/src/main/cpp/Common/NativeView/react/renderer/components/rnreanimated/ComponentDescriptors.h +19 -0
  12. package/harmony/reanimated/src/main/cpp/Common/NativeView/react/renderer/components/rnreanimated/REASharedTransitionBoundaryComponentDescriptor.h +30 -0
  13. package/harmony/reanimated/src/main/cpp/Common/NativeView/react/renderer/components/rnreanimated/REASharedTransitionBoundaryShadowNode.cpp +15 -0
  14. package/harmony/reanimated/src/main/cpp/Common/NativeView/react/renderer/components/rnreanimated/REASharedTransitionBoundaryShadowNode.h +41 -0
  15. package/harmony/reanimated/src/main/cpp/Common/NativeView/react/renderer/components/rnreanimated/REASharedTransitionBoundaryState.h +30 -0
  16. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.cpp +8 -9
  17. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.h +3 -6
  18. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/InterpolatorRegistry.cpp +203 -150
  19. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/InterpolatorRegistry.h +1 -6
  20. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/definitions.h +2 -7
  21. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSAngle.cpp +0 -1
  22. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSColor.cpp +2 -18
  23. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSDiscreteArray.cpp +11 -11
  24. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSDiscreteArray.h +2 -6
  25. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSLength.cpp +4 -1
  26. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSNumber.cpp +5 -0
  27. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSNumber.h +8 -0
  28. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSValue.h +27 -46
  29. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSValueVariant.cpp +20 -20
  30. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSValueVariant.h +2 -2
  31. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/complex/CSSDropShadow.h +3 -3
  32. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSAnimationConfig.cpp +10 -2
  33. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSAnimationConfig.h +5 -3
  34. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSKeyframesConfig.cpp +20 -17
  35. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSKeyframesConfig.h +5 -8
  36. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSTransitionConfig.cpp +33 -66
  37. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSTransitionConfig.h +29 -22
  38. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/common.cpp +14 -2
  39. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/common.h +8 -2
  40. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSAnimation.cpp +50 -91
  41. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSAnimation.h +43 -18
  42. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSAnimationsGroup.cpp +63 -0
  43. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSAnimationsGroup.h +37 -0
  44. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSLoopAnimation.cpp +100 -0
  45. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSLoopAnimation.h +49 -0
  46. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSPlatformAnimation.h +13 -0
  47. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSPlatformAnimationFactory.h +32 -0
  48. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/transition/CSSLoopTransition.cpp +156 -0
  49. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/transition/CSSLoopTransition.h +71 -0
  50. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/transition/CSSPlatformTransitionProxy.cpp +141 -0
  51. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/transition/CSSPlatformTransitionProxy.h +104 -0
  52. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/transition/CSSTransition.cpp +97 -0
  53. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/transition/CSSTransition.h +69 -0
  54. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/EasingConfigs.cpp +89 -0
  55. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/EasingConfigs.h +36 -0
  56. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/InterpolatorFactory.cpp +12 -0
  57. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/InterpolatorFactory.h +11 -2
  58. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/PropertyInterpolator.cpp +2 -3
  59. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/PropertyInterpolator.h +3 -5
  60. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterOperation.cpp +3 -3
  61. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterOperation.h +1 -1
  62. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/ArrayPropertiesInterpolator.cpp +38 -37
  63. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/ArrayPropertiesInterpolator.h +3 -6
  64. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/RecordPropertiesInterpolator.cpp +54 -32
  65. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/RecordPropertiesInterpolator.h +5 -7
  66. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/OperationsStyleInterpolator.cpp +46 -46
  67. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/OperationsStyleInterpolator.h +8 -7
  68. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/StyleOperation.h +4 -57
  69. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/AnimationStyleInterpolator.cpp +23 -0
  70. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/AnimationStyleInterpolator.h +10 -8
  71. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/AnimationStyleInterpolatorFactory.cpp +77 -0
  72. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/AnimationStyleInterpolatorFactory.h +38 -0
  73. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/TransitionStyleInterpolator.cpp +47 -68
  74. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/TransitionStyleInterpolator.h +21 -9
  75. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperation.cpp +4 -1
  76. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperationInterpolator.cpp +35 -78
  77. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperationInterpolator.h +44 -13
  78. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/matrix.cpp +13 -11
  79. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ResolvableValueInterpolator.cpp +4 -0
  80. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/SimpleValueInterpolator.cpp +7 -3
  81. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ValueInterpolator.cpp +20 -27
  82. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ValueInterpolator.h +12 -9
  83. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/misc/ViewStylesRepository.cpp +63 -36
  84. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/misc/ViewStylesRepository.h +6 -8
  85. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/AnimationProgressProvider.cpp +55 -46
  86. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/AnimationProgressProvider.h +8 -5
  87. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/RawProgressProvider.cpp +1 -2
  88. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/RawProgressProvider.h +3 -2
  89. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/TransitionProgressProvider.cpp +76 -71
  90. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/TransitionProgressProvider.h +17 -14
  91. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSAnimationsRegistry.cpp +145 -273
  92. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSAnimationsRegistry.h +43 -44
  93. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSKeyframesRegistry.cpp +19 -19
  94. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSKeyframesRegistry.h +16 -12
  95. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSTransitionsRegistry.cpp +95 -114
  96. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSTransitionsRegistry.h +38 -25
  97. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/StaticPropsRegistry.cpp +9 -34
  98. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/StaticPropsRegistry.h +0 -10
  99. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/CSSLengthArray.cpp +47 -0
  100. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/CSSLengthArray.h +24 -0
  101. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/CSSLengthVector.cpp +87 -0
  102. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/CSSLengthVector.h +28 -0
  103. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGPath.cpp +326 -0
  104. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGPath.h +65 -0
  105. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGStops.cpp +164 -0
  106. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGStops.h +51 -0
  107. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGStrokeDashArray.cpp +14 -66
  108. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGStrokeDashArray.h +7 -18
  109. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/platform.cpp +284 -0
  110. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/platform.h +31 -0
  111. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/props.cpp +13 -132
  112. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/props.h +3 -21
  113. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/reversingShortening.h +43 -0
  114. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Compat/WorkletsApi.h +13 -0
  115. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Events/UIEventHandler.cpp +33 -0
  116. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Events/UIEventHandler.h +39 -0
  117. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Events/UIEventHandlerRegistry.cpp +95 -0
  118. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Events/UIEventHandlerRegistry.h +40 -0
  119. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.cpp +20 -23
  120. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.h +2 -6
  121. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.cpp +26 -18
  122. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.h +4 -8
  123. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.cpp +16 -28
  124. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.h +3 -4
  125. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.cpp +72 -24
  126. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.h +17 -7
  127. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/OperationsLoop.cpp +152 -0
  128. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/OperationsLoop.h +86 -0
  129. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/PropsLayoutFilter.h +98 -0
  130. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistry.cpp +162 -28
  131. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistry.h +69 -11
  132. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistryManager.cpp +41 -17
  133. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistryManager.h +14 -3
  134. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/propNameFromString.h +130 -0
  135. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.cpp +1 -0
  136. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.h +5 -7
  137. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.cpp +7 -4
  138. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.h +52 -9
  139. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.cpp +174 -62
  140. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.h +12 -11
  141. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.cpp +251 -128
  142. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.h +23 -19
  143. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.h +34 -6
  144. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/SharedTransitions.cpp +71 -64
  145. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.cpp +938 -700
  146. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.h +123 -76
  147. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/SynchronousPropsBufferSerializer.cpp +313 -0
  148. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/SynchronousPropsBufferSerializer.h +18 -0
  149. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/PseudoStyles/PseudoSelector.h +41 -0
  150. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/PseudoStyles/PseudoStylesRegistry.cpp +113 -0
  151. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/PseudoStyles/PseudoStylesRegistry.h +73 -0
  152. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.cpp +4 -4
  153. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.cpp +23 -48
  154. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.h +13 -14
  155. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/PlatformDepMethodsHolder.h +20 -3
  156. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReaJSIUtils.h +227 -0
  157. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReanimatedVersion.cpp +51 -14
  158. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReanimatedVersion.h +2 -5
  159. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/SingleInstanceChecker.h +76 -0
  160. package/harmony/reanimated/src/main/cpp/OHOSCSSPlatformTransitions.cpp +353 -0
  161. package/harmony/reanimated/src/main/cpp/OHOSCSSPlatformTransitions.h +95 -0
  162. package/harmony/reanimated/src/main/cpp/PseudoSelectorManager.cpp +140 -0
  163. package/harmony/reanimated/src/main/cpp/PseudoSelectorManager.h +52 -0
  164. package/harmony/reanimated/src/main/cpp/REASharedTransitionBoundaryComponentInstance.cpp +45 -0
  165. package/harmony/reanimated/src/main/cpp/REASharedTransitionBoundaryComponentInstance.h +33 -0
  166. package/harmony/reanimated/src/main/cpp/REASharedTransitionBoundaryJSIBinder.h +20 -0
  167. package/harmony/reanimated/src/main/cpp/ReanimatedModule.cpp +112 -19
  168. package/harmony/reanimated/src/main/cpp/ReanimatedModule.h +4 -2
  169. package/harmony/reanimated/src/main/cpp/ReanimatedNodesManager.cpp +1 -1
  170. package/harmony/reanimated/src/main/cpp/ReanimatedNodesManager.h +1 -1
  171. package/harmony/reanimated/src/main/cpp/ReanimatedPackage.cpp +24 -1
  172. package/harmony/reanimated/src/main/cpp/ReanimatedPackage.h +7 -2
  173. package/harmony/reanimated/src/main/cpp/ReanimatedSensor.cpp +88 -57
  174. package/harmony/reanimated/src/main/cpp/ReanimatedSensor.h +4 -2
  175. package/harmony/reanimated/src/main/cpp/ReanimatedSensorContainer.cpp +1 -1
  176. package/harmony/reanimated/src/main/cpp/ReanimatedSensorContainer.h +1 -1
  177. package/harmony/reanimated/src/main/cpp/ReanimatedUIScheduler.cpp +9 -7
  178. package/harmony/reanimated/src/main/cpp/ReanimatedUIScheduler.h +6 -5
  179. package/harmony/reanimated/src/main/cpp/TransformParser.h +1 -1
  180. package/harmony/reanimated/src/main/cpp/codegen/react/renderer/components/rnreanimated/EventEmitters.h +19 -0
  181. package/harmony/reanimated/src/main/cpp/codegen/react/renderer/components/rnreanimated/Props.h +31 -0
  182. package/harmony/reanimated/src/main/ets/KeyboardState.ts +11 -0
  183. package/harmony/reanimated/src/main/ets/ReanimatedModule.ts +119 -19
  184. package/harmony/reanimated/src/main/ets/{ReanimatedPackage.ts → ReanimatedPackage.ets} +4 -3
  185. package/harmony/reanimated.har +0 -0
  186. package/package.json +52 -24
  187. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSTransition.cpp +0 -145
  188. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSTransition.h +0 -47
  189. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGLength.cpp +0 -93
  190. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGLength.h +0 -36
  191. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/DelayedItemsManager.cpp +0 -75
  192. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/DelayedItemsManager.h +0 -45
  193. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.cpp +0 -183
  194. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.h +0 -93
  195. package/harmony/reanimated/src/main/ets/AnimationManager.ts +0 -61
  196. /package/harmony/reanimated/{ts.ts → ts.ets} +0 -0
@@ -4,40 +4,39 @@
4
4
  #include <reanimated/CSS/progress/KeyframeProgressProvider.h>
5
5
  #include <reanimated/CSS/progress/RawProgressProvider.h>
6
6
  #include <reanimated/CSS/utils/props.h>
7
+ #include <reanimated/CSS/utils/reversingShortening.h>
7
8
 
8
9
  #include <memory>
9
10
  #include <string>
10
11
  #include <unordered_map>
11
12
  #include <unordered_set>
13
+ #include <vector>
12
14
 
13
15
  namespace reanimated::css {
14
16
 
15
- enum class TransitionProgressState : std::uint8_t { Pending, Running, Finished };
17
+ enum class TransitionProgressState : std::uint8_t { Idle, Pending, Running };
16
18
 
17
19
  class TransitionPropertyProgressProvider final : public KeyframeProgressProvider, public RawProgressProvider {
18
20
  public:
21
+ TransitionPropertyProgressProvider(double timestamp, double duration, double delay, EasingConfig easing);
19
22
  TransitionPropertyProgressProvider(
20
23
  double timestamp,
21
24
  double duration,
22
25
  double delay,
23
- const EasingFunction &easingFunction);
24
- TransitionPropertyProgressProvider(
25
- double timestamp,
26
- double duration,
27
- double delay,
28
- const EasingFunction &easingFunction,
26
+ EasingConfig easing,
29
27
  double reversingShorteningFactor);
30
28
 
31
29
  double getGlobalProgress() const override;
32
30
  double getKeyframeProgress(double fromOffset, double toOffset) const override;
33
31
  double getRemainingDelay(double timestamp) const;
34
- double getReversingShorteningFactor() const;
32
+ ReversingState getReversingState() const;
35
33
  TransitionProgressState getState() const;
36
34
 
37
35
  protected:
38
36
  std::optional<double> calculateRawProgress(double timestamp) override;
39
37
 
40
38
  private:
39
+ EasingConfig easing_;
41
40
  EasingFunction easingFunction_;
42
41
  double reversingShorteningFactor_ = 1;
43
42
 
@@ -54,18 +53,22 @@ class TransitionProgressProvider final {
54
53
  TransitionPropertyProgressProviders getPropertyProgressProviders() const;
55
54
  std::unordered_set<std::string> getRemovedProperties() const;
56
55
 
56
+ void runProgressProvider(const std::string &propertyName, bool isReversed, double timestamp);
57
+ void removeProperties(const std::vector<std::string> &propertyNames);
58
+ void removeProperty(const std::string &propertyName);
57
59
  void discardFinishedProgressProviders();
58
- void discardIrrelevantProgressProviders(const std::unordered_set<std::string> &transitionPropertyNames);
59
- void runProgressProviders(
60
- double timestamp,
61
- const CSSTransitionPropertiesSettings &propertiesSettings,
62
- const PropertyNames &changedPropertyNames,
63
- const std::unordered_set<std::string> &reversedPropertyNames);
64
60
  void update(double timestamp);
61
+ void setPropertySettings(const PropertiesSettingsMap &changedPropertiesSettings);
62
+ CSSTransitionPropertySettings getPropertySettings(const std::string &propertyName) const;
65
63
 
66
64
  private:
67
65
  TransitionPropertyProgressProviders propertyProgressProviders_;
68
66
 
67
+ // TO DO: currently never cleaned by design - if the property has already been transitioned in the past, we might want
68
+ // to reuse the config (run without settings in the config).
69
+ /// We might want to add an option for clearing those settings in the future.
70
+ PropertiesSettingsMap propertySettings_;
71
+
69
72
  std::unordered_set<std::string> removedProperties_;
70
73
 
71
74
  std::shared_ptr<TransitionPropertyProgressProvider> createReversingShorteningProgressProvider(
@@ -1,4 +1,7 @@
1
1
  #include <reanimated/CSS/registries/CSSAnimationsRegistry.h>
2
+ #include <reanimated/Fabric/updates/UpdatesRegistryManager.h>
3
+
4
+ #include <react/debug/react_native_assert.h>
2
5
 
3
6
  #include <memory>
4
7
  #include <string>
@@ -8,333 +11,202 @@
8
11
 
9
12
  namespace reanimated::css {
10
13
 
11
- bool CSSAnimationsRegistry::isEmpty() const {
12
- // The registry is empty if has no registered animations and no updates
13
- // stored in the updates registry
14
- return UpdatesRegistry::isEmpty() && registry_.empty();
15
- }
14
+ CSSAnimationsRegistry::CSSAnimationsRegistry(
15
+ const std::shared_ptr<OperationsLoop> &loop,
16
+ const std::shared_ptr<CSSKeyframesRegistry> &keyframesRegistry,
17
+ const std::shared_ptr<CSSPlatformAnimationFactory> &platformAnimationFactory)
18
+ : loop_(loop), keyframesRegistry_(keyframesRegistry), platformAnimationFactory_(platformAnimationFactory) {}
16
19
 
17
- bool CSSAnimationsRegistry::hasUpdates() const {
18
- return !runningAnimationIndicesMap_.empty() || !delayedAnimationsManager_.empty() || !animationsToRevertMap_.empty();
20
+ bool CSSAnimationsRegistry::needsFlush() const {
21
+ react_native_assert(UpdatesRegistryManager::isLockedByCurrentThread());
22
+ return !updatedTags_.empty();
19
23
  }
20
24
 
21
25
  void CSSAnimationsRegistry::apply(
22
- jsi::Runtime &rt,
23
26
  const std::shared_ptr<const ShadowNode> &shadowNode,
24
- const std::optional<std::vector<std::string>> &animationNames,
25
- const CSSAnimationsMap &newAnimations,
26
- const CSSAnimationSettingsUpdatesMap &settingsUpdates,
27
- double timestamp) {
28
- auto animationsVector = buildAnimationsVector(rt, shadowNode, animationNames, newAnimations);
29
-
27
+ const std::string &compoundComponentName,
28
+ const CSSAnimationUpdates &updates) {
29
+ react_native_assert(UpdatesRegistryManager::isLockedByCurrentThread());
30
30
  const auto viewTag = shadowNode->getTag();
31
- if (animationsVector.empty()) {
32
- remove(viewTag);
33
- return;
34
- }
31
+ auto newGroup =
32
+ maybeBuildNewGroup(shadowNode, compoundComponentName, updates.animationNames, updates.newAnimationSettings);
35
33
 
36
- runningAnimationIndicesMap_[viewTag].clear();
34
+ if (newGroup) {
35
+ auto oldIt = groups_.find(viewTag);
36
+ if (oldIt != groups_.end()) {
37
+ oldIt->second.unschedule(*loop_);
38
+ }
37
39
 
38
- std::vector<size_t> updatedIndices;
39
- for (const auto &[index, _] : newAnimations) {
40
- updatedIndices.push_back(index);
41
- }
42
- for (const auto &[index, _] : settingsUpdates) {
43
- updatedIndices.push_back(index);
44
- }
40
+ if (newGroup->getAnimations().empty()) {
41
+ remove(viewTag);
42
+ return;
43
+ }
45
44
 
46
- updateAnimationSettings(animationsVector, settingsUpdates, timestamp);
47
- for (size_t i = 0; i < animationsVector.size(); ++i) {
48
- scheduleOrActivateAnimation(i, animationsVector[i], timestamp);
45
+ groups_.insert_or_assign(viewTag, std::move(*newGroup));
49
46
  }
50
47
 
51
- auto animationToIndexMap = buildAnimationToIndexMap(animationsVector);
52
- registry_.erase(viewTag);
53
- registry_.emplace(viewTag, RegistryEntry{std::move(animationsVector), std::move(animationToIndexMap)});
48
+ auto it = groups_.find(viewTag);
49
+ if (it == groups_.end()) {
50
+ return;
51
+ }
54
52
 
55
- updateViewAnimations(viewTag, updatedIndices, timestamp, false);
56
- applyViewAnimationsStyle(viewTag, timestamp);
57
- }
53
+ auto &group = it->second;
54
+ group.updateSettings(updates.settingsUpdates, loop_->resolveTimestamp());
55
+ group.schedule(*loop_);
58
56
 
59
- void CSSAnimationsRegistry::remove(const Tag viewTag) {
60
- removeViewAnimations(viewTag);
61
- removeFromUpdatesRegistry(viewTag);
62
- registry_.erase(viewTag);
57
+ // Set current style to updates registry to ensure that all old
58
+ // styles are removed (replaced by the new style).
59
+ setInUpdatesRegistry(group.getShadowNodeFamily(), group.computeStyle());
60
+ // Mark always as updated to ensure that updates are committed
61
+ updatedTags_.insert(viewTag);
63
62
  }
64
63
 
65
- void CSSAnimationsRegistry::update(const double timestamp) {
66
- // Activate all delayed animations that should start now
67
- activateDelayedAnimations(timestamp);
68
- // Update styles in the registry for views which animations were reverted
69
- handleAnimationsToRevert(timestamp);
70
-
71
- // Iterate over active animations and update them
72
- for (auto it = runningAnimationIndicesMap_.begin(); it != runningAnimationIndicesMap_.end();) {
73
- const auto viewTag = it->first;
74
- const std::vector<size_t> animationIndices = {it->second.begin(), it->second.end()};
75
- updateViewAnimations(viewTag, animationIndices, timestamp, true);
76
-
77
- if (runningAnimationIndicesMap_[viewTag].empty()) {
78
- it = runningAnimationIndicesMap_.erase(it);
79
- } else {
80
- ++it;
64
+ void CSSAnimationsRegistry::flushUpdates(UpdatesBatch &updatesBatch) {
65
+ react_native_assert(UpdatesRegistryManager::isLockedByCurrentThread());
66
+ const auto tags = std::exchange(updatedTags_, {});
67
+ for (const auto viewTag : tags) {
68
+ const auto it = groups_.find(viewTag);
69
+ if (it == groups_.end()) {
70
+ continue;
81
71
  }
82
- }
83
- }
84
72
 
85
- CSSAnimationsVector CSSAnimationsRegistry::buildAnimationsVector(
86
- jsi::Runtime &rt,
87
- const std::shared_ptr<const ShadowNode> &shadowNode,
88
- const std::optional<std::vector<std::string>> &animationNames,
89
- const std::optional<CSSAnimationsMap> &newAnimations) const {
90
- const auto registryIt = registry_.find(shadowNode->getTag());
91
-
92
- // If animationNames has no value, that means no animations were added,
93
- // removed or reordered, so we can return the current animations vector from
94
- // the registry
95
- if (!animationNames.has_value()) {
96
- if (registryIt != registry_.end()) {
97
- return registryIt->second.animationsVector;
73
+ const auto updates = it->second.computeStyle(true);
74
+ if (!updates.empty()) {
75
+ addUpdatesToBatch(it->second.getShadowNodeFamily(), updates);
98
76
  }
99
77
  }
100
78
 
101
- CSSAnimationsVector animationsVector;
102
- const auto &animationNamesVector = animationNames.value();
103
- const auto animationNamesSize = animationNamesVector.size();
104
- animationsVector.reserve(animationNamesSize);
105
-
106
- std::unordered_map<std::string, CSSAnimationsVector> oldAnimationsMap;
107
- CSSAnimationsMap emptyAnimationsMap;
108
- const auto &newAnimationsMap = newAnimations.value_or(emptyAnimationsMap);
109
-
110
- if (registryIt != registry_.end()) {
111
- const auto &oldAnimations = registryIt->second.animationsVector;
112
-
113
- // Fill the map while maintaining reverse order (for quick pop from the end)
114
- for (auto it = oldAnimations.rbegin(); it != oldAnimations.rend(); ++it) {
115
- oldAnimationsMap[(*it)->getName()].emplace_back(*it);
116
- }
117
- }
79
+ flush(updatesBatch);
80
+ updateRegistryForRevertedAnimations();
81
+ }
118
82
 
119
- for (size_t i = 0; i < animationNamesSize; ++i) {
120
- const auto &newAnimationIt = newAnimationsMap.find(i);
121
- if (newAnimationIt != newAnimationsMap.end()) {
122
- animationsVector.emplace_back(newAnimationIt->second);
83
+ #if REACT_NATIVE_VERSION_MINOR >= 85
84
+ void CSSAnimationsRegistry::flushUpdates(UpdatesBatchAnimatedProps &updatesBatch) {
85
+ react_native_assert(UpdatesRegistryManager::isLockedByCurrentThread());
86
+ const auto tags = std::exchange(updatedTags_, {});
87
+ for (const auto viewTag : tags) {
88
+ const auto it = groups_.find(viewTag);
89
+ if (it == groups_.end()) {
123
90
  continue;
124
91
  }
125
92
 
126
- const auto &name = animationNamesVector[i];
127
- const auto &oldAnimationIt = oldAnimationsMap.find(name);
128
-
129
- if (oldAnimationIt == oldAnimationsMap.end()) {
130
- throw std::runtime_error(
131
- "[Reanimated] There is no animation with name " + name + " available to use at index " + std::to_string(i));
132
- }
133
-
134
- animationsVector.emplace_back(oldAnimationIt->second.back());
135
- oldAnimationIt->second.pop_back();
136
-
137
- if (oldAnimationIt->second.empty()) {
138
- oldAnimationsMap.erase(oldAnimationIt);
93
+ const auto updates = it->second.computeStyle(true);
94
+ if (!updates.empty()) {
95
+ addRawPropsToAnimatedPropsBatch(it->second.getShadowNodeFamily(), updates);
96
+ // Legacy flushes merge each frame into the updates registry; animated-props flushes do not.
97
+ // Keep the registry current so subsequent reads see the latest values.
98
+ setInUpdatesRegistry(it->second.getShadowNodeFamily(), updates);
139
99
  }
140
100
  }
141
101
 
142
- return animationsVector;
102
+ flush(updatesBatch);
103
+ updateRegistryForRevertedAnimations();
143
104
  }
105
+ #endif
144
106
 
145
- CSSAnimationsRegistry::AnimationToIndexMap CSSAnimationsRegistry::buildAnimationToIndexMap(
146
- const CSSAnimationsVector &animationsVector) const {
147
- AnimationToIndexMap animationToIndexMap;
107
+ CSSAnimationsRegistry::AnimationObserver::AnimationObserver(CSSAnimationsRegistry &owner) : owner_(owner) {}
148
108
 
149
- for (size_t i = 0; i < animationsVector.size(); ++i) {
150
- animationToIndexMap[animationsVector[i]] = i;
151
- }
152
-
153
- return animationToIndexMap;
109
+ void CSSAnimationsRegistry::AnimationObserver::onAnimationUpdate(const Tag viewTag) {
110
+ react_native_assert(UpdatesRegistryManager::isLockedByCurrentThread());
111
+ owner_.updatedTags_.insert(viewTag);
154
112
  }
155
113
 
156
- void CSSAnimationsRegistry::updateAnimationSettings(
157
- const CSSAnimationsVector &animationsVector,
158
- const CSSAnimationSettingsUpdatesMap &settingsUpdates,
159
- const double timestamp) {
160
- for (size_t i = 0; i < animationsVector.size(); ++i) {
161
- const auto &animation = animationsVector[i];
162
- const auto it = settingsUpdates.find(i);
163
- if (it != settingsUpdates.end()) {
164
- animation->updateSettings(it->second, timestamp);
165
- }
166
- }
114
+ void CSSAnimationsRegistry::AnimationObserver::onAnimationNeedsRevert(const Tag viewTag) {
115
+ react_native_assert(UpdatesRegistryManager::isLockedByCurrentThread());
116
+ owner_.pendingRevertTags_.insert(viewTag);
167
117
  }
168
118
 
169
- void CSSAnimationsRegistry::updateViewAnimations(
170
- const Tag viewTag,
171
- const std::vector<size_t> &animationIndices,
172
- const double timestamp,
173
- const bool addToBatch) {
174
- folly::dynamic result = folly::dynamic::object;
175
- std::shared_ptr<const ShadowNode> shadowNode = nullptr;
176
- bool hasUpdates = false;
177
-
178
- for (const auto animationIndex : animationIndices) {
179
- const auto &animation = registry_[viewTag].animationsVector[animationIndex];
180
- if (!shadowNode) {
181
- shadowNode = animation->getShadowNode();
182
- }
183
- if (animation->getState(timestamp) == AnimationProgressState::Pending) {
184
- animation->run(timestamp);
185
- }
186
-
187
- bool updatesAddedToBatch = false;
188
- const auto updates = animation->update(timestamp);
189
- const auto newState = animation->getState(timestamp);
190
-
191
- if (newState == AnimationProgressState::Finished) {
192
- // Revert changes applied during animation if there is no forwards fill
193
- // mode
194
- if (addToBatch && !animation->hasForwardsFillMode()) {
195
- // We also have to manually commit style values
196
- // reverting the changes applied by the animation.
197
- hasUpdates = addStyleUpdates(result, animation->getResetStyle(), false) || hasUpdates;
198
- updatesAddedToBatch = true;
199
- // We want to remove style changes applied by the animation that is
200
- // finished and has no forwards fill mode. We cannot simply remove
201
- // properties from the style in the registry as it may be overridden
202
- // by the next animation. Instead, we are creating the new style
203
- // object without reverted (finished without forwards fill mode)
204
- // animations.
205
- animationsToRevertMap_[viewTag].insert(animationIndex);
206
- }
207
- }
208
-
209
- if (addToBatch && !updatesAddedToBatch) {
210
- hasUpdates = addStyleUpdates(result, updates, true) || hasUpdates;
211
- }
212
- if (newState != AnimationProgressState::Running) {
213
- runningAnimationIndicesMap_[viewTag].erase(animationIndex);
214
- }
215
- }
216
-
217
- if (hasUpdates) {
218
- addUpdatesToBatch(shadowNode, result);
219
- }
220
- }
221
-
222
- void CSSAnimationsRegistry::scheduleOrActivateAnimation(
223
- const size_t animationIndex,
224
- const std::shared_ptr<CSSAnimation> &animation,
225
- const double timestamp) {
226
- // Remove the animation from delayed (if it is already added to
227
- // delayed animations)
228
- delayedAnimationsManager_.remove(animation);
229
-
230
- const auto startTimestamp = animation->getStartTimestamp(timestamp);
231
-
232
- if (startTimestamp > timestamp) {
233
- // If the animation is delayed, schedule it for activation
234
- // (Only if it isn't paused)
235
- if (animation->getState(timestamp) != AnimationProgressState::Paused) {
236
- delayedAnimationsManager_.add(startTimestamp, animation);
237
- }
238
- } else {
239
- const auto viewTag = animation->getShadowNode()->getTag();
240
- runningAnimationIndicesMap_[viewTag].insert(animationIndex);
119
+ void CSSAnimationsRegistry::removeTag(const Tag viewTag) {
120
+ auto it = groups_.find(viewTag);
121
+ if (it != groups_.end()) {
122
+ it->second.unschedule(*loop_);
123
+ groups_.erase(it);
241
124
  }
125
+ removeFromUpdatesRegistry(viewTag);
242
126
  }
243
127
 
244
- void CSSAnimationsRegistry::removeViewAnimations(const Tag viewTag) {
245
- const auto it = registry_.find(viewTag);
246
- if (it == registry_.end()) {
247
- return;
248
- }
249
-
250
- for (const auto &animation : it->second.animationsVector) {
251
- delayedAnimationsManager_.remove(animation);
128
+ std::optional<CSSAnimationsGroup> CSSAnimationsRegistry::maybeBuildNewGroup(
129
+ const std::shared_ptr<const ShadowNode> &shadowNode,
130
+ const std::string &compoundComponentName,
131
+ const std::optional<std::vector<std::string>> &updatedAnimationNames,
132
+ const CSSAnimationSettingsMap &newAnimationSettings) {
133
+ // No animations added/removed/reordered — nothing to build
134
+ if (!updatedAnimationNames.has_value()) {
135
+ return std::nullopt;
252
136
  }
253
- runningAnimationIndicesMap_.erase(viewTag);
254
- }
255
137
 
256
- void CSSAnimationsRegistry::applyViewAnimationsStyle(const Tag viewTag, const double timestamp) {
257
- const auto it = registry_.find(viewTag);
258
- // Remove the style from the registry if there are no animations for the view
259
- if (it == registry_.end() || it->second.animationsVector.empty()) {
260
- removeFromUpdatesRegistry(viewTag);
261
- return;
262
- }
138
+ const auto viewTag = shadowNode->getTag();
139
+ const auto groupIt = groups_.find(viewTag);
263
140
 
264
- folly::dynamic updatedStyle = folly::dynamic::object;
265
- std::shared_ptr<const ShadowNode> shadowNode = nullptr;
266
-
267
- for (const auto &animation : it->second.animationsVector) {
268
- const auto startTimestamp = animation->getStartTimestamp(timestamp);
269
-
270
- folly::dynamic style;
271
- const auto &currentState = animation->getState(timestamp);
272
- if (startTimestamp > timestamp && animation->hasBackwardsFillMode()) {
273
- style = animation->getBackwardsFillStyle();
274
- } else if (
275
- currentState == AnimationProgressState::Running ||
276
- // Animation is paused after start (was running before)
277
- (currentState == AnimationProgressState::Paused && timestamp >= animation->getStartTimestamp(timestamp)) ||
278
- // Animation is finished and has fill forwards fill mode
279
- (currentState == AnimationProgressState::Finished && animation->hasForwardsFillMode())) {
280
- style = animation->getCurrentInterpolationStyle();
281
- }
141
+ const auto &names = updatedAnimationNames.value();
142
+ const auto timestamp = loop_->resolveTimestamp();
282
143
 
283
- if (!shadowNode) {
284
- shadowNode = animation->getShadowNode();
285
- }
286
- if (style.isObject()) {
287
- updatedStyle.update(style);
144
+ // Index old animations by name (reversed for quick pop)
145
+ std::unordered_map<std::string, CSSAnimationsVector> oldByName;
146
+ if (groupIt != groups_.end()) {
147
+ for (auto it = groupIt->second.getAnimations().rbegin(); it != groupIt->second.getAnimations().rend(); ++it) {
148
+ oldByName[(*it)->getName()].emplace_back(*it);
288
149
  }
289
150
  }
290
151
 
291
- setInUpdatesRegistry(shadowNode, updatedStyle);
292
- }
293
-
294
- void CSSAnimationsRegistry::activateDelayedAnimations(const double timestamp) {
295
- while (!delayedAnimationsManager_.empty() && delayedAnimationsManager_.top().timestamp <= timestamp) {
296
- const auto [_, animation] = delayedAnimationsManager_.pop();
297
- const auto viewTag = animation->getShadowNode()->getTag();
152
+ // Build new vector — create new or reuse old
153
+ CSSAnimationsVector animations;
154
+ animations.reserve(names.size());
298
155
 
299
- // Add only these animations which weren't removed in the meantime
300
- if (registry_.find(viewTag) == registry_.end()) {
301
- continue;
302
- }
156
+ for (size_t i = 0; i < names.size(); ++i) {
157
+ const auto &name = names[i];
158
+ const auto settingsIt = newAnimationSettings.find(i);
303
159
 
304
- const auto &animationToIndexMap = registry_[viewTag].animationToIndexMap;
305
- if (animationToIndexMap.find(animation) == animationToIndexMap.end()) {
306
- continue;
160
+ if (settingsIt != newAnimationSettings.end()) {
161
+ animations.emplace_back(createAnimation(shadowNode, name, compoundComponentName, settingsIt->second, timestamp));
162
+ } else {
163
+ auto oldIt = oldByName.find(name);
164
+ if (oldIt == oldByName.end()) {
165
+ throw std::runtime_error(
166
+ "[Reanimated] There is no animation with name " + name + " available to use at index " + std::to_string(i));
167
+ }
168
+ animations.emplace_back(oldIt->second.back());
169
+ oldIt->second.pop_back();
170
+ if (oldIt->second.empty()) {
171
+ oldByName.erase(oldIt);
172
+ }
307
173
  }
308
-
309
- const auto animationIndex = animationToIndexMap.at(animation);
310
- runningAnimationIndicesMap_[viewTag].insert(animationIndex);
311
174
  }
312
- }
313
175
 
314
- void CSSAnimationsRegistry::handleAnimationsToRevert(const double timestamp) {
315
- for (const auto &[viewTag, _] : animationsToRevertMap_) {
316
- applyViewAnimationsStyle(viewTag, timestamp);
317
- }
318
- animationsToRevertMap_.clear();
176
+ return CSSAnimationsGroup(shadowNode, std::move(animations));
319
177
  }
320
178
 
321
- bool CSSAnimationsRegistry::addStyleUpdates(
322
- folly::dynamic &target,
323
- const folly::dynamic &updates,
324
- bool shouldOverride) {
325
- if (!updates.isObject()) {
326
- return false;
327
- }
179
+ std::shared_ptr<CSSAnimation> CSSAnimationsRegistry::createAnimation(
180
+ const std::shared_ptr<const ShadowNode> &shadowNode,
181
+ const std::string &name,
182
+ const std::string &compoundComponentName,
183
+ const CSSAnimationSettings &settings,
184
+ const double timestamp) {
185
+ const auto keyframesConfig = keyframesRegistry_->get(name, compoundComponentName);
186
+ if (!keyframesConfig) {
187
+ throw std::runtime_error(
188
+ "[Reanimated] No keyframes with name `" + name + "` were registered for component `" +
189
+ splitCompoundComponentName(compoundComponentName).second + "` (" + shadowNode->getComponentName() + ")");
190
+ }
191
+
192
+ return std::make_shared<CSSAnimation>(
193
+ shadowNode->getTag(),
194
+ name,
195
+ keyframesConfig->get(),
196
+ settings,
197
+ animationObserver_,
198
+ platformAnimationFactory_,
199
+ timestamp);
200
+ }
328
201
 
329
- bool hasUpdates = false;
330
- for (const auto &[propertyName, propertyValue] : updates.items()) {
331
- if (shouldOverride || !target.count(propertyName) || target[propertyName].isNull()) {
332
- target[propertyName] = propertyValue;
333
- hasUpdates = true;
202
+ void CSSAnimationsRegistry::updateRegistryForRevertedAnimations() {
203
+ const auto tags = std::exchange(pendingRevertTags_, {});
204
+ for (const auto viewTag : tags) {
205
+ const auto it = groups_.find(viewTag);
206
+ if (it != groups_.end()) {
207
+ setInUpdatesRegistry(it->second.getShadowNodeFamily(), it->second.computeStyle());
334
208
  }
335
209
  }
336
-
337
- return hasUpdates;
338
210
  }
339
211
 
340
212
  } // namespace reanimated::css