@react-native-ohos/react-native-reanimated 3.18.2-rc.2 → 4.0.0-rc.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/compatibility.json +161 -0
- package/harmony/reanimated/BuildProfile.ets +16 -16
- package/harmony/reanimated/build-profile.json5 +18 -11
- package/harmony/reanimated/oh-package.json5 +12 -11
- package/harmony/reanimated/src/main/cpp/CMakeLists.txt +31 -40
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.cpp +81 -86
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.h +46 -47
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/InterpolatorRegistry.cpp +390 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/InterpolatorRegistry.h +16 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/definitions.h +30 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/filters/FilterOp.cpp +46 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/filters/FilterOp.h +23 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/Quaternion.cpp +53 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/Quaternion.h +21 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformMatrix.cpp +166 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformMatrix.h +71 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformMatrix2D.cpp +368 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformMatrix2D.h +53 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformMatrix3D.cpp +594 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformMatrix3D.h +67 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformOp.cpp +52 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformOp.h +26 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/vectors.cpp +156 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/vectors.h +76 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSAngle.cpp +93 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSAngle.h +33 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSBoolean.cpp +48 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSBoolean.h +31 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSColor.cpp +135 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSColor.h +61 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSDiscreteArray.cpp +100 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSDiscreteArray.h +44 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSKeyword.cpp +81 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSKeyword.h +53 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSLength.cpp +122 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSLength.h +38 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSNumber.cpp +82 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSNumber.h +63 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSValue.h +118 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSValueVariant.cpp +174 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSValueVariant.h +111 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/complex/CSSBoxShadow.cpp +196 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/complex/CSSBoxShadow.h +66 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/complex/CSSDropShadow.cpp +134 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/complex/CSSDropShadow.h +44 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSAnimationConfig.cpp +174 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSAnimationConfig.h +49 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSKeyframesConfig.cpp +45 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSKeyframesConfig.h +26 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSTransitionConfig.cpp +90 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSTransitionConfig.h +43 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/common.cpp +17 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/common.h +13 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSAnimation.cpp +127 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSAnimation.h +51 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSTransition.cpp +145 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSTransition.h +47 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/EasingFunctions.cpp +69 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/EasingFunctions.h +22 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/cubicBezier.cpp +66 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/cubicBezier.h +15 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/linear.cpp +28 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/linear.h +15 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/steps.cpp +13 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/steps.h +12 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/InterpolatorFactory.cpp +157 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/InterpolatorFactory.h +189 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/PropertyInterpolator.cpp +76 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/PropertyInterpolator.h +66 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/configs.h +20 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterOperation.cpp +136 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterOperation.h +40 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterOperationInterpolator.cpp +38 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterOperationInterpolator.h +24 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterStyleInterpolator.cpp +58 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterStyleInterpolator.h +24 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/blur.h +14 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/brightness.h +14 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/contrast.h +14 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/dropShadow.h +17 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/grayscale.h +14 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/hueRotate.h +14 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/invert.h +14 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/opacity.h +14 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/saturate.h +14 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/sepia.h +14 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/ArrayPropertiesInterpolator.cpp +95 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/ArrayPropertiesInterpolator.h +36 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/GroupPropertiesInterpolator.cpp +41 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/GroupPropertiesInterpolator.h +32 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/RecordPropertiesInterpolator.cpp +99 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/RecordPropertiesInterpolator.h +37 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/OperationsStyleInterpolator.cpp +308 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/OperationsStyleInterpolator.h +100 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/StyleOperation.cpp +19 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/StyleOperation.h +94 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/StyleOperationInterpolator.cpp +18 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/StyleOperationInterpolator.h +43 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/AnimationStyleInterpolator.h +26 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/TransitionStyleInterpolator.cpp +103 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/TransitionStyleInterpolator.h +42 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperation.cpp +224 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperation.h +52 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperationInterpolator.cpp +218 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperationInterpolator.h +89 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformsStyleInterpolator.cpp +149 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformsStyleInterpolator.h +33 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/matrix.cpp +208 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/matrix.h +56 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/perspective.cpp +42 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/perspective.h +20 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/rotate.cpp +41 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/rotate.h +39 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/scale.cpp +28 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/scale.h +25 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/skew.cpp +14 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/skew.h +20 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/translate.cpp +39 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/translate.h +25 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ResolvableValueInterpolator.cpp +47 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ResolvableValueInterpolator.h +43 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/SimpleValueInterpolator.cpp +70 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/SimpleValueInterpolator.h +40 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ValueInterpolator.cpp +146 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ValueInterpolator.h +71 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/misc/ViewStylesRepository.cpp +155 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/misc/ViewStylesRepository.h +53 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/AnimationProgressProvider.cpp +170 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/AnimationProgressProvider.h +67 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/KeyframeProgressProvider.h +12 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/RawProgressProvider.cpp +41 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/RawProgressProvider.h +31 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/TransitionProgressProvider.cpp +193 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/TransitionProgressProvider.h +77 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSAnimationsRegistry.cpp +340 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSAnimationsRegistry.h +80 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSKeyframesRegistry.cpp +45 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSKeyframesRegistry.h +29 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSTransitionsRegistry.cpp +167 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSTransitionsRegistry.h +51 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/StaticPropsRegistry.cpp +61 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/StaticPropsRegistry.h +33 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGBrush.cpp +80 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGBrush.h +39 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGLength.cpp +93 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGLength.h +36 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGStrokeDashArray.cpp +110 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGStrokeDashArray.h +33 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/DelayedItemsManager.cpp +75 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/DelayedItemsManager.h +45 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/algorithms.cpp +12 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/algorithms.h +10 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/interpolators.cpp +36 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/interpolators.h +23 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/props.cpp +149 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/props.h +32 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.cpp +113 -101
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.h +49 -51
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitShadowNode.h +46 -49
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.cpp +56 -96
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.h +37 -33
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.cpp +104 -95
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.h +22 -29
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.cpp +72 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.h +25 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistry.cpp +160 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistry.h +71 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistryManager.cpp +161 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistryManager.h +65 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationType.h +11 -9
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.cpp +137 -232
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.h +82 -90
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.cpp +79 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.h +81 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.cpp +864 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.h +214 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/{LayoutAnimationsProxy.cpp → LayoutAnimationsProxy_Legacy.cpp} +897 -870
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.h +220 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.cpp +31 -91
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.h +146 -176
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/PropsDiffer.cpp +456 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/PropsDiffer.h +102 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/SharedTransitions.cpp +544 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/PropValueProcessor.cpp +119 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/PropValueProcessor.h +39 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.cpp +1376 -971
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.h +228 -252
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.cpp +183 -231
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.h +93 -109
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.cpp +54 -56
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.h +28 -20
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.cpp +58 -70
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.h +31 -35
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeatureFlags.cpp +18 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeatureFlags.h +44 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/PlatformDepMethodsHolder.h +67 -98
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReanimatedSystraceSection.h +114 -135
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReanimatedVersion.cpp +46 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/{worklets → reanimated}/Tools/ReanimatedVersion.h +18 -19
- package/harmony/reanimated/src/main/cpp/ReanimatedModule.cpp +60 -85
- package/harmony/reanimated/src/main/cpp/ReanimatedNodesManager.cpp +1 -0
- package/harmony/reanimated/src/main/cpp/ReanimatedPackage.cpp +0 -3
- package/harmony/reanimated/src/main/cpp/ReanimatedSensor.cpp +266 -0
- package/harmony/reanimated/src/main/cpp/ReanimatedSensor.h +36 -0
- package/harmony/reanimated/src/main/cpp/ReanimatedSensorContainer.cpp +36 -0
- package/harmony/reanimated/src/main/cpp/ReanimatedSensorContainer.h +23 -0
- package/harmony/reanimated/src/main/cpp/ReanimatedUIScheduler.h +3 -3
- package/harmony/reanimated/src/main/ets/ReanimatedModule.ts +5 -1
- package/harmony/reanimated/src/main/ets/ReanimatedPackage.ts +1 -4
- package/harmony/reanimated/src/main/module.json5 +12 -12
- package/harmony/reanimated/src/main/resources/base/element/color.json +7 -7
- package/harmony/reanimated/src/main/resources/base/element/string.json +15 -15
- package/harmony/reanimated/src/main/resources/base/profile/main_pages.json +5 -5
- package/harmony/reanimated/src/main/resources/en_US/element/string.json +15 -15
- package/harmony/reanimated/src/main/resources/zh_CN/element/string.json +15 -15
- package/harmony/reanimated/ts.ts +6 -6
- package/harmony/reanimated.har +0 -0
- package/package.json +68 -50
- package/scripts/deploy.js +191 -0
- package/scripts/set-reanimated-version.js +37 -0
- package/scripts/update-version.js +119 -0
- package/scripts/validate-react-native-version.js +46 -0
- package/scripts/validate-worklets-build.js +17 -0
- package/scripts/validate-worklets-version.js +79 -0
- package/scripts/worklets-version.json +4 -0
- package/LICENSE +0 -21
- package/README.OpenSource +0 -11
- package/README.md +0 -10
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/PropsRegistry.cpp +0 -68
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/PropsRegistry.h +0 -68
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy.h +0 -147
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/CollectionUtils.h +0 -14
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeaturesConfig.cpp +0 -5
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeaturesConfig.h +0 -19
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.cpp +0 -47
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.h +0 -59
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxySpec.cpp +0 -27
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxySpec.h +0 -25
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/EventHandlerRegistry.cpp +0 -94
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/EventHandlerRegistry.h +0 -49
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.cpp +0 -8
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.h +0 -39
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/SharedItems/Shareables.cpp +0 -326
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/SharedItems/Shareables.h +0 -345
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/AsyncQueue.cpp +0 -52
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/AsyncQueue.h +0 -35
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/Defs.h +0 -10
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSISerializer.cpp +0 -342
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSISerializer.h +0 -47
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSLogger.cpp +0 -16
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSLogger.h +0 -20
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSScheduler.cpp +0 -20
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSScheduler.h +0 -29
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/PlatformLogger.h +0 -16
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedJSIUtils.cpp +0 -26
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedJSIUtils.h +0 -199
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedVersion.cpp +0 -95
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/SingleInstanceChecker.h +0 -72
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ThreadSafeQueue.h +0 -49
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/UIScheduler.cpp +0 -20
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/UIScheduler.h +0 -22
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/WorkletEventHandler.cpp +0 -29
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/WorkletEventHandler.h +0 -41
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.cpp +0 -16
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.h +0 -19
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedHermesRuntime.cpp +0 -112
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedHermesRuntime.h +0 -127
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedRuntime.cpp +0 -53
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedRuntime.h +0 -22
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RuntimeInitialization.md +0 -191
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.cpp +0 -173
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.h +0 -90
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeCollector.h +0 -36
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp +0 -189
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.h +0 -22
- package/harmony/reanimated/src/main/cpp/ReanimatedLogger.cpp +0 -33
- package/harmony/reanimated/src/main/cpp/WorkletsModule.cpp +0 -61
- package/harmony/reanimated/src/main/cpp/WorkletsModule.h +0 -22
- package/harmony/reanimated/src/main/cpp/patches/AnimatedSensor/AnimatedSensorModule.cpp +0 -89
- package/harmony/reanimated/src/main/cpp/patches/Fabric/ShadowTreeCloner.cpp +0 -95
- package/harmony/reanimated/src/main/cpp/patches/NativeModules/ReanimatedModuleProxy.cpp +0 -964
- package/harmony/reanimated/src/main/ets/WorkletsModule.ts +0 -15
|
@@ -1,964 +0,0 @@
|
|
|
1
|
-
#include <jsi/jsi.h>
|
|
2
|
-
#include <reanimated/NativeModules/ReanimatedModuleProxy.h>
|
|
3
|
-
#include <reanimated/RuntimeDecorators/UIRuntimeDecorator.h>
|
|
4
|
-
#include <reanimated/Tools/CollectionUtils.h>
|
|
5
|
-
#include <reanimated/Tools/FeaturesConfig.h>
|
|
6
|
-
#include <reanimated/Tools/ReanimatedSystraceSection.h>
|
|
7
|
-
#include <unordered_map>
|
|
8
|
-
|
|
9
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
10
|
-
#include <reanimated/Fabric/ReanimatedCommitShadowNode.h>
|
|
11
|
-
#include <reanimated/Fabric/ShadowTreeCloner.h>
|
|
12
|
-
#endif // RCT_NEW_ARCH_ENABLED
|
|
13
|
-
|
|
14
|
-
#include <worklets/Registries/EventHandlerRegistry.h>
|
|
15
|
-
#include <worklets/SharedItems/Shareables.h>
|
|
16
|
-
#include <worklets/Tools/AsyncQueue.h>
|
|
17
|
-
#include <worklets/Tools/WorkletEventHandler.h>
|
|
18
|
-
|
|
19
|
-
#ifdef __ANDROID__
|
|
20
|
-
#include <fbjni/fbjni.h>
|
|
21
|
-
#endif // __ANDROID__
|
|
22
|
-
|
|
23
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
24
|
-
#include <react/renderer/scheduler/Scheduler.h>
|
|
25
|
-
#include <react/renderer/uimanager/UIManagerBinding.h>
|
|
26
|
-
#include <react/renderer/uimanager/primitives.h>
|
|
27
|
-
#endif // RCT_NEW_ARCH_ENABLED
|
|
28
|
-
|
|
29
|
-
#include <functional>
|
|
30
|
-
#include <utility>
|
|
31
|
-
|
|
32
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
33
|
-
#include <iomanip>
|
|
34
|
-
#include <sstream>
|
|
35
|
-
#include <string>
|
|
36
|
-
#endif // RCT_NEW_ARCH_ENABLED
|
|
37
|
-
|
|
38
|
-
namespace reanimated {
|
|
39
|
-
|
|
40
|
-
ReanimatedModuleProxy::ReanimatedModuleProxy(
|
|
41
|
-
const std::shared_ptr<WorkletsModuleProxy> &workletsModuleProxy,
|
|
42
|
-
jsi::Runtime &rnRuntime,
|
|
43
|
-
const std::shared_ptr<CallInvoker> &jsCallInvoker,
|
|
44
|
-
const PlatformDepMethodsHolder &platformDepMethodsHolder,
|
|
45
|
-
const bool isBridgeless,
|
|
46
|
-
const bool isReducedMotion)
|
|
47
|
-
: ReanimatedModuleProxySpec(jsCallInvoker),
|
|
48
|
-
isBridgeless_(isBridgeless),
|
|
49
|
-
isReducedMotion_(isReducedMotion),
|
|
50
|
-
workletsModuleProxy_(workletsModuleProxy),
|
|
51
|
-
valueUnpackerCode_(workletsModuleProxy->getValueUnpackerCode()),
|
|
52
|
-
uiWorkletRuntime_(std::make_shared<WorkletRuntime>(
|
|
53
|
-
rnRuntime,
|
|
54
|
-
workletsModuleProxy->getJSQueue(),
|
|
55
|
-
workletsModuleProxy->getJSScheduler(),
|
|
56
|
-
"Reanimated UI runtime",
|
|
57
|
-
true /* supportsLocking */,
|
|
58
|
-
valueUnpackerCode_)),
|
|
59
|
-
eventHandlerRegistry_(std::make_unique<EventHandlerRegistry>()),
|
|
60
|
-
requestRender_(platformDepMethodsHolder.requestRender),
|
|
61
|
-
animatedSensorModule_(platformDepMethodsHolder),
|
|
62
|
-
jsLogger_(
|
|
63
|
-
std::make_shared<JSLogger>(workletsModuleProxy->getJSScheduler())),
|
|
64
|
-
layoutAnimationsManager_(
|
|
65
|
-
std::make_shared<LayoutAnimationsManager>(jsLogger_)),
|
|
66
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
67
|
-
propsRegistry_(std::make_shared<PropsRegistry>()),
|
|
68
|
-
#else
|
|
69
|
-
obtainPropFunction_(platformDepMethodsHolder.obtainPropFunction),
|
|
70
|
-
configurePropsPlatformFunction_(
|
|
71
|
-
platformDepMethodsHolder.configurePropsFunction),
|
|
72
|
-
updatePropsFunction_(platformDepMethodsHolder.updatePropsFunction),
|
|
73
|
-
#endif
|
|
74
|
-
subscribeForKeyboardEventsFunction_(
|
|
75
|
-
platformDepMethodsHolder.subscribeForKeyboardEvents),
|
|
76
|
-
unsubscribeFromKeyboardEventsFunction_(
|
|
77
|
-
platformDepMethodsHolder.unsubscribeFromKeyboardEvents) {
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
void ReanimatedModuleProxy::init(
|
|
81
|
-
const PlatformDepMethodsHolder &platformDepMethodsHolder) {
|
|
82
|
-
auto onRenderCallback = [weakThis =
|
|
83
|
-
weak_from_this()](const double timestampMs) {
|
|
84
|
-
auto strongThis = weakThis.lock();
|
|
85
|
-
if (!strongThis) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
strongThis->renderRequested_ = false;
|
|
90
|
-
strongThis->onRender(timestampMs);
|
|
91
|
-
};
|
|
92
|
-
onRenderCallback_ = std::move(onRenderCallback);
|
|
93
|
-
|
|
94
|
-
auto requestAnimationFrame = [weakThis = weak_from_this()](
|
|
95
|
-
jsi::Runtime &rt,
|
|
96
|
-
const jsi::Value &callback) {
|
|
97
|
-
auto strongThis = weakThis.lock();
|
|
98
|
-
if (!strongThis) {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
strongThis->requestAnimationFrame(rt, callback);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
106
|
-
auto updateProps = [weakThis = weak_from_this()](
|
|
107
|
-
jsi::Runtime &rt, const jsi::Value &operations) {
|
|
108
|
-
auto strongThis = weakThis.lock();
|
|
109
|
-
if (!strongThis) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
strongThis->updateProps(rt, operations);
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
auto removeFromPropsRegistry = [weakThis = weak_from_this()](
|
|
117
|
-
jsi::Runtime &rt,
|
|
118
|
-
const jsi::Value &viewTags) {
|
|
119
|
-
auto strongThis = weakThis.lock();
|
|
120
|
-
if (!strongThis) {
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
strongThis->removeFromPropsRegistry(rt, viewTags);
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
auto measure = [weakThis = weak_from_this()](
|
|
128
|
-
jsi::Runtime &rt,
|
|
129
|
-
const jsi::Value &shadowNodeValue) -> jsi::Value {
|
|
130
|
-
auto strongThis = weakThis.lock();
|
|
131
|
-
if (!strongThis) {
|
|
132
|
-
return jsi::Value::undefined();
|
|
133
|
-
}
|
|
134
|
-
return strongThis->measure(rt, shadowNodeValue);
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
auto dispatchCommand = [weakThis = weak_from_this()](
|
|
138
|
-
jsi::Runtime &rt,
|
|
139
|
-
const jsi::Value &shadowNodeValue,
|
|
140
|
-
const jsi::Value &commandNameValue,
|
|
141
|
-
const jsi::Value &argsValue) {
|
|
142
|
-
auto strongThis = weakThis.lock();
|
|
143
|
-
if (!strongThis) {
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
strongThis->dispatchCommand(
|
|
148
|
-
rt, shadowNodeValue, commandNameValue, argsValue);
|
|
149
|
-
};
|
|
150
|
-
ProgressLayoutAnimationFunction progressLayoutAnimation =
|
|
151
|
-
[weakThis = weak_from_this()](
|
|
152
|
-
jsi::Runtime &rt, int tag, const jsi::Object &newStyle, bool) {
|
|
153
|
-
auto strongThis = weakThis.lock();
|
|
154
|
-
if (!strongThis) {
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
auto surfaceId =
|
|
159
|
-
strongThis->layoutAnimationsProxy_->progressLayoutAnimation(
|
|
160
|
-
tag, newStyle);
|
|
161
|
-
if (!surfaceId) {
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
strongThis->uiManager_->getShadowTreeRegistry().visit(
|
|
165
|
-
*surfaceId, [](const ShadowTree &shadowTree) {
|
|
166
|
-
shadowTree.notifyDelegatesOfUpdates();
|
|
167
|
-
});
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
EndLayoutAnimationFunction endLayoutAnimation =
|
|
171
|
-
[weakThis = weak_from_this()](int tag, bool shouldRemove) {
|
|
172
|
-
auto strongThis = weakThis.lock();
|
|
173
|
-
if (!strongThis) {
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
auto surfaceId = strongThis->layoutAnimationsProxy_->endLayoutAnimation(
|
|
178
|
-
tag, shouldRemove);
|
|
179
|
-
if (!surfaceId) {
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
strongThis->uiManager_->getShadowTreeRegistry().visit(
|
|
184
|
-
*surfaceId, [](const ShadowTree &shadowTree) {
|
|
185
|
-
shadowTree.notifyDelegatesOfUpdates();
|
|
186
|
-
});
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
auto obtainProp = [weakThis = weak_from_this()](
|
|
190
|
-
jsi::Runtime &rt,
|
|
191
|
-
const jsi::Value &shadowNodeWrapper,
|
|
192
|
-
const jsi::Value &propName) {
|
|
193
|
-
auto strongThis = weakThis.lock();
|
|
194
|
-
if (!strongThis) {
|
|
195
|
-
return jsi::String::createFromUtf8(rt, "");
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
return strongThis->obtainProp(rt, shadowNodeWrapper, propName);
|
|
199
|
-
};
|
|
200
|
-
#endif
|
|
201
|
-
|
|
202
|
-
jsi::Runtime &uiRuntime = uiWorkletRuntime_->getJSIRuntime();
|
|
203
|
-
UIRuntimeDecorator::decorate(
|
|
204
|
-
uiRuntime,
|
|
205
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
206
|
-
obtainProp,
|
|
207
|
-
updateProps,
|
|
208
|
-
measure,
|
|
209
|
-
dispatchCommand,
|
|
210
|
-
#else
|
|
211
|
-
platformDepMethodsHolder.scrollToFunction,
|
|
212
|
-
platformDepMethodsHolder.obtainPropFunction,
|
|
213
|
-
platformDepMethodsHolder.updatePropsFunction,
|
|
214
|
-
platformDepMethodsHolder.measureFunction,
|
|
215
|
-
platformDepMethodsHolder.dispatchCommandFunction,
|
|
216
|
-
#endif
|
|
217
|
-
requestAnimationFrame,
|
|
218
|
-
platformDepMethodsHolder.getAnimationTimestamp,
|
|
219
|
-
platformDepMethodsHolder.setGestureStateFunction,
|
|
220
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
221
|
-
progressLayoutAnimation,
|
|
222
|
-
endLayoutAnimation,
|
|
223
|
-
#else
|
|
224
|
-
platformDepMethodsHolder.progressLayoutAnimation,
|
|
225
|
-
platformDepMethodsHolder.endLayoutAnimation,
|
|
226
|
-
#endif
|
|
227
|
-
platformDepMethodsHolder.maybeFlushUIUpdatesQueueFunction);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
ReanimatedModuleProxy::~ReanimatedModuleProxy() {
|
|
231
|
-
// event handler registry and frame callbacks store some JSI values from UI
|
|
232
|
-
// runtime, so they have to go away before we tear down the runtime
|
|
233
|
-
eventHandlerRegistry_.reset();
|
|
234
|
-
frameCallbacks_.clear();
|
|
235
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
236
|
-
operationsInBatch_.clear();
|
|
237
|
-
#endif // RCT_NEW_ARCH_ENABLED
|
|
238
|
-
uiWorkletRuntime_.reset();
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
void ReanimatedModuleProxy::scheduleOnUI(
|
|
242
|
-
jsi::Runtime &rt,
|
|
243
|
-
const jsi::Value &worklet) {
|
|
244
|
-
auto shareableWorklet = extractShareableOrThrow<ShareableWorklet>(
|
|
245
|
-
rt, worklet, "[Reanimated] Only worklets can be scheduled to run on UI.");
|
|
246
|
-
workletsModuleProxy_->getUIScheduler()->scheduleOnUI(
|
|
247
|
-
[=, weakThis = weak_from_this()] {
|
|
248
|
-
const auto strongThis = weakThis.lock();
|
|
249
|
-
if (!strongThis) {
|
|
250
|
-
return;
|
|
251
|
-
}
|
|
252
|
-
#if JS_RUNTIME_HERMES
|
|
253
|
-
// JSI's scope defined here allows for JSI-objects to be cleared up
|
|
254
|
-
// after each runtime loop. Within these loops we typically create some
|
|
255
|
-
// temporary JSI objects and hence it allows for such objects to be
|
|
256
|
-
// garbage collected much sooner. Apparently the scope API is only
|
|
257
|
-
// supported on Hermes at the moment.
|
|
258
|
-
const auto scope =
|
|
259
|
-
jsi::Scope(strongThis->uiWorkletRuntime_->getJSIRuntime());
|
|
260
|
-
#endif
|
|
261
|
-
strongThis->uiWorkletRuntime_->runGuarded(shareableWorklet);
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
jsi::Value ReanimatedModuleProxy::executeOnUIRuntimeSync(
|
|
266
|
-
jsi::Runtime &rt,
|
|
267
|
-
const jsi::Value &worklet) {
|
|
268
|
-
return uiWorkletRuntime_->executeSync(rt, worklet);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
jsi::Value ReanimatedModuleProxy::createWorkletRuntime(
|
|
272
|
-
jsi::Runtime &rt,
|
|
273
|
-
const jsi::Value &name,
|
|
274
|
-
const jsi::Value &initializer) {
|
|
275
|
-
auto workletRuntime = std::make_shared<WorkletRuntime>(
|
|
276
|
-
rt,
|
|
277
|
-
workletsModuleProxy_->getJSQueue(),
|
|
278
|
-
workletsModuleProxy_->getJSScheduler(),
|
|
279
|
-
name.asString(rt).utf8(rt),
|
|
280
|
-
true /* supportsLocking */,
|
|
281
|
-
valueUnpackerCode_);
|
|
282
|
-
auto initializerShareable = extractShareableOrThrow<ShareableWorklet>(
|
|
283
|
-
rt, initializer, "[Reanimated] Initializer must be a worklet.");
|
|
284
|
-
workletRuntime->runGuarded(initializerShareable);
|
|
285
|
-
return jsi::Object::createFromHostObject(rt, workletRuntime);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
jsi::Value ReanimatedModuleProxy::scheduleOnRuntime(
|
|
289
|
-
jsi::Runtime &rt,
|
|
290
|
-
const jsi::Value &workletRuntimeValue,
|
|
291
|
-
const jsi::Value &shareableWorkletValue) {
|
|
292
|
-
reanimated::scheduleOnRuntime(rt, workletRuntimeValue, shareableWorkletValue);
|
|
293
|
-
return jsi::Value::undefined();
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
jsi::Value ReanimatedModuleProxy::registerEventHandler(
|
|
297
|
-
jsi::Runtime &rt,
|
|
298
|
-
const jsi::Value &worklet,
|
|
299
|
-
const jsi::Value &eventName,
|
|
300
|
-
const jsi::Value &emitterReactTag) {
|
|
301
|
-
static uint64_t NEXT_EVENT_HANDLER_ID = 1;
|
|
302
|
-
|
|
303
|
-
uint64_t newRegistrationId = NEXT_EVENT_HANDLER_ID++;
|
|
304
|
-
auto eventNameStr = eventName.asString(rt).utf8(rt);
|
|
305
|
-
auto handlerShareable = extractShareableOrThrow<ShareableWorklet>(
|
|
306
|
-
rt, worklet, "[Reanimated] Event handler must be a worklet.");
|
|
307
|
-
int emitterReactTagInt = emitterReactTag.asNumber();
|
|
308
|
-
|
|
309
|
-
workletsModuleProxy_->getUIScheduler()->scheduleOnUI(
|
|
310
|
-
[=, weakThis = weak_from_this()]() {
|
|
311
|
-
auto strongThis = weakThis.lock();
|
|
312
|
-
if (!strongThis) {
|
|
313
|
-
return;
|
|
314
|
-
}
|
|
315
|
-
auto handler = std::make_shared<WorkletEventHandler>(
|
|
316
|
-
newRegistrationId,
|
|
317
|
-
eventNameStr,
|
|
318
|
-
emitterReactTagInt,
|
|
319
|
-
handlerShareable);
|
|
320
|
-
strongThis->eventHandlerRegistry_->registerEventHandler(
|
|
321
|
-
std::move(handler));
|
|
322
|
-
});
|
|
323
|
-
|
|
324
|
-
return jsi::Value(static_cast<double>(newRegistrationId));
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
void ReanimatedModuleProxy::unregisterEventHandler(
|
|
328
|
-
jsi::Runtime &,
|
|
329
|
-
const jsi::Value ®istrationId) {
|
|
330
|
-
uint64_t id = registrationId.asNumber();
|
|
331
|
-
workletsModuleProxy_->getUIScheduler()->scheduleOnUI(
|
|
332
|
-
[=, weakThis = weak_from_this()]() {
|
|
333
|
-
auto strongThis = weakThis.lock();
|
|
334
|
-
if (!strongThis) {
|
|
335
|
-
return;
|
|
336
|
-
}
|
|
337
|
-
strongThis->eventHandlerRegistry_->unregisterEventHandler(id);
|
|
338
|
-
});
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
342
|
-
static inline std::string intColorToHex(const int val) {
|
|
343
|
-
std::stringstream
|
|
344
|
-
invertedHexColorStream; // By default transparency is first, color second
|
|
345
|
-
invertedHexColorStream << std::setfill('0') << std::setw(8) << std::hex
|
|
346
|
-
<< val;
|
|
347
|
-
|
|
348
|
-
auto invertedHexColor = invertedHexColorStream.str();
|
|
349
|
-
auto hexColor =
|
|
350
|
-
"#" + invertedHexColor.substr(2, 6) + invertedHexColor.substr(0, 2);
|
|
351
|
-
|
|
352
|
-
return hexColor;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
std::string ReanimatedModuleProxy::obtainPropFromShadowNode(
|
|
356
|
-
jsi::Runtime &rt,
|
|
357
|
-
const std::string &propName,
|
|
358
|
-
const ShadowNode::Shared &shadowNode) {
|
|
359
|
-
auto newestCloneOfShadowNode =
|
|
360
|
-
uiManager_->getNewestCloneOfShadowNode(*shadowNode);
|
|
361
|
-
|
|
362
|
-
if (propName == "width" || propName == "height" || propName == "top" ||
|
|
363
|
-
propName == "left") {
|
|
364
|
-
// These props are calculated from frame
|
|
365
|
-
auto layoutableShadowNode = dynamic_cast<LayoutableShadowNode const *>(
|
|
366
|
-
newestCloneOfShadowNode.get());
|
|
367
|
-
const auto &frame = layoutableShadowNode->layoutMetrics_.frame;
|
|
368
|
-
|
|
369
|
-
if (propName == "width") {
|
|
370
|
-
return std::to_string(frame.size.width);
|
|
371
|
-
} else if (propName == "height") {
|
|
372
|
-
return std::to_string(frame.size.height);
|
|
373
|
-
} else if (propName == "top") {
|
|
374
|
-
return std::to_string(frame.origin.y);
|
|
375
|
-
} else if (propName == "left") {
|
|
376
|
-
return std::to_string(frame.origin.x);
|
|
377
|
-
}
|
|
378
|
-
} else {
|
|
379
|
-
// These props are calculated from viewProps
|
|
380
|
-
auto props = newestCloneOfShadowNode->getProps();
|
|
381
|
-
auto viewProps = std::static_pointer_cast<const ViewProps>(props);
|
|
382
|
-
if (propName == "opacity") {
|
|
383
|
-
return std::to_string(viewProps->opacity);
|
|
384
|
-
} else if (propName == "zIndex") {
|
|
385
|
-
if (viewProps->zIndex.has_value()) {
|
|
386
|
-
return std::to_string(*viewProps->zIndex);
|
|
387
|
-
}
|
|
388
|
-
} else if (propName == "backgroundColor") {
|
|
389
|
-
return intColorToHex(*viewProps->backgroundColor);
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
throw std::runtime_error(std::string(
|
|
394
|
-
"Getting property `" + propName +
|
|
395
|
-
"` with function `getViewProp` is not supported"));
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
jsi::Value ReanimatedModuleProxy::getViewProp(
|
|
399
|
-
jsi::Runtime &rnRuntime,
|
|
400
|
-
const jsi::Value &shadowNodeWrapper,
|
|
401
|
-
const jsi::Value &propName,
|
|
402
|
-
const jsi::Value &callback) {
|
|
403
|
-
const auto propNameStr = propName.asString(rnRuntime).utf8(rnRuntime);
|
|
404
|
-
const auto funPtr = std::make_shared<jsi::Function>(
|
|
405
|
-
callback.getObject(rnRuntime).asFunction(rnRuntime));
|
|
406
|
-
const auto shadowNode = shadowNodeFromValue(rnRuntime, shadowNodeWrapper);
|
|
407
|
-
workletsModuleProxy_->getUIScheduler()->scheduleOnUI(
|
|
408
|
-
[=, weakThis = weak_from_this()]() {
|
|
409
|
-
auto strongThis = weakThis.lock();
|
|
410
|
-
if (!strongThis) {
|
|
411
|
-
return;
|
|
412
|
-
}
|
|
413
|
-
jsi::Runtime &uiRuntime =
|
|
414
|
-
strongThis->uiWorkletRuntime_->getJSIRuntime();
|
|
415
|
-
const auto resultStr = strongThis->obtainPropFromShadowNode(
|
|
416
|
-
uiRuntime, propNameStr, shadowNode);
|
|
417
|
-
|
|
418
|
-
strongThis->workletsModuleProxy_->getJSScheduler()->scheduleOnJS(
|
|
419
|
-
[=](jsi::Runtime &rnRuntime) {
|
|
420
|
-
const auto resultValue =
|
|
421
|
-
jsi::String::createFromUtf8(rnRuntime, resultStr);
|
|
422
|
-
funPtr->call(rnRuntime, resultValue);
|
|
423
|
-
});
|
|
424
|
-
});
|
|
425
|
-
return jsi::Value::undefined();
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
#else
|
|
429
|
-
|
|
430
|
-
jsi::Value ReanimatedModuleProxy::getViewProp(
|
|
431
|
-
jsi::Runtime &rnRuntime,
|
|
432
|
-
const jsi::Value &viewTag,
|
|
433
|
-
const jsi::Value &propName,
|
|
434
|
-
const jsi::Value &callback) {
|
|
435
|
-
const auto propNameStr = propName.asString(rnRuntime).utf8(rnRuntime);
|
|
436
|
-
const auto funPtr = std::make_shared<jsi::Function>(
|
|
437
|
-
callback.getObject(rnRuntime).asFunction(rnRuntime));
|
|
438
|
-
|
|
439
|
-
const int viewTagInt = viewTag.asNumber();
|
|
440
|
-
|
|
441
|
-
workletsModuleProxy_->getUIScheduler()->scheduleOnUI(
|
|
442
|
-
[=, weakThis = weak_from_this()]
|
|
443
|
-
|
|
444
|
-
() {
|
|
445
|
-
auto strongThis = weakThis.lock();
|
|
446
|
-
if (!strongThis) {
|
|
447
|
-
return;
|
|
448
|
-
}
|
|
449
|
-
jsi::Runtime &uiRuntime =
|
|
450
|
-
strongThis->uiWorkletRuntime_->getJSIRuntime();
|
|
451
|
-
const jsi::Value propNameValue =
|
|
452
|
-
jsi::String::createFromUtf8(uiRuntime, propNameStr);
|
|
453
|
-
const auto resultValue = strongThis->obtainPropFunction_(
|
|
454
|
-
uiRuntime, viewTagInt, propNameValue);
|
|
455
|
-
const auto resultStr = resultValue.asString(uiRuntime).utf8(uiRuntime);
|
|
456
|
-
const auto jsScheduler =
|
|
457
|
-
strongThis->workletsModuleProxy_->getJSScheduler();
|
|
458
|
-
jsScheduler->scheduleOnJS([=](jsi::Runtime &rnRuntime) {
|
|
459
|
-
const auto resultValue =
|
|
460
|
-
jsi::String::createFromUtf8(rnRuntime, resultStr);
|
|
461
|
-
funPtr->call(rnRuntime, resultValue);
|
|
462
|
-
});
|
|
463
|
-
});
|
|
464
|
-
return jsi::Value::undefined();
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
#endif
|
|
468
|
-
|
|
469
|
-
jsi::Value ReanimatedModuleProxy::enableLayoutAnimations(
|
|
470
|
-
jsi::Runtime &,
|
|
471
|
-
const jsi::Value &config) {
|
|
472
|
-
FeaturesConfig::setLayoutAnimationEnabled(config.getBool());
|
|
473
|
-
return jsi::Value::undefined();
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
jsi::Value ReanimatedModuleProxy::configureProps(
|
|
477
|
-
jsi::Runtime &rt,
|
|
478
|
-
const jsi::Value &uiProps,
|
|
479
|
-
const jsi::Value &nativeProps) {
|
|
480
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
481
|
-
auto uiPropsArray = uiProps.asObject(rt).asArray(rt);
|
|
482
|
-
for (size_t i = 0; i < uiPropsArray.size(rt); ++i) {
|
|
483
|
-
auto name = uiPropsArray.getValueAtIndex(rt, i).asString(rt).utf8(rt);
|
|
484
|
-
animatablePropNames_.insert(name);
|
|
485
|
-
}
|
|
486
|
-
auto nativePropsArray = nativeProps.asObject(rt).asArray(rt);
|
|
487
|
-
for (size_t i = 0; i < nativePropsArray.size(rt); ++i) {
|
|
488
|
-
auto name = nativePropsArray.getValueAtIndex(rt, i).asString(rt).utf8(rt);
|
|
489
|
-
animatablePropNames_.insert(name);
|
|
490
|
-
}
|
|
491
|
-
#else
|
|
492
|
-
configurePropsPlatformFunction_(rt, uiProps, nativeProps);
|
|
493
|
-
#endif // RCT_NEW_ARCH_ENABLED
|
|
494
|
-
|
|
495
|
-
return jsi::Value::undefined();
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
jsi::Value ReanimatedModuleProxy::configureLayoutAnimationBatch(
|
|
499
|
-
jsi::Runtime &rt,
|
|
500
|
-
const jsi::Value &layoutAnimationsBatch) {
|
|
501
|
-
auto array = layoutAnimationsBatch.asObject(rt).asArray(rt);
|
|
502
|
-
size_t length = array.size(rt);
|
|
503
|
-
std::vector<LayoutAnimationConfig> batch(length);
|
|
504
|
-
for (int i = 0; i < length; i++) {
|
|
505
|
-
auto item = array.getValueAtIndex(rt, i).asObject(rt);
|
|
506
|
-
auto &batchItem = batch[i];
|
|
507
|
-
batchItem.tag = item.getProperty(rt, "viewTag").asNumber();
|
|
508
|
-
batchItem.type = static_cast<LayoutAnimationType>(
|
|
509
|
-
item.getProperty(rt, "type").asNumber());
|
|
510
|
-
auto config = item.getProperty(rt, "config");
|
|
511
|
-
if (config.isUndefined()) {
|
|
512
|
-
batchItem.config = nullptr;
|
|
513
|
-
} else {
|
|
514
|
-
batchItem.config = extractShareableOrThrow<ShareableObject>(
|
|
515
|
-
rt,
|
|
516
|
-
config,
|
|
517
|
-
"[Reanimated] Layout animation config must be an object.");
|
|
518
|
-
}
|
|
519
|
-
if (batch[i].type != SHARED_ELEMENT_TRANSITION &&
|
|
520
|
-
batch[i].type != SHARED_ELEMENT_TRANSITION_PROGRESS) {
|
|
521
|
-
continue;
|
|
522
|
-
}
|
|
523
|
-
auto sharedTransitionTag = item.getProperty(rt, "sharedTransitionTag");
|
|
524
|
-
if (sharedTransitionTag.isUndefined()) {
|
|
525
|
-
batch[i].config = nullptr;
|
|
526
|
-
} else {
|
|
527
|
-
batch[i].sharedTransitionTag = sharedTransitionTag.asString(rt).utf8(rt);
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
layoutAnimationsManager_->configureAnimationBatch(batch);
|
|
531
|
-
return jsi::Value::undefined();
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
void ReanimatedModuleProxy::setShouldAnimateExiting(
|
|
535
|
-
jsi::Runtime &rt,
|
|
536
|
-
const jsi::Value &viewTag,
|
|
537
|
-
const jsi::Value &shouldAnimate) {
|
|
538
|
-
layoutAnimationsManager_->setShouldAnimateExiting(
|
|
539
|
-
viewTag.asNumber(), shouldAnimate.getBool());
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
bool ReanimatedModuleProxy::isAnyHandlerWaitingForEvent(
|
|
543
|
-
const std::string &eventName,
|
|
544
|
-
const int emitterReactTag) {
|
|
545
|
-
return eventHandlerRegistry_->isAnyHandlerWaitingForEvent(
|
|
546
|
-
eventName, emitterReactTag);
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
void ReanimatedModuleProxy::requestAnimationFrame(
|
|
550
|
-
jsi::Runtime &rt,
|
|
551
|
-
const jsi::Value &callback) {
|
|
552
|
-
frameCallbacks_.push_back(std::make_shared<jsi::Value>(rt, callback));
|
|
553
|
-
maybeRequestRender();
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
void ReanimatedModuleProxy::maybeRequestRender() {
|
|
557
|
-
if (!renderRequested_) {
|
|
558
|
-
renderRequested_ = true;
|
|
559
|
-
requestRender_(onRenderCallback_);
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
void ReanimatedModuleProxy::onRender(double timestampMs) {
|
|
564
|
-
auto callbacks = std::move(frameCallbacks_);
|
|
565
|
-
frameCallbacks_.clear();
|
|
566
|
-
jsi::Runtime &uiRuntime = uiWorkletRuntime_->getJSIRuntime();
|
|
567
|
-
jsi::Value timestamp{timestampMs};
|
|
568
|
-
for (const auto &callback : callbacks) {
|
|
569
|
-
runOnRuntimeGuarded(uiRuntime, *callback, timestamp);
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
jsi::Value ReanimatedModuleProxy::registerSensor(
|
|
574
|
-
jsi::Runtime &rt,
|
|
575
|
-
const jsi::Value &sensorType,
|
|
576
|
-
const jsi::Value &interval,
|
|
577
|
-
const jsi::Value &iosReferenceFrame,
|
|
578
|
-
const jsi::Value &sensorDataHandler) {
|
|
579
|
-
return animatedSensorModule_.registerSensor(
|
|
580
|
-
rt,
|
|
581
|
-
uiWorkletRuntime_,
|
|
582
|
-
sensorType,
|
|
583
|
-
interval,
|
|
584
|
-
iosReferenceFrame,
|
|
585
|
-
sensorDataHandler);
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
void ReanimatedModuleProxy::unregisterSensor(
|
|
589
|
-
jsi::Runtime &,
|
|
590
|
-
const jsi::Value &sensorId) {
|
|
591
|
-
animatedSensorModule_.unregisterSensor(sensorId);
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
void ReanimatedModuleProxy::cleanupSensors() {
|
|
595
|
-
animatedSensorModule_.unregisterAllSensors();
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
599
|
-
|
|
600
|
-
void ReanimatedModuleProxy::markNodeAsRemovable(
|
|
601
|
-
jsi::Runtime &rt,
|
|
602
|
-
const jsi::Value &shadowNodeWrapper) {
|
|
603
|
-
auto shadowNode = shadowNodeFromValue(rt, shadowNodeWrapper);
|
|
604
|
-
propsRegistry_->markNodeAsRemovable(shadowNode);
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
void ReanimatedModuleProxy::unmarkNodeAsRemovable(
|
|
608
|
-
jsi::Runtime &rt,
|
|
609
|
-
const jsi::Value &viewTag) {
|
|
610
|
-
propsRegistry_->unmarkNodeAsRemovable(viewTag.asNumber());
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
jsi::Value ReanimatedModuleProxy::filterNonAnimatableProps(
|
|
614
|
-
jsi::Runtime &rt,
|
|
615
|
-
const jsi::Value &props) {
|
|
616
|
-
jsi::Object nonAnimatableProps(rt);
|
|
617
|
-
bool hasAnyNonAnimatableProp = false;
|
|
618
|
-
const jsi::Object &propsObject = props.asObject(rt);
|
|
619
|
-
const jsi::Array &propNames = propsObject.getPropertyNames(rt);
|
|
620
|
-
for (size_t i = 0; i < propNames.size(rt); ++i) {
|
|
621
|
-
const std::string &propName =
|
|
622
|
-
propNames.getValueAtIndex(rt, i).asString(rt).utf8(rt);
|
|
623
|
-
if (propName == "transformOrigin") {
|
|
624
|
-
continue;
|
|
625
|
-
}
|
|
626
|
-
if (!collection::contains(animatablePropNames_, propName)) {
|
|
627
|
-
hasAnyNonAnimatableProp = true;
|
|
628
|
-
const auto &propNameStr = propName.c_str();
|
|
629
|
-
const jsi::Value &propValue = propsObject.getProperty(rt, propNameStr);
|
|
630
|
-
nonAnimatableProps.setProperty(rt, propNameStr, propValue);
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
if (!hasAnyNonAnimatableProp) {
|
|
634
|
-
return jsi::Value::undefined();
|
|
635
|
-
}
|
|
636
|
-
return nonAnimatableProps;
|
|
637
|
-
}
|
|
638
|
-
#endif // RCT_NEW_ARCH_ENABLED
|
|
639
|
-
|
|
640
|
-
bool ReanimatedModuleProxy::handleEvent(
|
|
641
|
-
const std::string &eventName,
|
|
642
|
-
const int emitterReactTag,
|
|
643
|
-
const jsi::Value &payload,
|
|
644
|
-
double currentTime) {
|
|
645
|
-
eventHandlerRegistry_->processEvent(
|
|
646
|
-
uiWorkletRuntime_, currentTime, eventName, emitterReactTag, payload);
|
|
647
|
-
|
|
648
|
-
// TODO: return true if Reanimated successfully handled the event
|
|
649
|
-
// to avoid sending it to JavaScript
|
|
650
|
-
return false;
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
654
|
-
bool ReanimatedModuleProxy::handleRawEvent(
|
|
655
|
-
const RawEvent &rawEvent,
|
|
656
|
-
double currentTime) {
|
|
657
|
-
const EventTarget *eventTarget = rawEvent.eventTarget.get();
|
|
658
|
-
if (eventTarget == nullptr) {
|
|
659
|
-
// after app reload scrollView is unmounted and its content offset is set
|
|
660
|
-
// to 0 and view is thrown into recycle pool setting content offset
|
|
661
|
-
// triggers scroll event eventTarget is null though, because it's
|
|
662
|
-
// unmounting we can just ignore this event, because it's an event on
|
|
663
|
-
// unmounted component
|
|
664
|
-
return false;
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
int tag = eventTarget->getTag();
|
|
668
|
-
auto eventType = rawEvent.type;
|
|
669
|
-
if (eventType.rfind("top", 0) == 0) {
|
|
670
|
-
eventType = "on" + eventType.substr(3);
|
|
671
|
-
}
|
|
672
|
-
jsi::Runtime &rt = uiWorkletRuntime_->getJSIRuntime();
|
|
673
|
-
|
|
674
|
-
if (!isAnyHandlerWaitingForEvent(eventType, tag)) {
|
|
675
|
-
return false;
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
const auto &eventPayload = rawEvent.eventPayload;
|
|
679
|
-
jsi::Value payload = eventPayload->asJSIValue(rt);
|
|
680
|
-
|
|
681
|
-
auto res = handleEvent(eventType, tag, std::move(payload), currentTime);
|
|
682
|
-
// TODO: we should call performOperations conditionally if event is handled
|
|
683
|
-
// (res == true), but for now handleEvent always returns false. Thankfully,
|
|
684
|
-
// performOperations does not trigger a lot of code if there is nothing to
|
|
685
|
-
// be done so this is fine for now.
|
|
686
|
-
performOperations();
|
|
687
|
-
return res;
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
void ReanimatedModuleProxy::updateProps(
|
|
691
|
-
jsi::Runtime &rt,
|
|
692
|
-
const jsi::Value &operations) {
|
|
693
|
-
auto array = operations.asObject(rt).asArray(rt);
|
|
694
|
-
size_t length = array.size(rt);
|
|
695
|
-
for (size_t i = 0; i < length; ++i) {
|
|
696
|
-
auto item = array.getValueAtIndex(rt, i).asObject(rt);
|
|
697
|
-
auto shadowNodeWrapper = item.getProperty(rt, "shadowNodeWrapper");
|
|
698
|
-
auto shadowNode = shadowNodeFromValue(rt, shadowNodeWrapper);
|
|
699
|
-
const jsi::Value &updates = item.getProperty(rt, "updates");
|
|
700
|
-
operationsInBatch_.emplace_back(
|
|
701
|
-
shadowNode, std::make_unique<jsi::Value>(rt, updates));
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
void ReanimatedModuleProxy::performOperations() {
|
|
706
|
-
if (operationsInBatch_.empty() && tagsToRemove_.empty()) {
|
|
707
|
-
// nothing to do
|
|
708
|
-
return;
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
ReanimatedSystraceSection s("performOperations");
|
|
712
|
-
|
|
713
|
-
auto copiedOperationsQueue = std::move(operationsInBatch_);
|
|
714
|
-
operationsInBatch_.clear();
|
|
715
|
-
|
|
716
|
-
jsi::Runtime &rt = uiWorkletRuntime_->getJSIRuntime();
|
|
717
|
-
|
|
718
|
-
{
|
|
719
|
-
auto lock = propsRegistry_->createLock();
|
|
720
|
-
|
|
721
|
-
if (copiedOperationsQueue.size() > 0 &&
|
|
722
|
-
propsRegistry_->shouldReanimatedSkipCommit()) {
|
|
723
|
-
propsRegistry_->pleaseCommitAfterPause();
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
// remove recently unmounted ShadowNodes from PropsRegistry
|
|
727
|
-
if (!tagsToRemove_.empty()) {
|
|
728
|
-
for (auto tag : tagsToRemove_) {
|
|
729
|
-
propsRegistry_->remove(tag);
|
|
730
|
-
}
|
|
731
|
-
tagsToRemove_.clear();
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
// Even if only non-layout props are changed, we need to store the update
|
|
735
|
-
// in PropsRegistry anyway so that React doesn't overwrite it in the next
|
|
736
|
-
// render. Currently, only opacity and transform are treated in a special
|
|
737
|
-
// way but backgroundColor, shadowOpacity etc. would get overwritten (see
|
|
738
|
-
// `_propKeysManagedByAnimated_DO_NOT_USE_THIS_IS_BROKEN`).
|
|
739
|
-
for (const auto &[shadowNode, props] : copiedOperationsQueue) {
|
|
740
|
-
propsRegistry_->update(shadowNode, dynamicFromValue(rt, *props));
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
for (const auto &[shadowNode, props] : copiedOperationsQueue) {
|
|
745
|
-
const jsi::Value &nonAnimatableProps = filterNonAnimatableProps(rt, *props);
|
|
746
|
-
if (nonAnimatableProps.isUndefined()) {
|
|
747
|
-
continue;
|
|
748
|
-
}
|
|
749
|
-
Tag viewTag = shadowNode->getTag();
|
|
750
|
-
jsi::Value maybeJSPropsUpdater =
|
|
751
|
-
rt.global().getProperty(rt, "updateJSProps");
|
|
752
|
-
assert(
|
|
753
|
-
maybeJSPropsUpdater.isObject() &&
|
|
754
|
-
"[Reanimated] `updateJSProps` not found");
|
|
755
|
-
jsi::Function jsPropsUpdater =
|
|
756
|
-
maybeJSPropsUpdater.asObject(rt).asFunction(rt);
|
|
757
|
-
jsPropsUpdater.call(rt, viewTag, nonAnimatableProps);
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
if (propsRegistry_->shouldReanimatedSkipCommit()) {
|
|
761
|
-
// It may happen that `performOperations` is called on the UI thread
|
|
762
|
-
// while React Native tries to commit a new tree on the JS thread.
|
|
763
|
-
// In this case, we should skip the commit here and let React Native do
|
|
764
|
-
// it. The commit will include the current values from PropsRegistry which
|
|
765
|
-
// will be applied in ReanimatedCommitHook.
|
|
766
|
-
return;
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
react_native_assert(uiManager_ != nullptr);
|
|
770
|
-
const auto &shadowTreeRegistry = uiManager_->getShadowTreeRegistry();
|
|
771
|
-
|
|
772
|
-
std::unordered_map<SurfaceId, PropsMap> propsMapBySurface;
|
|
773
|
-
|
|
774
|
-
for (auto const &[shadowNode, props] : copiedOperationsQueue) {
|
|
775
|
-
SurfaceId surfaceId = shadowNode->getSurfaceId();
|
|
776
|
-
auto family = &shadowNode->getFamily();
|
|
777
|
-
react_native_assert(family->getSurfaceId() == surfaceId);
|
|
778
|
-
propsMapBySurface[surfaceId][family].emplace_back(rt, std::move(*props));
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
for (auto const &entry : propsMapBySurface) {
|
|
782
|
-
auto surfaceId = entry.first;
|
|
783
|
-
auto const &propsMap = entry.second;
|
|
784
|
-
shadowTreeRegistry.visit(surfaceId, [&](ShadowTree const &shadowTree) {
|
|
785
|
-
shadowTree.commit(
|
|
786
|
-
[&](RootShadowNode const &oldRootShadowNode)
|
|
787
|
-
-> RootShadowNode::Unshared {
|
|
788
|
-
if (propsRegistry_->shouldReanimatedSkipCommit()) {
|
|
789
|
-
return nullptr;
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
auto rootNode =
|
|
793
|
-
cloneShadowTreeWithNewProps(oldRootShadowNode, propsMap);
|
|
794
|
-
|
|
795
|
-
// Mark the commit as Reanimated commit so that we can distinguish
|
|
796
|
-
// it in ReanimatedCommitHook.
|
|
797
|
-
|
|
798
|
-
auto reaShadowNode =
|
|
799
|
-
std::reinterpret_pointer_cast<ReanimatedCommitShadowNode>(
|
|
800
|
-
rootNode);
|
|
801
|
-
reaShadowNode->setReanimatedCommitTrait();
|
|
802
|
-
|
|
803
|
-
return rootNode;
|
|
804
|
-
},
|
|
805
|
-
{/* .enableStateReconciliation = */
|
|
806
|
-
false,
|
|
807
|
-
/* .mountSynchronously = */ true});
|
|
808
|
-
});
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
void ReanimatedModuleProxy::dispatchCommand(
|
|
813
|
-
jsi::Runtime &rt,
|
|
814
|
-
const jsi::Value &shadowNodeValue,
|
|
815
|
-
const jsi::Value &commandNameValue,
|
|
816
|
-
const jsi::Value &argsValue) {
|
|
817
|
-
ShadowNode::Shared shadowNode = shadowNodeFromValue(rt, shadowNodeValue);
|
|
818
|
-
std::string commandName = stringFromValue(rt, commandNameValue);
|
|
819
|
-
folly::dynamic args = commandArgsFromValue(rt, argsValue);
|
|
820
|
-
uiManager_->dispatchCommand(shadowNode, commandName, args);
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
jsi::String ReanimatedModuleProxy::obtainProp(
|
|
824
|
-
jsi::Runtime &rt,
|
|
825
|
-
const jsi::Value &shadowNodeWrapper,
|
|
826
|
-
const jsi::Value &propName) {
|
|
827
|
-
jsi::Runtime &uiRuntime = uiWorkletRuntime_->getJSIRuntime();
|
|
828
|
-
const auto propNameStr = propName.asString(rt).utf8(rt);
|
|
829
|
-
const auto shadowNode = shadowNodeFromValue(rt, shadowNodeWrapper);
|
|
830
|
-
const auto resultStr =
|
|
831
|
-
obtainPropFromShadowNode(uiRuntime, propNameStr, shadowNode);
|
|
832
|
-
return jsi::String::createFromUtf8(rt, resultStr);
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
jsi::Value ReanimatedModuleProxy::measure(
|
|
836
|
-
jsi::Runtime &rt,
|
|
837
|
-
const jsi::Value &shadowNodeValue) {
|
|
838
|
-
// based on implementation from UIManagerBinding.cpp
|
|
839
|
-
|
|
840
|
-
auto shadowNode = shadowNodeFromValue(rt, shadowNodeValue);
|
|
841
|
-
auto layoutMetrics = uiManager_->getRelativeLayoutMetrics(
|
|
842
|
-
*shadowNode, nullptr, {/* .includeTransform = */ true});
|
|
843
|
-
|
|
844
|
-
if (layoutMetrics == EmptyLayoutMetrics) {
|
|
845
|
-
// Originally, in this case React Native returns `{0, 0, 0, 0, 0, 0}`,
|
|
846
|
-
// most likely due to the type of measure callback function which accepts
|
|
847
|
-
// just an array of numbers (not null). In Reanimated, `measure` returns
|
|
848
|
-
// `MeasuredDimensions | null`.
|
|
849
|
-
return jsi::Value::null();
|
|
850
|
-
}
|
|
851
|
-
auto newestCloneOfShadowNode =
|
|
852
|
-
uiManager_->getNewestCloneOfShadowNode(*shadowNode);
|
|
853
|
-
|
|
854
|
-
auto layoutableShadowNode =
|
|
855
|
-
dynamic_cast<LayoutableShadowNode const *>(newestCloneOfShadowNode.get());
|
|
856
|
-
facebook::react::Point originRelativeToParent =
|
|
857
|
-
layoutableShadowNode != nullptr
|
|
858
|
-
? layoutableShadowNode->getLayoutMetrics().frame.origin
|
|
859
|
-
: facebook::react::Point();
|
|
860
|
-
|
|
861
|
-
auto frame = layoutMetrics.frame;
|
|
862
|
-
|
|
863
|
-
jsi::Object result(rt);
|
|
864
|
-
result.setProperty(
|
|
865
|
-
rt, "x", jsi::Value(static_cast<double>(originRelativeToParent.x)));
|
|
866
|
-
result.setProperty(
|
|
867
|
-
rt, "y", jsi::Value(static_cast<double>(originRelativeToParent.y)));
|
|
868
|
-
result.setProperty(
|
|
869
|
-
rt, "width", jsi::Value(static_cast<double>(frame.size.width)));
|
|
870
|
-
result.setProperty(
|
|
871
|
-
rt, "height", jsi::Value(static_cast<double>(frame.size.height)));
|
|
872
|
-
result.setProperty(
|
|
873
|
-
rt, "pageX", jsi::Value(static_cast<double>(frame.origin.x)));
|
|
874
|
-
result.setProperty(
|
|
875
|
-
rt, "pageY", jsi::Value(static_cast<double>(frame.origin.y)));
|
|
876
|
-
return result;
|
|
877
|
-
}
|
|
878
|
-
|
|
879
|
-
void ReanimatedModuleProxy::initializeFabric(
|
|
880
|
-
const std::shared_ptr<UIManager> &uiManager) {
|
|
881
|
-
uiManager_ = uiManager;
|
|
882
|
-
|
|
883
|
-
initializeLayoutAnimationsProxy();
|
|
884
|
-
|
|
885
|
-
mountHook_ =
|
|
886
|
-
std::make_shared<ReanimatedMountHook>(propsRegistry_, uiManager_);
|
|
887
|
-
commitHook_ = std::make_shared<ReanimatedCommitHook>(
|
|
888
|
-
propsRegistry_, uiManager_, layoutAnimationsProxy_);
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
void ReanimatedModuleProxy::initializeLayoutAnimationsProxy() {
|
|
892
|
-
uiManager_->setAnimationDelegate(nullptr);
|
|
893
|
-
auto scheduler = reinterpret_cast<Scheduler *>(uiManager_->getDelegate());
|
|
894
|
-
auto componentDescriptorRegistry =
|
|
895
|
-
scheduler->getContextContainer()
|
|
896
|
-
->at<std::weak_ptr<const ComponentDescriptorRegistry>>(
|
|
897
|
-
"ComponentDescriptorRegistry_DO_NOT_USE_PRETTY_PLEASE")
|
|
898
|
-
.lock();
|
|
899
|
-
|
|
900
|
-
if (componentDescriptorRegistry) {
|
|
901
|
-
layoutAnimationsProxy_ = std::make_shared<LayoutAnimationsProxy>(
|
|
902
|
-
layoutAnimationsManager_,
|
|
903
|
-
componentDescriptorRegistry,
|
|
904
|
-
scheduler->getContextContainer(),
|
|
905
|
-
uiWorkletRuntime_->getJSIRuntime(),
|
|
906
|
-
workletsModuleProxy_->getUIScheduler());
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
#ifdef IS_REANIMATED_EXAMPLE_APP
|
|
911
|
-
|
|
912
|
-
std::string format(bool b) {
|
|
913
|
-
return b ? "✅" : "❌";
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
std::function<std::string()>
|
|
917
|
-
ReanimatedModuleProxy::createRegistriesLeakCheck() {
|
|
918
|
-
return [weakThis = weak_from_this()]() {
|
|
919
|
-
auto strongThis = weakThis.lock();
|
|
920
|
-
if (!strongThis) {
|
|
921
|
-
return std::string("");
|
|
922
|
-
}
|
|
923
|
-
|
|
924
|
-
std::string result = "";
|
|
925
|
-
|
|
926
|
-
result += "PropsRegistry: " + format(strongThis->propsRegistry_->isEmpty());
|
|
927
|
-
|
|
928
|
-
return result;
|
|
929
|
-
};
|
|
930
|
-
}
|
|
931
|
-
|
|
932
|
-
#endif // IS_REANIMATED_EXAMPLE_APP
|
|
933
|
-
|
|
934
|
-
#endif // RCT_NEW_ARCH_ENABLED
|
|
935
|
-
|
|
936
|
-
jsi::Value ReanimatedModuleProxy::subscribeForKeyboardEvents(
|
|
937
|
-
jsi::Runtime &rt,
|
|
938
|
-
const jsi::Value &handlerWorklet,
|
|
939
|
-
const jsi::Value &isStatusBarTranslucent,
|
|
940
|
-
const jsi::Value &isNavigationBarTranslucent) {
|
|
941
|
-
auto shareableHandler = extractShareableOrThrow<ShareableWorklet>(
|
|
942
|
-
rt,
|
|
943
|
-
handlerWorklet,
|
|
944
|
-
"[Reanimated] Keyboard event handler must be a worklet.");
|
|
945
|
-
return subscribeForKeyboardEventsFunction_(
|
|
946
|
-
[=, weakThis = weak_from_this()](int keyboardState, int height) {
|
|
947
|
-
auto strongThis = weakThis.lock();
|
|
948
|
-
if (!strongThis) {
|
|
949
|
-
return;
|
|
950
|
-
}
|
|
951
|
-
strongThis->uiWorkletRuntime_->runGuarded(
|
|
952
|
-
shareableHandler, jsi::Value(keyboardState), jsi::Value(height));
|
|
953
|
-
},
|
|
954
|
-
isStatusBarTranslucent.getBool(),
|
|
955
|
-
isNavigationBarTranslucent.getBool());
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
void ReanimatedModuleProxy::unsubscribeFromKeyboardEvents(
|
|
959
|
-
jsi::Runtime &,
|
|
960
|
-
const jsi::Value &listenerId) {
|
|
961
|
-
unsubscribeFromKeyboardEventsFunction_(listenerId.asNumber());
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
} // namespace reanimated
|