@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
@@ -7,10 +7,11 @@
7
7
 
8
8
  namespace reanimated {
9
9
 
10
- Props::Shared mergeProps(const ShadowNode &shadowNode, const PropsMap &propsMap, const ShadowNodeFamily &family) {
10
+ Props::Shared
11
+ mergeProps(const ShadowNode &shadowNode, const PropsMap &propsMap, const ShadowNodeFamily::Shared &family) {
11
12
  ReanimatedSystraceSection s("ShadowTreeCloner::mergeProps");
12
13
 
13
- const auto it = propsMap.find(&family);
14
+ const auto it = propsMap.find(family);
14
15
 
15
16
  if (it == propsMap.end()) {
16
17
  return ShadowNodeFragment::propsPlaceholder();
@@ -41,7 +42,7 @@ std::shared_ptr<ShadowNode> cloneShadowTreeWithNewPropsRecursive(
41
42
  const ShadowNode &shadowNode,
42
43
  const ChildrenMap &childrenMap,
43
44
  const PropsMap &propsMap) {
44
- const auto family = &shadowNode.getFamily();
45
+ const auto family = shadowNode.getFamilyShared();
45
46
  const auto affectedChildrenIt = childrenMap.find(family);
46
47
  auto children = shadowNode.getChildren();
47
48
 
@@ -52,7 +53,7 @@ std::shared_ptr<ShadowNode> cloneShadowTreeWithNewPropsRecursive(
52
53
  }
53
54
 
54
55
  return shadowNode.clone(
55
- {mergeProps(shadowNode, propsMap, *family),
56
+ {mergeProps(shadowNode, propsMap, family),
56
57
  std::make_shared<std::vector<std::shared_ptr<const ShadowNode>>>(children),
57
58
  shadowNode.getState(),
58
59
  false});
@@ -66,32 +67,19 @@ RootShadowNode::Unshared cloneShadowTreeWithNewProps(const RootShadowNode &oldRo
66
67
  {
67
68
  ReanimatedSystraceSection s("ShadowTreeCloner::prepareChildrenMap");
68
69
 
69
- for (auto &[family, _] : propsMap) {
70
+ for (const auto &[family, _] : propsMap) {
70
71
  const auto ancestors = family->getAncestors(oldRootNode);
71
72
 
72
- // for (const auto &[parentNode, index] : std::ranges::reverse_view(ancestors)) {
73
- // const auto parentFamily = &parentNode.get().getFamily();
74
- // auto &affectedChildren = childrenMap[parentFamily];
75
- //
76
- // if (affectedChildren.contains(index)) {
77
- // continue;
78
- // }
79
- //
80
- // affectedChildren.insert(index);
81
- // }
82
- //TODO
83
- for (auto it = ancestors.rbegin(); it != ancestors.rend(); ++it) {
84
- const auto &[parentNode, index] = *it;
85
-
86
- const auto parentFamily = &parentNode.get().getFamily();
87
- auto &affectedChildren = childrenMap[parentFamily];
88
-
89
- if (affectedChildren.find(index) != affectedChildren.end()) {
90
- continue;
91
- }
92
-
93
- affectedChildren.insert(index);
94
- }
73
+ for (const auto &[parentNode, index] : std::ranges::reverse_view(ancestors)) {
74
+ const auto parentFamily = parentNode.get().getFamilyShared();
75
+ auto &affectedChildren = childrenMap[parentFamily];
76
+
77
+ if (affectedChildren.contains(index)) {
78
+ continue;
79
+ }
80
+
81
+ affectedChildren.insert(index);
82
+ }
95
83
  }
96
84
  }
97
85
 
@@ -1,10 +1,9 @@
1
1
  #pragma once
2
2
 
3
3
  #include <react/renderer/core/PropsParserContext.h>
4
+ #include <react/renderer/core/ShadowNodeFamily.h>
4
5
  #include <react/renderer/uimanager/UIManager.h>
5
6
 
6
- #include <memory>
7
- #include <type_traits>
8
7
  #include <unordered_map>
9
8
  #include <unordered_set>
10
9
  #include <vector>
@@ -14,8 +13,8 @@ using namespace react;
14
13
 
15
14
  namespace reanimated {
16
15
 
17
- using PropsMap = std::unordered_map<const ShadowNodeFamily *, std::vector<RawProps>>;
18
- using ChildrenMap = std::unordered_map<const ShadowNodeFamily *, std::unordered_set<int>>;
16
+ using PropsMap = std::unordered_map<ShadowNodeFamily::Shared, std::vector<RawProps>>;
17
+ using ChildrenMap = std::unordered_map<ShadowNodeFamily::Shared, std::unordered_set<int>>;
19
18
 
20
19
  RootShadowNode::Unshared cloneShadowTreeWithNewProps(const RootShadowNode &oldRootNode, const PropsMap &propsMap);
21
20
 
@@ -1,20 +1,25 @@
1
+ #include <cxxreact/ReactNativeVersion.h>
1
2
  #include <reanimated/Fabric/updates/AnimatedPropsRegistry.h>
3
+ #include <reanimated/Fabric/updates/UpdatesRegistryManager.h>
2
4
  #include <reanimated/Tools/FeatureFlags.h>
3
5
 
6
+ #include <react/debug/react_native_assert.h>
7
+
8
+ #include <functional>
4
9
  #include <memory>
5
10
  #include <utility>
11
+ #include <vector>
6
12
 
7
13
  namespace reanimated {
8
14
 
9
- #if REACT_NATIVE_MINOR_VERSION >= 81
10
15
  static inline std::shared_ptr<const ShadowNode> shadowNodeFromValue(
11
16
  jsi::Runtime &rt,
12
17
  const jsi::Value &shadowNodeWrapper) {
13
18
  return Bridging<std::shared_ptr<const ShadowNode>>::fromJs(rt, shadowNodeWrapper);
14
19
  }
15
- #endif
16
20
 
17
21
  void AnimatedPropsRegistry::update(jsi::Runtime &rt, const jsi::Value &operations, const double timestamp) {
22
+ react_native_assert(UpdatesRegistryManager::isLockedByCurrentThread());
18
23
  auto operationsArray = operations.asObject(rt).asArray(rt);
19
24
 
20
25
  for (size_t i = 0, length = operationsArray.size(rt); i < length; ++i) {
@@ -22,26 +27,75 @@ void AnimatedPropsRegistry::update(jsi::Runtime &rt, const jsi::Value &operation
22
27
  auto shadowNodeWrapper = item.getProperty(rt, "shadowNodeWrapper");
23
28
  auto shadowNode = shadowNodeFromValue(rt, shadowNodeWrapper);
24
29
 
25
- const jsi::Value &updates = item.getProperty(rt, "updates");
26
- addUpdatesToBatch(shadowNode, jsi::dynamicFromValue(rt, updates));
30
+ jsi::Value updates = item.getProperty(rt, "updates");
27
31
 
28
- if constexpr (StaticFeatureFlags::getFlag("FORCE_REACT_RENDER_FOR_SETTLED_ANIMATIONS")) {
29
- timestampMap_[shadowNode->getTag()] = timestamp;
32
+ if constexpr (StaticFeatureFlags::getFlag("USE_ANIMATION_BACKEND")) {
33
+ #if REACT_NATIVE_VERSION_MINOR >= 85
34
+ addJSIPropsToAnimatedPropsBatch(shadowNode->getFamilyShared(), rt, updates);
35
+ #endif
36
+ } else {
37
+ addUpdatesToBatch(shadowNode->getFamilyShared(), jsi::dynamicFromValue(rt, updates));
38
+ }
39
+
40
+ // When USE_ANIMATION_BACKEND is enabled, updates bypass `updatesRegistry_`,
41
+ // so entries added to `timestampMap_` would never be synced and thus never
42
+ // evicted, leaking until view unmount.
43
+ if constexpr (
44
+ StaticFeatureFlags::getFlag("FORCE_REACT_RENDER_FOR_SETTLED_ANIMATIONS") &&
45
+ !StaticFeatureFlags::getFlag("USE_ANIMATION_BACKEND")) {
46
+ const auto tag = shadowNode->getTag();
47
+ timestampMap_[tag] = timestamp;
48
+ // If JS already has a `settledProps` snapshot for this tag, it is now
49
+ // stale — schedule a refresh on the next `collectSettledUpdates`.
50
+ if (syncedTags_.erase(tag) > 0) {
51
+ invalidatedTags_.insert(tag);
52
+ }
30
53
  }
31
54
  }
32
55
  }
33
56
 
34
- void AnimatedPropsRegistry::remove(const Tag tag) {
35
- updatesRegistry_.erase(tag);
36
- }
57
+ jsi::Value AnimatedPropsRegistry::collectSettledUpdates(jsi::Runtime &rt, const double settledTimestamp) {
58
+ react_native_assert(UpdatesRegistryManager::isLockedByCurrentThread());
37
59
 
38
- jsi::Value AnimatedPropsRegistry::getUpdatesOlderThanTimestamp(jsi::Runtime &rt, const double timestamp) {
39
60
  std::vector<std::pair<Tag, std::reference_wrapper<const folly::dynamic>>> updates;
40
61
 
41
- for (const auto &[viewTag, pair] : updatesRegistry_) {
42
- if (timestampMap_.at(viewTag) < timestamp) {
43
- updates.emplace_back(viewTag, std::cref(pair.second));
62
+ for (auto it = updatesRegistry_.begin(); it != updatesRegistry_.end();) {
63
+ const auto viewTag = it->first;
64
+
65
+ if (syncedTags_.contains(viewTag)) {
66
+ // React already has the latest value for this tag (synced on a previous
67
+ // call, so the `settledProps` state is committed by now) — the registry
68
+ // entry is redundant. `syncedTags_` is intentionally retained to detect
69
+ // re-animation staleness. Note that `syncedTags_` and `invalidatedTags_`
70
+ // are disjoint — `update()` moves tags from the former to the latter.
71
+ timestampMap_.erase(viewTag);
72
+ it = updatesRegistry_.erase(it);
73
+ continue;
74
+ }
75
+
76
+ const auto timestampIt = timestampMap_.find(viewTag);
77
+ if (timestampIt == timestampMap_.end()) {
78
+ ++it;
79
+ continue;
44
80
  }
81
+ const bool isSettled = timestampIt->second < settledTimestamp;
82
+ const auto invalidatedIt = invalidatedTags_.find(viewTag);
83
+ const bool isInvalidated = invalidatedIt != invalidatedTags_.end();
84
+ if (isSettled || isInvalidated) {
85
+ updates.emplace_back(viewTag, std::cref(it->second.second));
86
+ if (isSettled) {
87
+ // Only settled-path tags are tracked as "synced" so that an ongoing
88
+ // animation doesn't re-trigger an invalidation/sync on every GC tick.
89
+ syncedTags_.insert(viewTag);
90
+ }
91
+ if (isInvalidated) {
92
+ // Only erase serviced invalidations; if a tag was invalidated but the
93
+ // matching update batch hasn't been flushed into updatesRegistry_ yet,
94
+ // we leave the entry so the next sync picks it up.
95
+ invalidatedTags_.erase(invalidatedIt);
96
+ }
97
+ }
98
+ ++it;
45
99
  }
46
100
 
47
101
  const jsi::Array array(rt, updates.size());
@@ -56,17 +110,11 @@ jsi::Value AnimatedPropsRegistry::getUpdatesOlderThanTimestamp(jsi::Runtime &rt,
56
110
  return jsi::Value(rt, array);
57
111
  }
58
112
 
59
- void AnimatedPropsRegistry::removeUpdatesOlderThanTimestamp(const double timestamp) {
60
- for (auto it = timestampMap_.begin(); it != timestampMap_.end();) {
61
- const auto viewTag = it->first;
62
- const auto viewTimestamp = it->second;
63
- if (viewTimestamp < timestamp) {
64
- it = timestampMap_.erase(it);
65
- updatesRegistry_.erase(viewTag);
66
- } else {
67
- it++;
68
- }
69
- }
113
+ void AnimatedPropsRegistry::removeTag(const Tag tag) {
114
+ updatesRegistry_.erase(tag);
115
+ timestampMap_.erase(tag);
116
+ syncedTags_.erase(tag);
117
+ invalidatedTags_.erase(tag);
70
118
  }
71
119
 
72
120
  } // namespace reanimated
@@ -4,22 +4,32 @@
4
4
 
5
5
  #include <react/renderer/uimanager/UIManager.h>
6
6
 
7
- #include <memory>
8
- #include <string>
9
7
  #include <unordered_map>
10
- #include <vector>
8
+ #include <unordered_set>
11
9
 
12
10
  namespace reanimated {
13
11
 
14
12
  class AnimatedPropsRegistry : public UpdatesRegistry {
15
13
  public:
16
14
  void update(jsi::Runtime &rt, const jsi::Value &operations, double timestamp);
17
- void remove(Tag tag) override;
18
- jsi::Value getUpdatesOlderThanTimestamp(jsi::Runtime &rt, double timestamp);
19
- void removeUpdatesOlderThanTimestamp(double timestamp);
15
+
16
+ /// Returns updates that settled (received no update since `settledTimestamp`)
17
+ /// or whose synced `settledProps` snapshot was invalidated by a fresh update.
18
+ /// Also evicts entries that have already been synced to React — by the time
19
+ /// of the next call, the corresponding `settledProps` state is guaranteed to
20
+ /// be committed, so the registry entries are redundant.
21
+ jsi::Value collectSettledUpdates(jsi::Runtime &rt, double settledTimestamp);
20
22
 
21
23
  private:
22
- std::unordered_map<Tag, double> timestampMap_; // viewTag -> timestamp, protected by `mutex_`
24
+ std::unordered_map<Tag, double> timestampMap_;
25
+ // Tags whose latest values have already been pushed to React `settledProps`.
26
+ // Intentionally retained after eviction to detect re-animation staleness.
27
+ std::unordered_set<Tag> syncedTags_;
28
+ // Tags that were synced to React but received a fresh worklet update since;
29
+ // their `settledProps` are stale and need to be refreshed on the next sync.
30
+ std::unordered_set<Tag> invalidatedTags_;
31
+
32
+ void removeTag(Tag tag) override;
23
33
  };
24
34
 
25
35
  } // namespace reanimated
@@ -0,0 +1,152 @@
1
+ #include <reanimated/Fabric/updates/OperationsLoop.h>
2
+ #include <reanimated/Fabric/updates/UpdatesRegistryManager.h>
3
+
4
+ #include <utility>
5
+
6
+ namespace reanimated {
7
+
8
+ OperationsLoop::OperationsLoop(
9
+ const std::shared_ptr<worklets::UIScheduler> &uiScheduler,
10
+ const RequestRenderFunction &requestRender,
11
+ const GetAnimationTimestampFunction &getTimestamp,
12
+ const std::shared_ptr<UpdatesRegistryManager> &updatesRegistryManager)
13
+ : uiScheduler_(uiScheduler),
14
+ requestRender_(requestRender),
15
+ getTimestamp_(getTimestamp),
16
+ updatesRegistryManager_(updatesRegistryManager) {}
17
+
18
+ double OperationsLoop::resolveTimestamp() {
19
+ // Fast path: cache hit is lock-free.
20
+ if (const double cached = currentTimestamp_.load(std::memory_order_acquire); cached > 0) {
21
+ return cached;
22
+ }
23
+
24
+ // Slow path: try to win the cache fill. If someone else already filled it, use theirs.
25
+ const double fresh = getTimestamp_();
26
+ double expected = 0;
27
+ if (!currentTimestamp_.compare_exchange_strong(expected, fresh, std::memory_order_acq_rel)) {
28
+ return expected;
29
+ }
30
+
31
+ // We filled the cache - make sure a frame is scheduled to invalidate it.
32
+ maybeScheduleFrame();
33
+ return fresh;
34
+ }
35
+
36
+ bool OperationsLoop::hasOngoingOperations() const {
37
+ std::lock_guard<std::mutex> lock(queueMutex_);
38
+ return !scheduledOperations_.empty() || !activeOps_.empty() || !delayedOps_.empty();
39
+ }
40
+
41
+ void OperationsLoop::schedule(std::shared_ptr<LoopOperation> operation, double startTimestamp) {
42
+ enqueue({std::move(operation), startTimestamp});
43
+ }
44
+
45
+ void OperationsLoop::remove(const std::shared_ptr<LoopOperation> &operation) {
46
+ enqueue({operation, std::nullopt});
47
+ }
48
+
49
+ void OperationsLoop::update() {
50
+ auto [operations, timestamp] = beginFrame();
51
+ applyScheduledOperations(std::move(operations), timestamp);
52
+ activateDelayedOperations(timestamp);
53
+ updateActiveOperations(timestamp);
54
+ endFrame();
55
+ }
56
+
57
+ void OperationsLoop::enqueue(ScheduledOperation operation) {
58
+ {
59
+ std::lock_guard<std::mutex> lock(queueMutex_);
60
+ scheduledOperations_.emplace_back(std::move(operation));
61
+ }
62
+
63
+ maybeScheduleFrame();
64
+ }
65
+
66
+ void OperationsLoop::maybeScheduleFrame() {
67
+ // No-op if a frame is already scheduled - flips the flag and returns true if so.
68
+ if (frameRequested_.exchange(true, std::memory_order_acq_rel)) {
69
+ return;
70
+ }
71
+
72
+ worklets::scheduleOnUI(uiScheduler_, [weakThis = weak_from_this()]() {
73
+ auto strongThis = weakThis.lock();
74
+ if (!strongThis) {
75
+ return;
76
+ }
77
+ strongThis->requestRender_([weakThis](double /*frameTimestamp*/) {
78
+ if (auto strongThis = weakThis.lock()) {
79
+ strongThis->update();
80
+ }
81
+ });
82
+ });
83
+ }
84
+
85
+ std::pair<std::vector<OperationsLoop::ScheduledOperation>, double> OperationsLoop::beginFrame() {
86
+ const double freshTimestamp = getTimestamp_();
87
+
88
+ std::vector<ScheduledOperation> drained;
89
+ {
90
+ // Reset frameRequested_ together with the drain so an enqueue() can't slip a push
91
+ // in between (which would see the flag still true and skip scheduling).
92
+ std::lock_guard<std::mutex> lock(queueMutex_);
93
+ drained = std::exchange(scheduledOperations_, {});
94
+ frameRequested_.store(false, std::memory_order_release);
95
+ }
96
+
97
+ currentTimestamp_.store(freshTimestamp, std::memory_order_release);
98
+
99
+ return {std::move(drained), freshTimestamp};
100
+ }
101
+
102
+ void OperationsLoop::endFrame() {
103
+ // activeOps_ / delayedOps_ are touched only on the UI thread, so we can read them lock-free.
104
+ // We don't check the scheduledOperations_ queue: enqueue() schedules its own frame, so any
105
+ // pushes that arrived during update() have already requested a frame on their own.
106
+ const bool hasOngoingOperations = !activeOps_.empty() || !delayedOps_.empty();
107
+
108
+ currentTimestamp_.store(0, std::memory_order_release);
109
+
110
+ if (hasOngoingOperations) {
111
+ maybeScheduleFrame();
112
+ }
113
+ }
114
+
115
+ void OperationsLoop::applyScheduledOperations(std::vector<ScheduledOperation> operations, double timestamp) {
116
+ for (auto &op : operations) {
117
+ // Remove any prior scheduling for this operation.
118
+ activeOps_.erase(op.operation);
119
+ if (auto it = delayedLookup_.find(op.operation); it != delayedLookup_.end()) {
120
+ delayedOps_.erase(it->second);
121
+ delayedLookup_.erase(it);
122
+ }
123
+
124
+ if (!op.insertAt) {
125
+ continue;
126
+ }
127
+
128
+ const double insertAt = *op.insertAt;
129
+ if (insertAt <= timestamp) {
130
+ activeOps_.insert(std::move(op.operation));
131
+ } else {
132
+ auto it = delayedOps_.insert({insertAt, op.operation}).first;
133
+ delayedLookup_.emplace(std::move(op.operation), it);
134
+ }
135
+ }
136
+ }
137
+
138
+ void OperationsLoop::activateDelayedOperations(double timestamp) {
139
+ while (!delayedOps_.empty() && delayedOps_.begin()->activateAt <= timestamp) {
140
+ auto it = delayedOps_.begin();
141
+ delayedLookup_.erase(it->operation);
142
+ activeOps_.insert(it->operation);
143
+ delayedOps_.erase(it);
144
+ }
145
+ }
146
+
147
+ void OperationsLoop::updateActiveOperations(double timestamp) {
148
+ auto lock = updatesRegistryManager_->lock();
149
+ std::erase_if(activeOps_, [&](auto &op) { return !op->update(timestamp, *this); });
150
+ }
151
+
152
+ } // namespace reanimated
@@ -0,0 +1,86 @@
1
+ #pragma once
2
+
3
+ #include <reanimated/Tools/PlatformDepMethodsHolder.h>
4
+
5
+ #include <worklets/Compat/StableApi.h>
6
+
7
+ #include <atomic>
8
+ #include <memory>
9
+ #include <mutex>
10
+ #include <optional>
11
+ #include <set>
12
+ #include <tuple>
13
+ #include <unordered_map>
14
+ #include <unordered_set>
15
+ #include <utility>
16
+ #include <vector>
17
+
18
+ namespace reanimated {
19
+
20
+ class UpdatesRegistryManager;
21
+
22
+ class OperationsLoop : public std::enable_shared_from_this<OperationsLoop> {
23
+ public:
24
+ class LoopOperation {
25
+ public:
26
+ virtual ~LoopOperation() = default;
27
+ virtual bool update(double timestamp, OperationsLoop &loop) = 0;
28
+ };
29
+
30
+ OperationsLoop(
31
+ const std::shared_ptr<worklets::UIScheduler> &uiScheduler,
32
+ const RequestRenderFunction &requestRender,
33
+ const GetAnimationTimestampFunction &getTimestamp,
34
+ const std::shared_ptr<UpdatesRegistryManager> &updatesRegistryManager);
35
+
36
+ double resolveTimestamp();
37
+
38
+ // True if anything is queued, active, or delayed in the loop.
39
+ bool hasOngoingOperations() const;
40
+
41
+ void schedule(std::shared_ptr<LoopOperation> operation, double startTimestamp);
42
+ void remove(const std::shared_ptr<LoopOperation> &operation);
43
+
44
+ private:
45
+ struct ScheduledOperation {
46
+ std::shared_ptr<LoopOperation> operation;
47
+ std::optional<double> insertAt; // nullopt means remove
48
+ };
49
+
50
+ struct DelayedEntry {
51
+ double activateAt;
52
+ std::shared_ptr<LoopOperation> operation;
53
+
54
+ bool operator<(const DelayedEntry &other) const {
55
+ return std::tie(activateAt, operation) < std::tie(other.activateAt, other.operation);
56
+ }
57
+ };
58
+
59
+ const std::shared_ptr<worklets::UIScheduler> uiScheduler_;
60
+ const RequestRenderFunction requestRender_;
61
+ const GetAnimationTimestampFunction getTimestamp_;
62
+ const std::shared_ptr<UpdatesRegistryManager> updatesRegistryManager_;
63
+
64
+ mutable std::mutex queueMutex_;
65
+ std::vector<ScheduledOperation> scheduledOperations_;
66
+
67
+ std::atomic<bool> frameRequested_{false};
68
+ std::atomic<double> currentTimestamp_{0};
69
+
70
+ std::unordered_set<std::shared_ptr<LoopOperation>> activeOps_;
71
+ std::set<DelayedEntry> delayedOps_;
72
+ std::unordered_map<std::shared_ptr<LoopOperation>, std::set<DelayedEntry>::iterator> delayedLookup_;
73
+
74
+ void update();
75
+ void enqueue(ScheduledOperation operation);
76
+
77
+ void maybeScheduleFrame();
78
+
79
+ std::pair<std::vector<ScheduledOperation>, double> beginFrame();
80
+ void endFrame();
81
+ void applyScheduledOperations(std::vector<ScheduledOperation> operations, double timestamp);
82
+ void activateDelayedOperations(double timestamp);
83
+ void updateActiveOperations(double timestamp);
84
+ };
85
+
86
+ } // namespace reanimated
@@ -0,0 +1,98 @@
1
+ #pragma once
2
+
3
+ #include <jsi/jsi.h>
4
+
5
+ #include <cxxreact/ReactNativeVersion.h>
6
+
7
+ #if REACT_NATIVE_VERSION_MINOR >= 85
8
+ #include <react/featureflags/ReactNativeFeatureFlags.h>
9
+ #include <reanimated/Fabric/updates/propNameFromString.h>
10
+
11
+ #include <react/renderer/animationbackend/AnimatedProps.h>
12
+
13
+ #include <set>
14
+
15
+ namespace reanimated {
16
+
17
+ // On Android, non-layout props need to be packed into the rawProps unless props 2.0 are enabled.
18
+ inline bool shouldFilterNonLayoutProps() {
19
+ #ifdef ANDROID
20
+ return !facebook::react::ReactNativeFeatureFlags::enablePropsUpdateReconciliationAndroid();
21
+ #else
22
+ return false;
23
+ #endif
24
+ }
25
+
26
+ inline bool isLayoutProp(facebook::react::PropName propName) {
27
+ static const std::set<facebook::react::PropName> layoutPropNames = {
28
+ facebook::react::WIDTH, facebook::react::HEIGHT, facebook::react::FLEX,
29
+ facebook::react::MARGIN, facebook::react::PADDING, facebook::react::POSITION,
30
+ facebook::react::BORDER_WIDTH, facebook::react::ALIGN_CONTENT, facebook::react::ALIGN_ITEMS,
31
+ facebook::react::ALIGN_SELF, facebook::react::ASPECT_RATIO, facebook::react::BOX_SIZING,
32
+ facebook::react::DISPLAY, facebook::react::FLEX_BASIS, facebook::react::FLEX_DIRECTION,
33
+ facebook::react::ROW_GAP, facebook::react::COLUMN_GAP, facebook::react::FLEX_GROW,
34
+ facebook::react::FLEX_SHRINK, facebook::react::FLEX_WRAP, facebook::react::JUSTIFY_CONTENT,
35
+ facebook::react::MAX_HEIGHT, facebook::react::MAX_WIDTH, facebook::react::MIN_HEIGHT,
36
+ facebook::react::MIN_WIDTH, facebook::react::STYLE_OVERFLOW, facebook::react::POSITION_TYPE,
37
+ facebook::react::DIRECTION, facebook::react::Z_INDEX,
38
+ };
39
+ return layoutPropNames.contains(propName);
40
+ }
41
+
42
+ inline bool shouldSkipNonLayoutProp(facebook::react::PropName propName) {
43
+ if (shouldFilterNonLayoutProps()) {
44
+ return !isLayoutProp(propName);
45
+ }
46
+ return false;
47
+ }
48
+
49
+ inline bool animatedPropsContainLayoutProps(const facebook::react::AnimatedProps &animatedProps) {
50
+ for (const auto &prop : animatedProps.props) {
51
+ if (isLayoutProp(prop->propName)) {
52
+ return true;
53
+ }
54
+ }
55
+
56
+ if (!animatedProps.rawProps) {
57
+ return false;
58
+ }
59
+
60
+ const auto rawPropsDynamic = animatedProps.rawProps->toDynamic();
61
+ for (const auto &key : rawPropsDynamic.keys()) {
62
+ const auto propName = propNameFromString(key.asString());
63
+ if (propName.has_value() && isLayoutProp(propName.value())) {
64
+ return true;
65
+ }
66
+ }
67
+
68
+ return false;
69
+ }
70
+
71
+ inline bool hasLayoutProps(const folly::dynamic &props) {
72
+ for (const auto &key : props.keys()) {
73
+ const auto propName = propNameFromString(key.asString());
74
+ if (propName.has_value() && isLayoutProp(propName.value())) {
75
+ return true;
76
+ }
77
+ }
78
+ return false;
79
+ }
80
+
81
+ inline bool hasLayoutProps(facebook::jsi::Runtime &rt, const facebook::jsi::Value &value) {
82
+ facebook::jsi::Object obj = value.asObject(rt);
83
+ facebook::jsi::Array names = obj.getPropertyNames(rt);
84
+ const size_t n = names.size(rt);
85
+ for (size_t ki = 0; ki < n; ++ki) {
86
+ facebook::jsi::Value keyVal = names.getValueAtIndex(rt, ki);
87
+ const auto keyStr = keyVal.asString(rt).utf8(rt);
88
+ const auto propName = propNameFromString(keyStr);
89
+ if (propName.has_value() && isLayoutProp(propName.value())) {
90
+ return true;
91
+ }
92
+ }
93
+ return false;
94
+ }
95
+
96
+ } // namespace reanimated
97
+
98
+ #endif