@react-native-ohos/react-native-reanimated 4.0.2-beta.1 → 4.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1070 -0
- package/LICENSE +21 -0
- package/README.md +842 -0
- package/compatibility.json +20 -26
- package/harmony/reanimated/BuildProfile.ets +1 -1
- package/harmony/reanimated/index.ets +4 -2
- package/harmony/reanimated/oh-package-lock.json5 +1 -1
- package/harmony/reanimated/oh-package.json5 +1 -1
- package/harmony/reanimated/src/main/cpp/CMakeLists.txt +23 -9
- package/harmony/reanimated/src/main/cpp/Common/NativeView/CMakeLists.txt +56 -0
- package/harmony/reanimated/src/main/cpp/Common/NativeView/react/renderer/components/rnreanimated/ComponentDescriptors.h +19 -0
- package/harmony/reanimated/src/main/cpp/Common/NativeView/react/renderer/components/rnreanimated/REASharedTransitionBoundaryComponentDescriptor.h +30 -0
- package/harmony/reanimated/src/main/cpp/Common/NativeView/react/renderer/components/rnreanimated/REASharedTransitionBoundaryShadowNode.cpp +15 -0
- package/harmony/reanimated/src/main/cpp/Common/NativeView/react/renderer/components/rnreanimated/REASharedTransitionBoundaryShadowNode.h +41 -0
- package/harmony/reanimated/src/main/cpp/Common/NativeView/react/renderer/components/rnreanimated/REASharedTransitionBoundaryState.h +30 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.cpp +8 -9
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.h +3 -6
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/InterpolatorRegistry.cpp +203 -150
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/InterpolatorRegistry.h +1 -6
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/definitions.h +2 -7
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSAngle.cpp +0 -1
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSColor.cpp +2 -18
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSDiscreteArray.cpp +11 -11
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSDiscreteArray.h +2 -6
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSLength.cpp +4 -1
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSNumber.cpp +5 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSNumber.h +8 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSValue.h +27 -46
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSValueVariant.cpp +20 -20
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSValueVariant.h +2 -2
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/complex/CSSDropShadow.h +3 -3
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSAnimationConfig.cpp +10 -2
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSAnimationConfig.h +5 -3
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSKeyframesConfig.cpp +20 -17
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSKeyframesConfig.h +5 -8
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSTransitionConfig.cpp +33 -66
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSTransitionConfig.h +29 -22
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/common.cpp +14 -2
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/common.h +8 -2
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSAnimation.cpp +50 -91
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSAnimation.h +43 -18
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSAnimationsGroup.cpp +63 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSAnimationsGroup.h +37 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSLoopAnimation.cpp +100 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSLoopAnimation.h +49 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSPlatformAnimation.h +13 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSPlatformAnimationFactory.h +32 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/transition/CSSLoopTransition.cpp +156 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/transition/CSSLoopTransition.h +71 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/transition/CSSPlatformTransitionProxy.cpp +141 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/transition/CSSPlatformTransitionProxy.h +104 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/transition/CSSTransition.cpp +97 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/transition/CSSTransition.h +69 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/EasingConfigs.cpp +89 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/EasingConfigs.h +36 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/InterpolatorFactory.cpp +12 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/InterpolatorFactory.h +11 -2
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/PropertyInterpolator.cpp +2 -3
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/PropertyInterpolator.h +3 -5
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterOperation.cpp +3 -3
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterOperation.h +1 -1
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/ArrayPropertiesInterpolator.cpp +38 -37
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/ArrayPropertiesInterpolator.h +3 -6
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/RecordPropertiesInterpolator.cpp +54 -32
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/RecordPropertiesInterpolator.h +5 -7
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/OperationsStyleInterpolator.cpp +46 -46
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/OperationsStyleInterpolator.h +8 -7
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/StyleOperation.h +4 -57
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/AnimationStyleInterpolator.cpp +23 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/AnimationStyleInterpolator.h +10 -8
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/AnimationStyleInterpolatorFactory.cpp +77 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/AnimationStyleInterpolatorFactory.h +38 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/TransitionStyleInterpolator.cpp +47 -68
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/TransitionStyleInterpolator.h +21 -9
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperation.cpp +4 -1
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperationInterpolator.cpp +35 -78
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperationInterpolator.h +44 -13
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/matrix.cpp +13 -11
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ResolvableValueInterpolator.cpp +4 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/SimpleValueInterpolator.cpp +7 -3
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ValueInterpolator.cpp +20 -27
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ValueInterpolator.h +12 -9
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/misc/ViewStylesRepository.cpp +63 -36
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/misc/ViewStylesRepository.h +6 -8
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/AnimationProgressProvider.cpp +55 -46
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/AnimationProgressProvider.h +8 -5
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/RawProgressProvider.cpp +1 -2
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/RawProgressProvider.h +3 -2
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/TransitionProgressProvider.cpp +76 -71
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/TransitionProgressProvider.h +17 -14
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSAnimationsRegistry.cpp +145 -273
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSAnimationsRegistry.h +43 -44
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSKeyframesRegistry.cpp +19 -19
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSKeyframesRegistry.h +16 -12
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSTransitionsRegistry.cpp +95 -114
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSTransitionsRegistry.h +38 -25
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/StaticPropsRegistry.cpp +9 -34
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/StaticPropsRegistry.h +0 -10
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/CSSLengthArray.cpp +47 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/CSSLengthArray.h +24 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/CSSLengthVector.cpp +87 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/CSSLengthVector.h +28 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGPath.cpp +326 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGPath.h +65 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGStops.cpp +164 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGStops.h +51 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGStrokeDashArray.cpp +14 -66
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGStrokeDashArray.h +7 -18
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/platform.cpp +284 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/platform.h +31 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/props.cpp +13 -132
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/props.h +3 -21
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/reversingShortening.h +43 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Compat/WorkletsApi.h +13 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Events/UIEventHandler.cpp +33 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Events/UIEventHandler.h +39 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Events/UIEventHandlerRegistry.cpp +95 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Events/UIEventHandlerRegistry.h +40 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.cpp +20 -23
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.h +2 -6
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.cpp +26 -18
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.h +4 -8
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.cpp +16 -28
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.h +3 -4
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.cpp +72 -24
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.h +17 -7
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/OperationsLoop.cpp +152 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/OperationsLoop.h +86 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/PropsLayoutFilter.h +98 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistry.cpp +162 -28
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistry.h +69 -11
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistryManager.cpp +41 -17
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistryManager.h +14 -3
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/propNameFromString.h +130 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.cpp +1 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.h +5 -7
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.cpp +7 -4
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.h +52 -9
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.cpp +174 -62
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.h +12 -11
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.cpp +251 -128
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.h +23 -19
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.h +34 -6
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/SharedTransitions.cpp +71 -64
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.cpp +938 -700
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.h +123 -76
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/SynchronousPropsBufferSerializer.cpp +313 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/SynchronousPropsBufferSerializer.h +18 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/PseudoStyles/PseudoSelector.h +41 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/PseudoStyles/PseudoStylesRegistry.cpp +113 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/PseudoStyles/PseudoStylesRegistry.h +73 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.cpp +4 -4
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.cpp +23 -48
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.h +13 -14
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/PlatformDepMethodsHolder.h +20 -3
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReaJSIUtils.h +227 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReanimatedVersion.cpp +51 -14
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReanimatedVersion.h +2 -5
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/SingleInstanceChecker.h +76 -0
- package/harmony/reanimated/src/main/cpp/OHOSCSSPlatformTransitions.cpp +353 -0
- package/harmony/reanimated/src/main/cpp/OHOSCSSPlatformTransitions.h +95 -0
- package/harmony/reanimated/src/main/cpp/PseudoSelectorManager.cpp +140 -0
- package/harmony/reanimated/src/main/cpp/PseudoSelectorManager.h +52 -0
- package/harmony/reanimated/src/main/cpp/REASharedTransitionBoundaryComponentInstance.cpp +45 -0
- package/harmony/reanimated/src/main/cpp/REASharedTransitionBoundaryComponentInstance.h +33 -0
- package/harmony/reanimated/src/main/cpp/REASharedTransitionBoundaryJSIBinder.h +20 -0
- package/harmony/reanimated/src/main/cpp/ReanimatedModule.cpp +112 -19
- package/harmony/reanimated/src/main/cpp/ReanimatedModule.h +4 -2
- package/harmony/reanimated/src/main/cpp/ReanimatedNodesManager.cpp +1 -1
- package/harmony/reanimated/src/main/cpp/ReanimatedNodesManager.h +1 -1
- package/harmony/reanimated/src/main/cpp/ReanimatedPackage.cpp +24 -1
- package/harmony/reanimated/src/main/cpp/ReanimatedPackage.h +7 -2
- package/harmony/reanimated/src/main/cpp/ReanimatedSensor.cpp +88 -57
- package/harmony/reanimated/src/main/cpp/ReanimatedSensor.h +4 -2
- package/harmony/reanimated/src/main/cpp/ReanimatedSensorContainer.cpp +1 -1
- package/harmony/reanimated/src/main/cpp/ReanimatedSensorContainer.h +1 -1
- package/harmony/reanimated/src/main/cpp/ReanimatedUIScheduler.cpp +9 -7
- package/harmony/reanimated/src/main/cpp/ReanimatedUIScheduler.h +6 -5
- package/harmony/reanimated/src/main/cpp/TransformParser.h +1 -1
- package/harmony/reanimated/src/main/cpp/codegen/react/renderer/components/rnreanimated/EventEmitters.h +19 -0
- package/harmony/reanimated/src/main/cpp/codegen/react/renderer/components/rnreanimated/Props.h +31 -0
- package/harmony/reanimated/src/main/ets/KeyboardState.ts +11 -0
- package/harmony/reanimated/src/main/ets/ReanimatedModule.ts +119 -19
- package/harmony/reanimated/src/main/ets/{ReanimatedPackage.ts → ReanimatedPackage.ets} +4 -3
- package/harmony/reanimated.har +0 -0
- package/package.json +52 -24
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSTransition.cpp +0 -145
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSTransition.h +0 -47
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGLength.cpp +0 -93
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGLength.h +0 -36
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/DelayedItemsManager.cpp +0 -75
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/DelayedItemsManager.h +0 -45
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.cpp +0 -183
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.h +0 -93
- package/harmony/reanimated/src/main/ets/AnimationManager.ts +0 -61
- /package/harmony/reanimated/{ts.ts → ts.ets} +0 -0
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#include <reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.h>
|
|
2
|
-
#include <reanimated/NativeModules/ReanimatedModuleProxy.h>
|
|
3
2
|
|
|
4
|
-
#include <react/
|
|
3
|
+
#include <react/debug/react_native_assert.h>
|
|
5
4
|
#include <react/renderer/mounting/ShadowViewMutation.h>
|
|
6
5
|
|
|
7
6
|
#include <memory>
|
|
@@ -39,17 +38,25 @@ std::optional<MountingTransaction> LayoutAnimationsProxy_Legacy::pullTransaction
|
|
|
39
38
|
std::vector<std::shared_ptr<MutationNode>> roots;
|
|
40
39
|
std::unordered_map<Tag, Tag> movedViews;
|
|
41
40
|
|
|
41
|
+
reconcileContradictedRemovals(mutations, filteredMutations, surfaceId);
|
|
42
|
+
|
|
42
43
|
addOngoingAnimations(surfaceId, filteredMutations);
|
|
43
44
|
|
|
44
45
|
#ifdef ANDROID
|
|
45
46
|
restoreOpacityInCaseOfFlakyEnteringAnimation(surfaceId);
|
|
46
47
|
#endif // ANDROID
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
layoutAnimations_.
|
|
48
|
+
auto &updateMap = surfaceManager.getUpdateMap(surfaceId);
|
|
49
|
+
for (const auto tag : maybeSettledAnimationTags_) {
|
|
50
|
+
const auto layoutAnimationIt = layoutAnimations_.find(tag);
|
|
51
|
+
if (layoutAnimationIt == layoutAnimations_.end() || !layoutAnimationIt->second.isSettled()) {
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
layoutAnimations_.erase(layoutAnimationIt);
|
|
50
55
|
updateMap.erase(tag);
|
|
51
56
|
}
|
|
52
|
-
|
|
57
|
+
maybeSettledAnimationTags_.clear();
|
|
58
|
+
// Past this point no animation can be settled - we hold the mutex for the whole
|
|
59
|
+
// transaction, so no end callback can run until we return.
|
|
53
60
|
|
|
54
61
|
parseRemoveMutations(movedViews, mutations, roots);
|
|
55
62
|
|
|
@@ -64,6 +71,40 @@ std::optional<MountingTransaction> LayoutAnimationsProxy_Legacy::pullTransaction
|
|
|
64
71
|
return MountingTransaction{surfaceId, transactionNumber, std::move(filteredMutations), telemetry};
|
|
65
72
|
}
|
|
66
73
|
|
|
74
|
+
// If React re-creates or re-inserts a tag whose exiting removal we are still
|
|
75
|
+
// withholding, it has contradicted that withheld Remove/Delete. Flush it now
|
|
76
|
+
// instead of letting it fire later against a stale hierarchy (which would
|
|
77
|
+
// unmount the wrong, still-live view and crash the mounting layer).
|
|
78
|
+
//
|
|
79
|
+
// This must run before addOngoingAnimations (which would otherwise emit an
|
|
80
|
+
// Update for a tag we are about to Delete this frame) and before
|
|
81
|
+
// parseRemoveMutations, so the rest of the pipeline sees clean bookkeeping.
|
|
82
|
+
void LayoutAnimationsProxy_Legacy::reconcileContradictedRemovals(
|
|
83
|
+
ShadowViewMutationList &mutations,
|
|
84
|
+
ShadowViewMutationList &filteredMutations,
|
|
85
|
+
SurfaceId surfaceId) const {
|
|
86
|
+
auto &[deadNodes] = surfaceContext_[surfaceId];
|
|
87
|
+
for (auto &mutation : mutations) {
|
|
88
|
+
if (mutation.type != ShadowViewMutation::Type::Create && mutation.type != ShadowViewMutation::Type::Insert) {
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
auto tag = mutation.newChildShadowView.tag;
|
|
92
|
+
auto it = nodeForTag_.find(tag);
|
|
93
|
+
// Only a MutationNode represents a withheld removal; a plain Node is just a
|
|
94
|
+
// live parent of some removed child and must be left untouched.
|
|
95
|
+
if (it == nodeForTag_.end() || !it->second->isMutationNode()) {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
auto node = std::static_pointer_cast<MutationNode>(it->second);
|
|
99
|
+
// Flush the withheld Remove/Delete for this tag (and its withheld subtree)
|
|
100
|
+
// right now, mirroring the deadNodes cleanup in handleRemovals. This removes
|
|
101
|
+
// the stale view before React's Create/Insert re-registers the same tag.
|
|
102
|
+
endAnimationsRecursively(node, filteredMutations);
|
|
103
|
+
maybeDropAncestors(node->unflattenedParent, node, filteredMutations);
|
|
104
|
+
deadNodes.erase(node);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
67
108
|
std::optional<SurfaceId> LayoutAnimationsProxy_Legacy::progressLayoutAnimation(int tag, const jsi::Object &newStyle) {
|
|
68
109
|
#ifdef LAYOUT_ANIMATIONS_LOGS
|
|
69
110
|
LOG(INFO) << "progress layout animation for tag " << tag << std::endl;
|
|
@@ -111,11 +152,10 @@ std::optional<SurfaceId> LayoutAnimationsProxy_Legacy::endLayoutAnimation(int ta
|
|
|
111
152
|
// one after the other, so we need to keep count of how many
|
|
112
153
|
// were actually triggered, so that we don't cleanup necessary
|
|
113
154
|
// structures too early
|
|
114
|
-
if (layoutAnimation.count >
|
|
115
|
-
layoutAnimation.count--;
|
|
155
|
+
if (--layoutAnimation.count > 0) {
|
|
116
156
|
return {};
|
|
117
157
|
}
|
|
118
|
-
|
|
158
|
+
maybeSettledAnimationTags_.insert(tag);
|
|
119
159
|
auto surfaceId = layoutAnimation.finalView.surfaceId;
|
|
120
160
|
|
|
121
161
|
if (!shouldRemove || !nodeForTag_.contains(tag)) {
|
|
@@ -123,8 +163,12 @@ std::optional<SurfaceId> LayoutAnimationsProxy_Legacy::endLayoutAnimation(int ta
|
|
|
123
163
|
}
|
|
124
164
|
|
|
125
165
|
auto node = nodeForTag_[tag];
|
|
166
|
+
if (!node->isMutationNode()) {
|
|
167
|
+
react_native_assert(false && "exiting tag must map to a MutationNode");
|
|
168
|
+
return {};
|
|
169
|
+
}
|
|
126
170
|
auto mutationNode = std::static_pointer_cast<MutationNode>(node);
|
|
127
|
-
mutationNode->state = DEAD;
|
|
171
|
+
mutationNode->state = ExitingState_Legacy::DEAD;
|
|
128
172
|
auto &[deadNodes] = surfaceContext_[surfaceId];
|
|
129
173
|
deadNodes.insert(mutationNode);
|
|
130
174
|
|
|
@@ -172,7 +216,7 @@ void LayoutAnimationsProxy_Legacy::parseRemoveMutations(
|
|
|
172
216
|
}
|
|
173
217
|
}
|
|
174
218
|
if (!deletedViews.contains(mutation.oldChildShadowView.tag)) {
|
|
175
|
-
mutationNode->state = MOVED;
|
|
219
|
+
mutationNode->state = ExitingState_Legacy::MOVED;
|
|
176
220
|
movedViews.insert_or_assign(mutation.oldChildShadowView.tag, -1);
|
|
177
221
|
}
|
|
178
222
|
nodeForTag_[tag] = mutationNode;
|
|
@@ -245,11 +289,11 @@ void LayoutAnimationsProxy_Legacy::handleRemovals(
|
|
|
245
289
|
if (!startAnimationsRecursively(node, true, shouldAnimate, false, filteredMutations)) {
|
|
246
290
|
filteredMutations.push_back(node->mutation);
|
|
247
291
|
node->unflattenedParent->removeChildFromUnflattenedTree(node); //???
|
|
248
|
-
if (node->state != MOVED) {
|
|
292
|
+
if (node->state != ExitingState_Legacy::MOVED) {
|
|
249
293
|
maybeCancelAnimation(node->tag);
|
|
250
294
|
filteredMutations.push_back(ShadowViewMutation::DeleteMutation(node->mutation.oldChildShadowView));
|
|
251
295
|
nodeForTag_.erase(node->tag);
|
|
252
|
-
node->state = DELETED;
|
|
296
|
+
node->state = ExitingState_Legacy::DELETED;
|
|
253
297
|
#ifdef LAYOUT_ANIMATIONS_LOGS
|
|
254
298
|
LOG(INFO) << "delete " << node->tag << std::endl;
|
|
255
299
|
#endif
|
|
@@ -258,7 +302,7 @@ void LayoutAnimationsProxy_Legacy::handleRemovals(
|
|
|
258
302
|
}
|
|
259
303
|
|
|
260
304
|
for (const auto &node : deadNodes) {
|
|
261
|
-
if (node->state != DELETED) {
|
|
305
|
+
if (node->state != ExitingState_Legacy::DELETED) {
|
|
262
306
|
endAnimationsRecursively(node, filteredMutations);
|
|
263
307
|
maybeDropAncestors(node->unflattenedParent, node, filteredMutations);
|
|
264
308
|
}
|
|
@@ -408,7 +452,13 @@ void LayoutAnimationsProxy_Legacy::addOngoingAnimations(SurfaceId surfaceId, Sha
|
|
|
408
452
|
|
|
409
453
|
auto layoutAnimationIt = layoutAnimations_.find(tag);
|
|
410
454
|
|
|
411
|
-
if (layoutAnimationIt == layoutAnimations_.end()
|
|
455
|
+
if (layoutAnimationIt == layoutAnimations_.end() ||
|
|
456
|
+
// A settled animation is normally cleaned up without applying further
|
|
457
|
+
// updates. The exception is a flaky entering animation whose opacity was
|
|
458
|
+
// never restored (the view wasn't mounted in time) - we still need to
|
|
459
|
+
// apply that pending opacity, otherwise the view stays invisible. Only
|
|
460
|
+
// entering animations carry an opacity value.
|
|
461
|
+
(layoutAnimationIt->second.isSettled() && !layoutAnimationIt->second.opacity.has_value())) {
|
|
412
462
|
continue;
|
|
413
463
|
}
|
|
414
464
|
|
|
@@ -429,12 +479,12 @@ void LayoutAnimationsProxy_Legacy::endAnimationsRecursively(
|
|
|
429
479
|
const std::shared_ptr<MutationNode> &node,
|
|
430
480
|
ShadowViewMutationList &mutations) const {
|
|
431
481
|
maybeCancelAnimation(node->tag);
|
|
432
|
-
node->state = DELETED;
|
|
482
|
+
node->state = ExitingState_Legacy::DELETED;
|
|
433
483
|
// iterate from the end, so that children
|
|
434
484
|
// with higher indices appear first in the mutations list
|
|
435
485
|
for (auto it = node->unflattenedChildren.rbegin(); it != node->unflattenedChildren.rend(); it++) {
|
|
436
486
|
auto &subNode = *it;
|
|
437
|
-
if (subNode->state != DELETED) {
|
|
487
|
+
if (subNode->state != ExitingState_Legacy::DELETED) {
|
|
438
488
|
endAnimationsRecursively(subNode, mutations);
|
|
439
489
|
}
|
|
440
490
|
}
|
|
@@ -457,11 +507,11 @@ void LayoutAnimationsProxy_Legacy::maybeDropAncestors(
|
|
|
457
507
|
|
|
458
508
|
auto node = std::static_pointer_cast<MutationNode>(parent);
|
|
459
509
|
|
|
460
|
-
if (node->children.size() == 0 && node->state != ANIMATING) {
|
|
510
|
+
if (node->children.size() == 0 && node->state != ExitingState_Legacy::ANIMATING) {
|
|
461
511
|
nodeForTag_.erase(node->tag);
|
|
462
512
|
cleanupMutations.push_back(node->mutation);
|
|
463
513
|
maybeCancelAnimation(node->tag);
|
|
464
|
-
node->state = DELETED;
|
|
514
|
+
node->state = ExitingState_Legacy::DELETED;
|
|
465
515
|
#ifdef LAYOUT_ANIMATIONS_LOGS
|
|
466
516
|
LOG(INFO) << "delete " << node->tag << std::endl;
|
|
467
517
|
#endif
|
|
@@ -492,7 +542,7 @@ bool LayoutAnimationsProxy_Legacy::startAnimationsRecursively(
|
|
|
492
542
|
bool hasAnimatedChildren = false;
|
|
493
543
|
|
|
494
544
|
shouldRemoveSubviewsWithoutAnimations =
|
|
495
|
-
shouldRemoveSubviewsWithoutAnimations && (!hasExitAnimation || node->state == MOVED);
|
|
545
|
+
shouldRemoveSubviewsWithoutAnimations && (!hasExitAnimation || node->state == ExitingState_Legacy::MOVED);
|
|
496
546
|
std::vector<std::shared_ptr<MutationNode>> toBeRemoved;
|
|
497
547
|
|
|
498
548
|
// iterate from the end, so that children
|
|
@@ -503,8 +553,8 @@ bool LayoutAnimationsProxy_Legacy::startAnimationsRecursively(
|
|
|
503
553
|
LOG(INFO) << "child " << subNode->tag << " "
|
|
504
554
|
<< " " << shouldAnimate << " " << shouldRemoveSubviewsWithoutAnimations << std::endl;
|
|
505
555
|
#endif
|
|
506
|
-
if (subNode->state != UNDEFINED && subNode->state != MOVED) {
|
|
507
|
-
if (shouldAnimate && subNode->state != DEAD) {
|
|
556
|
+
if (subNode->state != ExitingState_Legacy::UNDEFINED && subNode->state != ExitingState_Legacy::MOVED) {
|
|
557
|
+
if (shouldAnimate && subNode->state != ExitingState_Legacy::DEAD) {
|
|
508
558
|
hasAnimatedChildren = true;
|
|
509
559
|
} else {
|
|
510
560
|
endAnimationsRecursively(subNode, mutations);
|
|
@@ -516,21 +566,21 @@ bool LayoutAnimationsProxy_Legacy::startAnimationsRecursively(
|
|
|
516
566
|
LOG(INFO) << "child " << subNode->tag << " start animations returned true " << std::endl;
|
|
517
567
|
#endif
|
|
518
568
|
hasAnimatedChildren = true;
|
|
519
|
-
} else if (subNode->state == MOVED) {
|
|
569
|
+
} else if (subNode->state == ExitingState_Legacy::MOVED) {
|
|
520
570
|
mutations.push_back(subNode->mutation);
|
|
521
571
|
toBeRemoved.push_back(subNode);
|
|
522
572
|
} else if (shouldRemoveSubviewsWithoutAnimations) {
|
|
523
573
|
maybeCancelAnimation(subNode->tag);
|
|
524
574
|
mutations.push_back(subNode->mutation);
|
|
525
575
|
toBeRemoved.push_back(subNode);
|
|
526
|
-
subNode->state = DELETED;
|
|
576
|
+
subNode->state = ExitingState_Legacy::DELETED;
|
|
527
577
|
nodeForTag_.erase(subNode->tag);
|
|
528
578
|
#ifdef LAYOUT_ANIMATIONS_LOGS
|
|
529
579
|
LOG(INFO) << "delete " << subNode->tag << std::endl;
|
|
530
580
|
#endif
|
|
531
581
|
mutations.push_back(ShadowViewMutation::DeleteMutation(subNode->mutation.oldChildShadowView));
|
|
532
582
|
} else {
|
|
533
|
-
subNode->state = WAITING;
|
|
583
|
+
subNode->state = ExitingState_Legacy::WAITING;
|
|
534
584
|
}
|
|
535
585
|
}
|
|
536
586
|
|
|
@@ -538,7 +588,7 @@ bool LayoutAnimationsProxy_Legacy::startAnimationsRecursively(
|
|
|
538
588
|
node->removeChildFromUnflattenedTree(subNode);
|
|
539
589
|
}
|
|
540
590
|
|
|
541
|
-
if (node->state == MOVED) {
|
|
591
|
+
if (node->state == ExitingState_Legacy::MOVED) {
|
|
542
592
|
auto replacement = std::make_shared<Node>(*node);
|
|
543
593
|
for (const auto &subNode : node->children) {
|
|
544
594
|
subNode->parent = replacement;
|
|
@@ -553,7 +603,7 @@ bool LayoutAnimationsProxy_Legacy::startAnimationsRecursively(
|
|
|
553
603
|
bool wantAnimateExit = hasExitAnimation || hasAnimatedChildren;
|
|
554
604
|
|
|
555
605
|
if (hasExitAnimation) {
|
|
556
|
-
node->state = ANIMATING;
|
|
606
|
+
node->state = ExitingState_Legacy::ANIMATING;
|
|
557
607
|
startExitingAnimation(node->tag, node->mutation);
|
|
558
608
|
} else {
|
|
559
609
|
layoutAnimationsManager_->clearLayoutAnimationConfig(node->tag);
|
|
@@ -635,38 +685,60 @@ void LayoutAnimationsProxy_Legacy::startEnteringAnimation(const int tag, ShadowV
|
|
|
635
685
|
|
|
636
686
|
auto &viewProps = static_cast<const ViewProps &>(*mutation.newChildShadowView.props);
|
|
637
687
|
auto opacity = viewProps.opacity;
|
|
688
|
+
#ifdef ANDROID
|
|
689
|
+
const auto handle = pendingStarts_[tag].handle;
|
|
690
|
+
pendingStarts_[tag].count++;
|
|
691
|
+
#endif
|
|
638
692
|
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
693
|
+
scheduleOnUI(
|
|
694
|
+
uiScheduler_,
|
|
695
|
+
[weakThis = weak_from_this(),
|
|
696
|
+
finalView,
|
|
697
|
+
current,
|
|
698
|
+
mutation,
|
|
699
|
+
opacity,
|
|
700
|
+
tag
|
|
701
|
+
#ifdef ANDROID
|
|
702
|
+
,
|
|
703
|
+
handle
|
|
704
|
+
#endif
|
|
705
|
+
]() {
|
|
706
|
+
auto strongThis = weakThis.lock();
|
|
707
|
+
if (!strongThis) {
|
|
708
|
+
return;
|
|
709
|
+
}
|
|
644
710
|
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
tag,
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
711
|
+
Rect window{};
|
|
712
|
+
{
|
|
713
|
+
auto &mutex = strongThis->mutex;
|
|
714
|
+
auto lock = std::unique_lock<std::recursive_mutex>(mutex);
|
|
715
|
+
#ifdef ANDROID
|
|
716
|
+
if (consumeIsCancelled(strongThis->pendingStarts_, tag, handle)) {
|
|
717
|
+
// the view was removed before this start could run
|
|
718
|
+
return;
|
|
719
|
+
}
|
|
720
|
+
#endif
|
|
721
|
+
strongThis->layoutAnimations_.insert_or_assign(
|
|
722
|
+
tag,
|
|
723
|
+
LayoutAnimation{
|
|
724
|
+
.finalView = finalView, .currentView = current, .parentTag = mutation.parentTag, .opacity = opacity});
|
|
725
|
+
window = strongThis->surfaceManager.getWindow(mutation.newChildShadowView.surfaceId);
|
|
726
|
+
}
|
|
655
727
|
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
728
|
+
Snapshot values(mutation.newChildShadowView, window);
|
|
729
|
+
auto &uiRuntime = strongThis->uiRuntime_;
|
|
730
|
+
jsi::Object yogaValues(uiRuntime);
|
|
731
|
+
yogaValues.setProperty(uiRuntime, "targetOriginX", values.x);
|
|
732
|
+
yogaValues.setProperty(uiRuntime, "targetGlobalOriginX", values.x);
|
|
733
|
+
yogaValues.setProperty(uiRuntime, "targetOriginY", values.y);
|
|
734
|
+
yogaValues.setProperty(uiRuntime, "targetGlobalOriginY", values.y);
|
|
735
|
+
yogaValues.setProperty(uiRuntime, "targetWidth", values.width);
|
|
736
|
+
yogaValues.setProperty(uiRuntime, "targetHeight", values.height);
|
|
737
|
+
yogaValues.setProperty(uiRuntime, "windowWidth", values.windowWidth);
|
|
738
|
+
yogaValues.setProperty(uiRuntime, "windowHeight", values.windowHeight);
|
|
739
|
+
strongThis->layoutAnimationsManager_->startLayoutAnimation(
|
|
740
|
+
uiRuntime, tag, LayoutAnimationType::ENTERING, yogaValues);
|
|
741
|
+
});
|
|
670
742
|
}
|
|
671
743
|
|
|
672
744
|
void LayoutAnimationsProxy_Legacy::startExitingAnimation(const int tag, ShadowViewMutation &mutation) const {
|
|
@@ -674,38 +746,62 @@ void LayoutAnimationsProxy_Legacy::startExitingAnimation(const int tag, ShadowVi
|
|
|
674
746
|
LOG(INFO) << "start exiting animation for tag " << tag << std::endl;
|
|
675
747
|
#endif
|
|
676
748
|
auto surfaceId = mutation.oldChildShadowView.surfaceId;
|
|
749
|
+
#ifdef ANDROID
|
|
750
|
+
const auto handle = pendingStarts_[tag].handle;
|
|
751
|
+
pendingStarts_[tag].count++;
|
|
752
|
+
#endif
|
|
677
753
|
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
754
|
+
scheduleOnUI(
|
|
755
|
+
uiScheduler_,
|
|
756
|
+
[weakThis = weak_from_this(),
|
|
757
|
+
tag,
|
|
758
|
+
mutation,
|
|
759
|
+
surfaceId
|
|
760
|
+
#ifdef ANDROID
|
|
761
|
+
,
|
|
762
|
+
handle
|
|
763
|
+
#endif
|
|
764
|
+
]() {
|
|
765
|
+
auto strongThis = weakThis.lock();
|
|
766
|
+
if (!strongThis) {
|
|
767
|
+
return;
|
|
768
|
+
}
|
|
692
769
|
|
|
693
|
-
|
|
770
|
+
auto oldView = mutation.oldChildShadowView;
|
|
771
|
+
Rect window{};
|
|
772
|
+
{
|
|
773
|
+
auto &mutex = strongThis->mutex;
|
|
774
|
+
auto lock = std::unique_lock<std::recursive_mutex>(mutex);
|
|
775
|
+
#ifdef ANDROID
|
|
776
|
+
if (consumeIsCancelled(strongThis->pendingStarts_, tag, handle)) {
|
|
777
|
+
// the view was removed (e.g. its subtree was force-ended by a screen
|
|
778
|
+
// pop) before this start could run — its Remove+Delete are already on
|
|
779
|
+
// their way to the mounting layer, so starting the animation now
|
|
780
|
+
// would emit updates for a view that's about to be deleted
|
|
781
|
+
strongThis->layoutAnimationsManager_->clearLayoutAnimationConfig(tag);
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
#endif
|
|
785
|
+
strongThis->createLayoutAnimation(mutation, oldView, surfaceId, tag);
|
|
786
|
+
window = strongThis->surfaceManager.getWindow(surfaceId);
|
|
787
|
+
}
|
|
694
788
|
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
uiRuntime,
|
|
707
|
-
|
|
708
|
-
|
|
789
|
+
Snapshot values(oldView, window);
|
|
790
|
+
|
|
791
|
+
auto &uiRuntime = strongThis->uiRuntime_;
|
|
792
|
+
jsi::Object yogaValues(uiRuntime);
|
|
793
|
+
yogaValues.setProperty(uiRuntime, "currentOriginX", values.x);
|
|
794
|
+
yogaValues.setProperty(uiRuntime, "currentGlobalOriginX", values.x);
|
|
795
|
+
yogaValues.setProperty(uiRuntime, "currentOriginY", values.y);
|
|
796
|
+
yogaValues.setProperty(uiRuntime, "currentGlobalOriginY", values.y);
|
|
797
|
+
yogaValues.setProperty(uiRuntime, "currentWidth", values.width);
|
|
798
|
+
yogaValues.setProperty(uiRuntime, "currentHeight", values.height);
|
|
799
|
+
yogaValues.setProperty(uiRuntime, "windowWidth", values.windowWidth);
|
|
800
|
+
yogaValues.setProperty(uiRuntime, "windowHeight", values.windowHeight);
|
|
801
|
+
strongThis->layoutAnimationsManager_->startLayoutAnimation(
|
|
802
|
+
uiRuntime, tag, LayoutAnimationType::EXITING, yogaValues);
|
|
803
|
+
strongThis->layoutAnimationsManager_->clearLayoutAnimationConfig(tag);
|
|
804
|
+
});
|
|
709
805
|
}
|
|
710
806
|
|
|
711
807
|
void LayoutAnimationsProxy_Legacy::startLayoutAnimation(const int tag, const ShadowViewMutation &mutation) const {
|
|
@@ -713,43 +809,64 @@ void LayoutAnimationsProxy_Legacy::startLayoutAnimation(const int tag, const Sha
|
|
|
713
809
|
LOG(INFO) << "start layout animation for tag " << tag << std::endl;
|
|
714
810
|
#endif
|
|
715
811
|
auto surfaceId = mutation.oldChildShadowView.surfaceId;
|
|
812
|
+
#ifdef ANDROID
|
|
813
|
+
const auto handle = pendingStarts_[tag].handle;
|
|
814
|
+
pendingStarts_[tag].count++;
|
|
815
|
+
#endif
|
|
716
816
|
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
817
|
+
scheduleOnUI(
|
|
818
|
+
uiScheduler_,
|
|
819
|
+
[weakThis = weak_from_this(),
|
|
820
|
+
mutation,
|
|
821
|
+
surfaceId,
|
|
822
|
+
tag
|
|
823
|
+
#ifdef ANDROID
|
|
824
|
+
,
|
|
825
|
+
handle
|
|
826
|
+
#endif
|
|
827
|
+
]() {
|
|
828
|
+
auto strongThis = weakThis.lock();
|
|
829
|
+
if (!strongThis) {
|
|
830
|
+
return;
|
|
831
|
+
}
|
|
731
832
|
|
|
732
|
-
|
|
733
|
-
|
|
833
|
+
auto oldView = mutation.oldChildShadowView;
|
|
834
|
+
Rect window{};
|
|
835
|
+
{
|
|
836
|
+
auto &mutex = strongThis->mutex;
|
|
837
|
+
auto lock = std::unique_lock<std::recursive_mutex>(mutex);
|
|
838
|
+
#ifdef ANDROID
|
|
839
|
+
if (consumeIsCancelled(strongThis->pendingStarts_, tag, handle)) {
|
|
840
|
+
// the view was removed before this start could run
|
|
841
|
+
return;
|
|
842
|
+
}
|
|
843
|
+
#endif
|
|
844
|
+
strongThis->createLayoutAnimation(mutation, oldView, surfaceId, tag);
|
|
845
|
+
window = strongThis->surfaceManager.getWindow(surfaceId);
|
|
846
|
+
}
|
|
734
847
|
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
848
|
+
Snapshot currentValues(oldView, window);
|
|
849
|
+
Snapshot targetValues(mutation.newChildShadowView, window);
|
|
850
|
+
|
|
851
|
+
auto &uiRuntime = strongThis->uiRuntime_;
|
|
852
|
+
jsi::Object yogaValues(uiRuntime);
|
|
853
|
+
yogaValues.setProperty(uiRuntime, "currentOriginX", currentValues.x);
|
|
854
|
+
yogaValues.setProperty(uiRuntime, "currentGlobalOriginX", currentValues.x);
|
|
855
|
+
yogaValues.setProperty(uiRuntime, "currentOriginY", currentValues.y);
|
|
856
|
+
yogaValues.setProperty(uiRuntime, "currentGlobalOriginY", currentValues.y);
|
|
857
|
+
yogaValues.setProperty(uiRuntime, "currentWidth", currentValues.width);
|
|
858
|
+
yogaValues.setProperty(uiRuntime, "currentHeight", currentValues.height);
|
|
859
|
+
yogaValues.setProperty(uiRuntime, "targetOriginX", targetValues.x);
|
|
860
|
+
yogaValues.setProperty(uiRuntime, "targetGlobalOriginX", targetValues.x);
|
|
861
|
+
yogaValues.setProperty(uiRuntime, "targetOriginY", targetValues.y);
|
|
862
|
+
yogaValues.setProperty(uiRuntime, "targetGlobalOriginY", targetValues.y);
|
|
863
|
+
yogaValues.setProperty(uiRuntime, "targetWidth", targetValues.width);
|
|
864
|
+
yogaValues.setProperty(uiRuntime, "targetHeight", targetValues.height);
|
|
865
|
+
yogaValues.setProperty(uiRuntime, "windowWidth", targetValues.windowWidth);
|
|
866
|
+
yogaValues.setProperty(uiRuntime, "windowHeight", targetValues.windowHeight);
|
|
867
|
+
strongThis->layoutAnimationsManager_->startLayoutAnimation(
|
|
868
|
+
uiRuntime, tag, LayoutAnimationType::LAYOUT, yogaValues);
|
|
869
|
+
});
|
|
753
870
|
}
|
|
754
871
|
|
|
755
872
|
void LayoutAnimationsProxy_Legacy::updateOngoingAnimationTarget(const int tag, const ShadowViewMutation &mutation)
|
|
@@ -759,11 +876,18 @@ void LayoutAnimationsProxy_Legacy::updateOngoingAnimationTarget(const int tag, c
|
|
|
759
876
|
}
|
|
760
877
|
|
|
761
878
|
void LayoutAnimationsProxy_Legacy::maybeCancelAnimation(const int tag) const {
|
|
762
|
-
|
|
879
|
+
#ifdef ANDROID
|
|
880
|
+
// invalidate animation starts that are scheduled but haven't run yet
|
|
881
|
+
if (const auto it = pendingStarts_.find(tag); it != pendingStarts_.end()) {
|
|
882
|
+
it->second.handle++;
|
|
883
|
+
}
|
|
884
|
+
#endif
|
|
885
|
+
const auto layoutAnimationIt = layoutAnimations_.find(tag);
|
|
886
|
+
if (layoutAnimationIt == layoutAnimations_.end()) {
|
|
763
887
|
return;
|
|
764
888
|
}
|
|
765
|
-
layoutAnimations_.erase(
|
|
766
|
-
|
|
889
|
+
layoutAnimations_.erase(layoutAnimationIt);
|
|
890
|
+
scheduleOnUI(uiScheduler_, [weakThis = weak_from_this(), tag]() {
|
|
767
891
|
auto strongThis = weakThis.lock();
|
|
768
892
|
if (!strongThis) {
|
|
769
893
|
return;
|
|
@@ -824,15 +948,14 @@ void LayoutAnimationsProxy_Legacy::maybeUpdateWindowDimensions(
|
|
|
824
948
|
}
|
|
825
949
|
}
|
|
826
950
|
|
|
827
|
-
void Node::applyMutationToIndices(ShadowViewMutation mutation) {
|
|
951
|
+
void Node::applyMutationToIndices(const ShadowViewMutation &mutation) {
|
|
828
952
|
const auto parentTag = mutation.parentTag;
|
|
829
953
|
if (tag != parentTag) {
|
|
830
954
|
return;
|
|
831
955
|
}
|
|
832
956
|
|
|
833
957
|
int delta = mutation.type == ShadowViewMutation::Insert ? 1 : -1;
|
|
834
|
-
for (auto
|
|
835
|
-
const auto& child = *it;
|
|
958
|
+
for (const auto &child : std::views::reverse(children)) {
|
|
836
959
|
if (child->mutation.index < mutation.index) {
|
|
837
960
|
return;
|
|
838
961
|
}
|
|
@@ -841,8 +964,8 @@ void Node::applyMutationToIndices(ShadowViewMutation mutation) {
|
|
|
841
964
|
}
|
|
842
965
|
|
|
843
966
|
// Should only be called on unflattened parents
|
|
844
|
-
void Node::removeChildFromUnflattenedTree(std::shared_ptr<MutationNode> child) {
|
|
845
|
-
for (
|
|
967
|
+
void Node::removeChildFromUnflattenedTree(const std::shared_ptr<MutationNode> &child) {
|
|
968
|
+
for (size_t i = unflattenedChildren.size(); i-- > 0;) {
|
|
846
969
|
if (unflattenedChildren[i]->tag == child->tag) {
|
|
847
970
|
unflattenedChildren.erase(unflattenedChildren.begin() + i);
|
|
848
971
|
break;
|
|
@@ -850,7 +973,7 @@ void Node::removeChildFromUnflattenedTree(std::shared_ptr<MutationNode> child) {
|
|
|
850
973
|
}
|
|
851
974
|
|
|
852
975
|
auto &flattenedChildren = child->parent->children;
|
|
853
|
-
for (
|
|
976
|
+
for (size_t i = flattenedChildren.size(); i-- > 0;) {
|
|
854
977
|
if (flattenedChildren[i]->tag == child->tag) {
|
|
855
978
|
flattenedChildren.erase(flattenedChildren.begin() + i);
|
|
856
979
|
return;
|