@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
package/README.md ADDED
@@ -0,0 +1,842 @@
1
+ > 文档模板:v0.4.2
2
+
3
+ <p align="center">
4
+ <h1 align="center"> <code>react-native-reanimated</code> </h1>
5
+ </p>
6
+ <p align="center">
7
+ <a href="https://github.com/software-mansion/react-native-reanimated">
8
+ <img src="https://img.shields.io/badge/platforms-ios%20|%20android%20|%20web%20|%20harmony%20-lightgrey.svg" alt="Supported platforms" />
9
+ </a>
10
+ <a href="https://github.com/software-mansion/react-native-reanimated/blob/main/LICENSE">
11
+ <img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License" />
12
+ </a>
13
+ </p>
14
+
15
+ 本项目基于 [原库 react-native-reanimated](https://github.com/software-mansion/react-native-reanimated) 开发。
16
+
17
+ 该第三方库的仓库已迁移至 Gitcode,且支持直接从 npm 下载,新的包名为:`@react-native-ohos/react-native-reanimated`,版本所属关系如下:
18
+
19
+ | 三方库名称 | 三方库版本(npm地址) | 发布信息 | 支持RN版本 | Autolink | 编译API版本 | 社区基线版本 | 源码地址 |
20
+ | ------------------------------------------- | ----------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | ---------- | -------- | ----------- | ------------ | ---------------------------------------------------------------------------------------------- |
21
+ | @react-native-ohos/react-native-reanimated | [~ 4.1.0(进行中)](https://www.npmjs.com/package/@react-native-ohos/react-native-reanimated) | [Gitcode Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-reanimated/releases) | 0.84.* | 是 | API12+ | 4.5.3 | [master](https://gitcode.com/openharmony-sig/rntpc_react-native-reanimated) |
22
+ | @react-native-ohos/react-native-reanimated | [~ 4.0.0](https://www.npmjs.com/package/@react-native-ohos/react-native-reanimated) | [Gitcode Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-reanimated/releases) | 0.82.* | 否 | API12+ | 4.2.1 | [br_rnoh0.82](https://gitcode.com/openharmony-sig/rntpc_react-native-reanimated/tree/br_rnoh0.82) |
23
+ | @react-native-ohos/react-native-reanimated | [~ 3.18.1](https://www.npmjs.com/package/@react-native-ohos/react-native-reanimated) | [Gitcode Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-reanimated/releases) | 0.77.* | 否 | API12+ | 3.18.0 | [br_rnoh0.77](https://gitcode.com/openharmony-sig/rntpc_react-native-reanimated/tree/br_rnoh0.77) |
24
+ | @react-native-ohos/react-native-reanimated | [~ 3.6.5](https://www.npmjs.com/package/@react-native-ohos/react-native-reanimated) | [Gitcode Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-reanimated/releases) | 0.72.* | 是 | API12+ | 3.6.0 | [br_rnoh0.72](https://gitcode.com/openharmony-sig/rntpc_react-native-reanimated/tree/br_rnoh0.72) |
25
+ | @react-native-oh-tpl/react-native-reanimated | [<= 3.6.4@deprecated](https://www.npmjs.com/package/@react-native-oh-tpl/react-native-reanimated) | [Github Releases(deprecated)](https://github.com/react-native-oh-library/react-native-harmony-reanimated/releases) | 0.72.* | 否 | API12+ | 3.6.0 | [sig](https://github.com/react-native-oh-library/react-native-harmony-reanimated) |
26
+
27
+ ## 简介
28
+
29
+ react-native-reanimated 是 React Native 生态中使用最广泛的高性能动画库,是 RN 内置 `Animated` 库的增强替代方案。它通过 worklet 机制将动画计算放到 UI 线程执行,提供了动画(`withTiming` / `withSpring` / `withDecay` 等)、布局动画(进入 / 退出 / 布局过渡 / 共享元素转场)、CSS 动画与过渡、手势与传感器联动、键盘动画等全面的能力。
30
+
31
+ > `react-native-reanimated >= 4.0.0` 起,worklets 能力已独立成库,需同时引入 [@react-native-ohos/react-native-worklets](../react-native-worklets/README.md)。
32
+
33
+ ## 下载安装
34
+
35
+ 进入到工程目录并输入以下命令:
36
+
37
+ **npm**
38
+
39
+ ```bash
40
+ # RN 0.84
41
+ npm install react-native-reanimated@4.5.3
42
+ npm install @react-native-ohos/react-native-reanimated
43
+ ```
44
+
45
+ **yarn**
46
+
47
+ ```bash
48
+ # RN 0.84
49
+ yarn add react-native-reanimated@4.5.3
50
+ yarn add @react-native-ohos/react-native-reanimated
51
+ ```
52
+
53
+ #### 插件配置
54
+
55
+ 添加插件到 `babel.config.js`:
56
+
57
+ > [!TIP] 为什么需要添加这个?Reanimated Babel 插件会自动转换特殊的 JavaScript 函数(称为 worklet),以便它们可以被传递并在 UI 线程上运行。
58
+
59
+ ```js
60
+ module.exports = {
61
+ presets: [
62
+ ... // don't add it here :)
63
+ ],
64
+ plugins: [
65
+ ...
66
+ 'react-native-worklets/plugin',
67
+ ],
68
+ };
69
+ ```
70
+
71
+ 清除 Metro 的缓存(推荐):
72
+
73
+ **npm**
74
+
75
+ ```bash
76
+ npm start --reset-cache
77
+ ```
78
+
79
+ **yarn**
80
+
81
+ ```bash
82
+ yarn start --reset-cache
83
+ ```
84
+
85
+ ## Link
86
+
87
+ | | 是否支持autolink | RN框架版本 |
88
+ | ------------------- | ---------------- | ---------- |
89
+ | ~ 4.1.0 | 是 | 0.84 |
90
+
91
+ 使用AutoLink的工程需要根据该文档配置,Autolink框架指导文档:https://gitcode.com/CPF-RN/ohos_react_native/blob/master/docs/zh-cn/Autolinking.md
92
+
93
+ 如您使用的版本支持 Autolink,并且工程已接入 Autolink,需要配置[Overrides RN SDK](#1-overrides-rn-sdk)后,可跳过ManualLink配置。
94
+
95
+ > [!TIP] version >= 4.0.0。
96
+ > 该版本 HarmonyOS 侧实现依赖 `@react-native-ohos/react-native-worklets` 的原生端代码,如已在 HarmonyOS 工程中引入过该库,则无需再次引入,可跳过本章节步骤,直接使用。
97
+ > 如未引入请参照 [@react-native-ohos/react-native-worklets文档的 Link 章节](../react-native-worklets//README.md)进行引入。
98
+
99
+ <details>
100
+ <summary>ManualLink: 此步骤为手动配置原生依赖项的指导</summary>
101
+
102
+ 首先需要使用 DevEco Studio 打开项目里的 HarmonyOS 工程 `harmony`。
103
+
104
+ ### 1. Overrides RN SDK
105
+
106
+ 为了让工程依赖同一个版本的 RN SDK,需要在工程根目录的 `oh-package.json5` 添加 overrides 字段,指向工程需要使用的 RN SDK 版本。替换的版本既可以是一个具体的版本号,也可以是一个模糊版本,还可以是本地存在的 HAR 包或源码目录。
107
+
108
+ 关于该字段的作用请阅读[官方说明](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/ide-oh-package-json5-V5#zh-cn_topic_0000001792256137_overrides)
109
+
110
+ ```json
111
+ {
112
+ ...
113
+ "overrides": {
114
+ "@rnoh/react-native-openharmony" : "~0.84.2",
115
+ // version >= 4.0.0
116
+ "@react-native-ohos/react-native-worklets": "file:../node_modules/@react-native-ohos/react-native-worklets/harmony/worklets.har"
117
+ }
118
+ }
119
+ ```
120
+
121
+ ### 2. 引入原生端代码
122
+
123
+ 目前有两种方法:
124
+
125
+ - 通过 har 包引入;
126
+ - 直接链接源码。
127
+
128
+ 方法一:通过 har 包引入(推荐)
129
+
130
+ > [!TIP] har 包位于三方库安装路径的 `harmony` 文件夹下。
131
+
132
+ 打开 `entry/oh-package.json5`,添加以下依赖
133
+
134
+ ```json
135
+ "dependencies": {
136
+ "@rnoh/react-native-openharmony": "~0.84.2",
137
+
138
+ "@react-native-ohos/react-native-reanimated": "file:../../node_modules/@react-native-ohos/react-native-reanimated/harmony/reanimated.har",
139
+ }
140
+ ```
141
+
142
+ 点击右上角的 `sync` 按钮
143
+
144
+ 或者在命令行终端执行:
145
+
146
+ ```bash
147
+ cd entry
148
+ ohpm install
149
+ ```
150
+
151
+ 方法二:直接链接源码
152
+
153
+ > [!TIP] 如需使用直接链接源码,请参考[直接链接源码说明](https://gitcode.com/CPF-RN/usage-docs/blob/master/zh-cn/link-source-code.md)
154
+
155
+ ### 3. 配置 CMakeLists 和引入 ReanimatedPackage
156
+
157
+ 打开 `entry/src/main/cpp/CMakeLists.txt`,添加:
158
+
159
+ ```diff
160
+ project(rnapp)
161
+ cmake_minimum_required(VERSION 3.4.1)
162
+ set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
163
+ + set(NODE_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../node_modules")
164
+ set(OH_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
165
+ + set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp")
166
+
167
+ # (可选) 若开启对应SVG的Feature flags,需配置如下:
168
+ + add_compile_definitions(REANIMATED_FEATURE_FLAGS="[RUNTIME_TEST_FLAG:false][DISABLE_COMMIT_PAUSING_MECHANISM:false][ANDROID_SYNCHRONOUSLY_UPDATE_UI_PROPS:false][IOS_SYNCHRONOUSLY_UPDATE_UI_PROPS:false][EXPERIMENTAL_CSS_ANIMATIONS_FOR_SVG_COMPONENTS:true][IOS_CSS_CORE_ANIMATION:false][USE_SYNCHRONIZABLE_FOR_MUTABLES:true][USE_COMMIT_HOOK_ONLY_FOR_REACT_COMMITS:true][ENABLE_SHARED_ELEMENT_TRANSITIONS:false][FORCE_REACT_RENDER_FOR_SETTLED_ANIMATIONS:true][USE_ANIMATION_BACKEND:false]")
169
+
170
+ add_subdirectory("${RNOH_CPP_DIR}" ./rn)
171
+
172
+ # RNOH_END: manual_package_linking_1
173
+ add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
174
+
175
+ + add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-reanimated/src/main/cpp" ./reanimated)
176
+
177
+ # RNOH_END: manual_package_linking_1
178
+
179
+ add_library(rnoh_app SHARED
180
+ "./PackageProvider.cpp"
181
+ "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
182
+ )
183
+
184
+ target_link_libraries(rnoh_app PUBLIC rnoh)
185
+
186
+ # RNOH_BEGIN: manual_package_linking_2
187
+ target_link_libraries(rnoh_app PUBLIC rnoh_sample_package)
188
+ + target_link_libraries(rnoh_app PUBLIC rnoh_reanimated)
189
+
190
+ # RNOH_BEGIN: manual_package_linking_2
191
+ ```
192
+ > [!Tip] 注意:上面RNOH_CPP_DIR定义,为RNOH框架的安装路径,用户可以根据安装的实际路径定义RNOH_CPP_DIR
193
+
194
+ 打开 `entry/src/main/cpp/PackageProvider.cpp`,添加:
195
+
196
+ ```diff
197
+ #include "RNOH/PackageProvider.h"
198
+ #include "SamplePackage.h"
199
+ + #include "ReanimatedPackage.h"
200
+ using namespace rnoh;
201
+
202
+ std::vector<std::shared_ptr<Package>> PackageProvider::getPackages(Package::Context ctx) {
203
+ return {
204
+ std::make_shared<SamplePackage>(ctx),
205
+ + std::make_shared<ReanimatedPackage>(ctx)
206
+ };
207
+ }
208
+ ```
209
+
210
+ ### 4. 在 ArkTs 侧引入 ReanimatedPackage
211
+
212
+ 打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加:
213
+
214
+ ```diff
215
+ ...
216
+ + import { ReanimatedPackage} from '@react-native-ohos/react-native-reanimated/ts';
217
+
218
+ export function createRNPackages(ctx: RNPackageContext): RNPackage[] {
219
+ return [
220
+ new SamplePackage(ctx),
221
+ + new ReanimatedPackage(ctx),
222
+ ];
223
+ }
224
+ ```
225
+
226
+ </details>
227
+
228
+ ### 运行
229
+
230
+ 点击右上角的 `sync` 按钮
231
+
232
+ 或者在命令行终端执行:
233
+
234
+ ```bash
235
+ cd entry
236
+ ohpm install
237
+ ```
238
+
239
+ 然后编译、运行即可。
240
+
241
+ ## 约束与限制
242
+
243
+ ### 兼容性
244
+
245
+ 本文档内容基于以下版本验证通过:
246
+
247
+ 1. RNOH: 0.84.2; SDK: HarmonyOS 6.0.1 Release SDK; IDE: DevEco Studio 6.0.1.260; ROM: 6.0.0.130 SP15;
248
+
249
+ ### 权限要求
250
+
251
+ > [!Tip] 使用传感器(`useAnimatedSensor`)的功能,需要使用 >= 4.0.0 的版本。在 `entry` 目录下的 `module.json5` 中添加权限
252
+
253
+ ```json
254
+ "requestPermissions": [
255
+ {
256
+ "name": "ohos.permission.ACCELEROMETER", // 加速度传感器权限名称
257
+ "reason": "$string:accele_reason",
258
+ "usedScene": {
259
+ "abilities": [
260
+ "EntryAbility"
261
+ ],
262
+ "when":"inuse"
263
+ }
264
+ },
265
+ {
266
+ "name": "ohos.permission.GYROSCOPE", // 陀螺仪传感器权限名称
267
+ "reason": "$string:gyr_reason",
268
+ "usedScene": {
269
+ "abilities": [
270
+ "EntryAbility"
271
+ ],
272
+ "when":"inuse"
273
+ }
274
+ },
275
+ ]
276
+ ```
277
+
278
+ 在 entry 目录下添加申请以上权限的原因,打开 `entry/src/main/resources/base/element/string.json`,添加:
279
+
280
+ ```json
281
+ {
282
+ "string": [
283
+ {
284
+ "name": "accele_reason",
285
+ "value": "使用加速度传感器"
286
+ },
287
+ {
288
+ "name": "gyr_reason",
289
+ "value": "使用陀螺仪传感器"
290
+ },
291
+ ]
292
+ }
293
+ ```
294
+
295
+ ## 使用示例
296
+
297
+ 下面的代码展示了这个库的基本使用场景:
298
+
299
+ > [!WARNING] 使用时 import 的库名不变。
300
+
301
+ ```js
302
+ import { Button, View } from "react-native";
303
+ import Animated, { useSharedValue, withSpring } from "react-native-reanimated";
304
+
305
+ export default function App() {
306
+ const width = useSharedValue(100);
307
+
308
+ const handlePress = () => {
309
+ width.value = withSpring(width.value + 50);
310
+ };
311
+
312
+ return (
313
+ <View style={{ flex: 1, alignItems: "center" }}>
314
+ <Animated.View
315
+ style={{
316
+ width,
317
+ height: 100,
318
+ backgroundColor: "violet",
319
+ }}
320
+ />
321
+ <Button onPress={handlePress} title="Click me" />
322
+ </View>
323
+ );
324
+ }
325
+ ```
326
+
327
+ ## 接口说明
328
+
329
+ > [!TIP] "Platform"列表示该属性在原三方库上支持的平台。
330
+
331
+ > [!TIP] "HarmonyOS Support"列为 yes 表示 HarmonyOS 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。
332
+
333
+ > 自 4.0.0 起,`runOnJS`、`runOnUI`、`runOnRuntime`、`executeOnUIRuntimeSync`、`createWorkletRuntime`、`isWorkletFunction`、`makeShareableCloneRecursive` 等线程调度 API 已迁移至 `react-native-worklets`,reanimated 中的同名导出仅为已废弃的兼容转发,其属性与用法请查阅 [react-native-worklets 文档](../react-native-worklets/README.md),不再在本表列出。
334
+ >
335
+ >
336
+
337
+ ### 属性
338
+
339
+ #### Animated 组件(默认导出 `Animated`)
340
+
341
+ | 名称 | 参数类型 | 默认值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
342
+ | --------------------------- | --------------------- | ------ | ---- | ---- | ----------------- | ------------------------------------------------- |
343
+ | `Animated.View` | ViewProps + 动画样式 | none | No | All | Yes | 动画版 View 组件 |
344
+ | `Animated.Text` | TextProps + 动画样式 | none | No | All | Yes | 动画版 Text 组件 |
345
+ | `Animated.Image` | ImageProps + 动画样式 | none | No | All | Yes | 动画版 Image 组件 |
346
+ | `Animated.ScrollView` | AnimatedScrollViewProps + 动画样式 | none | No | All | Yes | 动画版 ScrollView 组件,支持 `useScrollOffset`、`scrollTo` |
347
+ | `Animated.FlatList` | FlatListPropsWithLayout + 动画样式 | none | No | All | Yes | 动画版 FlatList 组件,支持 `itemLayoutAnimation` 列表项布局动画 |
348
+ | `Animated.createAnimatedComponent` | (component: ComponentType) => AnimatedComponent | none | No | All | Yes | 将任意 RN 组件封装为动画组件 |
349
+ | `Animated.addWhitelistedNativeProps` | (props: Record<string, string>) => void | none | No | All | Yes | 扩展动画组件可直接更新的原生属性白名单 |
350
+ | `Animated.addWhitelistedUIProps` | (props: Record<string, string>) => void | none | No | All | Yes | 扩展动画组件可直接更新的 UI 属性白名单 |
351
+
352
+ #### LayoutAnimationConfig 组件属性
353
+
354
+ 用于批量跳过子树的进入 / 退出动画:
355
+
356
+ | 名称 | 参数类型 | 默认值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
357
+ | --------------- | ----------- | ------ | ---- | ---- | ----------------- | --------------------------------------------- |
358
+ | `skipEntering` | boolean | false | No | All | Yes | 挂载时是否跳过子组件的进入动画 |
359
+ | `skipExiting` | boolean | false | No | All | Yes | 卸载时是否跳过子组件的退出动画 |
360
+ | `children` | ReactNode | none | Yes | All | Yes | 子组件 |
361
+
362
+ #### PerformanceMonitor 组件属性
363
+
364
+ | 名称 | 参数类型 | 默认值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
365
+ | ---------------- | -------- | ------ | ---- | ---- | ----------------- | ------------------------------------------ |
366
+ | `smoothingFrames` | number | none | No | All | Yes | 用于 FPS 平滑统计的历史帧数,影响数值抖动程度 |
367
+
368
+ #### ReducedMotionConfig 组件属性
369
+
370
+ | 名称 | 参数类型 | 默认值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
371
+ | -------- | ------------- | ------ | ---- | ---- | ----------------- | ------------------------------------------ |
372
+ | `mode` | ReduceMotion | none | Yes | All | Yes | 覆盖子树的减弱动态效果(无障碍)设置 |
373
+ | `children` | ReactNode | none | No | All | Yes | 子组件 |
374
+
375
+ #### SharedTransitionBoundary 组件属性
376
+
377
+ | 名称 | 参数类型 | 默认值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
378
+ | ---------- | ----------- | ------ | ---- | ---- | ----------------- | ------------------------------------------ |
379
+ | `isActive` | boolean | none | Yes | All | Yes | 边界是否激活(用于嵌套共享元素转场的边界判定)|
380
+ | `children` | ReactNode | none | No | All | Yes | 子组件 |
381
+
382
+ #### WithTimingConfig(withTiming 配置)
383
+
384
+ | 名称 | 参数类型 | 默认值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
385
+ | -------------- | ---------------------------------------- | ------------------- | ---- | ---- | ----------------- | --------------------------------------------- |
386
+ | `duration` | number | 300 | No | All | Yes | 动画时长(毫秒) |
387
+ | `easing` | EasingFunction \| EasingFunctionFactory | Easing.inOut(Easing.quad) | No | All | Yes | 缓动曲线,需使用本库导出的 `Easing` |
388
+ | `reduceMotion` | ReduceMotion | ReduceMotion.System | No | All | Yes | 减弱动态效果(无障碍)策略 |
389
+
390
+ #### WithSpringConfig(withSpring 配置)
391
+
392
+ > 两组参数互斥:`stiffness + damping`(物理参数)或 `duration + dampingRatio`(时长参数)二选一。
393
+
394
+ | 名称 | 参数类型 | 默认值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
395
+ | --------------------- | ------------------------- | -------------------- | ---- | -------------- | ----------------- | ---------------------------------------------------------- |
396
+ | `mass` | number | 4 | No | Android and iOS | Yes | 弹簧质量,越小动画越快 |
397
+ | `stiffness` | number | 900 | No | Android and iOS | Yes | 弹簧刚度(与 damping 一组使用) |
398
+ | `damping` | number | 120 | No | Android and iOS | Yes | 阻尼,越大越快静止(与 stiffness 一组使用) |
399
+ | `duration` | number | 550 | No | Android and iOS | Yes | 感知时长(毫秒),实际时长约为其 1.5 倍(与 dampingRatio 一组使用) |
400
+ | `dampingRatio` | number | 1 | No | Android and iOS | Yes | 阻尼比:1 临界阻尼、<1 欠阻尼(回弹)、>1 过阻尼(与 duration 一组使用) |
401
+ | `clamp` | { min?: number, max?: number } | none | No | Android and iOS | Yes | 位移限幅(仅与 duration + dampingRatio 组合时可用),超限时自动增大阻尼抑制回弹 |
402
+ | `velocity` | number | 0 | No | Android and iOS | Yes | 初始速度 |
403
+ | `overshootClamping` | boolean | false | No | Android and iOS | Yes | 是否禁止越过 toValue 回弹 |
404
+ | `energyThreshold` | number | 6e-9 | No | Android and iOS | Yes | 相对能量阈值,低于该阈值直接吸附到目标值 |
405
+ | `reduceMotion` | ReduceMotion | ReduceMotion.System | No | Android and iOS | Yes | 减弱动态效果(无障碍)策略 |
406
+
407
+ #### WithDecayConfig(withDecay 配置)
408
+
409
+ | 名称 | 参数类型 | 默认值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
410
+ | ------------------ | --------------------- | -------------------- | ---- | -------------- | ----------------- | ------------------------------------------------- |
411
+ | `velocity` | number | 0 | No | Android and iOS | Yes | 初始速度 |
412
+ | `deceleration` | number | 0.998 | No | Android and iOS | Yes | 减速率,速度随时间的衰减系数 |
413
+ | `clamp` | [min: number, max: number] | [] | No | Android and iOS | Yes | 动画范围限幅;启用 rubberBandEffect 时必填 |
414
+ | `velocityFactor` | number | 1 | No | Android and iOS | Yes | 速度倍率,需大于 0 |
415
+ | `rubberBandEffect` | boolean | false | No | Android and iOS | Yes | 到达 clamp 边界后的橡皮筋回弹效果 |
416
+ | `rubberBandFactor` | number | 0.6 | No | Android and iOS | Yes | 橡皮筋效果强度(启用 rubberBandEffect 时可用) |
417
+ | `reduceMotion` | ReduceMotion | ReduceMotion.System | No | Android and iOS | Yes | 减弱动态效果(无障碍)策略 |
418
+
419
+ #### withClamp / withRepeat / withDelay / withSequence 参数
420
+
421
+ | 名称 | 所属 API | 参数类型 | 默认值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
422
+ | ------------------ | -------------- | ------------------------------- | ------- | ---- | -------------- | ----------------- | ------------------------------------------------- |
423
+ | `min` / `max` | withClamp | number \| string | none | No | Android and iOS | Yes | 限幅上下界 |
424
+ | `numberOfRepeats` | withRepeat | number | none | Yes | Android and iOS | Yes | 重复次数,-1 表示无限重复 |
425
+ | `reverse` | withRepeat | boolean | false | No | Android and iOS | Yes | 是否每次迭代反向播放 |
426
+ | `delay` | withDelay | number | none | Yes | Android and iOS | Yes | 延迟时长(毫秒) |
427
+ | `callback` | 全部动画函数 | (finished?: boolean, current?: AnimatableValue) => void | none | No | Android and iOS | Yes | 动画结束回调,被取消时入参为 false |
428
+
429
+ #### SensorConfig(useAnimatedSensor 配置)
430
+
431
+ | 名称 | 参数类型 | 默认值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
432
+ | --------------------------- | ------------------ | ----------------------- | ---- | -------------- | ----------------- | ---------------------------------------------------------- |
433
+ | `interval` | number \| 'auto' | 'auto' | No | Android and iOS | Yes | 采样间隔(毫秒),'auto' 由系统决定 |
434
+ | `adjustToInterfaceOrientation` | boolean | true | No | Android and iOS | Yes | 传感器数值是否根据屏幕方向调整 |
435
+ | `iosReferenceFrame` | IOSReferenceFrame | IOSReferenceFrame.Auto | No | iOS | No | iOS 传感器姿态参考系,iOS 专属 |
436
+
437
+ #### AnimatedSensor(useAnimatedSensor 返回值)
438
+
439
+ | 名称 | 参数类型 | 默认值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
440
+ | ------------- | ------------------------------------- | ------ | ---- | -------------- | ----------------- | ------------------------------------------------- |
441
+ | `sensor` | SharedValue&lt;Value3D \| ValueRotation&gt; | none | No | Android and iOS | Yes | 传感器数据共享值 |
442
+ | `unregister` | () => void | none | No | Android and iOS | Yes | 注销传感器监听 |
443
+ | `isAvailable` | boolean | false | No | Android and iOS | Yes | 传感器是否可用(注册失败为 false) |
444
+ | `config` | SensorConfig | none | No | Android and iOS | Yes | 实际生效的配置(默认值与传入值合并) |
445
+
446
+ 其中 `Value3D` 为 `{ x, y, z, interfaceOrientation }`;`ValueRotation` 为 `{ qw, qx, qy, qz, yaw, pitch, roll, interfaceOrientation }`。
447
+
448
+ #### AnimatedKeyboardOptions / AnimatedKeyboardInfo(useAnimatedKeyboard)
449
+
450
+ | 名称 | 参数类型 | 默认值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
451
+ | -------------------------------- | -------------------- | ------ | ---- | ------- | ----------------- | ------------------------------------------ |
452
+ | `isStatusBarTranslucentAndroid` | boolean | none | No | Android | Yes(忽略,无副作用) | Android 状态栏透明标志(Android 专属) |
453
+ | `isNavigationBarTranslucentAndroid` | boolean | none | No | Android | Yes(忽略,无副作用) | Android 导航栏透明标志(Android 专属) |
454
+ | `height`(返回值) | SharedValue&lt;number&gt; | 0 | No | All | Yes | 键盘高度共享值 |
455
+ | `state`(返回值) | SharedValue&lt;KeyboardState&gt; | KeyboardState.UNKNOWN | No | All | Yes | 键盘状态共享值 |
456
+
457
+ #### SharedValue(useSharedValue 返回值)
458
+
459
+ | 名称 | 参数类型 | 默认值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
460
+ | -------------- | ---------------------------------------------------------- | ------ | ---- | -------------- | ----------------- | ------------------------------------------------- |
461
+ | `value` | Value | none | No | Android and iOS | Yes | 读写共享值(写入触发 UI 线程同步更新) |
462
+ | `get` | () => Value | none | No | Android and iOS | Yes | 获取当前值 |
463
+ | `set` | (value: Value \| ((value: Value) => Value)) => void | none | No | Android and iOS | Yes | 更新共享值,支持直接赋值或更新函数 |
464
+ | `addListener` | (listenerID: number, listener: (value: Value) => void) => void | none | No | Android and iOS | Yes | 注册值变化监听 |
465
+ | `removeListener` | (listenerID: number) => void | none | No | Android and iOS | Yes | 移除值变化监听 |
466
+ | `modify` | (modifier?: (value: Value) => Value, forceUpdate?: boolean) => void | none | No | Android and iOS | Yes | 在 UI 线程上以原子方式修改当前值 |
467
+
468
+ #### Easing 缓动函数(Easing 对象成员)
469
+
470
+ | 名称 | 参数类型 | 默认值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
471
+ | --------- | ------------------------------ | ------ | ---- | ---- | ----------------- | -------------------------------------- |
472
+ | `linear` | () => EasingFunction | none | No | All | Yes | 线性 |
473
+ | `ease` | () => EasingFunction | none | No | All | Yes | 基础缓动 |
474
+ | `quad` | () => EasingFunction | none | No | All | Yes | 二次曲线 |
475
+ | `cubic` | () => EasingFunction | none | No | All | Yes | 三次曲线 |
476
+ | `poly` | (n: number) => EasingFunction | none | No | All | Yes | n 次曲线 |
477
+ | `sin` | () => EasingFunction | none | No | All | Yes | 正弦曲线 |
478
+ | `circle` | () => EasingFunction | none | No | All | Yes | 圆弧曲线 |
479
+ | `exp` | () => EasingFunction | none | No | All | Yes | 指数曲线 |
480
+ | `elastic` | (bounciness?: number) => EasingFunction | none | No | All | Yes | 弹性曲线 |
481
+ | `back` | (overshoot?: number) => EasingFunction | none | No | All | Yes | 回退曲线 |
482
+ | `bounce` | () => EasingFunction | none | No | All | Yes | 弹跳曲线 |
483
+ | `bezier` | (x1, y1, x2, y2: number) => EasingFunctionFactory | none | No | All | Yes | 三阶贝塞尔曲线 |
484
+ | `bezierFn`| (x1, y1, x2, y2: number) => EasingFunction | none | No | All | Yes | 三阶贝塞尔曲线(直接返回函数,不带工厂信息) |
485
+ | `steps` | (n?: number, roundToNextStep?: boolean) => EasingFunction | none | No | All | Yes | 阶梯曲线 |
486
+ | `in` | (easing: EasingFunction) => EasingFunction | none | No | All | Yes | 先加速 |
487
+ | `out` | (easing: EasingFunction) => EasingFunction | none | No | All | Yes | 先减速 |
488
+ | `inOut` | (easing: EasingFunction) => EasingFunction | none | No | All | Yes | 先加速后减速 |
489
+
490
+ #### CSS 样式属性(css.create / createCSSAnimatedComponent)
491
+
492
+ 配合 `css.create` 创建的样式或 `createCSSAnimatedComponent` 封装的组件使用:
493
+
494
+ | 名称 | 参数类型 | 默认值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
495
+ | -------------------------- | ----------------------- | ------ | ---- | -------------- | ----------------- | ------------------------------------------ |
496
+ | `transitionProperty` | string \| string[] | none | No | Android and iOS | Yes | 参与过渡的样式属性名 |
497
+ | `transitionDuration` | string \| number(ms) | none | No | Android and iOS | Yes | 过渡时长 |
498
+ | `transitionDelay` | string \| number(ms) | none | No | Android and iOS | Yes | 过渡开始前的延迟 |
499
+ | `transitionTimingFunction` | CSS timing function | none | No | Android and iOS | Yes | 过渡缓动函数 |
500
+ | `transitionBehavior` | 'normal' \| 'allow-discrete' | none | No | Android and iOS | Yes | 是否对离散属性应用过渡 |
501
+ | `onTransitionRun` | (event: { propertyName: string, elapsedTime: number }) => void | none | No | Web | No | 过渡触发回调 |
502
+ | `onTransitionStart` | (event: { propertyName: string, elapsedTime: number }) => void | none | No | Web | No | 延迟结束后过渡开始回调 |
503
+ | `onTransitionEnd` | (event: { propertyName: string, elapsedTime: number }) => void | none | No | Web | No | 过渡完成回调 |
504
+ | `onTransitionCancel` | (event: { propertyName: string, elapsedTime: number }) => void | none | No | Web | No | 过渡中断回调 |
505
+ | `animationName` | CSSKeyframesRule | none | No | Android and iOS | Yes | 关键帧动画(由 `css.keyframes` 创建) |
506
+ | `animationDuration` | string \| number(ms) | none | No | Android and iOS | Yes | 动画时长 |
507
+ | `animationDelay` | string \| number(ms) | none | No | Android and iOS | Yes | 动画开始前的延迟 |
508
+ | `animationTimingFunction` | CSS timing function | none | No | Android and iOS | Yes | 动画缓动函数 |
509
+ | `animationDirection` | 'normal' \| 'reverse' \| 'alternate' \| 'alternate-reverse' | none | No | Android and iOS | Yes | 动画播放方向 |
510
+ | `animationIterationCount` | number \| 'infinite' | none | No | Android and iOS | Yes | 动画迭代次数 |
511
+ | `animationFillMode` | 'none' \| 'forwards' \| 'backwards' \| 'both' | none | No | Android and iOS | Yes | 动画前后样式的保持策略 |
512
+ | `animationPlayState` | 'running' \| 'paused' | none | No | Android and iOS | Yes | 动画播放 / 暂停 |
513
+
514
+ #### CSS 样式伪类值(StyleWithPseudoValues)
515
+
516
+ `css.create` 创建的样式或 `createCSSAnimatedComponent` 封装组件的内联 `style` 中,任意 CSS 样式属性的值可从单值扩展为"按交互态取值"的对象(至少写一个键),由原生侧跟踪指针悬停 / 按压链 / 焦点链自动切换,无需手写 state 与事件;可与 `transitionProperty` 联动实现状态切换过渡:
517
+
518
+ ```tsx
519
+ backgroundColor: {
520
+ default: '#e7e7e7',
521
+ ':hover': '#b58df1',
522
+ ':active': '#61dafb',
523
+ },
524
+ ```
525
+
526
+ | 伪类键 | 触发条件 | 平台 | HarmonyOS平台支持 | 描述 |
527
+ | ------ | -------- | ---- | ----------------- | ---- |
528
+ | `default` | 无交互态时的基础值 | All | Yes | 伪类对象的基础值键 |
529
+ | `:hover` | 指针悬停(含祖先链) | Android and iOS | Yes | 悬停高亮 |
530
+ | `:active` | 按压自身或其后代期间(祖先链语义) | Android and iOS | Yes | 按压反馈 |
531
+ | `:active-deepest` | 按压链上最深的已注册组件 | Android and iOS | Yes | 仅按压链最深处生效 |
532
+ | `:focus` | 输入组件自身聚焦期间 | Android and iOS | Yes | 聚焦描边等 |
533
+ | `:focus-within` | 后代存在聚焦期间 | Android and iOS | Yes | 容器级聚焦高亮 |
534
+
535
+ ### API
536
+
537
+ #### 动画函数
538
+
539
+ | 名称 | 类型 | 参数类型 | 返回值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
540
+ | ---------------- | -------- | ------------------------------------------------------------------------ | ----------------- | ---- | ---- | ----------------- | -------------------------------------------------------- |
541
+ | `withTiming` | function | (toValue: AnimatableValue, config?: WithTimingConfig, callback?: AnimationCallback) | Animation | No | All | Yes | 基于时长与缓动曲线的动画 |
542
+ | `withSpring` | function | (toValue: AnimatableValue, config?: WithSpringConfig, callback?: AnimationCallback) | Animation | No | All | Yes | 基于弹簧模型的动画 |
543
+ | `withDecay` | function | (config: WithDecayConfig, callback?: AnimationCallback) | Animation | No | All | Yes | 带摩擦减速的衰减动画,常用于手势释放后的惯性滑动 |
544
+ | `withRepeat` | function | (animation: Animation, numberOfRepeats: number, reverse?: boolean, callback?: AnimationCallback) | Animation | No | All | Yes | 重复执行动画,numberOfRepeats 为 -1 时无限重复 |
545
+ | `withSequence` | function | (...animations: Animation[]) | Animation | No | All | Yes | 按顺序依次执行多个动画 |
546
+ | `withDelay` | function | (delay: number, animation: Animation) | Animation | No | All | Yes | 延迟指定毫秒后执行动画 |
547
+ | `withClamp` | function | (config: { min?, max?, reduceMotion? }, animation: Animation) | Animation | No | All | Yes | 限制内部动画的值域范围 |
548
+ | `cancelAnimation`| function | (sharedValue: SharedValue) => void | void | No | All | Yes | 取消共享值上正在运行的动画(异步生效) |
549
+ | `defineAnimation`| function | (starting: AnimatableValue \| (() => Animation), factory: () => Animation) | Animation | No | All | Yes | 自定义动画的底层工厂(配合 custom animation 使用) |
550
+
551
+ #### Hooks
552
+
553
+ | 名称 | 类型 | 参数类型 | 返回值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
554
+ | --------------------------- | -------- | ----------------------------------------------------------------------------------------- | ------------------------------------------ | ---- | ---- | ----------------- | ----------------------------------------------------------------- |
555
+ | `useSharedValue` | function | (initialValue: Value) | SharedValue&lt;Value&gt; | No | All | Yes | 定义可在 JS 线程与 UI 线程间共享的值 |
556
+ | `useDerivedValue` | function | (updater: () => Value, dependencies?: DependencyList) | DerivedValue&lt;Value&gt;(只读) | No | All | Yes | 基于其他共享值派生新的响应式共享值 |
557
+ | `useAnimatedStyle` | function | (updater: () => StyleProps, dependencies?: DependencyList) | AnimatedStyle | No | All | Yes | 创建由共享值驱动的动画样式 |
558
+ | `useAnimatedProps` | function | (updater: () => AnimatedProps, dependencies?: DependencyList) | AnimatedProps | No | All | Yes | 创建可动画的组件属性(用于非样式属性,如 SVG 的 path) |
559
+ | `useAnimatedRef` | function | () | AnimatedRef&lt;T&gt; | No | All | Yes | 获取动画组件引用,配合 measure、scrollTo、useScrollOffset 使用 |
560
+ | `useAnimatedReaction` | function | (prepare: () => PreparedResult, react: (prepared, previous) => void, dependencies?) | void | No | All | Yes | 对共享值变化做出反应(在 UI 线程执行 react) |
561
+ | `useAnimatedScrollHandler` | function | (handlers: ScrollHandlers \| ScrollHandler, dependencies?) | 事件处理器(传给 onScroll) | No | All | Yes | 创建滚动事件处理器,回调自动 worklet 化 |
562
+ | `useScrollOffset` | function | (aref: AnimatedRef, providedOffset?: SharedValue&lt;number&gt;) | SharedValue&lt;number&gt; | No | All | Yes | 读取滚动组件(ScrollView / FlatList 等)的滚动偏移 |
563
+ | `useScrollViewOffset` | function | 同 `useScrollOffset`(`useScrollOffset` 的废弃别名) | SharedValue&lt;number&gt; | No | All | Yes | 已废弃,请使用 `useScrollOffset` |
564
+ | `useAnimatedSensor` | function | (sensorType: SensorType, config?: Partial&lt;SensorConfig&gt;) | AnimatedSensor | No | All | Yes | 订阅设备传感器(加速度 / 陀螺仪 / 旋转等),需申请传感器权限 |
565
+ | `useAnimatedKeyboard` | function | (options?: AnimatedKeyboardOptions) | AnimatedKeyboardInfo | No | All | Yes | 订阅键盘高度与状态 |
566
+ | `useFrameCallback` | function | (callback: (frameInfo: FrameInfo) => void, autostart?: boolean) | FrameCallback | No | All | Yes | 每帧回调,返回 FrameCallback 对象:setActive / isActive / callbackId |
567
+ | `useTimestamp` | function | (isActive?: boolean) | SharedValue&lt;number&gt; | No | All | Yes | 每帧更新的时间戳共享值 |
568
+ | `useReducedMotion` | function | () | boolean | No | All | Yes | 读取系统"减弱动态效果"无障碍设置 |
569
+ | `useEvent` | function | (handler: EventHandler, eventNames?: readonly string[], rebuild?: boolean) | 事件处理器 | No | All | Yes | 创建 worklet 化的底层事件处理器(自定义事件处理的基础) |
570
+ | `useHandler` | function | (handlers: Record&lt;string, Handler&gt;, dependencies?: DependencyList) | { changedDepFlag } 等内部上下文 | No | All | Yes | 供自定义 use*Handler 类 Hook 复用的底层 Hook |
571
+ | `useComposedEventHandler` | function | (handlers: (EventHandlerProcessed \| null)[]) | 组合后的事件处理器 | No | All | Yes | 将多个 useEvent 系事件处理器组合为单个处理器 |
572
+
573
+ #### 颜色工具
574
+
575
+ | 名称 | 类型 | 参数类型 | 返回值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
576
+ | ----------------- | -------- | --------------------------------------------------------------- | ------------------ | ---- | ---- | ----------------- | ------------------------------------------------- |
577
+ | `interpolateColor`| function | (value, inputRange, outputRange, colorSpace?: 'RGB' \| 'HSV' \| 'LAB', options?) | string \| number | No | All | Yes | 颜色插值,支持 RGB / HSV / LAB 色彩空间 |
578
+ | `processColor` | function | (value: string \| number \| ColorValue, context?) | number \| object \| false \| null | No | All | Yes | 将颜色值处理为可动画的内部表示 |
579
+ | `PlatformColor` | function | (...names: string[]) | OpaqueColorValue | No | All | Yes | 引用系统主题色(鸿蒙侧按系统资源色对齐处理) |
580
+ | `DynamicColorIOS` | function | (tuple: { light, dark, highContrastLight?, highContrastDark? }) | OpaqueColorValue | No | iOS | **No** | iOS 专属的深浅色自适应颜色,鸿蒙不支持 |
581
+ | `convertToRGBA` | function | (color: string \| number \| ParsedColorArray) | ParsedColorArray(RGBA 数组) | No | All | Yes | 将任意颜色转换为 RGBA 数组 |
582
+ | `isColor` | function | (value: unknown) | boolean | No | All | Yes | 判断给定值是否为颜色 |
583
+
584
+ #### 插值工具
585
+
586
+ | 名称 | 类型 | 参数类型 | 返回值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
587
+ | -------------- | -------- | ---------------------------------------------------------------------------- | ------ | ---- | ---- | ----------------- | ------------------------------------------------------- |
588
+ | `interpolate` | function | (value: number, inputRange: number[], outputRange: number[], type?: ExtrapolationType) | number | No | All | Yes | 数值插值 |
589
+ | `clamp` | function | (value: number, min: number, max: number) | number | No | All | Yes | 将值限制在 [min, max] 区间内(可在 worklet 中使用) |
590
+ | `Extrapolation`| enum | IDENTITY / CLAMP / EXTEND | - | No | All | Yes | 插值外推方式枚举 |
591
+ | `Extrapolate`<sup>deprecated</sup> | enum | 同 Extrapolation | - | No | All | Yes | 已废弃,请使用 `Extrapolation` |
592
+
593
+ #### 布局动画构建器通用修饰方法
594
+
595
+ 以下静态方法在全部布局动画构建器(`Layout`、`FadeIn`、`BounceIn`、`SharedTransition` 等)上可用,链式调用:
596
+
597
+ | 名称 | 参数类型 | 返回值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
598
+ | -------------------------- | ------------------------------------------- | ------------ | ---- | ---- | ----------------- | ------------------------------------------------- |
599
+ | `duration(ms)` | number | 构建器实例 | No | All | Yes | 动画时长 |
600
+ | `delay(ms)` | number | 构建器实例 | No | All | Yes | 动画延迟 |
601
+ | `easing(easing)` | EasingFunctionFactory \| EasingFunction | 构建器实例 | No | All | Yes | 缓动曲线(ComplexAnimationBuilder 及其子类) |
602
+ | `springify()` | - | 构建器实例 | No | All | Yes | 切换为弹簧动画(ComplexAnimationBuilder 及其子类)|
603
+ | `damping(v)` / `stiffness(v)` / `mass(v)` | number | 构建器实例 | No | All | Yes | 弹簧物理参数(springify 后生效) |
604
+ | `dampingRatio(v)` | number | 构建器实例 | No | All | Yes | 弹簧阻尼比(springify 后生效) |
605
+ | `overshootClamping(v)` / `restDisplacementThreshold(v)` / `restSpeedThreshold(v)` / `energyThreshold(v)` | number | 构建器实例 | No | All | Yes | 弹簧细调参数(springify 后生效) |
606
+ | `rotate(deg)` | number \| string | 构建器实例 | No | All | Yes | 入场旋转角度修正(ComplexAnimationBuilder 子类) |
607
+ | `reduceMotion(mode)` | ReduceMotion | 构建器实例 | No | All | Yes | 减弱动态效果策略 |
608
+ | `withCallback(cb)` | (finished: boolean) => void | 构建器实例 | No | All | Yes | 动画结束回调 |
609
+ | `withInitialValues(values)`| StyleProps | 构建器实例 | No | All | Yes | 指定起始样式(ComplexAnimationBuilder 子类) |
610
+ | `withTargetValues(values)` | StyleProps | 构建器实例 | No | All | Yes | 指定目标样式(ComplexAnimationBuilder 子类) |
611
+ | `randomDelay()` | - | 构建器实例 | No | All | Yes | 随机延迟(用于列表错落动画) |
612
+ | `getDuration()` | - | number | No | All | Yes | 读取构建器内部时长 |
613
+
614
+ #### 布局动画(进入 Entering)
615
+
616
+ 通过组件的 `entering` 属性使用:
617
+
618
+ | 名称 | 类型 | 参数类型 | 返回值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
619
+ | ---- | ---- | -------- | ------ | ---- | ---- | ----------------- | ---- |
620
+ | `BounceIn` | class | - | 构建器实例 | No | All | Yes | 弹跳进入 |
621
+ | `BounceInDown` / `BounceInLeft` / `BounceInRight` / `BounceInUp` | class | - | 构建器实例 | No | All | Yes | 从下 / 左 / 右 / 上方向弹跳进入 |
622
+ | `FadeIn` | class | - | 构建器实例 | No | All | Yes | 淡入 |
623
+ | `FadeInDown` / `FadeInLeft` / `FadeInRight` / `FadeInUp` | class | - | 构建器实例 | No | All | Yes | 带位移的淡入 |
624
+ | `FlipInEasyX` / `FlipInEasyY` | class | - | 构建器实例 | No | All | Yes | 轻量 X / Y 轴翻转入场 |
625
+ | `FlipInXDown` / `FlipInXUp` / `FlipInYLeft` / `FlipInYRight` | class | - | 构建器实例 | No | All | Yes | X / Y 轴向翻转进入 |
626
+ | `LightSpeedInLeft` / `LightSpeedInRight` | class | - | 构建器实例 | No | All | Yes | 光速左侧 / 右侧进入 |
627
+ | `PinwheelIn` | class | - | 构建器实例 | No | All | Yes | 风车进入 |
628
+ | `RollInLeft` / `RollInRight` | class | - | 构建器实例 | No | All | Yes | 滚动进入(左 / 右) |
629
+ | `RotateInDownLeft` / `RotateInDownRight` / `RotateInUpLeft` / `RotateInUpRight` | class | - | 构建器实例 | No | All | Yes | 旋转进入 |
630
+ | `SlideInDown` / `SlideInLeft` / `SlideInRight` / `SlideInUp` | class | - | 构建器实例 | No | All | Yes | 滑入(下 / 左 / 右 / 上) |
631
+ | `StretchInX` / `StretchInY` | class | - | 构建器实例 | No | All | Yes | 拉伸进入 |
632
+ | `ZoomIn` | class | - | 构建器实例 | No | All | Yes | 缩放进入 |
633
+ | `ZoomInDown` / `ZoomInEasyDown` / `ZoomInEasyUp` / `ZoomInLeft` / `ZoomInRight` / `ZoomInRotate` / `ZoomInUp` | class | - | 构建器实例 | No | All | Yes | 各方向 / 轻量 / 旋转缩放进入 |
634
+
635
+ #### 布局动画(退出 Exiting)
636
+
637
+ 通过组件的 `exiting` 属性使用,与进入动画一一对应:
638
+
639
+ | 名称 | 类型 | 参数类型 | 返回值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
640
+ | ---- | ---- | -------- | ------ | ---- | ---- | ----------------- | ---- |
641
+ | `BounceOut` / `BounceOutDown` / `BounceOutLeft` / `BounceOutRight` / `BounceOutUp` | class | - | 构建器实例 | No | All | Yes | 弹跳退出(各方向) |
642
+ | `FadeOut` / `FadeOutDown` / `FadeOutLeft` / `FadeOutRight` / `FadeOutUp` | class | - | 构建器实例 | No | All | Yes | 淡出(各方向) |
643
+ | `FlipOutEasyX` / `FlipOutEasyY` / `FlipOutXDown` / `FlipOutXUp` / `FlipOutYLeft` / `FlipOutYRight` | class | - | 构建器实例 | No | All | Yes | 翻转退出 |
644
+ | `LightSpeedOutLeft` / `LightSpeedOutRight` | class | - | 构建器实例 | No | All | Yes | 光速退出 |
645
+ | `PinwheelOut` | class | - | 构建器实例 | No | All | Yes | 风车退出 |
646
+ | `RollOutLeft` / `RollOutRight` | class | - | 构建器实例 | No | All | Yes | 滚动退出 |
647
+ | `RotateOutDownLeft` / `RotateOutDownRight` / `RotateOutUpLeft` / `RotateOutUpRight` | class | - | 构建器实例 | No | All | Yes | 旋转退出 |
648
+ | `SlideOutDown` / `SlideOutLeft` / `SlideOutRight` / `SlideOutUp` | class | - | 构建器实例 | No | All | Yes | 滑出 |
649
+ | `StretchOutX` / `StretchOutY` | class | - | 构建器实例 | No | All | Yes | 拉伸退出 |
650
+ | `ZoomOut` / `ZoomOutDown` / `ZoomOutEasyDown` / `ZoomOutEasyUp` / `ZoomOutLeft` / `ZoomOutRight` / `ZoomOutRotate` / `ZoomOutUp` | class | - | 构建器实例 | No | All | Yes | 缩放退出(各方向 / 轻量 / 旋转) |
651
+
652
+ #### 布局动画(布局过渡 Layout)与组合
653
+
654
+ 通过组件的 `layout` 属性使用;`EntryExitTransition` 可组合进入与退出动画,用于组件的 `entering` 与 `exiting`:
655
+
656
+ | 名称 | 类型 | 参数类型 | 返回值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
657
+ | --------------------- | ------ | ----------------------------------------------- | ---------- | ---- | ---- | ----------------- | ------------------------------------------------- |
658
+ | `Layout` | class | - | 构建器实例 | No | All | Yes | 默认布局过渡动画 |
659
+ | `LinearTransition` | class | - | 构建器实例 | No | All | Yes | 线性布局过渡 |
660
+ | `CurvedTransition` | class | - | 构建器实例 | No | All | Yes | 曲线布局过渡(速度插值) |
661
+ | `SequencedTransition` | class | - | 构建器实例 | No | All | Yes | 先旋转缩放后位移的分段过渡,reverse() 方法可反向 |
662
+ | `FadingTransition` | class | - | 构建器实例 | No | All | Yes | 淡入淡出布局过渡 |
663
+ | `JumpingTransition` | class | - | 构建器实例 | No | All | Yes | 跳跃布局过渡 |
664
+ | `EntryExitTransition` | class | - | 构建器实例 | No | All | Yes | 组合进入与退出动画,经 entering() / exiting() 方法分别指定,同时用于 entering / exiting 属性 |
665
+ | `Keyframe` | class | (keyframes: Record&lt;string \| number, StyleProps&gt;) | 构建器实例 | No | All | Yes | 自定义关键帧布局动画,支持 '0%'–'100%' 或 0–1 关键帧 |
666
+ | `BaseAnimationBuilder` | class | - | 基类 | No | All | Yes | 全部布局动画构建器的基类 |
667
+ | `ComplexAnimationBuilder` | class | - | 基类 | No | All | Yes | 支持 easing / springify 等复杂配置的构建器基类 |
668
+
669
+ #### 共享元素转场
670
+
671
+ 通过组件的 `sharedTransitionTag` 字符串标签配对使用:
672
+
673
+ | 名称 | 类型 | 参数类型 | 返回值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
674
+ | ------------------------- | ------ | -------------------- | ---------- | ---- | ---- | ----------------- | ------------------------------------------------- |
675
+ | `SharedTransition` | class | - | 构建器实例 | No | All | Yes | 共享元素转场动画,两个相同 sharedTransitionTag 的组件间平滑过渡 |
676
+ | `SharedTransitionBoundary` | 组件 | 见属性章节 | ReactNode | No | All | Yes | 共享元素转场边界组件(嵌套场景) |
677
+
678
+ #### UI 线程平台函数
679
+
680
+ | 名称 | 类型 | 参数类型 | 返回值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
681
+ | ------------------ | -------- | --------------------------------------------------------------- | ------------------------- | ---- | ---- | ----------------- | ------------------------------------------------- |
682
+ | `measure` | function | (animatedRef: AnimatedRef) | MeasuredDimensions \| null | No | All | Yes | 在 UI 线程同步获取组件的尺寸与位置(x, y, width, height, pageX, pageY) |
683
+ | `scrollTo` | function | (animatedRef, x: number, y: number, animated?: boolean) | void | No | All | Yes | 滚动到指定位置 |
684
+ | `dispatchCommand` | function | (animatedRef, commandName: string, args?: unknown[]) | void | No | All | Yes | 同步调用组件的原生命令 |
685
+ | `setGestureState` | function | (handlerTag: number, newState: number) | void | No | All | Yes | 配合 RNGH 在 worklet 中更新手势状态 |
686
+ | `setNativeProps` | function | (animatedRef, updates: Record&lt;string, unknown&gt;) | void | No | All | Yes | 命令式更新组件属性 |
687
+ | `getRelativeCoords`| function | (animatedRef, absoluteX: number, absoluteY: number) | ComponentCoords \| null | No | All | Yes | 计算相对于某组件的坐标 |
688
+ | `getViewProp`<sup>deprecated</sup> | function | (viewTag: number, propName: string, component?) => Promise | Promise&lt;T&gt; | No | All | Yes | 读取视图属性(已废弃) |
689
+
690
+ #### 核心与工具
691
+
692
+ | 名称 | 类型 | 参数类型 | 返回值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
693
+ | ------------------------------ | -------- | ------------------------------------------------- | ------------------------- | ---- | ---- | ----------------- | ------------------------------------------------- |
694
+ | `makeMutable` | function | (initialValue: Value) | SharedValue&lt;Value&gt; | No | All | Yes | 直接创建共享值(useSharedValue 的底层实现) |
695
+ | `isSharedValue` | function | (value: unknown) | boolean | No | All | Yes | 判断给定值是否为共享值 |
696
+ | `createAnimatedComponent` | function | (component: ComponentType, options?) | AnimatedComponent | No | All | Yes | 将任意 RN 组件封装为动画组件 |
697
+ | `createAnimatedPropAdapter` | function | (adapter: (props, config?) => void, props?: string[]) | PropAdapter | No | All | Yes | 创建 useAnimatedProps 的属性适配器 |
698
+ | `startMapper` | function | (worklet, inputs?, outputs?) | number(mapperId) | No | All | Yes | 注册 mapper(驱动动画的底层机制) |
699
+ | `stopMapper` | function | (mapperId: number) | void | No | All | Yes | 注销 mapper |
700
+ | `isReanimated3` | function | () | boolean | No | All | Yes | 是否为 Reanimated 3(4.x 中恒为 false) |
701
+ | `isConfigured` | function | () | boolean | No | All | Yes | 已废弃,等价于 isReanimated3 |
702
+ | `enableLayoutAnimations` | function | (isEnabled?: boolean) | void | No | All | Yes | 已废弃,4.x 中不再起作用 |
703
+ | `getUseOfValueInStyleWarning` | function | () | string | No | All | Yes | 返回"在样式中使用 .value"的警告文案(调试用) |
704
+ | `NativeEventsManager` | class | (component, options?) | 事件管理器实例 | No | All | Yes | createAnimatedComponent 内部使用的事件管理器 |
705
+ | `reanimatedVersion` | const | - | string | No | All | Yes | 当前 reanimated 版本号字符串 |
706
+
707
+ #### Feature Flags
708
+
709
+ | 名称 | 类型 | 参数类型 | 返回值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
710
+ | ------------------------ | -------- | ----------------------------------- | ------- | ---- | ---- | ----------------- | ------------------------------------------------- |
711
+ | `getStaticFeatureFlag` | function | (name: keyof StaticFeatureFlagsSchema) | boolean | No | All | Yes | 读取静态特性开关(编译期确定,需配合 CMake 宏 REANIMATED_FEATURE_FLAGS 配置) |
712
+ | `setDynamicFeatureFlag` | function | (name: string, value: boolean) | void | No | All | Yes | 动态设置特性开关 |
713
+ | `getDynamicFeatureFlag` | function | (name: string) | boolean | No | All | Yes | 读取动态特性开关 |
714
+
715
+ 静态开关:
716
+
717
+ | 名称 | 参数类型 | 默认值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
718
+ | ---- | -------- | ------ | ---- | ---- | ----------------- | ---- |
719
+ | `RUNTIME_TEST_FLAG` | boolean | false | No | All | Yes | 运行时测试开关(上游测试用途,源码中无业务消费点),鸿蒙行为与上游一致 |
720
+ | `DISABLE_COMMIT_PAUSING_MECHANISM` | boolean | false | No | All | Yes | 是否禁用 commit 暂停机制(动画更新高峰期暂停 React 提交、为动画让路的优化) |
721
+ | `ANDROID_SYNCHRONOUSLY_UPDATE_UI_PROPS` | boolean | false | No | Android | **No** | Android 专属:在 performOperations 中同步更新 UI 属性的实验优化;原生侧走 `#ifdef ANDROID` 分支,鸿蒙上不生效(与上游 iOS 行为一致,详见遗留问题) |
722
+ | `IOS_SYNCHRONOUSLY_UPDATE_UI_PROPS` | boolean | false | No | iOS | Yes | 同步更新 UI 属性的实验优化; |
723
+ | `EXPERIMENTAL_CSS_ANIMATIONS_FOR_SVG_COMPONENTS` | boolean | true | No | All | Yes | 对 SVG 组件启用实验性 CSS 动画/过渡(鸿蒙上需按 Link 章节配置 CMake 宏方可生效) |
724
+ | `IOS_CSS_CORE_ANIMATION` | boolean | false | No | iOS | Yes | CSS 动画改用后端渲染; |
725
+ | `USE_SYNCHRONIZABLE_FOR_MUTABLES` | boolean | true | No | All | Yes | 共享值(mutable)底层使用 worklets 提供的 Synchronizable 实现跨 runtime 读写 |
726
+ | `USE_COMMIT_HOOK_ONLY_FOR_REACT_COMMITS` | boolean | true | No | All | Yes | commit hook 仅拦截 React 提交,动画属性更新走独立通路(减少 hook 开销) |
727
+ | `ENABLE_SHARED_ELEMENT_TRANSITIONS` | boolean | false | No | All | Yes | 启用共享元素转场引擎与 Experimental 布局动画代理;鸿蒙上需在 CMake 宏中显式置 true 方可生效,真机已验证 |
728
+ | `FORCE_REACT_RENDER_FOR_SETTLED_ANIMATIONS` | boolean | true | No | All | Yes | 动画结束后(settled)将最终属性经 React 渲染路径重新提交,保持 JS 与原生属性快照一致 |
729
+ | `USE_ANIMATION_BACKEND` | boolean | false | No | All | **No** | 新一代统一动画后端;原生要求 RN ≥ 0.85.2 且开启 RN 侧 useSharedAnimatedBackend 特性开关,RNOH 0.84 无法启用(默认 false,无影响,详见遗留问题) |
730
+
731
+ #### 日志
732
+
733
+ | 名称 | 类型 | 参数类型 | 返回值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
734
+ | -------------------------- | -------- | ----------------------------------------------- | ------ | ---- | ---- | ----------------- | ------------------------------------------ |
735
+ | `configureReanimatedLogger`| function | (config: { level?: ReanimatedLogLevel, strict?: boolean }) | void | No | All | Yes | 配置 reanimated 日志级别与严格模式,全线程生效 |
736
+
737
+ #### CSS 动画
738
+
739
+ | 名称 | 类型 | 参数类型 | 返回值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
740
+ | --------------------------- | -------- | ----------------------------------------------------------- | --------------------- | ---- | ---- | ----------------- | ------------------------------------------------- |
741
+ | `css.create` | function | (styles: NamedStyles) | 样式表对象 | No | All | Yes | 创建含 CSS 过渡 / 动画属性的样式表 |
742
+ | `css.keyframes` | function | (definitions: CSSAnimationKeyframes) | CSSKeyframesRule | No | All | Yes | 创建 CSS 关键帧动画定义 |
743
+ | `createCSSAnimatedComponent`| function | (component: ComponentType) | CSS 动画组件 | No | All | Yes | 将 RN 组件封装为支持 CSS 动画 / 过渡的组件 |
744
+ | `cubicBezier` | function | (x1: number, y1: number, x2: number, y2: number) | EasingFunctionFactory | No | All | Yes | CSS 三阶贝塞尔缓动 |
745
+ | `linear` | function | (...points: [number, number][]) | EasingFunctionFactory | No | All | Yes | CSS 线性缓动(可带控制点) |
746
+ | `steps` | function | (stepsNumber: number, modifier?: 'jump-start' \| 'jump-end' \| ...) | EasingFunctionFactory | No | All | Yes | CSS 阶梯缓动 |
747
+
748
+ #### 屏幕转场
749
+
750
+ | 名称 | 类型 | 参数类型 | 返回值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
751
+ | ------------------------ | -------- | -------------------------------------------- | ------ | ---- | ---- | ----------------- | ----------------------------------------------------------- |
752
+ | `ScreenTransition` | const | - | 预设集合 | No | All | Yes | 屏幕转场样式预设集合,成员:SwipeRight / SwipeLeft / SwipeDown / SwipeUp / Horizontal / Vertical / TwoDimensional / SwipeRightFade(每个成员含 topScreenStyle / belowTopScreenStyle 两个 worklet 样式函数) |
753
+ | `startScreenTransition` | function | (config: ScreenTransitionConfig) | void | No | All | Yes | 开始屏幕转场(worklet) |
754
+ | `finishScreenTransition` | function | (config: ScreenTransitionConfig) | void | No | All | Yes | 结束屏幕转场(worklet) |
755
+
756
+ #### Jest 测试工具
757
+
758
+ | 名称 | 类型 | 参数类型 | 返回值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
759
+ | ------------------------- | -------- | --------------------------- | ------ | ---- | ---- | ----------------- | -------------------------------------------------------- |
760
+ | `setUpTests` | function | (userConfig?) | void | No | Jest 环境 | Yes | 在 Jest 测试环境中初始化 reanimated 模拟 |
761
+ | `withReanimatedTimer` | function | (fn: () => void) | void | No | Jest 环境 | Yes | 单测中托管 reanimated 定时器 |
762
+ | `advanceAnimationByTime` | function | (time: number) | void | No | Jest 环境 | Yes | 将动画时间虚拟推进指定毫秒 |
763
+ | `advanceAnimationByFrame` | function | (frames: number) | void | No | Jest 环境 | Yes | 将动画虚拟推进指定帧数 |
764
+ | `getAnimatedStyle` | function | (animatedRef) | StyleProps | No | Jest 环境 | Yes | 读取动画组件当前合成的样式 |
765
+
766
+ ### 枚举与常量
767
+
768
+ | 名称 | 类型 | 取值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
769
+ | --------------------- | ---- | --------------------------------------------------------------------------------------------- | ---- | -------------- | ----------------- | ------------------------------------------ |
770
+ | `SensorType` | enum | ACCELEROMETER = 1, GYROSCOPE = 2, GRAVITY = 3, MAGNETIC_FIELD = 4, ROTATION = 5 | No | Android and iOS | Yes | 传感器类型(useAnimatedSensor 使用) |
771
+ | `IOSReferenceFrame` | enum | XArbitraryZVertical = 0, XArbitraryCorrectedZVertical = 1, XMagneticNorthZVertical = 2, XTrueNorthZVertical = 3, Auto = 4 | No | iOS | No | iOS 传感器姿态参考系,iOS 专属(详见遗留问题) |
772
+ | `KeyboardState` | enum | UNKNOWN = 0, OPENING = 1, OPEN = 2, CLOSING = 3, CLOSED = 4 | No | All | Yes | 键盘状态(useAnimatedKeyboard 返回) |
773
+ | `InterfaceOrientation`| enum | ROTATION_0 = 0, ROTATION_90 = 90, ROTATION_180 = 180, ROTATION_270 = 270 | No | All | Yes | 屏幕方向(传感器数值附带) |
774
+ | `ReduceMotion` | enum | System = 'system', Always = 'always', Never = 'never' | No | All | Yes | 减弱动态效果策略 |
775
+ | `ReanimatedLogLevel` | enum | warn = 1, error = 2 | No | All | Yes | 日志级别(configureReanimatedLogger 使用) |
776
+ | `Extrapolation` | enum | IDENTITY = 'identity', CLAMP = 'clamp', EXTEND = 'extend' | No | All | Yes | 插值外推方式 |
777
+ | `Easing` | const | 见"Easing 缓动函数"章节 | No | All | Yes | 缓动函数库对象 |
778
+ | `ScreenTransition` | const | SwipeRight / SwipeLeft / SwipeDown / SwipeUp / Horizontal / Vertical / TwoDimensional / SwipeRightFade | No | All | Yes | 屏幕转场样式预设集合 |
779
+
780
+ #### 弹簧动画预设常量
781
+
782
+ | 名称 | 参数内容 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
783
+ | ------------------------------------------ | ----------------------------------------------------- | ---- | ---- | ----------------- | ---------------------------------------- |
784
+ | `GentleSpringConfig` | { damping: 120, mass: 4, stiffness: 900 } | No | All | Yes | 平缓柔和的弹簧效果(物理参数形式) |
785
+ | `GentleSpringConfigWithDuration` | { duration: 550, dampingRatio: 1 } | No | All | Yes | 平缓柔和的弹簧效果(时长参数形式) |
786
+ | `Reanimated3DefaultSpringConfig` | { damping: 10, mass: 1, stiffness: 100 } | No | All | Yes | Reanimated 3 默认弹簧(高弹性、振荡明显)|
787
+ | `Reanimated3DefaultSpringConfigWithDuration` | { duration: 1333, dampingRatio: 0.5 } | No | All | Yes | Reanimated 3 默认弹簧(时长参数形式) |
788
+ | `SnappySpringConfig` | { damping: 110, mass: 4, stiffness: 900, overshootClamping: true } | No | All | Yes | "干脆利落"的快速弹簧效果 |
789
+ | `SnappySpringConfigWithDuration` | { duration: 550, dampingRatio: 0.92, overshootClamping: true } | No | All | Yes | "干脆利落"的快速弹簧(时长参数形式) |
790
+ | `WigglySpringConfig` | { damping: 90, mass: 4, stiffness: 900 } | No | All | Yes | "摇摆"回弹效果明显的弹簧 |
791
+ | `WigglySpringConfigWithDuration` | { duration: 550, dampingRatio: 0.75 } | No | All | Yes | "摇摆"回弹效果明显的弹簧(时长参数形式) |
792
+
793
+ #### css 类型出口(TypeScript 类型)
794
+
795
+ 4.5.3 起新增的 css 相关类型出口(编译期类型,无运行时值),均可从包顶层直接导入:
796
+
797
+ | 名称 | 类型 | 取值(结构) | 平台 | HarmonyOS平台支持 | 描述 |
798
+ | ---- | ---- | ------------ | ---- | ----------------- | ---- |
799
+ | `CSSPseudoSelectorKey` | type | 'default' \| ':hover' \| ':active' \| ':active-deepest' \| ':focus' \| ':focus-within'(native)+ 29 个 webonly 键(web) | All | Yes | CSS 样式伪类值的键类型(见"CSS 样式伪类值"章节) |
800
+ | `CSSGradientStop` | type | { offset: NumberProp; color?: ColorValue \| number; opacity?: NumberProp } | All | Yes | SVG 渐变 stop 描述:offset 百分比 / 数值,color 颜色,opacity 透明度(与 color 的 alpha 相乘) |
801
+ | `CSSLinearGradientProps` | type | { x1?, y1?, x2?, y2?, gradientUnits?, id?, gradient?: CSSGradientStop[] } | All | Yes | SVG 线性渐变可动画属性(渐变轴两端坐标、坐标单位、stop 数组),用作 CSS keyframes / animatedProps 的目标属性 |
802
+ | `CSSRadialGradientProps` | type | { r?, rx?, ry?, cx?, cy?, fx?, fy?, gradientUnits?, id?, gradient?: CSSGradientStop[] } | All | Yes | SVG 径向渐变可动画属性(半径、圆心、焦点、stop 数组) |
803
+
804
+ ## 遗留问题
805
+
806
+ 1. `IOSReferenceFrame`(iOS):该枚举是 iOS CoreMotion `CMAttitudeReferenceFrame` 的逐字映射,"姿态参考系"概念仅存在于 iOS;属于IOS独属概念。
807
+ 2. `DynamicColorIOS`(iOS):`DynamicColorIOS`为 RN 仅 iOS 原生支持的动态颜色 API,JS 包装层调用不报错,但在鸿蒙、Android 等非 iOS 平台经`processColor`处理时会抛出 Reanimated 平台不兼容错误,属于上游通用限制。
808
+ 3. 不支持`ANDROID_SYNCHRONOUSLY_UPDATE_UI_PROPS`(静态特性开关,Android):Android 专属实验能力,在`performOperations`同步更新 UI 属性,仅 Android 编译分支生效,鸿蒙不支持,属于上游平台差异,已对等实现IOS平台同步更新UI的能力`IOS_SYNCHRONOUSLY_UPDATE_UI_PROPS`。
809
+ 4. 不支持`USE_ANIMATION_BACKEND`(静态特性开关):新一代统一动画后端,要求 RN ≥0.85.2;RNOH 0.84 不满足条件,开启会触发原生断言,默认关闭,不影响现有功能。
810
+ 5. 不支持 CSS 过渡回调`onTransitionRun` / `onTransitionStart` / `onTransitionEnd` / `onTransitionCancel`:上游仅 web 端实现派发(映射 DOM `transitionrun` / `transitionstart` / `transitionend` / `transitioncancel` 事件),属于上游三端一致的实现现状。
811
+
812
+ ## 其他
813
+
814
+ - [React Native 中 LayoutAnimation 与 react-native-reanimated 存在不兼容,推荐使用 react-native-reanimated](https://github.com/software-mansion/react-native-reanimated/issues/6751)
815
+
816
+ ## 目录结构
817
+
818
+ ````
819
+ /rntpc_react-native-reanimated # 项目根目录
820
+ ├── package
821
+ │ ├── react-native-reanimated # reanimated 鸿蒙适配包
822
+ │ │ ├── harmony # 鸿蒙适配代码
823
+ │ │ │ └─ reanimated.har # har 包
824
+ │ │ │ └─ reanimated # 鸿蒙适配核心代码
825
+ │ │ │ └─ src/main/cpp # C++ 适配代码(ReanimatedPackage)
826
+ │ │ │ └─ src/main/ets # ArkTS 适配代码
827
+ │ │ ├── src
828
+ │ │ │ └─ index.ts # 适配层入口(重导出上游 JS 导出)
829
+ │ │ └── package.json
830
+ │ └── react-native-worklets # worklets 鸿蒙适配包(>= 4.0.0 必需)
831
+ ├── example # 示例工程
832
+ └── README.OpenSource # 开源信息
833
+
834
+ ````
835
+
836
+ ## 贡献代码
837
+
838
+ 使用过程中发现任何问题都可以提交 [Issue](https://gitcode.com/CPF-RN/rntpc_react-native-reanimated/issues),当然,也非常欢迎提交 [PR](https://gitcode.com/CPF-RN/rntpc_react-native-reanimated/pulls)。
839
+
840
+ ## 开源协议
841
+
842
+ 本项目基于 [The MIT License (MIT)](https://github.com/software-mansion/react-native-reanimated/blob/main/LICENSE) ,请自由地享受和参与开源。