@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
|
@@ -4,40 +4,39 @@
|
|
|
4
4
|
#include <reanimated/CSS/progress/KeyframeProgressProvider.h>
|
|
5
5
|
#include <reanimated/CSS/progress/RawProgressProvider.h>
|
|
6
6
|
#include <reanimated/CSS/utils/props.h>
|
|
7
|
+
#include <reanimated/CSS/utils/reversingShortening.h>
|
|
7
8
|
|
|
8
9
|
#include <memory>
|
|
9
10
|
#include <string>
|
|
10
11
|
#include <unordered_map>
|
|
11
12
|
#include <unordered_set>
|
|
13
|
+
#include <vector>
|
|
12
14
|
|
|
13
15
|
namespace reanimated::css {
|
|
14
16
|
|
|
15
|
-
enum class TransitionProgressState : std::uint8_t { Pending, Running
|
|
17
|
+
enum class TransitionProgressState : std::uint8_t { Idle, Pending, Running };
|
|
16
18
|
|
|
17
19
|
class TransitionPropertyProgressProvider final : public KeyframeProgressProvider, public RawProgressProvider {
|
|
18
20
|
public:
|
|
21
|
+
TransitionPropertyProgressProvider(double timestamp, double duration, double delay, EasingConfig easing);
|
|
19
22
|
TransitionPropertyProgressProvider(
|
|
20
23
|
double timestamp,
|
|
21
24
|
double duration,
|
|
22
25
|
double delay,
|
|
23
|
-
|
|
24
|
-
TransitionPropertyProgressProvider(
|
|
25
|
-
double timestamp,
|
|
26
|
-
double duration,
|
|
27
|
-
double delay,
|
|
28
|
-
const EasingFunction &easingFunction,
|
|
26
|
+
EasingConfig easing,
|
|
29
27
|
double reversingShorteningFactor);
|
|
30
28
|
|
|
31
29
|
double getGlobalProgress() const override;
|
|
32
30
|
double getKeyframeProgress(double fromOffset, double toOffset) const override;
|
|
33
31
|
double getRemainingDelay(double timestamp) const;
|
|
34
|
-
|
|
32
|
+
ReversingState getReversingState() const;
|
|
35
33
|
TransitionProgressState getState() const;
|
|
36
34
|
|
|
37
35
|
protected:
|
|
38
36
|
std::optional<double> calculateRawProgress(double timestamp) override;
|
|
39
37
|
|
|
40
38
|
private:
|
|
39
|
+
EasingConfig easing_;
|
|
41
40
|
EasingFunction easingFunction_;
|
|
42
41
|
double reversingShorteningFactor_ = 1;
|
|
43
42
|
|
|
@@ -54,18 +53,22 @@ class TransitionProgressProvider final {
|
|
|
54
53
|
TransitionPropertyProgressProviders getPropertyProgressProviders() const;
|
|
55
54
|
std::unordered_set<std::string> getRemovedProperties() const;
|
|
56
55
|
|
|
56
|
+
void runProgressProvider(const std::string &propertyName, bool isReversed, double timestamp);
|
|
57
|
+
void removeProperties(const std::vector<std::string> &propertyNames);
|
|
58
|
+
void removeProperty(const std::string &propertyName);
|
|
57
59
|
void discardFinishedProgressProviders();
|
|
58
|
-
void discardIrrelevantProgressProviders(const std::unordered_set<std::string> &transitionPropertyNames);
|
|
59
|
-
void runProgressProviders(
|
|
60
|
-
double timestamp,
|
|
61
|
-
const CSSTransitionPropertiesSettings &propertiesSettings,
|
|
62
|
-
const PropertyNames &changedPropertyNames,
|
|
63
|
-
const std::unordered_set<std::string> &reversedPropertyNames);
|
|
64
60
|
void update(double timestamp);
|
|
61
|
+
void setPropertySettings(const PropertiesSettingsMap &changedPropertiesSettings);
|
|
62
|
+
CSSTransitionPropertySettings getPropertySettings(const std::string &propertyName) const;
|
|
65
63
|
|
|
66
64
|
private:
|
|
67
65
|
TransitionPropertyProgressProviders propertyProgressProviders_;
|
|
68
66
|
|
|
67
|
+
// TO DO: currently never cleaned by design - if the property has already been transitioned in the past, we might want
|
|
68
|
+
// to reuse the config (run without settings in the config).
|
|
69
|
+
/// We might want to add an option for clearing those settings in the future.
|
|
70
|
+
PropertiesSettingsMap propertySettings_;
|
|
71
|
+
|
|
69
72
|
std::unordered_set<std::string> removedProperties_;
|
|
70
73
|
|
|
71
74
|
std::shared_ptr<TransitionPropertyProgressProvider> createReversingShorteningProgressProvider(
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#include <reanimated/CSS/registries/CSSAnimationsRegistry.h>
|
|
2
|
+
#include <reanimated/Fabric/updates/UpdatesRegistryManager.h>
|
|
3
|
+
|
|
4
|
+
#include <react/debug/react_native_assert.h>
|
|
2
5
|
|
|
3
6
|
#include <memory>
|
|
4
7
|
#include <string>
|
|
@@ -8,333 +11,202 @@
|
|
|
8
11
|
|
|
9
12
|
namespace reanimated::css {
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
14
|
+
CSSAnimationsRegistry::CSSAnimationsRegistry(
|
|
15
|
+
const std::shared_ptr<OperationsLoop> &loop,
|
|
16
|
+
const std::shared_ptr<CSSKeyframesRegistry> &keyframesRegistry,
|
|
17
|
+
const std::shared_ptr<CSSPlatformAnimationFactory> &platformAnimationFactory)
|
|
18
|
+
: loop_(loop), keyframesRegistry_(keyframesRegistry), platformAnimationFactory_(platformAnimationFactory) {}
|
|
16
19
|
|
|
17
|
-
bool CSSAnimationsRegistry::
|
|
18
|
-
|
|
20
|
+
bool CSSAnimationsRegistry::needsFlush() const {
|
|
21
|
+
react_native_assert(UpdatesRegistryManager::isLockedByCurrentThread());
|
|
22
|
+
return !updatedTags_.empty();
|
|
19
23
|
}
|
|
20
24
|
|
|
21
25
|
void CSSAnimationsRegistry::apply(
|
|
22
|
-
jsi::Runtime &rt,
|
|
23
26
|
const std::shared_ptr<const ShadowNode> &shadowNode,
|
|
24
|
-
const std::
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
double timestamp) {
|
|
28
|
-
auto animationsVector = buildAnimationsVector(rt, shadowNode, animationNames, newAnimations);
|
|
29
|
-
|
|
27
|
+
const std::string &compoundComponentName,
|
|
28
|
+
const CSSAnimationUpdates &updates) {
|
|
29
|
+
react_native_assert(UpdatesRegistryManager::isLockedByCurrentThread());
|
|
30
30
|
const auto viewTag = shadowNode->getTag();
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
31
|
+
auto newGroup =
|
|
32
|
+
maybeBuildNewGroup(shadowNode, compoundComponentName, updates.animationNames, updates.newAnimationSettings);
|
|
35
33
|
|
|
36
|
-
|
|
34
|
+
if (newGroup) {
|
|
35
|
+
auto oldIt = groups_.find(viewTag);
|
|
36
|
+
if (oldIt != groups_.end()) {
|
|
37
|
+
oldIt->second.unschedule(*loop_);
|
|
38
|
+
}
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
for (const auto &[index, _] : settingsUpdates) {
|
|
43
|
-
updatedIndices.push_back(index);
|
|
44
|
-
}
|
|
40
|
+
if (newGroup->getAnimations().empty()) {
|
|
41
|
+
remove(viewTag);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
for (size_t i = 0; i < animationsVector.size(); ++i) {
|
|
48
|
-
scheduleOrActivateAnimation(i, animationsVector[i], timestamp);
|
|
45
|
+
groups_.insert_or_assign(viewTag, std::move(*newGroup));
|
|
49
46
|
}
|
|
50
47
|
|
|
51
|
-
auto
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
auto it = groups_.find(viewTag);
|
|
49
|
+
if (it == groups_.end()) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
54
52
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
auto &group = it->second;
|
|
54
|
+
group.updateSettings(updates.settingsUpdates, loop_->resolveTimestamp());
|
|
55
|
+
group.schedule(*loop_);
|
|
58
56
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
// Set current style to updates registry to ensure that all old
|
|
58
|
+
// styles are removed (replaced by the new style).
|
|
59
|
+
setInUpdatesRegistry(group.getShadowNodeFamily(), group.computeStyle());
|
|
60
|
+
// Mark always as updated to ensure that updates are committed
|
|
61
|
+
updatedTags_.insert(viewTag);
|
|
63
62
|
}
|
|
64
63
|
|
|
65
|
-
void CSSAnimationsRegistry::
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
for (auto it = runningAnimationIndicesMap_.begin(); it != runningAnimationIndicesMap_.end();) {
|
|
73
|
-
const auto viewTag = it->first;
|
|
74
|
-
const std::vector<size_t> animationIndices = {it->second.begin(), it->second.end()};
|
|
75
|
-
updateViewAnimations(viewTag, animationIndices, timestamp, true);
|
|
76
|
-
|
|
77
|
-
if (runningAnimationIndicesMap_[viewTag].empty()) {
|
|
78
|
-
it = runningAnimationIndicesMap_.erase(it);
|
|
79
|
-
} else {
|
|
80
|
-
++it;
|
|
64
|
+
void CSSAnimationsRegistry::flushUpdates(UpdatesBatch &updatesBatch) {
|
|
65
|
+
react_native_assert(UpdatesRegistryManager::isLockedByCurrentThread());
|
|
66
|
+
const auto tags = std::exchange(updatedTags_, {});
|
|
67
|
+
for (const auto viewTag : tags) {
|
|
68
|
+
const auto it = groups_.find(viewTag);
|
|
69
|
+
if (it == groups_.end()) {
|
|
70
|
+
continue;
|
|
81
71
|
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
72
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const std::optional<std::vector<std::string>> &animationNames,
|
|
89
|
-
const std::optional<CSSAnimationsMap> &newAnimations) const {
|
|
90
|
-
const auto registryIt = registry_.find(shadowNode->getTag());
|
|
91
|
-
|
|
92
|
-
// If animationNames has no value, that means no animations were added,
|
|
93
|
-
// removed or reordered, so we can return the current animations vector from
|
|
94
|
-
// the registry
|
|
95
|
-
if (!animationNames.has_value()) {
|
|
96
|
-
if (registryIt != registry_.end()) {
|
|
97
|
-
return registryIt->second.animationsVector;
|
|
73
|
+
const auto updates = it->second.computeStyle(true);
|
|
74
|
+
if (!updates.empty()) {
|
|
75
|
+
addUpdatesToBatch(it->second.getShadowNodeFamily(), updates);
|
|
98
76
|
}
|
|
99
77
|
}
|
|
100
78
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
animationsVector.reserve(animationNamesSize);
|
|
105
|
-
|
|
106
|
-
std::unordered_map<std::string, CSSAnimationsVector> oldAnimationsMap;
|
|
107
|
-
CSSAnimationsMap emptyAnimationsMap;
|
|
108
|
-
const auto &newAnimationsMap = newAnimations.value_or(emptyAnimationsMap);
|
|
109
|
-
|
|
110
|
-
if (registryIt != registry_.end()) {
|
|
111
|
-
const auto &oldAnimations = registryIt->second.animationsVector;
|
|
112
|
-
|
|
113
|
-
// Fill the map while maintaining reverse order (for quick pop from the end)
|
|
114
|
-
for (auto it = oldAnimations.rbegin(); it != oldAnimations.rend(); ++it) {
|
|
115
|
-
oldAnimationsMap[(*it)->getName()].emplace_back(*it);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
79
|
+
flush(updatesBatch);
|
|
80
|
+
updateRegistryForRevertedAnimations();
|
|
81
|
+
}
|
|
118
82
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
83
|
+
#if REACT_NATIVE_VERSION_MINOR >= 85
|
|
84
|
+
void CSSAnimationsRegistry::flushUpdates(UpdatesBatchAnimatedProps &updatesBatch) {
|
|
85
|
+
react_native_assert(UpdatesRegistryManager::isLockedByCurrentThread());
|
|
86
|
+
const auto tags = std::exchange(updatedTags_, {});
|
|
87
|
+
for (const auto viewTag : tags) {
|
|
88
|
+
const auto it = groups_.find(viewTag);
|
|
89
|
+
if (it == groups_.end()) {
|
|
123
90
|
continue;
|
|
124
91
|
}
|
|
125
92
|
|
|
126
|
-
const auto
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
animationsVector.emplace_back(oldAnimationIt->second.back());
|
|
135
|
-
oldAnimationIt->second.pop_back();
|
|
136
|
-
|
|
137
|
-
if (oldAnimationIt->second.empty()) {
|
|
138
|
-
oldAnimationsMap.erase(oldAnimationIt);
|
|
93
|
+
const auto updates = it->second.computeStyle(true);
|
|
94
|
+
if (!updates.empty()) {
|
|
95
|
+
addRawPropsToAnimatedPropsBatch(it->second.getShadowNodeFamily(), updates);
|
|
96
|
+
// Legacy flushes merge each frame into the updates registry; animated-props flushes do not.
|
|
97
|
+
// Keep the registry current so subsequent reads see the latest values.
|
|
98
|
+
setInUpdatesRegistry(it->second.getShadowNodeFamily(), updates);
|
|
139
99
|
}
|
|
140
100
|
}
|
|
141
101
|
|
|
142
|
-
|
|
102
|
+
flush(updatesBatch);
|
|
103
|
+
updateRegistryForRevertedAnimations();
|
|
143
104
|
}
|
|
105
|
+
#endif
|
|
144
106
|
|
|
145
|
-
CSSAnimationsRegistry::
|
|
146
|
-
const CSSAnimationsVector &animationsVector) const {
|
|
147
|
-
AnimationToIndexMap animationToIndexMap;
|
|
107
|
+
CSSAnimationsRegistry::AnimationObserver::AnimationObserver(CSSAnimationsRegistry &owner) : owner_(owner) {}
|
|
148
108
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
return animationToIndexMap;
|
|
109
|
+
void CSSAnimationsRegistry::AnimationObserver::onAnimationUpdate(const Tag viewTag) {
|
|
110
|
+
react_native_assert(UpdatesRegistryManager::isLockedByCurrentThread());
|
|
111
|
+
owner_.updatedTags_.insert(viewTag);
|
|
154
112
|
}
|
|
155
113
|
|
|
156
|
-
void CSSAnimationsRegistry::
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
const double timestamp) {
|
|
160
|
-
for (size_t i = 0; i < animationsVector.size(); ++i) {
|
|
161
|
-
const auto &animation = animationsVector[i];
|
|
162
|
-
const auto it = settingsUpdates.find(i);
|
|
163
|
-
if (it != settingsUpdates.end()) {
|
|
164
|
-
animation->updateSettings(it->second, timestamp);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
114
|
+
void CSSAnimationsRegistry::AnimationObserver::onAnimationNeedsRevert(const Tag viewTag) {
|
|
115
|
+
react_native_assert(UpdatesRegistryManager::isLockedByCurrentThread());
|
|
116
|
+
owner_.pendingRevertTags_.insert(viewTag);
|
|
167
117
|
}
|
|
168
118
|
|
|
169
|
-
void CSSAnimationsRegistry::
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
folly::dynamic result = folly::dynamic::object;
|
|
175
|
-
std::shared_ptr<const ShadowNode> shadowNode = nullptr;
|
|
176
|
-
bool hasUpdates = false;
|
|
177
|
-
|
|
178
|
-
for (const auto animationIndex : animationIndices) {
|
|
179
|
-
const auto &animation = registry_[viewTag].animationsVector[animationIndex];
|
|
180
|
-
if (!shadowNode) {
|
|
181
|
-
shadowNode = animation->getShadowNode();
|
|
182
|
-
}
|
|
183
|
-
if (animation->getState(timestamp) == AnimationProgressState::Pending) {
|
|
184
|
-
animation->run(timestamp);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
bool updatesAddedToBatch = false;
|
|
188
|
-
const auto updates = animation->update(timestamp);
|
|
189
|
-
const auto newState = animation->getState(timestamp);
|
|
190
|
-
|
|
191
|
-
if (newState == AnimationProgressState::Finished) {
|
|
192
|
-
// Revert changes applied during animation if there is no forwards fill
|
|
193
|
-
// mode
|
|
194
|
-
if (addToBatch && !animation->hasForwardsFillMode()) {
|
|
195
|
-
// We also have to manually commit style values
|
|
196
|
-
// reverting the changes applied by the animation.
|
|
197
|
-
hasUpdates = addStyleUpdates(result, animation->getResetStyle(), false) || hasUpdates;
|
|
198
|
-
updatesAddedToBatch = true;
|
|
199
|
-
// We want to remove style changes applied by the animation that is
|
|
200
|
-
// finished and has no forwards fill mode. We cannot simply remove
|
|
201
|
-
// properties from the style in the registry as it may be overridden
|
|
202
|
-
// by the next animation. Instead, we are creating the new style
|
|
203
|
-
// object without reverted (finished without forwards fill mode)
|
|
204
|
-
// animations.
|
|
205
|
-
animationsToRevertMap_[viewTag].insert(animationIndex);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
if (addToBatch && !updatesAddedToBatch) {
|
|
210
|
-
hasUpdates = addStyleUpdates(result, updates, true) || hasUpdates;
|
|
211
|
-
}
|
|
212
|
-
if (newState != AnimationProgressState::Running) {
|
|
213
|
-
runningAnimationIndicesMap_[viewTag].erase(animationIndex);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
if (hasUpdates) {
|
|
218
|
-
addUpdatesToBatch(shadowNode, result);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
void CSSAnimationsRegistry::scheduleOrActivateAnimation(
|
|
223
|
-
const size_t animationIndex,
|
|
224
|
-
const std::shared_ptr<CSSAnimation> &animation,
|
|
225
|
-
const double timestamp) {
|
|
226
|
-
// Remove the animation from delayed (if it is already added to
|
|
227
|
-
// delayed animations)
|
|
228
|
-
delayedAnimationsManager_.remove(animation);
|
|
229
|
-
|
|
230
|
-
const auto startTimestamp = animation->getStartTimestamp(timestamp);
|
|
231
|
-
|
|
232
|
-
if (startTimestamp > timestamp) {
|
|
233
|
-
// If the animation is delayed, schedule it for activation
|
|
234
|
-
// (Only if it isn't paused)
|
|
235
|
-
if (animation->getState(timestamp) != AnimationProgressState::Paused) {
|
|
236
|
-
delayedAnimationsManager_.add(startTimestamp, animation);
|
|
237
|
-
}
|
|
238
|
-
} else {
|
|
239
|
-
const auto viewTag = animation->getShadowNode()->getTag();
|
|
240
|
-
runningAnimationIndicesMap_[viewTag].insert(animationIndex);
|
|
119
|
+
void CSSAnimationsRegistry::removeTag(const Tag viewTag) {
|
|
120
|
+
auto it = groups_.find(viewTag);
|
|
121
|
+
if (it != groups_.end()) {
|
|
122
|
+
it->second.unschedule(*loop_);
|
|
123
|
+
groups_.erase(it);
|
|
241
124
|
}
|
|
125
|
+
removeFromUpdatesRegistry(viewTag);
|
|
242
126
|
}
|
|
243
127
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
128
|
+
std::optional<CSSAnimationsGroup> CSSAnimationsRegistry::maybeBuildNewGroup(
|
|
129
|
+
const std::shared_ptr<const ShadowNode> &shadowNode,
|
|
130
|
+
const std::string &compoundComponentName,
|
|
131
|
+
const std::optional<std::vector<std::string>> &updatedAnimationNames,
|
|
132
|
+
const CSSAnimationSettingsMap &newAnimationSettings) {
|
|
133
|
+
// No animations added/removed/reordered — nothing to build
|
|
134
|
+
if (!updatedAnimationNames.has_value()) {
|
|
135
|
+
return std::nullopt;
|
|
252
136
|
}
|
|
253
|
-
runningAnimationIndicesMap_.erase(viewTag);
|
|
254
|
-
}
|
|
255
137
|
|
|
256
|
-
|
|
257
|
-
const auto
|
|
258
|
-
// Remove the style from the registry if there are no animations for the view
|
|
259
|
-
if (it == registry_.end() || it->second.animationsVector.empty()) {
|
|
260
|
-
removeFromUpdatesRegistry(viewTag);
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
138
|
+
const auto viewTag = shadowNode->getTag();
|
|
139
|
+
const auto groupIt = groups_.find(viewTag);
|
|
263
140
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
for (const auto &animation : it->second.animationsVector) {
|
|
268
|
-
const auto startTimestamp = animation->getStartTimestamp(timestamp);
|
|
269
|
-
|
|
270
|
-
folly::dynamic style;
|
|
271
|
-
const auto ¤tState = animation->getState(timestamp);
|
|
272
|
-
if (startTimestamp > timestamp && animation->hasBackwardsFillMode()) {
|
|
273
|
-
style = animation->getBackwardsFillStyle();
|
|
274
|
-
} else if (
|
|
275
|
-
currentState == AnimationProgressState::Running ||
|
|
276
|
-
// Animation is paused after start (was running before)
|
|
277
|
-
(currentState == AnimationProgressState::Paused && timestamp >= animation->getStartTimestamp(timestamp)) ||
|
|
278
|
-
// Animation is finished and has fill forwards fill mode
|
|
279
|
-
(currentState == AnimationProgressState::Finished && animation->hasForwardsFillMode())) {
|
|
280
|
-
style = animation->getCurrentInterpolationStyle();
|
|
281
|
-
}
|
|
141
|
+
const auto &names = updatedAnimationNames.value();
|
|
142
|
+
const auto timestamp = loop_->resolveTimestamp();
|
|
282
143
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
144
|
+
// Index old animations by name (reversed for quick pop)
|
|
145
|
+
std::unordered_map<std::string, CSSAnimationsVector> oldByName;
|
|
146
|
+
if (groupIt != groups_.end()) {
|
|
147
|
+
for (auto it = groupIt->second.getAnimations().rbegin(); it != groupIt->second.getAnimations().rend(); ++it) {
|
|
148
|
+
oldByName[(*it)->getName()].emplace_back(*it);
|
|
288
149
|
}
|
|
289
150
|
}
|
|
290
151
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
void CSSAnimationsRegistry::activateDelayedAnimations(const double timestamp) {
|
|
295
|
-
while (!delayedAnimationsManager_.empty() && delayedAnimationsManager_.top().timestamp <= timestamp) {
|
|
296
|
-
const auto [_, animation] = delayedAnimationsManager_.pop();
|
|
297
|
-
const auto viewTag = animation->getShadowNode()->getTag();
|
|
152
|
+
// Build new vector — create new or reuse old
|
|
153
|
+
CSSAnimationsVector animations;
|
|
154
|
+
animations.reserve(names.size());
|
|
298
155
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}
|
|
156
|
+
for (size_t i = 0; i < names.size(); ++i) {
|
|
157
|
+
const auto &name = names[i];
|
|
158
|
+
const auto settingsIt = newAnimationSettings.find(i);
|
|
303
159
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
160
|
+
if (settingsIt != newAnimationSettings.end()) {
|
|
161
|
+
animations.emplace_back(createAnimation(shadowNode, name, compoundComponentName, settingsIt->second, timestamp));
|
|
162
|
+
} else {
|
|
163
|
+
auto oldIt = oldByName.find(name);
|
|
164
|
+
if (oldIt == oldByName.end()) {
|
|
165
|
+
throw std::runtime_error(
|
|
166
|
+
"[Reanimated] There is no animation with name " + name + " available to use at index " + std::to_string(i));
|
|
167
|
+
}
|
|
168
|
+
animations.emplace_back(oldIt->second.back());
|
|
169
|
+
oldIt->second.pop_back();
|
|
170
|
+
if (oldIt->second.empty()) {
|
|
171
|
+
oldByName.erase(oldIt);
|
|
172
|
+
}
|
|
307
173
|
}
|
|
308
|
-
|
|
309
|
-
const auto animationIndex = animationToIndexMap.at(animation);
|
|
310
|
-
runningAnimationIndicesMap_[viewTag].insert(animationIndex);
|
|
311
174
|
}
|
|
312
|
-
}
|
|
313
175
|
|
|
314
|
-
|
|
315
|
-
for (const auto &[viewTag, _] : animationsToRevertMap_) {
|
|
316
|
-
applyViewAnimationsStyle(viewTag, timestamp);
|
|
317
|
-
}
|
|
318
|
-
animationsToRevertMap_.clear();
|
|
176
|
+
return CSSAnimationsGroup(shadowNode, std::move(animations));
|
|
319
177
|
}
|
|
320
178
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
const
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
179
|
+
std::shared_ptr<CSSAnimation> CSSAnimationsRegistry::createAnimation(
|
|
180
|
+
const std::shared_ptr<const ShadowNode> &shadowNode,
|
|
181
|
+
const std::string &name,
|
|
182
|
+
const std::string &compoundComponentName,
|
|
183
|
+
const CSSAnimationSettings &settings,
|
|
184
|
+
const double timestamp) {
|
|
185
|
+
const auto keyframesConfig = keyframesRegistry_->get(name, compoundComponentName);
|
|
186
|
+
if (!keyframesConfig) {
|
|
187
|
+
throw std::runtime_error(
|
|
188
|
+
"[Reanimated] No keyframes with name `" + name + "` were registered for component `" +
|
|
189
|
+
splitCompoundComponentName(compoundComponentName).second + "` (" + shadowNode->getComponentName() + ")");
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return std::make_shared<CSSAnimation>(
|
|
193
|
+
shadowNode->getTag(),
|
|
194
|
+
name,
|
|
195
|
+
keyframesConfig->get(),
|
|
196
|
+
settings,
|
|
197
|
+
animationObserver_,
|
|
198
|
+
platformAnimationFactory_,
|
|
199
|
+
timestamp);
|
|
200
|
+
}
|
|
328
201
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
202
|
+
void CSSAnimationsRegistry::updateRegistryForRevertedAnimations() {
|
|
203
|
+
const auto tags = std::exchange(pendingRevertTags_, {});
|
|
204
|
+
for (const auto viewTag : tags) {
|
|
205
|
+
const auto it = groups_.find(viewTag);
|
|
206
|
+
if (it != groups_.end()) {
|
|
207
|
+
setInUpdatesRegistry(it->second.getShadowNodeFamily(), it->second.computeStyle());
|
|
334
208
|
}
|
|
335
209
|
}
|
|
336
|
-
|
|
337
|
-
return hasUpdates;
|
|
338
210
|
}
|
|
339
211
|
|
|
340
212
|
} // namespace reanimated::css
|