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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/CHANGELOG.md +1070 -0
  2. package/LICENSE +21 -0
  3. package/README.md +842 -0
  4. package/compatibility.json +20 -26
  5. package/harmony/reanimated/BuildProfile.ets +1 -1
  6. package/harmony/reanimated/index.ets +4 -2
  7. package/harmony/reanimated/oh-package-lock.json5 +1 -1
  8. package/harmony/reanimated/oh-package.json5 +1 -1
  9. package/harmony/reanimated/src/main/cpp/CMakeLists.txt +23 -9
  10. package/harmony/reanimated/src/main/cpp/Common/NativeView/CMakeLists.txt +56 -0
  11. package/harmony/reanimated/src/main/cpp/Common/NativeView/react/renderer/components/rnreanimated/ComponentDescriptors.h +19 -0
  12. package/harmony/reanimated/src/main/cpp/Common/NativeView/react/renderer/components/rnreanimated/REASharedTransitionBoundaryComponentDescriptor.h +30 -0
  13. package/harmony/reanimated/src/main/cpp/Common/NativeView/react/renderer/components/rnreanimated/REASharedTransitionBoundaryShadowNode.cpp +15 -0
  14. package/harmony/reanimated/src/main/cpp/Common/NativeView/react/renderer/components/rnreanimated/REASharedTransitionBoundaryShadowNode.h +41 -0
  15. package/harmony/reanimated/src/main/cpp/Common/NativeView/react/renderer/components/rnreanimated/REASharedTransitionBoundaryState.h +30 -0
  16. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.cpp +8 -9
  17. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.h +3 -6
  18. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/InterpolatorRegistry.cpp +203 -150
  19. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/InterpolatorRegistry.h +1 -6
  20. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/definitions.h +2 -7
  21. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSAngle.cpp +0 -1
  22. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSColor.cpp +2 -18
  23. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSDiscreteArray.cpp +11 -11
  24. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSDiscreteArray.h +2 -6
  25. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSLength.cpp +4 -1
  26. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSNumber.cpp +5 -0
  27. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSNumber.h +8 -0
  28. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSValue.h +27 -46
  29. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSValueVariant.cpp +20 -20
  30. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSValueVariant.h +2 -2
  31. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/complex/CSSDropShadow.h +3 -3
  32. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSAnimationConfig.cpp +10 -2
  33. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSAnimationConfig.h +5 -3
  34. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSKeyframesConfig.cpp +20 -17
  35. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSKeyframesConfig.h +5 -8
  36. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSTransitionConfig.cpp +33 -66
  37. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSTransitionConfig.h +29 -22
  38. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/common.cpp +14 -2
  39. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/common.h +8 -2
  40. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSAnimation.cpp +50 -91
  41. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSAnimation.h +43 -18
  42. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSAnimationsGroup.cpp +63 -0
  43. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSAnimationsGroup.h +37 -0
  44. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSLoopAnimation.cpp +100 -0
  45. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSLoopAnimation.h +49 -0
  46. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSPlatformAnimation.h +13 -0
  47. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSPlatformAnimationFactory.h +32 -0
  48. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/transition/CSSLoopTransition.cpp +156 -0
  49. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/transition/CSSLoopTransition.h +71 -0
  50. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/transition/CSSPlatformTransitionProxy.cpp +141 -0
  51. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/transition/CSSPlatformTransitionProxy.h +104 -0
  52. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/transition/CSSTransition.cpp +97 -0
  53. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/transition/CSSTransition.h +69 -0
  54. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/EasingConfigs.cpp +89 -0
  55. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/EasingConfigs.h +36 -0
  56. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/InterpolatorFactory.cpp +12 -0
  57. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/InterpolatorFactory.h +11 -2
  58. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/PropertyInterpolator.cpp +2 -3
  59. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/PropertyInterpolator.h +3 -5
  60. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterOperation.cpp +3 -3
  61. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterOperation.h +1 -1
  62. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/ArrayPropertiesInterpolator.cpp +38 -37
  63. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/ArrayPropertiesInterpolator.h +3 -6
  64. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/RecordPropertiesInterpolator.cpp +54 -32
  65. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/RecordPropertiesInterpolator.h +5 -7
  66. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/OperationsStyleInterpolator.cpp +46 -46
  67. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/OperationsStyleInterpolator.h +8 -7
  68. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/StyleOperation.h +4 -57
  69. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/AnimationStyleInterpolator.cpp +23 -0
  70. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/AnimationStyleInterpolator.h +10 -8
  71. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/AnimationStyleInterpolatorFactory.cpp +77 -0
  72. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/AnimationStyleInterpolatorFactory.h +38 -0
  73. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/TransitionStyleInterpolator.cpp +47 -68
  74. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/TransitionStyleInterpolator.h +21 -9
  75. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperation.cpp +4 -1
  76. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperationInterpolator.cpp +35 -78
  77. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperationInterpolator.h +44 -13
  78. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/matrix.cpp +13 -11
  79. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ResolvableValueInterpolator.cpp +4 -0
  80. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/SimpleValueInterpolator.cpp +7 -3
  81. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ValueInterpolator.cpp +20 -27
  82. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ValueInterpolator.h +12 -9
  83. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/misc/ViewStylesRepository.cpp +63 -36
  84. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/misc/ViewStylesRepository.h +6 -8
  85. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/AnimationProgressProvider.cpp +55 -46
  86. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/AnimationProgressProvider.h +8 -5
  87. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/RawProgressProvider.cpp +1 -2
  88. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/RawProgressProvider.h +3 -2
  89. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/TransitionProgressProvider.cpp +76 -71
  90. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/TransitionProgressProvider.h +17 -14
  91. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSAnimationsRegistry.cpp +145 -273
  92. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSAnimationsRegistry.h +43 -44
  93. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSKeyframesRegistry.cpp +19 -19
  94. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSKeyframesRegistry.h +16 -12
  95. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSTransitionsRegistry.cpp +95 -114
  96. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSTransitionsRegistry.h +38 -25
  97. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/StaticPropsRegistry.cpp +9 -34
  98. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/StaticPropsRegistry.h +0 -10
  99. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/CSSLengthArray.cpp +47 -0
  100. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/CSSLengthArray.h +24 -0
  101. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/CSSLengthVector.cpp +87 -0
  102. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/CSSLengthVector.h +28 -0
  103. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGPath.cpp +326 -0
  104. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGPath.h +65 -0
  105. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGStops.cpp +164 -0
  106. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGStops.h +51 -0
  107. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGStrokeDashArray.cpp +14 -66
  108. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGStrokeDashArray.h +7 -18
  109. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/platform.cpp +284 -0
  110. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/platform.h +31 -0
  111. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/props.cpp +13 -132
  112. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/props.h +3 -21
  113. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/reversingShortening.h +43 -0
  114. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Compat/WorkletsApi.h +13 -0
  115. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Events/UIEventHandler.cpp +33 -0
  116. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Events/UIEventHandler.h +39 -0
  117. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Events/UIEventHandlerRegistry.cpp +95 -0
  118. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Events/UIEventHandlerRegistry.h +40 -0
  119. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.cpp +20 -23
  120. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.h +2 -6
  121. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.cpp +26 -18
  122. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.h +4 -8
  123. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.cpp +16 -28
  124. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.h +3 -4
  125. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.cpp +72 -24
  126. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.h +17 -7
  127. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/OperationsLoop.cpp +152 -0
  128. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/OperationsLoop.h +86 -0
  129. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/PropsLayoutFilter.h +98 -0
  130. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistry.cpp +162 -28
  131. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistry.h +69 -11
  132. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistryManager.cpp +41 -17
  133. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistryManager.h +14 -3
  134. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/propNameFromString.h +130 -0
  135. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.cpp +1 -0
  136. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.h +5 -7
  137. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.cpp +7 -4
  138. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.h +52 -9
  139. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.cpp +174 -62
  140. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.h +12 -11
  141. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.cpp +251 -128
  142. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.h +23 -19
  143. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.h +34 -6
  144. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/SharedTransitions.cpp +71 -64
  145. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.cpp +938 -700
  146. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.h +123 -76
  147. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/SynchronousPropsBufferSerializer.cpp +313 -0
  148. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/SynchronousPropsBufferSerializer.h +18 -0
  149. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/PseudoStyles/PseudoSelector.h +41 -0
  150. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/PseudoStyles/PseudoStylesRegistry.cpp +113 -0
  151. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/PseudoStyles/PseudoStylesRegistry.h +73 -0
  152. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.cpp +4 -4
  153. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.cpp +23 -48
  154. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.h +13 -14
  155. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/PlatformDepMethodsHolder.h +20 -3
  156. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReaJSIUtils.h +227 -0
  157. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReanimatedVersion.cpp +51 -14
  158. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReanimatedVersion.h +2 -5
  159. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/SingleInstanceChecker.h +76 -0
  160. package/harmony/reanimated/src/main/cpp/OHOSCSSPlatformTransitions.cpp +353 -0
  161. package/harmony/reanimated/src/main/cpp/OHOSCSSPlatformTransitions.h +95 -0
  162. package/harmony/reanimated/src/main/cpp/PseudoSelectorManager.cpp +140 -0
  163. package/harmony/reanimated/src/main/cpp/PseudoSelectorManager.h +52 -0
  164. package/harmony/reanimated/src/main/cpp/REASharedTransitionBoundaryComponentInstance.cpp +45 -0
  165. package/harmony/reanimated/src/main/cpp/REASharedTransitionBoundaryComponentInstance.h +33 -0
  166. package/harmony/reanimated/src/main/cpp/REASharedTransitionBoundaryJSIBinder.h +20 -0
  167. package/harmony/reanimated/src/main/cpp/ReanimatedModule.cpp +112 -19
  168. package/harmony/reanimated/src/main/cpp/ReanimatedModule.h +4 -2
  169. package/harmony/reanimated/src/main/cpp/ReanimatedNodesManager.cpp +1 -1
  170. package/harmony/reanimated/src/main/cpp/ReanimatedNodesManager.h +1 -1
  171. package/harmony/reanimated/src/main/cpp/ReanimatedPackage.cpp +24 -1
  172. package/harmony/reanimated/src/main/cpp/ReanimatedPackage.h +7 -2
  173. package/harmony/reanimated/src/main/cpp/ReanimatedSensor.cpp +88 -57
  174. package/harmony/reanimated/src/main/cpp/ReanimatedSensor.h +4 -2
  175. package/harmony/reanimated/src/main/cpp/ReanimatedSensorContainer.cpp +1 -1
  176. package/harmony/reanimated/src/main/cpp/ReanimatedSensorContainer.h +1 -1
  177. package/harmony/reanimated/src/main/cpp/ReanimatedUIScheduler.cpp +9 -7
  178. package/harmony/reanimated/src/main/cpp/ReanimatedUIScheduler.h +6 -5
  179. package/harmony/reanimated/src/main/cpp/TransformParser.h +1 -1
  180. package/harmony/reanimated/src/main/cpp/codegen/react/renderer/components/rnreanimated/EventEmitters.h +19 -0
  181. package/harmony/reanimated/src/main/cpp/codegen/react/renderer/components/rnreanimated/Props.h +31 -0
  182. package/harmony/reanimated/src/main/ets/KeyboardState.ts +11 -0
  183. package/harmony/reanimated/src/main/ets/ReanimatedModule.ts +119 -19
  184. package/harmony/reanimated/src/main/ets/{ReanimatedPackage.ts → ReanimatedPackage.ets} +4 -3
  185. package/harmony/reanimated.har +0 -0
  186. package/package.json +52 -24
  187. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSTransition.cpp +0 -145
  188. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSTransition.h +0 -47
  189. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGLength.cpp +0 -93
  190. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGLength.h +0 -36
  191. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/DelayedItemsManager.cpp +0 -75
  192. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/DelayedItemsManager.h +0 -45
  193. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.cpp +0 -183
  194. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.h +0 -93
  195. package/harmony/reanimated/src/main/ets/AnimationManager.ts +0 -61
  196. /package/harmony/reanimated/{ts.ts → ts.ets} +0 -0
