@react-native-ohos/react-native-reanimated 3.18.1-rc.6 → 4.0.0-rc.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 (275) hide show
  1. package/compatibility.json +161 -0
  2. package/harmony/reanimated/BuildProfile.ets +1 -1
  3. package/harmony/reanimated/build-profile.json5 +8 -1
  4. package/harmony/reanimated/oh-package.json5 +3 -2
  5. package/harmony/reanimated/src/main/cpp/CMakeLists.txt +31 -40
  6. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.cpp +11 -16
  7. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.h +3 -4
  8. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/InterpolatorRegistry.cpp +390 -0
  9. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/InterpolatorRegistry.h +16 -0
  10. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/definitions.h +30 -0
  11. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/filters/FilterOp.cpp +46 -0
  12. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/filters/FilterOp.h +23 -0
  13. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/Quaternion.cpp +53 -0
  14. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/Quaternion.h +21 -0
  15. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformMatrix.cpp +166 -0
  16. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformMatrix.h +71 -0
  17. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformMatrix2D.cpp +368 -0
  18. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformMatrix2D.h +53 -0
  19. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformMatrix3D.cpp +594 -0
  20. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformMatrix3D.h +67 -0
  21. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformOp.cpp +52 -0
  22. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformOp.h +26 -0
  23. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/vectors.cpp +156 -0
  24. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/vectors.h +76 -0
  25. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSAngle.cpp +93 -0
  26. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSAngle.h +33 -0
  27. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSBoolean.cpp +48 -0
  28. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSBoolean.h +31 -0
  29. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSColor.cpp +135 -0
  30. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSColor.h +61 -0
  31. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSDiscreteArray.cpp +100 -0
  32. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSDiscreteArray.h +44 -0
  33. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSKeyword.cpp +81 -0
  34. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSKeyword.h +53 -0
  35. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSLength.cpp +122 -0
  36. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSLength.h +38 -0
  37. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSNumber.cpp +82 -0
  38. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSNumber.h +63 -0
  39. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSValue.h +118 -0
  40. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSValueVariant.cpp +174 -0
  41. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSValueVariant.h +111 -0
  42. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/complex/CSSBoxShadow.cpp +196 -0
  43. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/complex/CSSBoxShadow.h +66 -0
  44. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/complex/CSSDropShadow.cpp +134 -0
  45. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/complex/CSSDropShadow.h +44 -0
  46. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSAnimationConfig.cpp +174 -0
  47. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSAnimationConfig.h +49 -0
  48. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSKeyframesConfig.cpp +45 -0
  49. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSKeyframesConfig.h +26 -0
  50. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSTransitionConfig.cpp +90 -0
  51. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSTransitionConfig.h +43 -0
  52. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/common.cpp +17 -0
  53. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/common.h +13 -0
  54. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSAnimation.cpp +127 -0
  55. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSAnimation.h +51 -0
  56. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSTransition.cpp +145 -0
  57. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSTransition.h +47 -0
  58. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/EasingFunctions.cpp +69 -0
  59. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/EasingFunctions.h +22 -0
  60. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/cubicBezier.cpp +66 -0
  61. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/cubicBezier.h +15 -0
  62. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/linear.cpp +28 -0
  63. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/linear.h +15 -0
  64. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/steps.cpp +13 -0
  65. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/steps.h +12 -0
  66. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/InterpolatorFactory.cpp +157 -0
  67. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/InterpolatorFactory.h +189 -0
  68. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/PropertyInterpolator.cpp +76 -0
  69. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/PropertyInterpolator.h +66 -0
  70. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/configs.h +20 -0
  71. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterOperation.cpp +136 -0
  72. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterOperation.h +40 -0
  73. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterOperationInterpolator.cpp +38 -0
  74. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterOperationInterpolator.h +24 -0
  75. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterStyleInterpolator.cpp +58 -0
  76. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterStyleInterpolator.h +24 -0
  77. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/blur.h +14 -0
  78. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/brightness.h +14 -0
  79. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/contrast.h +14 -0
  80. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/dropShadow.h +17 -0
  81. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/grayscale.h +14 -0
  82. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/hueRotate.h +14 -0
  83. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/invert.h +14 -0
  84. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/opacity.h +14 -0
  85. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/saturate.h +14 -0
  86. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/sepia.h +14 -0
  87. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/ArrayPropertiesInterpolator.cpp +95 -0
  88. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/ArrayPropertiesInterpolator.h +36 -0
  89. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/GroupPropertiesInterpolator.cpp +41 -0
  90. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/GroupPropertiesInterpolator.h +32 -0
  91. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/RecordPropertiesInterpolator.cpp +99 -0
  92. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/RecordPropertiesInterpolator.h +37 -0
  93. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/OperationsStyleInterpolator.cpp +308 -0
  94. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/OperationsStyleInterpolator.h +100 -0
  95. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/StyleOperation.cpp +19 -0
  96. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/StyleOperation.h +94 -0
  97. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/StyleOperationInterpolator.cpp +18 -0
  98. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/StyleOperationInterpolator.h +43 -0
  99. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/AnimationStyleInterpolator.h +26 -0
  100. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/TransitionStyleInterpolator.cpp +103 -0
  101. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/TransitionStyleInterpolator.h +42 -0
  102. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperation.cpp +224 -0
  103. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperation.h +52 -0
  104. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperationInterpolator.cpp +218 -0
  105. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperationInterpolator.h +89 -0
  106. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformsStyleInterpolator.cpp +149 -0
  107. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformsStyleInterpolator.h +33 -0
  108. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/matrix.cpp +208 -0
  109. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/matrix.h +56 -0
  110. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/perspective.cpp +42 -0
  111. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/perspective.h +20 -0
  112. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/rotate.cpp +41 -0
  113. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/rotate.h +39 -0
  114. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/scale.cpp +28 -0
  115. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/scale.h +25 -0
  116. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/skew.cpp +14 -0
  117. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/skew.h +20 -0
  118. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/translate.cpp +39 -0
  119. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/translate.h +25 -0
  120. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ResolvableValueInterpolator.cpp +47 -0
  121. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ResolvableValueInterpolator.h +43 -0
  122. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/SimpleValueInterpolator.cpp +70 -0
  123. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/SimpleValueInterpolator.h +40 -0
  124. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ValueInterpolator.cpp +146 -0
  125. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ValueInterpolator.h +71 -0
  126. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/misc/ViewStylesRepository.cpp +155 -0
  127. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/misc/ViewStylesRepository.h +53 -0
  128. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/AnimationProgressProvider.cpp +170 -0
  129. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/AnimationProgressProvider.h +67 -0
  130. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/KeyframeProgressProvider.h +12 -0
  131. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/RawProgressProvider.cpp +41 -0
  132. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/RawProgressProvider.h +31 -0
  133. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/TransitionProgressProvider.cpp +193 -0
  134. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/TransitionProgressProvider.h +77 -0
  135. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSAnimationsRegistry.cpp +340 -0
  136. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSAnimationsRegistry.h +80 -0
  137. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSKeyframesRegistry.cpp +45 -0
  138. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSKeyframesRegistry.h +29 -0
  139. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSTransitionsRegistry.cpp +167 -0
  140. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSTransitionsRegistry.h +51 -0
  141. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/StaticPropsRegistry.cpp +61 -0
  142. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/StaticPropsRegistry.h +33 -0
  143. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGBrush.cpp +80 -0
  144. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGBrush.h +39 -0
  145. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGLength.cpp +93 -0
  146. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGLength.h +36 -0
  147. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGStrokeDashArray.cpp +110 -0
  148. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGStrokeDashArray.h +33 -0
  149. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/DelayedItemsManager.cpp +75 -0
  150. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/DelayedItemsManager.h +45 -0
  151. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/algorithms.cpp +12 -0
  152. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/algorithms.h +10 -0
  153. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/interpolators.cpp +36 -0
  154. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/interpolators.h +23 -0
  155. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/props.cpp +149 -0
  156. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/props.h +32 -0
  157. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.cpp +51 -39
  158. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.h +13 -15
  159. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitShadowNode.h +0 -3
  160. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.cpp +22 -53
  161. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.h +12 -8
  162. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.cpp +46 -37
  163. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.h +3 -10
  164. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.cpp +72 -0
  165. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.h +25 -0
  166. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistry.cpp +160 -0
  167. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistry.h +71 -0
  168. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistryManager.cpp +161 -0
  169. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistryManager.h +65 -0
  170. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationType.h +4 -2
  171. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.cpp +62 -157
  172. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.h +38 -46
  173. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.cpp +79 -0
  174. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.h +81 -0
  175. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.cpp +864 -0
  176. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.h +214 -0
  177. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/{LayoutAnimationsProxy.cpp → LayoutAnimationsProxy_Legacy.cpp} +303 -276
  178. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.h +220 -0
  179. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.cpp +5 -65
  180. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.h +52 -82
  181. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/PropsDiffer.cpp +456 -0
  182. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/PropsDiffer.h +102 -0
  183. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/SharedTransitions.cpp +544 -0
  184. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/PropValueProcessor.cpp +119 -0
  185. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/PropValueProcessor.h +39 -0
  186. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.cpp +957 -552
  187. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.h +87 -111
  188. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.cpp +115 -163
  189. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.h +38 -54
  190. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.cpp +34 -36
  191. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.h +8 -0
  192. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.cpp +46 -58
  193. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.h +5 -9
  194. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeatureFlags.cpp +18 -0
  195. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeatureFlags.h +44 -0
  196. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/PlatformDepMethodsHolder.h +26 -57
  197. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReanimatedSystraceSection.h +12 -33
  198. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReanimatedVersion.cpp +46 -0
  199. package/harmony/reanimated/src/main/cpp/Common/cpp/{worklets → reanimated}/Tools/ReanimatedVersion.h +3 -4
  200. package/harmony/reanimated/src/main/cpp/ReanimatedModule.cpp +60 -85
  201. package/harmony/reanimated/src/main/cpp/ReanimatedNodesManager.cpp +1 -0
  202. package/harmony/reanimated/src/main/cpp/ReanimatedPackage.cpp +0 -3
  203. package/harmony/reanimated/src/main/cpp/ReanimatedSensor.cpp +266 -0
  204. package/harmony/reanimated/src/main/cpp/ReanimatedSensor.h +36 -0
  205. package/harmony/reanimated/src/main/cpp/ReanimatedSensorContainer.cpp +36 -0
  206. package/harmony/reanimated/src/main/cpp/ReanimatedSensorContainer.h +23 -0
  207. package/harmony/reanimated/src/main/cpp/ReanimatedUIScheduler.h +3 -3
  208. package/harmony/reanimated/src/main/ets/ReanimatedModule.ts +12 -1
  209. package/harmony/reanimated/src/main/ets/ReanimatedPackage.ts +1 -4
  210. package/harmony/reanimated.har +0 -0
  211. package/package.json +36 -18
  212. package/scripts/deploy.js +191 -0
  213. package/scripts/set-reanimated-version.js +37 -0
  214. package/scripts/update-version.js +119 -0
  215. package/scripts/validate-react-native-version.js +46 -0
  216. package/scripts/validate-worklets-build.js +17 -0
  217. package/scripts/validate-worklets-version.js +79 -0
  218. package/scripts/worklets-version.json +4 -0
  219. package/LICENSE +0 -21
  220. package/README.OpenSource +0 -11
  221. package/README.md +0 -10
  222. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/PropsRegistry.cpp +0 -68
  223. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/PropsRegistry.h +0 -68
  224. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy.h +0 -147
  225. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/CollectionUtils.h +0 -14
  226. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeaturesConfig.cpp +0 -5
  227. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeaturesConfig.h +0 -19
  228. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.cpp +0 -47
  229. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.h +0 -59
  230. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxySpec.cpp +0 -27
  231. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxySpec.h +0 -25
  232. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/EventHandlerRegistry.cpp +0 -94
  233. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/EventHandlerRegistry.h +0 -49
  234. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.cpp +0 -8
  235. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.h +0 -39
  236. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/SharedItems/Shareables.cpp +0 -326
  237. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/SharedItems/Shareables.h +0 -345
  238. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/AsyncQueue.cpp +0 -52
  239. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/AsyncQueue.h +0 -35
  240. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/Defs.h +0 -10
  241. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSISerializer.cpp +0 -342
  242. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSISerializer.h +0 -47
  243. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSLogger.cpp +0 -16
  244. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSLogger.h +0 -20
  245. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSScheduler.cpp +0 -20
  246. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSScheduler.h +0 -29
  247. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/PlatformLogger.h +0 -16
  248. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedJSIUtils.cpp +0 -26
  249. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedJSIUtils.h +0 -199
  250. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedVersion.cpp +0 -95
  251. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/SingleInstanceChecker.h +0 -72
  252. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ThreadSafeQueue.h +0 -49
  253. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/UIScheduler.cpp +0 -20
  254. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/UIScheduler.h +0 -22
  255. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/WorkletEventHandler.cpp +0 -29
  256. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/WorkletEventHandler.h +0 -41
  257. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.cpp +0 -16
  258. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.h +0 -19
  259. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedHermesRuntime.cpp +0 -112
  260. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedHermesRuntime.h +0 -127
  261. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedRuntime.cpp +0 -53
  262. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedRuntime.h +0 -22
  263. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RuntimeInitialization.md +0 -191
  264. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.cpp +0 -155
  265. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.h +0 -90
  266. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeCollector.h +0 -36
  267. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp +0 -182
  268. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.h +0 -22
  269. package/harmony/reanimated/src/main/cpp/ReanimatedLogger.cpp +0 -33
  270. package/harmony/reanimated/src/main/cpp/WorkletsModule.cpp +0 -61
  271. package/harmony/reanimated/src/main/cpp/WorkletsModule.h +0 -22
  272. package/harmony/reanimated/src/main/cpp/patches/AnimatedSensor/AnimatedSensorModule.cpp +0 -89
  273. package/harmony/reanimated/src/main/cpp/patches/Fabric/ShadowTreeCloner.cpp +0 -95
  274. package/harmony/reanimated/src/main/cpp/patches/NativeModules/ReanimatedModuleProxy.cpp +0 -964
  275. package/harmony/reanimated/src/main/ets/WorkletsModule.ts +0 -15
