@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.
- package/compatibility.json +161 -0
- package/harmony/reanimated/BuildProfile.ets +1 -1
- package/harmony/reanimated/build-profile.json5 +8 -1
- package/harmony/reanimated/oh-package.json5 +3 -2
- package/harmony/reanimated/src/main/cpp/CMakeLists.txt +31 -40
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.cpp +11 -16
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.h +3 -4
- 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 +93 -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 +44 -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 +110 -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 +51 -39
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.h +13 -15
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitShadowNode.h +0 -3
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.cpp +22 -53
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.h +12 -8
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.cpp +46 -37
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.h +3 -10
- 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 +4 -2
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.cpp +62 -157
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.h +38 -46
- 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} +303 -276
- 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 +5 -65
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.h +52 -82
- 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 +957 -552
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.h +87 -111
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.cpp +115 -163
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.h +38 -54
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.cpp +34 -36
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.h +8 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.cpp +46 -58
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.h +5 -9
- 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 +26 -57
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReanimatedSystraceSection.h +12 -33
- 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 +3 -4
- package/harmony/reanimated/src/main/cpp/ReanimatedModule.cpp +60 -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 +12 -1
- package/harmony/reanimated/src/main/ets/ReanimatedPackage.ts +1 -4
- package/harmony/reanimated.har +0 -0
- package/package.json +36 -18
- 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 +79 -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 -155
- 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 -182
- 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
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
#include <reanimated/CSS/interpolation/styles/TransitionStyleInterpolator.h>
|
|
2
|
+
|
|
3
|
+
#include <memory>
|
|
4
|
+
#include <string>
|
|
5
|
+
#include <unordered_set>
|
|
6
|
+
|
|
7
|
+
namespace reanimated::css {
|
|
8
|
+
|
|
9
|
+
TransitionStyleInterpolator::TransitionStyleInterpolator(
|
|
10
|
+
const std::string &componentName,
|
|
11
|
+
const std::shared_ptr<ViewStylesRepository> &viewStylesRepository)
|
|
12
|
+
: componentName_(componentName), viewStylesRepository_(viewStylesRepository) {}
|
|
13
|
+
|
|
14
|
+
std::unordered_set<std::string> TransitionStyleInterpolator::getReversedPropertyNames(
|
|
15
|
+
const folly::dynamic &newPropertyValues) const {
|
|
16
|
+
std::unordered_set<std::string> reversedProperties;
|
|
17
|
+
|
|
18
|
+
if (!newPropertyValues.isObject()) {
|
|
19
|
+
return reversedProperties;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
for (const auto &[propertyName, propertyValue] : newPropertyValues.items()) {
|
|
23
|
+
const auto propertyNameStr = propertyName.getString();
|
|
24
|
+
const auto it = interpolators_.find(propertyNameStr);
|
|
25
|
+
if (it != interpolators_.end() &&
|
|
26
|
+
// First keyframe value of the previous transition is the reversing
|
|
27
|
+
// adjusted start value
|
|
28
|
+
it->second->equalsReversingAdjustedStartValue(propertyValue)) {
|
|
29
|
+
reversedProperties.insert(propertyNameStr);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return reversedProperties;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
folly::dynamic TransitionStyleInterpolator::interpolate(
|
|
37
|
+
const std::shared_ptr<const ShadowNode> &shadowNode,
|
|
38
|
+
const TransitionProgressProvider &transitionProgressProvider,
|
|
39
|
+
const std::unordered_set<std::string> &allowDiscreteProperties) const {
|
|
40
|
+
folly::dynamic result = folly::dynamic::object;
|
|
41
|
+
|
|
42
|
+
const auto allFallbackInterpolateThreshold = allowDiscreteProperties.contains("all") ? 0.5 : 0;
|
|
43
|
+
|
|
44
|
+
for (const auto &[propertyName, progressProvider] : transitionProgressProvider.getPropertyProgressProviders()) {
|
|
45
|
+
const auto &interpolator = interpolators_.at(propertyName);
|
|
46
|
+
const auto fallbackInterpolateThreshold =
|
|
47
|
+
(allowDiscreteProperties.contains(propertyName)) ? 0.5 : allFallbackInterpolateThreshold;
|
|
48
|
+
result[propertyName] = interpolator->interpolate(shadowNode, progressProvider, fallbackInterpolateThreshold);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
void TransitionStyleInterpolator::discardFinishedInterpolators(
|
|
55
|
+
const TransitionProgressProvider &transitionProgressProvider) {
|
|
56
|
+
for (const auto &propertyName : transitionProgressProvider.getRemovedProperties()) {
|
|
57
|
+
interpolators_.erase(propertyName);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
void TransitionStyleInterpolator::discardIrrelevantInterpolators(
|
|
62
|
+
const std::unordered_set<std::string> &transitionPropertyNames) {
|
|
63
|
+
for (auto it = interpolators_.begin(); it != interpolators_.end();) {
|
|
64
|
+
// Remove property interpolators for properties not specified in the
|
|
65
|
+
// transition property names
|
|
66
|
+
if (transitionPropertyNames.find(it->first) == transitionPropertyNames.end()) {
|
|
67
|
+
it = interpolators_.erase(it);
|
|
68
|
+
} else {
|
|
69
|
+
++it;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
void TransitionStyleInterpolator::updateInterpolatedProperties(
|
|
75
|
+
const ChangedProps &changedProps,
|
|
76
|
+
const folly::dynamic &lastUpdateValue) {
|
|
77
|
+
const auto &oldPropsObj = changedProps.oldProps;
|
|
78
|
+
const auto &newPropsObj = changedProps.newProps;
|
|
79
|
+
|
|
80
|
+
const auto empty = folly::dynamic();
|
|
81
|
+
|
|
82
|
+
for (const auto &propertyName : changedProps.changedPropertyNames) {
|
|
83
|
+
auto it = interpolators_.find(propertyName);
|
|
84
|
+
const auto shouldCreateInterpolator = it == interpolators_.end();
|
|
85
|
+
|
|
86
|
+
if (shouldCreateInterpolator) {
|
|
87
|
+
const auto newInterpolator = createPropertyInterpolator(
|
|
88
|
+
propertyName, {}, getComponentInterpolators(componentName_), viewStylesRepository_);
|
|
89
|
+
it = interpolators_.emplace(propertyName, newInterpolator).first;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const auto &oldValue = oldPropsObj.getDefault(propertyName, empty);
|
|
93
|
+
const auto &newValue = newPropsObj.getDefault(propertyName, empty);
|
|
94
|
+
// Pass lastValue only if the interpolator is updated (no new interpolator
|
|
95
|
+
// was created), otherwise pass an empty value
|
|
96
|
+
const auto &lastValue =
|
|
97
|
+
(shouldCreateInterpolator || lastUpdateValue.empty()) ? empty : lastUpdateValue.getDefault(propertyName, empty);
|
|
98
|
+
|
|
99
|
+
it->second->updateKeyframesFromStyleChange(oldValue, newValue, lastValue);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
} // namespace reanimated::css
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <reanimated/CSS/InterpolatorRegistry.h>
|
|
4
|
+
#include <reanimated/CSS/common/definitions.h>
|
|
5
|
+
#include <reanimated/CSS/interpolation/groups/RecordPropertiesInterpolator.h>
|
|
6
|
+
#include <reanimated/CSS/progress/TransitionProgressProvider.h>
|
|
7
|
+
|
|
8
|
+
#include <memory>
|
|
9
|
+
#include <string>
|
|
10
|
+
#include <unordered_map>
|
|
11
|
+
#include <unordered_set>
|
|
12
|
+
|
|
13
|
+
namespace reanimated::css {
|
|
14
|
+
|
|
15
|
+
class TransitionStyleInterpolator {
|
|
16
|
+
public:
|
|
17
|
+
TransitionStyleInterpolator(
|
|
18
|
+
const std::string &componentName,
|
|
19
|
+
const std::shared_ptr<ViewStylesRepository> &viewStylesRepository);
|
|
20
|
+
|
|
21
|
+
std::unordered_set<std::string> getReversedPropertyNames(const folly::dynamic &newPropertyValues) const;
|
|
22
|
+
|
|
23
|
+
folly::dynamic interpolate(
|
|
24
|
+
const std::shared_ptr<const ShadowNode> &shadowNode,
|
|
25
|
+
const TransitionProgressProvider &transitionProgressProvider,
|
|
26
|
+
const std::unordered_set<std::string> &allowDiscreteProperties) const;
|
|
27
|
+
|
|
28
|
+
void discardFinishedInterpolators(const TransitionProgressProvider &transitionProgressProvider);
|
|
29
|
+
void discardIrrelevantInterpolators(const std::unordered_set<std::string> &transitionPropertyNames);
|
|
30
|
+
void updateInterpolatedProperties(const ChangedProps &changedProps, const folly::dynamic &lastUpdateValue);
|
|
31
|
+
|
|
32
|
+
private:
|
|
33
|
+
using MapInterpolatorsCallback = std::function<
|
|
34
|
+
folly::dynamic(const std::shared_ptr<PropertyInterpolator> &, const std::shared_ptr<KeyframeProgressProvider> &)>;
|
|
35
|
+
|
|
36
|
+
const std::string componentName_;
|
|
37
|
+
const std::shared_ptr<ViewStylesRepository> viewStylesRepository_;
|
|
38
|
+
|
|
39
|
+
PropertyInterpolatorsRecord interpolators_;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
} // namespace reanimated::css
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
#include <reanimated/CSS/interpolation/transforms/TransformOperation.h>
|
|
2
|
+
|
|
3
|
+
#include <reanimated/CSS/common/transforms/TransformMatrix2D.h>
|
|
4
|
+
#include <reanimated/CSS/common/transforms/TransformMatrix3D.h>
|
|
5
|
+
#include <reanimated/CSS/common/values/CSSAngle.h>
|
|
6
|
+
#include <reanimated/CSS/common/values/CSSLength.h>
|
|
7
|
+
#include <reanimated/CSS/common/values/CSSNumber.h>
|
|
8
|
+
|
|
9
|
+
#include <reanimated/CSS/interpolation/transforms/operations/matrix.h>
|
|
10
|
+
#include <reanimated/CSS/interpolation/transforms/operations/perspective.h>
|
|
11
|
+
#include <reanimated/CSS/interpolation/transforms/operations/rotate.h>
|
|
12
|
+
#include <reanimated/CSS/interpolation/transforms/operations/scale.h>
|
|
13
|
+
#include <reanimated/CSS/interpolation/transforms/operations/skew.h>
|
|
14
|
+
#include <reanimated/CSS/interpolation/transforms/operations/translate.h>
|
|
15
|
+
|
|
16
|
+
#include <utility>
|
|
17
|
+
|
|
18
|
+
namespace reanimated::css {
|
|
19
|
+
|
|
20
|
+
std::string createConversionErrorMessage(const TransformOp fromType, const TransformOp toType) {
|
|
21
|
+
return "[Reanimated] Cannot convert transform operation of type: " + getTransformOperationName(fromType) +
|
|
22
|
+
" to type: " + getTransformOperationName(toType);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
TransformOperation::TransformOperation(TransformOp type) : StyleOperation(static_cast<uint8_t>(type)) {}
|
|
26
|
+
|
|
27
|
+
bool TransformOperation::canConvertTo(const TransformOp targetType) const {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
void TransformOperation::assertCanConvertTo(const TransformOp targetType) const {
|
|
32
|
+
if (!canConvertTo(targetType)) {
|
|
33
|
+
throw std::invalid_argument(createConversionErrorMessage(static_cast<TransformOp>(type), targetType));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
TransformOperations TransformOperation::convertTo(const TransformOp targetType) const {
|
|
38
|
+
throw std::invalid_argument(createConversionErrorMessage(static_cast<TransformOp>(type), targetType));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
std::string TransformOperation::getOperationName() const {
|
|
42
|
+
return getTransformOperationName(static_cast<TransformOp>(type));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
bool TransformOperation::is3D() const {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
std::shared_ptr<TransformOperation> TransformOperation::fromJSIValue(jsi::Runtime &rt, const jsi::Value &value) {
|
|
50
|
+
if (!value.isObject()) {
|
|
51
|
+
throw std::invalid_argument("[Reanimated] TransformOperation must be an object.");
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
jsi::Object obj = value.asObject(rt);
|
|
55
|
+
auto propertyNames = obj.getPropertyNames(rt);
|
|
56
|
+
|
|
57
|
+
if (propertyNames.size(rt) != 1) {
|
|
58
|
+
throw std::invalid_argument("[Reanimated] TransformOperation must have exactly one property.");
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const auto propertyName = propertyNames.getValueAtIndex(rt, 0).asString(rt).utf8(rt);
|
|
62
|
+
const auto propertyValue = obj.getProperty(rt, jsi::PropNameID::forUtf8(rt, propertyName));
|
|
63
|
+
const TransformOp operationType = getTransformOperationType(propertyName);
|
|
64
|
+
|
|
65
|
+
switch (operationType) {
|
|
66
|
+
case TransformOp::Perspective:
|
|
67
|
+
return std::make_shared<PerspectiveOperation>(propertyValue.asNumber());
|
|
68
|
+
case TransformOp::Rotate:
|
|
69
|
+
return std::make_shared<RotateOperation>(propertyValue.asString(rt).utf8(rt));
|
|
70
|
+
case TransformOp::RotateX:
|
|
71
|
+
return std::make_shared<RotateXOperation>(propertyValue.asString(rt).utf8(rt));
|
|
72
|
+
case TransformOp::RotateY:
|
|
73
|
+
return std::make_shared<RotateYOperation>(propertyValue.asString(rt).utf8(rt));
|
|
74
|
+
case TransformOp::RotateZ:
|
|
75
|
+
return std::make_shared<RotateZOperation>(propertyValue.asString(rt).utf8(rt));
|
|
76
|
+
case TransformOp::Scale:
|
|
77
|
+
return std::make_shared<ScaleOperation>(propertyValue.asNumber());
|
|
78
|
+
case TransformOp::ScaleX:
|
|
79
|
+
return std::make_shared<ScaleXOperation>(propertyValue.asNumber());
|
|
80
|
+
case TransformOp::ScaleY:
|
|
81
|
+
return std::make_shared<ScaleYOperation>(propertyValue.asNumber());
|
|
82
|
+
case TransformOp::TranslateX: {
|
|
83
|
+
if (propertyValue.isNumber()) {
|
|
84
|
+
return std::make_shared<TranslateXOperation>(propertyValue.asNumber());
|
|
85
|
+
}
|
|
86
|
+
return std::make_shared<TranslateXOperation>(propertyValue.asString(rt).utf8(rt));
|
|
87
|
+
}
|
|
88
|
+
case TransformOp::TranslateY: {
|
|
89
|
+
if (propertyValue.isNumber()) {
|
|
90
|
+
return std::make_shared<TranslateYOperation>(propertyValue.asNumber());
|
|
91
|
+
}
|
|
92
|
+
return std::make_shared<TranslateYOperation>(propertyValue.asString(rt).utf8(rt));
|
|
93
|
+
}
|
|
94
|
+
case TransformOp::SkewX:
|
|
95
|
+
return std::make_shared<SkewXOperation>(propertyValue.asString(rt).utf8(rt));
|
|
96
|
+
case TransformOp::SkewY:
|
|
97
|
+
return std::make_shared<SkewYOperation>(propertyValue.asString(rt).utf8(rt));
|
|
98
|
+
case TransformOp::Matrix:
|
|
99
|
+
return std::make_shared<MatrixOperation>(rt, propertyValue);
|
|
100
|
+
default:
|
|
101
|
+
throw std::invalid_argument("[Reanimated] Unknown transform operation: " + propertyName);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
std::shared_ptr<TransformOperation> TransformOperation::fromDynamic(const folly::dynamic &value) {
|
|
106
|
+
if (!value.isObject()) {
|
|
107
|
+
throw std::invalid_argument("[Reanimated] TransformOperation must be an object.");
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
auto &obj = value;
|
|
111
|
+
if (obj.size() != 1) {
|
|
112
|
+
throw std::invalid_argument("[Reanimated] TransformOperation must have exactly one property.");
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
auto propertyName = obj.items().begin()->first.getString();
|
|
116
|
+
auto propertyValue = obj.items().begin()->second;
|
|
117
|
+
const TransformOp operationType = getTransformOperationType(propertyName);
|
|
118
|
+
|
|
119
|
+
switch (operationType) {
|
|
120
|
+
case TransformOp::Perspective:
|
|
121
|
+
return std::make_shared<PerspectiveOperation>(propertyValue.getDouble());
|
|
122
|
+
case TransformOp::Rotate:
|
|
123
|
+
return std::make_shared<RotateOperation>(propertyValue.getString());
|
|
124
|
+
case TransformOp::RotateX:
|
|
125
|
+
return std::make_shared<RotateXOperation>(propertyValue.getString());
|
|
126
|
+
case TransformOp::RotateY:
|
|
127
|
+
return std::make_shared<RotateYOperation>(propertyValue.getString());
|
|
128
|
+
case TransformOp::RotateZ:
|
|
129
|
+
return std::make_shared<RotateZOperation>(propertyValue.getString());
|
|
130
|
+
case TransformOp::Scale:
|
|
131
|
+
return std::make_shared<ScaleOperation>(propertyValue.getDouble());
|
|
132
|
+
case TransformOp::ScaleX:
|
|
133
|
+
return std::make_shared<ScaleXOperation>(propertyValue.getDouble());
|
|
134
|
+
case TransformOp::ScaleY:
|
|
135
|
+
return std::make_shared<ScaleYOperation>(propertyValue.getDouble());
|
|
136
|
+
case TransformOp::TranslateX: {
|
|
137
|
+
if (propertyValue.isNumber()) {
|
|
138
|
+
return std::make_shared<TranslateXOperation>(propertyValue.getDouble());
|
|
139
|
+
}
|
|
140
|
+
return std::make_shared<TranslateXOperation>(propertyValue.getString());
|
|
141
|
+
}
|
|
142
|
+
case TransformOp::TranslateY: {
|
|
143
|
+
if (propertyValue.isNumber()) {
|
|
144
|
+
return std::make_shared<TranslateYOperation>(propertyValue.getDouble());
|
|
145
|
+
}
|
|
146
|
+
return std::make_shared<TranslateYOperation>(propertyValue.getString());
|
|
147
|
+
}
|
|
148
|
+
case TransformOp::SkewX:
|
|
149
|
+
return std::make_shared<SkewXOperation>(propertyValue.getString());
|
|
150
|
+
case TransformOp::SkewY:
|
|
151
|
+
return std::make_shared<SkewYOperation>(propertyValue.getString());
|
|
152
|
+
case TransformOp::Matrix:
|
|
153
|
+
return std::make_shared<MatrixOperation>(propertyValue);
|
|
154
|
+
default:
|
|
155
|
+
throw std::invalid_argument("[Reanimated] Unknown transform operation: " + propertyName);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// TransformOperationBase implementation
|
|
160
|
+
template <TransformOp TOperation, typename TValue>
|
|
161
|
+
TransformOperationBase<TOperation, TValue>::TransformOperationBase(TValue value)
|
|
162
|
+
: TransformOperation(TOperation), value(std::move(value)) {}
|
|
163
|
+
|
|
164
|
+
template <TransformOp TOperation, typename TValue>
|
|
165
|
+
TransformMatrix::Shared TransformOperationBase<TOperation, TValue>::toMatrix(bool force3D) const {
|
|
166
|
+
if constexpr (Resolvable<TValue>) {
|
|
167
|
+
// Handle resolvable operations
|
|
168
|
+
throw std::runtime_error("[Reanimated] Cannot convert resolvable operation to matrix: " + getOperationName());
|
|
169
|
+
} else {
|
|
170
|
+
// Handle regular operations
|
|
171
|
+
const auto shouldBe3D = this->is3D() || force3D;
|
|
172
|
+
|
|
173
|
+
if (cachedMatrix_) {
|
|
174
|
+
const auto resultDimension = shouldBe3D ? MATRIX_3D_DIMENSION : MATRIX_2D_DIMENSION;
|
|
175
|
+
if (cachedMatrix_->getDimension() == resultDimension) {
|
|
176
|
+
return cachedMatrix_;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
TransformMatrix::Shared result;
|
|
181
|
+
if (shouldBe3D) {
|
|
182
|
+
result = std::make_shared<const TransformMatrix3D>(TransformMatrix3D::create<TOperation>(this->value.value));
|
|
183
|
+
} else {
|
|
184
|
+
result = std::make_shared<const TransformMatrix2D>(TransformMatrix2D::create<TOperation>(this->value.value));
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
cachedMatrix_ = result;
|
|
188
|
+
return result;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
template <TransformOp TOperation, typename TValue>
|
|
193
|
+
folly::dynamic TransformOperationBase<TOperation, TValue>::valueToDynamic() const {
|
|
194
|
+
return value.toDynamic();
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
template <TransformOp TOperation, typename TValue>
|
|
198
|
+
bool TransformOperationBase<TOperation, TValue>::areValuesEqual(const StyleOperation &other) const {
|
|
199
|
+
return value == static_cast<const TransformOperationBase<TOperation, TValue> &>(other).value;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// Rotate operations
|
|
203
|
+
template struct TransformOperationBase<TransformOp::Rotate, CSSAngle>;
|
|
204
|
+
template struct TransformOperationBase<TransformOp::RotateZ, CSSAngle>;
|
|
205
|
+
template struct TransformOperationBase<TransformOp::RotateX, CSSAngle>;
|
|
206
|
+
template struct TransformOperationBase<TransformOp::RotateY, CSSAngle>;
|
|
207
|
+
|
|
208
|
+
// Translate operations
|
|
209
|
+
template struct TransformOperationBase<TransformOp::TranslateX, CSSLength>;
|
|
210
|
+
template struct TransformOperationBase<TransformOp::TranslateY, CSSLength>;
|
|
211
|
+
|
|
212
|
+
// Scale operations
|
|
213
|
+
template struct TransformOperationBase<TransformOp::ScaleX, CSSDouble>;
|
|
214
|
+
template struct TransformOperationBase<TransformOp::ScaleY, CSSDouble>;
|
|
215
|
+
template struct TransformOperationBase<TransformOp::Scale, CSSDouble>;
|
|
216
|
+
|
|
217
|
+
// Skew operations
|
|
218
|
+
template struct TransformOperationBase<TransformOp::SkewX, CSSAngle>;
|
|
219
|
+
template struct TransformOperationBase<TransformOp::SkewY, CSSAngle>;
|
|
220
|
+
|
|
221
|
+
// Perspective operation
|
|
222
|
+
template struct TransformOperationBase<TransformOp::Perspective, CSSDouble>;
|
|
223
|
+
|
|
224
|
+
} // namespace reanimated::css
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <reanimated/CSS/common/transforms/TransformMatrix.h>
|
|
4
|
+
#include <reanimated/CSS/common/transforms/TransformOp.h>
|
|
5
|
+
#include <reanimated/CSS/interpolation/operations/StyleOperation.h>
|
|
6
|
+
|
|
7
|
+
#include <jsi/jsi.h>
|
|
8
|
+
#include <memory>
|
|
9
|
+
#include <string>
|
|
10
|
+
#include <vector>
|
|
11
|
+
|
|
12
|
+
namespace reanimated::css {
|
|
13
|
+
|
|
14
|
+
using namespace facebook;
|
|
15
|
+
|
|
16
|
+
// Base struct for TransformOperation
|
|
17
|
+
struct TransformOperation : public StyleOperation {
|
|
18
|
+
explicit TransformOperation(TransformOp type);
|
|
19
|
+
|
|
20
|
+
// Tells if the transform operations is 3D-only (cannot be represented in 2D)
|
|
21
|
+
virtual bool is3D() const;
|
|
22
|
+
|
|
23
|
+
std::string getOperationName() const override;
|
|
24
|
+
|
|
25
|
+
static std::shared_ptr<TransformOperation> fromJSIValue(jsi::Runtime &rt, const jsi::Value &value);
|
|
26
|
+
static std::shared_ptr<TransformOperation> fromDynamic(const folly::dynamic &value);
|
|
27
|
+
|
|
28
|
+
virtual bool canConvertTo(TransformOp type) const;
|
|
29
|
+
virtual std::vector<std::shared_ptr<TransformOperation>> convertTo(TransformOp type) const;
|
|
30
|
+
void assertCanConvertTo(TransformOp type) const;
|
|
31
|
+
|
|
32
|
+
virtual TransformMatrix::Shared toMatrix(bool force3D) const = 0;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
using TransformOperations = std::vector<std::shared_ptr<TransformOperation>>;
|
|
36
|
+
|
|
37
|
+
// Base implementation for transform operations (except for MatrixOperation)
|
|
38
|
+
template <TransformOp TOperation, typename TValue>
|
|
39
|
+
struct TransformOperationBase : public TransformOperation {
|
|
40
|
+
const TValue value;
|
|
41
|
+
|
|
42
|
+
explicit TransformOperationBase(TValue value);
|
|
43
|
+
TransformMatrix::Shared toMatrix(bool force3D) const override;
|
|
44
|
+
|
|
45
|
+
protected:
|
|
46
|
+
mutable TransformMatrix::Shared cachedMatrix_;
|
|
47
|
+
|
|
48
|
+
folly::dynamic valueToDynamic() const override;
|
|
49
|
+
bool areValuesEqual(const StyleOperation &other) const override;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
} // namespace reanimated::css
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
#include <reanimated/CSS/interpolation/transforms/TransformOperationInterpolator.h>
|
|
2
|
+
|
|
3
|
+
#include <reanimated/CSS/interpolation/transforms/operations/rotate.h>
|
|
4
|
+
#include <reanimated/CSS/interpolation/transforms/operations/scale.h>
|
|
5
|
+
#include <reanimated/CSS/interpolation/transforms/operations/skew.h>
|
|
6
|
+
#include <reanimated/CSS/interpolation/transforms/operations/translate.h>
|
|
7
|
+
|
|
8
|
+
#include <utility>
|
|
9
|
+
|
|
10
|
+
namespace reanimated::css {
|
|
11
|
+
|
|
12
|
+
// Base implementation for simple operations
|
|
13
|
+
template <typename TOperation, typename TEnable>
|
|
14
|
+
std::unique_ptr<StyleOperation> TransformOperationInterpolator<TOperation, TEnable>::interpolate(
|
|
15
|
+
double progress,
|
|
16
|
+
const std::shared_ptr<StyleOperation> &from,
|
|
17
|
+
const std::shared_ptr<StyleOperation> &to,
|
|
18
|
+
const StyleOperationsInterpolationContext & /* context */) const {
|
|
19
|
+
const auto &fromOp = *std::static_pointer_cast<TOperation>(from);
|
|
20
|
+
const auto &toOp = *std::static_pointer_cast<TOperation>(to);
|
|
21
|
+
return std::make_unique<TOperation>(fromOp.value.interpolate(progress, toOp.value));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Specialization for PerspectiveOperation
|
|
25
|
+
TransformOperationInterpolator<PerspectiveOperation, void>::TransformOperationInterpolator(
|
|
26
|
+
const std::shared_ptr<PerspectiveOperation> &defaultOperation)
|
|
27
|
+
: StyleOperationInterpolator(defaultOperation) {}
|
|
28
|
+
|
|
29
|
+
std::unique_ptr<StyleOperation> TransformOperationInterpolator<PerspectiveOperation, void>::interpolate(
|
|
30
|
+
double progress,
|
|
31
|
+
const std::shared_ptr<StyleOperation> &from,
|
|
32
|
+
const std::shared_ptr<StyleOperation> &to,
|
|
33
|
+
const StyleOperationsInterpolationContext & /* context */) const {
|
|
34
|
+
// TODO - check if this implementation is correct
|
|
35
|
+
const auto &fromValue = std::static_pointer_cast<PerspectiveOperation>(from)->value;
|
|
36
|
+
const auto &toValue = std::static_pointer_cast<PerspectiveOperation>(to)->value;
|
|
37
|
+
|
|
38
|
+
if (fromValue.value == 0)
|
|
39
|
+
return std::make_unique<PerspectiveOperation>(toValue);
|
|
40
|
+
if (toValue.value == 0)
|
|
41
|
+
return std::make_unique<PerspectiveOperation>(fromValue);
|
|
42
|
+
|
|
43
|
+
return std::make_unique<PerspectiveOperation>(fromValue.interpolate(progress, toValue));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Specialization for MatrixOperation
|
|
47
|
+
TransformOperationInterpolator<MatrixOperation, void>::TransformOperationInterpolator(
|
|
48
|
+
const std::shared_ptr<MatrixOperation> &defaultOperation)
|
|
49
|
+
: StyleOperationInterpolator(defaultOperation) {}
|
|
50
|
+
|
|
51
|
+
std::unique_ptr<StyleOperation> TransformOperationInterpolator<MatrixOperation, void>::interpolate(
|
|
52
|
+
double progress,
|
|
53
|
+
const std::shared_ptr<StyleOperation> &from,
|
|
54
|
+
const std::shared_ptr<StyleOperation> &to,
|
|
55
|
+
const StyleOperationsInterpolationContext &context) const {
|
|
56
|
+
const auto fromOperation = std::static_pointer_cast<TransformOperation>(from);
|
|
57
|
+
const auto toOperation = std::static_pointer_cast<TransformOperation>(to);
|
|
58
|
+
const auto shouldBe3D = fromOperation->is3D() || toOperation->is3D();
|
|
59
|
+
|
|
60
|
+
const auto fromMatrix = matrixFromOperation(fromOperation, shouldBe3D, context);
|
|
61
|
+
const auto toMatrix = matrixFromOperation(toOperation, shouldBe3D, context);
|
|
62
|
+
|
|
63
|
+
if (shouldBe3D) {
|
|
64
|
+
return std::make_unique<MatrixOperation>(interpolateMatrix<TransformMatrix3D>(progress, fromMatrix, toMatrix));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const auto result2D = interpolateMatrix<TransformMatrix2D>(progress, fromMatrix, toMatrix);
|
|
68
|
+
|
|
69
|
+
// Unfortunately 2D matrices aren't handled properly in RN, so we have to
|
|
70
|
+
// convert them to 3D
|
|
71
|
+
// see the issue: https://github.com/facebook/react-native/issues/53639
|
|
72
|
+
return std::make_unique<MatrixOperation>(TransformMatrix3D::from2D(result2D));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
template <typename MatrixType>
|
|
76
|
+
MatrixType TransformOperationInterpolator<MatrixOperation, void>::interpolateMatrix(
|
|
77
|
+
double progress,
|
|
78
|
+
const TransformMatrix::Shared &from,
|
|
79
|
+
const TransformMatrix::Shared &to) const {
|
|
80
|
+
const auto fromMatrix = std::static_pointer_cast<const MatrixType>(from);
|
|
81
|
+
const auto toMatrix = std::static_pointer_cast<const MatrixType>(to);
|
|
82
|
+
const auto decomposedFrom = fromMatrix->decompose();
|
|
83
|
+
const auto decomposedTo = toMatrix->decompose();
|
|
84
|
+
|
|
85
|
+
if (!decomposedFrom.has_value() || !decomposedTo.has_value()) {
|
|
86
|
+
return progress < 0.5 ? *fromMatrix : *toMatrix;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return MatrixType::recompose(decomposedFrom->interpolate(progress, decomposedTo.value()));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
TransformMatrix::Shared TransformOperationInterpolator<MatrixOperation, void>::matrixFromOperation(
|
|
93
|
+
const std::shared_ptr<TransformOperation> &operation,
|
|
94
|
+
const bool shouldBe3D,
|
|
95
|
+
const StyleOperationsInterpolationContext &context) const {
|
|
96
|
+
const auto &matrixOperation = std::static_pointer_cast<MatrixOperation>(operation);
|
|
97
|
+
|
|
98
|
+
if (std::holds_alternative<TransformMatrix::Shared>(matrixOperation->value)) {
|
|
99
|
+
const auto &matrix = std::get<TransformMatrix::Shared>(matrixOperation->value);
|
|
100
|
+
|
|
101
|
+
if (shouldBe3D && !matrixOperation->is3D()) {
|
|
102
|
+
return std::make_shared<TransformMatrix3D>(
|
|
103
|
+
TransformMatrix3D::from2D(static_cast<const TransformMatrix2D &>(*matrix)));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return matrix;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const auto &operations = std::get<TransformOperations>(matrixOperation->value);
|
|
110
|
+
|
|
111
|
+
// Map over operations and resolve unresolved ones
|
|
112
|
+
TransformOperations resolvedOperations;
|
|
113
|
+
resolvedOperations.reserve(operations.size());
|
|
114
|
+
|
|
115
|
+
std::transform(
|
|
116
|
+
operations.begin(),
|
|
117
|
+
operations.end(),
|
|
118
|
+
std::back_inserter(resolvedOperations),
|
|
119
|
+
[&](const auto &operation) -> std::shared_ptr<TransformOperation> {
|
|
120
|
+
if (operation->shouldResolve()) {
|
|
121
|
+
const auto &interpolator = context.interpolators->at(operation->type);
|
|
122
|
+
return std::static_pointer_cast<TransformOperation>(interpolator->resolveOperation(operation, context));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return operation;
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
if (shouldBe3D) {
|
|
129
|
+
return std::make_shared<TransformMatrix3D>(matrixFromOperations3D(resolvedOperations));
|
|
130
|
+
}
|
|
131
|
+
return std::make_shared<TransformMatrix2D>(matrixFromOperations2D(resolvedOperations));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Explicit template instantiations
|
|
135
|
+
template TransformMatrix2D TransformOperationInterpolator<MatrixOperation, void>::interpolateMatrix<TransformMatrix2D>(
|
|
136
|
+
double,
|
|
137
|
+
const TransformMatrix::Shared &,
|
|
138
|
+
const TransformMatrix::Shared &) const;
|
|
139
|
+
template TransformMatrix3D TransformOperationInterpolator<MatrixOperation, void>::interpolateMatrix<TransformMatrix3D>(
|
|
140
|
+
double,
|
|
141
|
+
const TransformMatrix::Shared &,
|
|
142
|
+
const TransformMatrix::Shared &) const;
|
|
143
|
+
|
|
144
|
+
// Specialization for resolvable operations
|
|
145
|
+
template <typename TOperation>
|
|
146
|
+
TransformOperationInterpolator<
|
|
147
|
+
TOperation,
|
|
148
|
+
std::enable_if_t<ResolvableOp<TOperation> && !std::is_same_v<TOperation, PerspectiveOperation> && !std::is_same_v<TOperation, MatrixOperation>>>::TransformOperationInterpolator(
|
|
149
|
+
const std::shared_ptr<TOperation> &defaultOperation,
|
|
150
|
+
ResolvableValueInterpolatorConfig config)
|
|
151
|
+
: StyleOperationInterpolator(defaultOperation), config_(std::move(config)) {}
|
|
152
|
+
|
|
153
|
+
template <typename TOperation>
|
|
154
|
+
std::unique_ptr<StyleOperation> TransformOperationInterpolator<
|
|
155
|
+
TOperation,
|
|
156
|
+
std::enable_if_t<ResolvableOp<TOperation> && !std::is_same_v<TOperation, PerspectiveOperation> && !std::is_same_v<TOperation, MatrixOperation>>>::interpolate(
|
|
157
|
+
double progress,
|
|
158
|
+
const std::shared_ptr<StyleOperation> &from,
|
|
159
|
+
const std::shared_ptr<StyleOperation> &to,
|
|
160
|
+
const StyleOperationsInterpolationContext &context) const {
|
|
161
|
+
const auto &fromOp = *std::static_pointer_cast<TOperation>(from);
|
|
162
|
+
const auto &toOp = *std::static_pointer_cast<TOperation>(to);
|
|
163
|
+
|
|
164
|
+
return std::make_unique<TOperation>(
|
|
165
|
+
fromOp.value.interpolate(progress, toOp.value, getResolvableValueContext(context)));
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
template <typename TOperation>
|
|
169
|
+
std::shared_ptr<StyleOperation> TransformOperationInterpolator<
|
|
170
|
+
TOperation,
|
|
171
|
+
std::enable_if_t<ResolvableOp<TOperation> && !std::is_same_v<TOperation, PerspectiveOperation> && !std::is_same_v<TOperation, MatrixOperation>>>::resolveOperation(
|
|
172
|
+
const std::shared_ptr<StyleOperation> &operation,
|
|
173
|
+
const StyleOperationsInterpolationContext &context) const {
|
|
174
|
+
const auto &resolvableOp = std::static_pointer_cast<TOperation>(operation);
|
|
175
|
+
const auto &resolved = resolvableOp->value.resolve(getResolvableValueContext(context));
|
|
176
|
+
|
|
177
|
+
if (!resolved.has_value()) {
|
|
178
|
+
throw std::invalid_argument(
|
|
179
|
+
"[Reanimated] Cannot resolve resolvable operation: " + operation->getOperationName() +
|
|
180
|
+
" for node with tag: " + std::to_string(context.node->getTag()));
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return std::make_shared<TOperation>(resolved.value());
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
template <typename TOperation>
|
|
187
|
+
ResolvableValueInterpolationContext TransformOperationInterpolator<
|
|
188
|
+
TOperation,
|
|
189
|
+
std::enable_if_t<ResolvableOp<TOperation> && !std::is_same_v<TOperation, PerspectiveOperation> && !std::is_same_v<TOperation, MatrixOperation>>>::getResolvableValueContext(
|
|
190
|
+
const StyleOperationsInterpolationContext &context) const {
|
|
191
|
+
return ResolvableValueInterpolationContext{
|
|
192
|
+
.node = context.node,
|
|
193
|
+
.fallbackInterpolateThreshold = context.fallbackInterpolateThreshold,
|
|
194
|
+
.viewStylesRepository = context.viewStylesRepository,
|
|
195
|
+
.relativeProperty = config_.relativeProperty,
|
|
196
|
+
.relativeTo = config_.relativeTo};
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Rotate operations
|
|
200
|
+
template class TransformOperationInterpolator<RotateOperation, void>;
|
|
201
|
+
template class TransformOperationInterpolator<RotateXOperation, void>;
|
|
202
|
+
template class TransformOperationInterpolator<RotateYOperation, void>;
|
|
203
|
+
template class TransformOperationInterpolator<RotateZOperation, void>;
|
|
204
|
+
|
|
205
|
+
// Scale operations
|
|
206
|
+
template class TransformOperationInterpolator<ScaleOperation, void>;
|
|
207
|
+
template class TransformOperationInterpolator<ScaleXOperation, void>;
|
|
208
|
+
template class TransformOperationInterpolator<ScaleYOperation, void>;
|
|
209
|
+
|
|
210
|
+
// Skew operations
|
|
211
|
+
template class TransformOperationInterpolator<SkewXOperation, void>;
|
|
212
|
+
template class TransformOperationInterpolator<SkewYOperation, void>;
|
|
213
|
+
|
|
214
|
+
// Translate operations (resolvable)
|
|
215
|
+
template class TransformOperationInterpolator<TranslateXOperation>;
|
|
216
|
+
template class TransformOperationInterpolator<TranslateYOperation>;
|
|
217
|
+
|
|
218
|
+
} // namespace reanimated::css
|