@react-native-ohos/react-native-reanimated 4.0.2 → 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 -6
- 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 +98 -18
- 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 +106 -17
- 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/NativeModules/ReanimatedModuleProxy.h
CHANGED
|
@@ -1,55 +1,72 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
+
#include <ReactCommon/CallInvoker.h>
|
|
4
|
+
#include <cxxreact/ReactNativeVersion.h>
|
|
5
|
+
#include <react/renderer/componentregistry/componentNameByReactViewName.h>
|
|
6
|
+
#include <react/renderer/core/ShadowNode.h>
|
|
7
|
+
#include <react/renderer/uimanager/UIManager.h>
|
|
3
8
|
#include <reanimated/AnimatedSensor/AnimatedSensorModule.h>
|
|
4
9
|
#include <reanimated/CSS/core/CSSAnimation.h>
|
|
5
|
-
#include <reanimated/CSS/core/CSSTransition.h>
|
|
10
|
+
#include <reanimated/CSS/core/transition/CSSTransition.h>
|
|
6
11
|
#include <reanimated/CSS/misc/ViewStylesRepository.h>
|
|
7
12
|
#include <reanimated/CSS/registries/CSSAnimationsRegistry.h>
|
|
8
13
|
#include <reanimated/CSS/registries/CSSKeyframesRegistry.h>
|
|
9
14
|
#include <reanimated/CSS/registries/CSSTransitionsRegistry.h>
|
|
10
15
|
#include <reanimated/CSS/registries/StaticPropsRegistry.h>
|
|
16
|
+
#include <reanimated/Compat/WorkletsApi.h>
|
|
17
|
+
#include <reanimated/Events/UIEventHandlerRegistry.h>
|
|
11
18
|
#include <reanimated/Fabric/ReanimatedCommitHook.h>
|
|
12
19
|
#include <reanimated/Fabric/ReanimatedCommitShadowNode.h>
|
|
13
20
|
#include <reanimated/Fabric/ReanimatedMountHook.h>
|
|
14
21
|
#include <reanimated/Fabric/ShadowTreeCloner.h>
|
|
15
22
|
#include <reanimated/Fabric/updates/AnimatedPropsRegistry.h>
|
|
23
|
+
#include <reanimated/Fabric/updates/OperationsLoop.h>
|
|
16
24
|
#include <reanimated/Fabric/updates/UpdatesRegistryManager.h>
|
|
17
25
|
#include <reanimated/LayoutAnimations/LayoutAnimationsManager.h>
|
|
18
26
|
#include <reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.h>
|
|
19
27
|
#include <reanimated/NativeModules/PropValueProcessor.h>
|
|
20
|
-
#include <reanimated/
|
|
28
|
+
#include <reanimated/PseudoStyles/PseudoStylesRegistry.h>
|
|
21
29
|
#include <reanimated/Tools/PlatformDepMethodsHolder.h>
|
|
30
|
+
#include <reanimated/Tools/SingleInstanceChecker.h>
|
|
22
31
|
|
|
23
|
-
#
|
|
24
|
-
#include <
|
|
25
|
-
#include <
|
|
26
|
-
#
|
|
27
|
-
#include <worklets/Tools/UIScheduler.h>
|
|
28
|
-
|
|
29
|
-
#include <react/renderer/componentregistry/componentNameByReactViewName.h>
|
|
30
|
-
#include <react/renderer/core/ShadowNode.h>
|
|
31
|
-
#include <react/renderer/uimanager/UIManager.h>
|
|
32
|
+
#if REACT_NATIVE_VERSION_MINOR >= 85
|
|
33
|
+
#include <react/renderer/animationbackend/AnimationBackend.h>
|
|
34
|
+
#include <react/renderer/uimanager/UIManagerAnimationBackend.h>
|
|
35
|
+
#endif
|
|
32
36
|
|
|
37
|
+
#include <atomic>
|
|
38
|
+
#include <cstdint>
|
|
39
|
+
#include <functional>
|
|
33
40
|
#include <memory>
|
|
41
|
+
#include <mutex>
|
|
34
42
|
#include <set>
|
|
35
43
|
#include <string>
|
|
36
|
-
#include <unordered_map>
|
|
37
|
-
#include <unordered_set>
|
|
38
44
|
#include <utility>
|
|
39
45
|
#include <vector>
|
|
40
46
|
|
|
41
47
|
namespace reanimated {
|
|
42
48
|
|
|
43
49
|
using namespace facebook;
|
|
50
|
+
using namespace facebook::react;
|
|
44
51
|
using namespace css;
|
|
45
52
|
|
|
46
|
-
|
|
53
|
+
enum class GrandCallbackSource : std::uint8_t {
|
|
54
|
+
// Used when a new vsync signal is triggered
|
|
55
|
+
AnimationLoop,
|
|
47
56
|
|
|
48
|
-
|
|
49
|
-
|
|
57
|
+
// Used when handling an event (excluding the draw pass)
|
|
58
|
+
Event,
|
|
59
|
+
|
|
60
|
+
// Used when handling an event originating from the Android draw pass,
|
|
61
|
+
// the info is used to avoid performing Tree Hierarchy updates when this could break the app
|
|
62
|
+
EventInAndroidDraw,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
class ReanimatedModuleProxy : public std::enable_shared_from_this<ReanimatedModuleProxy> {
|
|
50
66
|
public:
|
|
51
67
|
ReanimatedModuleProxy(
|
|
52
|
-
const std::shared_ptr<
|
|
68
|
+
const std::shared_ptr<worklets::WorkletRuntime> &uiRuntime,
|
|
69
|
+
const std::shared_ptr<worklets::UIScheduler> &uiScheduler,
|
|
53
70
|
jsi::Runtime &rnRuntime,
|
|
54
71
|
const std::shared_ptr<CallInvoker> &jsCallInvoker,
|
|
55
72
|
const PlatformDepMethodsHolder &platformDepMethodsHolder,
|
|
@@ -60,73 +77,77 @@ class ReanimatedModuleProxy : public ReanimatedModuleProxySpec,
|
|
|
60
77
|
// is fully constructed.
|
|
61
78
|
void init(const PlatformDepMethodsHolder &platformDepMethodsHolder);
|
|
62
79
|
|
|
63
|
-
~ReanimatedModuleProxy()
|
|
80
|
+
~ReanimatedModuleProxy();
|
|
81
|
+
|
|
82
|
+
[[nodiscard]]
|
|
83
|
+
jsi::Object toOptimizedObject(jsi::Runtime &rt);
|
|
64
84
|
|
|
65
|
-
void invalidate();
|
|
66
|
-
|
|
67
85
|
jsi::Value registerEventHandler(
|
|
68
86
|
jsi::Runtime &rt,
|
|
69
87
|
const jsi::Value &worklet,
|
|
70
88
|
const jsi::Value &eventName,
|
|
71
|
-
const jsi::Value &emitterReactTag)
|
|
72
|
-
void unregisterEventHandler(jsi::Runtime &rt, const jsi::Value ®istrationId)
|
|
89
|
+
const jsi::Value &emitterReactTag);
|
|
90
|
+
void unregisterEventHandler(jsi::Runtime &rt, const jsi::Value ®istrationId);
|
|
73
91
|
|
|
74
92
|
jsi::Value getViewProp(
|
|
75
93
|
jsi::Runtime &rt,
|
|
76
94
|
const jsi::Value &shadowNodeWrapper,
|
|
77
95
|
const jsi::Value &propName,
|
|
78
|
-
const jsi::Value &callback)
|
|
96
|
+
const jsi::Value &callback);
|
|
79
97
|
|
|
80
|
-
jsi::Value getStaticFeatureFlag(jsi::Runtime &rt, const jsi::Value &name)
|
|
81
|
-
jsi::Value setDynamicFeatureFlag(jsi::Runtime &rt, const jsi::Value &name, const jsi::Value &value)
|
|
98
|
+
jsi::Value getStaticFeatureFlag(jsi::Runtime &rt, const jsi::Value &name);
|
|
99
|
+
jsi::Value setDynamicFeatureFlag(jsi::Runtime &rt, const jsi::Value &name, const jsi::Value &value);
|
|
82
100
|
|
|
83
|
-
jsi::Value configureLayoutAnimationBatch(jsi::Runtime &rt, const jsi::Value &layoutAnimationsBatch)
|
|
84
|
-
void setShouldAnimateExiting(jsi::Runtime &rt, const jsi::Value &viewTag, const jsi::Value &shouldAnimate)
|
|
85
|
-
|
|
86
|
-
void onRender(double timestampMs);
|
|
101
|
+
jsi::Value configureLayoutAnimationBatch(jsi::Runtime &rt, const jsi::Value &layoutAnimationsBatch);
|
|
102
|
+
void setShouldAnimateExiting(jsi::Runtime &rt, const jsi::Value &viewTag, const jsi::Value &shouldAnimate);
|
|
87
103
|
|
|
88
104
|
bool isAnyHandlerWaitingForEvent(const std::string &eventName, const int emitterReactTag);
|
|
89
105
|
|
|
90
|
-
void maybeRequestRender();
|
|
91
|
-
|
|
92
106
|
bool
|
|
93
107
|
handleEvent(const std::string &eventName, const int emitterReactTag, const jsi::Value &payload, double currentTime);
|
|
94
108
|
|
|
95
|
-
inline std::shared_ptr<JSLogger> getJSLogger() const {
|
|
96
|
-
return jsLogger_;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
109
|
bool handleRawEvent(const RawEvent &rawEvent, double currentTime);
|
|
100
110
|
|
|
101
|
-
void
|
|
102
|
-
|
|
111
|
+
void performOperations();
|
|
112
|
+
void performNonLayoutOperations();
|
|
113
|
+
void executeLayoutAnimationsRequests();
|
|
103
114
|
|
|
104
|
-
|
|
115
|
+
bool handleEventAndFlush(
|
|
116
|
+
const std::string &eventName,
|
|
117
|
+
int emitterReactTag,
|
|
118
|
+
const jsi::Value &payload,
|
|
119
|
+
GrandCallbackSource source);
|
|
105
120
|
|
|
106
|
-
void
|
|
121
|
+
void startBackendIfNeeded();
|
|
122
|
+
void stopBackendIfIdle(bool producedMutations);
|
|
107
123
|
|
|
108
|
-
void
|
|
109
|
-
|
|
124
|
+
void setViewStyle(jsi::Runtime &rt, const jsi::Value &viewTag, const jsi::Value &viewStyle);
|
|
125
|
+
|
|
126
|
+
void markNodeAsRemovable(jsi::Runtime &rt, const jsi::Value &shadowNodeWrapper);
|
|
127
|
+
void unmarkNodeAsRemovable(jsi::Runtime &rt, const jsi::Value &viewTag);
|
|
110
128
|
|
|
111
129
|
void registerCSSKeyframes(
|
|
112
130
|
jsi::Runtime &rt,
|
|
113
131
|
const jsi::Value &animationName,
|
|
114
|
-
const jsi::Value &
|
|
115
|
-
const jsi::Value &keyframesConfig)
|
|
116
|
-
void
|
|
132
|
+
const jsi::Value &compoundComponentName,
|
|
133
|
+
const jsi::Value &keyframesConfig);
|
|
134
|
+
void
|
|
135
|
+
unregisterCSSKeyframes(jsi::Runtime &rt, const jsi::Value &animationName, const jsi::Value &compoundComponentName);
|
|
117
136
|
|
|
118
|
-
void applyCSSAnimations(
|
|
119
|
-
|
|
120
|
-
|
|
137
|
+
void applyCSSAnimations(
|
|
138
|
+
jsi::Runtime &rt,
|
|
139
|
+
const jsi::Value &shadowNodeWrapper,
|
|
140
|
+
const jsi::Value &compoundComponentName,
|
|
141
|
+
const jsi::Value &animationUpdates);
|
|
142
|
+
void unregisterCSSAnimations(const jsi::Value &viewTag);
|
|
121
143
|
|
|
122
|
-
void
|
|
123
|
-
|
|
124
|
-
void updateCSSTransition(jsi::Runtime &rt, const jsi::Value &viewTag, const jsi::Value &configUpdates) override;
|
|
125
|
-
void unregisterCSSTransition(jsi::Runtime &rt, const jsi::Value &viewTag) override;
|
|
144
|
+
void runCSSTransition(jsi::Runtime &rt, const jsi::Value &shadowNodeWrapper, const jsi::Value &transitionConfig);
|
|
145
|
+
void unregisterCSSTransition(jsi::Runtime &rt, const jsi::Value &viewTag);
|
|
126
146
|
|
|
127
|
-
jsi::Value
|
|
147
|
+
void registerPseudoStyles(jsi::Runtime &rt, const jsi::Value &shadowNodeWrapper, const jsi::Value &config);
|
|
148
|
+
void unregisterPseudoStyles(jsi::Runtime &rt, const jsi::Value &viewTag);
|
|
128
149
|
|
|
129
|
-
|
|
150
|
+
jsi::Value getSettledUpdates(jsi::Runtime &rt);
|
|
130
151
|
|
|
131
152
|
void dispatchCommand(
|
|
132
153
|
jsi::Runtime &rt,
|
|
@@ -152,8 +173,8 @@ class ReanimatedModuleProxy : public ReanimatedModuleProxySpec,
|
|
|
152
173
|
const jsi::Value &sensorType,
|
|
153
174
|
const jsi::Value &interval,
|
|
154
175
|
const jsi::Value &iosReferenceFrame,
|
|
155
|
-
const jsi::Value &sensorDataContainer)
|
|
156
|
-
void unregisterSensor(jsi::Runtime &rt, const jsi::Value &sensorId)
|
|
176
|
+
const jsi::Value &sensorDataContainer);
|
|
177
|
+
void unregisterSensor(jsi::Runtime &rt, const jsi::Value &sensorId);
|
|
157
178
|
|
|
158
179
|
void cleanupSensors();
|
|
159
180
|
|
|
@@ -161,8 +182,10 @@ class ReanimatedModuleProxy : public ReanimatedModuleProxySpec,
|
|
|
161
182
|
jsi::Runtime &rt,
|
|
162
183
|
const jsi::Value &keyboardEventContainer,
|
|
163
184
|
const jsi::Value &isStatusBarTranslucent,
|
|
164
|
-
const jsi::Value &isNavigationBarTranslucent)
|
|
165
|
-
void unsubscribeFromKeyboardEvents(jsi::Runtime &rt, const jsi::Value &listenerId)
|
|
185
|
+
const jsi::Value &isNavigationBarTranslucent);
|
|
186
|
+
void unsubscribeFromKeyboardEvents(jsi::Runtime &rt, const jsi::Value &listenerId);
|
|
187
|
+
|
|
188
|
+
void toggleSlowAnimationsOnUIRuntime() const;
|
|
166
189
|
|
|
167
190
|
inline LayoutAnimationsManager &layoutAnimationsManager() {
|
|
168
191
|
return *layoutAnimationsManager_;
|
|
@@ -172,58 +195,82 @@ class ReanimatedModuleProxy : public ReanimatedModuleProxySpec,
|
|
|
172
195
|
return isReducedMotion_;
|
|
173
196
|
}
|
|
174
197
|
|
|
175
|
-
[[nodiscard]] inline std::shared_ptr<WorkletsModuleProxy> getWorkletsModuleProxy() const {
|
|
176
|
-
return workletsModuleProxy_;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
198
|
void requestFlushRegistry();
|
|
180
199
|
std::function<std::string()> createRegistriesLeakCheck();
|
|
181
200
|
|
|
182
|
-
private:
|
|
183
201
|
void commitUpdates(jsi::Runtime &rt, const UpdatesBatch &updatesBatch);
|
|
202
|
+
void applySynchronousUpdates(UpdatesBatch &updatesBatch, bool allowPartialUpdates);
|
|
203
|
+
|
|
204
|
+
#if REACT_NATIVE_VERSION_MINOR >= 85
|
|
205
|
+
std::shared_ptr<UIManagerAnimationBackend> getAnimationBackend();
|
|
206
|
+
AnimationMutations runGrandCallback(AnimationTimestamp timestamp, GrandCallbackSource source);
|
|
207
|
+
void executeOperationsLoop(AnimationTimestamp timestamp);
|
|
208
|
+
void executeWorkletsForFrame(AnimationTimestamp timestamp);
|
|
209
|
+
AnimationMutations executeOperationsAndCollectUpdates(AnimationTimestamp timestamp);
|
|
210
|
+
AnimationMutations collectEventUpdates();
|
|
211
|
+
AnimationMutations collectNonLayoutAnimationUpdates();
|
|
212
|
+
AnimationMutations mutationsFromAnimatedPropsBatch(UpdatesBatchAnimatedProps &&animatedPropsBatch);
|
|
213
|
+
#endif
|
|
184
214
|
|
|
185
215
|
const bool isReducedMotion_;
|
|
186
|
-
bool shouldFlushRegistry_
|
|
187
|
-
std::shared_ptr<
|
|
216
|
+
std::atomic<bool> shouldFlushRegistry_{false};
|
|
217
|
+
std::shared_ptr<worklets::WorkletRuntime> uiRuntime_;
|
|
218
|
+
std::shared_ptr<worklets::UIScheduler> uiScheduler_;
|
|
219
|
+
std::shared_ptr<CallInvoker> jsInvoker_;
|
|
220
|
+
|
|
221
|
+
std::unique_ptr<UIEventHandlerRegistry> eventHandlerRegistry_;
|
|
222
|
+
RequestRenderFunction requestRender_;
|
|
223
|
+
bool isAnimationRunning_{false};
|
|
188
224
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
225
|
+
#if REACT_NATIVE_VERSION_MINOR >= 85
|
|
226
|
+
CallbackId animationBackendCallbackId_{0};
|
|
227
|
+
#endif
|
|
228
|
+
|
|
229
|
+
// Callbacks queued by OperationsLoop via the requestRender_ override when
|
|
230
|
+
// USE_ANIMATION_BACKEND is on. They are drained at the start of each
|
|
231
|
+
// runGrandCallback(AnimationLoop) tick, so the backend plays the role of the
|
|
232
|
+
// platform frame source for the loop.
|
|
233
|
+
std::vector<std::function<void(double)>> pendingFrameCallbacks_;
|
|
193
234
|
AnimatedSensorModule animatedSensorModule_;
|
|
194
|
-
const std::shared_ptr<JSLogger> jsLogger_;
|
|
195
235
|
std::shared_ptr<LayoutAnimationsManager> layoutAnimationsManager_;
|
|
196
236
|
GetAnimationTimestampFunction getAnimationTimestamp_;
|
|
237
|
+
std::function<void(double)> pendingAnimationFrameCallbackFromWorklets_;
|
|
238
|
+
|
|
197
239
|
#ifdef __APPLE__
|
|
198
240
|
ForceScreenSnapshotFunction forceScreenSnapshot_;
|
|
199
241
|
#endif
|
|
200
|
-
bool cssLoopRunning_{false};
|
|
201
|
-
bool shouldUpdateCssAnimations_{true};
|
|
202
|
-
double currentCssTimestamp_{0};
|
|
203
|
-
|
|
204
|
-
const std::shared_ptr<AnimatedPropsRegistry> animatedPropsRegistry_;
|
|
205
242
|
const std::shared_ptr<StaticPropsRegistry> staticPropsRegistry_;
|
|
206
243
|
const std::shared_ptr<UpdatesRegistryManager> updatesRegistryManager_;
|
|
244
|
+
const std::shared_ptr<OperationsLoop> operationsLoop_;
|
|
245
|
+
const std::shared_ptr<AnimatedPropsRegistry> animatedPropsRegistry_;
|
|
207
246
|
const std::shared_ptr<ViewStylesRepository> viewStylesRepository_;
|
|
208
247
|
const std::shared_ptr<CSSKeyframesRegistry> cssAnimationKeyframesRegistry_;
|
|
209
248
|
const std::shared_ptr<CSSAnimationsRegistry> cssAnimationsRegistry_;
|
|
210
249
|
const std::shared_ptr<CSSTransitionsRegistry> cssTransitionsRegistry_;
|
|
250
|
+
const std::shared_ptr<PseudoStylesRegistry> pseudoStylesRegistry_;
|
|
211
251
|
|
|
212
252
|
const SynchronouslyUpdateUIPropsFunction synchronouslyUpdateUIPropsFunction_;
|
|
213
253
|
const PreserveMountedTagsFunction filterUnmountedTagsFunction_;
|
|
214
254
|
|
|
255
|
+
#ifdef ANDROID
|
|
256
|
+
// Reused across `applySynchronousUpdates` calls to avoid per-frame heap
|
|
257
|
+
// allocations. Access only on the UI thread.
|
|
258
|
+
std::vector<int> synchronousPropsIntBuffer_;
|
|
259
|
+
std::vector<double> synchronousPropsDoubleBuffer_;
|
|
260
|
+
#endif // ANDROID
|
|
261
|
+
|
|
215
262
|
std::shared_ptr<UIManager> uiManager_;
|
|
216
263
|
std::shared_ptr<LayoutAnimationsProxyCommon> layoutAnimationsProxy_;
|
|
217
264
|
std::shared_ptr<ReanimatedCommitHook> commitHook_;
|
|
218
265
|
std::shared_ptr<ReanimatedMountHook> mountHook_;
|
|
266
|
+
/// Access only on UI thread.
|
|
219
267
|
std::set<SurfaceId> layoutAnimationFlushRequests_;
|
|
220
|
-
bool layoutAnimationRenderRequested_;
|
|
221
268
|
|
|
222
269
|
const KeyboardEventSubscribeFunction subscribeForKeyboardEventsFunction_;
|
|
223
270
|
const KeyboardEventUnsubscribeFunction unsubscribeFromKeyboardEventsFunction_;
|
|
224
271
|
|
|
225
272
|
#ifndef NDEBUG
|
|
226
|
-
|
|
273
|
+
SingleInstanceChecker<ReanimatedModuleProxy> singleInstanceChecker_;
|
|
227
274
|
#endif // NDEBUG
|
|
228
275
|
};
|
|
229
276
|
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
#include <reanimated/NativeModules/SynchronousPropsBufferSerializer.h>
|
|
2
|
+
|
|
3
|
+
#ifdef ANDROID
|
|
4
|
+
|
|
5
|
+
#include <react/debug/react_native_assert.h>
|
|
6
|
+
|
|
7
|
+
#include <cstdint>
|
|
8
|
+
#include <stdexcept>
|
|
9
|
+
#include <string>
|
|
10
|
+
#include <string_view>
|
|
11
|
+
#include <unordered_map>
|
|
12
|
+
|
|
13
|
+
namespace reanimated {
|
|
14
|
+
|
|
15
|
+
namespace {
|
|
16
|
+
|
|
17
|
+
// NOTE: Keep in sync with SynchronousPropsBufferParser.kt
|
|
18
|
+
enum Command : std::uint8_t {
|
|
19
|
+
CMD_START_OF_VIEW = 1,
|
|
20
|
+
CMD_START_OF_TRANSFORM = 2,
|
|
21
|
+
CMD_END_OF_TRANSFORM = 3,
|
|
22
|
+
CMD_END_OF_VIEW = 4,
|
|
23
|
+
|
|
24
|
+
CMD_OPACITY = 10,
|
|
25
|
+
CMD_ELEVATION = 11,
|
|
26
|
+
CMD_Z_INDEX = 12,
|
|
27
|
+
CMD_SHADOW_COLOR = 19,
|
|
28
|
+
CMD_BACKGROUND_COLOR = 15,
|
|
29
|
+
CMD_TINT_COLOR = 17,
|
|
30
|
+
CMD_PLACEHOLDER_TEXT_COLOR = 18,
|
|
31
|
+
|
|
32
|
+
CMD_BORDER_RADIUS = 20,
|
|
33
|
+
CMD_BORDER_TOP_LEFT_RADIUS = 21,
|
|
34
|
+
CMD_BORDER_TOP_RIGHT_RADIUS = 22,
|
|
35
|
+
CMD_BORDER_TOP_START_RADIUS = 23,
|
|
36
|
+
CMD_BORDER_TOP_END_RADIUS = 24,
|
|
37
|
+
CMD_BORDER_BOTTOM_LEFT_RADIUS = 25,
|
|
38
|
+
CMD_BORDER_BOTTOM_RIGHT_RADIUS = 26,
|
|
39
|
+
CMD_BORDER_BOTTOM_START_RADIUS = 27,
|
|
40
|
+
CMD_BORDER_BOTTOM_END_RADIUS = 28,
|
|
41
|
+
CMD_BORDER_START_START_RADIUS = 29,
|
|
42
|
+
CMD_BORDER_START_END_RADIUS = 30,
|
|
43
|
+
CMD_BORDER_END_START_RADIUS = 31,
|
|
44
|
+
CMD_BORDER_END_END_RADIUS = 32,
|
|
45
|
+
|
|
46
|
+
CMD_BORDER_COLOR = 40,
|
|
47
|
+
CMD_BORDER_TOP_COLOR = 41,
|
|
48
|
+
CMD_BORDER_BOTTOM_COLOR = 42,
|
|
49
|
+
CMD_BORDER_LEFT_COLOR = 43,
|
|
50
|
+
CMD_BORDER_RIGHT_COLOR = 44,
|
|
51
|
+
CMD_BORDER_START_COLOR = 45,
|
|
52
|
+
CMD_BORDER_END_COLOR = 46,
|
|
53
|
+
CMD_BORDER_BLOCK_COLOR = 47,
|
|
54
|
+
CMD_BORDER_BLOCK_START_COLOR = 48,
|
|
55
|
+
CMD_BORDER_BLOCK_END_COLOR = 49,
|
|
56
|
+
|
|
57
|
+
CMD_OUTLINE_COLOR = 50,
|
|
58
|
+
CMD_OUTLINE_OFFSET = 51,
|
|
59
|
+
CMD_OUTLINE_WIDTH = 52,
|
|
60
|
+
|
|
61
|
+
CMD_TRANSFORM_TRANSLATE_X = 100,
|
|
62
|
+
CMD_TRANSFORM_TRANSLATE_Y = 101,
|
|
63
|
+
CMD_TRANSFORM_SCALE = 102,
|
|
64
|
+
CMD_TRANSFORM_SCALE_X = 103,
|
|
65
|
+
CMD_TRANSFORM_SCALE_Y = 104,
|
|
66
|
+
CMD_TRANSFORM_ROTATE = 105,
|
|
67
|
+
CMD_TRANSFORM_ROTATE_X = 106,
|
|
68
|
+
CMD_TRANSFORM_ROTATE_Y = 107,
|
|
69
|
+
CMD_TRANSFORM_ROTATE_Z = 108,
|
|
70
|
+
CMD_TRANSFORM_SKEW_X = 109,
|
|
71
|
+
CMD_TRANSFORM_SKEW_Y = 110,
|
|
72
|
+
CMD_TRANSFORM_MATRIX = 111,
|
|
73
|
+
CMD_TRANSFORM_PERSPECTIVE = 112,
|
|
74
|
+
|
|
75
|
+
CMD_UNIT_DEG = 200,
|
|
76
|
+
CMD_UNIT_RAD = 201,
|
|
77
|
+
CMD_UNIT_PX = 202,
|
|
78
|
+
CMD_UNIT_PERCENT = 203,
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const std::unordered_map<std::string_view, Command> kPropNameToCommand = {
|
|
82
|
+
{"opacity", CMD_OPACITY},
|
|
83
|
+
{"elevation", CMD_ELEVATION},
|
|
84
|
+
{"zIndex", CMD_Z_INDEX},
|
|
85
|
+
{"shadowColor", CMD_SHADOW_COLOR},
|
|
86
|
+
{"backgroundColor", CMD_BACKGROUND_COLOR},
|
|
87
|
+
{"tintColor", CMD_TINT_COLOR},
|
|
88
|
+
{"placeholderTextColor", CMD_PLACEHOLDER_TEXT_COLOR},
|
|
89
|
+
{"borderRadius", CMD_BORDER_RADIUS},
|
|
90
|
+
{"borderTopLeftRadius", CMD_BORDER_TOP_LEFT_RADIUS},
|
|
91
|
+
{"borderTopRightRadius", CMD_BORDER_TOP_RIGHT_RADIUS},
|
|
92
|
+
{"borderTopStartRadius", CMD_BORDER_TOP_START_RADIUS},
|
|
93
|
+
{"borderTopEndRadius", CMD_BORDER_TOP_END_RADIUS},
|
|
94
|
+
{"borderBottomLeftRadius", CMD_BORDER_BOTTOM_LEFT_RADIUS},
|
|
95
|
+
{"borderBottomRightRadius", CMD_BORDER_BOTTOM_RIGHT_RADIUS},
|
|
96
|
+
{"borderBottomStartRadius", CMD_BORDER_BOTTOM_START_RADIUS},
|
|
97
|
+
{"borderBottomEndRadius", CMD_BORDER_BOTTOM_END_RADIUS},
|
|
98
|
+
{"borderStartStartRadius", CMD_BORDER_START_START_RADIUS},
|
|
99
|
+
{"borderStartEndRadius", CMD_BORDER_START_END_RADIUS},
|
|
100
|
+
{"borderEndStartRadius", CMD_BORDER_END_START_RADIUS},
|
|
101
|
+
{"borderEndEndRadius", CMD_BORDER_END_END_RADIUS},
|
|
102
|
+
{"borderColor", CMD_BORDER_COLOR},
|
|
103
|
+
{"borderTopColor", CMD_BORDER_TOP_COLOR},
|
|
104
|
+
{"borderBottomColor", CMD_BORDER_BOTTOM_COLOR},
|
|
105
|
+
{"borderLeftColor", CMD_BORDER_LEFT_COLOR},
|
|
106
|
+
{"borderRightColor", CMD_BORDER_RIGHT_COLOR},
|
|
107
|
+
{"borderStartColor", CMD_BORDER_START_COLOR},
|
|
108
|
+
{"borderEndColor", CMD_BORDER_END_COLOR},
|
|
109
|
+
{"borderBlockColor", CMD_BORDER_BLOCK_COLOR},
|
|
110
|
+
{"borderBlockStartColor", CMD_BORDER_BLOCK_START_COLOR},
|
|
111
|
+
{"borderBlockEndColor", CMD_BORDER_BLOCK_END_COLOR},
|
|
112
|
+
{"outlineColor", CMD_OUTLINE_COLOR},
|
|
113
|
+
{"outlineOffset", CMD_OUTLINE_OFFSET},
|
|
114
|
+
{"outlineWidth", CMD_OUTLINE_WIDTH},
|
|
115
|
+
{"transform", CMD_START_OF_TRANSFORM},
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
Command propNameToCommand(const std::string &name) {
|
|
119
|
+
const auto it = kPropNameToCommand.find(name);
|
|
120
|
+
if (it == kPropNameToCommand.end()) {
|
|
121
|
+
throw std::runtime_error("[Reanimated] Unsupported style: " + name);
|
|
122
|
+
}
|
|
123
|
+
return it->second;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const std::unordered_map<std::string_view, Command> kTransformNameToCommand = {
|
|
127
|
+
{"translateX", CMD_TRANSFORM_TRANSLATE_X},
|
|
128
|
+
{"translateY", CMD_TRANSFORM_TRANSLATE_Y},
|
|
129
|
+
{"scale", CMD_TRANSFORM_SCALE},
|
|
130
|
+
{"scaleX", CMD_TRANSFORM_SCALE_X},
|
|
131
|
+
{"scaleY", CMD_TRANSFORM_SCALE_Y},
|
|
132
|
+
{"rotate", CMD_TRANSFORM_ROTATE},
|
|
133
|
+
{"rotateX", CMD_TRANSFORM_ROTATE_X},
|
|
134
|
+
{"rotateY", CMD_TRANSFORM_ROTATE_Y},
|
|
135
|
+
{"rotateZ", CMD_TRANSFORM_ROTATE_Z},
|
|
136
|
+
{"skewX", CMD_TRANSFORM_SKEW_X},
|
|
137
|
+
{"skewY", CMD_TRANSFORM_SKEW_Y},
|
|
138
|
+
{"matrix", CMD_TRANSFORM_MATRIX},
|
|
139
|
+
{"perspective", CMD_TRANSFORM_PERSPECTIVE},
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
Command transformNameToCommand(const std::string &name) {
|
|
143
|
+
const auto it = kTransformNameToCommand.find(name);
|
|
144
|
+
if (it == kTransformNameToCommand.end()) {
|
|
145
|
+
throw std::runtime_error("[Reanimated] Unsupported transform: " + name);
|
|
146
|
+
}
|
|
147
|
+
return it->second;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
} // namespace
|
|
151
|
+
|
|
152
|
+
void serializeSynchronousPropsToBuffers(
|
|
153
|
+
const UpdatesBatch &synchronousUpdatesBatch,
|
|
154
|
+
std::vector<int> &intBuffer,
|
|
155
|
+
std::vector<double> &doubleBuffer) {
|
|
156
|
+
intBuffer.clear();
|
|
157
|
+
doubleBuffer.clear();
|
|
158
|
+
|
|
159
|
+
const auto pushInt = [&](int value) {
|
|
160
|
+
intBuffer.push_back(value);
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
const auto pushDouble = [&](double value) {
|
|
164
|
+
doubleBuffer.push_back(value);
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
for (const auto &[shadowNodeFamily, props] : synchronousUpdatesBatch) {
|
|
168
|
+
pushInt(CMD_START_OF_VIEW);
|
|
169
|
+
pushInt(shadowNodeFamily->getTag());
|
|
170
|
+
for (const auto &[key, value] : props.items()) {
|
|
171
|
+
const auto &propName = key.getString();
|
|
172
|
+
const auto command = propNameToCommand(propName);
|
|
173
|
+
switch (command) {
|
|
174
|
+
case CMD_OPACITY:
|
|
175
|
+
case CMD_ELEVATION:
|
|
176
|
+
case CMD_Z_INDEX:
|
|
177
|
+
case CMD_OUTLINE_OFFSET:
|
|
178
|
+
case CMD_OUTLINE_WIDTH:
|
|
179
|
+
pushInt(command);
|
|
180
|
+
pushDouble(value.asDouble());
|
|
181
|
+
break;
|
|
182
|
+
|
|
183
|
+
case CMD_SHADOW_COLOR:
|
|
184
|
+
case CMD_BACKGROUND_COLOR:
|
|
185
|
+
case CMD_TINT_COLOR:
|
|
186
|
+
case CMD_PLACEHOLDER_TEXT_COLOR:
|
|
187
|
+
case CMD_BORDER_COLOR:
|
|
188
|
+
case CMD_BORDER_TOP_COLOR:
|
|
189
|
+
case CMD_BORDER_BOTTOM_COLOR:
|
|
190
|
+
case CMD_BORDER_LEFT_COLOR:
|
|
191
|
+
case CMD_BORDER_RIGHT_COLOR:
|
|
192
|
+
case CMD_BORDER_START_COLOR:
|
|
193
|
+
case CMD_BORDER_END_COLOR:
|
|
194
|
+
case CMD_BORDER_BLOCK_COLOR:
|
|
195
|
+
case CMD_BORDER_BLOCK_START_COLOR:
|
|
196
|
+
case CMD_BORDER_BLOCK_END_COLOR:
|
|
197
|
+
case CMD_OUTLINE_COLOR:
|
|
198
|
+
pushInt(command);
|
|
199
|
+
pushInt(value.asInt());
|
|
200
|
+
break;
|
|
201
|
+
|
|
202
|
+
case CMD_BORDER_RADIUS:
|
|
203
|
+
case CMD_BORDER_TOP_LEFT_RADIUS:
|
|
204
|
+
case CMD_BORDER_TOP_RIGHT_RADIUS:
|
|
205
|
+
case CMD_BORDER_TOP_START_RADIUS:
|
|
206
|
+
case CMD_BORDER_TOP_END_RADIUS:
|
|
207
|
+
case CMD_BORDER_BOTTOM_LEFT_RADIUS:
|
|
208
|
+
case CMD_BORDER_BOTTOM_RIGHT_RADIUS:
|
|
209
|
+
case CMD_BORDER_BOTTOM_START_RADIUS:
|
|
210
|
+
case CMD_BORDER_BOTTOM_END_RADIUS:
|
|
211
|
+
case CMD_BORDER_START_START_RADIUS:
|
|
212
|
+
case CMD_BORDER_START_END_RADIUS:
|
|
213
|
+
case CMD_BORDER_END_START_RADIUS:
|
|
214
|
+
case CMD_BORDER_END_END_RADIUS:
|
|
215
|
+
pushInt(command);
|
|
216
|
+
if (value.isDouble()) {
|
|
217
|
+
pushInt(CMD_UNIT_PX);
|
|
218
|
+
pushDouble(value.getDouble());
|
|
219
|
+
} else if (value.isString()) {
|
|
220
|
+
const auto &valueStr = value.getString();
|
|
221
|
+
if (!valueStr.ends_with("%")) {
|
|
222
|
+
throw std::runtime_error("[Reanimated] Border radius string must be a percentage");
|
|
223
|
+
}
|
|
224
|
+
pushInt(CMD_UNIT_PERCENT);
|
|
225
|
+
pushDouble(std::stod(valueStr.substr(0, valueStr.size() - 1)));
|
|
226
|
+
} else {
|
|
227
|
+
throw std::runtime_error("[Reanimated] Border radius value must be either a number or a string");
|
|
228
|
+
}
|
|
229
|
+
break;
|
|
230
|
+
|
|
231
|
+
case CMD_START_OF_TRANSFORM:
|
|
232
|
+
pushInt(command);
|
|
233
|
+
react_native_assert(value.isArray() && "[Reanimated] Transform value must be an array");
|
|
234
|
+
for (const auto &item : value) {
|
|
235
|
+
react_native_assert(item.isObject() && "[Reanimated] Transform array item must be an object");
|
|
236
|
+
react_native_assert(
|
|
237
|
+
item.size() == 1 && "[Reanimated] Transform array item must have exactly one key-value pair");
|
|
238
|
+
const auto &transformName = item.keys().begin()->getString();
|
|
239
|
+
const auto transformCommand = transformNameToCommand(transformName);
|
|
240
|
+
const auto &transformValue = *item.values().begin();
|
|
241
|
+
switch (transformCommand) {
|
|
242
|
+
case CMD_TRANSFORM_SCALE:
|
|
243
|
+
case CMD_TRANSFORM_SCALE_X:
|
|
244
|
+
case CMD_TRANSFORM_SCALE_Y:
|
|
245
|
+
case CMD_TRANSFORM_PERSPECTIVE: {
|
|
246
|
+
pushInt(transformCommand);
|
|
247
|
+
pushDouble(transformValue.asDouble());
|
|
248
|
+
break;
|
|
249
|
+
}
|
|
250
|
+
case CMD_TRANSFORM_TRANSLATE_X:
|
|
251
|
+
case CMD_TRANSFORM_TRANSLATE_Y: {
|
|
252
|
+
pushInt(transformCommand);
|
|
253
|
+
if (transformValue.isDouble()) {
|
|
254
|
+
pushInt(CMD_UNIT_PX);
|
|
255
|
+
pushDouble(transformValue.getDouble());
|
|
256
|
+
} else if (transformValue.isString()) {
|
|
257
|
+
const auto &transformValueStr = transformValue.getString();
|
|
258
|
+
if (!transformValueStr.ends_with("%")) {
|
|
259
|
+
throw std::runtime_error("[Reanimated] String translate must be a percentage");
|
|
260
|
+
}
|
|
261
|
+
pushInt(CMD_UNIT_PERCENT);
|
|
262
|
+
pushDouble(std::stod(transformValueStr.substr(0, transformValueStr.size() - 1)));
|
|
263
|
+
} else {
|
|
264
|
+
throw std::runtime_error("[Reanimated] Translate value must be either a number or a string");
|
|
265
|
+
}
|
|
266
|
+
break;
|
|
267
|
+
}
|
|
268
|
+
case CMD_TRANSFORM_ROTATE:
|
|
269
|
+
case CMD_TRANSFORM_ROTATE_X:
|
|
270
|
+
case CMD_TRANSFORM_ROTATE_Y:
|
|
271
|
+
case CMD_TRANSFORM_ROTATE_Z:
|
|
272
|
+
case CMD_TRANSFORM_SKEW_X:
|
|
273
|
+
case CMD_TRANSFORM_SKEW_Y: {
|
|
274
|
+
const auto &transformValueStr = transformValue.getString();
|
|
275
|
+
pushInt(transformCommand);
|
|
276
|
+
if (transformValueStr.ends_with("deg")) {
|
|
277
|
+
pushInt(CMD_UNIT_DEG);
|
|
278
|
+
} else if (transformValueStr.ends_with("rad")) {
|
|
279
|
+
pushInt(CMD_UNIT_RAD);
|
|
280
|
+
} else {
|
|
281
|
+
throw std::runtime_error("[Reanimated] Unsupported rotation unit: " + transformValueStr);
|
|
282
|
+
}
|
|
283
|
+
pushDouble(std::stod(transformValueStr.substr(0, transformValueStr.size() - 3)));
|
|
284
|
+
break;
|
|
285
|
+
}
|
|
286
|
+
case CMD_TRANSFORM_MATRIX: {
|
|
287
|
+
pushInt(transformCommand);
|
|
288
|
+
react_native_assert(transformValue.isArray() && "[Reanimated] Matrix must be an array");
|
|
289
|
+
int size = transformValue.size();
|
|
290
|
+
pushInt(size);
|
|
291
|
+
for (int i = 0; i < size; i++) {
|
|
292
|
+
pushDouble(transformValue[i].asDouble());
|
|
293
|
+
}
|
|
294
|
+
break;
|
|
295
|
+
}
|
|
296
|
+
default:
|
|
297
|
+
throw std::runtime_error("[Reanimated] Unsupported transform: " + transformName);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
pushInt(CMD_END_OF_TRANSFORM);
|
|
301
|
+
break;
|
|
302
|
+
|
|
303
|
+
default:
|
|
304
|
+
throw std::runtime_error("[Reanimated] Unsupported prop: " + propName);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
pushInt(CMD_END_OF_VIEW);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
} // namespace reanimated
|
|
312
|
+
|
|
313
|
+
#endif // ANDROID
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#ifdef ANDROID
|
|
4
|
+
|
|
5
|
+
#include <reanimated/Fabric/updates/UpdatesRegistry.h>
|
|
6
|
+
|
|
7
|
+
#include <vector>
|
|
8
|
+
|
|
9
|
+
namespace reanimated {
|
|
10
|
+
|
|
11
|
+
void serializeSynchronousPropsToBuffers(
|
|
12
|
+
const UpdatesBatch &synchronousUpdatesBatch,
|
|
13
|
+
std::vector<int> &intBuffer,
|
|
14
|
+
std::vector<double> &doubleBuffer);
|
|
15
|
+
|
|
16
|
+
} // namespace reanimated
|
|
17
|
+
|
|
18
|
+
#endif // ANDROID
|