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