@react-native-ohos/react-native-reanimated 4.0.2 → 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 -6
  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 +98 -18
  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 +106 -17
  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
@@ -0,0 +1,97 @@
1
+ #include <reanimated/CSS/core/transition/CSSLoopTransition.h>
2
+ #include <reanimated/CSS/core/transition/CSSTransition.h>
3
+ #include <reanimated/Fabric/updates/OperationsLoop.h>
4
+
5
+ #include <memory>
6
+ #include <utility>
7
+
8
+ namespace reanimated::css {
9
+
10
+ CSSTransition::CSSTransition(
11
+ std::shared_ptr<const ShadowNode> shadowNode,
12
+ const std::shared_ptr<ViewStylesRepository> &viewStylesRepository,
13
+ const std::shared_ptr<CSSPlatformTransitionProxy> &platformTransitionProxy,
14
+ const std::shared_ptr<OperationsLoop> &loop,
15
+ Observer &observer)
16
+ : shadowNode_(std::move(shadowNode)),
17
+ viewStylesRepository_(viewStylesRepository),
18
+ platformTransitionProxy_(platformTransitionProxy),
19
+ loop_(loop),
20
+ observer_(observer) {}
21
+
22
+ CSSTransition::~CSSTransition() {
23
+ platformTransitionProxy_->cancelAll(getViewTag(), routing_.platform);
24
+ }
25
+
26
+ TransitionProperties CSSTransition::getProperties() const {
27
+ TransitionProperties result = routing_.loop;
28
+ result.insert(routing_.platform.begin(), routing_.platform.end());
29
+ return result;
30
+ }
31
+
32
+ folly::dynamic CSSTransition::run(jsi::Runtime &rt, CSSTransitionConfig &&config, const folly::dynamic &lastUpdates) {
33
+ const auto timestamp = loop_->resolveTimestamp();
34
+
35
+ auto loopConfig = platformTransitionProxy_->processConfig(rt, getViewTag(), config, routing_, timestamp);
36
+ if (loopConfig.empty()) {
37
+ return folly::dynamic::object();
38
+ }
39
+
40
+ auto &loopTransition = ensureLoopTransition();
41
+ loopTransition.updateSettings(loopConfig.changedPropertiesSettings, loopConfig.removedProperties);
42
+
43
+ // Settings-only configs reconfigure without running.
44
+ if (!loopConfig.hasValueUpdates()) {
45
+ return folly::dynamic::object();
46
+ }
47
+
48
+ auto initialUpdate = loopTransition.run(rt, shadowNode_, loopConfig.changedProperties, lastUpdates, timestamp);
49
+ scheduleLoop(timestamp);
50
+ return initialUpdate;
51
+ }
52
+
53
+ folly::dynamic CSSTransition::run(
54
+ const PropertyValueDynamicDiffsMap &propertyDiffs,
55
+ const folly::dynamic &lastUpdates) {
56
+ const auto timestamp = loop_->resolveTimestamp();
57
+
58
+ auto loopDiffs = platformTransitionProxy_->processDynamicDiffs(getViewTag(), propertyDiffs, routing_, timestamp);
59
+ if (loopDiffs.empty() && !loopTransition_) {
60
+ return folly::dynamic::object();
61
+ }
62
+
63
+ auto initialUpdate = ensureLoopTransition().run(shadowNode_, loopDiffs, lastUpdates, timestamp);
64
+ scheduleLoop(timestamp);
65
+ return initialUpdate;
66
+ }
67
+
68
+ folly::dynamic CSSTransition::computeCurrentLoopStyle() {
69
+ if (!loopTransition_) {
70
+ return folly::dynamic::object();
71
+ }
72
+ return loopTransition_->computeCurrentStyle(shadowNode_);
73
+ }
74
+
75
+ void CSSTransition::cancel() {
76
+ if (loopTransition_) {
77
+ loop_->remove(loopTransition_);
78
+ }
79
+ platformTransitionProxy_->cancelAll(getViewTag(), routing_.platform);
80
+ }
81
+
82
+ CSSLoopTransition &CSSTransition::ensureLoopTransition() {
83
+ if (!loopTransition_) {
84
+ loopTransition_ = std::make_shared<CSSLoopTransition>(
85
+ shadowNode_->getTag(),
86
+ shadowNode_->getComponentName(),
87
+ viewStylesRepository_,
88
+ [&observer = observer_](Tag viewTag) { observer.onTransitionUpdate(viewTag); });
89
+ }
90
+ return *loopTransition_;
91
+ }
92
+
93
+ void CSSTransition::scheduleLoop(const double timestamp) {
94
+ loop_->schedule(loopTransition_, timestamp + loopTransition_->getMinDelay(timestamp));
95
+ }
96
+
97
+ } // namespace reanimated::css
@@ -0,0 +1,69 @@
1
+ #pragma once
2
+
3
+ #include <reanimated/CSS/configs/CSSTransitionConfig.h>
4
+ #include <reanimated/CSS/core/transition/CSSLoopTransition.h>
5
+ #include <reanimated/CSS/core/transition/CSSPlatformTransitionProxy.h>
6
+ #include <reanimated/CSS/misc/ViewStylesRepository.h>
7
+ #include <reanimated/Fabric/updates/OperationsLoop.h>
8
+
9
+ #include <react/renderer/core/ShadowNode.h>
10
+
11
+ #include <folly/dynamic.h>
12
+ #include <jsi/jsi.h>
13
+ #include <memory>
14
+
15
+ namespace reanimated::css {
16
+
17
+ class CSSTransition {
18
+ public:
19
+ class Observer {
20
+ public:
21
+ virtual ~Observer() = default;
22
+ virtual void onTransitionUpdate(Tag viewTag) = 0;
23
+ };
24
+
25
+ CSSTransition(
26
+ std::shared_ptr<const ShadowNode> shadowNode,
27
+ const std::shared_ptr<ViewStylesRepository> &viewStylesRepository,
28
+ const std::shared_ptr<CSSPlatformTransitionProxy> &platformTransitionProxy,
29
+ const std::shared_ptr<OperationsLoop> &loop,
30
+ Observer &observer);
31
+ ~CSSTransition();
32
+
33
+ Tag getViewTag() const {
34
+ return shadowNode_->getTag();
35
+ }
36
+
37
+ std::shared_ptr<const ShadowNode> getShadowNode() const {
38
+ return shadowNode_;
39
+ }
40
+
41
+ ShadowNodeFamily::Shared getShadowNodeFamily() const {
42
+ return shadowNode_->getFamilyShared();
43
+ }
44
+
45
+ TransitionProperties getProperties() const;
46
+
47
+ folly::dynamic computeCurrentLoopStyle();
48
+
49
+ /// Applies a config: routes props between the platform and loop sides and runs them.
50
+ folly::dynamic run(jsi::Runtime &rt, CSSTransitionConfig &&config, const folly::dynamic &lastUpdates);
51
+ /// Runs the loop side directly from already-computed (dynamic) diffs.
52
+ folly::dynamic run(const PropertyValueDynamicDiffsMap &propertyDiffs, const folly::dynamic &lastUpdates);
53
+ void cancel();
54
+
55
+ private:
56
+ const std::shared_ptr<const ShadowNode> shadowNode_;
57
+ const std::shared_ptr<ViewStylesRepository> viewStylesRepository_;
58
+ const std::shared_ptr<CSSPlatformTransitionProxy> platformTransitionProxy_;
59
+ const std::shared_ptr<OperationsLoop> loop_;
60
+ Observer &observer_;
61
+
62
+ CSSTransitionRouting routing_;
63
+ std::shared_ptr<CSSLoopTransition> loopTransition_;
64
+
65
+ CSSLoopTransition &ensureLoopTransition();
66
+ void scheduleLoop(double timestamp);
67
+ };
68
+
69
+ } // namespace reanimated::css
@@ -0,0 +1,89 @@
1
+ #include <reanimated/CSS/easing/EasingConfigs.h>
2
+ #include <reanimated/CSS/easing/cubicBezier.h>
3
+ #include <reanimated/CSS/easing/linear.h>
4
+ #include <reanimated/CSS/easing/steps.h>
5
+
6
+ #include <stdexcept>
7
+ #include <type_traits>
8
+ #include <unordered_map>
9
+ #include <utility>
10
+
11
+ namespace reanimated::css {
12
+
13
+ EasingFunction getEasingFunctionFromConfig(const EasingConfig &easingConfig) {
14
+ return std::visit(
15
+ [](const auto &config) -> EasingFunction {
16
+ using T = std::decay_t<decltype(config)>;
17
+ if constexpr (std::is_same_v<T, LinearEasing>) {
18
+ return [](double x) {
19
+ return x;
20
+ };
21
+ } else if constexpr (std::is_same_v<T, CubicBezierEasing>) {
22
+ return cubicBezier(config.x1, config.y1, config.x2, config.y2);
23
+ } else if constexpr (std::is_same_v<T, StepsEasing>) {
24
+ return steps(config.pointsX, config.pointsY);
25
+ } else {
26
+ return linear(config.pointsX, config.pointsY);
27
+ }
28
+ },
29
+ easingConfig);
30
+ }
31
+
32
+ EasingConfig getEasingConfig(jsi::Runtime &rt, const jsi::Value &easingConfig) {
33
+ static const std::unordered_map<std::string, EasingConfig> PREDEFINED_EASING_CONFIGS = {
34
+ {"linear", LinearEasing{}},
35
+ {"ease", CubicBezierEasing{0.25, 0.1, 0.25, 1.0}},
36
+ {"ease-in", CubicBezierEasing{0.42, 0.0, 1.0, 1.0}},
37
+ {"ease-out", CubicBezierEasing{0.0, 0.0, 0.58, 1.0}},
38
+ {"ease-in-out", CubicBezierEasing{0.42, 0.0, 0.58, 1.0}},
39
+ {"step-start", StepsEasing{{0}, {1}}},
40
+ {"step-end", StepsEasing{{0, 1}, {0, 1}}}};
41
+
42
+ if (easingConfig.isString()) {
43
+ const auto easingName = easingConfig.asString(rt).utf8(rt);
44
+ const auto easingIt = PREDEFINED_EASING_CONFIGS.find(easingName);
45
+ if (easingIt != PREDEFINED_EASING_CONFIGS.end()) {
46
+ return easingIt->second;
47
+ }
48
+ throw std::runtime_error("[Reanimated] Easing function with name '" + easingName + "' is not defined.");
49
+ }
50
+
51
+ if (easingConfig.isObject()) {
52
+ const auto easingObj = easingConfig.asObject(rt);
53
+ const auto easingName = easingObj.getProperty(rt, "name").asString(rt).utf8(rt);
54
+ if (easingName == "cubicBezier") {
55
+ return CubicBezierEasing{
56
+ easingObj.getProperty(rt, "x1").asNumber(),
57
+ easingObj.getProperty(rt, "y1").asNumber(),
58
+ easingObj.getProperty(rt, "x2").asNumber(),
59
+ easingObj.getProperty(rt, "y2").asNumber()};
60
+ }
61
+
62
+ std::vector<double> pointsX;
63
+ std::vector<double> pointsY;
64
+
65
+ const auto points = easingObj.getProperty(rt, "points").asObject(rt).asArray(rt);
66
+ const auto pointsCount = points.size(rt);
67
+ pointsX.reserve(pointsCount);
68
+ pointsY.reserve(pointsCount);
69
+
70
+ for (size_t i = 0; i < pointsCount; i++) {
71
+ const auto pointObj = points.getValueAtIndex(rt, i).asObject(rt);
72
+ pointsX.emplace_back(pointObj.getProperty(rt, "x").asNumber());
73
+ pointsY.emplace_back(pointObj.getProperty(rt, "y").asNumber());
74
+ }
75
+
76
+ if (easingName == "linear") {
77
+ return LinearStopsEasing{std::move(pointsX), std::move(pointsY)};
78
+ }
79
+ if (easingName == "steps") {
80
+ return StepsEasing{std::move(pointsX), std::move(pointsY)};
81
+ }
82
+ throw std::runtime_error(
83
+ "[Reanimated] Parametrized easing function with name '" + easingName + "' is not defined.");
84
+ }
85
+
86
+ throw std::runtime_error("[Reanimated] Invalid easing function");
87
+ }
88
+
89
+ } // namespace reanimated::css
@@ -0,0 +1,36 @@
1
+ #pragma once
2
+
3
+ #include <reanimated/CSS/easing/EasingFunctions.h>
4
+
5
+ #include <jsi/jsi.h>
6
+ #include <string>
7
+ #include <unordered_map>
8
+ #include <variant>
9
+ #include <vector>
10
+
11
+ namespace reanimated::css {
12
+
13
+ struct LinearEasing {};
14
+
15
+ struct CubicBezierEasing {
16
+ double x1, y1, x2, y2;
17
+ };
18
+
19
+ struct StepsEasing {
20
+ std::vector<double> pointsX;
21
+ std::vector<double> pointsY;
22
+ };
23
+
24
+ struct LinearStopsEasing {
25
+ std::vector<double> pointsX;
26
+ std::vector<double> pointsY;
27
+ };
28
+
29
+ using EasingConfig = std::variant<LinearEasing, CubicBezierEasing, StepsEasing, LinearStopsEasing>;
30
+
31
+ using KeyframeEasingConfigs = std::unordered_map<double, EasingConfig>;
32
+
33
+ EasingConfig getEasingConfig(jsi::Runtime &rt, const jsi::Value &easingConfig);
34
+ EasingFunction getEasingFunctionFromConfig(const EasingConfig &easingConfig);
35
+
36
+ } // namespace reanimated::css
@@ -33,6 +33,10 @@ class RecordInterpolatorFactory : public PropertyInterpolatorFactory {
33
33
  std::string toString() const override {
34
34
  return "{}";
35
35
  }
36
+
37
+ bool operator==(const CSSValue &) const override {
38
+ return false;
39
+ }
36
40
  };