@@ -196,7 +196,10 @@ folly::dynamic TransformOperationBase<TOperation, TValue>::valueToDynamic() cons
196
196
 
197
197
  template <TransformOp TOperation, typename TValue>
198
198
  bool TransformOperationBase<TOperation, TValue>::areValuesEqual(const StyleOperation &other) const {
199
- return value == static_cast<const TransformOperationBase<TOperation, TValue> &>(other).value;
199
+ if (typeid(*this) == typeid(other)) {
200
+ return value == static_cast<const TransformOperationBase<TOperation, TValue> &>(other).value;
201
+ }
202
+ return false;
200
203
  }
201
204
 
202
205
  // Rotate operations
@@ -5,13 +5,15 @@
5
5
  #include <reanimated/CSS/interpolation/transforms/operations/skew.h>
6
6
  #include <reanimated/CSS/interpolation/transforms/operations/translate.h>
7
7
 
8
+ #include <cmath>
9
+ #include <limits>
8
10
  #include <utility>
9
11
 
10
12
  namespace reanimated::css {
11
13
 
12
14
  // Base implementation for simple operations
13
- template <typename TOperation, typename TEnable>
14
- std::unique_ptr<StyleOperation> TransformOperationInterpolator<TOperation, TEnable>::interpolate(
15
+ template <typename TOperation>
16
+ std::unique_ptr<StyleOperation> TransformOperationInterpolator<TOperation>::interpolate(
15
17
  double progress,
16
18
  const std::shared_ptr<StyleOperation> &from,
17
19
  const std::shared_ptr<StyleOperation> &to,
@@ -22,33 +24,38 @@ std::unique_ptr<StyleOperation> TransformOperationInterpolator<TOperation, TEnab
22
24
  }
23
25
 
24
26
  // Specialization for PerspectiveOperation
25
- TransformOperationInterpolator<PerspectiveOperation, void>::TransformOperationInterpolator(
27
+ TransformOperationInterpolator<PerspectiveOperation>::TransformOperationInterpolator(
26
28
  const std::shared_ptr<PerspectiveOperation> &defaultOperation)
27
29
  : StyleOperationInterpolator(defaultOperation) {}
28
30
 
29
- std::unique_ptr<StyleOperation> TransformOperationInterpolator<PerspectiveOperation, void>::interpolate(
31
+ std::unique_ptr<StyleOperation> TransformOperationInterpolator<PerspectiveOperation>::interpolate(
30
32
  double progress,
31
33
  const std::shared_ptr<StyleOperation> &from,
32
34
  const std::shared_ptr<StyleOperation> &to,
33
35
  const StyleOperationsInterpolationContext & /* context */) const {
34
- // TODO - check if this implementation is correct
35
36
  const auto &fromValue = std::static_pointer_cast<PerspectiveOperation>(from)->value;
36
37
  const auto &toValue = std::static_pointer_cast<PerspectiveOperation>(to)->value;
37
38
 
38
- if (fromValue.value == 0)
39
- return std::make_unique<PerspectiveOperation>(toValue);
40
- if (toValue.value == 0)
41
- return std::make_unique<PerspectiveOperation>(fromValue);
39
+ // The default "no perspective" is infinity, so interpolating the distance
40
+ // directly gives inf + t*(d - inf) = NaN. Interpolate in reciprocal space
41
+ // instead (1/inf = 0, matching how perspective enters the matrix as -1/d).
42
+ if (std::isinf(fromValue.value) || std::isinf(toValue.value)) {
43
+ const double fromReciprocal = 1.0 / fromValue.value;
44
+ const double toReciprocal = 1.0 / toValue.value;
45
+ const double reciprocal = fromReciprocal + progress * (toReciprocal - fromReciprocal);
46
+ return std::make_unique<PerspectiveOperation>(
47
+ reciprocal == 0.0 ? std::numeric_limits<double>::infinity() : 1.0 / reciprocal);
48
+ }
42
49
 
43
50
  return std::make_unique<PerspectiveOperation>(fromValue.interpolate(progress, toValue));
44
51
  }
45
52
 
46
53
  // Specialization for MatrixOperation
47
- TransformOperationInterpolator<MatrixOperation, void>::TransformOperationInterpolator(
54
+ TransformOperationInterpolator<MatrixOperation>::TransformOperationInterpolator(
48
55
  const std::shared_ptr<MatrixOperation> &defaultOperation)
49
56
  : StyleOperationInterpolator(defaultOperation) {}
50
57
 
51
- std::unique_ptr<StyleOperation> TransformOperationInterpolator<MatrixOperation, void>::interpolate(
58
+ std::unique_ptr<StyleOperation> TransformOperationInterpolator<MatrixOperation>::interpolate(
52
59
  double progress,
53
60
  const std::shared_ptr<StyleOperation> &from,
54
61
  const std::shared_ptr<StyleOperation> &to,
@@ -73,7 +80,7 @@ std::unique_ptr<StyleOperation> TransformOperationInterpolator<MatrixOperation,
73
80
  }
74
81
 
75
82
  template <typename MatrixType>
76
- MatrixType TransformOperationInterpolator<MatrixOperation, void>::interpolateMatrix(
83
+ MatrixType TransformOperationInterpolator<MatrixOperation>::interpolateMatrix(
77
84
  double progress,
78
85
  const TransformMatrix::Shared &from,
79
86
  const TransformMatrix::Shared &to) const {
@@ -89,7 +96,7 @@ MatrixType TransformOperationInterpolator<MatrixOperation, void>::interpolateMat
89
96
  return MatrixType::recompose(decomposedFrom->interpolate(progress, decomposedTo.value()));
90
97
  }
91
98
 
92
- TransformMatrix::Shared TransformOperationInterpolator<MatrixOperation, void>::matrixFromOperation(
99
+ TransformMatrix::Shared TransformOperationInterpolator<MatrixOperation>::matrixFromOperation(
93
100
  const std::shared_ptr<TransformOperation> &operation,
94
101
  const bool shouldBe3D,
95
102
  const StyleOperationsInterpolationContext &context) const {
@@ -132,84 +139,34 @@ TransformMatrix::Shared TransformOperationInterpolator<MatrixOperation, void>::m
132
139
  }
133
140
 
134
141
  // Explicit template instantiations
135
- template TransformMatrix2D TransformOperationInterpolator<MatrixOperation, void>::interpolateMatrix<TransformMatrix2D>(
142
+ template TransformMatrix2D TransformOperationInterpolator<MatrixOperation>::interpolateMatrix<TransformMatrix2D>(
136
143
  double,
137
144
  const TransformMatrix::Shared &,
138
145
  const TransformMatrix::Shared &) const;
139
- template TransformMatrix3D TransformOperationInterpolator<MatrixOperation, void>::interpolateMatrix<TransformMatrix3D>(
146
+ template TransformMatrix3D TransformOperationInterpolator<MatrixOperation>::interpolateMatrix<TransformMatrix3D>(
140
147
  double,
141
148
  const TransformMatrix::Shared &,
142
149
  const TransformMatrix::Shared &) const;
143
150
 
144
- // Specialization for resolvable operations
145
- template <typename TOperation>
146
- TransformOperationInterpolator<
147
- TOperation,
148
- std::enable_if_t<ResolvableOp<TOperation> && !std::is_same_v<TOperation, PerspectiveOperation> && !std::is_same_v<TOperation, MatrixOperation>>>::TransformOperationInterpolator(
149
- const std::shared_ptr<TOperation> &defaultOperation,
150
- ResolvableValueInterpolatorConfig config)
151
- : StyleOperationInterpolator(defaultOperation), config_(std::move(config)) {}
152
-
153
- template <typename TOperation>
154
- std::unique_ptr<StyleOperation> TransformOperationInterpolator<
155
- TOperation,
156
- std::enable_if_t<ResolvableOp<TOperation> && !std::is_same_v<TOperation, PerspectiveOperation> && !std::is_same_v<TOperation, MatrixOperation>>>::interpolate(
157
- double progress,
158
- const std::shared_ptr<StyleOperation> &from,
159
- const std::shared_ptr<StyleOperation> &to,
160
- const StyleOperationsInterpolationContext &context) const {
161
- const auto &fromOp = *std::static_pointer_cast<TOperation>(from);
162
- const auto &toOp = *std::static_pointer_cast<TOperation>(to);
163
-
164
- return std::make_unique<TOperation>(
165
- fromOp.value.interpolate(progress, toOp.value, getResolvableValueContext(context)));
166
- }
167
-
168
- template <typename TOperation>
169
- std::shared_ptr<StyleOperation> TransformOperationInterpolator<
170
- TOperation,
171
- std::enable_if_t<ResolvableOp<TOperation> && !std::is_same_v<TOperation, PerspectiveOperation> && !std::is_same_v<TOperation, MatrixOperation>>>::resolveOperation(
172
- const std::shared_ptr<StyleOperation> &operation,
173
- const StyleOperationsInterpolationContext &context) const {
174
- const auto &resolvableOp = std::static_pointer_cast<TOperation>(operation);
175
- const auto &resolved = resolvableOp->value.resolve(getResolvableValueContext(context));
176
-
177
- if (!resolved.has_value()) {
178
- throw std::invalid_argument(
179
- "[Reanimated] Cannot resolve resolvable operation: " + operation->getOperationName() +
180
- " for node with tag: " + std::to_string(context.node->getTag()));
181
- }
182
-
183
- return std::make_shared<TOperation>(resolved.value());
184
- }
185
-
186
- template <typename TOperation>
187
- ResolvableValueInterpolationContext TransformOperationInterpolator<
188
- TOperation,
189
- std::enable_if_t<ResolvableOp<TOperation> && !std::is_same_v<TOperation, PerspectiveOperation> && !std::is_same_v<TOperation, MatrixOperation>>>::getResolvableValueContext(
190
- const StyleOperationsInterpolationContext &context) const {
191
- return ResolvableValueInterpolationContext{
192
- .node = context.node,
193
- .fallbackInterpolateThreshold = context.fallbackInterpolateThreshold,
194
- .viewStylesRepository = context.viewStylesRepository,
195
- .relativeProperty = config_.relativeProperty,
196
- .relativeTo = config_.relativeTo};
197
- }
151
+ // OHOS patch: the members of the ResolvableOp-constrained partial
152
+ // specialization are defined inline in the header (clang 15 can't match their
153
+ // out-of-line definitions with the specialization declaration). Only the
154
+ // explicit instantiations remain here.
198
155
 
199
156
  // Rotate operations
200
- template class TransformOperationInterpolator<RotateOperation, void>;
201
- template class TransformOperationInterpolator<RotateXOperation, void>;
202
- template class TransformOperationInterpolator<RotateYOperation, void>;
203
- template class TransformOperationInterpolator<RotateZOperation, void>;
157
+ template class TransformOperationInterpolator<RotateOperation>;
158
+ template class TransformOperationInterpolator<RotateXOperation>;
159
+ template class TransformOperationInterpolator<RotateYOperation>;
160
+ template class TransformOperationInterpolator<RotateZOperation>;
204
161
 
205
162
  // Scale operations
206
- template class TransformOperationInterpolator<ScaleOperation, void>;
207
- template class TransformOperationInterpolator<ScaleXOperation, void>;
208
- template class TransformOperationInterpolator<ScaleYOperation, void>;
163
+ template class TransformOperationInterpolator<ScaleOperation>;
164
+ template class TransformOperationInterpolator<ScaleXOperation>;
165
+ template class TransformOperationInterpolator<ScaleYOperation>;
209
166
 
210
167
  // Skew operations
211
- template class TransformOperationInterpolator<SkewXOperation, void>;
212
- template class TransformOperationInterpolator<SkewYOperation, void>;
168
+ template class TransformOperationInterpolator<SkewXOperation>;
169
+ template class TransformOperationInterpolator<SkewYOperation>;
213
170
 
214
171
  // Translate operations (resolvable)
215
172
  template class TransformOperationInterpolator<TranslateXOperation>;
@@ -6,12 +6,13 @@
6
6
  #include <reanimated/CSS/interpolation/transforms/operations/perspective.h>
7
7
 
8
8
  #include <memory>
9
- #include <type_traits>
9
+ #include <stdexcept>
10
+ #include <string>
10
11
 
11
12
  namespace reanimated::css {
12
-
13
+
13
14
  // Base implementation for simple operations
14
- template <typename TOperation, typename = void>
15
+ template <typename TOperation>
15
16
  class TransformOperationInterpolator : public StyleOperationInterpolator {
16
17
  public:
17
18
  using StyleOperationInterpolator::StyleOperationInterpolator;
@@ -25,7 +26,7 @@ class TransformOperationInterpolator : public StyleOperationInterpolator {
25
26
 
26
27
  // Specialization for PerspectiveOperation
27
28
  template <>
28
- class TransformOperationInterpolator<PerspectiveOperation, void> : public StyleOperationInterpolator {
29
+ class TransformOperationInterpolator<PerspectiveOperation> : public StyleOperationInterpolator {
29
30
  public:
30
31
  explicit TransformOperationInterpolator(const std::shared_ptr<PerspectiveOperation> &defaultOperation);
31
32
 
@@ -38,7 +39,7 @@ class TransformOperationInterpolator<PerspectiveOperation, void> : public StyleO
38
39
 
39
40
  // Specialization for MatrixOperation
40
41
  template <>
41
- class TransformOperationInterpolator<MatrixOperation, void> : public StyleOperationInterpolator {
42
+ class TransformOperationInterpolator<MatrixOperation> : public StyleOperationInterpolator {
42
43
  public:
43
44
  explicit TransformOperationInterpolator(const std::shared_ptr<MatrixOperation> &defaultOperation);
44
45
 
@@ -60,30 +61,60 @@ class TransformOperationInterpolator<MatrixOperation, void> : public StyleOperat
60
61
  };
61
62
 
62
63
  // Specialization for resolvable operations
63
- template <typename TOperation>
64
- class TransformOperationInterpolator<
65
- TOperation,
66
- std::enable_if_t<ResolvableOp<TOperation> && !std::is_same_v<TOperation, PerspectiveOperation> && !std::is_same_v<TOperation, MatrixOperation>>> : public StyleOperationInterpolator {
64
+ // OHOS patch: clang 15 (the OHOS NDK toolchain) fails to match out-of-line
65
+ // member definitions of a concept-constrained partial specialization with the
66
+ // specialization's declaration — it resolves them against the primary template
67
+ // instead ("type constraint differs in template redeclaration" followed by
68
+ // "member initializer 'config_' does not name a non-static data member").
69
+ // Upstream defines these members out-of-line in the .cpp; here they are moved
70
+ // inline. Semantics are unchanged.
71
+ template <ResolvableOp TOperation>
72
+ class TransformOperationInterpolator<TOperation> : public StyleOperationInterpolator {
67
73
  public:
68
74
  TransformOperationInterpolator(
69
75
  const std::shared_ptr<TOperation> &defaultOperation,
70
- ResolvableValueInterpolatorConfig config);
76
+ ResolvableValueInterpolatorConfig config)
77
+ : StyleOperationInterpolator(defaultOperation), config_(std::move(config)) {}
71
78
 
72
79
  std::unique_ptr<StyleOperation> interpolate(
73
80
  double progress,
74
81
  const std::shared_ptr<StyleOperation> &from,
75
82
  const std::shared_ptr<StyleOperation> &to,
76
- const StyleOperationsInterpolationContext &context) const override;
83
+ const StyleOperationsInterpolationContext &context) const override {
84
+ const auto &fromOp = *std::static_pointer_cast<TOperation>(from);
85
+ const auto &toOp = *std::static_pointer_cast<TOperation>(to);
86
+
87
+ return std::make_unique<TOperation>(
88
+ fromOp.value.interpolate(progress, toOp.value, getResolvableValueContext(context)));
89
+ }
77
90
 
78
91
  std::shared_ptr<StyleOperation> resolveOperation(
79
92
  const std::shared_ptr<StyleOperation> &operation,
80
- const StyleOperationsInterpolationContext &context) const override;
93
+ const StyleOperationsInterpolationContext &context) const override {
94
+ const auto &resolvableOp = std::static_pointer_cast<TOperation>(operation);
95
+ const auto &resolved = resolvableOp->value.resolve(getResolvableValueContext(context));
96
+
97
+ if (!resolved.has_value()) {
98
+ throw std::invalid_argument(
99
+ "[Reanimated] Cannot resolve resolvable operation: " + operation->getOperationName() +
100
+ " for node with tag: " + std::to_string(context.node->getTag()));
101
+ }
102
+
103
+ return std::make_shared<TOperation>(resolved.value());
104
+ }
81
105
 
82
106
  protected:
83
107
  const ResolvableValueInterpolatorConfig config_;
84
108
 
85
109
  ResolvableValueInterpolationContext getResolvableValueContext(
86
- const StyleOperationsInterpolationContext &context) const;
110
+ const StyleOperationsInterpolationContext &context) const {
111
+ return ResolvableValueInterpolationContext{
112
+ .node = context.node,
113
+ .fallbackInterpolateThreshold = context.fallbackInterpolateThreshold,
114
+ .viewStylesRepository = context.viewStylesRepository,
115
+ .relativeProperty = config_.relativeProperty,
116
+ .relativeTo = config_.relativeTo};
117
+ }
87
118
  };
88
119
 
89
120
  } // namespace reanimated::css
@@ -60,26 +60,28 @@ std::pair<TransformOperations, bool> flattenOperations(const TransformOperations
60
60
  * operations can be converted to a matrix.
61
61
  */
62
62
  std::pair<MatrixOperationValue, bool> simplifyOperations(const TransformOperations &operations) {
63
- const auto [flattenedOperations, is3D] = flattenOperations(operations);
63
+ // OHOS patch: clang 15 doesn't allow capturing a structured binding in a
64
+ // lambda (P1091 fully landed in clang 16), and the `simplify` lambda below
65
+ // reads `is3D`. Read the pair through plain local references instead; they
66
+ // alias the same objects so semantics/perf are unchanged.
67
+ const auto flattenResult = flattenOperations(operations);
68
+ const auto &flattenedOperations = flattenResult.first;
69
+ const auto &is3D = flattenResult.second;
64
70
 
65
71
  TransformOperations result;
66
72
  TransformOperations toSimplify;
67
73
  result.reserve(operations.size());
68
74
  toSimplify.reserve(operations.size());
69
75
 
70
- // const auto simplify = [&]() {
71
- // return is3D ? std::make_shared<MatrixOperation>(matrixFromOperations3D(toSimplify))
72
- // : std::make_shared<MatrixOperation>(matrixFromOperations2D(toSimplify));
73
- // };
74
- //TODO
75
- const auto simplify = [](TransformOperations &toSimplify,bool is3DValue) {
76
- return is3DValue ? std::make_shared<MatrixOperation>(matrixFromOperations3D(toSimplify))
76
+ const auto simplify = [&]() {
77
+ return is3D ? std::make_shared<MatrixOperation>(matrixFromOperations3D(toSimplify))
77
78
  : std::make_shared<MatrixOperation>(matrixFromOperations2D(toSimplify));
78
79
  };
80
+
79
81
  for (const auto &operation : flattenedOperations) {
80
82
  if (operation->shouldResolve()) {
81
83
  if (toSimplify.size() > 0) {
82
- result.emplace_back(simplify(toSimplify,is3D));
84
+ result.emplace_back(simplify());
83
85
  toSimplify.clear();
84
86
  }
85
87
 
@@ -94,10 +96,10 @@ std::pair<MatrixOperationValue, bool> simplifyOperations(const TransformOperatio
94
96
  // Result is empty only if there was not a single operation that needed to be
95
97
  // resolved (all operations were added to the toSimplify vector)
96
98
  if (result.empty()) {
97
- return {simplify(toSimplify,is3D)->toMatrix(is3D), is3D};
99
+ return {simplify()->toMatrix(is3D), is3D};
98
100
  }
99
101
 
100
- result.emplace_back(simplify(toSimplify,is3D));
102
+ result.emplace_back(simplify());
101
103
 
102
104
  return {std::move(result), is3D};
103
105
  }
@@ -7,6 +7,8 @@
7
7
  #include <reanimated/CSS/common/values/CSSKeyword.h>
8
8
  #include <reanimated/CSS/common/values/CSSLength.h>
9
9
  #include <reanimated/CSS/common/values/CSSNumber.h>
10
+ #include <reanimated/CSS/svg/values/CSSLengthArray.h>
11
+ #include <reanimated/CSS/svg/values/SVGStrokeDashArray.h>
10
12
 
11
13
  #include <memory>
12
14
 
@@ -43,5 +45,7 @@ folly::dynamic ResolvableValueInterpolator<AllowedTypes...>::interpolateValue(
43
45
 
44
46
  template class ResolvableValueInterpolator<CSSLength>;
45
47
  template class ResolvableValueInterpolator<CSSLength, CSSKeyword>;
48
+ template class ResolvableValueInterpolator<CSSLengthArray>;
49
+ template class ResolvableValueInterpolator<SVGStrokeDashArray, CSSKeyword>;
46
50
 
47
51
  } // namespace reanimated::css
@@ -11,8 +11,10 @@
11
11
  #include <reanimated/CSS/common/values/CSSLength.h>
12
12
  #include <reanimated/CSS/common/values/CSSNumber.h>
13
13
  #include <reanimated/CSS/common/values/complex/CSSBoxShadow.h>
14
+ #include <reanimated/CSS/svg/values/CSSLengthArray.h>
14
15
  #include <reanimated/CSS/svg/values/SVGBrush.h>
15
- #include <reanimated/CSS/svg/values/SVGLength.h>
16
+ #include <reanimated/CSS/svg/values/SVGPath.h>
17
+ #include <reanimated/CSS/svg/values/SVGStops.h>
16
18
  #include <reanimated/CSS/svg/values/SVGStrokeDashArray.h>
17
19
 
18
20
  #include <memory>
@@ -54,6 +56,7 @@ template class SimpleValueInterpolator<CSSLength, CSSKeyword>;
54
56
  template class SimpleValueInterpolator<CSSDouble>;
55
57
  template class SimpleValueInterpolator<CSSDouble, CSSKeyword>;
56
58
  template class SimpleValueInterpolator<CSSInteger>;
59
+ template class SimpleValueInterpolator<CSSIndex>;
57
60
  template class SimpleValueInterpolator<CSSAngle>;
58
61
  template class SimpleValueInterpolator<CSSColor>;
59
62
  template class SimpleValueInterpolator<CSSBoolean>;
@@ -62,8 +65,9 @@ template class SimpleValueInterpolator<CSSKeyword>;
62
65
  template class SimpleValueInterpolator<CSSBoxShadow>;
63
66
  template class SimpleValueInterpolator<CSSDiscreteArray<CSSKeyword>>;
64
67
 
65
- template class SimpleValueInterpolator<SVGLength>;
66
- template class SimpleValueInterpolator<SVGLength, CSSKeyword>;
68
+ template class SimpleValueInterpolator<SVGPath>;
69
+ template class SimpleValueInterpolator<CSSLengthArray>;
70
+ template class SimpleValueInterpolator<SVGStops>;
67
71
  template class SimpleValueInterpolator<SVGStrokeDashArray, CSSKeyword>;
68
72
  template class SimpleValueInterpolator<SVGBrush>;
69
73
 
@@ -35,13 +35,6 @@ folly::dynamic ValueInterpolator::getLastKeyframeValue() const {
35
35
  return convertOptionalToDynamic(keyframes_.back().value);
36
36
  }
37
37
 
38
- bool ValueInterpolator::equalsReversingAdjustedStartValue(const folly::dynamic &propertyValue) const {
39
- if (reversingAdjustedStartValue_.isNull()) {
40
- return propertyValue.isNull();
41
- }
42
- return reversingAdjustedStartValue_ == propertyValue;
43
- }
44
-
45
38
  void ValueInterpolator::updateKeyframes(jsi::Runtime &rt, const jsi::Value &keyframes) {
46
39
  const auto parsedKeyframes = parseJSIKeyframes(rt, keyframes);
47
40
 
@@ -57,28 +50,28 @@ void ValueInterpolator::updateKeyframes(jsi::Runtime &rt, const jsi::Value &keyf
57
50
  }
58
51
  }
59
52
 
60
- void ValueInterpolator::updateKeyframesFromStyleChange(
61
- const folly::dynamic &oldStyleValue,
62
- const folly::dynamic &newStyleValue,
63
- const folly::dynamic &lastUpdateValue) {
64
- ValueKeyframe firstKeyframe, lastKeyframe;
65
-
66
- if (!lastUpdateValue.isNull()) {
67
- firstKeyframe = ValueKeyframe{0, createValue(lastUpdateValue)};
68
- } else if (!oldStyleValue.isNull()) {
69
- firstKeyframe = ValueKeyframe{0, createValue(oldStyleValue)};
70
- } else {
71
- firstKeyframe = ValueKeyframe{0, defaultStyleValue_};
72
- }
53
+ bool ValueInterpolator::updateKeyframes(jsi::Runtime &rt, const jsi::Value &fromValue, const jsi::Value &toValue) {
54
+ auto from = fromValue.isUndefined() ? defaultStyleValue_ : createValue(rt, fromValue);
55
+ auto to = toValue.isUndefined() ? defaultStyleValue_ : createValue(rt, toValue);
73
56
 
74
- if (newStyleValue.isNull()) {
75
- lastKeyframe = ValueKeyframe{1, defaultStyleValue_};
76
- } else {
77
- lastKeyframe = ValueKeyframe{1, createValue(newStyleValue)};
78
- }
57
+ const auto equalsReversingAdjustedStartValue = reversingAdjustedStartValue_ && (*to == *reversingAdjustedStartValue_);
58
+ reversingAdjustedStartValue_ = keyframes_.empty() ? from : keyframes_[1].value.value();
59
+
60
+ keyframes_ = {ValueKeyframe{0, std::move(from)}, ValueKeyframe{1, std::move(to)}};
61
+
62
+ return equalsReversingAdjustedStartValue;
63
+ }
64
+
65
+ bool ValueInterpolator::updateKeyframes(const folly::dynamic &fromValue, const folly::dynamic &toValue) {
66
+ auto from = fromValue.isNull() ? defaultStyleValue_ : createValue(fromValue);
67
+ auto to = toValue.isNull() ? defaultStyleValue_ : createValue(toValue);
68
+
69
+ const auto equalsReversingAdjustedStartValue = reversingAdjustedStartValue_ && (*to == *reversingAdjustedStartValue_);
70
+ reversingAdjustedStartValue_ = keyframes_.empty() ? from : keyframes_[1].value.value();
71
+
72
+ keyframes_ = {ValueKeyframe{0, std::move(from)}, ValueKeyframe{1, std::move(to)}};
79
73
 
80
- keyframes_ = {std::move(firstKeyframe), std::move(lastKeyframe)};
81
- reversingAdjustedStartValue_ = oldStyleValue;
74
+ return equalsReversingAdjustedStartValue;
82
75
  }
83
76
 
84
77
  folly::dynamic ValueInterpolator::interpolate(
@@ -10,11 +10,15 @@
10
10
  namespace reanimated::css {
11
11
 
12
12
  struct ValueKeyframe {
13
+ // OHOS patch: explicit constructor for the same reason as
14
+ // SVGStops::GradientStop — clang 15's is_constructible trait misses
15
+ // parenthesized aggregate init (P0960), which breaks
16
+ // keyframes_.emplace_back(offset, ...) in ValueInterpolator.cpp.
17
+ ValueKeyframe(double offset_, std::optional<std::shared_ptr<CSSValue>> value_)
18
+ : offset(offset_), value(std::move(value_)) {}
19
+
13
20
  double offset;
14
21
  std::optional<std::shared_ptr<CSSValue>> value;
15
- ValueKeyframe() : offset(0.0), value(std::nullopt) {}
16
- ValueKeyframe(double offset, std::optional<std::shared_ptr<CSSValue>> value = std::nullopt)
17
- : offset(offset), value(std::move(value)) {}
18
22
  };
19
23
 
20
24
  /**
@@ -35,13 +39,11 @@ class ValueInterpolator : public PropertyInterpolator {
35
39
  folly::dynamic getResetStyle(const std::shared_ptr<const ShadowNode> &shadowNode) const override;
36
40
  folly::dynamic getFirstKeyframeValue() const override;
37
41
  folly::dynamic getLastKeyframeValue() const override;
38
- bool equalsReversingAdjustedStartValue(const folly::dynamic &propertyValue) const override;
39
42
 
40
43
  void updateKeyframes(jsi::Runtime &rt, const jsi::Value &keyframes) override;
41
- void updateKeyframesFromStyleChange(
42
- const folly::dynamic &oldStyleValue,
43
- const folly::dynamic &newStyleValue,
44
- const folly::dynamic &lastUpdateValue) override;
44
+ bool updateKeyframes(jsi::Runtime &rt, const jsi::Value &fromValue, const jsi::Value &toValue) override;
45
+ /** TODO: unify folly::dynamic and jsi::value versions */
46
+ bool updateKeyframes(const folly::dynamic &fromValue, const folly::dynamic &toValue) override;
45
47
 
46
48
  folly::dynamic interpolate(
47
49
  const std::shared_ptr<const ShadowNode> &shadowNode,
@@ -52,7 +54,6 @@ class ValueInterpolator : public PropertyInterpolator {
52
54
  std::vector<ValueKeyframe> keyframes_;
53
55
  std::shared_ptr<CSSValue> defaultStyleValue_;
54
56
  folly::dynamic defaultStyleValueDynamic_;
55
- folly::dynamic reversingAdjustedStartValue_;
56
57
 
57
58
  virtual std::shared_ptr<CSSValue> createValue(jsi::Runtime &rt, const jsi::Value &value) const = 0;
58
59
  virtual std::shared_ptr<CSSValue> createValue(const folly::dynamic &value) const = 0;
@@ -63,6 +64,8 @@ class ValueInterpolator : public PropertyInterpolator {
63
64
  const ValueInterpolationContext &context) const = 0;
64
65
 
65
66
  private:
67
+ std::shared_ptr<CSSValue> reversingAdjustedStartValue_;
68
+
66
69
  folly::dynamic convertOptionalToDynamic(const std::optional<std::shared_ptr<CSSValue>> &value) const;
67
70
  std::shared_ptr<CSSValue> getFallbackValue(const std::shared_ptr<const ShadowNode> &shadowNode) const;
68
71
  size_t getToKeyframeIndex(const std::shared_ptr<KeyframeProgressProvider> &progressProvider) const;