@@ -1,13 +1,17 @@
1
- #ifdef RCT_NEW_ARCH_ENABLED
2
-
3
- #include <reanimated/LayoutAnimations/LayoutAnimationsProxy.h>
1
+ #include <reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.h>
4
2
  #include <reanimated/NativeModules/ReanimatedModuleProxy.h>
5
3
 
6
4
  #include <react/renderer/animations/utils.h>
7
5
  #include <react/renderer/mounting/ShadowViewMutation.h>
8
6
 
7
+ #include <memory>
8
+ #include <ranges>
9
9
  #include <set>
10
+ #include <string>
11
+ #include <unordered_map>
12
+ #include <unordered_set>
10
13
  #include <utility>
14
+ #include <vector>
11
15
 
12
16
  namespace reanimated {
13
17
 
@@ -18,39 +22,49 @@ namespace reanimated {
18
22
  // On android this code will be sometimes executed on the JS thread.
19
23
  // That's why we have to schedule some of animation manager function on the UI
20
24
  // thread
21
- std::optional<MountingTransaction> LayoutAnimationsProxy::pullTransaction(
25
+ std::optional<MountingTransaction> LayoutAnimationsProxy_Legacy::pullTransaction(
22
26
  SurfaceId surfaceId,
23
27
  MountingTransaction::Number transactionNumber,
24
28
  const TransactionTelemetry &telemetry,
25
29
  ShadowViewMutationList mutations) const {
26
30
  #ifdef LAYOUT_ANIMATIONS_LOGS
27
31
  LOG(INFO) << std::endl;
28
- LOG(INFO) << "pullTransaction " << std::this_thread::get_id() << " "
29
- << surfaceId << std::endl;
32
+ LOG(INFO) << "pullTransaction " << std::this_thread::get_id() << " " << surfaceId << std::endl;
30
33
  #endif
31
34
  auto lock = std::unique_lock<std::recursive_mutex>(mutex);
32
35
  PropsParserContext propsParserContext{surfaceId, *contextContainer_};
33
36
  ShadowViewMutationList filteredMutations;
37
+ auto &[deadNodes] = surfaceContext_[surfaceId];
34
38
 
35
39
  std::vector<std::shared_ptr<MutationNode>> roots;
36
- std::unordered_map<Tag, ShadowView> movedViews;
40
+ std::unordered_map<Tag, Tag> movedViews;
41
+
42
+ addOngoingAnimations(surfaceId, filteredMutations);
43
+
44
+ #ifdef ANDROID
45
+ restoreOpacityInCaseOfFlakyEnteringAnimation(surfaceId);
46
+ #endif // ANDROID
47
+ for (const auto tag : finishedAnimationTags_) {
48
+ auto &updateMap = surfaceManager.getUpdateMap(surfaceId);
49
+ layoutAnimations_.erase(tag);
50
+ updateMap.erase(tag);
51
+ }
52
+ finishedAnimationTags_.clear();
37
53
 
38
54
  parseRemoveMutations(movedViews, mutations, roots);
39
55
 
40
- handleRemovals(filteredMutations, roots);
56
+ auto shouldAnimate = !surfacesToRemove_.contains(surfaceId);
57
+ surfacesToRemove_.erase(surfaceId);
58
+ handleRemovals(filteredMutations, roots, deadNodes, shouldAnimate);
41
59
 
42
- handleUpdatesAndEnterings(
43
- filteredMutations, movedViews, mutations, propsParserContext, surfaceId);
60
+ handleUpdatesAndEnterings(filteredMutations, movedViews, mutations, propsParserContext, surfaceId);
44
61
 
45
62
  addOngoingAnimations(surfaceId, filteredMutations);
46
63
 
47
- return MountingTransaction{
48
- surfaceId, transactionNumber, std::move(filteredMutations), telemetry};
64
+ return MountingTransaction{surfaceId, transactionNumber, std::move(filteredMutations), telemetry};
49
65
  }
50
66
 
51
- std::optional<SurfaceId> LayoutAnimationsProxy::progressLayoutAnimation(
52
- int tag,
53
- const jsi::Object &newStyle) {
67
+ std::optional<SurfaceId> LayoutAnimationsProxy_Legacy::progressLayoutAnimation(int tag, const jsi::Object &newStyle) {
54
68
  #ifdef LAYOUT_ANIMATIONS_LOGS
55
69
  LOG(INFO) << "progress layout animation for tag " << tag << std::endl;
56
70
  #endif
@@ -65,35 +79,24 @@ std::optional<SurfaceId> LayoutAnimationsProxy::progressLayoutAnimation(
65
79
 
66
80
  maybeRestoreOpacity(layoutAnimation, newStyle);
67
81
 
68
- auto rawProps =
69
- std::make_shared<RawProps>(uiRuntime_, jsi::Value(uiRuntime_, newStyle));
82
+ auto rawProps = std::make_shared<RawProps>(uiRuntime_, jsi::Value(uiRuntime_, newStyle));
70
83
 
71
- PropsParserContext propsParserContext{
72
- layoutAnimation.finalView->surfaceId, *contextContainer_};
73
- #ifdef ANDROID
74
- rawProps = std::make_shared<RawProps>(folly::dynamic::merge(
75
- layoutAnimation.finalView->props->rawProps, (folly::dynamic)*rawProps));
84
+ PropsParserContext propsParserContext{layoutAnimation.finalView.surfaceId, *contextContainer_};
85
+ #ifdef RN_SERIALIZABLE_STATE
86
+ rawProps = std::make_shared<RawProps>(
87
+ folly::dynamic::merge(layoutAnimation.finalView.props->rawProps, (folly::dynamic)*rawProps));
76
88
  #endif
77
- auto newProps =
78
- getComponentDescriptorForShadowView(*layoutAnimation.finalView)
79
- .cloneProps(
80
- propsParserContext,
81
- layoutAnimation.finalView->props,
82
- std::move(*rawProps));
83
- auto &updateMap =
84
- surfaceManager.getUpdateMap(layoutAnimation.finalView->surfaceId);
85
- updateMap.insert_or_assign(
86
- tag, UpdateValues{newProps, Frame(uiRuntime_, newStyle)});
87
-
88
- return layoutAnimation.finalView->surfaceId;
89
+ auto newProps = getComponentDescriptorForShadowView(layoutAnimation.finalView)
90
+ .cloneProps(propsParserContext, layoutAnimation.finalView.props, std::move(*rawProps));
91
+ auto &updateMap = surfaceManager.getUpdateMap(layoutAnimation.finalView.surfaceId);
92
+ updateMap.insert_or_assign(tag, UpdateValues{newProps, Frame(uiRuntime_, newStyle)});
93
+
94
+ return layoutAnimation.finalView.surfaceId;
89
95
  }
90
96
 
91
- std::optional<SurfaceId> LayoutAnimationsProxy::endLayoutAnimation(
92
- int tag,
93
- bool shouldRemove) {
97
+ std::optional<SurfaceId> LayoutAnimationsProxy_Legacy::endLayoutAnimation(int tag, bool shouldRemove) {
94
98
  #ifdef LAYOUT_ANIMATIONS_LOGS
95
- LOG(INFO) << "end layout animation for " << tag << " - should remove "
96
- << shouldRemove << std::endl;
99
+ LOG(INFO) << "end layout animation for " << tag << " - should remove " << shouldRemove << std::endl;
97
100
  #endif
98
101
  auto lock = std::unique_lock<std::recursive_mutex>(mutex);
99
102
  auto layoutAnimationIt = layoutAnimations_.find(tag);
@@ -112,11 +115,8 @@ std::optional<SurfaceId> LayoutAnimationsProxy::endLayoutAnimation(
112
115
  layoutAnimation.count--;
113
116
  return {};
114
117
  }
115
-
116
- auto surfaceId = layoutAnimation.finalView->surfaceId;
117
- auto &updateMap = surfaceManager.getUpdateMap(surfaceId);
118
- layoutAnimations_.erase(tag);
119
- updateMap.erase(tag);
118
+ finishedAnimationTags_.push_back(tag);
119
+ auto surfaceId = layoutAnimation.finalView.surfaceId;
120
120
 
121
121
  if (!shouldRemove || !nodeForTag_.contains(tag)) {
122
122
  return {};
@@ -125,6 +125,7 @@ std::optional<SurfaceId> LayoutAnimationsProxy::endLayoutAnimation(
125
125
  auto node = nodeForTag_[tag];
126
126
  auto mutationNode = std::static_pointer_cast<MutationNode>(node);
127
127
  mutationNode->state = DEAD;
128
+ auto &[deadNodes] = surfaceContext_[surfaceId];
128
129
  deadNodes.insert(mutationNode);
129
130
 
130
131
  return surfaceId;
@@ -134,13 +135,12 @@ std::optional<SurfaceId> LayoutAnimationsProxy::endLayoutAnimation(
134
135
  Organizes removed views into a tree structure, allowing for convenient
135
136
  traversals and index maintenance
136
137
  */
137
- void LayoutAnimationsProxy::parseRemoveMutations(
138
- std::unordered_map<Tag, ShadowView> &movedViews,
138
+ void LayoutAnimationsProxy_Legacy::parseRemoveMutations(
139
+ std::unordered_map<Tag, Tag> &movedViews,
139
140
  ShadowViewMutationList &mutations,
140
141
  std::vector<std::shared_ptr<MutationNode>> &roots) const {
141
142
  std::set<Tag> deletedViews;
142
- std::unordered_map<Tag, std::vector<std::shared_ptr<MutationNode>>>
143
- childrenForTag, unflattenedChildrenForTag;
143
+ std::unordered_map<Tag, std::vector<std::shared_ptr<MutationNode>>> childrenForTag, unflattenedChildrenForTag;
144
144
 
145
145
  std::vector<std::shared_ptr<MutationNode>> mutationNodes;
146
146
 
@@ -153,24 +153,17 @@ void LayoutAnimationsProxy::parseRemoveMutations(
153
153
  if (mutation.type == ShadowViewMutation::Remove) {
154
154
  updateIndexForMutation(mutation);
155
155
  auto tag = mutation.oldChildShadowView.tag;
156
- #if REACT_NATIVE_MINOR_VERSION >= 78
157
156
  auto parentTag = mutation.parentTag;
158
- #else
159
- auto parentTag = mutation.parentShadowView.tag;
160
- #endif // REACT_NATIVE_MINOR_VERSION >= 78
161
157
  auto unflattenedParentTag = parentTag; // temporary
162
158
 
163
159
  std::shared_ptr<MutationNode> mutationNode;
164
- std::shared_ptr<Node> node = nodeForTag_[tag],
165
- parent = nodeForTag_[parentTag],
166
- unflattenedParent =
167
- nodeForTag_[unflattenedParentTag];
160
+ std::shared_ptr<Node> node = nodeForTag_[tag], parent = nodeForTag_[parentTag],
161
+ unflattenedParent = nodeForTag_[unflattenedParentTag];
168
162
 
169
163
  if (!node) {
170
164
  mutationNode = std::make_shared<MutationNode>(mutation);
171
165
  } else {
172
- mutationNode =
173
- std::make_shared<MutationNode>(mutation, std::move(*node));
166
+ mutationNode = std::make_shared<MutationNode>(mutation, std::move(*node));
174
167
  for (auto &subNode : mutationNode->children) {
175
168
  subNode->parent = mutationNode;
176
169
  }
@@ -180,8 +173,7 @@ void LayoutAnimationsProxy::parseRemoveMutations(
180
173
  }
181
174
  if (!deletedViews.contains(mutation.oldChildShadowView.tag)) {
182
175
  mutationNode->state = MOVED;
183
- movedViews.insert_or_assign(
184
- mutation.oldChildShadowView.tag, mutation.oldChildShadowView);
176
+ movedViews.insert_or_assign(mutation.oldChildShadowView.tag, -1);
185
177
  }
186
178
  nodeForTag_[tag] = mutationNode;
187
179
 
@@ -206,12 +198,16 @@ void LayoutAnimationsProxy::parseRemoveMutations(
206
198
  mutationNode->parent = parent;
207
199
  mutationNode->unflattenedParent = unflattenedParent;
208
200
  }
209
- if (mutation.type == ShadowViewMutation::Update &&
210
- movedViews.contains(mutation.newChildShadowView.tag)) {
201
+ if (mutation.type == ShadowViewMutation::Update && movedViews.contains(mutation.newChildShadowView.tag)) {
211
202
  auto node = nodeForTag_[mutation.newChildShadowView.tag];
212
203
  auto mutationNode = std::static_pointer_cast<MutationNode>(node);
213
204
  mutationNode->mutation.oldChildShadowView = mutation.oldChildShadowView;
214
- movedViews[mutation.newChildShadowView.tag] = mutation.oldChildShadowView;
205
+ }
206
+ }
207
+
208
+ for (const auto &mutation : mutations) {
209
+ if (mutation.type == ShadowViewMutation::Insert && movedViews.contains(mutation.newChildShadowView.tag)) {
210
+ movedViews[mutation.newChildShadowView.tag] = mutation.parentTag;
215
211
  }
216
212
  }
217
213
 
@@ -231,28 +227,29 @@ void LayoutAnimationsProxy::parseRemoveMutations(
231
227
  }
232
228
 
233
229
  for (auto &mutationNode : mutationNodes) {
234
- if (!mutationNode->unflattenedParent->isMutationMode()) {
230
+ if (!mutationNode->unflattenedParent->isMutationNode()) {
235
231
  roots.push_back(mutationNode);
236
232
  }
237
233
  }
238
234
  }
239
235
 
240
- void LayoutAnimationsProxy::handleRemovals(
236
+ void LayoutAnimationsProxy_Legacy::handleRemovals(
241
237
  ShadowViewMutationList &filteredMutations,
242
- std::vector<std::shared_ptr<MutationNode>> &roots) const {
238
+ std::vector<std::shared_ptr<MutationNode>> &roots,
239
+ std::unordered_set<std::shared_ptr<MutationNode>> &deadNodes,
240
+ bool shouldAnimate) const {
243
241
  // iterate from the end, so that children
244
242
  // with higher indices appear first in the mutations list
245
243
  for (auto it = roots.rbegin(); it != roots.rend(); it++) {
246
244
  auto &node = *it;
247
- if (!startAnimationsRecursively(
248
- node, true, true, false, filteredMutations)) {
245
+ if (!startAnimationsRecursively(node, true, shouldAnimate, false, filteredMutations)) {
249
246
  filteredMutations.push_back(node->mutation);
250
247
  node->unflattenedParent->removeChildFromUnflattenedTree(node); //???
251
248
  if (node->state != MOVED) {
252
249
  maybeCancelAnimation(node->tag);
253
- filteredMutations.push_back(ShadowViewMutation::DeleteMutation(
254
- node->mutation.oldChildShadowView));
250
+ filteredMutations.push_back(ShadowViewMutation::DeleteMutation(node->mutation.oldChildShadowView));
255
251
  nodeForTag_.erase(node->tag);
252
+ node->state = DELETED;
256
253
  #ifdef LAYOUT_ANIMATIONS_LOGS
257
254
  LOG(INFO) << "delete " << node->tag << std::endl;
258
255
  #endif
@@ -260,7 +257,7 @@ void LayoutAnimationsProxy::handleRemovals(
260
257
  }
261
258
  }
262
259
 
263
- for (auto node : deadNodes) {
260
+ for (const auto &node : deadNodes) {
264
261
  if (node->state != DELETED) {
265
262
  endAnimationsRecursively(node, filteredMutations);
266
263
  maybeDropAncestors(node->unflattenedParent, node, filteredMutations);
@@ -269,9 +266,9 @@ void LayoutAnimationsProxy::handleRemovals(
269
266
  deadNodes.clear();
270
267
  }
271
268
 
272
- void LayoutAnimationsProxy::handleUpdatesAndEnterings(
269
+ void LayoutAnimationsProxy_Legacy::handleUpdatesAndEnterings(
273
270
  ShadowViewMutationList &filteredMutations,
274
- const std::unordered_map<Tag, ShadowView> &movedViews,
271
+ const std::unordered_map<Tag, Tag> &movedViews,
275
272
  ShadowViewMutationList &mutations,
276
273
  const PropsParserContext &propsParserContext,
277
274
  SurfaceId surfaceId) const {
@@ -279,8 +276,7 @@ void LayoutAnimationsProxy::handleUpdatesAndEnterings(
279
276
  for (auto &mutation : mutations) {
280
277
  maybeUpdateWindowDimensions(mutation, surfaceId);
281
278
 
282
- Tag tag = mutation.type == ShadowViewMutation::Type::Create ||
283
- mutation.type == ShadowViewMutation::Type::Insert
279
+ Tag tag = mutation.type == ShadowViewMutation::Type::Create || mutation.type == ShadowViewMutation::Type::Insert
284
280
  ? mutation.newChildShadowView.tag
285
281
  : mutation.oldChildShadowView.tag;
286
282
 
@@ -292,13 +288,8 @@ void LayoutAnimationsProxy::handleUpdatesAndEnterings(
292
288
  case ShadowViewMutation::Type::Insert: {
293
289
  updateIndexForMutation(mutation);
294
290
 
295
- #if REACT_NATIVE_MINOR_VERSION >= 78
296
291
  const auto parentTag = mutation.parentTag;
297
292
  const auto mutationParent = parentTag;
298
- #else
299
- const auto parentTag = mutation.parentShadowView.tag;
300
- const auto mutationParent = mutation.parentShadowView;
301
- #endif // REACT_NATIVE_MINOR_VERSION >= 78
302
293
  if (nodeForTag_.contains(parentTag)) {
303
294
  nodeForTag_[parentTag]->applyMutationToIndices(mutation);
304
295
  }
@@ -308,25 +299,23 @@ void LayoutAnimationsProxy::handleUpdatesAndEnterings(
308
299
  if (layoutAnimationIt == layoutAnimations_.end()) {
309
300
  if (oldShadowViewsForReparentings.contains(tag)) {
310
301
  filteredMutations.push_back(ShadowViewMutation::InsertMutation(
311
- mutationParent,
312
- oldShadowViewsForReparentings[tag],
313
- mutation.index));
302
+ mutationParent, oldShadowViewsForReparentings[tag], mutation.index));
314
303
  } else {
315
304
  filteredMutations.push_back(mutation);
316
305
  }
317
306
  continue;
318
307
  }
319
308
 
320
- auto oldView = *layoutAnimationIt->second.currentView;
321
- filteredMutations.push_back(ShadowViewMutation::InsertMutation(
322
- mutationParent, oldView, mutation.index));
309
+ auto oldView = layoutAnimationIt->second.currentView;
310
+ filteredMutations.push_back(ShadowViewMutation::InsertMutation(mutationParent, oldView, mutation.index));
311
+ if (movedViews.contains(tag)) {
312
+ layoutAnimationIt->second.parentTag = movedViews.at(tag);
313
+ }
323
314
  continue;
324
315
  }
325
316
 
326
- transferConfigFromNativeID(
327
- mutation.newChildShadowView.props->nativeId,
328
- mutation.newChildShadowView.tag);
329
- if (!layoutAnimationsManager_->hasLayoutAnimation(tag, ENTERING)) {
317
+ transferConfigFromNativeID(mutation.newChildShadowView.props->nativeId, mutation.newChildShadowView.tag);
318
+ if (!layoutAnimationsManager_->hasLayoutAnimation(tag, LayoutAnimationType::ENTERING)) {
330
319
  filteredMutations.push_back(mutation);
331
320
  continue;
332
321
  }
@@ -335,17 +324,16 @@ void LayoutAnimationsProxy::handleUpdatesAndEnterings(
335
324
  filteredMutations.push_back(mutation);
336
325
 
337
326
  // temporarily set opacity to 0 to prevent flickering on android
338
- std::shared_ptr<ShadowView> newView =
339
- cloneViewWithoutOpacity(mutation, propsParserContext);
327
+ std::shared_ptr<ShadowView> newView = cloneViewWithoutOpacity(mutation, propsParserContext);
340
328
 
341
- filteredMutations.push_back(ShadowViewMutation::UpdateMutation(
342
- mutation.newChildShadowView, *newView, mutationParent));
329
+ filteredMutations.push_back(
330
+ ShadowViewMutation::UpdateMutation(mutation.newChildShadowView, *newView, mutationParent));
343
331
  break;
344
332
  }
345
333
 
346
334
  case ShadowViewMutation::Type::Update: {
347
335
  auto shouldAnimate = hasLayoutChanged(mutation);
348
- if (!layoutAnimationsManager_->hasLayoutAnimation(tag, LAYOUT) ||
336
+ if (!layoutAnimationsManager_->hasLayoutAnimation(tag, LayoutAnimationType::LAYOUT) ||
349
337
  (!shouldAnimate && !layoutAnimations_.contains(tag))) {
350
338
  // We should cancel any ongoing animation here to ensure that the
351
339
  // proper final state is reached for this view However, due to how
@@ -364,7 +352,12 @@ void LayoutAnimationsProxy::handleUpdatesAndEnterings(
364
352
  // store the oldChildShadowView, so that we can use this ShadowView when
365
353
  // the view is inserted
366
354
  oldShadowViewsForReparentings[tag] = mutation.oldChildShadowView;
367
- startLayoutAnimation(tag, mutation);
355
+ if (movedViews.contains(tag)) {
356
+ mutation.parentTag = movedViews.at(tag);
357
+ }
358
+ if (mutation.parentTag != -1) {
359
+ startLayoutAnimation(tag, mutation);
360
+ }
368
361
  break;
369
362
  }
370
363
 
@@ -379,11 +372,40 @@ void LayoutAnimationsProxy::handleUpdatesAndEnterings(
379
372
  }
380
373
  }
381
374
 
382
- void LayoutAnimationsProxy::addOngoingAnimations(
383
- SurfaceId surfaceId,
384
- ShadowViewMutationList &mutations) const {
375
+ void LayoutAnimationsProxy_Legacy::addOngoingAnimations(SurfaceId surfaceId, ShadowViewMutationList &mutations) const {
385
376
  auto &updateMap = surfaceManager.getUpdateMap(surfaceId);
377
+ #ifdef ANDROID
378
+ std::vector<int> tagsToUpdate;
379
+ tagsToUpdate.reserve(updateMap.size());
380
+
381
+ for (auto &[tag, updateValues] : updateMap) {
382
+ tagsToUpdate.push_back(tag);
383
+ }
384
+
385
+ auto maybeCorrectedTags = preserveMountedTags_(tagsToUpdate);
386
+ if (!maybeCorrectedTags.has_value()) {
387
+ return;
388
+ }
389
+
390
+ auto correctedTags = maybeCorrectedTags->get();
391
+
392
+ // since the map is not updated, we can assume that the ordering of tags in
393
+ // correctedTags matches the iterator
394
+ int i = -1;
395
+ #endif
386
396
  for (auto &[tag, updateValues] : updateMap) {
397
+ #ifdef ANDROID
398
+ i++;
399
+ if (correctedTags[i] == -1) {
400
+ // skip views that have not been mounted yet
401
+ // on Android we start entering animations from the JS thread
402
+ // so it might happen, that the first frame of the animation goes through
403
+ // before the view is first mounted
404
+ // https://github.com/software-mansion/react-native-reanimated/issues/7493
405
+ continue;
406
+ }
407
+ #endif
408
+
387
409
  auto layoutAnimationIt = layoutAnimations_.find(tag);
388
410
 
389
411
  if (layoutAnimationIt == layoutAnimations_.end()) {
@@ -391,35 +413,26 @@ void LayoutAnimationsProxy::addOngoingAnimations(
391
413
  }
392
414
 
393
415
  auto &layoutAnimation = layoutAnimationIt->second;
416
+ layoutAnimation.isViewAlreadyMounted = true;
417
+ auto newView = layoutAnimation.finalView;
418
+ newView.props = updateValues.newProps;
419
+ updateLayoutMetrics(newView.layoutMetrics, updateValues.frame);
394
420
 
395
- auto newView = std::make_shared<ShadowView>(*layoutAnimation.finalView);
396
- newView->props = updateValues.newProps;
397
- updateLayoutMetrics(newView->layoutMetrics, updateValues.frame);
398
-
399
- mutations.push_back(ShadowViewMutation::UpdateMutation(
400
- *layoutAnimation.currentView,
401
- *newView,
402
- #if REACT_NATIVE_MINOR_VERSION >= 78
403
- layoutAnimation.parentTag
404
- #else
405
- *layoutAnimation.parentView
406
- #endif // REACT_NATIVE_MINOR_VERSION >= 78
407
- ));
421
+ mutations.push_back(
422
+ ShadowViewMutation::UpdateMutation(layoutAnimation.currentView, newView, layoutAnimation.parentTag));
408
423
  layoutAnimation.currentView = newView;
409
424
  }
410
425
  updateMap.clear();
411
426
  }
412
427
 
413
- void LayoutAnimationsProxy::endAnimationsRecursively(
414
- std::shared_ptr<MutationNode> node,
428
+ void LayoutAnimationsProxy_Legacy::endAnimationsRecursively(
429
+ const std::shared_ptr<MutationNode> &node,
415
430
  ShadowViewMutationList &mutations) const {
416
431
  maybeCancelAnimation(node->tag);
417
432
  node->state = DELETED;
418
433
  // iterate from the end, so that children
419
434
  // with higher indices appear first in the mutations list
420
- for (auto it = node->unflattenedChildren.rbegin();
421
- it != node->unflattenedChildren.rend();
422
- it++) {
435
+ for (auto it = node->unflattenedChildren.rbegin(); it != node->unflattenedChildren.rend(); it++) {
423
436
  auto &subNode = *it;
424
437
  if (subNode->state != DELETED) {
425
438
  endAnimationsRecursively(subNode, mutations);
@@ -430,16 +443,15 @@ void LayoutAnimationsProxy::endAnimationsRecursively(
430
443
  #ifdef LAYOUT_ANIMATIONS_LOGS
431
444
  LOG(INFO) << "delete " << node->tag << std::endl;
432
445
  #endif
433
- mutations.push_back(
434
- ShadowViewMutation::DeleteMutation(node->mutation.oldChildShadowView));
446
+ mutations.push_back(ShadowViewMutation::DeleteMutation(node->mutation.oldChildShadowView));
435
447
  }
436
448
 
437
- void LayoutAnimationsProxy::maybeDropAncestors(
438
- std::shared_ptr<Node> parent,
439
- std::shared_ptr<MutationNode> child,
449
+ void LayoutAnimationsProxy_Legacy::maybeDropAncestors(
450
+ const std::shared_ptr<Node> &parent,
451
+ const std::shared_ptr<MutationNode> &child,
440
452
  ShadowViewMutationList &cleanupMutations) const {
441
453
  parent->removeChildFromUnflattenedTree(child);
442
- if (!parent->isMutationMode()) {
454
+ if (!parent->isMutationNode()) {
443
455
  return;
444
456
  }
445
457
 
@@ -449,23 +461,22 @@ void LayoutAnimationsProxy::maybeDropAncestors(
449
461
  nodeForTag_.erase(node->tag);
450
462
  cleanupMutations.push_back(node->mutation);
451
463
  maybeCancelAnimation(node->tag);
464
+ node->state = DELETED;
452
465
  #ifdef LAYOUT_ANIMATIONS_LOGS
453
466
  LOG(INFO) << "delete " << node->tag << std::endl;
454
467
  #endif
455
- cleanupMutations.push_back(
456
- ShadowViewMutation::DeleteMutation(node->mutation.oldChildShadowView));
468
+ cleanupMutations.push_back(ShadowViewMutation::DeleteMutation(node->mutation.oldChildShadowView));
457
469
  maybeDropAncestors(node->unflattenedParent, node, cleanupMutations);
458
470
  }
459
471
  }
460
472
 
461
- const ComponentDescriptor &
462
- LayoutAnimationsProxy::getComponentDescriptorForShadowView(
473
+ const ComponentDescriptor &LayoutAnimationsProxy_Legacy::getComponentDescriptorForShadowView(
463
474
  const ShadowView &shadowView) const {
464
475
  return componentDescriptorRegistry_->at(shadowView.componentHandle);
465
476
  }
466
477
 
467
- bool LayoutAnimationsProxy::startAnimationsRecursively(
468
- std::shared_ptr<MutationNode> node,
478
+ bool LayoutAnimationsProxy_Legacy::startAnimationsRecursively(
479
+ const std::shared_ptr<MutationNode> &node,
469
480
  bool shouldRemoveSubviewsWithoutAnimations,
470
481
  bool shouldAnimate,
471
482
  bool isScreenPop,
@@ -474,28 +485,23 @@ bool LayoutAnimationsProxy::startAnimationsRecursively(
474
485
  isScreenPop = true;
475
486
  }
476
487
 
477
- shouldAnimate = !isScreenPop &&
478
- layoutAnimationsManager_->shouldAnimateExiting(node->tag, shouldAnimate);
488
+ shouldAnimate = !isScreenPop && layoutAnimationsManager_->shouldAnimateExiting(node->tag, shouldAnimate);
479
489
 
480
- bool hasExitAnimation = shouldAnimate &&
481
- layoutAnimationsManager_->hasLayoutAnimation(
482
- node->tag, LayoutAnimationType::EXITING);
490
+ bool hasExitAnimation =
491
+ shouldAnimate && layoutAnimationsManager_->hasLayoutAnimation(node->tag, LayoutAnimationType::EXITING);
483
492
  bool hasAnimatedChildren = false;
484
493
 
485
494
  shouldRemoveSubviewsWithoutAnimations =
486
- shouldRemoveSubviewsWithoutAnimations && !hasExitAnimation;
495
+ shouldRemoveSubviewsWithoutAnimations && (!hasExitAnimation || node->state == MOVED);
487
496
  std::vector<std::shared_ptr<MutationNode>> toBeRemoved;
488
497
 
489
498
  // iterate from the end, so that children
490
499
  // with higher indices appear first in the mutations list
491
- for (auto it = node->unflattenedChildren.rbegin();
492
- it != node->unflattenedChildren.rend();
493
- it++) {
500
+ for (auto it = node->unflattenedChildren.rbegin(); it != node->unflattenedChildren.rend(); it++) {
494
501
  auto &subNode = *it;
495
502
  #ifdef LAYOUT_ANIMATIONS_LOGS
496
503
  LOG(INFO) << "child " << subNode->tag << " "
497
- << " " << shouldAnimate << " "
498
- << shouldRemoveSubviewsWithoutAnimations << std::endl;
504
+ << " " << shouldAnimate << " " << shouldRemoveSubviewsWithoutAnimations << std::endl;
499
505
  #endif
500
506
  if (subNode->state != UNDEFINED && subNode->state != MOVED) {
501
507
  if (shouldAnimate && subNode->state != DEAD) {
@@ -505,14 +511,9 @@ bool LayoutAnimationsProxy::startAnimationsRecursively(
505
511
  toBeRemoved.push_back(subNode);
506
512
  }
507
513
  } else if (startAnimationsRecursively(
508
- subNode,
509
- shouldRemoveSubviewsWithoutAnimations,
510
- shouldAnimate,
511
- isScreenPop,
512
- mutations)) {
514
+ subNode, shouldRemoveSubviewsWithoutAnimations, shouldAnimate, isScreenPop, mutations)) {
513
515
  #ifdef LAYOUT_ANIMATIONS_LOGS
514
- LOG(INFO) << "child " << subNode->tag
515
- << " start animations returned true " << std::endl;
516
+ LOG(INFO) << "child " << subNode->tag << " start animations returned true " << std::endl;
516
517
  #endif
517
518
  hasAnimatedChildren = true;
518
519
  } else if (subNode->state == MOVED) {
@@ -527,8 +528,7 @@ bool LayoutAnimationsProxy::startAnimationsRecursively(
527
528
  #ifdef LAYOUT_ANIMATIONS_LOGS
528
529
  LOG(INFO) << "delete " << subNode->tag << std::endl;
529
530
  #endif
530
- mutations.push_back(ShadowViewMutation::DeleteMutation(
531
- subNode->mutation.oldChildShadowView));
531
+ mutations.push_back(ShadowViewMutation::DeleteMutation(subNode->mutation.oldChildShadowView));
532
532
  } else {
533
533
  subNode->state = WAITING;
534
534
  }
@@ -540,10 +540,10 @@ bool LayoutAnimationsProxy::startAnimationsRecursively(
540
540
 
541
541
  if (node->state == MOVED) {
542
542
  auto replacement = std::make_shared<Node>(*node);
543
- for (auto subNode : node->children) {
543
+ for (const auto &subNode : node->children) {
544
544
  subNode->parent = replacement;
545
545
  }
546
- for (auto subNode : node->unflattenedChildren) {
546
+ for (const auto &subNode : node->unflattenedChildren) {
547
547
  subNode->unflattenedParent = replacement;
548
548
  }
549
549
  nodeForTag_[replacement->tag] = replacement;
@@ -562,17 +562,12 @@ bool LayoutAnimationsProxy::startAnimationsRecursively(
562
562
  return wantAnimateExit;
563
563
  }
564
564
 
565
- void LayoutAnimationsProxy::updateIndexForMutation(
566
- ShadowViewMutation &mutation) const {
565
+ void LayoutAnimationsProxy_Legacy::updateIndexForMutation(ShadowViewMutation &mutation) const {
567
566
  if (mutation.index == -1) {
568
567
  return;
569
568
  }
570
569
 
571
- #if REACT_NATIVE_MINOR_VERSION >= 78
572
570
  const auto parentTag = mutation.parentTag;
573
- #else
574
- const auto parentTag = mutation.parentShadowView.tag;
575
- #endif // REACT_NATIVE_MINOR_VERSION >= 78
576
571
 
577
572
  if (!nodeForTag_.contains(parentTag)) {
578
573
  return;
@@ -590,20 +585,19 @@ void LayoutAnimationsProxy::updateIndexForMutation(
590
585
  prevIndex = subNode->mutation.index;
591
586
  }
592
587
  #ifdef LAYOUT_ANIMATIONS_LOGS
593
- int tag = mutation.type == ShadowViewMutation::Insert
594
- ? mutation.newChildShadowView.tag
595
- : mutation.oldChildShadowView.tag;
596
- LOG(INFO) << "update index for " << tag << " in " << parentTag << ": "
597
- << mutation.index << " -> " << mutation.index + offset << std::endl;
588
+ int tag =
589
+ mutation.type == ShadowViewMutation::Insert ? mutation.newChildShadowView.tag : mutation.oldChildShadowView.tag;
590
+ LOG(INFO) << "update index for " << tag << " in " << parentTag << ": " << mutation.index << " -> "
591
+ << mutation.index + offset << std::endl;
598
592
  #endif
599
593
  mutation.index += offset;
600
594
  }
601
595
 
602
- bool LayoutAnimationsProxy::shouldOverridePullTransaction() const {
596
+ bool LayoutAnimationsProxy_Legacy::shouldOverridePullTransaction() const {
603
597
  return true;
604
598
  }
605
599
 
606
- void LayoutAnimationsProxy::createLayoutAnimation(
600
+ void LayoutAnimationsProxy_Legacy::createLayoutAnimation(
607
601
  const ShadowViewMutation &mutation,
608
602
  ShadowView &oldView,
609
603
  const SurfaceId &surfaceId,
@@ -613,52 +607,36 @@ void LayoutAnimationsProxy::createLayoutAnimation(
613
607
 
614
608
  if (layoutAnimationIt != layoutAnimations_.end()) {
615
609
  auto &layoutAnimation = layoutAnimationIt->second;
616
- oldView = *layoutAnimation.currentView;
610
+ oldView = layoutAnimation.currentView;
617
611
  count = layoutAnimation.count + 1;
618
612
  }
619
613
 
620
- auto finalView = std::make_shared<ShadowView>(
621
- mutation.type == ShadowViewMutation::Remove
622
- ? mutation.oldChildShadowView
623
- : mutation.newChildShadowView);
624
- auto currentView = std::make_shared<ShadowView>(oldView);
614
+ auto finalView =
615
+ mutation.type == ShadowViewMutation::Remove ? mutation.oldChildShadowView : mutation.newChildShadowView;
616
+ auto currentView = oldView;
625
617
 
626
- #if REACT_NATIVE_MINOR_VERSION >= 78
627
618
  layoutAnimations_.insert_or_assign(
628
619
  tag,
629
- LayoutAnimation{finalView, currentView, mutation.parentTag, {}, count});
630
- #else
631
- auto parentView = std::make_shared<ShadowView>(mutation.parentShadowView);
632
- layoutAnimations_.insert_or_assign(
633
- tag, LayoutAnimation{finalView, currentView, parentView, {}, count});
634
- #endif // REACT_NATIVE_MINOR_VERSION >= 78
620
+ LayoutAnimation{
621
+ .finalView = finalView,
622
+ .currentView = currentView,
623
+ .parentTag = mutation.parentTag,
624
+ .opacity = {},
625
+ .isViewAlreadyMounted = false,
626
+ .count = count});
635
627
  }
636
628
 
637
- void LayoutAnimationsProxy::startEnteringAnimation(
638
- const int tag,
639
- ShadowViewMutation &mutation) const {
629
+ void LayoutAnimationsProxy_Legacy::startEnteringAnimation(const int tag, ShadowViewMutation &mutation) const {
640
630
  #ifdef LAYOUT_ANIMATIONS_LOGS
641
631
  LOG(INFO) << "start entering animation for tag " << tag << std::endl;
642
632
  #endif
643
- auto finalView = std::make_shared<ShadowView>(mutation.newChildShadowView);
644
- auto current = std::make_shared<ShadowView>(mutation.newChildShadowView);
645
- #if REACT_NATIVE_MINOR_VERSION < 78
646
- auto parent = std::make_shared<ShadowView>(mutation.parentShadowView);
647
- #endif
633
+ auto finalView = mutation.newChildShadowView;
634
+ auto current = mutation.newChildShadowView;
648
635
 
649
- auto &viewProps =
650
- static_cast<const ViewProps &>(*mutation.newChildShadowView.props);
636
+ auto &viewProps = static_cast<const ViewProps &>(*mutation.newChildShadowView.props);
651
637
  auto opacity = viewProps.opacity;
652
638
 
653
- uiScheduler_->scheduleOnUI([weakThis = weak_from_this(),
654
- finalView,
655
- current,
656
- #if REACT_NATIVE_MINOR_VERSION < 78
657
- parent,
658
- #endif // RE
659
- mutation,
660
- opacity,
661
- tag]() {
639
+ uiScheduler_->scheduleOnUI([weakThis = weak_from_this(), finalView, current, mutation, opacity, tag]() {
662
640
  auto strongThis = weakThis.lock();
663
641
  if (!strongThis) {
664
642
  return;
@@ -669,17 +647,10 @@ void LayoutAnimationsProxy::startEnteringAnimation(
669
647
  auto &mutex = strongThis->mutex;
670
648
  auto lock = std::unique_lock<std::recursive_mutex>(mutex);
671
649
  strongThis->layoutAnimations_.insert_or_assign(
672
- tag, LayoutAnimation {
673
- finalView, current,
674
- #if REACT_NATIVE_MINOR_VERSION >= 78
675
- mutation.parentTag,
676
- #else
677
- parent,
678
- #endif // REACT_NATIVE_MINOR_VERSION >= 78
679
- opacity
680
- });
681
- window = strongThis->surfaceManager.getWindow(
682
- mutation.newChildShadowView.surfaceId);
650
+ tag,
651
+ LayoutAnimation{
652
+ .finalView = finalView, .currentView = current, .parentTag = mutation.parentTag, .opacity = opacity});
653
+ window = strongThis->surfaceManager.getWindow(mutation.newChildShadowView.surfaceId);
683
654
  }
684
655
 
685
656
  Snapshot values(mutation.newChildShadowView, window);
@@ -698,60 +669,52 @@ void LayoutAnimationsProxy::startEnteringAnimation(
698
669
  });
699
670
  }
700
671
 
701
- void LayoutAnimationsProxy::startExitingAnimation(
702
- const int tag,
703
- ShadowViewMutation &mutation) const {
672
+ void LayoutAnimationsProxy_Legacy::startExitingAnimation(const int tag, ShadowViewMutation &mutation) const {
704
673
  #ifdef LAYOUT_ANIMATIONS_LOGS
705
674
  LOG(INFO) << "start exiting animation for tag " << tag << std::endl;
706
675
  #endif
707
676
  auto surfaceId = mutation.oldChildShadowView.surfaceId;
708
677
 
709
- uiScheduler_->scheduleOnUI(
710
- [weakThis = weak_from_this(), tag, mutation, surfaceId]() {
711
- auto strongThis = weakThis.lock();
712
- if (!strongThis) {
713
- return;
714
- }
678
+ uiScheduler_->scheduleOnUI([weakThis = weak_from_this(), tag, mutation, surfaceId]() {
679
+ auto strongThis = weakThis.lock();
680
+ if (!strongThis) {
681
+ return;
682
+ }
715
683
 
716
- auto oldView = mutation.oldChildShadowView;
717
- Rect window{};
718
- {
719
- auto &mutex = strongThis->mutex;
720
- auto lock = std::unique_lock<std::recursive_mutex>(mutex);
721
- strongThis->createLayoutAnimation(mutation, oldView, surfaceId, tag);
722
- window = strongThis->surfaceManager.getWindow(surfaceId);
723
- }
684
+ auto oldView = mutation.oldChildShadowView;
685
+ Rect window{};
686
+ {
687
+ auto &mutex = strongThis->mutex;
688
+ auto lock = std::unique_lock<std::recursive_mutex>(mutex);
689
+ strongThis->createLayoutAnimation(mutation, oldView, surfaceId, tag);
690
+ window = strongThis->surfaceManager.getWindow(surfaceId);
691
+ }
692
+
693
+ Snapshot values(oldView, window);
724
694
 
725
- Snapshot values(oldView, window);
726
-
727
- auto &uiRuntime = strongThis->uiRuntime_;
728
- jsi::Object yogaValues(uiRuntime);
729
- yogaValues.setProperty(uiRuntime, "currentOriginX", values.x);
730
- yogaValues.setProperty(uiRuntime, "currentGlobalOriginX", values.x);
731
- yogaValues.setProperty(uiRuntime, "currentOriginY", values.y);
732
- yogaValues.setProperty(uiRuntime, "currentGlobalOriginY", values.y);
733
- yogaValues.setProperty(uiRuntime, "currentWidth", values.width);
734
- yogaValues.setProperty(uiRuntime, "currentHeight", values.height);
735
- yogaValues.setProperty(uiRuntime, "windowWidth", values.windowWidth);
736
- yogaValues.setProperty(uiRuntime, "windowHeight", values.windowHeight);
737
- strongThis->layoutAnimationsManager_->startLayoutAnimation(
738
- uiRuntime, tag, LayoutAnimationType::EXITING, yogaValues);
739
- strongThis->layoutAnimationsManager_->clearLayoutAnimationConfig(tag);
740
- });
695
+ auto &uiRuntime = strongThis->uiRuntime_;
696
+ jsi::Object yogaValues(uiRuntime);
697
+ yogaValues.setProperty(uiRuntime, "currentOriginX", values.x);
698
+ yogaValues.setProperty(uiRuntime, "currentGlobalOriginX", values.x);
699
+ yogaValues.setProperty(uiRuntime, "currentOriginY", values.y);
700
+ yogaValues.setProperty(uiRuntime, "currentGlobalOriginY", values.y);
701
+ yogaValues.setProperty(uiRuntime, "currentWidth", values.width);
702
+ yogaValues.setProperty(uiRuntime, "currentHeight", values.height);
703
+ yogaValues.setProperty(uiRuntime, "windowWidth", values.windowWidth);
704
+ yogaValues.setProperty(uiRuntime, "windowHeight", values.windowHeight);
705
+ strongThis->layoutAnimationsManager_->startLayoutAnimation(
706
+ uiRuntime, tag, LayoutAnimationType::EXITING, yogaValues);
707
+ strongThis->layoutAnimationsManager_->clearLayoutAnimationConfig(tag);
708
+ });
741
709
  }
742
710
 
743
- void LayoutAnimationsProxy::startLayoutAnimation(
744
- const int tag,
745
- const ShadowViewMutation &mutation) const {
711
+ void LayoutAnimationsProxy_Legacy::startLayoutAnimation(const int tag, const ShadowViewMutation &mutation) const {
746
712
  #ifdef LAYOUT_ANIMATIONS_LOGS
747
713
  LOG(INFO) << "start layout animation for tag " << tag << std::endl;
748
714
  #endif
749
715
  auto surfaceId = mutation.oldChildShadowView.surfaceId;
750
716
 
751
- uiScheduler_->scheduleOnUI([weakThis = weak_from_this(),
752
- mutation,
753
- surfaceId,
754
- tag]() {
717
+ uiScheduler_->scheduleOnUI([weakThis = weak_from_this(), mutation, surfaceId, tag]() {
755
718
  auto strongThis = weakThis.lock();
756
719
  if (!strongThis) {
757
720
  return;
@@ -784,21 +747,18 @@ void LayoutAnimationsProxy::startLayoutAnimation(
784
747
  yogaValues.setProperty(uiRuntime, "targetWidth", targetValues.width);
785
748
  yogaValues.setProperty(uiRuntime, "targetHeight", targetValues.height);
786
749
  yogaValues.setProperty(uiRuntime, "windowWidth", targetValues.windowWidth);
787
- yogaValues.setProperty(
788
- uiRuntime, "windowHeight", targetValues.windowHeight);
789
- strongThis->layoutAnimationsManager_->startLayoutAnimation(
790
- uiRuntime, tag, LayoutAnimationType::LAYOUT, yogaValues);
750
+ yogaValues.setProperty(uiRuntime, "windowHeight", targetValues.windowHeight);
751
+ strongThis->layoutAnimationsManager_->startLayoutAnimation(uiRuntime, tag, LayoutAnimationType::LAYOUT, yogaValues);
791
752
  });
792
753
  }
793
754
 
794
- void LayoutAnimationsProxy::updateOngoingAnimationTarget(
795
- const int tag,
796
- const ShadowViewMutation &mutation) const {
797
- layoutAnimations_[tag].finalView =
798
- std::make_shared<ShadowView>(mutation.newChildShadowView);
755
+ void LayoutAnimationsProxy_Legacy::updateOngoingAnimationTarget(const int tag, const ShadowViewMutation &mutation)
756
+ const {
757
+ auto copy = mutation.newChildShadowView;
758
+ layoutAnimations_[tag].finalView = copy;
799
759
  }
800
760
 
801
- void LayoutAnimationsProxy::maybeCancelAnimation(const int tag) const {
761
+ void LayoutAnimationsProxy_Legacy::maybeCancelAnimation(const int tag) const {
802
762
  if (!layoutAnimations_.contains(tag)) {
803
763
  return;
804
764
  }
@@ -814,9 +774,7 @@ void LayoutAnimationsProxy::maybeCancelAnimation(const int tag) const {
814
774
  });
815
775
  }
816
776
 
817
- void LayoutAnimationsProxy::transferConfigFromNativeID(
818
- const std::string nativeIdString,
819
- const int tag) const {
777
+ void LayoutAnimationsProxy_Legacy::transferConfigFromNativeID(const std::string &nativeIdString, const int tag) const {
820
778
  if (nativeIdString.empty()) {
821
779
  return;
822
780
  }
@@ -824,40 +782,41 @@ void LayoutAnimationsProxy::transferConfigFromNativeID(
824
782
  auto nativeId = stoi(nativeIdString);
825
783
  layoutAnimationsManager_->transferConfigFromNativeID(nativeId, tag);
826
784
  } catch (std::invalid_argument) {
827
- } catch (std::out_of_range) {
828
- }
785
+ } catch (std::out_of_range) {}
829
786
  }
830
787
 
831
788
  // When entering animations start, we temporarily set opacity to 0
832
789
  // so that we can immediately insert the view at the right position
833
790
  // and schedule the animation on the UI thread
834
- std::shared_ptr<ShadowView> LayoutAnimationsProxy::cloneViewWithoutOpacity(
791
+ std::shared_ptr<ShadowView> LayoutAnimationsProxy_Legacy::cloneViewWithoutOpacity(
835
792
  facebook::react::ShadowViewMutation &mutation,
836
793
  const PropsParserContext &propsParserContext) const {
837
794
  auto newView = std::make_shared<ShadowView>(mutation.newChildShadowView);
838
795
  folly::dynamic opacity = folly::dynamic::object("opacity", 0);
839
- auto newProps = getComponentDescriptorForShadowView(*newView).cloneProps(
840
- propsParserContext, newView->props, RawProps(opacity));
796
+ auto newProps =
797
+ getComponentDescriptorForShadowView(*newView).cloneProps(propsParserContext, newView->props, RawProps(opacity));
841
798
  newView->props = newProps;
842
799
  return newView;
843
800
  }
844
801
 
845
- void LayoutAnimationsProxy::maybeRestoreOpacity(
846
- LayoutAnimation &layoutAnimation,
847
- const jsi::Object &newStyle) const {
802
+ void LayoutAnimationsProxy_Legacy::maybeRestoreOpacity(LayoutAnimation &layoutAnimation, const jsi::Object &newStyle)
803
+ const {
848
804
  if (layoutAnimation.opacity && !newStyle.hasProperty(uiRuntime_, "opacity")) {
849
- newStyle.setProperty(
850
- uiRuntime_, "opacity", jsi::Value(*layoutAnimation.opacity));
851
- layoutAnimation.opacity.reset();
805
+ newStyle.setProperty(uiRuntime_, "opacity", jsi::Value(*layoutAnimation.opacity));
806
+ if (layoutAnimation.isViewAlreadyMounted) {
807
+ // We want to reset opacity only when we are sure that this update will be
808
+ // applied to the native view. Otherwise, we want to update opacity using
809
+ // the `restoreOpacityInCaseOfFlakyEnteringAnimation` method.
810
+ layoutAnimation.opacity.reset();
811
+ }
852
812
  }
853
813
  }
854
814
 
855
- void LayoutAnimationsProxy::maybeUpdateWindowDimensions(
815
+ void LayoutAnimationsProxy_Legacy::maybeUpdateWindowDimensions(
856
816
  facebook::react::ShadowViewMutation &mutation,
857
817
  SurfaceId surfaceId) const {
858
818
  if (mutation.type == ShadowViewMutation::Update &&
859
- !std::strcmp(
860
- mutation.oldChildShadowView.componentName, RootComponentName)) {
819
+ !std::strcmp(mutation.oldChildShadowView.componentName, RootComponentName)) {
861
820
  surfaceManager.updateWindow(
862
821
  surfaceId,
863
822
  mutation.newChildShadowView.layoutMetrics.frame.size.width,
@@ -865,6 +824,74 @@ void LayoutAnimationsProxy::maybeUpdateWindowDimensions(
865
824
  }
866
825
  }
867
826
 
868
- } // namespace reanimated
827
+ void Node::applyMutationToIndices(ShadowViewMutation mutation) {
828
+ const auto parentTag = mutation.parentTag;
829
+ if (tag != parentTag) {
830
+ return;
831
+ }
832
+
833
+ int delta = mutation.type == ShadowViewMutation::Insert ? 1 : -1;
834
+ for (auto it = children.rbegin(); it != children.rend(); ++it) {
835
+ const auto& child = *it;
836
+ if (child->mutation.index < mutation.index) {
837
+ return;
838
+ }
839
+ child->mutation.index += delta;
840
+ }
841
+ }
842
+
843
+ // Should only be called on unflattened parents
844
+ void Node::removeChildFromUnflattenedTree(std::shared_ptr<MutationNode> child) {
845
+ for (int i = unflattenedChildren.size() - 1; i >= 0; i--) {
846
+ if (unflattenedChildren[i]->tag == child->tag) {
847
+ unflattenedChildren.erase(unflattenedChildren.begin() + i);
848
+ break;
849
+ }
850
+ }
869
851
 
870
- #endif // RCT_NEW_ARCH_ENABLED
852
+ auto &flattenedChildren = child->parent->children;
853
+ for (int i = flattenedChildren.size() - 1; i >= 0; i--) {
854
+ if (flattenedChildren[i]->tag == child->tag) {
855
+ flattenedChildren.erase(flattenedChildren.begin() + i);
856
+ return;
857
+ }
858
+ flattenedChildren[i]->mutation.index--;
859
+ }
860
+ }
861
+
862
+ void Node::insertChildren(std::vector<std::shared_ptr<MutationNode>> &newChildren) {
863
+ mergeAndSwap(children, newChildren);
864
+ }
865
+
866
+ void Node::insertUnflattenedChildren(std::vector<std::shared_ptr<MutationNode>> &newChildren) {
867
+ mergeAndSwap(unflattenedChildren, newChildren);
868
+ }
869
+
870
+ inline bool Node::isMutationNode() {
871
+ return false;
872
+ }
873
+
874
+ inline bool MutationNode::isMutationNode() {
875
+ return true;
876
+ }
877
+
878
+ // UIManagerAnimationDelegate
879
+
880
+ void LayoutAnimationsProxy_Legacy::uiManagerDidConfigureNextLayoutAnimation(
881
+ jsi::Runtime &runtime,
882
+ const RawValue &config,
883
+ const jsi::Value &successCallbackValue,
884
+ const jsi::Value &failureCallbackValue) const {}
885
+
886
+ void LayoutAnimationsProxy_Legacy::setComponentDescriptorRegistry(
887
+ const SharedComponentDescriptorRegistry &componentDescriptorRegistry) {}
888
+
889
+ bool LayoutAnimationsProxy_Legacy::shouldAnimateFrame() const {
890
+ return false;
891
+ }
892
+
893
+ void LayoutAnimationsProxy_Legacy::stopSurface(SurfaceId surfaceId) {
894
+ surfacesToRemove_.insert(surfaceId);
895
+ }
896
+
897
+ } // namespace reanimated