37
41
 
38
42
  const InterpolatorFactoriesRecord factories_;
@@ -55,6 +59,10 @@ class ArrayLikeInterpolatorFactory : public PropertyInterpolatorFactory {
55
59
  std::string toString() const override {
56
60
  return "[]";
57
61
  }
62
+
63
+ bool operator==(const CSSValue &) const override {
64
+ return false;
65
+ }
58
66
  };
59
67
  };
60
68
 
@@ -119,6 +127,10 @@ class TransformsInterpolatorFactory : public PropertyInterpolatorFactory {
119
127
  std::string toString() const override {
120
128
  return getIdentityMatrix().toString();
121
129
  }
130
+
131
+ bool operator==(const CSSValue &) const override {
132
+ return false;
133
+ }
122
134
  };
123
135
 
124
136
  const std::shared_ptr<StyleOperationInterpolators> interpolators_;
@@ -112,6 +112,11 @@ template <typename... AllowedTypes>
112
112
  auto value(const auto &defaultValue) -> std::enable_if_t<
113
113
  (std::is_constructible_v<AllowedTypes, decltype(defaultValue)> || ...),
114
114
  std::shared_ptr<PropertyInterpolatorFactory>> {
115
+ static_assert(
116
+ !(Resolvable<AllowedTypes> || ...),
117
+ "Resolvable value types (e.g. CSSLength) require a "
118
+ "ResolvableValueInterpolatorConfig — use the value(defaultValue, "
119
+ "{RelativeTo::..., \"...\"}) overload instead");
115
120
  // Create a concrete CSSValue from the defaultValue
116
121
  auto cssValue = createCSSValue<AllowedTypes...>(defaultValue);
117
122
  return std::make_shared<SimpleValueInterpolatorFactory<AllowedTypes...>>(std::move(cssValue));
@@ -121,6 +126,10 @@ template <typename... AllowedTypes>
121
126
  auto value(const auto &defaultValue, ResolvableValueInterpolatorConfig config) -> std::enable_if_t<
122
127
  (std::is_constructible_v<AllowedTypes, decltype(defaultValue)> || ...),
123
128
  std::shared_ptr<PropertyInterpolatorFactory>> {
129
+ static_assert(
130
+ (Resolvable<AllowedTypes> || ...),
131
+ "None of the value types are resolvable — use the value(defaultValue) "
132
+ "overload without ResolvableValueInterpolatorConfig instead");
124
133
  // Create a concrete CSSValue from the defaultValue
125
134
  auto cssValue = createCSSValue<AllowedTypes...>(defaultValue);
126
135
  return std::make_shared<ResolvableValueInterpolatorFactory<AllowedTypes...>>(std::move(cssValue), std::move(config));
@@ -181,8 +190,8 @@ std::shared_ptr<PropertyInterpolatorFactory> transforms(
181
190
  const std::unordered_map<std::string, std::shared_ptr<StyleOperationInterpolator>> &interpolators);
182
191
 
183
192
  /**
184
- * Filter interpolators
185
- */
193
+ * Filter interpolators
194
+ */
186
195
  std::shared_ptr<PropertyInterpolatorFactory> filters(
187
196
  const std::unordered_map<std::string, std::shared_ptr<StyleOperationInterpolator>> &interpolators);
188
197
 
@@ -1,6 +1,5 @@
1
1
  #include <reanimated/CSS/interpolation/PropertyInterpolator.h>
2
-
3
- #include <worklets/Tools/JSISerializer.h>
2
+ #include <reanimated/Compat/WorkletsApi.h>
4
3
 
5
4
  #include <memory>
6
5
  #include <utility>
@@ -35,7 +34,7 @@ std::vector<std::pair<double, jsi::Value>> PropertyInterpolator::parseJSIKeyfram
35
34
  throw std::invalid_argument(
36
35
  "[Reanimated] Received invalid keyframes object for property: " + getPropertyPathString() +
37
36
  ".\n\nExpected an array of objects with 'offset' and 'value' properties, got: " +
38
- worklets::stringifyJSIValue(rt, keyframes));
37
+ worklets::JSIValueToStdString(rt, keyframes));
39
38
  }
