@react-native-ohos/react-native-reanimated 4.0.2-beta.1 → 4.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1070 -0
- package/LICENSE +21 -0
- package/README.md +842 -0
- package/compatibility.json +20 -26
- package/harmony/reanimated/BuildProfile.ets +1 -1
- package/harmony/reanimated/index.ets +4 -2
- package/harmony/reanimated/oh-package-lock.json5 +1 -1
- package/harmony/reanimated/oh-package.json5 +1 -1
- package/harmony/reanimated/src/main/cpp/CMakeLists.txt +23 -9
- package/harmony/reanimated/src/main/cpp/Common/NativeView/CMakeLists.txt +56 -0
- package/harmony/reanimated/src/main/cpp/Common/NativeView/react/renderer/components/rnreanimated/ComponentDescriptors.h +19 -0
- package/harmony/reanimated/src/main/cpp/Common/NativeView/react/renderer/components/rnreanimated/REASharedTransitionBoundaryComponentDescriptor.h +30 -0
- package/harmony/reanimated/src/main/cpp/Common/NativeView/react/renderer/components/rnreanimated/REASharedTransitionBoundaryShadowNode.cpp +15 -0
- package/harmony/reanimated/src/main/cpp/Common/NativeView/react/renderer/components/rnreanimated/REASharedTransitionBoundaryShadowNode.h +41 -0
- package/harmony/reanimated/src/main/cpp/Common/NativeView/react/renderer/components/rnreanimated/REASharedTransitionBoundaryState.h +30 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.cpp +8 -9
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.h +3 -6
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/InterpolatorRegistry.cpp +203 -150
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/InterpolatorRegistry.h +1 -6
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/definitions.h +2 -7
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSAngle.cpp +0 -1
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSColor.cpp +2 -18
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSDiscreteArray.cpp +11 -11
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSDiscreteArray.h +2 -6
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSLength.cpp +4 -1
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSNumber.cpp +5 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSNumber.h +8 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSValue.h +27 -46
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSValueVariant.cpp +20 -20
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSValueVariant.h +2 -2
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/complex/CSSDropShadow.h +3 -3
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSAnimationConfig.cpp +10 -2
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSAnimationConfig.h +5 -3
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSKeyframesConfig.cpp +20 -17
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSKeyframesConfig.h +5 -8
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSTransitionConfig.cpp +33 -66
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSTransitionConfig.h +29 -22
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/common.cpp +14 -2
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/common.h +8 -2
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSAnimation.cpp +50 -91
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSAnimation.h +43 -18
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSAnimationsGroup.cpp +63 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSAnimationsGroup.h +37 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSLoopAnimation.cpp +100 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSLoopAnimation.h +49 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSPlatformAnimation.h +13 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSPlatformAnimationFactory.h +32 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/transition/CSSLoopTransition.cpp +156 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/transition/CSSLoopTransition.h +71 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/transition/CSSPlatformTransitionProxy.cpp +141 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/transition/CSSPlatformTransitionProxy.h +104 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/transition/CSSTransition.cpp +97 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/transition/CSSTransition.h +69 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/EasingConfigs.cpp +89 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/EasingConfigs.h +36 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/InterpolatorFactory.cpp +12 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/InterpolatorFactory.h +11 -2
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/PropertyInterpolator.cpp +2 -3
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/PropertyInterpolator.h +3 -5
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterOperation.cpp +3 -3
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterOperation.h +1 -1
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/ArrayPropertiesInterpolator.cpp +38 -37
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/ArrayPropertiesInterpolator.h +3 -6
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/RecordPropertiesInterpolator.cpp +54 -32
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/RecordPropertiesInterpolator.h +5 -7
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/OperationsStyleInterpolator.cpp +46 -46
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/OperationsStyleInterpolator.h +8 -7
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/StyleOperation.h +4 -57
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/AnimationStyleInterpolator.cpp +23 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/AnimationStyleInterpolator.h +10 -8
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/AnimationStyleInterpolatorFactory.cpp +77 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/AnimationStyleInterpolatorFactory.h +38 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/TransitionStyleInterpolator.cpp +47 -68
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/TransitionStyleInterpolator.h +21 -9
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperation.cpp +4 -1
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperationInterpolator.cpp +35 -78
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperationInterpolator.h +44 -13
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/matrix.cpp +13 -11
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ResolvableValueInterpolator.cpp +4 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/SimpleValueInterpolator.cpp +7 -3
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ValueInterpolator.cpp +20 -27
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ValueInterpolator.h +12 -9
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/misc/ViewStylesRepository.cpp +63 -36
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/misc/ViewStylesRepository.h +6 -8
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/AnimationProgressProvider.cpp +55 -46
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/AnimationProgressProvider.h +8 -5
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/RawProgressProvider.cpp +1 -2
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/RawProgressProvider.h +3 -2
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/TransitionProgressProvider.cpp +76 -71
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/TransitionProgressProvider.h +17 -14
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSAnimationsRegistry.cpp +145 -273
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSAnimationsRegistry.h +43 -44
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSKeyframesRegistry.cpp +19 -19
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSKeyframesRegistry.h +16 -12
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSTransitionsRegistry.cpp +95 -114
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSTransitionsRegistry.h +38 -25
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/StaticPropsRegistry.cpp +9 -34
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/StaticPropsRegistry.h +0 -10
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/CSSLengthArray.cpp +47 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/CSSLengthArray.h +24 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/CSSLengthVector.cpp +87 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/CSSLengthVector.h +28 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGPath.cpp +326 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGPath.h +65 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGStops.cpp +164 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGStops.h +51 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGStrokeDashArray.cpp +14 -66
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGStrokeDashArray.h +7 -18
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/platform.cpp +284 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/platform.h +31 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/props.cpp +13 -132
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/props.h +3 -21
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/reversingShortening.h +43 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Compat/WorkletsApi.h +13 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Events/UIEventHandler.cpp +33 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Events/UIEventHandler.h +39 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Events/UIEventHandlerRegistry.cpp +95 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Events/UIEventHandlerRegistry.h +40 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.cpp +20 -23
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.h +2 -6
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.cpp +26 -18
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.h +4 -8
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.cpp +16 -28
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.h +3 -4
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.cpp +72 -24
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.h +17 -7
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/OperationsLoop.cpp +152 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/OperationsLoop.h +86 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/PropsLayoutFilter.h +98 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistry.cpp +162 -28
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistry.h +69 -11
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistryManager.cpp +41 -17
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistryManager.h +14 -3
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/propNameFromString.h +130 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.cpp +1 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.h +5 -7
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.cpp +7 -4
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.h +52 -9
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.cpp +174 -62
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.h +12 -11
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.cpp +251 -128
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.h +23 -19
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.h +34 -6
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/SharedTransitions.cpp +71 -64
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.cpp +938 -700
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.h +123 -76
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/SynchronousPropsBufferSerializer.cpp +313 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/SynchronousPropsBufferSerializer.h +18 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/PseudoStyles/PseudoSelector.h +41 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/PseudoStyles/PseudoStylesRegistry.cpp +113 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/PseudoStyles/PseudoStylesRegistry.h +73 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.cpp +4 -4
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.cpp +23 -48
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.h +13 -14
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/PlatformDepMethodsHolder.h +20 -3
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReaJSIUtils.h +227 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReanimatedVersion.cpp +51 -14
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReanimatedVersion.h +2 -5
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/SingleInstanceChecker.h +76 -0
- package/harmony/reanimated/src/main/cpp/OHOSCSSPlatformTransitions.cpp +353 -0
- package/harmony/reanimated/src/main/cpp/OHOSCSSPlatformTransitions.h +95 -0
- package/harmony/reanimated/src/main/cpp/PseudoSelectorManager.cpp +140 -0
- package/harmony/reanimated/src/main/cpp/PseudoSelectorManager.h +52 -0
- package/harmony/reanimated/src/main/cpp/REASharedTransitionBoundaryComponentInstance.cpp +45 -0
- package/harmony/reanimated/src/main/cpp/REASharedTransitionBoundaryComponentInstance.h +33 -0
- package/harmony/reanimated/src/main/cpp/REASharedTransitionBoundaryJSIBinder.h +20 -0
- package/harmony/reanimated/src/main/cpp/ReanimatedModule.cpp +112 -19
- package/harmony/reanimated/src/main/cpp/ReanimatedModule.h +4 -2
- package/harmony/reanimated/src/main/cpp/ReanimatedNodesManager.cpp +1 -1
- package/harmony/reanimated/src/main/cpp/ReanimatedNodesManager.h +1 -1
- package/harmony/reanimated/src/main/cpp/ReanimatedPackage.cpp +24 -1
- package/harmony/reanimated/src/main/cpp/ReanimatedPackage.h +7 -2
- package/harmony/reanimated/src/main/cpp/ReanimatedSensor.cpp +88 -57
- package/harmony/reanimated/src/main/cpp/ReanimatedSensor.h +4 -2
- package/harmony/reanimated/src/main/cpp/ReanimatedSensorContainer.cpp +1 -1
- package/harmony/reanimated/src/main/cpp/ReanimatedSensorContainer.h +1 -1
- package/harmony/reanimated/src/main/cpp/ReanimatedUIScheduler.cpp +9 -7
- package/harmony/reanimated/src/main/cpp/ReanimatedUIScheduler.h +6 -5
- package/harmony/reanimated/src/main/cpp/TransformParser.h +1 -1
- package/harmony/reanimated/src/main/cpp/codegen/react/renderer/components/rnreanimated/EventEmitters.h +19 -0
- package/harmony/reanimated/src/main/cpp/codegen/react/renderer/components/rnreanimated/Props.h +31 -0
- package/harmony/reanimated/src/main/ets/KeyboardState.ts +11 -0
- package/harmony/reanimated/src/main/ets/ReanimatedModule.ts +119 -19
- package/harmony/reanimated/src/main/ets/{ReanimatedPackage.ts → ReanimatedPackage.ets} +4 -3
- package/harmony/reanimated.har +0 -0
- package/package.json +52 -24
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSTransition.cpp +0 -145
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSTransition.h +0 -47
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGLength.cpp +0 -93
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGLength.h +0 -36
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/DelayedItemsManager.cpp +0 -75
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/DelayedItemsManager.h +0 -45
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.cpp +0 -183
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.h +0 -93
- package/harmony/reanimated/src/main/ets/AnimationManager.ts +0 -61
- /package/harmony/reanimated/{ts.ts → ts.ets} +0 -0
|
@@ -16,22 +16,20 @@ class RecordPropertiesInterpolator : public GroupPropertiesInterpolator {
|
|
|
16
16
|
const std::shared_ptr<ViewStylesRepository> &viewStylesRepository);
|
|
17
17
|
virtual ~RecordPropertiesInterpolator() = default;
|
|
18
18
|
|
|
19
|
-
bool equalsReversingAdjustedStartValue(const folly::dynamic &propertyValue) const override;
|
|
20
|
-
|
|
21
19
|
void updateKeyframes(jsi::Runtime &rt, const jsi::Value &keyframes) override;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const folly::dynamic &lastUpdateValue) override;
|
|
20
|
+
bool updateKeyframes(jsi::Runtime &rt, const jsi::Value &fromValue, const jsi::Value &toValue) override;
|
|
21
|
+
/** TODO: unify folly::dynamic and jsi::value versions */
|
|
22
|
+
bool updateKeyframes(const folly::dynamic &fromValue, const folly::dynamic &toValue) override;
|
|
26
23
|
|
|
27
24
|
protected:
|
|
25
|
+
PropertyInterpolatorsRecord interpolators_;
|
|
26
|
+
|
|
28
27
|
folly::dynamic mapInterpolators(const std::function<folly::dynamic(PropertyInterpolator &)> &callback) const override;
|
|
29
28
|
|
|
30
29
|
void maybeCreateInterpolator(const std::string &propertyName);
|
|
31
30
|
|
|
32
31
|
private:
|
|
33
32
|
const InterpolatorFactoriesRecord &factories_;
|
|
34
|
-
PropertyInterpolatorsRecord interpolators_;
|
|
35
33
|
};
|
|
36
34
|
|
|
37
35
|
} // namespace reanimated::css
|
|
@@ -14,7 +14,8 @@ OperationsStyleInterpolator::OperationsStyleInterpolator(
|
|
|
14
14
|
const folly::dynamic &defaultStyleValueDynamic)
|
|
15
15
|
: PropertyInterpolator(propertyPath, viewStylesRepository),
|
|
16
16
|
interpolators_(interpolators),
|
|
17
|
-
defaultStyleValueDynamic_(defaultStyleValueDynamic)
|
|
17
|
+
defaultStyleValueDynamic_(defaultStyleValueDynamic),
|
|
18
|
+
reversingAdjustedStartValue_(std::nullopt) {}
|
|
18
19
|
|
|
19
20
|
folly::dynamic OperationsStyleInterpolator::getStyleValue(const std::shared_ptr<const ShadowNode> &shadowNode) const {
|
|
20
21
|
return viewStylesRepository_->getStyleProp(shadowNode->getTag(), propertyPath_);
|
|
@@ -40,31 +41,6 @@ folly::dynamic OperationsStyleInterpolator::getLastKeyframeValue() const {
|
|
|
40
41
|
return toOperations.has_value() ? convertOperationsToDynamic(toOperations.value()) : defaultStyleValueDynamic_;
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
bool OperationsStyleInterpolator::equalsReversingAdjustedStartValue(const folly::dynamic &propertyValue) const {
|
|
44
|
-
const auto propertyOperations = parseStyleOperations(propertyValue);
|
|
45
|
-
|
|
46
|
-
if (!reversingAdjustedStartValue_.has_value()) {
|
|
47
|
-
return !propertyOperations.has_value();
|
|
48
|
-
} else if (!propertyOperations.has_value()) {
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const auto &reversingAdjustedOperationsValue = reversingAdjustedStartValue_.value();
|
|
53
|
-
const auto &propertyOperationsValue = propertyOperations.value();
|
|
54
|
-
|
|
55
|
-
if (reversingAdjustedOperationsValue.size() != propertyOperationsValue.size()) {
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
for (size_t i = 0; i < reversingAdjustedOperationsValue.size(); ++i) {
|
|
60
|
-
if (*reversingAdjustedOperationsValue[i] != *propertyOperationsValue[i]) {
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return true;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
44
|
folly::dynamic OperationsStyleInterpolator::interpolate(
|
|
69
45
|
const std::shared_ptr<const ShadowNode> &shadowNode,
|
|
70
46
|
const std::shared_ptr<KeyframeProgressProvider> &progressProvider,
|
|
@@ -126,25 +102,35 @@ void OperationsStyleInterpolator::updateKeyframes(jsi::Runtime &rt, const jsi::V
|
|
|
126
102
|
}
|
|
127
103
|
}
|
|
128
104
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
105
|
+
bool OperationsStyleInterpolator::updateKeyframes(
|
|
106
|
+
jsi::Runtime &rt,
|
|
107
|
+
const jsi::Value &fromValue,
|
|
108
|
+
const jsi::Value &toValue) {
|
|
109
|
+
const auto fromOperations = parseStyleOperations(rt, fromValue);
|
|
110
|
+
const auto toOperations = parseStyleOperations(rt, toValue);
|
|
111
|
+
|
|
112
|
+
const auto equalsReversingAdjustedStartValue = areStyleOperationsEqual(toOperations, reversingAdjustedStartValue_);
|
|
113
|
+
reversingAdjustedStartValue_ = keyframes_.empty() ? fromOperations : keyframes_[0]->toOperations;
|
|
114
|
+
|
|
115
|
+
keyframes_.clear();
|
|
116
|
+
keyframes_.reserve(1);
|
|
117
|
+
keyframes_.emplace_back(createStyleOperationsKeyframe(0, 1, fromOperations, toOperations));
|
|
138
118
|
|
|
139
|
-
|
|
119
|
+
return equalsReversingAdjustedStartValue;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
bool OperationsStyleInterpolator::updateKeyframes(const folly::dynamic &fromValue, const folly::dynamic &toValue) {
|
|
123
|
+
const auto fromOperations = parseStyleOperations(fromValue);
|
|
124
|
+
const auto toOperations = parseStyleOperations(toValue);
|
|
125
|
+
|
|
126
|
+
const auto equalsReversingAdjustedStartValue = areStyleOperationsEqual(toOperations, reversingAdjustedStartValue_);
|
|
127
|
+
reversingAdjustedStartValue_ = keyframes_.empty() ? fromOperations : keyframes_[0]->toOperations;
|
|
140
128
|
|
|
141
129
|
keyframes_.clear();
|
|
142
130
|
keyframes_.reserve(1);
|
|
143
|
-
keyframes_.emplace_back(createStyleOperationsKeyframe(
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
parseStyleOperations(prevStyleValue).value_or(StyleOperations{}),
|
|
147
|
-
parseStyleOperations(newStyleValue).value_or(StyleOperations{})));
|
|
131
|
+
keyframes_.emplace_back(createStyleOperationsKeyframe(0, 1, fromOperations, toOperations));
|
|
132
|
+
|
|
133
|
+
return equalsReversingAdjustedStartValue;
|
|
148
134
|
}
|
|
149
135
|
|
|
150
136
|
std::optional<StyleOperations> OperationsStyleInterpolator::parseStyleOperations(
|
|
@@ -262,6 +248,13 @@ folly::dynamic OperationsStyleInterpolator::interpolateOperations(
|
|
|
262
248
|
return result;
|
|
263
249
|
}
|
|
264
250
|
|
|
251
|
+
StyleOperationsInterpolationContext OperationsStyleInterpolator::createUpdateContext(
|
|
252
|
+
const std::shared_ptr<const ShadowNode> &shadowNode,
|
|
253
|
+
const double fallbackInterpolateThreshold) const {
|
|
254
|
+
return StyleOperationsInterpolationContext{
|
|
255
|
+
shadowNode, viewStylesRepository_, interpolators_, fallbackInterpolateThreshold};
|
|
256
|
+
}
|
|
257
|
+
|
|
265
258
|
folly::dynamic OperationsStyleInterpolator::convertOperationsToDynamic(const StyleOperations &operations) {
|
|
266
259
|
auto result = folly::dynamic::array();
|
|
267
260
|
result.reserve(operations.size());
|
|
@@ -273,11 +266,18 @@ folly::dynamic OperationsStyleInterpolator::convertOperationsToDynamic(const Sty
|
|
|
273
266
|
return result;
|
|
274
267
|
}
|
|
275
268
|
|
|
276
|
-
|
|
277
|
-
const std::
|
|
278
|
-
const
|
|
279
|
-
|
|
280
|
-
|
|
269
|
+
bool OperationsStyleInterpolator::areStyleOperationsEqual(
|
|
270
|
+
const std::optional<StyleOperations> &ops1,
|
|
271
|
+
const std::optional<StyleOperations> &ops2) {
|
|
272
|
+
if (ops1.has_value() != ops2.has_value()) {
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
if (!ops1.has_value()) {
|
|
276
|
+
return true;
|
|
277
|
+
}
|
|
278
|
+
return std::equal(ops1->begin(), ops1->end(), ops2->begin(), ops2->end(), [](const auto &lhs, const auto &rhs) {
|
|
279
|
+
return *lhs == *rhs;
|
|
280
|
+
});
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
// OperationsStyleInterpolatorBase implementation
|
|
@@ -37,7 +37,6 @@ class OperationsStyleInterpolator : public PropertyInterpolator {
|
|
|
37
37
|
folly::dynamic getResetStyle(const std::shared_ptr<const ShadowNode> &shadowNode) const override;
|
|
38
38
|
folly::dynamic getFirstKeyframeValue() const override;
|
|
39
39
|
folly::dynamic getLastKeyframeValue() const override;
|
|
40
|
-
bool equalsReversingAdjustedStartValue(const folly::dynamic &propertyValue) const override;
|
|
41
40
|
|
|
42
41
|
folly::dynamic interpolate(
|
|
43
42
|
const std::shared_ptr<const ShadowNode> &shadowNode,
|
|
@@ -45,10 +44,9 @@ class OperationsStyleInterpolator : public PropertyInterpolator {
|
|
|
45
44
|
const double fallbackInterpolateThreshold) const override;
|
|
46
45
|
|
|
47
46
|
void updateKeyframes(jsi::Runtime &rt, const jsi::Value &keyframes) override;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const folly::dynamic &lastUpdateValue) override;
|
|
47
|
+
bool updateKeyframes(jsi::Runtime &rt, const jsi::Value &fromValue, const jsi::Value &toValue) override;
|
|
48
|
+
/** TODO: unify folly::dynamic and jsi::value versions */
|
|
49
|
+
bool updateKeyframes(const folly::dynamic &fromValue, const folly::dynamic &toValue) override;
|
|
52
50
|
|
|
53
51
|
protected:
|
|
54
52
|
const std::shared_ptr<StyleOperationInterpolators> interpolators_;
|
|
@@ -62,8 +60,8 @@ class OperationsStyleInterpolator : public PropertyInterpolator {
|
|
|
62
60
|
private:
|
|
63
61
|
const folly::dynamic defaultStyleValueDynamic_;
|
|
64
62
|
|
|
65
|
-
std::vector<std::shared_ptr<StyleOperationsKeyframe>> keyframes_;
|
|
66
63
|
std::optional<StyleOperations> reversingAdjustedStartValue_;
|
|
64
|
+
std::vector<std::shared_ptr<StyleOperationsKeyframe>> keyframes_;
|
|
67
65
|
|
|
68
66
|
std::optional<StyleOperations> parseStyleOperations(jsi::Runtime &rt, const jsi::Value &values) const;
|
|
69
67
|
std::optional<StyleOperations> parseStyleOperations(const folly::dynamic &values) const;
|
|
@@ -80,10 +78,13 @@ class OperationsStyleInterpolator : public PropertyInterpolator {
|
|
|
80
78
|
const StyleOperations &fromOperations,
|
|
81
79
|
const StyleOperations &toOperations,
|
|
82
80
|
double fallbackInterpolateThreshold) const;
|
|
83
|
-
static folly::dynamic convertOperationsToDynamic(const StyleOperations &operations);
|
|
84
81
|
StyleOperationsInterpolationContext createUpdateContext(
|
|
85
82
|
const std::shared_ptr<const ShadowNode> &shadowNode,
|
|
86
83
|
double fallbackInterpolateThreshold) const;
|
|
84
|
+
static folly::dynamic convertOperationsToDynamic(const StyleOperations &operations);
|
|
85
|
+
static bool areStyleOperationsEqual(
|
|
86
|
+
const std::optional<StyleOperations> &ops1,
|
|
87
|
+
const std::optional<StyleOperations> &ops2);
|
|
87
88
|
};
|
|
88
89
|
|
|
89
90
|
template <typename TOperation>
|
|
@@ -13,65 +13,12 @@ namespace reanimated::css {
|
|
|
13
13
|
|
|
14
14
|
using namespace facebook;
|
|
15
15
|
|
|
16
|
-
//template <typename TOperation>
|
|
17
|
-
//concept ResolvableOp = requires(TOperation operation) {
|
|
18
|
-
// { operation.value } -> std::convertible_to<typename std::remove_reference_t<decltype(operation.value)>>;
|
|
19
|
-
// requires Resolvable<std::remove_reference_t<decltype(operation.value)>>;
|
|
20
|
-
//}; // NOLINT(readability/braces)
|
|
21
|
-
|
|
22
|
-
//template<typename TOperation>
|
|
23
|
-
//struct IsResolvableOpHelper {
|
|
24
|
-
//private:
|
|
25
|
-
// template<typename T>
|
|
26
|
-
// static auto test(int) -> decltype(
|
|
27
|
-
// std::declval<T>().value,
|
|
28
|
-
// std::declval<typename std::remove_reference_t<decltype(std::declval<T>().value)>>(),
|
|
29
|
-
// std::declval<Resolvable<typename std::remove_reference_t<decltype(std::declval<T>().value)>>>(),
|
|
30
|
-
// std::true_type{}
|
|
31
|
-
// );
|
|
32
|
-
//
|
|
33
|
-
// template<typename T>
|
|
34
|
-
// static std::false_type test(...);
|
|
35
|
-
//
|
|
36
|
-
//public:
|
|
37
|
-
// using type = decltype(test<TOperation>(0));
|
|
38
|
-
//};
|
|
39
|
-
//
|
|
40
|
-
//template<typename TOperation>
|
|
41
|
-
//constexpr bool ResolvableOp = IsResolvableOpHelper<TOperation>::type::value;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
template <typename T>
|
|
45
|
-
using value_type_t = decltype(std::declval<T>().value);
|
|
46
|
-
|
|
47
|
-
template <typename T>
|
|
48
|
-
using remove_ref_value_type_t = std::remove_reference_t<value_type_t<T>>;
|
|
49
|
-
|
|
50
|
-
template <typename T, typename = void>
|
|
51
|
-
struct has_value_member : std::false_type {};
|
|
52
|
-
|
|
53
|
-
template <typename T>
|
|
54
|
-
struct has_value_member<T, std::void_t<decltype(std::declval<T>().value)>> : std::true_type {};
|
|
55
|
-
|
|
56
|
-
template <typename T, typename = void>
|
|
57
|
-
struct is_resolvable_op_impl : std::false_type {};
|
|
58
|
-
|
|
59
|
-
template <typename T>
|
|
60
|
-
struct is_resolvable_op_impl<
|
|
61
|
-
T,
|
|
62
|
-
std::enable_if_t<
|
|
63
|
-
has_value_member<T>::value &&
|
|
64
|
-
std::is_convertible<value_type_t<T>, remove_ref_value_type_t<T>>::value &&
|
|
65
|
-
Resolvable<remove_ref_value_type_t<T>>>> : std::true_type {};
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
template <typename TOperation>
|
|
69
|
-
struct is_resolvable_op : reanimated::css::is_resolvable_op_impl<TOperation> {};
|
|
70
|
-
|
|
71
16
|
template <typename TOperation>
|
|
72
|
-
|
|
17
|
+
concept ResolvableOp = requires(TOperation operation) {
|
|
18
|
+
{ operation.value } -> std::convertible_to<typename std::remove_reference_t<decltype(operation.value)>>;
|
|
19
|
+
requires Resolvable<std::remove_reference_t<decltype(operation.value)>>;
|
|
20
|
+
}; // NOLINT(readability/braces)
|
|
73
21
|
|
|
74
|
-
//is_resolvable_op_v
|
|
75
22
|
struct StyleOperation {
|
|
76
23
|
uint8_t type;
|
|
77
24
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#include <reanimated/CSS/interpolation/styles/AnimationStyleInterpolator.h>
|
|
2
|
+
|
|
3
|
+
namespace reanimated::css {
|
|
4
|
+
|
|
5
|
+
AnimationStyleInterpolator::AnimationStyleInterpolator(
|
|
6
|
+
const std::string &nativeComponentName,
|
|
7
|
+
const std::shared_ptr<ViewStylesRepository> &viewStylesRepository,
|
|
8
|
+
const std::shared_ptr<const PropertyInterpolatorsRecord> &allInterpolators)
|
|
9
|
+
: RecordPropertiesInterpolator(getComponentInterpolators(nativeComponentName), {}, viewStylesRepository),
|
|
10
|
+
allInterpolators_(allInterpolators) {}
|
|
11
|
+
|
|
12
|
+
void AnimationStyleInterpolator::setActiveProperties(const std::unordered_set<std::string> &propertyNames) {
|
|
13
|
+
interpolators_.clear();
|
|
14
|
+
|
|
15
|
+
for (const auto &propertyName : propertyNames) {
|
|
16
|
+
const auto it = allInterpolators_->find(propertyName);
|
|
17
|
+
if (it != allInterpolators_->end()) {
|
|
18
|
+
interpolators_[propertyName] = it->second;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
} // namespace reanimated::css
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
#include <memory>
|
|
7
7
|
#include <string>
|
|
8
|
+
#include <unordered_set>
|
|
8
9
|
|
|
9
10
|
namespace reanimated::css {
|
|
10
11
|
|
|
@@ -13,14 +14,15 @@ namespace reanimated::css {
|
|
|
13
14
|
// same as interpolating record properties
|
|
14
15
|
class AnimationStyleInterpolator : public RecordPropertiesInterpolator {
|
|
15
16
|
public:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
const std::
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
AnimationStyleInterpolator(
|
|
18
|
+
const std::string &nativeComponentName,
|
|
19
|
+
const std::shared_ptr<ViewStylesRepository> &viewStylesRepository,
|
|
20
|
+
const std::shared_ptr<const PropertyInterpolatorsRecord> &allInterpolators);
|
|
21
|
+
|
|
22
|
+
void setActiveProperties(const std::unordered_set<std::string> &propertyNames);
|
|
23
|
+
|
|
24
|
+
private:
|
|
25
|
+
const std::shared_ptr<const PropertyInterpolatorsRecord> allInterpolators_;
|
|
24
26
|
};
|
|
25
27
|
|
|
26
28
|
} // namespace reanimated::css
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#include <reanimated/CSS/InterpolatorRegistry.h>
|
|
2
|
+
#include <reanimated/CSS/interpolation/styles/AnimationStyleInterpolatorFactory.h>
|
|
3
|
+
#include <reanimated/CSS/utils/interpolators.h>
|
|
4
|
+
|
|
5
|
+
#include <memory>
|
|
6
|
+
#include <utility>
|
|
7
|
+
|
|
8
|
+
namespace reanimated::css {
|
|
9
|
+
|
|
10
|
+
AnimationStyleInterpolatorFactory::AnimationStyleInterpolatorFactory(
|
|
11
|
+
jsi::Runtime &rt,
|
|
12
|
+
const jsi::Value &keyframes,
|
|
13
|
+
std::string nativeComponentName,
|
|
14
|
+
const std::shared_ptr<ViewStylesRepository> &viewStylesRepository)
|
|
15
|
+
: nativeComponentName_(std::move(nativeComponentName)),
|
|
16
|
+
viewStylesRepository_(viewStylesRepository),
|
|
17
|
+
factories_(getComponentInterpolators(nativeComponentName_)),
|
|
18
|
+
interpolatorsByProperty_(
|
|
19
|
+
std::make_shared<PropertyInterpolatorsRecord>(parseInterpolatorsByProperty(rt, keyframes))),
|
|
20
|
+
allPropertyNames_(collectPropertyNames(interpolatorsByProperty_)) {}
|
|
21
|
+
|
|
22
|
+
std::shared_ptr<AnimationStyleInterpolator> AnimationStyleInterpolatorFactory::create(
|
|
23
|
+
const std::unordered_set<std::string> &propertyNames) const {
|
|
24
|
+
auto interpolator = std::make_shared<AnimationStyleInterpolator>(
|
|
25
|
+
nativeComponentName_, viewStylesRepository_, interpolatorsByProperty_);
|
|
26
|
+
interpolator->setActiveProperties(propertyNames);
|
|
27
|
+
return interpolator;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
std::shared_ptr<AnimationStyleInterpolator> AnimationStyleInterpolatorFactory::create() const {
|
|
31
|
+
return create(getAllPropertyNames());
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const std::unordered_set<std::string> &AnimationStyleInterpolatorFactory::getAllPropertyNames() const {
|
|
35
|
+
return allPropertyNames_;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
PropertyInterpolatorsRecord AnimationStyleInterpolatorFactory::parseInterpolatorsByProperty(
|
|
39
|
+
jsi::Runtime &rt,
|
|
40
|
+
const jsi::Value &keyframes) const {
|
|
41
|
+
PropertyInterpolatorsRecord interpolatorsByProperty;
|
|
42
|
+
const auto keyframesObject = keyframes.asObject(rt);
|
|
43
|
+
const auto propertyNames = keyframesObject.getPropertyNames(rt);
|
|
44
|
+
const auto propertiesCount = propertyNames.size(rt);
|
|
45
|
+
interpolatorsByProperty.reserve(propertiesCount);
|
|
46
|
+
|
|
47
|
+
for (size_t i = 0; i < propertiesCount; ++i) {
|
|
48
|
+
const auto propertyName = propertyNames.getValueAtIndex(rt, i).asString(rt).utf8(rt);
|
|
49
|
+
const auto propertyKeyframes = keyframesObject.getProperty(rt, jsi::PropNameID::forUtf8(rt, propertyName));
|
|
50
|
+
auto propertyInterpolator = createPropertyInterpolator(propertyName, {}, factories_, viewStylesRepository_);
|
|
51
|
+
propertyInterpolator->updateKeyframes(rt, propertyKeyframes);
|
|
52
|
+
interpolatorsByProperty.emplace(propertyName, std::move(propertyInterpolator));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return interpolatorsByProperty;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
std::unordered_set<std::string> AnimationStyleInterpolatorFactory::collectPropertyNames(
|
|
59
|
+
const std::shared_ptr<const PropertyInterpolatorsRecord> &interpolatorsByProperty) {
|
|
60
|
+
std::unordered_set<std::string> propertyNames;
|
|
61
|
+
propertyNames.reserve(interpolatorsByProperty->size());
|
|
62
|
+
for (const auto &[propertyName, _] : *interpolatorsByProperty) {
|
|
63
|
+
propertyNames.insert(propertyName);
|
|
64
|
+
}
|
|
65
|
+
return propertyNames;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
folly::dynamic AnimationStyleInterpolatorFactory::getResetStyle(
|
|
69
|
+
const std::shared_ptr<const ShadowNode> &shadowNode) const {
|
|
70
|
+
folly::dynamic style = folly::dynamic::object;
|
|
71
|
+
for (const auto &[name, interpolator] : *interpolatorsByProperty_) {
|
|
72
|
+
style[name] = interpolator->getResetStyle(shadowNode);
|
|
73
|
+
}
|
|
74
|
+
return style;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
} // namespace reanimated::css
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <reanimated/CSS/interpolation/styles/AnimationStyleInterpolator.h>
|
|
4
|
+
|
|
5
|
+
#include <memory>
|
|
6
|
+
#include <string>
|
|
7
|
+
#include <unordered_set>
|
|
8
|
+
|
|
9
|
+
namespace reanimated::css {
|
|
10
|
+
|
|
11
|
+
class AnimationStyleInterpolatorFactory {
|
|
12
|
+
public:
|
|
13
|
+
AnimationStyleInterpolatorFactory(
|
|
14
|
+
jsi::Runtime &rt,
|
|
15
|
+
const jsi::Value &keyframes,
|
|
16
|
+
std::string nativeComponentName,
|
|
17
|
+
const std::shared_ptr<ViewStylesRepository> &viewStylesRepository);
|
|
18
|
+
|
|
19
|
+
std::shared_ptr<AnimationStyleInterpolator> create() const;
|
|
20
|
+
std::shared_ptr<AnimationStyleInterpolator> create(const std::unordered_set<std::string> &propertyNames) const;
|
|
21
|
+
|
|
22
|
+
const std::unordered_set<std::string> &getAllPropertyNames() const;
|
|
23
|
+
|
|
24
|
+
folly::dynamic getResetStyle(const std::shared_ptr<const ShadowNode> &shadowNode) const;
|
|
25
|
+
|
|
26
|
+
private:
|
|
27
|
+
const std::string nativeComponentName_;
|
|
28
|
+
const std::shared_ptr<ViewStylesRepository> viewStylesRepository_;
|
|
29
|
+
const InterpolatorFactoriesRecord &factories_;
|
|
30
|
+
std::shared_ptr<const PropertyInterpolatorsRecord> interpolatorsByProperty_;
|
|
31
|
+
const std::unordered_set<std::string> allPropertyNames_;
|
|
32
|
+
|
|
33
|
+
PropertyInterpolatorsRecord parseInterpolatorsByProperty(jsi::Runtime &rt, const jsi::Value &keyframes) const;
|
|
34
|
+
static std::unordered_set<std::string> collectPropertyNames(
|
|
35
|
+
const std::shared_ptr<const PropertyInterpolatorsRecord> &interpolatorsByProperty);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
} // namespace reanimated::css
|
|
@@ -7,97 +7,76 @@
|
|
|
7
7
|
namespace reanimated::css {
|
|
8
8
|
|
|
9
9
|
TransitionStyleInterpolator::TransitionStyleInterpolator(
|
|
10
|
-
const std::string &
|
|
10
|
+
const std::string &nativeComponentName,
|
|
11
11
|
const std::shared_ptr<ViewStylesRepository> &viewStylesRepository)
|
|
12
|
-
:
|
|
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
|
-
}
|
|
12
|
+
: nativeComponentName_(nativeComponentName), viewStylesRepository_(viewStylesRepository) {}
|
|
35
13
|
|
|
36
14
|
folly::dynamic TransitionStyleInterpolator::interpolate(
|
|
37
15
|
const std::shared_ptr<const ShadowNode> &shadowNode,
|
|
38
|
-
const TransitionProgressProvider &transitionProgressProvider
|
|
39
|
-
const std::unordered_set<std::string> &allowDiscreteProperties) const {
|
|
16
|
+
const TransitionProgressProvider &transitionProgressProvider) const {
|
|
40
17
|
folly::dynamic result = folly::dynamic::object;
|
|
41
18
|
|
|
42
|
-
const auto allFallbackInterpolateThreshold = allowDiscreteProperties.contains("all") ? 0.5 : 0;
|
|
43
|
-
|
|
44
19
|
for (const auto &[propertyName, progressProvider] : transitionProgressProvider.getPropertyProgressProviders()) {
|
|
45
20
|
const auto &interpolator = interpolators_.at(propertyName);
|
|
46
|
-
const auto fallbackInterpolateThreshold =
|
|
47
|
-
(allowDiscreteProperties.contains(propertyName)) ? 0.5 : allFallbackInterpolateThreshold;
|
|
21
|
+
const auto fallbackInterpolateThreshold = (allowDiscreteProperties_.contains(propertyName)) ? 0.5 : 0;
|
|
48
22
|
result[propertyName] = interpolator->interpolate(shadowNode, progressProvider, fallbackInterpolateThreshold);
|
|
49
23
|
}
|
|
50
24
|
|
|
51
25
|
return result;
|
|
52
26
|
}
|
|
53
27
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
28
|
+
bool TransitionStyleInterpolator::createOrUpdateInterpolator(
|
|
29
|
+
jsi::Runtime &rt,
|
|
30
|
+
const std::string &propertyName,
|
|
31
|
+
const jsi::Value &fromValue,
|
|
32
|
+
const jsi::Value &toValue) {
|
|
33
|
+
const auto &interpolator = getOrCreateInterpolator(propertyName);
|
|
34
|
+
return interpolator->updateKeyframes(rt, fromValue, toValue);
|
|
59
35
|
}
|
|
60
36
|
|
|
61
|
-
|
|
62
|
-
const std::
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
it = interpolators_.erase(it);
|
|
68
|
-
} else {
|
|
69
|
-
++it;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
37
|
+
bool TransitionStyleInterpolator::createOrUpdateInterpolator(
|
|
38
|
+
const std::string &propertyName,
|
|
39
|
+
const folly::dynamic &fromValue,
|
|
40
|
+
const folly::dynamic &toValue) {
|
|
41
|
+
const auto &interpolator = getOrCreateInterpolator(propertyName);
|
|
42
|
+
return interpolator->updateKeyframes(fromValue, toValue);
|
|
72
43
|
}
|
|
73
44
|
|
|
74
|
-
void TransitionStyleInterpolator::
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
45
|
+
void TransitionStyleInterpolator::setAllowDiscrete(const std::string &propertyName, const bool allowDiscrete) {
|
|
46
|
+
if (allowDiscrete) {
|
|
47
|
+
allowDiscreteProperties_.insert(propertyName);
|
|
48
|
+
} else {
|
|
49
|
+
allowDiscreteProperties_.erase(propertyName);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
81
52
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
53
|
+
void TransitionStyleInterpolator::removeProperties(const std::vector<std::string> &propertyNames) {
|
|
54
|
+
for (const auto &propertyName : propertyNames) {
|
|
55
|
+
interpolators_.erase(propertyName);
|
|
56
|
+
allowDiscreteProperties_.erase(propertyName);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
85
59
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
it = interpolators_.emplace(propertyName, newInterpolator).first;
|
|
90
|
-
}
|
|
60
|
+
void TransitionStyleInterpolator::removeProperty(const std::string &propertyName) {
|
|
61
|
+
interpolators_.erase(propertyName);
|
|
62
|
+
}
|
|
91
63
|
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
(shouldCreateInterpolator || lastUpdateValue.empty()) ? empty : lastUpdateValue.getDefault(propertyName, empty);
|
|
64
|
+
void TransitionStyleInterpolator::discardFinishedInterpolators(
|
|
65
|
+
const TransitionProgressProvider &transitionProgressProvider) {
|
|
66
|
+
const auto &removedProperties = transitionProgressProvider.getRemovedProperties();
|
|
67
|
+
removeProperties(std::vector<std::string>(removedProperties.begin(), removedProperties.end()));
|
|
68
|
+
}
|
|
98
69
|
|
|
99
|
-
|
|
70
|
+
std::shared_ptr<PropertyInterpolator> TransitionStyleInterpolator::getOrCreateInterpolator(
|
|
71
|
+
const std::string &propertyName) {
|
|
72
|
+
if (!interpolators_.contains(propertyName)) {
|
|
73
|
+
interpolators_.emplace(
|
|
74
|
+
propertyName,
|
|
75
|
+
createPropertyInterpolator(
|
|
76
|
+
propertyName, {}, getComponentInterpolators(nativeComponentName_), viewStylesRepository_));
|
|
100
77
|
}
|
|
78
|
+
|
|
79
|
+
return interpolators_.at(propertyName);
|
|
101
80
|
}
|
|
102
81
|
|
|
103
82
|
} // namespace reanimated::css
|
|
@@ -9,34 +9,46 @@
|
|
|
9
9
|
#include <string>
|
|
10
10
|
#include <unordered_map>
|
|
11
11
|
#include <unordered_set>
|
|
12
|
+
#include <vector>
|
|
12
13
|
|
|
13
14
|
namespace reanimated::css {
|
|
14
15
|
|
|
15
16
|
class TransitionStyleInterpolator {
|
|
16
17
|
public:
|
|
17
18
|
TransitionStyleInterpolator(
|
|
18
|
-
const std::string &
|
|
19
|
+
const std::string &nativeComponentName,
|
|
19
20
|
const std::shared_ptr<ViewStylesRepository> &viewStylesRepository);
|
|
20
21
|
|
|
21
|
-
std::unordered_set<std::string> getReversedPropertyNames(const folly::dynamic &newPropertyValues) const;
|
|
22
|
-
|
|
23
22
|
folly::dynamic interpolate(
|
|
24
23
|
const std::shared_ptr<const ShadowNode> &shadowNode,
|
|
25
|
-
const TransitionProgressProvider &transitionProgressProvider
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
const TransitionProgressProvider &transitionProgressProvider) const;
|
|
25
|
+
|
|
26
|
+
bool createOrUpdateInterpolator(
|
|
27
|
+
jsi::Runtime &rt,
|
|
28
|
+
const std::string &propertyName,
|
|
29
|
+
const jsi::Value &fromValue,
|
|
30
|
+
const jsi::Value &toValue);
|
|
31
|
+
/** TODO: unify folly::dynamic and jsi::value versions */
|
|
32
|
+
bool createOrUpdateInterpolator(
|
|
33
|
+
const std::string &propertyName,
|
|
34
|
+
const folly::dynamic &fromValue,
|
|
35
|
+
const folly::dynamic &toValue);
|
|
36
|
+
void setAllowDiscrete(const std::string &propertyName, bool allowDiscrete);
|
|
37
|
+
void removeProperties(const std::vector<std::string> &propertyNames);
|
|
38
|
+
void removeProperty(const std::string &propertyName);
|
|
28
39
|
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
40
|
|
|
32
41
|
private:
|
|
33
42
|
using MapInterpolatorsCallback = std::function<
|
|
34
43
|
folly::dynamic(const std::shared_ptr<PropertyInterpolator> &, const std::shared_ptr<KeyframeProgressProvider> &)>;
|
|
35
44
|
|
|
36
|
-
const std::string
|
|
45
|
+
const std::string nativeComponentName_;
|
|
37
46
|
const std::shared_ptr<ViewStylesRepository> viewStylesRepository_;
|
|
38
47
|
|
|
39
48
|
PropertyInterpolatorsRecord interpolators_;
|
|
49
|
+
std::unordered_set<std::string> allowDiscreteProperties_;
|
|
50
|
+
|
|
51
|
+
std::shared_ptr<PropertyInterpolator> getOrCreateInterpolator(const std::string &propertyName);
|
|
40
52
|
};
|
|
41
53
|
|
|
42
54
|
} // namespace reanimated::css
|