@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
package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSTransitionConfig.cpp
CHANGED
|
@@ -1,87 +1,54 @@
|
|
|
1
1
|
#include <reanimated/CSS/configs/CSSTransitionConfig.h>
|
|
2
|
-
|
|
3
|
-
#include <
|
|
2
|
+
#include <reanimated/CSS/configs/common.h>
|
|
3
|
+
#include <reanimated/CSS/utils/props.h>
|
|
4
4
|
|
|
5
5
|
namespace reanimated::css {
|
|
6
6
|
|
|
7
|
-
std::optional<CSSTransitionPropertySettings> getTransitionPropertySettings(
|
|
8
|
-
const CSSTransitionPropertiesSettings &propertiesSettings,
|
|
9
|
-
const std::string &propName) {
|
|
10
|
-
// Try to use property specific settings first
|
|
11
|
-
const auto &propIt = propertiesSettings.find(propName);
|
|
12
|
-
if (propIt != propertiesSettings.end()) {
|
|
13
|
-
return propIt->second;
|
|
14
|
-
}
|
|
15
|
-
// Fallback to "all" settings if no property specific settings are available
|
|
16
|
-
const auto &allIt = propertiesSettings.find("all");
|
|
17
|
-
if (allIt != propertiesSettings.end()) {
|
|
18
|
-
return allIt->second;
|
|
19
|
-
}
|
|
20
|
-
// Or return nullopt if no settings are available
|
|
21
|
-
return std::nullopt;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
TransitionProperties getProperties(jsi::Runtime &rt, const jsi::Object &config) {
|
|
25
|
-
const auto transitionProperty = config.getProperty(rt, "properties");
|
|
26
|
-
|
|
27
|
-
if (transitionProperty.isObject()) {
|
|
28
|
-
PropertyNames properties;
|
|
29
|
-
|
|
30
|
-
const auto propertiesArray = transitionProperty.asObject(rt).asArray(rt);
|
|
31
|
-
const auto propertiesCount = propertiesArray.size(rt);
|
|
32
|
-
for (size_t i = 0; i < propertiesCount; ++i) {
|
|
33
|
-
properties.emplace_back(propertiesArray.getValueAtIndex(rt, i).asString(rt).utf8(rt));
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return properties;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return std::nullopt;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
7
|
bool getAllowDiscrete(jsi::Runtime &rt, const jsi::Object &config) {
|
|
43
8
|
return config.getProperty(rt, "allowDiscrete").asBool();
|
|
44
9
|
}
|
|
45
10
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const auto propertyNames =
|
|
11
|
+
CSSTransitionConfig
|
|
12
|
+
parseCSSTransitionConfig(jsi::Runtime &rt, const std::string &componentName, const jsi::Value &config) {
|
|
13
|
+
const auto configObj = config.asObject(rt);
|
|
14
|
+
const auto propertyNames = configObj.getPropertyNames(rt);
|
|
50
15
|
const auto propertiesCount = propertyNames.size(rt);
|
|
51
16
|
|
|
17
|
+
CSSTransitionConfig result;
|
|
18
|
+
|
|
52
19
|
for (size_t i = 0; i < propertiesCount; ++i) {
|
|
53
20
|
const auto propertyName = propertyNames.getValueAtIndex(rt, i).asString(rt).utf8(rt);
|
|
54
|
-
const auto
|
|
21
|
+
const auto propertyValue = configObj.getProperty(rt, jsi::PropNameID::forUtf8(rt, propertyName));
|
|
55
22
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
getTimingFunction(rt, propertySettings),
|
|
61
|
-
getDelay(rt, propertySettings),
|
|
62
|
-
getAllowDiscrete(rt, propertySettings)});
|
|
63
|
-
}
|
|
23
|
+
if (propertyValue.isNull() || propertyValue.isUndefined()) {
|
|
24
|
+
result.removedProperties.emplace_back(propertyName);
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
64
27
|
|
|
65
|
-
|
|
66
|
-
|
|
28
|
+
const auto propertySettingsObj = propertyValue.asObject(rt);
|
|
29
|
+
const auto allowDiscrete = getAllowDiscrete(rt, propertySettingsObj);
|
|
67
30
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
31
|
+
// Inherently-discrete properties without allowDiscrete are not transitioned;
|
|
32
|
+
// route them to removedProperties so any active animation cleans up.
|
|
33
|
+
if (!allowDiscrete && isDiscreteProperty(propertyName, componentName)) {
|
|
34
|
+
result.removedProperties.emplace_back(propertyName);
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
74
37
|
|
|
75
|
-
|
|
76
|
-
|
|
38
|
+
const auto valueArray = propertySettingsObj.getProperty(rt, "value").asObject(rt).asArray(rt);
|
|
39
|
+
auto oldValue = valueArray.getValueAtIndex(rt, 0);
|
|
40
|
+
auto newValue = valueArray.getValueAtIndex(rt, 1);
|
|
77
41
|
|
|
78
|
-
|
|
42
|
+
result.changedPropertiesSettings.emplace(
|
|
43
|
+
propertyName,
|
|
44
|
+
CSSTransitionPropertySettings{
|
|
45
|
+
getDuration(rt, propertySettingsObj),
|
|
46
|
+
getEasingConfig(rt, propertySettingsObj),
|
|
47
|
+
getDelay(rt, propertySettingsObj),
|
|
48
|
+
allowDiscrete,
|
|
49
|
+
});
|
|
79
50
|
|
|
80
|
-
|
|
81
|
-
result.properties = getProperties(rt, partialObj);
|
|
82
|
-
}
|
|
83
|
-
if (partialObj.hasProperty(rt, "settings")) {
|
|
84
|
-
result.settings = parseCSSTransitionPropertiesSettings(rt, partialObj.getProperty(rt, "settings").asObject(rt));
|
|
51
|
+
result.changedProperties.emplace(propertyName, std::make_pair(std::move(oldValue), std::move(newValue)));
|
|
85
52
|
}
|
|
86
53
|
|
|
87
54
|
return result;
|
package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSTransitionConfig.h
CHANGED
|
@@ -1,43 +1,50 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
-
#include <reanimated/CSS/common/definitions.h>
|
|
4
3
|
#include <reanimated/CSS/configs/common.h>
|
|
5
|
-
#include <reanimated/CSS/easing/EasingFunctions.h>
|
|
6
4
|
|
|
5
|
+
#include <folly/dynamic.h>
|
|
6
|
+
#include <jsi/jsi.h>
|
|
7
7
|
#include <string>
|
|
8
8
|
#include <unordered_map>
|
|
9
|
+
#include <utility>
|
|
10
|
+
#include <vector>
|
|
9
11
|
|
|
10
12
|
namespace reanimated::css {
|
|
11
13
|
|
|
12
14
|
struct CSSTransitionPropertySettings {
|
|
13
15
|
double duration;
|
|
14
|
-
|
|
16
|
+
EasingConfig easingConfig;
|
|
15
17
|
double delay;
|
|
16
18
|
bool allowDiscrete;
|
|
17
19
|
};
|
|
18
20
|
|
|
19
|
-
using
|
|
21
|
+
using PropertyValueDiff = std::pair<jsi::Value, jsi::Value>;
|
|
22
|
+
/** TODO: unify folly::dynamic and jsi::value versions */
|
|
23
|
+
using PropertyValueDynamicDiff = std::pair<folly::dynamic, folly::dynamic>;
|
|
20
24
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
struct PartialCSSTransitionConfig {
|
|
27
|
-
std::optional<TransitionProperties> properties;
|
|
28
|
-
std::optional<CSSTransitionPropertiesSettings> settings;
|
|
29
|
-
};
|
|
25
|
+
using PropertyValueDiffsMap = std::unordered_map<std::string, PropertyValueDiff>;
|
|
26
|
+
/** TODO: unify folly::dynamic and jsi::value versions */
|
|
27
|
+
using PropertyValueDynamicDiffsMap = std::unordered_map<std::string, PropertyValueDynamicDiff>;
|
|
30
28
|
|
|
31
|
-
std::
|
|
32
|
-
const CSSTransitionPropertiesSettings &propertiesSettings,
|
|
33
|
-
const std::string &propName);
|
|
29
|
+
using PropertiesSettingsMap = std::unordered_map<std::string, CSSTransitionPropertySettings>;
|
|
34
30
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
struct CSSTransitionConfig {
|
|
32
|
+
PropertiesSettingsMap changedPropertiesSettings;
|
|
33
|
+
PropertyValueDiffsMap changedProperties;
|
|
34
|
+
std::vector<std::string> removedProperties;
|
|
35
|
+
|
|
36
|
+
bool hasSettingsUpdates() const {
|
|
37
|
+
return !changedPropertiesSettings.empty() || !removedProperties.empty();
|
|
38
|
+
}
|
|
39
|
+
bool hasValueUpdates() const {
|
|
40
|
+
return !changedProperties.empty();
|
|
41
|
+
}
|
|
42
|
+
bool empty() const {
|
|
43
|
+
return !hasSettingsUpdates() && !hasValueUpdates();
|
|
44
|
+
}
|
|
45
|
+
};
|
|
40
46
|
|
|
41
|
-
|
|
47
|
+
CSSTransitionConfig
|
|
48
|
+
parseCSSTransitionConfig(jsi::Runtime &rt, const std::string &componentName, const jsi::Value &config);
|
|
42
49
|
|
|
43
50
|
} // namespace reanimated::css
|
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
#include <reanimated/CSS/configs/common.h>
|
|
2
2
|
|
|
3
|
+
#include <react/renderer/componentregistry/componentNameByReactViewName.h>
|
|
4
|
+
|
|
5
|
+
using facebook::react::componentNameByReactViewName;
|
|
6
|
+
|
|
3
7
|
namespace reanimated::css {
|
|
4
8
|
|
|
5
9
|
double getDuration(jsi::Runtime &rt, const jsi::Object &config) {
|
|
6
10
|
return config.getProperty(rt, "duration").asNumber();
|
|
7
11
|
}
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
return
|
|
13
|
+
EasingConfig getEasingConfig(jsi::Runtime &rt, const jsi::Object &config) {
|
|
14
|
+
return getEasingConfig(rt, config.getProperty(rt, "timingFunction"));
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
double getDelay(jsi::Runtime &rt, const jsi::Object &config) {
|
|
14
18
|
return config.getProperty(rt, "delay").asNumber();
|
|
15
19
|
}
|
|
16
20
|
|
|
21
|
+
std::pair<std::string, std::string> splitCompoundComponentName(const std::string &compoundComponentName) {
|
|
22
|
+
const auto pos = compoundComponentName.find('$');
|
|
23
|
+
if (pos == std::string::npos) {
|
|
24
|
+
return {compoundComponentName, ""};
|
|
25
|
+
}
|
|
26
|
+
return {compoundComponentName.substr(0, pos), compoundComponentName.substr(pos + 1)};
|
|
27
|
+
}
|
|
28
|
+
|
|
17
29
|
} // namespace reanimated::css
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
-
#include <
|
|
3
|
+
#include <jsi/jsi.h>
|
|
4
|
+
#include <reanimated/CSS/easing/EasingConfigs.h>
|
|
5
|
+
|
|
6
|
+
#include <string>
|
|
7
|
+
#include <utility>
|
|
4
8
|
|
|
5
9
|
namespace reanimated::css {
|
|
6
10
|
|
|
7
11
|
double getDuration(jsi::Runtime &rt, const jsi::Object &config);
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
EasingConfig getEasingConfig(jsi::Runtime &rt, const jsi::Object &config);
|
|
10
14
|
|
|
11
15
|
double getDelay(jsi::Runtime &rt, const jsi::Object &config);
|
|
12
16
|
|
|
17
|
+
std::pair<std::string, std::string> splitCompoundComponentName(const std::string &compoundComponentName);
|
|
18
|
+
|
|
13
19
|
} // namespace reanimated::css
|
|
@@ -1,127 +1,86 @@
|
|
|
1
1
|
#include <reanimated/CSS/core/CSSAnimation.h>
|
|
2
|
+
#include <reanimated/CSS/core/CSSLoopAnimation.h>
|
|
3
|
+
#include <reanimated/Tools/FeatureFlags.h>
|
|
2
4
|
|
|
3
5
|
#include <memory>
|
|
4
|
-
#include <string>
|
|
5
6
|
#include <utility>
|
|
6
7
|
|
|
7
8
|
namespace reanimated::css {
|
|
8
9
|
|
|
9
10
|
CSSAnimation::CSSAnimation(
|
|
10
|
-
|
|
11
|
-
std::shared_ptr<const ShadowNode> shadowNode,
|
|
11
|
+
const Tag viewTag,
|
|
12
12
|
std::string animationName,
|
|
13
13
|
const CSSKeyframesConfig &cssKeyframesConfig,
|
|
14
14
|
const CSSAnimationSettings &settings,
|
|
15
|
+
Observer &observer,
|
|
16
|
+
const std::shared_ptr<CSSPlatformAnimationFactory> &platformAnimationFactory,
|
|
15
17
|
const double timestamp)
|
|
16
|
-
:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const std::string &CSSAnimation::getName() const {
|
|
34
|
-
return name_;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
std::shared_ptr<const ShadowNode> CSSAnimation::getShadowNode() const {
|
|
38
|
-
return shadowNode_;
|
|
18
|
+
: viewTag_(viewTag),
|
|
19
|
+
name_(std::move(animationName)),
|
|
20
|
+
keyframesConfig_(cssKeyframesConfig),
|
|
21
|
+
settings_(std::make_shared<CSSAnimationSettings>(settings)),
|
|
22
|
+
styleInterpolator_(cssKeyframesConfig.styleInterpolatorFactory->create()),
|
|
23
|
+
loopAnimation_(std::make_shared<CSSLoopAnimation>(
|
|
24
|
+
viewTag,
|
|
25
|
+
styleInterpolator_,
|
|
26
|
+
settings_,
|
|
27
|
+
cssKeyframesConfig.keyframeEasingConfigs,
|
|
28
|
+
observer,
|
|
29
|
+
timestamp)),
|
|
30
|
+
platformAnimationFactory_(platformAnimationFactory) {
|
|
31
|
+
updatePropertyRouting();
|
|
39
32
|
}
|
|
40
33
|
|
|
41
|
-
|
|
42
|
-
return
|
|
34
|
+
AnimationProgressState CSSAnimation::getState() const {
|
|
35
|
+
return loopAnimation_->getState();
|
|
43
36
|
}
|
|
44
37
|
|
|
45
|
-
|
|
46
|
-
return
|
|
38
|
+
folly::dynamic CSSAnimation::getBackwardsFillStyle() const {
|
|
39
|
+
return isReversed() ? styleInterpolator_->getLastKeyframeValue() : styleInterpolator_->getFirstKeyframeValue();
|
|
47
40
|
}
|
|
48
41
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return direction == AnimationDirection::Reverse || direction == AnimationDirection::AlternateReverse;
|
|
42
|
+
folly::dynamic CSSAnimation::getCurrentInterpolationStyle(const std::shared_ptr<const ShadowNode> &shadowNode) const {
|
|
43
|
+
return loopAnimation_->getCurrentInterpolationStyle(shadowNode);
|
|
52
44
|
}
|
|
53
45
|
|
|
54
|
-
|
|
55
|
-
return
|
|
46
|
+
folly::dynamic CSSAnimation::getResetStyle(const std::shared_ptr<const ShadowNode> &shadowNode) const {
|
|
47
|
+
return keyframesConfig_.styleInterpolatorFactory->getResetStyle(shadowNode);
|
|
56
48
|
}
|
|
57
49
|
|
|
58
|
-
|
|
59
|
-
|
|
50
|
+
void CSSAnimation::schedule(OperationsLoop &loop) {
|
|
51
|
+
loopAnimation_->schedule(loop);
|
|
52
|
+
if (platformAnimation_) {
|
|
53
|
+
platformAnimation_->schedule(loop.resolveTimestamp() + settings_->delay);
|
|
54
|
+
}
|
|
60
55
|
}
|
|
61
56
|
|
|
62
|
-
|
|
63
|
-
|
|
57
|
+
void CSSAnimation::unschedule(OperationsLoop &loop) {
|
|
58
|
+
loopAnimation_->unschedule(loop);
|
|
59
|
+
if (platformAnimation_) {
|
|
60
|
+
platformAnimation_->unschedule();
|
|
61
|
+
}
|
|
64
62
|
}
|
|
65
63
|
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
void CSSAnimation::updateSettings(const PartialCSSAnimationSettings &updatedSettings, const double timestamp) {
|
|
65
|
+
loopAnimation_->updateSettings(updatedSettings, timestamp);
|
|
68
66
|
}
|
|
69
67
|
|
|
70
|
-
|
|
71
|
-
return
|
|
68
|
+
bool CSSAnimation::isReversed() const {
|
|
69
|
+
return settings_->direction == AnimationDirection::Reverse ||
|
|
70
|
+
settings_->direction == AnimationDirection::AlternateReverse;
|
|
72
71
|
}
|
|
73
72
|
|
|
74
|
-
void CSSAnimation::
|
|
75
|
-
if (
|
|
73
|
+
void CSSAnimation::updatePropertyRouting() {
|
|
74
|
+
if (!platformAnimationFactory_) {
|
|
76
75
|
return;
|
|
77
76
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
folly::dynamic CSSAnimation::update(const double timestamp) {
|
|
82
|
-
progressProvider_->update(timestamp);
|
|
83
|
-
|
|
84
|
-
// Check if the animation has not started yet because of the delay
|
|
85
|
-
// (In general, it shouldn't be activated until the delay has passed but we
|
|
86
|
-
// add this check to make sure that animation doesn't start with the negative
|
|
87
|
-
// progress)
|
|
88
|
-
if (progressProvider_->getState(timestamp) == AnimationProgressState::Pending) {
|
|
89
|
-
return hasBackwardsFillMode() ? getBackwardsFillStyle() : folly::dynamic();
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return styleInterpolator_->interpolate(shadowNode_, progressProvider_, FALLBACK_INTERPOLATION_THRESHOLD);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
void CSSAnimation::updateSettings(const PartialCSSAnimationSettings &updatedSettings, const double timestamp) {
|
|
96
|
-
progressProvider_->resetProgress();
|
|
97
|
-
|
|
98
|
-
if (updatedSettings.duration.has_value()) {
|
|
99
|
-
progressProvider_->setDuration(updatedSettings.duration.value());
|
|
100
|
-
}
|
|
101
|
-
if (updatedSettings.easingFunction.has_value()) {
|
|
102
|
-
progressProvider_->setEasingFunction(updatedSettings.easingFunction.value());
|
|
103
|
-
}
|
|
104
|
-
if (updatedSettings.delay.has_value()) {
|
|
105
|
-
progressProvider_->setDelay(updatedSettings.delay.value());
|
|
106
|
-
}
|
|
107
|
-
if (updatedSettings.iterationCount.has_value()) {
|
|
108
|
-
progressProvider_->setIterationCount(updatedSettings.iterationCount.value());
|
|
109
|
-
}
|
|
110
|
-
if (updatedSettings.direction.has_value()) {
|
|
111
|
-
progressProvider_->setDirection(updatedSettings.direction.value());
|
|
112
|
-
}
|
|
113
|
-
if (updatedSettings.fillMode.has_value()) {
|
|
114
|
-
fillMode_ = updatedSettings.fillMode.value();
|
|
115
|
-
}
|
|
116
|
-
if (updatedSettings.playState.has_value()) {
|
|
117
|
-
if (updatedSettings.playState.value() == AnimationPlayState::Paused) {
|
|
118
|
-
progressProvider_->pause(timestamp);
|
|
119
|
-
} else {
|
|
120
|
-
progressProvider_->play(timestamp);
|
|
121
|
-
}
|
|
77
|
+
if constexpr (!StaticFeatureFlags::getFlag("IOS_CSS_CORE_ANIMATION")) {
|
|
78
|
+
return;
|
|
122
79
|
}
|
|
123
|
-
|
|
124
|
-
|
|
80
|
+
const auto &allProperties = keyframesConfig_.styleInterpolatorFactory->getAllPropertyNames();
|
|
81
|
+
auto result = platformAnimationFactory_->resolve(viewTag_, name_, allProperties, keyframesConfig_, settings_);
|
|
82
|
+
platformAnimation_ = result.animation;
|
|
83
|
+
loopAnimation_->setAnimatedProperties(result.remainingProperties);
|
|
125
84
|
}
|
|
126
85
|
|
|
127
86
|
} // namespace reanimated::css
|
|
@@ -2,50 +2,75 @@
|
|
|
2
2
|
|
|
3
3
|
#include <reanimated/CSS/configs/CSSAnimationConfig.h>
|
|
4
4
|
#include <reanimated/CSS/configs/CSSKeyframesConfig.h>
|
|
5
|
+
#include <reanimated/CSS/core/CSSPlatformAnimation.h>
|
|
6
|
+
#include <reanimated/CSS/core/CSSPlatformAnimationFactory.h>
|
|
7
|
+
#include <reanimated/CSS/interpolation/styles/AnimationStyleInterpolator.h>
|
|
5
8
|
#include <reanimated/CSS/progress/AnimationProgressProvider.h>
|
|
9
|
+
#include <reanimated/Fabric/updates/OperationsLoop.h>
|
|
6
10
|
|
|
7
11
|
#include <memory>
|
|
8
12
|
#include <string>
|
|
9
13
|
|
|
10
14
|
namespace reanimated::css {
|
|
11
15
|
|
|
16
|
+
class CSSLoopAnimation;
|
|
17
|
+
|
|
12
18
|
class CSSAnimation {
|
|
13
19
|
public:
|
|
14
|
-
|
|
20
|
+
class Observer {
|
|
21
|
+
public:
|
|
22
|
+
virtual ~Observer() = default;
|
|
23
|
+
virtual void onAnimationUpdate(Tag viewTag) = 0;
|
|
24
|
+
// Called when the animation finishes without `forwards` fill mode and will
|
|
25
|
+
// need to be reverted to the underlying style on the next flush.
|
|
26
|
+
virtual void onAnimationNeedsRevert(Tag viewTag) = 0;
|
|
27
|
+
};
|
|
15
28
|
|
|
16
29
|
CSSAnimation(
|
|
17
|
-
|
|
18
|
-
std::shared_ptr<const ShadowNode> shadowNode,
|
|
30
|
+
Tag viewTag,
|
|
19
31
|
std::string animationName,
|
|
20
32
|
const CSSKeyframesConfig &cssKeyframesConfig,
|
|
21
33
|
const CSSAnimationSettings &settings,
|
|
34
|
+
Observer &observer,
|
|
35
|
+
const std::shared_ptr<CSSPlatformAnimationFactory> &platformAnimationFactory,
|
|
22
36
|
double timestamp);
|
|
23
37
|
|
|
24
|
-
const std::string &getName() const
|
|
25
|
-
|
|
38
|
+
const std::string &getName() const {
|
|
39
|
+
return name_;
|
|
40
|
+
}
|
|
26
41
|
|
|
27
|
-
|
|
28
|
-
AnimationProgressState getState(double timestamp) const;
|
|
29
|
-
bool isReversed() const;
|
|
42
|
+
AnimationProgressState getState() const;
|
|
30
43
|
|
|
31
|
-
bool hasForwardsFillMode() const
|
|
32
|
-
|
|
44
|
+
bool hasForwardsFillMode() const {
|
|
45
|
+
return settings_->hasForwardsFillMode();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
bool hasBackwardsFillMode() const {
|
|
49
|
+
return settings_->hasBackwardsFillMode();
|
|
50
|
+
}
|
|
33
51
|
|
|
34
|
-
folly::dynamic getCurrentInterpolationStyle() const;
|
|
35
52
|
folly::dynamic getBackwardsFillStyle() const;
|
|
36
|
-
folly::dynamic
|
|
53
|
+
folly::dynamic getCurrentInterpolationStyle(const std::shared_ptr<const ShadowNode> &shadowNode) const;
|
|
54
|
+
folly::dynamic getResetStyle(const std::shared_ptr<const ShadowNode> &shadowNode) const;
|
|
55
|
+
|
|
56
|
+
void schedule(OperationsLoop &loop);
|
|
57
|
+
void unschedule(OperationsLoop &loop);
|
|
37
58
|
|
|
38
|
-
void run(double timestamp);
|
|
39
|
-
folly::dynamic update(double timestamp);
|
|
40
59
|
void updateSettings(const PartialCSSAnimationSettings &updatedSettings, double timestamp);
|
|
41
60
|
|
|
42
61
|
private:
|
|
62
|
+
const Tag viewTag_;
|
|
43
63
|
const std::string name_;
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
64
|
+
const CSSKeyframesConfig keyframesConfig_;
|
|
65
|
+
const std::shared_ptr<CSSAnimationSettings> settings_;
|
|
66
|
+
const std::shared_ptr<OperationsLoop> loop_;
|
|
47
67
|
const std::shared_ptr<AnimationStyleInterpolator> styleInterpolator_;
|
|
48
|
-
const std::shared_ptr<
|
|
68
|
+
const std::shared_ptr<CSSLoopAnimation> loopAnimation_;
|
|
69
|
+
const std::shared_ptr<CSSPlatformAnimationFactory> platformAnimationFactory_;
|
|
70
|
+
std::shared_ptr<CSSPlatformAnimation> platformAnimation_;
|
|
71
|
+
|
|
72
|
+
bool isReversed() const;
|
|
73
|
+
void updatePropertyRouting();
|
|
49
74
|
};
|
|
50
75
|
|
|
51
76
|
} // namespace reanimated::css
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#include <reanimated/CSS/core/CSSAnimationsGroup.h>
|
|
2
|
+
|
|
3
|
+
#include <utility>
|
|
4
|
+
|
|
5
|
+
namespace reanimated::css {
|
|
6
|
+
|
|
7
|
+
CSSAnimationsGroup::CSSAnimationsGroup(std::shared_ptr<const ShadowNode> shadowNode, CSSAnimationsVector animations)
|
|
8
|
+
: shadowNode_(std::move(shadowNode)), animations_(std::move(animations)) {}
|
|
9
|
+
|
|
10
|
+
const CSSAnimationsVector &CSSAnimationsGroup::getAnimations() const {
|
|
11
|
+
return animations_;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
ShadowNodeFamily::Shared CSSAnimationsGroup::getShadowNodeFamily() const {
|
|
15
|
+
return shadowNode_->getFamilyShared();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
void CSSAnimationsGroup::updateSettings(const CSSAnimationSettingsUpdatesMap &settingsUpdates, const double timestamp) {
|
|
19
|
+
for (size_t i = 0; i < animations_.size(); ++i) {
|
|
20
|
+
const auto it = settingsUpdates.find(i);
|
|
21
|
+
if (it != settingsUpdates.end()) {
|
|
22
|
+
animations_[i]->updateSettings(it->second, timestamp);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
void CSSAnimationsGroup::schedule(OperationsLoop &loop) {
|
|
28
|
+
for (const auto &animation : animations_) {
|
|
29
|
+
animation->schedule(loop);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
void CSSAnimationsGroup::unschedule(OperationsLoop &loop) const {
|
|
34
|
+
for (const auto &animation : animations_) {
|
|
35
|
+
animation->unschedule(loop);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
folly::dynamic CSSAnimationsGroup::computeStyle(bool includeResetStyles) const {
|
|
40
|
+
folly::dynamic style = folly::dynamic::object;
|
|
41
|
+
|
|
42
|
+
for (const auto &animation : animations_) {
|
|
43
|
+
const auto state = animation->getState();
|
|
44
|
+
|
|
45
|
+
if (state == AnimationProgressState::Running || state == AnimationProgressState::Paused ||
|
|
46
|
+
(state == AnimationProgressState::Finished && animation->hasForwardsFillMode())) {
|
|
47
|
+
style.update(animation->getCurrentInterpolationStyle(shadowNode_));
|
|
48
|
+
} else if (state == AnimationProgressState::Pending && animation->hasBackwardsFillMode()) {
|
|
49
|
+
style.update(animation->getBackwardsFillStyle());
|
|
50
|
+
} else if (state == AnimationProgressState::Finished && includeResetStyles) {
|
|
51
|
+
const auto resetStyle = animation->getResetStyle(shadowNode_);
|
|
52
|
+
for (const auto &[key, value] : resetStyle.items()) {
|
|
53
|
+
if (!style.count(key)) {
|
|
54
|
+
style[key] = value;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return style;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
} // namespace reanimated::css
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <reanimated/CSS/configs/CSSAnimationConfig.h>
|
|
4
|
+
#include <reanimated/CSS/core/CSSAnimation.h>
|
|
5
|
+
|
|
6
|
+
#include <folly/dynamic.h>
|
|
7
|
+
#include <react/renderer/core/ShadowNode.h>
|
|
8
|
+
|
|
9
|
+
#include <memory>
|
|
10
|
+
#include <vector>
|
|
11
|
+
|
|
12
|
+
namespace reanimated::css {
|
|
13
|
+
|
|
14
|
+
using CSSAnimationsVector = std::vector<std::shared_ptr<CSSAnimation>>;
|
|
15
|
+
|
|
16
|
+
class CSSAnimationsGroup {
|
|
17
|
+
public:
|
|
18
|
+
CSSAnimationsGroup(std::shared_ptr<const ShadowNode> shadowNode, CSSAnimationsVector animations);
|
|
19
|
+
|
|
20
|
+
const CSSAnimationsVector &getAnimations() const;
|
|
21
|
+
ShadowNodeFamily::Shared getShadowNodeFamily() const;
|
|
22
|
+
|
|
23
|
+
void schedule(OperationsLoop &loop);
|
|
24
|
+
void unschedule(OperationsLoop &loop) const;
|
|
25
|
+
void updateSettings(const CSSAnimationSettingsUpdatesMap &settingsUpdates, double timestamp);
|
|
26
|
+
// Computes the combined style from all animations.
|
|
27
|
+
// When includeResetStyles is true, finished animations without forwards fill
|
|
28
|
+
// contribute their original (pre-animation) property values — these should be
|
|
29
|
+
// committed once to revert the visual changes applied by the animation.
|
|
30
|
+
folly::dynamic computeStyle(bool includeResetStyles = false) const;
|
|
31
|
+
|
|
32
|
+
private:
|
|
33
|
+
std::shared_ptr<const ShadowNode> shadowNode_;
|
|
34
|
+
CSSAnimationsVector animations_;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
} // namespace reanimated::css
|