40
39
 
41
40
  const auto keyframeArray = keyframes.asObject(rt).asArray(rt);
@@ -23,13 +23,11 @@ class PropertyInterpolator {
23
23
  virtual folly::dynamic getResetStyle(const std::shared_ptr<const ShadowNode> &shadowNode) const = 0;
24
24
  virtual folly::dynamic getFirstKeyframeValue() const = 0;
25
25
  virtual folly::dynamic getLastKeyframeValue() const = 0;
26
- virtual bool equalsReversingAdjustedStartValue(const folly::dynamic &propertyValue) const = 0;
27
26
 
28
27
  virtual void updateKeyframes(jsi::Runtime &rt, const jsi::Value &keyframes) = 0;
29
- virtual void updateKeyframesFromStyleChange(
30
- const folly::dynamic &oldStyleValue,
31
- const folly::dynamic &newStyleValue,
32
- const folly::dynamic &lastUpdateValue) = 0;
28
+ virtual bool updateKeyframes(jsi::Runtime &rt, const jsi::Value &fromValue, const jsi::Value &toValue) = 0;
29
+ /** TODO: unify folly::dynamic and jsi::value versions */
30
+ virtual bool updateKeyframes(const folly::dynamic &fromValue, const folly::dynamic &toValue) = 0;
33
31
 
34
32
  virtual folly::dynamic interpolate(
35
33
  const std::shared_ptr<const ShadowNode> &shadowNode,
@@ -108,16 +108,16 @@ std::shared_ptr<FilterOperation> FilterOperation::fromDynamic(const folly::dynam
108
108
  }
109
109
 
110
110
  // FilterOperationBase implementation
111
- template <FilterOp TOperation, typename TValue>
111
+ template <FilterOp TOperation, CSSValueDerived TValue>
112
112
  FilterOperationBase<TOperation, TValue>::FilterOperationBase(TValue value)
113
113
  : FilterOperation(TOperation), value(std::move(value)) {}
114
114
 
115
- template <FilterOp TOperation, typename TValue>
115
+ template <FilterOp TOperation, CSSValueDerived TValue>
116
116
  folly::dynamic FilterOperationBase<TOperation, TValue>::valueToDynamic() const {
117
117
  return value.toDynamic();
118
118
  }
119
119
 
120
- template <FilterOp TOperation, typename TValue>
120
+ template <FilterOp TOperation, CSSValueDerived TValue>
121
121
  bool FilterOperationBase<TOperation, TValue>::areValuesEqual(const StyleOperation &other) const {
122
122
  return value == static_cast<const FilterOperationBase<TOperation, TValue> &>(other).value;
123
123
  }
@@ -26,7 +26,7 @@ struct FilterOperation : public StyleOperation {
26
26
  using FilterOperations = std::vector<std::shared_ptr<FilterOperation>>;
27
27
 
28
28
  // Base implementation for filter operations
29
- template <FilterOp TOperation, typename TValue>
29
+ template <FilterOp TOperation, CSSValueDerived TValue>
30
30
  struct FilterOperationBase : public FilterOperation {
31
31
  const TValue value;
32
32
 
@@ -11,25 +11,6 @@ ArrayPropertiesInterpolator::ArrayPropertiesInterpolator(
11
11
  const std::shared_ptr<ViewStylesRepository> &viewStylesRepository)
12
12
  : GroupPropertiesInterpolator(propertyPath, viewStylesRepository), factories_(factories) {}
13
13
 
14
- bool ArrayPropertiesInterpolator::equalsReversingAdjustedStartValue(const folly::dynamic &propertyValue) const {
15
- if (!propertyValue.isArray()) {
16
- return false;
17
- }
18
-
19
- const auto valuesCount = propertyValue.size();
20
- if (valuesCount != interpolators_.size()) {
21
- return false;
22
- }
23
-
24
- for (size_t i = 0; i < valuesCount; ++i) {
25
- if (!interpolators_[i]->equalsReversingAdjustedStartValue(propertyValue[i])) {
26
- return false;
27
- }
28
- }
29
-
30
- return true;
31
- }
32
-
33
14
  void ArrayPropertiesInterpolator::updateKeyframes(jsi::Runtime &rt, const jsi::Value &keyframes) {
34
15
  const jsi::Array keyframesArray = keyframes.asObject(rt).asArray(rt);
35
16
  const size_t valuesCount = keyframesArray.size(rt);
@@ -41,32 +22,52 @@ void ArrayPropertiesInterpolator::updateKeyframes(jsi::Runtime &rt, const jsi::V
41
22
  }
42
23
  }
43
24
 
44
- void ArrayPropertiesInterpolator::updateKeyframesFromStyleChange(
45
- const folly::dynamic &oldStyleValue,
46
- const folly::dynamic &newStyleValue,
47
- const folly::dynamic &lastUpdateValue) {
48
- const auto emptyArray = folly::dynamic::array();
49
- const auto null = folly::dynamic();
25
+ bool ArrayPropertiesInterpolator::updateKeyframes(
26
+ jsi::Runtime &rt,
27
+ const jsi::Value &fromValue,
28
+ const jsi::Value &toValue) {
29
+ const auto fromArray = fromValue.isUndefined() ? jsi::Array(rt, 0) : fromValue.asObject(rt).asArray(rt);
30
+ const auto toArray = toValue.isUndefined() ? jsi::Array(rt, 0) : toValue.asObject(rt).asArray(rt);
50
31
 
51
- const auto &oldStyleArray = oldStyleValue.empty() ? emptyArray : oldStyleValue;
52
- const auto &newStyleArray = newStyleValue.empty() ? emptyArray : newStyleValue;
53
- const auto &lastUpdateArray = lastUpdateValue.empty() ? emptyArray : lastUpdateValue;
54
-
55
- const size_t oldSize = oldStyleArray.size();
56
- const size_t newSize = newStyleArray.size();
57
- const size_t lastSize = lastUpdateArray.size();
58
- const size_t valuesCount = std::max(oldSize, newSize);
32
+ const size_t fromSize = fromArray.size(rt);
33
+ const size_t toSize = toArray.size(rt);
34
+ const size_t valuesCount = std::max(fromSize, toSize);
59
35
 
60
36
  resizeInterpolators(valuesCount);
61
37
 
38
+ bool areAllPropsReversed = true;
39
+
62
40
  for (size_t i = 0; i < valuesCount; ++i) {
63
41
  // These index checks ensure that interpolation works between 2 arrays
64
42
  // with different lengths
65
- interpolators_[i]->updateKeyframesFromStyleChange(
66
- i < oldSize ? oldStyleArray[i] : null,
67
- i < newSize ? newStyleArray[i] : null,
68
- i < lastSize ? lastUpdateArray[i] : null);
43
+ areAllPropsReversed &= interpolators_[i]->updateKeyframes(
44
+ rt,
45
+ i < fromSize ? fromArray.getValueAtIndex(rt, i) : jsi::Value::undefined(),
46
+ i < toSize ? toArray.getValueAtIndex(rt, i) : jsi::Value::undefined());
69
47
  }
48
+
49
+ return areAllPropsReversed;
50
+ }
51
+
52
+ bool ArrayPropertiesInterpolator::updateKeyframes(const folly::dynamic &fromValue, const folly::dynamic &toValue) {
53
+ const auto fromIsArray = fromValue.isArray();
54
+ const auto toIsArray = toValue.isArray();
55
+
56
+ const size_t fromSize = fromIsArray ? fromValue.size() : 0;
57
+ const size_t toSize = toIsArray ? toValue.size() : 0;
58
+ const size_t valuesCount = std::max(fromSize, toSize);
59
+
60
+ resizeInterpolators(valuesCount);
61
+
62
+ bool areAllPropsReversed = true;
63
+
64
+ static const folly::dynamic kNull;
65
+ for (size_t i = 0; i < valuesCount; ++i) {
66
+ areAllPropsReversed &=
67
+ interpolators_[i]->updateKeyframes(i < fromSize ? fromValue[i] : kNull, i < toSize ? toValue[i] : kNull);
68
+ }
69
+
70
+ return areAllPropsReversed;
70
71
  }
71
72
 
72
73
  folly::dynamic ArrayPropertiesInterpolator::mapInterpolators(
@@ -15,13 +15,10 @@ class ArrayPropertiesInterpolator : public GroupPropertiesInterpolator {
15
15
  const std::shared_ptr<ViewStylesRepository> &viewStylesRepository);
16
16
  virtual ~ArrayPropertiesInterpolator() = default;
17
17
 
18
- bool equalsReversingAdjustedStartValue(const folly::dynamic &propertyValue) const override;
19
-
20
18
  void updateKeyframes(jsi::Runtime &rt, const jsi::Value &keyframes) override;
21
- void updateKeyframesFromStyleChange(
22
- const folly::dynamic &oldStyleValue,
23
- const folly::dynamic &newStyleValue,
24
- const folly::dynamic &lastUpdateValue) override;
19
+ bool updateKeyframes(jsi::Runtime &rt, const jsi::Value &fromValue, const jsi::Value &toValue) override;
20
+ /** TODO: unify folly::dynamic and jsi::value versions */
21
+ bool updateKeyframes(const folly::dynamic &fromValue, const folly::dynamic &toValue) override;
25
22
 
26
23
  protected:
27
24
  folly::dynamic mapInterpolators(const std::function<folly::dynamic(PropertyInterpolator &)> &callback) const override;
@@ -12,21 +12,6 @@ RecordPropertiesInterpolator::RecordPropertiesInterpolator(
12
12
  const std::shared_ptr<ViewStylesRepository> &viewStylesRepository)
13
13
  : GroupPropertiesInterpolator(propertyPath, viewStylesRepository), factories_(factories) {}
14
14
 
15
- bool RecordPropertiesInterpolator::equalsReversingAdjustedStartValue(const folly::dynamic &propertyValue) const {
16
- // return std::ranges::all_of(propertyValue.items(), [this](const auto &item) {
17
- // const auto &[propName, propValue] = item;
18
- // const auto it = interpolators_.find(propName.getString());
19
- // return it != interpolators_.end() && it->second->equalsReversingAdjustedStartValue(propValue);
20
- // });
21
- //TODO
22
- return std::all_of(propertyValue.items().begin(), propertyValue.items().end(), [this](const auto &item) {
23
- const auto &[propName, propValue] = item;
24
- const auto it = interpolators_.find(propName.getString());
25
- return it != interpolators_.end() &&
26
- it->second->equalsReversingAdjustedStartValue(propValue);
27
- });
28
- }
29
-
30
15
  void RecordPropertiesInterpolator::updateKeyframes(jsi::Runtime &rt, const jsi::Value &keyframes) {
31
16
  // TODO - maybe add a possibility to remove interpolators that are no longer
32
17
  // used (for now, for simplicity, we only add new ones)
@@ -44,34 +29,71 @@ void RecordPropertiesInterpolator::updateKeyframes(jsi::Runtime &rt, const jsi::
44
29
  }
45
30
  }
46
31
 
47
- void RecordPropertiesInterpolator::updateKeyframesFromStyleChange(
48
- const folly::dynamic &oldStyleValue,
49
- const folly::dynamic &newStyleValue,
50
- const folly::dynamic &lastUpdateValue) {
32
+ bool RecordPropertiesInterpolator::updateKeyframes(
33
+ jsi::Runtime &rt,
34
+ const jsi::Value &fromValue,
35
+ const jsi::Value &toValue) {
51
36
  // TODO - maybe add a possibility to remove interpolators that are no longer
52
37
  // used (for now, for simplicity, we only add new ones)
53
- const folly::dynamic emptyObject = folly::dynamic::object();
54
- const auto null = folly::dynamic();
38
+ const auto fromObject = fromValue.isUndefined() ? jsi::Object(rt) : fromValue.asObject(rt);
39
+ const auto toObject = toValue.isUndefined() ? jsi::Object(rt) : toValue.asObject(rt);
40
+
41
+ const auto fromPropertyNames = fromObject.getPropertyNames(rt);
42
+ const auto toPropertyNames = toObject.getPropertyNames(rt);
43
+ const auto fromSize = fromPropertyNames.size(rt);
44
+ const auto toSize = toPropertyNames.size(rt);
45
+
46
+ std::unordered_set<std::string> propertyNamesSet;
47
+ for (size_t i = 0; i < fromSize; ++i) {
48
+ propertyNamesSet.insert(fromPropertyNames.getValueAtIndex(rt, i).asString(rt).utf8(rt));
49
+ }
50
+ for (size_t i = 0; i < toSize; ++i) {
51
+ propertyNamesSet.insert(toPropertyNames.getValueAtIndex(rt, i).asString(rt).utf8(rt));
52
+ }
53
+
54
+ bool areAllPropsReversed = true;
55
+
56
+ for (const auto &propertyName : propertyNamesSet) {
57
+ maybeCreateInterpolator(propertyName);
58
+ const auto propNameID = jsi::PropNameID::forUtf8(rt, propertyName);
59
+ areAllPropsReversed &= interpolators_[propertyName]->updateKeyframes(
60
+ rt,
61
+ fromObject.hasProperty(rt, propNameID) ? fromObject.getProperty(rt, propNameID) : jsi::Value::undefined(),
62
+ toObject.hasProperty(rt, propNameID) ? toObject.getProperty(rt, propNameID) : jsi::Value::undefined());
63
+ }
55
64
 
56
- const auto &oldStyleObject = oldStyleValue.empty() ? emptyObject : oldStyleValue;
57
- const auto &newStyleObject = newStyleValue.empty() ? emptyObject : newStyleValue;
58
- const auto &lastUpdateObject = lastUpdateValue.empty() ? emptyObject : lastUpdateValue;
65
+ return areAllPropsReversed;
66
+ }
67
+
68
+ bool RecordPropertiesInterpolator::updateKeyframes(const folly::dynamic &fromValue, const folly::dynamic &toValue) {
69
+ // TODO - maybe add a possibility to remove interpolators that are no longer
70
+ // used (for now, for simplicity, we only add new ones)
71
+ const auto fromIsObject = fromValue.isObject();
72
+ const auto toIsObject = toValue.isObject();
59
73
 
60
74
  std::unordered_set<std::string> propertyNamesSet;
61
- for (const auto &key : oldStyleObject.keys()) {
62
- propertyNamesSet.insert(key.asString());
75
+ if (fromIsObject) {
76
+ for (const auto &item : fromValue.items()) {
77
+ propertyNamesSet.insert(item.first.asString());
78
+ }
63
79
  }
64
- for (const auto &key : newStyleObject.keys()) {
65
- propertyNamesSet.insert(key.asString());
80
+ if (toIsObject) {
81
+ for (const auto &item : toValue.items()) {
82
+ propertyNamesSet.insert(item.first.asString());
83
+ }
66
84
  }
67
85
 
86
+ bool areAllPropsReversed = true;
87
+
88
+ static const folly::dynamic kNull;
68
89
  for (const auto &propertyName : propertyNamesSet) {
69
90
  maybeCreateInterpolator(propertyName);
70
- interpolators_[propertyName]->updateKeyframesFromStyleChange(
71
- oldStyleObject.getDefault(propertyName, null),
72
- newStyleObject.getDefault(propertyName, null),
73
- lastUpdateObject.getDefault(propertyName, null));
91
+ areAllPropsReversed &= interpolators_[propertyName]->updateKeyframes(
92
+ fromIsObject && fromValue.count(propertyName) ? fromValue[propertyName] : kNull,
93
+ toIsObject && toValue.count(propertyName) ? toValue[propertyName] : kNull);
74
94
  }
95
+
96
+ return areAllPropsReversed;
75
97
  }
76
98
 
77
99
  folly::dynamic RecordPropertiesInterpolator::mapInterpolators(