@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
@@ -1,8 +1,8 @@
1
1
  #include <reanimated/Tools/ReanimatedVersion.h>
2
- #include <worklets/Tools/JSLogger.h>
3
- #include <worklets/Tools/VersionUtils.h>
4
2
 
5
- #include <memory>
3
+ #ifndef NDEBUG
4
+ #include <regex>
5
+ #endif // NDEBUG
6
6
  #include <string>
7
7
 
8
8
  #ifdef REANIMATED_VERSION
@@ -25,19 +25,56 @@ void injectReanimatedCppVersion(jsi::Runtime &rnRuntime) {
25
25
  }
26
26
 
27
27
  #ifndef NDEBUG
28
- void checkJSVersion(jsi::Runtime &rnRuntime, const std::shared_ptr<worklets::JSLogger> &jsLogger) {
29
- auto cppVersion = getReanimatedCppVersion();
30
- auto jsVersionValue = rnRuntime.global().getProperty(rnRuntime, "_REANIMATED_VERSION_JS");
31
- worklets::checkJSVersion(
32
- rnRuntime,
33
- jsVersionValue,
34
- jsLogger,
35
- cppVersion,
36
- "Reanimated",
37
- "https://docs.swmansion.com/react-native-reanimated/");
28
+ bool matchVersion(const std::string &version1, const std::string &version2) {
29
+ std::regex pattern("^(\\d+)\\.(\\d+)\\.\\d+$");
30
+ std::smatch mv1;
31
+ std::smatch mv2;
32
+ if (std::regex_match(version1, mv1, pattern) && std::regex_match(version2, mv2, pattern)) {
33
+ return mv1[1].str() == mv2[1].str() && mv1[2].str() == mv2[2].str();
34
+ } else {
35
+ return version1 == version2;
36
+ }
37
+ }
38
+
39
+ void checkJSVersion(jsi::Runtime &rt) {
40
+ const auto cppVersion = getReanimatedCppVersion();
41
+ const auto jsVersionValue = rt.global().getProperty(rt, "_REANIMATED_VERSION_JS");
42
+ const auto docsBaseUrl = "https://docs.swmansion.com/react-native-reanimated/";
43
+ const auto consoleWarn = rt.global().getPropertyAsObject(rt, "console").getPropertyAsFunction(rt, "warn");
44
+ const auto libraryPrefix = std::string("[Reanimated] ");
45
+
46
+ if (jsVersionValue.isUndefined()) {
47
+ consoleWarn.call(
48
+ rt,
49
+ std::string(
50
+ libraryPrefix +
51
+ "C++ side failed to resolve JavaScript code "
52
+ "version\n") +
53
+ "See " + docsBaseUrl +
54
+ "guides/"
55
+ "troubleshooting#c-side-failed-to-resolve-javascript-code-version for "
56
+ "more details.");
57
+ return;
58
+ }
59
+
60
+ const auto jsVersion = jsVersionValue.asString(rt).utf8(rt);
61
+
62
+ if (!matchVersion(cppVersion, jsVersion)) {
63
+ consoleWarn.call(
64
+ rt,
65
+ std::string(
66
+ libraryPrefix +
67
+ "Mismatch between C++ code version and "
68
+ "JavaScript code version (") +
69
+ cppVersion + " vs. " + jsVersion + " respectively).\n" + "See " + docsBaseUrl +
70
+ "/guides/"
71
+ "troubleshooting#mismatch-between-c-code-version-and-javascript-code-"
72
+ "version` for more details.");
73
+ return;
74
+ }
38
75
  }
39
76
  #else
40
- void checkJSVersion(jsi::Runtime &rnRuntime, const std::shared_ptr<worklets::JSLogger> &jsLogger) {
77
+ void checkJSVersion(jsi::Runtime &rt) {
41
78
  // In release builds we don't check the version, hence
42
79
  // this function is a NOOP.
43
80
  }
@@ -1,10 +1,7 @@
1
1
  #pragma once
2
2
 
3
- #include <worklets/Tools/JSLogger.h>
4
-
5
3
  #include <jsi/jsi.h>
6
4
 
7
- #include <memory>
8
5
  #include <string>
9
6
 
10
7
  using namespace facebook;
@@ -12,7 +9,7 @@ using namespace facebook;
12
9
  namespace reanimated {
13
10
 
14
11
  std::string getReanimatedCppVersion();
15
- void injectReanimatedCppVersion(jsi::Runtime &);
16
- void checkJSVersion(jsi::Runtime &, const std::shared_ptr<worklets::JSLogger> &);
12
+ void injectReanimatedCppVersion(jsi::Runtime &rt);
13
+ void checkJSVersion(jsi::Runtime &rt);
17
14
 
18
15
  }; // namespace reanimated
@@ -0,0 +1,76 @@
1
+ #pragma once
2
+
3
+ #ifndef NDEBUG
4
+
5
+ #include <react/debug/react_native_assert.h>
6
+
7
+ #include <cxxabi.h>
8
+
9
+ #include <atomic>
10
+ #include <cassert>
11
+ #include <cstdlib>
12
+ #include <string>
13
+
14
+ #ifdef ANDROID
15
+ #include <android/log.h>
16
+ #else
17
+ #include <iostream>
18
+ #endif
19
+
20
+ namespace reanimated {
21
+
22
+ // This is a class that counts how many instances of a different class there
23
+ // are. It is meant only to be used with classes that should only have one
24
+ // instance.
25
+
26
+ template <class T>
27
+ class SingleInstanceChecker {
28
+ public:
29
+ SingleInstanceChecker();
30
+ ~SingleInstanceChecker();
31
+
32
+ private:
33
+ void assertWithMessage(bool condition, const std::string &message) {
34
+ if (!condition) {
35
+ #ifdef ANDROID
36
+ __android_log_print(ANDROID_LOG_WARN, "Reanimated", "%s", message.c_str());
37
+ #else
38
+ std::cerr << "[Reanimated] " << message << std::endl;
39
+ #endif
40
+
41
+ #ifdef IS_REANIMATED_EXAMPLE_APP
42
+ react_native_assert(false && "SingleInstanceChecker failed");
43
+ #endif
44
+ }
45
+ }
46
+
47
+ // A static field will exist separately for every class template.
48
+ // This has to be inline for automatic initialization.
49
+ inline static std::atomic<int> instanceCount_;
50
+ };
51
+
52
+ template <class T>
53
+ SingleInstanceChecker<T>::SingleInstanceChecker() {
54
+ int status = 0;
55
+ char *demangled = __cxxabiv1::__cxa_demangle(typeid(T).name(), nullptr, nullptr, &status);
56
+ std::string className = (status == 0 && demangled != nullptr) ? demangled : typeid(T).name();
57
+ std::free(demangled);
58
+
59
+ // React Native can spawn up to two instances of a Native Module at the same
60
+ // time. This happens during a reload when a new instance of React Native is
61
+ // created while simultaneously the old one is torn down.
62
+ instanceCount_++;
63
+ assertWithMessage(
64
+ instanceCount_ <= 2,
65
+ "[Reanimated] More than two instances of " + className +
66
+ " present. This may indicate a memory leak due to a retain cycle.");
67
+ }
68
+
69
+ template <class T>
70
+ SingleInstanceChecker<T>::~SingleInstanceChecker() {
71
+ instanceCount_--;
72
+ }
73
+
74
+ } // namespace reanimated
75
+
76
+ #endif // NDEBUG
@@ -0,0 +1,353 @@
1
+ // Copyright (c) 2026 Huawei Device Co., Ltd. All rights reserved
2
+ // Use of this source code is governed by a MIT license that can be
3
+ // found in the LICENSE file.
4
+
5
+ #include "OHOSCSSPlatformTransitions.h"
6
+
7
+ #include "RNOH/ComponentInstance.h"
8
+ #include "RNOH/RNInstance.h"
9
+ #include "RNOH/RNInstanceCAPI.h"
10
+ #include "RNOH/TaskExecutor/TaskExecutor.h"
11
+ #include "RNOH/arkui/ArkUINode.h"
12
+ #include "RNOH/arkui/NativeNodeApi.h"
13
+
14
+ #include <arkui/native_animate.h>
15
+ #include <arkui/native_interface.h>
16
+ #include <arkui/native_node.h>
17
+
18
+ #include <glog/logging.h>
19
+
20
+ #include <algorithm>
21
+ #include <array>
22
+ #include <chrono>
23
+ #include <cstdint>
24
+ #include <optional>
25
+ #include <utility>
26
+ #include <vector>
27
+
28
+ using namespace facebook;
29
+
30
+ namespace reanimated::css {
31
+
32
+ namespace {
33
+
34
+ double wallClockMs() {
35
+ return std::chrono::duration<double, std::milli>(
36
+ std::chrono::high_resolution_clock::now().time_since_epoch())
37
+ .count();
38
+ }
39
+
40
+ // CSS property -> the ArkUI node attribute that renders it. The routable set
41
+ // matches platform.cpp's OHOS whitelist (shadow* stays on the loop: ArkUI's
42
+ // NODE_SHADOW takes only predefined style enums).
43
+ std::optional<ArkUI_NodeAttributeType> attributeForProperty(const std::string &propertyName) {
44
+ static const std::unordered_map<std::string, ArkUI_NodeAttributeType> kAttributes = {
45
+ {"opacity", NODE_OPACITY},
46
+ {"backgroundColor", NODE_BACKGROUND_COLOR},
47
+ {"borderColor", NODE_BORDER_COLOR},
48
+ {"borderRadius", NODE_BORDER_RADIUS},
49
+ {"borderWidth", NODE_BORDER_WIDTH},
50
+ };
51
+ const auto it = kAttributes.find(propertyName);
52
+ return it != kAttributes.end() ? std::optional<ArkUI_NodeAttributeType>(it->second) : std::nullopt;
53
+ }
54
+
55
+ // Normalized [r,g,b,a] doubles (parsePlatformValue's Color form) -> 0xAARRGGBB,
56
+ // the layout ArkUI color attributes take.
57
+ uint32_t argbFromColor(const std::array<double, 4> &rgba) {
58
+ const auto channel = [](const double v) {
59
+ return static_cast<uint32_t>(std::clamp(v, 0.0, 1.0) * 255.0 + 0.5);
60
+ };
61
+ return (channel(rgba[3]) << 24) | (channel(rgba[0]) << 16) | (channel(rgba[1]) << 8) | channel(rgba[2]);
62
+ }
63
+
64
+ // The single ArkUI_NumberValue expressing this property's endpoint. A Size
65
+ // value (array<double,2>) is not expressible — unreachable through the
66
+ // routing gate, reported as nullopt so callers can bail out.
67
+ struct AttributePayload {
68
+ ArkUI_NumberValue value;
69
+ };
70
+ std::optional<AttributePayload> payloadForValue(const PlatformValue &value) {
71
+ if (const auto *scalar = std::get_if<double>(&value)) {
72
+ return AttributePayload{ArkUI_NumberValue{.f32 = static_cast<float>(*scalar)}};
73
+ }
74
+ if (const auto *color = std::get_if<std::array<double, 4>>(&value)) {
75
+ return AttributePayload{ArkUI_NumberValue{.u32 = argbFromColor(*color)}};
76
+ }
77
+ return std::nullopt;
78
+ }
79
+
80
+ std::string describeValue(const PlatformValue &value) {
81
+ if (const auto *scalar = std::get_if<double>(&value)) {
82
+ return std::to_string(*scalar);
83
+ }
84
+ if (const auto *color = std::get_if<std::array<double, 4>>(&value)) {
85
+ std::string out = "#" + std::to_string(argbFromColor(*color));
86
+ return out;
87
+ }
88
+ return "size";
89
+ }
90
+
91
+ // Only linear and cubic-bezier reach the backend (canRouteCSSProperty gate);
92
+ // steps / linear-stops would need per-frame interpolation on the loop.
93
+ ArkUI_CurveHandle createCurve(const EasingConfig &easing) {
94
+ if (const auto *bezier = std::get_if<CubicBezierEasing>(&easing)) {
95
+ return OH_ArkUI_Curve_CreateCubicBezierCurve(
96
+ static_cast<float>(bezier->x1),
97
+ static_cast<float>(bezier->y1),
98
+ static_cast<float>(bezier->x2),
99
+ static_cast<float>(bezier->y2));
100
+ }
101
+ return OH_ArkUI_Curve_CreateCurveByType(ARKUI_CURVE_LINEAR);
102
+ }
103
+
104
+ // Everything the MAIN-thread animation needs; plain copies only, so the
105
+ // closure outlives the caller-side state safely.
106
+ struct AnimateRequest {
107
+ react::Tag tag;
108
+ std::string property;
109
+ ArkUI_NodeAttributeType attribute;
110
+ AttributePayload payload;
111
+ double durationMs;
112
+ double delayMs;
113
+ EasingConfig easing;
114
+ };
115
+
116
+ // Resolves the raw ArkUI node behind a view tag. Must run on MAIN (component
117
+ // instances live there); returns nullptr for unmounted/unresolved tags.
118
+ ArkUI_NodeHandle resolveNode(
119
+ const std::weak_ptr<rnoh::RNInstance> &weakInstance,
120
+ const react::Tag tag) {
121
+ const auto instance = weakInstance.lock();
122
+ const auto instanceCapi = std::dynamic_pointer_cast<rnoh::RNInstanceCAPI>(instance);
123
+ if (instanceCapi == nullptr) {
124
+ return nullptr;
125
+ }
126
+ const auto componentInstance = instanceCapi->findComponentInstanceByTag(tag);
127
+ if (componentInstance == nullptr) {
128
+ return nullptr;
129
+ }
130
+ return componentInstance->getLocalRootArkUINode().getArkUINodeHandle();
131
+ }
132
+
133
+ } // namespace
134
+
135
+ OHOSCSSPlatformTransitions::OHOSCSSPlatformTransitions(
136
+ std::weak_ptr<rnoh::RNInstance> instance,
137
+ std::weak_ptr<rnoh::TaskExecutor> taskExecutor)
138
+ : instance_(std::move(instance)), taskExecutor_(std::move(taskExecutor)) {}
139
+
140
+ bool OHOSCSSPlatformTransitions::applyTransitionForTag(
141
+ jsi::Runtime &rt,
142
+ const react::Tag viewTag,
143
+ const std::string &propertyName,
144
+ const jsi::Value &fromValue,
145
+ const jsi::Value &toValue,
146
+ const CSSTransitionPropertySettings &settings,
147
+ const double timestamp) {
148
+ const auto from = parsePlatformValue(rt, propertyName, fromValue);
149
+ const auto to = parsePlatformValue(rt, propertyName, toValue);
150
+ if (!from || !to || !attributeForProperty(propertyName) || !payloadForValue(*to)) {
151
+ return false;
152
+ }
153
+ DLOG(INFO) << "[css-route] apply tag=" << viewTag << " prop=" << propertyName
154
+ << " from=" << describeValue(*from) << " to=" << describeValue(*to)
155
+ << " duration=" << settings.duration << " delay=" << settings.delay;
156
+ applyForTag(viewTag, propertyName, *from, *to, settings, timestamp);
157
+ return true;
158
+ }
159
+
160
+ bool OHOSCSSPlatformTransitions::applyDynamicTransitionForTag(
161
+ const react::Tag viewTag,
162
+ const std::string &propertyName,
163
+ const folly::dynamic &fromValue,
164
+ const folly::dynamic &toValue,
165
+ const double timestamp) {
166
+ std::optional<CSSTransitionPropertySettings> settings;
167
+ {
168
+ std::lock_guard<std::mutex> lock(mutex_);
169
+ const auto propertiesIt = active_.find(viewTag);
170
+ if (propertiesIt == active_.end()) {
171
+ return false;
172
+ }
173
+ const auto activeIt = propertiesIt->second.find(propertyName);
174
+ if (activeIt == propertiesIt->second.end()) {
175
+ // No config apply ran for this property, so there are no settings to reuse.
176
+ return false;
177
+ }
178
+ settings = activeIt->second.settings;
179
+ }
180
+ const auto from = parsePlatformValue(propertyName, fromValue);
181
+ const auto to = parsePlatformValue(propertyName, toValue);
182
+ if (!from || !to || !attributeForProperty(propertyName) || !payloadForValue(*to)) {
183
+ return false;
184
+ }
185
+ DLOG(INFO) << "[css-route] applyDynamic tag=" << viewTag << " prop=" << propertyName
186
+ << " from=" << describeValue(*from) << " to=" << describeValue(*to);
187
+ applyForTag(viewTag, propertyName, *from, *to, *settings, timestamp);
188
+ return true;
189
+ }
190
+
191
+ void OHOSCSSPlatformTransitions::removeTransitionForTag(
192
+ const react::Tag viewTag, const std::string &propertyName) {
193
+ std::optional<PlatformValue> endValue;
194
+ {
195
+ std::lock_guard<std::mutex> lock(mutex_);
196
+ const auto propertiesIt = active_.find(viewTag);
197
+ if (propertiesIt != active_.end()) {
198
+ const auto activeIt = propertiesIt->second.find(propertyName);
199
+ if (activeIt != propertiesIt->second.end()) {
200
+ endValue = activeIt->second.adjustedEnd;
201
+ }
202
+ propertiesIt->second.erase(propertyName);
203
+ if (propertiesIt->second.empty()) {
204
+ active_.erase(propertiesIt);
205
+ }
206
+ }
207
+ }
208
+ const auto attribute = attributeForProperty(propertyName);
209
+ if (!endValue || !attribute) {
210
+ return;
211
+ }
212
+ const auto payload = payloadForValue(*endValue);
213
+ if (!payload) {
214
+ return;
215
+ }
216
+ // v1: snap the node to the recorded target value. iOS freezes the live
217
+ // presentation value on cancel; ArkUI has no generic presentation getter
218
+ // for arbitrary attributes, so the node lands on the target instead.
219
+ const auto weakInstance = instance_;
220
+ const ArkUI_NodeAttributeType attr = *attribute;
221
+ const AttributePayload payloadCopy = *payload;
222
+ const std::string property = propertyName;
223
+ runOnMain([weakInstance, viewTag, property, attr, payloadCopy]() {
224
+ const auto nodeApi = rnoh::NativeNodeApi::getInstance();
225
+ ArkUI_NodeHandle node = resolveNode(weakInstance, viewTag);
226
+ if (node == nullptr) {
227
+ DLOG(WARNING) << "[css-route] remove: node not found tag=" << viewTag;
228
+ return;
229
+ }
230
+ ArkUI_NumberValue value = payloadCopy.value;
231
+ const ArkUI_AttributeItem item{&value, 1, nullptr, nullptr};
232
+ nodeApi->setAttribute(node, attr, &item);
233
+ DLOG(INFO) << "[css-route] remove tag=" << viewTag << " prop=" << property
234
+ << " (snapped to target)";
235
+ });
236
+ }
237
+
238
+ void OHOSCSSPlatformTransitions::applyForTag(
239
+ const react::Tag viewTag,
240
+ const std::string &propertyName,
241
+ const PlatformValue &fromValue,
242
+ const PlatformValue &toValue,
243
+ const CSSTransitionPropertySettings &settings,
244
+ const double timestamp) {
245
+ const auto attribute = attributeForProperty(propertyName);
246
+ const auto payload = payloadForValue(toValue);
247
+ if (!attribute || !payload) {
248
+ return;
249
+ }
250
+
251
+ ReversingState reversing;
252
+ {
253
+ std::lock_guard<std::mutex> lock(mutex_);
254
+ auto &properties = active_[viewTag];
255
+ const auto activeIt = properties.find(propertyName);
256
+ // Targeting the in-flight transition's start value means this is a reversal.
257
+ const bool isReversal =
258
+ activeIt != properties.end() && toValue == activeIt->second.adjustedStart;
259
+ if (isReversal) {
260
+ reversing = reverseShorten(
261
+ activeIt->second.reversing, timestamp, settings.duration, settings.delay, settings.easingConfig);
262
+ DLOG(INFO) << "[css-route] reversal tag=" << viewTag << " prop=" << propertyName
263
+ << " shortened=" << reversing.duration << "ms";
264
+ } else {
265
+ reversing = makeReversingState(timestamp, settings.duration, settings.delay, settings.easingConfig);
266
+ }
267
+ properties[propertyName] = ActiveTransition{
268
+ isReversal ? activeIt->second.adjustedEnd : fromValue, toValue, reversing, settings};
269
+ }
270
+
271
+ // reversing.startTimestamp is absolute (ms); animateTo wants a relative
272
+ // delay. Negative delays (already-part-elapsed W3C semantics) clamp to 0 —
273
+ // ArkUI has no negative-delay form.
274
+ double delayMs = reversing.startTimestamp - wallClockMs();
275
+ if (delayMs < 0) {
276
+ delayMs = 0;
277
+ }
278
+
279
+ AnimateRequest request{
280
+ viewTag,
281
+ propertyName,
282
+ *attribute,
283
+ *payload,
284
+ std::max(0.0, reversing.duration),
285
+ delayMs,
286
+ settings.easingConfig};
287
+ const auto weakInstance = instance_;
288
+ runOnMain([weakInstance, request = std::move(request)]() {
289
+ ArkUI_NodeHandle node = resolveNode(weakInstance, request.tag);
290
+ if (node == nullptr) {
291
+ DLOG(WARNING) << "[css-route] animate: node not found tag=" << request.tag
292
+ << " prop=" << request.property;
293
+ return;
294
+ }
295
+ ArkUI_ContextHandle context = OH_ArkUI_GetContextByNode(node);
296
+ if (context == nullptr) {
297
+ DLOG(WARNING) << "[css-route] animate: no UIContext tag=" << request.tag;
298
+ return;
299
+ }
300
+ ArkUI_NativeAnimateAPI_1 *animateApi = nullptr;
301
+ OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_ANIMATE, ArkUI_NativeAnimateAPI_1, animateApi);
302
+ if (animateApi == nullptr || animateApi->animateTo == nullptr) {
303
+ DLOG(WARNING) << "[css-route] animate: ArkUI_NativeAnimateAPI_1 unavailable";
304
+ return;
305
+ }
306
+
307
+ ArkUI_AnimateOption *option = OH_ArkUI_AnimateOption_Create();
308
+ OH_ArkUI_AnimateOption_SetDuration(option, static_cast<int32_t>(request.durationMs));
309
+ OH_ArkUI_AnimateOption_SetDelay(option, static_cast<int32_t>(request.delayMs));
310
+ ArkUI_CurveHandle curve = createCurve(request.easing);
311
+ if (curve != nullptr) {
312
+ OH_ArkUI_AnimateOption_SetICurve(option, curve);
313
+ }
314
+
315
+ // animateTo invokes the update closure synchronously (it exists to record
316
+ // the end-state diff), so a stack context is safe as its userData.
317
+ struct UpdateCtx {
318
+ ArkUI_NodeHandle node;
319
+ ArkUI_NodeAttributeType attribute;
320
+ ArkUI_NumberValue value;
321
+ } updateCtx{node, request.attribute, request.payload.value};
322
+ ArkUI_ContextCallback update{
323
+ &updateCtx,
324
+ [](void *userData) {
325
+ const auto *ctx = static_cast<UpdateCtx *>(userData);
326
+ ArkUI_NumberValue value = ctx->value;
327
+ const ArkUI_AttributeItem item{&value, 1, nullptr, nullptr};
328
+ rnoh::NativeNodeApi::getInstance()->setAttribute(ctx->node, ctx->attribute, &item);
329
+ }};
330
+ const int32_t result = animateApi->animateTo(context, option, &update, nullptr);
331
+ OH_ArkUI_AnimateOption_Dispose(option);
332
+ if (curve != nullptr) {
333
+ OH_ArkUI_Curve_DisposeCurve(curve);
334
+ }
335
+ DLOG(INFO) << "[css-route] animateTo tag=" << request.tag << " prop=" << request.property
336
+ << " result=" << result << " duration=" << static_cast<int32_t>(request.durationMs)
337
+ << "ms delay=" << static_cast<int32_t>(request.delayMs) << "ms";
338
+ });
339
+ }
340
+
341
+ void OHOSCSSPlatformTransitions::runOnMain(std::function<void()> task) {
342
+ auto taskExecutor = taskExecutor_.lock();
343
+ if (!taskExecutor) {
344
+ return;
345
+ }
346
+ if (taskExecutor->isOnTaskThread(rnoh::TaskThread::MAIN)) {
347
+ task();
348
+ } else {
349
+ taskExecutor->runTask(rnoh::TaskThread::MAIN, std::move(task));
350
+ }
351
+ }
352
+
353
+ } // namespace reanimated::css
@@ -0,0 +1,95 @@
1
+ // Copyright (c) 2026 Huawei Device Co., Ltd. All rights reserved
2
+ // Use of this source code is governed by a MIT license that can be
3
+ // found in the LICENSE file.
4
+
5
+ #pragma once
6
+
7
+ #include <reanimated/CSS/configs/CSSTransitionConfig.h>
8
+ #include <reanimated/CSS/utils/platform.h>
9
+ #include <reanimated/CSS/utils/reversingShortening.h>
10
+
11
+ #include <folly/dynamic.h>
12
+ #include <jsi/jsi.h>
13
+ #include <react/renderer/core/ReactPrimitives.h>
14
+
15
+ #include <functional>
16
+ #include <memory>
17
+ #include <mutex>
18
+ #include <string>
19
+ #include <unordered_map>
20
+
21
+ namespace rnoh {
22
+ class RNInstance;
23
+ class TaskExecutor;
24
+ } // namespace rnoh
25
+
26
+ namespace reanimated::css {
27
+
28
+ // Per-property state for an in-flight native transition. adjustedStart/adjustedEnd
29
+ // and the reversing snapshot handle interruptions; settings are reused by the
30
+ // toggle path. (Mirrors the Apple backend's ActiveTransition.)
31
+ struct ActiveTransition {
32
+ PlatformValue adjustedStart;
33
+ PlatformValue adjustedEnd;
34
+ ReversingState reversing;
35
+ CSSTransitionPropertySettings settings;
36
+ };
37
+
38
+ /// ArkUI-backed CSS transition backend — the OHOS counterpart of Apple's
39
+ /// REACSSPlatformTransitions. Routed properties animate via
40
+ /// ArkUI_NativeAnimateAPI_1::animateTo on the real UI nodes (implicit
41
+ /// attribute animation) instead of being interpolated per-frame on the
42
+ /// reanimated loop.
43
+ ///
44
+ /// The state map is mutex-guarded (routing can arrive from the JS thread as
45
+ /// well as the operations loop); the ArkUI work always runs on MAIN and the
46
+ /// posted closures only carry copies, never map references.
47
+ class OHOSCSSPlatformTransitions {
48
+ public:
49
+ OHOSCSSPlatformTransitions(
50
+ std::weak_ptr<rnoh::RNInstance> instance,
51
+ std::weak_ptr<rnoh::TaskExecutor> taskExecutor);
52
+
53
+ /// Config path (CSSPlatformTransitionProxy's applyJSI hook). Returns false
54
+ /// when the platform can't express an endpoint — the proxy then falls back
55
+ /// to the loop for this property.
56
+ bool applyTransitionForTag(
57
+ facebook::jsi::Runtime &rt,
58
+ react::Tag viewTag,
59
+ const std::string &propertyName,
60
+ const facebook::jsi::Value &fromValue,
61
+ const facebook::jsi::Value &toValue,
62
+ const CSSTransitionPropertySettings &settings,
63
+ double timestamp);
64
+
65
+ /// Pseudo-selector toggle path: reuses the settings of the active transition.
66
+ bool applyDynamicTransitionForTag(
67
+ react::Tag viewTag,
68
+ const std::string &propertyName,
69
+ const folly::dynamic &fromValue,
70
+ const folly::dynamic &toValue,
71
+ double timestamp);
72
+
73
+ /// Cancels the property's native transition and drops its platform-side state.
74
+ void removeTransitionForTag(react::Tag viewTag, const std::string &propertyName);
75
+
76
+ private:
77
+ // Reverse-shortens against any in-flight transition (W3C reversing),
78
+ // records the new active state and kicks off the ArkUI animation.
79
+ void applyForTag(
80
+ react::Tag viewTag,
81
+ const std::string &propertyName,
82
+ const PlatformValue &fromValue,
83
+ const PlatformValue &toValue,
84
+ const CSSTransitionPropertySettings &settings,
85
+ double timestamp);
86
+
87
+ void runOnMain(std::function<void()> task);
88
+
89
+ std::unordered_map<react::Tag, std::unordered_map<std::string, ActiveTransition>> active_;
90
+ std::mutex mutex_;
91
+ std::weak_ptr<rnoh::RNInstance> instance_;
92
+ std::weak_ptr<rnoh::TaskExecutor> taskExecutor_;
93
+ };
94
+
95
+ } // namespace reanimated::css