@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/registries/CSSAnimationsRegistry.h
CHANGED
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
#include <reanimated/CSS/configs/CSSAnimationConfig.h>
|
|
4
4
|
#include <reanimated/CSS/core/CSSAnimation.h>
|
|
5
|
-
#include <reanimated/CSS/
|
|
5
|
+
#include <reanimated/CSS/core/CSSAnimationsGroup.h>
|
|
6
|
+
#include <reanimated/CSS/core/CSSPlatformAnimationFactory.h>
|
|
7
|
+
#include <reanimated/CSS/registries/CSSKeyframesRegistry.h>
|
|
6
8
|
#include <reanimated/CSS/utils/props.h>
|
|
9
|
+
#include <reanimated/Fabric/updates/OperationsLoop.h>
|
|
7
10
|
#include <reanimated/Fabric/updates/UpdatesRegistry.h>
|
|
8
11
|
|
|
9
12
|
#include <memory>
|
|
10
|
-
#include <set>
|
|
11
13
|
#include <string>
|
|
12
14
|
#include <unordered_map>
|
|
13
15
|
#include <unordered_set>
|
|
@@ -17,64 +19,61 @@
|
|
|
17
19
|
namespace reanimated::css {
|
|
18
20
|
|
|
19
21
|
using CSSAnimationsMap = std::unordered_map<size_t, std::shared_ptr<CSSAnimation>>;
|
|
20
|
-
using CSSAnimationsVector = std::vector<std::shared_ptr<CSSAnimation>>;
|
|
21
22
|
|
|
22
|
-
class CSSAnimationsRegistry : public UpdatesRegistry
|
|
23
|
+
class CSSAnimationsRegistry : public UpdatesRegistry {
|
|
23
24
|
public:
|
|
24
|
-
|
|
25
|
+
CSSAnimationsRegistry(
|
|
26
|
+
const std::shared_ptr<OperationsLoop> &loop,
|
|
27
|
+
const std::shared_ptr<CSSKeyframesRegistry> &keyframesRegistry,
|
|
28
|
+
const std::shared_ptr<CSSPlatformAnimationFactory> &platformAnimationFactory);
|
|
25
29
|
|
|
26
|
-
bool
|
|
27
|
-
bool hasUpdates() const;
|
|
30
|
+
bool needsFlush() const;
|
|
28
31
|
|
|
29
32
|
void apply(
|
|
30
|
-
jsi::Runtime &rt,
|
|
31
33
|
const std::shared_ptr<const ShadowNode> &shadowNode,
|
|
32
|
-
const std::
|
|
33
|
-
const
|
|
34
|
-
const CSSAnimationSettingsUpdatesMap &settingsUpdates,
|
|
35
|
-
double timestamp);
|
|
36
|
-
void remove(Tag viewTag) override;
|
|
34
|
+
const std::string &compoundComponentName,
|
|
35
|
+
const CSSAnimationUpdates &updates);
|
|
37
36
|
|
|
38
|
-
void
|
|
37
|
+
void flushUpdates(UpdatesBatch &updatesBatch);
|
|
38
|
+
#if REACT_NATIVE_VERSION_MINOR >= 85
|
|
39
|
+
void flushUpdates(UpdatesBatchAnimatedProps &updatesBatch);
|
|
40
|
+
#endif
|
|
39
41
|
|
|
40
42
|
private:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
class AnimationObserver : public CSSAnimation::Observer {
|
|
44
|
+
public:
|
|
45
|
+
explicit AnimationObserver(CSSAnimationsRegistry &owner);
|
|
46
|
+
void onAnimationUpdate(Tag viewTag) override;
|
|
47
|
+
void onAnimationNeedsRevert(Tag viewTag) override;
|
|
48
|
+
|
|
49
|
+
private:
|
|
50
|
+
CSSAnimationsRegistry &owner_;
|
|
47
51
|
};
|
|
48
52
|
|
|
49
|
-
|
|
53
|
+
const std::shared_ptr<OperationsLoop> loop_;
|
|
54
|
+
const std::shared_ptr<CSSKeyframesRegistry> keyframesRegistry_;
|
|
55
|
+
const std::shared_ptr<CSSPlatformAnimationFactory> platformAnimationFactory_;
|
|
50
56
|
|
|
51
|
-
|
|
57
|
+
AnimationObserver animationObserver_{*this};
|
|
52
58
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
59
|
+
std::unordered_map<Tag, CSSAnimationsGroup> groups_;
|
|
60
|
+
// Tags reported by owned animations between flushes.
|
|
61
|
+
std::unordered_set<Tag> updatedTags_;
|
|
62
|
+
std::unordered_set<Tag> pendingRevertTags_;
|
|
56
63
|
|
|
57
|
-
|
|
58
|
-
|
|
64
|
+
void removeTag(Tag viewTag) override;
|
|
65
|
+
std::optional<CSSAnimationsGroup> maybeBuildNewGroup(
|
|
66
|
+
const std::shared_ptr<const ShadowNode> &shadowNode,
|
|
67
|
+
const std::string &compoundComponentName,
|
|
68
|
+
const std::optional<std::vector<std::string>> &updatedAnimationNames,
|
|
69
|
+
const CSSAnimationSettingsMap &newAnimationSettings);
|
|
70
|
+
std::shared_ptr<CSSAnimation> createAnimation(
|
|
59
71
|
const std::shared_ptr<const ShadowNode> &shadowNode,
|
|
60
|
-
const std::
|
|
61
|
-
const std::
|
|
62
|
-
|
|
63
|
-
void updateAnimationSettings(
|
|
64
|
-
const CSSAnimationsVector &animationsVector,
|
|
65
|
-
const CSSAnimationSettingsUpdatesMap &settingsUpdates,
|
|
72
|
+
const std::string &name,
|
|
73
|
+
const std::string &compoundComponentName,
|
|
74
|
+
const CSSAnimationSettings &settings,
|
|
66
75
|
double timestamp);
|
|
67
|
-
|
|
68
|
-
void
|
|
69
|
-
updateViewAnimations(Tag viewTag, const std::vector<size_t> &animationIndices, double timestamp, bool addToBatch);
|
|
70
|
-
void
|
|
71
|
-
scheduleOrActivateAnimation(size_t animationIndex, const std::shared_ptr<CSSAnimation> &animation, double timestamp);
|
|
72
|
-
void removeViewAnimations(Tag viewTag);
|
|
73
|
-
void applyViewAnimationsStyle(Tag viewTag, double timestamp);
|
|
74
|
-
void activateDelayedAnimations(double timestamp);
|
|
75
|
-
void handleAnimationsToRevert(double timestamp);
|
|
76
|
-
|
|
77
|
-
static bool addStyleUpdates(folly::dynamic &target, const folly::dynamic &updates, bool shouldOverride);
|
|
76
|
+
void updateRegistryForRevertedAnimations();
|
|
78
77
|
};
|
|
79
78
|
|
|
80
79
|
} // namespace reanimated::css
|
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
#include <reanimated/CSS/registries/CSSKeyframesRegistry.h>
|
|
2
|
+
#include <reanimated/Fabric/updates/UpdatesRegistryManager.h>
|
|
3
|
+
|
|
4
|
+
#include <react/debug/react_native_assert.h>
|
|
2
5
|
|
|
3
|
-
#include <memory>
|
|
4
6
|
#include <string>
|
|
5
7
|
#include <utility>
|
|
6
8
|
|
|
7
9
|
namespace reanimated::css {
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
: viewStylesRepository_(viewStylesRepository) {}
|
|
11
|
-
|
|
12
|
-
const CSSKeyframesConfig &CSSKeyframesRegistry::get(
|
|
11
|
+
std::optional<std::reference_wrapper<const CSSKeyframesConfig>> CSSKeyframesRegistry::get(
|
|
13
12
|
const std::string &animationName,
|
|
14
|
-
const std::string &
|
|
15
|
-
|
|
13
|
+
const std::string &compoundComponentName) {
|
|
14
|
+
react_native_assert(UpdatesRegistryManager::isLockedByCurrentThread());
|
|
15
|
+
const auto registryIt = registry_.find(animationName);
|
|
16
16
|
if (registryIt == registry_.end()) {
|
|
17
|
-
|
|
17
|
+
return std::nullopt;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
const auto &
|
|
21
|
-
const auto
|
|
22
|
-
if (
|
|
23
|
-
|
|
24
|
-
"[Reanimated] No keyframes with name `" + animationName + "` were registered for component `" + componentName +
|
|
25
|
-
"`");
|
|
20
|
+
const auto &keyframesByComponent = registryIt->second;
|
|
21
|
+
const auto keyframesByComponentIt = keyframesByComponent.find(compoundComponentName);
|
|
22
|
+
if (keyframesByComponentIt == keyframesByComponent.end()) {
|
|
23
|
+
return std::nullopt;
|
|
26
24
|
}
|
|
27
25
|
|
|
28
|
-
return
|
|
26
|
+
return std::cref(keyframesByComponentIt->second);
|
|
29
27
|
}
|
|
30
28
|
|
|
31
29
|
void CSSKeyframesRegistry::set(
|
|
32
30
|
const std::string &animationName,
|
|
33
|
-
const std::string &
|
|
31
|
+
const std::string &compoundComponentName,
|
|
34
32
|
CSSKeyframesConfig &&config) {
|
|
35
|
-
|
|
33
|
+
react_native_assert(UpdatesRegistryManager::isLockedByCurrentThread());
|
|
34
|
+
registry_[animationName][compoundComponentName] = std::move(config);
|
|
36
35
|
}
|
|
37
36
|
|
|
38
|
-
void CSSKeyframesRegistry::remove(const std::string &animationName, const std::string &
|
|
39
|
-
|
|
37
|
+
void CSSKeyframesRegistry::remove(const std::string &animationName, const std::string &compoundComponentName) {
|
|
38
|
+
react_native_assert(UpdatesRegistryManager::isLockedByCurrentThread());
|
|
39
|
+
registry_[animationName].erase(compoundComponentName);
|
|
40
40
|
if (registry_[animationName].empty()) {
|
|
41
41
|
registry_.erase(animationName);
|
|
42
42
|
}
|
package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSKeyframesRegistry.h
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
3
|
#include <reanimated/CSS/configs/CSSKeyframesConfig.h>
|
|
4
|
-
#include <reanimated/CSS/interpolation/styles/AnimationStyleInterpolator.h>
|
|
5
|
-
#include <reanimated/CSS/misc/ViewStylesRepository.h>
|
|
6
4
|
|
|
7
|
-
#include <
|
|
5
|
+
#include <functional>
|
|
6
|
+
#include <optional>
|
|
8
7
|
#include <string>
|
|
9
8
|
#include <unordered_map>
|
|
10
9
|
#include <utility>
|
|
@@ -13,17 +12,22 @@ namespace reanimated::css {
|
|
|
13
12
|
|
|
14
13
|
class CSSKeyframesRegistry {
|
|
15
14
|
public:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
void set(const std::string &animationName, const std::string &
|
|
20
|
-
void remove(const std::string &animationName, const std::string &
|
|
15
|
+
std::optional<std::reference_wrapper<const CSSKeyframesConfig>> get(
|
|
16
|
+
const std::string &animationName,
|
|
17
|
+
const std::string &compoundComponentName);
|
|
18
|
+
void set(const std::string &animationName, const std::string &compoundComponentName, CSSKeyframesConfig &&config);
|
|
19
|
+
void remove(const std::string &animationName, const std::string &compoundComponentName);
|
|
21
20
|
|
|
22
21
|
private:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
// Maps compound component name to CSSKeyframesConfig. The same keyframes object may be
|
|
23
|
+
// interpolated differently per component (different interpolators) even when the
|
|
24
|
+
// keyframes look identical. CSSKeyframesConfig holds a component-specific
|
|
25
|
+
// styleInterpolator, so configs must be stored separately per component.
|
|
26
|
+
// Compound component name combines native and JS component names (caller must build it).
|
|
27
|
+
using KeyframesByCompoundComponentName = std::unordered_map<std::string, CSSKeyframesConfig>;
|
|
28
|
+
|
|
29
|
+
// Top level: animation name. Inner level: compound component name -> config.
|
|
30
|
+
std::unordered_map<std::string, KeyframesByCompoundComponentName> registry_;
|
|
27
31
|
};
|
|
28
32
|
|
|
29
33
|
} // namespace reanimated::css
|
|
@@ -1,135 +1,101 @@
|
|
|
1
1
|
#include <reanimated/CSS/registries/CSSTransitionsRegistry.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 <utility>
|
|
8
|
+
#include <vector>
|
|
5
9
|
|
|
6
10
|
namespace reanimated::css {
|
|
7
11
|
|
|
8
12
|
CSSTransitionsRegistry::CSSTransitionsRegistry(
|
|
9
|
-
const std::shared_ptr<
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
bool CSSTransitionsRegistry::hasUpdates() const {
|
|
20
|
-
return !runningTransitionTags_.empty() || !delayedTransitionsManager_.empty();
|
|
13
|
+
const std::shared_ptr<ViewStylesRepository> &viewStylesRepository,
|
|
14
|
+
const std::shared_ptr<OperationsLoop> &loop,
|
|
15
|
+
const std::shared_ptr<CSSPlatformTransitionProxy> &platformTransitionProxy)
|
|
16
|
+
: viewStylesRepository_(viewStylesRepository), loop_(loop), platformTransitionProxy_(platformTransitionProxy) {}
|
|
17
|
+
|
|
18
|
+
bool CSSTransitionsRegistry::needsFlush() const {
|
|
19
|
+
react_native_assert(UpdatesRegistryManager::isLockedByCurrentThread());
|
|
20
|
+
return !updatedTags_.empty();
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
void CSSTransitionsRegistry::
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
void CSSTransitionsRegistry::updateConfigOrRun(
|
|
24
|
+
jsi::Runtime &rt,
|
|
25
|
+
const std::shared_ptr<const ShadowNode> &shadowNode,
|
|
26
|
+
CSSTransitionConfig &&config) {
|
|
27
|
+
react_native_assert(UpdatesRegistryManager::isLockedByCurrentThread());
|
|
28
|
+
const auto &transition = getOrCreateTransition(shadowNode);
|
|
29
|
+
auto initialUpdate = transition->run(rt, std::move(config), getUpdatesFromRegistry(transition->getViewTag()));
|
|
30
|
+
recordInitialUpdate(transition, initialUpdate);
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
void CSSTransitionsRegistry::
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
void CSSTransitionsRegistry::updateSettings(const Tag viewTag, const PartialCSSTransitionConfig &config) {
|
|
41
|
-
const auto &transition = registry_[viewTag];
|
|
42
|
-
transition->updateSettings(config);
|
|
43
|
-
|
|
44
|
-
// Replace style overrides with the new ones if transition properties were
|
|
45
|
-
// updated (we want to keep overrides only for transitioned properties)
|
|
46
|
-
if (config.properties.has_value()) {
|
|
47
|
-
updateInUpdatesRegistry(transition, transition->getCurrentInterpolationStyle());
|
|
48
|
-
}
|
|
33
|
+
void CSSTransitionsRegistry::run(
|
|
34
|
+
const std::shared_ptr<const ShadowNode> &shadowNode,
|
|
35
|
+
const PropertyValueDynamicDiffsMap &propertyDiffs) {
|
|
36
|
+
react_native_assert(UpdatesRegistryManager::isLockedByCurrentThread());
|
|
37
|
+
const auto &transition = getOrCreateTransition(shadowNode);
|
|
38
|
+
auto initialUpdate = transition->run(propertyDiffs, getUpdatesFromRegistry(transition->getViewTag()));
|
|
39
|
+
recordInitialUpdate(transition, initialUpdate);
|
|
49
40
|
}
|
|
50
41
|
|
|
51
|
-
void CSSTransitionsRegistry::
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const auto &transition = registry_[viewTag];
|
|
59
|
-
|
|
60
|
-
const folly::dynamic &updates = transition->update(timestamp);
|
|
61
|
-
if (!updates.empty()) {
|
|
62
|
-
addUpdatesToBatch(transition->getShadowNode(), updates);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// We remove transition from running and schedule it when animation of one
|
|
66
|
-
// of properties has finished and the other one is still delayed
|
|
67
|
-
const auto &minDelay = transition->getMinDelay(timestamp);
|
|
68
|
-
if (minDelay > 0) {
|
|
69
|
-
delayedTransitionsManager_.add(timestamp + transition->getMinDelay(timestamp), viewTag);
|
|
42
|
+
void CSSTransitionsRegistry::flushUpdates(UpdatesBatch &updatesBatch) {
|
|
43
|
+
react_native_assert(UpdatesRegistryManager::isLockedByCurrentThread());
|
|
44
|
+
const auto tags = std::exchange(updatedTags_, {});
|
|
45
|
+
for (const auto viewTag : tags) {
|
|
46
|
+
const auto it = registry_.find(viewTag);
|
|
47
|
+
if (it == registry_.end()) {
|
|
48
|
+
continue;
|
|
70
49
|
}
|
|
71
50
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
51
|
+
auto &transition = it->second;
|
|
52
|
+
const auto updates = transition->computeCurrentLoopStyle();
|
|
53
|
+
if (!updates.empty()) {
|
|
54
|
+
addUpdatesToBatch(transition->getShadowNodeFamily(), updates);
|
|
76
55
|
}
|
|
77
56
|
}
|
|
57
|
+
|
|
58
|
+
flush(updatesBatch);
|
|
78
59
|
}
|
|
79
60
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
61
|
+
#if REACT_NATIVE_VERSION_MINOR >= 85
|
|
62
|
+
void CSSTransitionsRegistry::flushUpdates(UpdatesBatchAnimatedProps &updatesBatch) {
|
|
63
|
+
react_native_assert(UpdatesRegistryManager::isLockedByCurrentThread());
|
|
64
|
+
const auto tags = std::exchange(updatedTags_, {});
|
|
65
|
+
for (const auto viewTag : tags) {
|
|
66
|
+
const auto it = registry_.find(viewTag);
|
|
67
|
+
if (it == registry_.end()) {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
83
70
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
71
|
+
auto &transition = it->second;
|
|
72
|
+
const auto updates = transition->computeCurrentLoopStyle();
|
|
73
|
+
if (!updates.empty()) {
|
|
74
|
+
addRawPropsToAnimatedPropsBatch(transition->getShadowNodeFamily(), updates);
|
|
75
|
+
// Legacy flushes merge each frame into the updates registry; animated-props flushes do not.
|
|
76
|
+
// Keep the registry current so the next transition reads a real "from" value, not the first frame only.
|
|
77
|
+
updateInUpdatesRegistry(transition, updates);
|
|
87
78
|
}
|
|
88
79
|
}
|
|
89
|
-
}
|
|
90
80
|
|
|
91
|
-
|
|
92
|
-
const auto viewTag = transition->getViewTag();
|
|
93
|
-
const auto currentTimestamp = getCurrentTimestamp_();
|
|
94
|
-
const auto minDelay = transition->getMinDelay(currentTimestamp);
|
|
95
|
-
|
|
96
|
-
// Remove transition from delayed (if it is already added to delayed
|
|
97
|
-
// transitions)
|
|
98
|
-
delayedTransitionsManager_.remove(viewTag);
|
|
99
|
-
|
|
100
|
-
if (minDelay > 0) {
|
|
101
|
-
delayedTransitionsManager_.add(currentTimestamp + minDelay, viewTag);
|
|
102
|
-
} else {
|
|
103
|
-
runningTransitionTags_.insert(viewTag);
|
|
104
|
-
}
|
|
81
|
+
flush(updatesBatch);
|
|
105
82
|
}
|
|
83
|
+
#endif
|
|
106
84
|
|
|
107
|
-
|
|
108
|
-
return [weakThis = weak_from_this(), viewTag](const folly::dynamic &oldProps, const folly::dynamic &newProps) {
|
|
109
|
-
auto strongThis = weakThis.lock();
|
|
110
|
-
if (!strongThis) {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const auto &transition = strongThis->registry_[viewTag];
|
|
115
|
-
const auto allowedProperties = transition->getAllowedProperties(oldProps, newProps);
|
|
116
|
-
|
|
117
|
-
const auto changedProps = getChangedProps(oldProps, newProps, allowedProperties);
|
|
85
|
+
CSSTransitionsRegistry::TransitionObserver::TransitionObserver(CSSTransitionsRegistry &owner) : owner_(owner) {}
|
|
118
86
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
{
|
|
124
|
-
std::lock_guard<std::mutex> lock{strongThis->mutex_};
|
|
87
|
+
void CSSTransitionsRegistry::TransitionObserver::onTransitionUpdate(const Tag viewTag) {
|
|
88
|
+
react_native_assert(UpdatesRegistryManager::isLockedByCurrentThread());
|
|
89
|
+
owner_.updatedTags_.insert(viewTag);
|
|
90
|
+
}
|
|
125
91
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
92
|
+
void CSSTransitionsRegistry::removeTag(const Tag viewTag) {
|
|
93
|
+
const auto it = registry_.find(viewTag);
|
|
94
|
+
if (it != registry_.end()) {
|
|
95
|
+
it->second->cancel();
|
|
96
|
+
}
|
|
97
|
+
removeFromUpdatesRegistry(viewTag);
|
|
98
|
+
registry_.erase(viewTag);
|
|
133
99
|
}
|
|
134
100
|
|
|
135
101
|
void CSSTransitionsRegistry::updateInUpdatesRegistry(
|
|
@@ -141,17 +107,10 @@ void CSSTransitionsRegistry::updateInUpdatesRegistry(
|
|
|
141
107
|
|
|
142
108
|
folly::dynamic filteredUpdates = folly::dynamic::object;
|
|
143
109
|
|
|
144
|
-
if (!
|
|
145
|
-
// If transitionProperty is set to 'all' (optional has no value), we have
|
|
146
|
-
// to keep the result of the previous transition updated with the new
|
|
147
|
-
// transition starting values
|
|
148
|
-
if (!lastUpdates.empty()) {
|
|
149
|
-
filteredUpdates = lastUpdates;
|
|
150
|
-
}
|
|
151
|
-
} else if (!lastUpdates.empty()) {
|
|
110
|
+
if (!lastUpdates.empty()) {
|
|
152
111
|
// Otherwise, we keep only allowed properties from the last updates
|
|
153
112
|
// and update the object with the new transition starting values
|
|
154
|
-
for (const auto &prop : transitionProperties
|
|
113
|
+
for (const auto &prop : transitionProperties) {
|
|
155
114
|
if (lastUpdates.count(prop)) {
|
|
156
115
|
filteredUpdates[prop] = lastUpdates[prop];
|
|
157
116
|
}
|
|
@@ -161,7 +120,29 @@ void CSSTransitionsRegistry::updateInUpdatesRegistry(
|
|
|
161
120
|
// updated object contains only allowed properties so we don't need
|
|
162
121
|
// to do additional filtering here
|
|
163
122
|
filteredUpdates.update(updates);
|
|
164
|
-
setInUpdatesRegistry(shadowNode, filteredUpdates);
|
|
123
|
+
setInUpdatesRegistry(shadowNode->getFamilyShared(), filteredUpdates);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const std::shared_ptr<CSSTransition> &CSSTransitionsRegistry::getOrCreateTransition(
|
|
127
|
+
const std::shared_ptr<const ShadowNode> &shadowNode) {
|
|
128
|
+
const auto viewTag = shadowNode->getTag();
|
|
129
|
+
if (!registry_.contains(viewTag)) {
|
|
130
|
+
registry_.emplace(
|
|
131
|
+
viewTag,
|
|
132
|
+
std::make_shared<CSSTransition>(
|
|
133
|
+
shadowNode, viewStylesRepository_, platformTransitionProxy_, loop_, transitionObserver_));
|
|
134
|
+
}
|
|
135
|
+
return registry_.at(viewTag);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
void CSSTransitionsRegistry::recordInitialUpdate(
|
|
139
|
+
const std::shared_ptr<CSSTransition> &transition,
|
|
140
|
+
const folly::dynamic &initialUpdate) {
|
|
141
|
+
if (initialUpdate.empty()) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
updateInUpdatesRegistry(transition, initialUpdate);
|
|
145
|
+
updatedTags_.insert(transition->getViewTag());
|
|
165
146
|
}
|
|
166
147
|
|
|
167
148
|
} // namespace reanimated::css
|
|
@@ -1,51 +1,64 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
-
#include <reanimated/CSS/
|
|
4
|
-
#include <reanimated/CSS/
|
|
5
|
-
#include <reanimated/CSS/
|
|
6
|
-
#include <reanimated/
|
|
3
|
+
#include <reanimated/CSS/configs/CSSTransitionConfig.h>
|
|
4
|
+
#include <reanimated/CSS/core/transition/CSSTransition.h>
|
|
5
|
+
#include <reanimated/CSS/misc/ViewStylesRepository.h>
|
|
6
|
+
#include <reanimated/Fabric/updates/OperationsLoop.h>
|
|
7
7
|
#include <reanimated/Fabric/updates/UpdatesRegistry.h>
|
|
8
|
-
#include <reanimated/Tools/PlatformDepMethodsHolder.h>
|
|
9
8
|
|
|
10
9
|
#include <memory>
|
|
11
|
-
#include <set>
|
|
12
10
|
#include <unordered_map>
|
|
13
11
|
#include <unordered_set>
|
|
14
|
-
#include <utility>
|
|
15
|
-
#include <vector>
|
|
16
12
|
|
|
17
13
|
namespace reanimated::css {
|
|
18
14
|
|
|
19
|
-
class CSSTransitionsRegistry : public UpdatesRegistry
|
|
15
|
+
class CSSTransitionsRegistry : public UpdatesRegistry {
|
|
20
16
|
public:
|
|
21
17
|
CSSTransitionsRegistry(
|
|
22
|
-
const std::shared_ptr<
|
|
23
|
-
const
|
|
18
|
+
const std::shared_ptr<ViewStylesRepository> &viewStylesRepository,
|
|
19
|
+
const std::shared_ptr<OperationsLoop> &loop,
|
|
20
|
+
const std::shared_ptr<CSSPlatformTransitionProxy> &platformTransitionProxy);
|
|
24
21
|
|
|
25
|
-
bool
|
|
26
|
-
bool hasUpdates() const;
|
|
22
|
+
bool needsFlush() const;
|
|
27
23
|
|
|
28
|
-
|
|
29
|
-
void
|
|
30
|
-
|
|
24
|
+
// TODO: In the future we want to decouple config update and run
|
|
25
|
+
void updateConfigOrRun(
|
|
26
|
+
jsi::Runtime &rt,
|
|
27
|
+
const std::shared_ptr<const ShadowNode> &shadowNode,
|
|
28
|
+
CSSTransitionConfig &&config);
|
|
29
|
+
void run(const std::shared_ptr<const ShadowNode> &shadowNode, const PropertyValueDynamicDiffsMap &propertyDiffs);
|
|
31
30
|
|
|
32
|
-
void
|
|
31
|
+
void flushUpdates(UpdatesBatch &updatesBatch);
|
|
32
|
+
#if REACT_NATIVE_VERSION_MINOR >= 85
|
|
33
|
+
void flushUpdates(UpdatesBatchAnimatedProps &updatesBatch);
|
|
34
|
+
#endif
|
|
33
35
|
|
|
34
36
|
private:
|
|
35
37
|
using Registry = std::unordered_map<Tag, std::shared_ptr<CSSTransition>>;
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
class TransitionObserver : public CSSTransition::Observer {
|
|
40
|
+
public:
|
|
41
|
+
explicit TransitionObserver(CSSTransitionsRegistry &owner);
|
|
42
|
+
void onTransitionUpdate(Tag viewTag) override;
|
|
39
43
|
|
|
40
|
-
|
|
44
|
+
private:
|
|
45
|
+
CSSTransitionsRegistry &owner_;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const std::shared_ptr<ViewStylesRepository> viewStylesRepository_;
|
|
49
|
+
const std::shared_ptr<OperationsLoop> loop_;
|
|
50
|
+
const std::shared_ptr<CSSPlatformTransitionProxy> platformTransitionProxy_;
|
|
41
51
|
|
|
42
|
-
|
|
43
|
-
|
|
52
|
+
TransitionObserver transitionObserver_{*this};
|
|
53
|
+
|
|
54
|
+
Registry registry_;
|
|
55
|
+
// Tags reported by owned transitions between flushes.
|
|
56
|
+
std::unordered_set<Tag> updatedTags_;
|
|
44
57
|
|
|
45
|
-
void
|
|
46
|
-
|
|
47
|
-
PropsObserver createPropsObserver(Tag viewTag);
|
|
58
|
+
void removeTag(Tag viewTag) override;
|
|
59
|
+
const std::shared_ptr<CSSTransition> &getOrCreateTransition(const std::shared_ptr<const ShadowNode> &shadowNode);
|
|
48
60
|
void updateInUpdatesRegistry(const std::shared_ptr<CSSTransition> &transition, const folly::dynamic &updates);
|
|
61
|
+
void recordInitialUpdate(const std::shared_ptr<CSSTransition> &transition, const folly::dynamic &initialUpdate);
|
|
49
62
|
};
|
|
50
63
|
|
|
51
64
|
} // namespace reanimated::css
|
package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/StaticPropsRegistry.cpp
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
#include <reanimated/CSS/registries/StaticPropsRegistry.h>
|
|
2
|
+
#include <reanimated/Fabric/updates/UpdatesRegistryManager.h>
|
|
2
3
|
|
|
3
|
-
#include <
|
|
4
|
+
#include <react/debug/react_native_assert.h>
|
|
4
5
|
|
|
5
6
|
namespace reanimated::css {
|
|
6
7
|
|
|
7
8
|
void StaticPropsRegistry::set(jsi::Runtime &rt, const Tag viewTag, const jsi::Value &props) {
|
|
9
|
+
react_native_assert(UpdatesRegistryManager::isLockedByCurrentThread());
|
|
8
10
|
if (props.isNull() || props.isUndefined()) {
|
|
9
|
-
|
|
11
|
+
registry_.erase(viewTag);
|
|
10
12
|
} else {
|
|
11
|
-
|
|
12
|
-
if (has(viewTag)) {
|
|
13
|
-
notifyObservers(viewTag, get(viewTag), newProps);
|
|
14
|
-
}
|
|
15
|
-
registry_[viewTag] = newProps;
|
|
13
|
+
registry_[viewTag] = dynamicFromValue(rt, props);
|
|
16
14
|
}
|
|
17
15
|
}
|
|
18
16
|
|
|
19
17
|
folly::dynamic StaticPropsRegistry::get(const Tag viewTag) const {
|
|
18
|
+
react_native_assert(UpdatesRegistryManager::isLockedByCurrentThread());
|
|
20
19
|
auto it = registry_.find(viewTag);
|
|
21
20
|
if (it == registry_.end()) {
|
|
22
21
|
return nullptr;
|
|
@@ -24,38 +23,14 @@ folly::dynamic StaticPropsRegistry::get(const Tag viewTag) const {
|
|
|
24
23
|
return it->second;
|
|
25
24
|
}
|
|
26
25
|
|
|
27
|
-
bool StaticPropsRegistry::has(const Tag viewTag) const {
|
|
28
|
-
return registry_.find(viewTag) != registry_.end();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
26
|
void StaticPropsRegistry::remove(const Tag viewTag) {
|
|
27
|
+
react_native_assert(UpdatesRegistryManager::isLockedByCurrentThread());
|
|
32
28
|
registry_.erase(viewTag);
|
|
33
29
|
}
|
|
34
30
|
|
|
35
31
|
bool StaticPropsRegistry::isEmpty() const {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
bool StaticPropsRegistry::hasObservers(const Tag viewTag) const {
|
|
40
|
-
return observers_.find(viewTag) != observers_.end();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
void StaticPropsRegistry::setObserver(const Tag viewTag, PropsObserver observer) {
|
|
44
|
-
observers_[viewTag] = std::move(observer);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
void StaticPropsRegistry::removeObserver(const Tag viewTag) {
|
|
48
|
-
observers_.erase(viewTag);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
void StaticPropsRegistry::notifyObservers(
|
|
52
|
-
const Tag viewTag,
|
|
53
|
-
const folly::dynamic &oldProps,
|
|
54
|
-
const folly::dynamic &newProps) {
|
|
55
|
-
auto observerIt = observers_.find(viewTag);
|
|
56
|
-
if (observerIt != observers_.end()) {
|
|
57
|
-
observerIt->second(oldProps, newProps);
|
|
58
|
-
}
|
|
32
|
+
react_native_assert(UpdatesRegistryManager::isLockedByCurrentThread());
|
|
33
|
+
return registry_.empty();
|
|
59
34
|
}
|
|
60
35
|
|
|
61
36
|
} // namespace reanimated::css
|