@react-native-ohos/react-native-reanimated 3.18.1-rc.6 → 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 +1 -1
- package/harmony/reanimated/build-profile.json5 +8 -1
- package/harmony/reanimated/oh-package.json5 +3 -2
- package/harmony/reanimated/src/main/cpp/CMakeLists.txt +31 -40
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.cpp +11 -16
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.h +3 -4
- 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 +51 -39
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.h +13 -15
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitShadowNode.h +0 -3
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.cpp +22 -53
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.h +12 -8
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.cpp +46 -37
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.h +3 -10
- 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 +4 -2
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.cpp +62 -157
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.h +38 -46
- 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} +303 -276
- 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 +5 -65
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.h +52 -82
- 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 +957 -552
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.h +87 -111
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.cpp +115 -163
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.h +38 -54
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.cpp +34 -36
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.h +8 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.cpp +46 -58
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.h +5 -9
- 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 +26 -57
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReanimatedSystraceSection.h +12 -33
- 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 +3 -4
- 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 +12 -1
- package/harmony/reanimated/src/main/ets/ReanimatedPackage.ts +1 -4
- package/harmony/reanimated.har +0 -0
- package/package.json +36 -18
- 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 -155
- 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 -182
- 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,86 +1,86 @@
|
|
|
1
1
|
#include <jsi/jsi.h>
|
|
2
|
+
#include <reanimated/NativeModules/PropValueProcessor.h>
|
|
2
3
|
#include <reanimated/NativeModules/ReanimatedModuleProxy.h>
|
|
3
4
|
#include <reanimated/RuntimeDecorators/UIRuntimeDecorator.h>
|
|
4
|
-
#include <reanimated/Tools/
|
|
5
|
-
#include <reanimated/Tools/FeaturesConfig.h>
|
|
5
|
+
#include <reanimated/Tools/FeatureFlags.h>
|
|
6
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
7
|
|
|
14
8
|
#include <worklets/Registries/EventHandlerRegistry.h>
|
|
15
|
-
#include <worklets/SharedItems/
|
|
16
|
-
#include <worklets/Tools/AsyncQueue.h>
|
|
9
|
+
#include <worklets/SharedItems/Serializable.h>
|
|
17
10
|
#include <worklets/Tools/WorkletEventHandler.h>
|
|
18
11
|
|
|
19
12
|
#ifdef __ANDROID__
|
|
20
13
|
#include <fbjni/fbjni.h>
|
|
21
14
|
#endif // __ANDROID__
|
|
22
15
|
|
|
23
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
24
16
|
#include <react/renderer/scheduler/Scheduler.h>
|
|
25
17
|
#include <react/renderer/uimanager/UIManagerBinding.h>
|
|
26
|
-
#include <
|
|
27
|
-
#
|
|
18
|
+
#include <reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.h>
|
|
19
|
+
#include <reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.h>
|
|
28
20
|
|
|
29
21
|
#include <functional>
|
|
30
|
-
#include <utility>
|
|
31
|
-
|
|
32
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
33
22
|
#include <iomanip>
|
|
23
|
+
#include <memory>
|
|
34
24
|
#include <sstream>
|
|
35
25
|
#include <string>
|
|
36
|
-
#
|
|
26
|
+
#include <unordered_map>
|
|
27
|
+
#include <unordered_set>
|
|
28
|
+
#include <utility>
|
|
29
|
+
#include <vector>
|
|
37
30
|
|
|
38
31
|
namespace reanimated {
|
|
39
32
|
|
|
33
|
+
#if REACT_NATIVE_MINOR_VERSION >= 81
|
|
34
|
+
static inline std::shared_ptr<const ShadowNode> shadowNodeFromValue(
|
|
35
|
+
jsi::Runtime &rt,
|
|
36
|
+
const jsi::Value &shadowNodeWrapper) {
|
|
37
|
+
return Bridging<std::shared_ptr<const ShadowNode>>::fromJs(rt, shadowNodeWrapper);
|
|
38
|
+
}
|
|
39
|
+
#endif
|
|
40
|
+
|
|
40
41
|
ReanimatedModuleProxy::ReanimatedModuleProxy(
|
|
41
42
|
const std::shared_ptr<WorkletsModuleProxy> &workletsModuleProxy,
|
|
42
43
|
jsi::Runtime &rnRuntime,
|
|
43
44
|
const std::shared_ptr<CallInvoker> &jsCallInvoker,
|
|
44
45
|
const PlatformDepMethodsHolder &platformDepMethodsHolder,
|
|
45
|
-
const bool isBridgeless,
|
|
46
46
|
const bool isReducedMotion)
|
|
47
47
|
: ReanimatedModuleProxySpec(jsCallInvoker),
|
|
48
|
-
isBridgeless_(isBridgeless),
|
|
49
48
|
isReducedMotion_(isReducedMotion),
|
|
50
49
|
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
50
|
eventHandlerRegistry_(std::make_unique<EventHandlerRegistry>()),
|
|
60
51
|
requestRender_(platformDepMethodsHolder.requestRender),
|
|
61
52
|
animatedSensorModule_(platformDepMethodsHolder),
|
|
62
|
-
jsLogger_(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
propsRegistry_(std::make_shared<PropsRegistry>()),
|
|
68
|
-
#else
|
|
69
|
-
obtainPropFunction_(platformDepMethodsHolder.obtainPropFunction),
|
|
70
|
-
configurePropsPlatformFunction_(
|
|
71
|
-
platformDepMethodsHolder.configurePropsFunction),
|
|
72
|
-
updatePropsFunction_(platformDepMethodsHolder.updatePropsFunction),
|
|
53
|
+
jsLogger_(std::make_shared<JSLogger>(workletsModuleProxy->getJSScheduler())),
|
|
54
|
+
layoutAnimationsManager_(std::make_shared<LayoutAnimationsManager>(jsLogger_)),
|
|
55
|
+
getAnimationTimestamp_(platformDepMethodsHolder.getAnimationTimestamp),
|
|
56
|
+
#ifdef __APPLE__
|
|
57
|
+
forceScreenSnapshot_(platformDepMethodsHolder.forceScreenSnapshotFunction),
|
|
73
58
|
#endif
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
59
|
+
animatedPropsRegistry_(std::make_shared<AnimatedPropsRegistry>()),
|
|
60
|
+
staticPropsRegistry_(std::make_shared<StaticPropsRegistry>()),
|
|
61
|
+
updatesRegistryManager_(std::make_shared<UpdatesRegistryManager>(staticPropsRegistry_)),
|
|
62
|
+
viewStylesRepository_(std::make_shared<ViewStylesRepository>(staticPropsRegistry_, animatedPropsRegistry_)),
|
|
63
|
+
cssAnimationKeyframesRegistry_(std::make_shared<CSSKeyframesRegistry>(viewStylesRepository_)),
|
|
64
|
+
cssAnimationsRegistry_(std::make_shared<CSSAnimationsRegistry>()),
|
|
65
|
+
cssTransitionsRegistry_(std::make_shared<CSSTransitionsRegistry>(staticPropsRegistry_, getAnimationTimestamp_)),
|
|
66
|
+
synchronouslyUpdateUIPropsFunction_(platformDepMethodsHolder.synchronouslyUpdateUIPropsFunction),
|
|
67
|
+
#ifdef ANDROID
|
|
68
|
+
filterUnmountedTagsFunction_(platformDepMethodsHolder.filterUnmountedTagsFunction),
|
|
69
|
+
#endif // ANDROID
|
|
70
|
+
subscribeForKeyboardEventsFunction_(platformDepMethodsHolder.subscribeForKeyboardEvents),
|
|
71
|
+
unsubscribeFromKeyboardEventsFunction_(platformDepMethodsHolder.unsubscribeFromKeyboardEvents) {
|
|
72
|
+
auto lock = updatesRegistryManager_->lock();
|
|
73
|
+
// Add registries in order of their priority (from the lowest to the
|
|
74
|
+
// highest)
|
|
75
|
+
// CSS transitions should be overriden by animated style animations;
|
|
76
|
+
// animated style animations should be overriden by CSS animations
|
|
77
|
+
updatesRegistryManager_->addRegistry(cssTransitionsRegistry_);
|
|
78
|
+
updatesRegistryManager_->addRegistry(animatedPropsRegistry_);
|
|
79
|
+
updatesRegistryManager_->addRegistry(cssAnimationsRegistry_);
|
|
78
80
|
}
|
|
79
81
|
|
|
80
|
-
void ReanimatedModuleProxy::init(
|
|
81
|
-
|
|
82
|
-
auto onRenderCallback = [weakThis =
|
|
83
|
-
weak_from_this()](const double timestampMs) {
|
|
82
|
+
void ReanimatedModuleProxy::init(const PlatformDepMethodsHolder &platformDepMethodsHolder) {
|
|
83
|
+
auto onRenderCallback = [weakThis = weak_from_this()](const double timestampMs) {
|
|
84
84
|
auto strongThis = weakThis.lock();
|
|
85
85
|
if (!strongThis) {
|
|
86
86
|
return;
|
|
@@ -91,42 +91,17 @@ void ReanimatedModuleProxy::init(
|
|
|
91
91
|
};
|
|
92
92
|
onRenderCallback_ = std::move(onRenderCallback);
|
|
93
93
|
|
|
94
|
-
auto
|
|
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) {
|
|
94
|
+
auto updateProps = [weakThis = weak_from_this()](jsi::Runtime &rt, const jsi::Value &operations) {
|
|
108
95
|
auto strongThis = weakThis.lock();
|
|
109
96
|
if (!strongThis) {
|
|
110
97
|
return;
|
|
111
98
|
}
|
|
112
99
|
|
|
113
|
-
strongThis->
|
|
100
|
+
const auto timestamp = strongThis->getAnimationTimestamp_();
|
|
101
|
+
strongThis->animatedPropsRegistry_->update(rt, operations, timestamp);
|
|
114
102
|
};
|
|
115
103
|
|
|
116
|
-
auto
|
|
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 {
|
|
104
|
+
auto measure = [weakThis = weak_from_this()](jsi::Runtime &rt, const jsi::Value &shadowNodeValue) -> jsi::Value {
|
|
130
105
|
auto strongThis = weakThis.lock();
|
|
131
106
|
if (!strongThis) {
|
|
132
107
|
return jsi::Value::undefined();
|
|
@@ -144,52 +119,54 @@ void ReanimatedModuleProxy::init(
|
|
|
144
119
|
return;
|
|
145
120
|
}
|
|
146
121
|
|
|
147
|
-
strongThis->dispatchCommand(
|
|
148
|
-
rt, shadowNodeValue, commandNameValue, argsValue);
|
|
122
|
+
strongThis->dispatchCommand(rt, shadowNodeValue, commandNameValue, argsValue);
|
|
149
123
|
};
|
|
150
124
|
ProgressLayoutAnimationFunction progressLayoutAnimation =
|
|
151
|
-
[weakThis = weak_from_this()](
|
|
152
|
-
jsi::Runtime &rt, int tag, const jsi::Object &newStyle, bool) {
|
|
125
|
+
[weakThis = weak_from_this()](jsi::Runtime &rt, int tag, const jsi::Object &newStyle) {
|
|
153
126
|
auto strongThis = weakThis.lock();
|
|
154
127
|
if (!strongThis) {
|
|
155
128
|
return;
|
|
156
129
|
}
|
|
157
|
-
|
|
158
|
-
auto surfaceId =
|
|
159
|
-
strongThis->layoutAnimationsProxy_->progressLayoutAnimation(
|
|
160
|
-
tag, newStyle);
|
|
130
|
+
auto surfaceId = strongThis->layoutAnimationsProxy_->progressLayoutAnimation(tag, newStyle);
|
|
161
131
|
if (!surfaceId) {
|
|
162
132
|
return;
|
|
163
133
|
}
|
|
164
|
-
strongThis->
|
|
165
|
-
*surfaceId, [](const ShadowTree &shadowTree) {
|
|
166
|
-
shadowTree.notifyDelegatesOfUpdates();
|
|
167
|
-
});
|
|
134
|
+
strongThis->layoutAnimationFlushRequests_.insert(*surfaceId);
|
|
168
135
|
};
|
|
169
136
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
137
|
+
auto requestLayoutAnimationRender = [weakThis = weak_from_this()](double) {
|
|
138
|
+
auto strongThis = weakThis.lock();
|
|
139
|
+
if (!strongThis) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
strongThis->layoutAnimationRenderRequested_ = false;
|
|
143
|
+
};
|
|
176
144
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
145
|
+
EndLayoutAnimationFunction endLayoutAnimation = [weakThis = weak_from_this(), requestLayoutAnimationRender](
|
|
146
|
+
int tag, bool shouldRemove) {
|
|
147
|
+
auto strongThis = weakThis.lock();
|
|
148
|
+
if (!strongThis) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
182
151
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
152
|
+
auto surfaceId = strongThis->layoutAnimationsProxy_->endLayoutAnimation(tag, shouldRemove);
|
|
153
|
+
|
|
154
|
+
if (!strongThis->layoutAnimationRenderRequested_) {
|
|
155
|
+
strongThis->layoutAnimationRenderRequested_ = true;
|
|
156
|
+
// if an animation has duration 0, performOperations would not get
|
|
157
|
+
// called for it so we call requestRender to have it called in the
|
|
158
|
+
// next frame
|
|
159
|
+
strongThis->requestRender_(requestLayoutAnimationRender);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (!surfaceId) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
strongThis->layoutAnimationFlushRequests_.insert(*surfaceId);
|
|
166
|
+
};
|
|
188
167
|
|
|
189
168
|
auto obtainProp = [weakThis = weak_from_this()](
|
|
190
|
-
jsi::Runtime &rt,
|
|
191
|
-
const jsi::Value &shadowNodeWrapper,
|
|
192
|
-
const jsi::Value &propName) {
|
|
169
|
+
jsi::Runtime &rt, const jsi::Value &shadowNodeWrapper, const jsi::Value &propName) {
|
|
193
170
|
auto strongThis = weakThis.lock();
|
|
194
171
|
if (!strongThis) {
|
|
195
172
|
return jsi::String::createFromUtf8(rt, "");
|
|
@@ -197,33 +174,18 @@ void ReanimatedModuleProxy::init(
|
|
|
197
174
|
|
|
198
175
|
return strongThis->obtainProp(rt, shadowNodeWrapper, propName);
|
|
199
176
|
};
|
|
200
|
-
#endif
|
|
201
177
|
|
|
202
|
-
jsi::Runtime &uiRuntime =
|
|
178
|
+
jsi::Runtime &uiRuntime = workletsModuleProxy_->getUIWorkletRuntime()->getJSIRuntime();
|
|
203
179
|
UIRuntimeDecorator::decorate(
|
|
204
180
|
uiRuntime,
|
|
205
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
206
181
|
obtainProp,
|
|
207
182
|
updateProps,
|
|
208
183
|
measure,
|
|
209
184
|
dispatchCommand,
|
|
210
|
-
#else
|
|
211
|
-
platformDepMethodsHolder.scrollToFunction,
|
|
212
|
-
platformDepMethodsHolder.obtainPropFunction,
|
|
213
|
-
platformDepMethodsHolder.updatePropsFunction,
|
|
214
|
-
platformDepMethodsHolder.measureFunction,
|
|
215
|
-
platformDepMethodsHolder.dispatchCommandFunction,
|
|
216
|
-
#endif
|
|
217
|
-
requestAnimationFrame,
|
|
218
185
|
platformDepMethodsHolder.getAnimationTimestamp,
|
|
219
186
|
platformDepMethodsHolder.setGestureStateFunction,
|
|
220
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
221
187
|
progressLayoutAnimation,
|
|
222
188
|
endLayoutAnimation,
|
|
223
|
-
#else
|
|
224
|
-
platformDepMethodsHolder.progressLayoutAnimation,
|
|
225
|
-
platformDepMethodsHolder.endLayoutAnimation,
|
|
226
|
-
#endif
|
|
227
189
|
platformDepMethodsHolder.maybeFlushUIUpdatesQueueFunction);
|
|
228
190
|
}
|
|
229
191
|
|
|
@@ -231,66 +193,6 @@ ReanimatedModuleProxy::~ReanimatedModuleProxy() {
|
|
|
231
193
|
// event handler registry and frame callbacks store some JSI values from UI
|
|
232
194
|
// runtime, so they have to go away before we tear down the runtime
|
|
233
195
|
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
196
|
}
|
|
295
197
|
|
|
296
198
|
jsi::Value ReanimatedModuleProxy::registerEventHandler(
|
|
@@ -302,97 +204,41 @@ jsi::Value ReanimatedModuleProxy::registerEventHandler(
|
|
|
302
204
|
|
|
303
205
|
uint64_t newRegistrationId = NEXT_EVENT_HANDLER_ID++;
|
|
304
206
|
auto eventNameStr = eventName.asString(rt).utf8(rt);
|
|
305
|
-
auto
|
|
306
|
-
rt, worklet, "[Reanimated] Event handler must be a worklet.");
|
|
207
|
+
auto handlerSerializable = extractSerializableOrThrow<SerializableWorklet>(
|
|
208
|
+
rt, worklet, "[Reanimated] Event handler must be a serializable worklet.");
|
|
307
209
|
int emitterReactTagInt = emitterReactTag.asNumber();
|
|
308
210
|
|
|
309
|
-
workletsModuleProxy_->getUIScheduler()->scheduleOnUI(
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
emitterReactTagInt,
|
|
319
|
-
handlerShareable);
|
|
320
|
-
strongThis->eventHandlerRegistry_->registerEventHandler(
|
|
321
|
-
std::move(handler));
|
|
322
|
-
});
|
|
211
|
+
workletsModuleProxy_->getUIScheduler()->scheduleOnUI([=, weakThis = weak_from_this()]() {
|
|
212
|
+
auto strongThis = weakThis.lock();
|
|
213
|
+
if (!strongThis) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
auto handler =
|
|
217
|
+
std::make_shared<WorkletEventHandler>(newRegistrationId, eventNameStr, emitterReactTagInt, handlerSerializable);
|
|
218
|
+
strongThis->eventHandlerRegistry_->registerEventHandler(handler);
|
|
219
|
+
});
|
|
323
220
|
|
|
324
221
|
return jsi::Value(static_cast<double>(newRegistrationId));
|
|
325
222
|
}
|
|
326
223
|
|
|
327
|
-
void ReanimatedModuleProxy::unregisterEventHandler(
|
|
328
|
-
jsi::Runtime &,
|
|
329
|
-
const jsi::Value ®istrationId) {
|
|
224
|
+
void ReanimatedModuleProxy::unregisterEventHandler(jsi::Runtime &, const jsi::Value ®istrationId) {
|
|
330
225
|
uint64_t id = registrationId.asNumber();
|
|
331
|
-
workletsModuleProxy_->getUIScheduler()->scheduleOnUI(
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
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;
|
|
226
|
+
workletsModuleProxy_->getUIScheduler()->scheduleOnUI([=, weakThis = weak_from_this()]() {
|
|
227
|
+
auto strongThis = weakThis.lock();
|
|
228
|
+
if (!strongThis) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
strongThis->eventHandlerRegistry_->unregisterEventHandler(id);
|
|
232
|
+
});
|
|
353
233
|
}
|
|
354
234
|
|
|
355
235
|
std::string ReanimatedModuleProxy::obtainPropFromShadowNode(
|
|
356
236
|
jsi::Runtime &rt,
|
|
357
237
|
const std::string &propName,
|
|
358
|
-
const
|
|
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
|
-
}
|
|
238
|
+
const std::shared_ptr<const ShadowNode> &shadowNode) {
|
|
239
|
+
auto newestCloneOfShadowNode = uiManager_->getNewestCloneOfShadowNode(*shadowNode);
|
|
392
240
|
|
|
393
|
-
|
|
394
|
-
"Getting property `" + propName +
|
|
395
|
-
"` with function `getViewProp` is not supported"));
|
|
241
|
+
return PropValueProcessor::processPropValue(propName, newestCloneOfShadowNode, rt);
|
|
396
242
|
}
|
|
397
243
|
|
|
398
244
|
jsi::Value ReanimatedModuleProxy::getViewProp(
|
|
@@ -401,97 +247,31 @@ jsi::Value ReanimatedModuleProxy::getViewProp(
|
|
|
401
247
|
const jsi::Value &propName,
|
|
402
248
|
const jsi::Value &callback) {
|
|
403
249
|
const auto propNameStr = propName.asString(rnRuntime).utf8(rnRuntime);
|
|
404
|
-
const auto funPtr = std::make_shared<jsi::Function>(
|
|
405
|
-
callback.getObject(rnRuntime).asFunction(rnRuntime));
|
|
250
|
+
const auto funPtr = std::make_shared<jsi::Function>(callback.getObject(rnRuntime).asFunction(rnRuntime));
|
|
406
251
|
const auto shadowNode = shadowNodeFromValue(rnRuntime, shadowNodeWrapper);
|
|
407
|
-
workletsModuleProxy_->getUIScheduler()->scheduleOnUI(
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
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()]
|
|
252
|
+
workletsModuleProxy_->getUIScheduler()->scheduleOnUI([=, weakThis = weak_from_this()]() {
|
|
253
|
+
auto strongThis = weakThis.lock();
|
|
254
|
+
if (!strongThis) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
jsi::Runtime &uiRuntime = strongThis->workletsModuleProxy_->getUIWorkletRuntime()->getJSIRuntime();
|
|
258
|
+
const auto resultStr = strongThis->obtainPropFromShadowNode(uiRuntime, propNameStr, shadowNode);
|
|
443
259
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
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
|
-
});
|
|
260
|
+
strongThis->workletsModuleProxy_->getJSScheduler()->scheduleOnJS([=](jsi::Runtime &rnRuntime) {
|
|
261
|
+
const auto resultValue = jsi::String::createFromUtf8(rnRuntime, resultStr);
|
|
262
|
+
funPtr->call(rnRuntime, resultValue);
|
|
263
|
+
});
|
|
264
|
+
});
|
|
464
265
|
return jsi::Value::undefined();
|
|
465
266
|
}
|
|
466
267
|
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
jsi::Value ReanimatedModuleProxy::enableLayoutAnimations(
|
|
470
|
-
jsi::Runtime &,
|
|
471
|
-
const jsi::Value &config) {
|
|
472
|
-
FeaturesConfig::setLayoutAnimationEnabled(config.getBool());
|
|
473
|
-
return jsi::Value::undefined();
|
|
268
|
+
jsi::Value ReanimatedModuleProxy::getStaticFeatureFlag(jsi::Runtime &rt, const jsi::Value &name) {
|
|
269
|
+
return reanimated::StaticFeatureFlags::getFlag(name.asString(rt).utf8(rt));
|
|
474
270
|
}
|
|
475
271
|
|
|
476
|
-
jsi::Value
|
|
477
|
-
|
|
478
|
-
|
|
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
|
-
|
|
272
|
+
jsi::Value
|
|
273
|
+
ReanimatedModuleProxy::setDynamicFeatureFlag(jsi::Runtime &rt, const jsi::Value &name, const jsi::Value &value) {
|
|
274
|
+
reanimated::DynamicFeatureFlags::setFlag(name.asString(rt).utf8(rt), value.asBool());
|
|
495
275
|
return jsi::Value::undefined();
|
|
496
276
|
}
|
|
497
277
|
|
|
@@ -505,26 +285,17 @@ jsi::Value ReanimatedModuleProxy::configureLayoutAnimationBatch(
|
|
|
505
285
|
auto item = array.getValueAtIndex(rt, i).asObject(rt);
|
|
506
286
|
auto &batchItem = batch[i];
|
|
507
287
|
batchItem.tag = item.getProperty(rt, "viewTag").asNumber();
|
|
508
|
-
batchItem.type = static_cast<LayoutAnimationType>(
|
|
509
|
-
item.getProperty(rt, "type").asNumber());
|
|
288
|
+
batchItem.type = static_cast<LayoutAnimationType>(item.getProperty(rt, "type").asNumber());
|
|
510
289
|
auto config = item.getProperty(rt, "config");
|
|
511
290
|
if (config.isUndefined()) {
|
|
512
291
|
batchItem.config = nullptr;
|
|
513
292
|
} else {
|
|
514
|
-
batchItem.config =
|
|
515
|
-
rt,
|
|
516
|
-
config,
|
|
517
|
-
"[Reanimated] Layout animation config must be an object.");
|
|
293
|
+
batchItem.config = extractSerializableOrThrow<SerializableObject>(
|
|
294
|
+
rt, config, "[Reanimated] Layout animation config must be an object.");
|
|
518
295
|
}
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
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);
|
|
296
|
+
auto sharedTag = item.getProperty(rt, "sharedTransitionTag");
|
|
297
|
+
if (!sharedTag.isUndefined()) {
|
|
298
|
+
batchItem.sharedTransitionTag = sharedTag.asString(rt).utf8(rt);
|
|
528
299
|
}
|
|
529
300
|
}
|
|
530
301
|
layoutAnimationsManager_->configureAnimationBatch(batch);
|
|
@@ -535,22 +306,11 @@ void ReanimatedModuleProxy::setShouldAnimateExiting(
|
|
|
535
306
|
jsi::Runtime &rt,
|
|
536
307
|
const jsi::Value &viewTag,
|
|
537
308
|
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);
|
|
309
|
+
layoutAnimationsManager_->setShouldAnimateExiting(viewTag.asNumber(), shouldAnimate.getBool());
|
|
547
310
|
}
|
|
548
311
|
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
const jsi::Value &callback) {
|
|
552
|
-
frameCallbacks_.push_back(std::make_shared<jsi::Value>(rt, callback));
|
|
553
|
-
maybeRequestRender();
|
|
312
|
+
bool ReanimatedModuleProxy::isAnyHandlerWaitingForEvent(const std::string &eventName, const int emitterReactTag) {
|
|
313
|
+
return eventHandlerRegistry_->isAnyHandlerWaitingForEvent(eventName, emitterReactTag);
|
|
554
314
|
}
|
|
555
315
|
|
|
556
316
|
void ReanimatedModuleProxy::maybeRequestRender() {
|
|
@@ -561,13 +321,8 @@ void ReanimatedModuleProxy::maybeRequestRender() {
|
|
|
561
321
|
}
|
|
562
322
|
|
|
563
323
|
void ReanimatedModuleProxy::onRender(double timestampMs) {
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
jsi::Runtime &uiRuntime = uiWorkletRuntime_->getJSIRuntime();
|
|
567
|
-
jsi::Value timestamp{timestampMs};
|
|
568
|
-
for (const auto &callback : callbacks) {
|
|
569
|
-
runOnRuntimeGuarded(uiRuntime, *callback, timestamp);
|
|
570
|
-
}
|
|
324
|
+
ReanimatedSystraceSection s("ReanimatedModuleProxy::onRender");
|
|
325
|
+
// NOOP
|
|
571
326
|
}
|
|
572
327
|
|
|
573
328
|
jsi::Value ReanimatedModuleProxy::registerSensor(
|
|
@@ -577,17 +332,10 @@ jsi::Value ReanimatedModuleProxy::registerSensor(
|
|
|
577
332
|
const jsi::Value &iosReferenceFrame,
|
|
578
333
|
const jsi::Value &sensorDataHandler) {
|
|
579
334
|
return animatedSensorModule_.registerSensor(
|
|
580
|
-
rt,
|
|
581
|
-
uiWorkletRuntime_,
|
|
582
|
-
sensorType,
|
|
583
|
-
interval,
|
|
584
|
-
iosReferenceFrame,
|
|
585
|
-
sensorDataHandler);
|
|
335
|
+
rt, workletsModuleProxy_->getUIWorkletRuntime(), sensorType, interval, iosReferenceFrame, sensorDataHandler);
|
|
586
336
|
}
|
|
587
337
|
|
|
588
|
-
void ReanimatedModuleProxy::unregisterSensor(
|
|
589
|
-
jsi::Runtime &,
|
|
590
|
-
const jsi::Value &sensorId) {
|
|
338
|
+
void ReanimatedModuleProxy::unregisterSensor(jsi::Runtime &, const jsi::Value &sensorId) {
|
|
591
339
|
animatedSensorModule_.unregisterSensor(sensorId);
|
|
592
340
|
}
|
|
593
341
|
|
|
@@ -595,62 +343,155 @@ void ReanimatedModuleProxy::cleanupSensors() {
|
|
|
595
343
|
animatedSensorModule_.unregisterAllSensors();
|
|
596
344
|
}
|
|
597
345
|
|
|
598
|
-
|
|
346
|
+
void ReanimatedModuleProxy::setViewStyle(jsi::Runtime &rt, const jsi::Value &viewTag, const jsi::Value &viewStyle) {
|
|
347
|
+
const auto tag = viewTag.asNumber();
|
|
348
|
+
staticPropsRegistry_->set(rt, tag, viewStyle);
|
|
349
|
+
if (staticPropsRegistry_->hasObservers(tag)) {
|
|
350
|
+
maybeRunCSSLoop();
|
|
351
|
+
}
|
|
352
|
+
}
|
|
599
353
|
|
|
600
|
-
void ReanimatedModuleProxy::markNodeAsRemovable(
|
|
601
|
-
|
|
602
|
-
const jsi::Value &shadowNodeWrapper) {
|
|
354
|
+
void ReanimatedModuleProxy::markNodeAsRemovable(jsi::Runtime &rt, const jsi::Value &shadowNodeWrapper) {
|
|
355
|
+
auto lock = updatesRegistryManager_->lock();
|
|
603
356
|
auto shadowNode = shadowNodeFromValue(rt, shadowNodeWrapper);
|
|
604
|
-
|
|
357
|
+
updatesRegistryManager_->markNodeAsRemovable(shadowNode);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
void ReanimatedModuleProxy::unmarkNodeAsRemovable(jsi::Runtime &rt, const jsi::Value &viewTag) {
|
|
361
|
+
auto lock = updatesRegistryManager_->lock();
|
|
362
|
+
updatesRegistryManager_->unmarkNodeAsRemovable(viewTag.asNumber());
|
|
605
363
|
}
|
|
606
364
|
|
|
607
|
-
void ReanimatedModuleProxy::
|
|
365
|
+
void ReanimatedModuleProxy::registerCSSKeyframes(
|
|
608
366
|
jsi::Runtime &rt,
|
|
609
|
-
const jsi::Value &
|
|
610
|
-
|
|
367
|
+
const jsi::Value &animationName,
|
|
368
|
+
const jsi::Value &viewName,
|
|
369
|
+
const jsi::Value &keyframesConfig) {
|
|
370
|
+
// Convert react view name to Fabric component name
|
|
371
|
+
const auto componentName = componentNameByReactViewName(viewName.asString(rt).utf8(rt));
|
|
372
|
+
cssAnimationKeyframesRegistry_->set(
|
|
373
|
+
animationName.asString(rt).utf8(rt),
|
|
374
|
+
componentName,
|
|
375
|
+
parseCSSAnimationKeyframesConfig(rt, keyframesConfig, componentName, viewStylesRepository_));
|
|
611
376
|
}
|
|
612
377
|
|
|
613
|
-
|
|
378
|
+
void ReanimatedModuleProxy::unregisterCSSKeyframes(
|
|
614
379
|
jsi::Runtime &rt,
|
|
615
|
-
const jsi::Value &
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
380
|
+
const jsi::Value &animationName,
|
|
381
|
+
const jsi::Value &viewName) {
|
|
382
|
+
cssAnimationKeyframesRegistry_->remove(
|
|
383
|
+
animationName.asString(rt).utf8(rt), componentNameByReactViewName(viewName.asString(rt).utf8(rt)));
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
void ReanimatedModuleProxy::applyCSSAnimations(
|
|
387
|
+
jsi::Runtime &rt,
|
|
388
|
+
const jsi::Value &shadowNodeWrapper,
|
|
389
|
+
const jsi::Value &animationUpdates) {
|
|
390
|
+
auto shadowNode = shadowNodeFromValue(rt, shadowNodeWrapper);
|
|
391
|
+
const auto timestamp = getCssTimestamp();
|
|
392
|
+
const auto updates = parseCSSAnimationUpdates(rt, animationUpdates);
|
|
393
|
+
|
|
394
|
+
CSSAnimationsMap newAnimations;
|
|
395
|
+
|
|
396
|
+
if (!updates.newAnimationSettings.empty()) {
|
|
397
|
+
// animationNames always exists when newAnimationSettings is not empty
|
|
398
|
+
const auto animationNames = updates.animationNames.value();
|
|
399
|
+
const auto animationNamesCount = animationNames.size();
|
|
400
|
+
|
|
401
|
+
for (const auto &[index, settings] : updates.newAnimationSettings) {
|
|
402
|
+
if (index >= animationNamesCount) {
|
|
403
|
+
throw std::invalid_argument("[Reanimated] index is out of bounds of animationNames");
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
const auto &animationName = animationNames[index];
|
|
407
|
+
const auto &keyframesConfig = cssAnimationKeyframesRegistry_->get(animationName, shadowNode->getComponentName());
|
|
408
|
+
|
|
409
|
+
newAnimations.emplace(
|
|
410
|
+
index, std::make_shared<CSSAnimation>(rt, shadowNode, animationName, keyframesConfig, settings, timestamp));
|
|
628
411
|
}
|
|
629
412
|
}
|
|
630
|
-
|
|
631
|
-
|
|
413
|
+
|
|
414
|
+
{
|
|
415
|
+
auto lock = cssAnimationsRegistry_->lock();
|
|
416
|
+
cssAnimationsRegistry_->apply(
|
|
417
|
+
rt, shadowNode, updates.animationNames, newAnimations, updates.settingsUpdates, timestamp);
|
|
632
418
|
}
|
|
633
|
-
|
|
419
|
+
|
|
420
|
+
maybeRunCSSLoop();
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
void ReanimatedModuleProxy::unregisterCSSAnimations(const jsi::Value &viewTag) {
|
|
424
|
+
auto lock = cssAnimationsRegistry_->lock();
|
|
425
|
+
cssAnimationsRegistry_->remove(viewTag.asNumber());
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
void ReanimatedModuleProxy::registerCSSTransition(
|
|
429
|
+
jsi::Runtime &rt,
|
|
430
|
+
const jsi::Value &shadowNodeWrapper,
|
|
431
|
+
const jsi::Value &transitionConfig) {
|
|
432
|
+
auto shadowNode = shadowNodeFromValue(rt, shadowNodeWrapper);
|
|
433
|
+
|
|
434
|
+
auto transition = std::make_shared<CSSTransition>(
|
|
435
|
+
std::move(shadowNode), parseCSSTransitionConfig(rt, transitionConfig), viewStylesRepository_);
|
|
436
|
+
|
|
437
|
+
{
|
|
438
|
+
auto lock = cssTransitionsRegistry_->lock();
|
|
439
|
+
cssTransitionsRegistry_->add(transition);
|
|
440
|
+
}
|
|
441
|
+
maybeRunCSSLoop();
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
void ReanimatedModuleProxy::updateCSSTransition(
|
|
445
|
+
jsi::Runtime &rt,
|
|
446
|
+
const jsi::Value &viewTag,
|
|
447
|
+
const jsi::Value &configUpdates) {
|
|
448
|
+
auto lock = cssTransitionsRegistry_->lock();
|
|
449
|
+
cssTransitionsRegistry_->updateSettings(viewTag.asNumber(), parsePartialCSSTransitionConfig(rt, configUpdates));
|
|
450
|
+
maybeRunCSSLoop();
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
void ReanimatedModuleProxy::unregisterCSSTransition(jsi::Runtime &rt, const jsi::Value &viewTag) {
|
|
454
|
+
auto lock = cssTransitionsRegistry_->lock();
|
|
455
|
+
cssTransitionsRegistry_->remove(viewTag.asNumber());
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
jsi::Value ReanimatedModuleProxy::getSettledUpdates(jsi::Runtime &rt) {
|
|
459
|
+
react_native_assert(
|
|
460
|
+
StaticFeatureFlags::getFlag("FORCE_REACT_RENDER_FOR_SETTLED_ANIMATIONS") &&
|
|
461
|
+
"getSettledUpdates requires FORCE_REACT_RENDER_FOR_SETTLED_ANIMATIONS static feature flag to be enabled");
|
|
462
|
+
|
|
463
|
+
// TODO(future): use unified timestamp
|
|
464
|
+
const auto currentTimestamp = getAnimationTimestamp_();
|
|
465
|
+
|
|
466
|
+
const auto lock = animatedPropsRegistry_->lock();
|
|
467
|
+
|
|
468
|
+
// TODO: fix bug when threshold difference is smaller than 1 second
|
|
469
|
+
// TODO(future): flush updates from CSS animations and CSS transitions registries
|
|
470
|
+
animatedPropsRegistry_->removeUpdatesOlderThanTimestamp(currentTimestamp - 2000); // 2 seconds
|
|
471
|
+
|
|
472
|
+
// TODO(future): find a better way to obtain timestamp for removing updates
|
|
473
|
+
// TODO(future): move removing old updates to separate method
|
|
474
|
+
return animatedPropsRegistry_->getUpdatesOlderThanTimestamp(rt, currentTimestamp - 1000); // 1 second
|
|
634
475
|
}
|
|
635
|
-
#endif // RCT_NEW_ARCH_ENABLED
|
|
636
476
|
|
|
637
477
|
bool ReanimatedModuleProxy::handleEvent(
|
|
638
478
|
const std::string &eventName,
|
|
639
479
|
const int emitterReactTag,
|
|
640
480
|
const jsi::Value &payload,
|
|
641
481
|
double currentTime) {
|
|
482
|
+
ReanimatedSystraceSection s("ReanimatedModuleProxy::handleEvent");
|
|
483
|
+
|
|
642
484
|
eventHandlerRegistry_->processEvent(
|
|
643
|
-
|
|
485
|
+
workletsModuleProxy_->getUIWorkletRuntime(), currentTime, eventName, emitterReactTag, payload);
|
|
644
486
|
|
|
645
487
|
// TODO: return true if Reanimated successfully handled the event
|
|
646
488
|
// to avoid sending it to JavaScript
|
|
647
489
|
return false;
|
|
648
490
|
}
|
|
649
491
|
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
double currentTime) {
|
|
492
|
+
bool ReanimatedModuleProxy::handleRawEvent(const RawEvent &rawEvent, double currentTime) {
|
|
493
|
+
ReanimatedSystraceSection s("ReanimatedModuleProxy::handleRawEvent");
|
|
494
|
+
|
|
654
495
|
const EventTarget *eventTarget = rawEvent.eventTarget.get();
|
|
655
496
|
if (eventTarget == nullptr) {
|
|
656
497
|
// after app reload scrollView is unmounted and its content offset is set
|
|
@@ -666,133 +507,675 @@ bool ReanimatedModuleProxy::handleRawEvent(
|
|
|
666
507
|
if (eventType.rfind("top", 0) == 0) {
|
|
667
508
|
eventType = "on" + eventType.substr(3);
|
|
668
509
|
}
|
|
669
|
-
|
|
510
|
+
|
|
511
|
+
if constexpr (StaticFeatureFlags::getFlag("ENABLE_SHARED_ELEMENT_TRANSITIONS")) {
|
|
512
|
+
if (eventType == "onTransitionProgress") {
|
|
513
|
+
jsi::Runtime &rt = workletsModuleProxy_->getUIWorkletRuntime()->getJSIRuntime();
|
|
514
|
+
const auto &eventPayload = rawEvent.eventPayload;
|
|
515
|
+
jsi::Object payload = eventPayload->asJSIValue(rt).asObject(rt);
|
|
516
|
+
auto progress = payload.getProperty(rt, "progress").asNumber();
|
|
517
|
+
auto closing = static_cast<bool>(payload.getProperty(rt, "closing").asNumber());
|
|
518
|
+
auto goingForward = static_cast<bool>(payload.getProperty(rt, "goingForward").asNumber());
|
|
519
|
+
|
|
520
|
+
if (!layoutAnimationsProxy_) {
|
|
521
|
+
return false;
|
|
522
|
+
}
|
|
523
|
+
auto surfaceId = layoutAnimationsProxy_->onTransitionProgress(tag, progress, closing, goingForward);
|
|
524
|
+
if (!surfaceId) {
|
|
525
|
+
return false;
|
|
526
|
+
}
|
|
527
|
+
// TODO (future): enumerate -> visit
|
|
528
|
+
uiManager_->getShadowTreeRegistry().enumerate(
|
|
529
|
+
[](const ShadowTree &shadowTree, bool &) { shadowTree.notifyDelegatesOfUpdates(); });
|
|
530
|
+
return false;
|
|
531
|
+
} else if (eventType == "onGestureCancel") {
|
|
532
|
+
if (!layoutAnimationsProxy_) {
|
|
533
|
+
return false;
|
|
534
|
+
}
|
|
535
|
+
auto surfaceId = layoutAnimationsProxy_->onGestureCancel();
|
|
536
|
+
if (!surfaceId) {
|
|
537
|
+
return false;
|
|
538
|
+
}
|
|
539
|
+
// TODO (future): enumerate -> visit
|
|
540
|
+
uiManager_->getShadowTreeRegistry().enumerate(
|
|
541
|
+
[](const ShadowTree &shadowTree, bool &) { shadowTree.notifyDelegatesOfUpdates(); });
|
|
542
|
+
return false;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
670
545
|
|
|
671
546
|
if (!isAnyHandlerWaitingForEvent(eventType, tag)) {
|
|
672
547
|
return false;
|
|
673
548
|
}
|
|
674
549
|
|
|
550
|
+
jsi::Runtime &rt = workletsModuleProxy_->getUIWorkletRuntime()->getJSIRuntime();
|
|
675
551
|
const auto &eventPayload = rawEvent.eventPayload;
|
|
676
552
|
jsi::Value payload = eventPayload->asJSIValue(rt);
|
|
677
553
|
|
|
678
|
-
auto res = handleEvent(eventType, tag,
|
|
554
|
+
auto res = handleEvent(eventType, tag, payload, currentTime);
|
|
679
555
|
// TODO: we should call performOperations conditionally if event is handled
|
|
680
556
|
// (res == true), but for now handleEvent always returns false. Thankfully,
|
|
681
557
|
// performOperations does not trigger a lot of code if there is nothing to
|
|
682
558
|
// be done so this is fine for now.
|
|
683
|
-
performOperations();
|
|
559
|
+
performOperations(true);
|
|
684
560
|
return res;
|
|
685
561
|
}
|
|
686
562
|
|
|
687
|
-
void ReanimatedModuleProxy::
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
563
|
+
void ReanimatedModuleProxy::cssLoopCallback(const double /*timestampMs*/) {
|
|
564
|
+
shouldUpdateCssAnimations_ = true;
|
|
565
|
+
if (cssAnimationsRegistry_->hasUpdates() || cssTransitionsRegistry_->hasUpdates()
|
|
566
|
+
#ifdef ANDROID
|
|
567
|
+
|| updatesRegistryManager_->hasPropsToRevert()
|
|
568
|
+
#endif // ANDROID
|
|
569
|
+
) {
|
|
570
|
+
requestRender_([weakThis = weak_from_this()](const double newTimestampMs) {
|
|
571
|
+
if (auto strongThis = weakThis.lock()) {
|
|
572
|
+
strongThis->cssLoopCallback(newTimestampMs);
|
|
573
|
+
}
|
|
574
|
+
});
|
|
575
|
+
} else {
|
|
576
|
+
cssLoopRunning_ = false;
|
|
699
577
|
}
|
|
700
578
|
}
|
|
701
579
|
|
|
702
|
-
void ReanimatedModuleProxy::
|
|
703
|
-
if (
|
|
704
|
-
// nothing to do
|
|
580
|
+
void ReanimatedModuleProxy::maybeRunCSSLoop() {
|
|
581
|
+
if (cssLoopRunning_) {
|
|
705
582
|
return;
|
|
706
583
|
}
|
|
707
584
|
|
|
708
|
-
|
|
585
|
+
cssLoopRunning_ = true;
|
|
586
|
+
|
|
587
|
+
workletsModuleProxy_->getUIScheduler()->scheduleOnUI([weakThis = weak_from_this()]() {
|
|
588
|
+
auto strongThis = weakThis.lock();
|
|
589
|
+
if (!strongThis) {
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
strongThis->requestRender_([weakThis](const double timestampMs) {
|
|
593
|
+
if (auto strongThis = weakThis.lock()) {
|
|
594
|
+
strongThis->cssLoopCallback(timestampMs);
|
|
595
|
+
}
|
|
596
|
+
});
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
double ReanimatedModuleProxy::getCssTimestamp() {
|
|
601
|
+
if (cssLoopRunning_) {
|
|
602
|
+
return currentCssTimestamp_;
|
|
603
|
+
}
|
|
604
|
+
currentCssTimestamp_ = getAnimationTimestamp_();
|
|
605
|
+
return currentCssTimestamp_;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
void ReanimatedModuleProxy::performOperations(const bool isTriggeredByEvent) {
|
|
609
|
+
ReanimatedSystraceSection s("ReanimatedModuleProxy::performOperations");
|
|
709
610
|
|
|
710
|
-
|
|
711
|
-
|
|
611
|
+
if (!isTriggeredByEvent) {
|
|
612
|
+
auto flushRequestsCopy = std::move(layoutAnimationFlushRequests_);
|
|
613
|
+
for (const auto surfaceId : flushRequestsCopy) {
|
|
614
|
+
uiManager_->getShadowTreeRegistry().visit(
|
|
615
|
+
surfaceId, [](const ShadowTree &shadowTree) { shadowTree.notifyDelegatesOfUpdates(); });
|
|
616
|
+
}
|
|
617
|
+
}
|
|
712
618
|
|
|
713
|
-
jsi::Runtime &rt =
|
|
619
|
+
jsi::Runtime &rt = workletsModuleProxy_->getUIWorkletRuntime()->getJSIRuntime();
|
|
714
620
|
|
|
621
|
+
UpdatesBatch updatesBatch;
|
|
715
622
|
{
|
|
716
|
-
|
|
623
|
+
ReanimatedSystraceSection s2("ReanimatedModuleProxy::flushUpdates");
|
|
624
|
+
|
|
625
|
+
auto lock = updatesRegistryManager_->lock();
|
|
626
|
+
|
|
627
|
+
if (shouldUpdateCssAnimations_) {
|
|
628
|
+
currentCssTimestamp_ = getAnimationTimestamp_();
|
|
629
|
+
auto lock = cssTransitionsRegistry_->lock();
|
|
630
|
+
// Update CSS transitions and flush updates
|
|
631
|
+
cssTransitionsRegistry_->update(currentCssTimestamp_);
|
|
632
|
+
cssTransitionsRegistry_->flushUpdates(updatesBatch);
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
{
|
|
636
|
+
auto lock = animatedPropsRegistry_->lock();
|
|
637
|
+
// Flush all animated props updates
|
|
638
|
+
animatedPropsRegistry_->flushUpdates(updatesBatch);
|
|
639
|
+
}
|
|
717
640
|
|
|
718
|
-
if (
|
|
719
|
-
|
|
720
|
-
|
|
641
|
+
if (shouldUpdateCssAnimations_) {
|
|
642
|
+
auto lock = cssAnimationsRegistry_->lock();
|
|
643
|
+
// Update CSS animations and flush updates
|
|
644
|
+
cssAnimationsRegistry_->update(currentCssTimestamp_);
|
|
645
|
+
cssAnimationsRegistry_->flushUpdates(updatesBatch);
|
|
721
646
|
}
|
|
722
647
|
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
648
|
+
shouldUpdateCssAnimations_ = false;
|
|
649
|
+
|
|
650
|
+
#ifdef ANDROID
|
|
651
|
+
if constexpr (
|
|
652
|
+
StaticFeatureFlags::getFlag("ANDROID_SYNCHRONOUSLY_UPDATE_UI_PROPS") &&
|
|
653
|
+
!StaticFeatureFlags::getFlag("ENABLE_SHARED_ELEMENT_TRANSITIONS")) {
|
|
654
|
+
static const std::unordered_set<std::string> synchronousProps = {
|
|
655
|
+
"opacity",
|
|
656
|
+
"elevation",
|
|
657
|
+
"zIndex",
|
|
658
|
+
// "shadowOpacity", // not supported on Android
|
|
659
|
+
// "shadowRadius", // not supported on Android
|
|
660
|
+
"backgroundColor",
|
|
661
|
+
// "color", // TODO: fix animating color of Animated.Text
|
|
662
|
+
"tintColor",
|
|
663
|
+
"borderRadius",
|
|
664
|
+
"borderTopLeftRadius",
|
|
665
|
+
"borderTopRightRadius",
|
|
666
|
+
"borderTopStartRadius",
|
|
667
|
+
"borderTopEndRadius",
|
|
668
|
+
"borderBottomLeftRadius",
|
|
669
|
+
"borderBottomRightRadius",
|
|
670
|
+
"borderBottomStartRadius",
|
|
671
|
+
"borderBottomEndRadius",
|
|
672
|
+
"borderStartStartRadius",
|
|
673
|
+
"borderStartEndRadius",
|
|
674
|
+
"borderEndStartRadius",
|
|
675
|
+
"borderEndEndRadius",
|
|
676
|
+
"borderColor",
|
|
677
|
+
"borderTopColor",
|
|
678
|
+
"borderBottomColor",
|
|
679
|
+
"borderLeftColor",
|
|
680
|
+
"borderRightColor",
|
|
681
|
+
"borderStartColor",
|
|
682
|
+
"borderEndColor",
|
|
683
|
+
"transform",
|
|
684
|
+
};
|
|
685
|
+
|
|
686
|
+
// NOTE: Keep in sync with NativeProxy.java
|
|
687
|
+
static constexpr auto CMD_START_OF_VIEW = 1;
|
|
688
|
+
static constexpr auto CMD_START_OF_TRANSFORM = 2;
|
|
689
|
+
static constexpr auto CMD_END_OF_TRANSFORM = 3;
|
|
690
|
+
static constexpr auto CMD_END_OF_VIEW = 4;
|
|
691
|
+
|
|
692
|
+
static constexpr auto CMD_OPACITY = 10;
|
|
693
|
+
static constexpr auto CMD_ELEVATION = 11;
|
|
694
|
+
static constexpr auto CMD_Z_INDEX = 12;
|
|
695
|
+
static constexpr auto CMD_SHADOW_OPACITY = 13;
|
|
696
|
+
static constexpr auto CMD_SHADOW_RADIUS = 14;
|
|
697
|
+
static constexpr auto CMD_BACKGROUND_COLOR = 15;
|
|
698
|
+
static constexpr auto CMD_COLOR = 16;
|
|
699
|
+
static constexpr auto CMD_TINT_COLOR = 17;
|
|
700
|
+
|
|
701
|
+
static constexpr auto CMD_BORDER_RADIUS = 20;
|
|
702
|
+
static constexpr auto CMD_BORDER_TOP_LEFT_RADIUS = 21;
|
|
703
|
+
static constexpr auto CMD_BORDER_TOP_RIGHT_RADIUS = 22;
|
|
704
|
+
static constexpr auto CMD_BORDER_TOP_START_RADIUS = 23;
|
|
705
|
+
static constexpr auto CMD_BORDER_TOP_END_RADIUS = 24;
|
|
706
|
+
static constexpr auto CMD_BORDER_BOTTOM_LEFT_RADIUS = 25;
|
|
707
|
+
static constexpr auto CMD_BORDER_BOTTOM_RIGHT_RADIUS = 26;
|
|
708
|
+
static constexpr auto CMD_BORDER_BOTTOM_START_RADIUS = 27;
|
|
709
|
+
static constexpr auto CMD_BORDER_BOTTOM_END_RADIUS = 28;
|
|
710
|
+
static constexpr auto CMD_BORDER_START_START_RADIUS = 29;
|
|
711
|
+
static constexpr auto CMD_BORDER_START_END_RADIUS = 30;
|
|
712
|
+
static constexpr auto CMD_BORDER_END_START_RADIUS = 31;
|
|
713
|
+
static constexpr auto CMD_BORDER_END_END_RADIUS = 32;
|
|
714
|
+
|
|
715
|
+
static constexpr auto CMD_BORDER_COLOR = 40;
|
|
716
|
+
static constexpr auto CMD_BORDER_TOP_COLOR = 41;
|
|
717
|
+
static constexpr auto CMD_BORDER_BOTTOM_COLOR = 42;
|
|
718
|
+
static constexpr auto CMD_BORDER_LEFT_COLOR = 43;
|
|
719
|
+
static constexpr auto CMD_BORDER_RIGHT_COLOR = 44;
|
|
720
|
+
static constexpr auto CMD_BORDER_START_COLOR = 45;
|
|
721
|
+
static constexpr auto CMD_BORDER_END_COLOR = 46;
|
|
722
|
+
|
|
723
|
+
static constexpr auto CMD_TRANSFORM_TRANSLATE_X = 100;
|
|
724
|
+
static constexpr auto CMD_TRANSFORM_TRANSLATE_Y = 101;
|
|
725
|
+
static constexpr auto CMD_TRANSFORM_SCALE = 102;
|
|
726
|
+
static constexpr auto CMD_TRANSFORM_SCALE_X = 103;
|
|
727
|
+
static constexpr auto CMD_TRANSFORM_SCALE_Y = 104;
|
|
728
|
+
static constexpr auto CMD_TRANSFORM_ROTATE = 105;
|
|
729
|
+
static constexpr auto CMD_TRANSFORM_ROTATE_X = 106;
|
|
730
|
+
static constexpr auto CMD_TRANSFORM_ROTATE_Y = 107;
|
|
731
|
+
static constexpr auto CMD_TRANSFORM_ROTATE_Z = 108;
|
|
732
|
+
static constexpr auto CMD_TRANSFORM_SKEW_X = 109;
|
|
733
|
+
static constexpr auto CMD_TRANSFORM_SKEW_Y = 110;
|
|
734
|
+
static constexpr auto CMD_TRANSFORM_MATRIX = 111;
|
|
735
|
+
static constexpr auto CMD_TRANSFORM_PERSPECTIVE = 112;
|
|
736
|
+
|
|
737
|
+
static constexpr auto CMD_UNIT_DEG = 200;
|
|
738
|
+
static constexpr auto CMD_UNIT_RAD = 201;
|
|
739
|
+
static constexpr auto CMD_UNIT_PX = 202;
|
|
740
|
+
static constexpr auto CMD_UNIT_PERCENT = 203;
|
|
741
|
+
|
|
742
|
+
const auto propNameToCommand = [](const std::string &name) {
|
|
743
|
+
if (name == "opacity")
|
|
744
|
+
return CMD_OPACITY;
|
|
745
|
+
|
|
746
|
+
if (name == "elevation")
|
|
747
|
+
return CMD_ELEVATION;
|
|
748
|
+
|
|
749
|
+
if (name == "zIndex")
|
|
750
|
+
return CMD_Z_INDEX;
|
|
751
|
+
|
|
752
|
+
if (name == "shadowOpacity")
|
|
753
|
+
return CMD_SHADOW_OPACITY;
|
|
754
|
+
|
|
755
|
+
if (name == "shadowRadius")
|
|
756
|
+
return CMD_SHADOW_RADIUS;
|
|
757
|
+
|
|
758
|
+
if (name == "backgroundColor")
|
|
759
|
+
return CMD_BACKGROUND_COLOR;
|
|
760
|
+
|
|
761
|
+
if (name == "color")
|
|
762
|
+
return CMD_COLOR;
|
|
763
|
+
|
|
764
|
+
if (name == "tintColor")
|
|
765
|
+
return CMD_TINT_COLOR;
|
|
766
|
+
|
|
767
|
+
if (name == "borderRadius")
|
|
768
|
+
return CMD_BORDER_RADIUS;
|
|
769
|
+
|
|
770
|
+
if (name == "borderTopLeftRadius")
|
|
771
|
+
return CMD_BORDER_TOP_LEFT_RADIUS;
|
|
772
|
+
|
|
773
|
+
if (name == "borderTopRightRadius")
|
|
774
|
+
return CMD_BORDER_TOP_RIGHT_RADIUS;
|
|
775
|
+
|
|
776
|
+
if (name == "borderTopStartRadius")
|
|
777
|
+
return CMD_BORDER_TOP_START_RADIUS;
|
|
778
|
+
|
|
779
|
+
if (name == "borderTopEndRadius")
|
|
780
|
+
return CMD_BORDER_TOP_END_RADIUS;
|
|
781
|
+
|
|
782
|
+
if (name == "borderBottomLeftRadius")
|
|
783
|
+
return CMD_BORDER_BOTTOM_LEFT_RADIUS;
|
|
784
|
+
|
|
785
|
+
if (name == "borderBottomRightRadius")
|
|
786
|
+
return CMD_BORDER_BOTTOM_RIGHT_RADIUS;
|
|
787
|
+
|
|
788
|
+
if (name == "borderBottomStartRadius")
|
|
789
|
+
return CMD_BORDER_BOTTOM_START_RADIUS;
|
|
790
|
+
|
|
791
|
+
if (name == "borderBottomEndRadius")
|
|
792
|
+
return CMD_BORDER_BOTTOM_END_RADIUS;
|
|
793
|
+
|
|
794
|
+
if (name == "borderStartStartRadius")
|
|
795
|
+
return CMD_BORDER_START_START_RADIUS;
|
|
796
|
+
|
|
797
|
+
if (name == "borderStartEndRadius")
|
|
798
|
+
return CMD_BORDER_START_END_RADIUS;
|
|
799
|
+
|
|
800
|
+
if (name == "borderEndStartRadius")
|
|
801
|
+
return CMD_BORDER_END_START_RADIUS;
|
|
802
|
+
|
|
803
|
+
if (name == "borderEndEndRadius")
|
|
804
|
+
return CMD_BORDER_END_END_RADIUS;
|
|
805
|
+
|
|
806
|
+
if (name == "borderColor")
|
|
807
|
+
return CMD_BORDER_COLOR;
|
|
808
|
+
|
|
809
|
+
if (name == "borderTopColor")
|
|
810
|
+
return CMD_BORDER_TOP_COLOR;
|
|
811
|
+
|
|
812
|
+
if (name == "borderBottomColor")
|
|
813
|
+
return CMD_BORDER_BOTTOM_COLOR;
|
|
814
|
+
|
|
815
|
+
if (name == "borderLeftColor")
|
|
816
|
+
return CMD_BORDER_LEFT_COLOR;
|
|
817
|
+
|
|
818
|
+
if (name == "borderRightColor")
|
|
819
|
+
return CMD_BORDER_RIGHT_COLOR;
|
|
820
|
+
|
|
821
|
+
if (name == "borderStartColor")
|
|
822
|
+
return CMD_BORDER_START_COLOR;
|
|
823
|
+
|
|
824
|
+
if (name == "borderEndColor")
|
|
825
|
+
return CMD_BORDER_END_COLOR;
|
|
826
|
+
|
|
827
|
+
if (name == "transform")
|
|
828
|
+
return CMD_START_OF_TRANSFORM; // TODO: use CMD_TRANSFORM?
|
|
829
|
+
|
|
830
|
+
throw std::runtime_error("[Reanimated] Unsupported style: " + name);
|
|
831
|
+
};
|
|
832
|
+
|
|
833
|
+
const auto transformNameToCommand = [](const std::string &name) {
|
|
834
|
+
if (name == "translateX")
|
|
835
|
+
return CMD_TRANSFORM_TRANSLATE_X;
|
|
836
|
+
|
|
837
|
+
if (name == "translateY")
|
|
838
|
+
return CMD_TRANSFORM_TRANSLATE_Y;
|
|
839
|
+
|
|
840
|
+
if (name == "scale")
|
|
841
|
+
return CMD_TRANSFORM_SCALE;
|
|
842
|
+
|
|
843
|
+
if (name == "scaleX")
|
|
844
|
+
return CMD_TRANSFORM_SCALE_X;
|
|
845
|
+
|
|
846
|
+
if (name == "scaleY")
|
|
847
|
+
return CMD_TRANSFORM_SCALE_Y;
|
|
848
|
+
|
|
849
|
+
if (name == "rotate")
|
|
850
|
+
return CMD_TRANSFORM_ROTATE;
|
|
851
|
+
|
|
852
|
+
if (name == "rotateX")
|
|
853
|
+
return CMD_TRANSFORM_ROTATE_X;
|
|
854
|
+
|
|
855
|
+
if (name == "rotateY")
|
|
856
|
+
return CMD_TRANSFORM_ROTATE_Y;
|
|
857
|
+
|
|
858
|
+
if (name == "rotateZ")
|
|
859
|
+
return CMD_TRANSFORM_ROTATE_Z;
|
|
860
|
+
|
|
861
|
+
if (name == "skewX")
|
|
862
|
+
return CMD_TRANSFORM_SKEW_X;
|
|
863
|
+
|
|
864
|
+
if (name == "skewY")
|
|
865
|
+
return CMD_TRANSFORM_SKEW_Y;
|
|
866
|
+
|
|
867
|
+
if (name == "matrix")
|
|
868
|
+
return CMD_TRANSFORM_MATRIX;
|
|
869
|
+
|
|
870
|
+
if (name == "perspective")
|
|
871
|
+
return CMD_TRANSFORM_PERSPECTIVE;
|
|
872
|
+
|
|
873
|
+
throw std::runtime_error("[Reanimated] Unsupported transform: " + name);
|
|
874
|
+
};
|
|
875
|
+
|
|
876
|
+
UpdatesBatch synchronousUpdatesBatch, shadowTreeUpdatesBatch;
|
|
877
|
+
|
|
878
|
+
for (const auto &[shadowNode, props] : updatesBatch) {
|
|
879
|
+
bool hasOnlySynchronousProps = true;
|
|
880
|
+
for (const auto &[key, value] : props.items()) {
|
|
881
|
+
const auto keyStr = key.asString();
|
|
882
|
+
if (!synchronousProps.contains(keyStr) ||
|
|
883
|
+
((keyStr == "color" || keyStr.find("Color") != std::string::npos) && !value.isInt())) {
|
|
884
|
+
hasOnlySynchronousProps = false;
|
|
885
|
+
break;
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
if (hasOnlySynchronousProps) {
|
|
889
|
+
synchronousUpdatesBatch.emplace_back(shadowNode, props);
|
|
890
|
+
} else {
|
|
891
|
+
shadowTreeUpdatesBatch.emplace_back(shadowNode, props);
|
|
892
|
+
}
|
|
727
893
|
}
|
|
728
|
-
|
|
894
|
+
|
|
895
|
+
if (!synchronousUpdatesBatch.empty()) {
|
|
896
|
+
std::vector<int> intBuffer;
|
|
897
|
+
std::vector<double> doubleBuffer;
|
|
898
|
+
intBuffer.reserve(1024);
|
|
899
|
+
doubleBuffer.reserve(1024);
|
|
900
|
+
|
|
901
|
+
for (const auto &[shadowNode, props] : synchronousUpdatesBatch) {
|
|
902
|
+
intBuffer.push_back(CMD_START_OF_VIEW);
|
|
903
|
+
intBuffer.push_back(shadowNode->getTag());
|
|
904
|
+
for (const auto &[key, value] : props.items()) {
|
|
905
|
+
const auto command = propNameToCommand(key.getString());
|
|
906
|
+
switch (command) {
|
|
907
|
+
case CMD_OPACITY:
|
|
908
|
+
case CMD_ELEVATION:
|
|
909
|
+
case CMD_Z_INDEX:
|
|
910
|
+
case CMD_SHADOW_OPACITY:
|
|
911
|
+
case CMD_SHADOW_RADIUS:
|
|
912
|
+
intBuffer.push_back(command);
|
|
913
|
+
doubleBuffer.push_back(value.asDouble());
|
|
914
|
+
break;
|
|
915
|
+
|
|
916
|
+
case CMD_BACKGROUND_COLOR:
|
|
917
|
+
case CMD_COLOR:
|
|
918
|
+
case CMD_TINT_COLOR:
|
|
919
|
+
case CMD_BORDER_COLOR:
|
|
920
|
+
case CMD_BORDER_TOP_COLOR:
|
|
921
|
+
case CMD_BORDER_BOTTOM_COLOR:
|
|
922
|
+
case CMD_BORDER_LEFT_COLOR:
|
|
923
|
+
case CMD_BORDER_RIGHT_COLOR:
|
|
924
|
+
case CMD_BORDER_START_COLOR:
|
|
925
|
+
case CMD_BORDER_END_COLOR:
|
|
926
|
+
intBuffer.push_back(command);
|
|
927
|
+
intBuffer.push_back(value.asInt());
|
|
928
|
+
break;
|
|
929
|
+
|
|
930
|
+
case CMD_BORDER_RADIUS:
|
|
931
|
+
case CMD_BORDER_TOP_LEFT_RADIUS:
|
|
932
|
+
case CMD_BORDER_TOP_RIGHT_RADIUS:
|
|
933
|
+
case CMD_BORDER_TOP_START_RADIUS:
|
|
934
|
+
case CMD_BORDER_TOP_END_RADIUS:
|
|
935
|
+
case CMD_BORDER_BOTTOM_LEFT_RADIUS:
|
|
936
|
+
case CMD_BORDER_BOTTOM_RIGHT_RADIUS:
|
|
937
|
+
case CMD_BORDER_BOTTOM_START_RADIUS:
|
|
938
|
+
case CMD_BORDER_BOTTOM_END_RADIUS:
|
|
939
|
+
case CMD_BORDER_START_START_RADIUS:
|
|
940
|
+
case CMD_BORDER_START_END_RADIUS:
|
|
941
|
+
case CMD_BORDER_END_START_RADIUS:
|
|
942
|
+
case CMD_BORDER_END_END_RADIUS:
|
|
943
|
+
intBuffer.push_back(command);
|
|
944
|
+
if (value.isDouble()) {
|
|
945
|
+
intBuffer.push_back(CMD_UNIT_PX);
|
|
946
|
+
doubleBuffer.push_back(value.getDouble());
|
|
947
|
+
} else if (value.isString()) {
|
|
948
|
+
const auto &valueStr = value.getString();
|
|
949
|
+
if (!valueStr.ends_with("%")) {
|
|
950
|
+
throw std::runtime_error("[Reanimated] Border radius string must be a percentage");
|
|
951
|
+
}
|
|
952
|
+
intBuffer.push_back(CMD_UNIT_PERCENT);
|
|
953
|
+
doubleBuffer.push_back(std::stof(valueStr.substr(0, -1)));
|
|
954
|
+
} else {
|
|
955
|
+
throw std::runtime_error("[Reanimated] Border radius value must be either a number or a string");
|
|
956
|
+
}
|
|
957
|
+
break;
|
|
958
|
+
|
|
959
|
+
case CMD_START_OF_TRANSFORM:
|
|
960
|
+
intBuffer.push_back(command);
|
|
961
|
+
react_native_assert(value.isArray() && "[Reanimated] Transform value must be an array");
|
|
962
|
+
for (const auto &item : value) {
|
|
963
|
+
react_native_assert(item.isObject() && "[Reanimated] Transform array item must be an object");
|
|
964
|
+
react_native_assert(
|
|
965
|
+
item.size() == 1 && "[Reanimated] Transform array item must have exactly one key-value pair");
|
|
966
|
+
const auto transformCommand = transformNameToCommand(item.keys().begin()->getString());
|
|
967
|
+
const auto &transformValue = *item.values().begin();
|
|
968
|
+
switch (transformCommand) {
|
|
969
|
+
case CMD_TRANSFORM_SCALE:
|
|
970
|
+
case CMD_TRANSFORM_SCALE_X:
|
|
971
|
+
case CMD_TRANSFORM_SCALE_Y:
|
|
972
|
+
case CMD_TRANSFORM_PERSPECTIVE: {
|
|
973
|
+
intBuffer.push_back(transformCommand);
|
|
974
|
+
doubleBuffer.push_back(transformValue.asDouble());
|
|
975
|
+
break;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
case CMD_TRANSFORM_TRANSLATE_X:
|
|
979
|
+
case CMD_TRANSFORM_TRANSLATE_Y: {
|
|
980
|
+
intBuffer.push_back(transformCommand);
|
|
981
|
+
if (transformValue.isDouble()) {
|
|
982
|
+
intBuffer.push_back(CMD_UNIT_PX);
|
|
983
|
+
doubleBuffer.push_back(transformValue.getDouble());
|
|
984
|
+
} else if (transformValue.isString()) {
|
|
985
|
+
const auto &transformValueStr = transformValue.getString();
|
|
986
|
+
if (!transformValueStr.ends_with("%")) {
|
|
987
|
+
throw std::runtime_error("[Reanimated] String translate must be a percentage");
|
|
988
|
+
}
|
|
989
|
+
intBuffer.push_back(CMD_UNIT_PERCENT);
|
|
990
|
+
doubleBuffer.push_back(std::stof(transformValueStr.substr(0, -1)));
|
|
991
|
+
} else {
|
|
992
|
+
throw std::runtime_error("[Reanimated] Translate value must be either a number or a string");
|
|
993
|
+
}
|
|
994
|
+
break;
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
case CMD_TRANSFORM_ROTATE:
|
|
998
|
+
case CMD_TRANSFORM_ROTATE_X:
|
|
999
|
+
case CMD_TRANSFORM_ROTATE_Y:
|
|
1000
|
+
case CMD_TRANSFORM_ROTATE_Z:
|
|
1001
|
+
case CMD_TRANSFORM_SKEW_X:
|
|
1002
|
+
case CMD_TRANSFORM_SKEW_Y: {
|
|
1003
|
+
const auto &transformValueStr = transformValue.getString();
|
|
1004
|
+
intBuffer.push_back(transformCommand);
|
|
1005
|
+
if (transformValueStr.ends_with("deg")) {
|
|
1006
|
+
intBuffer.push_back(CMD_UNIT_DEG);
|
|
1007
|
+
} else if (transformValueStr.ends_with("rad")) {
|
|
1008
|
+
intBuffer.push_back(CMD_UNIT_RAD);
|
|
1009
|
+
} else {
|
|
1010
|
+
throw std::runtime_error("[Reanimated] Unsupported rotation unit: " + transformValueStr);
|
|
1011
|
+
}
|
|
1012
|
+
doubleBuffer.push_back(std::stof(transformValueStr.substr(0, -3)));
|
|
1013
|
+
break;
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
case CMD_TRANSFORM_MATRIX: {
|
|
1017
|
+
intBuffer.push_back(transformCommand);
|
|
1018
|
+
react_native_assert(transformValue.isArray() && "[Reanimated] Matrix must be an array");
|
|
1019
|
+
int size = transformValue.size();
|
|
1020
|
+
intBuffer.push_back(size);
|
|
1021
|
+
for (int i = 0; i < size; i++) {
|
|
1022
|
+
doubleBuffer.push_back(transformValue[i].asDouble());
|
|
1023
|
+
}
|
|
1024
|
+
break;
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
intBuffer.push_back(CMD_END_OF_TRANSFORM);
|
|
1029
|
+
break;
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
intBuffer.push_back(CMD_END_OF_VIEW);
|
|
1033
|
+
}
|
|
1034
|
+
synchronouslyUpdateUIPropsFunction_(intBuffer, doubleBuffer);
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
updatesBatch = std::move(shadowTreeUpdatesBatch);
|
|
729
1038
|
}
|
|
1039
|
+
#endif // ANDROID
|
|
1040
|
+
|
|
1041
|
+
#if __APPLE__
|
|
1042
|
+
if constexpr (
|
|
1043
|
+
StaticFeatureFlags::getFlag("IOS_SYNCHRONOUSLY_UPDATE_UI_PROPS") &&
|
|
1044
|
+
!StaticFeatureFlags::getFlag("ENABLE_SHARED_ELEMENT_TRANSITIONS")) {
|
|
1045
|
+
static const std::unordered_set<std::string> synchronousProps = {
|
|
1046
|
+
"opacity",
|
|
1047
|
+
"elevation",
|
|
1048
|
+
"zIndex",
|
|
1049
|
+
"shadowOpacity",
|
|
1050
|
+
"shadowRadius",
|
|
1051
|
+
"backgroundColor",
|
|
1052
|
+
// "color", // TODO: fix animating color of Animated.Text
|
|
1053
|
+
"tintColor",
|
|
1054
|
+
"borderRadius",
|
|
1055
|
+
"borderTopLeftRadius",
|
|
1056
|
+
"borderTopRightRadius",
|
|
1057
|
+
"borderTopStartRadius",
|
|
1058
|
+
"borderTopEndRadius",
|
|
1059
|
+
"borderBottomLeftRadius",
|
|
1060
|
+
"borderBottomRightRadius",
|
|
1061
|
+
"borderBottomStartRadius",
|
|
1062
|
+
"borderBottomEndRadius",
|
|
1063
|
+
"borderStartStartRadius",
|
|
1064
|
+
"borderStartEndRadius",
|
|
1065
|
+
"borderEndStartRadius",
|
|
1066
|
+
"borderEndEndRadius",
|
|
1067
|
+
"borderColor",
|
|
1068
|
+
"borderTopColor",
|
|
1069
|
+
"borderBottomColor",
|
|
1070
|
+
"borderLeftColor",
|
|
1071
|
+
"borderRightColor",
|
|
1072
|
+
"borderStartColor",
|
|
1073
|
+
"borderEndColor",
|
|
1074
|
+
"transform",
|
|
1075
|
+
};
|
|
1076
|
+
|
|
1077
|
+
UpdatesBatch synchronousUpdatesBatch, shadowTreeUpdatesBatch;
|
|
730
1078
|
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
1079
|
+
for (const auto &[shadowNode, props] : updatesBatch) {
|
|
1080
|
+
bool hasOnlySynchronousProps = true;
|
|
1081
|
+
for (const auto &key : props.keys()) {
|
|
1082
|
+
const auto keyStr = key.asString();
|
|
1083
|
+
if (!synchronousProps.contains(keyStr)) {
|
|
1084
|
+
hasOnlySynchronousProps = false;
|
|
1085
|
+
break;
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
if (hasOnlySynchronousProps) {
|
|
1089
|
+
synchronousUpdatesBatch.emplace_back(shadowNode, props);
|
|
1090
|
+
} else {
|
|
1091
|
+
shadowTreeUpdatesBatch.emplace_back(shadowNode, props);
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
for (const auto &[shadowNode, props] : synchronousUpdatesBatch) {
|
|
1096
|
+
synchronouslyUpdateUIPropsFunction_(shadowNode->getTag(), props);
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
updatesBatch = std::move(shadowTreeUpdatesBatch);
|
|
738
1100
|
}
|
|
739
|
-
|
|
1101
|
+
#endif // __APPLE__
|
|
740
1102
|
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
if (nonAnimatableProps.isUndefined()) {
|
|
744
|
-
continue;
|
|
1103
|
+
if ((updatesBatch.size() > 0) && updatesRegistryManager_->shouldReanimatedSkipCommit()) {
|
|
1104
|
+
updatesRegistryManager_->pleaseCommitAfterPause();
|
|
745
1105
|
}
|
|
746
|
-
Tag viewTag = shadowNode->getTag();
|
|
747
|
-
jsi::Value maybeJSPropsUpdater =
|
|
748
|
-
rt.global().getProperty(rt, "updateJSProps");
|
|
749
|
-
assert(
|
|
750
|
-
maybeJSPropsUpdater.isObject() &&
|
|
751
|
-
"[Reanimated] `updateJSProps` not found");
|
|
752
|
-
jsi::Function jsPropsUpdater =
|
|
753
|
-
maybeJSPropsUpdater.asObject(rt).asFunction(rt);
|
|
754
|
-
jsPropsUpdater.call(rt, viewTag, nonAnimatableProps);
|
|
755
1106
|
}
|
|
756
1107
|
|
|
757
|
-
if (
|
|
1108
|
+
if (updatesRegistryManager_->shouldReanimatedSkipCommit()) {
|
|
758
1109
|
// It may happen that `performOperations` is called on the UI thread
|
|
759
1110
|
// while React Native tries to commit a new tree on the JS thread.
|
|
760
1111
|
// In this case, we should skip the commit here and let React Native do
|
|
761
|
-
// it. The commit will include the current values from
|
|
762
|
-
// will be applied in ReanimatedCommitHook.
|
|
1112
|
+
// it. The commit will include the current values from the updates manager
|
|
1113
|
+
// which will be applied in ReanimatedCommitHook.
|
|
763
1114
|
return;
|
|
764
1115
|
}
|
|
765
1116
|
|
|
1117
|
+
commitUpdates(rt, updatesBatch);
|
|
1118
|
+
|
|
1119
|
+
// Clear the entire cache after the commit
|
|
1120
|
+
// (we don't know if the view is updated from outside of Reanimated
|
|
1121
|
+
// so we have to clear the entire cache)
|
|
1122
|
+
viewStylesRepository_->clearNodesCache();
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
void ReanimatedModuleProxy::requestFlushRegistry() {
|
|
1126
|
+
requestRender_([weakThis = weak_from_this()](const double timestamp) {
|
|
1127
|
+
if (auto strongThis = weakThis.lock()) {
|
|
1128
|
+
strongThis->shouldFlushRegistry_ = true;
|
|
1129
|
+
}
|
|
1130
|
+
});
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
void ReanimatedModuleProxy::commitUpdates(jsi::Runtime &rt, const UpdatesBatch &updatesBatch) {
|
|
1134
|
+
ReanimatedSystraceSection s("ReanimatedModuleProxy::commitUpdates");
|
|
766
1135
|
react_native_assert(uiManager_ != nullptr);
|
|
767
1136
|
const auto &shadowTreeRegistry = uiManager_->getShadowTreeRegistry();
|
|
768
1137
|
|
|
769
1138
|
std::unordered_map<SurfaceId, PropsMap> propsMapBySurface;
|
|
770
1139
|
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
1140
|
+
#ifdef ANDROID
|
|
1141
|
+
updatesRegistryManager_->collectPropsToRevertBySurface(propsMapBySurface);
|
|
1142
|
+
#endif
|
|
1143
|
+
|
|
1144
|
+
if (shouldFlushRegistry_) {
|
|
1145
|
+
shouldFlushRegistry_ = false;
|
|
1146
|
+
const auto propsMap = updatesRegistryManager_->collectProps();
|
|
1147
|
+
for (auto const &[family, props] : propsMap) {
|
|
1148
|
+
const auto surfaceId = family->getSurfaceId();
|
|
1149
|
+
auto &propsVector = propsMapBySurface[surfaceId][family];
|
|
1150
|
+
for (const auto &prop : props) {
|
|
1151
|
+
propsVector.emplace_back(prop);
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
} else {
|
|
1155
|
+
for (auto const &[shadowNode, props] : updatesBatch) {
|
|
1156
|
+
SurfaceId surfaceId = shadowNode->getSurfaceId();
|
|
1157
|
+
auto family = &shadowNode->getFamily();
|
|
1158
|
+
react_native_assert(family->getSurfaceId() == surfaceId);
|
|
1159
|
+
propsMapBySurface[surfaceId][family].emplace_back(props);
|
|
1160
|
+
}
|
|
776
1161
|
}
|
|
777
1162
|
|
|
778
|
-
for (auto
|
|
1163
|
+
for (const auto &entry : propsMapBySurface) {
|
|
1164
|
+
const SurfaceId surfaceId = entry.first;
|
|
1165
|
+
const PropsMap &propsMap = entry.second;
|
|
779
1166
|
shadowTreeRegistry.visit(surfaceId, [&](ShadowTree const &shadowTree) {
|
|
780
|
-
shadowTree.commit(
|
|
781
|
-
[&](RootShadowNode const &oldRootShadowNode)
|
|
782
|
-
|
|
783
|
-
if (propsRegistry_->shouldReanimatedSkipCommit()) {
|
|
1167
|
+
const auto status = shadowTree.commit(
|
|
1168
|
+
[&](RootShadowNode const &oldRootShadowNode) -> RootShadowNode::Unshared {
|
|
1169
|
+
if (updatesRegistryManager_->shouldReanimatedSkipCommit()) {
|
|
784
1170
|
return nullptr;
|
|
785
1171
|
}
|
|
786
1172
|
|
|
787
|
-
auto rootNode =
|
|
788
|
-
cloneShadowTreeWithNewProps(oldRootShadowNode, propsMap);
|
|
1173
|
+
auto rootNode = cloneShadowTreeWithNewProps(oldRootShadowNode, propsMap);
|
|
789
1174
|
|
|
790
1175
|
// Mark the commit as Reanimated commit so that we can distinguish
|
|
791
1176
|
// it in ReanimatedCommitHook.
|
|
792
1177
|
|
|
793
|
-
auto reaShadowNode =
|
|
794
|
-
std::reinterpret_pointer_cast<ReanimatedCommitShadowNode>(
|
|
795
|
-
rootNode);
|
|
1178
|
+
auto reaShadowNode = std::reinterpret_pointer_cast<ReanimatedCommitShadowNode>(rootNode);
|
|
796
1179
|
reaShadowNode->setReanimatedCommitTrait();
|
|
797
1180
|
|
|
798
1181
|
return rootNode;
|
|
@@ -800,6 +1183,14 @@ void ReanimatedModuleProxy::performOperations() {
|
|
|
800
1183
|
{/* .enableStateReconciliation = */
|
|
801
1184
|
false,
|
|
802
1185
|
/* .mountSynchronously = */ true});
|
|
1186
|
+
|
|
1187
|
+
#ifdef ANDROID
|
|
1188
|
+
if (status == ShadowTree::CommitStatus::Succeeded) {
|
|
1189
|
+
updatesRegistryManager_->clearPropsToRevert(surfaceId);
|
|
1190
|
+
}
|
|
1191
|
+
#else
|
|
1192
|
+
(void)status;
|
|
1193
|
+
#endif
|
|
803
1194
|
});
|
|
804
1195
|
}
|
|
805
1196
|
}
|
|
@@ -809,7 +1200,7 @@ void ReanimatedModuleProxy::dispatchCommand(
|
|
|
809
1200
|
const jsi::Value &shadowNodeValue,
|
|
810
1201
|
const jsi::Value &commandNameValue,
|
|
811
1202
|
const jsi::Value &argsValue) {
|
|
812
|
-
|
|
1203
|
+
const auto shadowNode = shadowNodeFromValue(rt, shadowNodeValue);
|
|
813
1204
|
std::string commandName = stringFromValue(rt, commandNameValue);
|
|
814
1205
|
folly::dynamic args = commandArgsFromValue(rt, argsValue);
|
|
815
1206
|
const auto &scheduler = static_cast<Scheduler *>(uiManager_->getDelegate());
|
|
@@ -822,31 +1213,24 @@ void ReanimatedModuleProxy::dispatchCommand(
|
|
|
822
1213
|
|
|
823
1214
|
if (schedulerDelegate) {
|
|
824
1215
|
const auto shadowView = ShadowView(*shadowNode);
|
|
825
|
-
schedulerDelegate->schedulerDidDispatchCommand(
|
|
826
|
-
shadowView, commandName, args);
|
|
1216
|
+
schedulerDelegate->schedulerDidDispatchCommand(shadowView, commandName, args);
|
|
827
1217
|
}
|
|
828
1218
|
}
|
|
829
1219
|
|
|
830
|
-
jsi::String
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
const jsi::Value &propName) {
|
|
834
|
-
jsi::Runtime &uiRuntime = uiWorkletRuntime_->getJSIRuntime();
|
|
1220
|
+
jsi::String
|
|
1221
|
+
ReanimatedModuleProxy::obtainProp(jsi::Runtime &rt, const jsi::Value &shadowNodeWrapper, const jsi::Value &propName) {
|
|
1222
|
+
jsi::Runtime &uiRuntime = workletsModuleProxy_->getUIWorkletRuntime()->getJSIRuntime();
|
|
835
1223
|
const auto propNameStr = propName.asString(rt).utf8(rt);
|
|
836
1224
|
const auto shadowNode = shadowNodeFromValue(rt, shadowNodeWrapper);
|
|
837
|
-
const auto resultStr =
|
|
838
|
-
obtainPropFromShadowNode(uiRuntime, propNameStr, shadowNode);
|
|
1225
|
+
const auto resultStr = obtainPropFromShadowNode(uiRuntime, propNameStr, shadowNode);
|
|
839
1226
|
return jsi::String::createFromUtf8(rt, resultStr);
|
|
840
1227
|
}
|
|
841
1228
|
|
|
842
|
-
jsi::Value ReanimatedModuleProxy::measure(
|
|
843
|
-
jsi::Runtime &rt,
|
|
844
|
-
const jsi::Value &shadowNodeValue) {
|
|
1229
|
+
jsi::Value ReanimatedModuleProxy::measure(jsi::Runtime &rt, const jsi::Value &shadowNodeValue) {
|
|
845
1230
|
// based on implementation from UIManagerBinding.cpp
|
|
846
1231
|
|
|
847
1232
|
auto shadowNode = shadowNodeFromValue(rt, shadowNodeValue);
|
|
848
|
-
auto layoutMetrics = uiManager_->getRelativeLayoutMetrics(
|
|
849
|
-
*shadowNode, nullptr, {/* .includeTransform = */ true});
|
|
1233
|
+
auto layoutMetrics = uiManager_->getRelativeLayoutMetrics(*shadowNode, nullptr, {/* .includeTransform = */ true});
|
|
850
1234
|
|
|
851
1235
|
if (layoutMetrics == EmptyLayoutMetrics) {
|
|
852
1236
|
// Originally, in this case React Native returns `{0, 0, 0, 0, 0, 0}`,
|
|
@@ -855,62 +1239,87 @@ jsi::Value ReanimatedModuleProxy::measure(
|
|
|
855
1239
|
// `MeasuredDimensions | null`.
|
|
856
1240
|
return jsi::Value::null();
|
|
857
1241
|
}
|
|
858
|
-
auto newestCloneOfShadowNode =
|
|
859
|
-
uiManager_->getNewestCloneOfShadowNode(*shadowNode);
|
|
1242
|
+
auto newestCloneOfShadowNode = uiManager_->getNewestCloneOfShadowNode(*shadowNode);
|
|
860
1243
|
|
|
861
|
-
auto layoutableShadowNode =
|
|
862
|
-
|
|
863
|
-
facebook::react::Point originRelativeToParent =
|
|
864
|
-
layoutableShadowNode != nullptr
|
|
1244
|
+
auto layoutableShadowNode = dynamic_cast<LayoutableShadowNode const *>(newestCloneOfShadowNode.get());
|
|
1245
|
+
facebook::react::Point originRelativeToParent = layoutableShadowNode != nullptr
|
|
865
1246
|
? layoutableShadowNode->getLayoutMetrics().frame.origin
|
|
866
1247
|
: facebook::react::Point();
|
|
867
1248
|
|
|
868
1249
|
auto frame = layoutMetrics.frame;
|
|
869
1250
|
|
|
870
1251
|
jsi::Object result(rt);
|
|
871
|
-
result.setProperty(
|
|
872
|
-
|
|
873
|
-
result.setProperty(
|
|
874
|
-
|
|
875
|
-
result.setProperty(
|
|
876
|
-
|
|
877
|
-
result.setProperty(
|
|
878
|
-
rt, "height", jsi::Value(static_cast<double>(frame.size.height)));
|
|
879
|
-
result.setProperty(
|
|
880
|
-
rt, "pageX", jsi::Value(static_cast<double>(frame.origin.x)));
|
|
881
|
-
result.setProperty(
|
|
882
|
-
rt, "pageY", jsi::Value(static_cast<double>(frame.origin.y)));
|
|
1252
|
+
result.setProperty(rt, "x", jsi::Value(static_cast<double>(originRelativeToParent.x)));
|
|
1253
|
+
result.setProperty(rt, "y", jsi::Value(static_cast<double>(originRelativeToParent.y)));
|
|
1254
|
+
result.setProperty(rt, "width", jsi::Value(static_cast<double>(frame.size.width)));
|
|
1255
|
+
result.setProperty(rt, "height", jsi::Value(static_cast<double>(frame.size.height)));
|
|
1256
|
+
result.setProperty(rt, "pageX", jsi::Value(static_cast<double>(frame.origin.x)));
|
|
1257
|
+
result.setProperty(rt, "pageY", jsi::Value(static_cast<double>(frame.origin.y)));
|
|
883
1258
|
return result;
|
|
884
1259
|
}
|
|
885
1260
|
|
|
886
|
-
void ReanimatedModuleProxy::initializeFabric(
|
|
887
|
-
const std::shared_ptr<UIManager> &uiManager) {
|
|
1261
|
+
void ReanimatedModuleProxy::initializeFabric(const std::shared_ptr<UIManager> &uiManager) {
|
|
888
1262
|
uiManager_ = uiManager;
|
|
1263
|
+
viewStylesRepository_->setUIManager(uiManager_);
|
|
889
1264
|
|
|
890
1265
|
initializeLayoutAnimationsProxy();
|
|
891
1266
|
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
1267
|
+
const std::function<void()> request = [weakThis = weak_from_this()]() {
|
|
1268
|
+
auto strongThis = weakThis.lock();
|
|
1269
|
+
if (!strongThis) {
|
|
1270
|
+
return;
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
strongThis->requestFlushRegistry();
|
|
1274
|
+
};
|
|
1275
|
+
mountHook_ = std::make_shared<ReanimatedMountHook>(uiManager_, updatesRegistryManager_, request);
|
|
1276
|
+
commitHook_ = std::make_shared<ReanimatedCommitHook>(uiManager_, updatesRegistryManager_, layoutAnimationsProxy_);
|
|
896
1277
|
}
|
|
897
1278
|
|
|
898
1279
|
void ReanimatedModuleProxy::initializeLayoutAnimationsProxy() {
|
|
899
|
-
uiManager_->setAnimationDelegate(nullptr);
|
|
900
1280
|
auto scheduler = reinterpret_cast<Scheduler *>(uiManager_->getDelegate());
|
|
901
1281
|
auto componentDescriptorRegistry =
|
|
902
1282
|
scheduler->getContextContainer()
|
|
903
|
-
->at<std::weak_ptr<const ComponentDescriptorRegistry>>(
|
|
904
|
-
"ComponentDescriptorRegistry_DO_NOT_USE_PRETTY_PLEASE")
|
|
1283
|
+
->at<std::weak_ptr<const ComponentDescriptorRegistry>>("ComponentDescriptorRegistry_DO_NOT_USE_PRETTY_PLEASE")
|
|
905
1284
|
.lock();
|
|
906
1285
|
|
|
907
1286
|
if (componentDescriptorRegistry) {
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
1287
|
+
if constexpr (StaticFeatureFlags::getFlag("ENABLE_SHARED_ELEMENT_TRANSITIONS")) {
|
|
1288
|
+
auto layoutAnimationsProxyExperimental = std::make_shared<LayoutAnimationsProxy_Experimental>(
|
|
1289
|
+
layoutAnimationsManager_,
|
|
1290
|
+
componentDescriptorRegistry,
|
|
1291
|
+
scheduler->getContextContainer(),
|
|
1292
|
+
workletsModuleProxy_->getUIWorkletRuntime()->getJSIRuntime(),
|
|
1293
|
+
workletsModuleProxy_->getUIScheduler()
|
|
1294
|
+
#ifdef ANDROID
|
|
1295
|
+
,
|
|
1296
|
+
filterUnmountedTagsFunction_,
|
|
1297
|
+
uiManager_,
|
|
1298
|
+
jsInvoker_
|
|
1299
|
+
#endif
|
|
1300
|
+
);
|
|
1301
|
+
#ifdef __APPLE__
|
|
1302
|
+
layoutAnimationsProxyExperimental->setForceScreenSnapshotFunction(forceScreenSnapshot_);
|
|
1303
|
+
#endif
|
|
1304
|
+
layoutAnimationsProxy_ = std::move(layoutAnimationsProxyExperimental);
|
|
1305
|
+
} else {
|
|
1306
|
+
auto layoutAnimationsProxyLegacy = std::make_shared<LayoutAnimationsProxy_Legacy>(
|
|
1307
|
+
layoutAnimationsManager_,
|
|
1308
|
+
componentDescriptorRegistry,
|
|
1309
|
+
scheduler->getContextContainer(),
|
|
1310
|
+
workletsModuleProxy_->getUIWorkletRuntime()->getJSIRuntime(),
|
|
1311
|
+
workletsModuleProxy_->getUIScheduler()
|
|
1312
|
+
#ifdef ANDROID
|
|
1313
|
+
,
|
|
1314
|
+
filterUnmountedTagsFunction_,
|
|
1315
|
+
uiManager_,
|
|
1316
|
+
jsInvoker_
|
|
1317
|
+
#endif
|
|
1318
|
+
);
|
|
1319
|
+
// TODO (future): support in experimental
|
|
1320
|
+
uiManager_->setAnimationDelegate(layoutAnimationsProxyLegacy.get());
|
|
1321
|
+
layoutAnimationsProxy_ = std::move(layoutAnimationsProxyLegacy);
|
|
1322
|
+
}
|
|
914
1323
|
}
|
|
915
1324
|
}
|
|
916
1325
|
|
|
@@ -920,8 +1329,7 @@ std::string format(bool b) {
|
|
|
920
1329
|
return b ? "✅" : "❌";
|
|
921
1330
|
}
|
|
922
1331
|
|
|
923
|
-
std::function<std::string()>
|
|
924
|
-
ReanimatedModuleProxy::createRegistriesLeakCheck() {
|
|
1332
|
+
std::function<std::string()> ReanimatedModuleProxy::createRegistriesLeakCheck() {
|
|
925
1333
|
return [weakThis = weak_from_this()]() {
|
|
926
1334
|
auto strongThis = weakThis.lock();
|
|
927
1335
|
if (!strongThis) {
|
|
@@ -930,7 +1338,10 @@ ReanimatedModuleProxy::createRegistriesLeakCheck() {
|
|
|
930
1338
|
|
|
931
1339
|
std::string result = "";
|
|
932
1340
|
|
|
933
|
-
result += "
|
|
1341
|
+
result += "AnimatedPropsRegistry: " + format(strongThis->animatedPropsRegistry_->isEmpty());
|
|
1342
|
+
result += "\nCSSAnimationsRegistry: " + format(strongThis->cssAnimationsRegistry_->isEmpty());
|
|
1343
|
+
result += "\nCSSTransitionsRegistry: " + format(strongThis->cssTransitionsRegistry_->isEmpty());
|
|
1344
|
+
result += "\nStaticPropsRegistry: " + format(strongThis->staticPropsRegistry_->isEmpty()) + "\n";
|
|
934
1345
|
|
|
935
1346
|
return result;
|
|
936
1347
|
};
|
|
@@ -938,33 +1349,27 @@ ReanimatedModuleProxy::createRegistriesLeakCheck() {
|
|
|
938
1349
|
|
|
939
1350
|
#endif // IS_REANIMATED_EXAMPLE_APP
|
|
940
1351
|
|
|
941
|
-
#endif // RCT_NEW_ARCH_ENABLED
|
|
942
|
-
|
|
943
1352
|
jsi::Value ReanimatedModuleProxy::subscribeForKeyboardEvents(
|
|
944
1353
|
jsi::Runtime &rt,
|
|
945
1354
|
const jsi::Value &handlerWorklet,
|
|
946
1355
|
const jsi::Value &isStatusBarTranslucent,
|
|
947
1356
|
const jsi::Value &isNavigationBarTranslucent) {
|
|
948
|
-
auto
|
|
949
|
-
rt,
|
|
950
|
-
handlerWorklet,
|
|
951
|
-
"[Reanimated] Keyboard event handler must be a worklet.");
|
|
1357
|
+
auto serializableHandler = extractSerializableOrThrow<SerializableWorklet>(
|
|
1358
|
+
rt, handlerWorklet, "[Reanimated] Keyboard event handler must be a worklet.");
|
|
952
1359
|
return subscribeForKeyboardEventsFunction_(
|
|
953
1360
|
[=, weakThis = weak_from_this()](int keyboardState, int height) {
|
|
954
1361
|
auto strongThis = weakThis.lock();
|
|
955
1362
|
if (!strongThis) {
|
|
956
1363
|
return;
|
|
957
1364
|
}
|
|
958
|
-
strongThis->
|
|
959
|
-
|
|
1365
|
+
strongThis->workletsModuleProxy_->getUIWorkletRuntime()->runSync(
|
|
1366
|
+
serializableHandler, jsi::Value(keyboardState), jsi::Value(height));
|
|
960
1367
|
},
|
|
961
1368
|
isStatusBarTranslucent.getBool(),
|
|
962
1369
|
isNavigationBarTranslucent.getBool());
|
|
963
1370
|
}
|
|
964
1371
|
|
|
965
|
-
void ReanimatedModuleProxy::unsubscribeFromKeyboardEvents(
|
|
966
|
-
jsi::Runtime &,
|
|
967
|
-
const jsi::Value &listenerId) {
|
|
1372
|
+
void ReanimatedModuleProxy::unsubscribeFromKeyboardEvents(jsi::Runtime &, const jsi::Value &listenerId) {
|
|
968
1373
|
unsubscribeFromKeyboardEventsFunction_(listenerId.asNumber());
|
|
969
1374
|
}
|
|
970
1375
|
|