react-native-reanimated 3.8.0 → 3.9.0-layout-animation-experimental
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/Common/cpp/Fabric/ShadowTreeCloner.cpp +5 -2
- package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.cpp +42 -32
- package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.h +5 -7
- package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.cpp +565 -0
- package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.h +74 -0
- package/Common/cpp/LayoutAnimations/LayoutAnimationsUtils.h +140 -0
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +216 -58
- package/Common/cpp/NativeModules/NativeReanimatedModule.h +32 -11
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +2 -17
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.h +6 -8
- package/Common/cpp/ReanimatedRuntime/RNRuntimeDecorator.cpp +3 -0
- package/Common/cpp/ReanimatedRuntime/WorkletRuntime.cpp +3 -4
- package/Common/cpp/ReanimatedRuntime/WorkletRuntimeDecorator.cpp +8 -3
- package/Common/cpp/SharedItems/Shareables.cpp +31 -5
- package/Common/cpp/SharedItems/Shareables.h +18 -2
- package/Common/cpp/Tools/JSScheduler.cpp +29 -5
- package/Common/cpp/Tools/JSScheduler.h +21 -4
- package/Common/cpp/Tools/PlatformDepMethodsHolder.h +6 -2
- package/Common/cpp/Tools/UIRuntimeDecorator.cpp +6 -0
- package/Common/cpp/Tools/UIRuntimeDecorator.h +1 -0
- package/android/CMakeLists.txt +3 -0
- package/android/build.gradle +17 -5
- package/android/src/main/cpp/NativeProxy.cpp +77 -12
- package/android/src/main/cpp/NativeProxy.h +35 -1
- package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +58 -19
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedPackage.java +7 -2
- package/android/src/{reactNativeVersionPatch/ReanimatedUIManager/latest → main/java}/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +5 -5
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +10 -6
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +18 -1
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/SharedTransitionManager.java +105 -17
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensor.java +2 -1
- package/android/src/paper/java/com/swmansion/reanimated/NativeReanimatedModuleSpec.java +37 -0
- package/android/src/{main/java/com/swmansion/reanimated → reactNativeVersionPatch/ReanimatedUIManager/73/com/swmansion}/ReanimatedModule.java +4 -3
- package/android/src/reactNativeVersionPatch/ReanimatedUIManager/{70 → 73}/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +1 -22
- package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/ReanimatedModule.java +176 -0
- package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +0 -26
- package/android/src/{fabric/java → reactNativeVersionPatch/RuntimeExecutor/73}/com/swmansion/reanimated/NativeProxy.java +16 -4
- package/android/src/reactNativeVersionPatch/RuntimeExecutor/latest/com/swmansion/reanimated/NativeProxy.java +143 -0
- package/apple/LayoutReanimation/REAAnimationsManager.h +3 -0
- package/apple/LayoutReanimation/REAAnimationsManager.m +11 -0
- package/apple/LayoutReanimation/REASharedTransitionManager.m +99 -23
- package/apple/LayoutReanimation/REASnapshot.h +1 -0
- package/apple/LayoutReanimation/REASnapshot.m +78 -37
- package/apple/REAModule.h +22 -2
- package/apple/REAModule.mm +97 -46
- package/apple/REANodesManager.h +3 -3
- package/apple/REANodesManager.mm +46 -22
- package/apple/native/NativeProxy.h +28 -2
- package/apple/native/NativeProxy.mm +65 -195
- package/apple/native/PlatformDepMethodsHolderImpl.h +59 -0
- package/apple/native/PlatformDepMethodsHolderImpl.mm +429 -0
- package/apple/sensor/ReanimatedSensor.m +5 -5
- package/lib/module/Animated.js.map +1 -1
- package/lib/module/ConfigHelper.js +1 -1
- package/lib/module/ConfigHelper.js.map +1 -1
- package/lib/module/animationBuilder.js +1 -0
- package/lib/module/animationBuilder.js.map +1 -1
- package/lib/module/createAnimatedComponent/InlinePropManager.js +4 -4
- package/lib/module/createAnimatedComponent/InlinePropManager.js.map +1 -1
- package/lib/module/createAnimatedComponent/JSPropsUpdater.js +9 -6
- package/lib/module/createAnimatedComponent/JSPropsUpdater.js.map +1 -1
- package/lib/module/createAnimatedComponent/JSPropsUpdater.web.js +11 -0
- package/lib/module/createAnimatedComponent/JSPropsUpdater.web.js.map +1 -0
- package/lib/module/createAnimatedComponent/PropsFilter.js +25 -9
- package/lib/module/createAnimatedComponent/PropsFilter.js.map +1 -1
- package/lib/module/createAnimatedComponent/commonTypes.js.map +1 -1
- package/lib/module/createAnimatedComponent/createAnimatedComponent.js +83 -52
- package/lib/module/createAnimatedComponent/createAnimatedComponent.js.map +1 -1
- package/lib/module/createAnimatedComponent/getViewInfo.js +37 -0
- package/lib/module/createAnimatedComponent/getViewInfo.js.map +1 -0
- package/lib/module/createAnimatedComponent/index.js.map +1 -1
- package/lib/module/createAnimatedComponent/setAndForwardRef.js +4 -5
- package/lib/module/createAnimatedComponent/setAndForwardRef.js.map +1 -1
- package/lib/module/createAnimatedComponent/utils.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +1 -2
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/mock.js +12 -12
- package/lib/module/mock.js.map +1 -1
- package/lib/module/propsAllowlists.js.map +1 -1
- package/lib/module/reanimated2/Bezier.js.map +1 -1
- package/lib/module/reanimated2/Colors.js +4 -11
- package/lib/module/reanimated2/Colors.js.map +1 -1
- package/lib/module/reanimated2/Easing.js +3 -7
- package/lib/module/reanimated2/Easing.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +16 -13
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/index.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/index.web.js.map +1 -1
- package/lib/module/reanimated2/PlatformChecker.js +2 -1
- package/lib/module/reanimated2/PlatformChecker.js.map +1 -1
- package/lib/module/reanimated2/PropAdapters.js +1 -1
- package/lib/module/reanimated2/PropAdapters.js.map +1 -1
- package/lib/module/reanimated2/PropsRegistry.js +1 -2
- package/lib/module/reanimated2/PropsRegistry.js.map +1 -1
- package/lib/module/reanimated2/Sensor.js +2 -2
- package/lib/module/reanimated2/Sensor.js.map +1 -1
- package/lib/module/reanimated2/SensorContainer.js +2 -2
- package/lib/module/reanimated2/SensorContainer.js.map +1 -1
- package/lib/module/reanimated2/UpdateLayoutAnimations.js +30 -8
- package/lib/module/reanimated2/UpdateLayoutAnimations.js.map +1 -1
- package/lib/module/reanimated2/UpdateProps.js.map +1 -1
- package/lib/module/reanimated2/ViewDescriptorsSet.js.map +1 -1
- package/lib/module/reanimated2/WorkletEventHandler.js +74 -31
- package/lib/module/reanimated2/WorkletEventHandler.js.map +1 -1
- package/lib/module/reanimated2/animation/clamp.js.map +1 -1
- package/lib/module/reanimated2/animation/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/animation/decay/decay.js.map +1 -1
- package/lib/module/reanimated2/animation/decay/index.js.map +1 -1
- package/lib/module/reanimated2/animation/decay/rigidDecay.js.map +1 -1
- package/lib/module/reanimated2/animation/decay/rubberBandDecay.js.map +1 -1
- package/lib/module/reanimated2/animation/decay/utils.js.map +1 -1
- package/lib/module/reanimated2/animation/delay.js.map +1 -1
- package/lib/module/reanimated2/animation/index.js.map +1 -1
- package/lib/module/reanimated2/animation/repeat.js +1 -6
- package/lib/module/reanimated2/animation/repeat.js.map +1 -1
- package/lib/module/reanimated2/animation/sequence.js +1 -5
- package/lib/module/reanimated2/animation/sequence.js.map +1 -1
- package/lib/module/reanimated2/animation/spring.js.map +1 -1
- package/lib/module/reanimated2/animation/springUtils.js +8 -10
- package/lib/module/reanimated2/animation/springUtils.js.map +1 -1
- package/lib/module/reanimated2/animation/styleAnimation.js +5 -4
- package/lib/module/reanimated2/animation/styleAnimation.js.map +1 -1
- package/lib/module/reanimated2/animation/timing.js +4 -1
- package/lib/module/reanimated2/animation/timing.js.map +1 -1
- package/lib/module/reanimated2/animation/transformationMatrix/matrixUtils.js +1 -2
- package/lib/module/reanimated2/animation/transformationMatrix/matrixUtils.js.map +1 -1
- package/lib/module/reanimated2/animation/util.js +22 -2
- package/lib/module/reanimated2/animation/util.js.map +1 -1
- package/lib/module/reanimated2/commonTypes.js +3 -1
- package/lib/module/reanimated2/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/component/FlatList.js +1 -0
- package/lib/module/reanimated2/component/FlatList.js.map +1 -1
- package/lib/module/reanimated2/component/Image.js +1 -0
- package/lib/module/reanimated2/component/Image.js.map +1 -1
- package/lib/module/reanimated2/component/LayoutAnimationConfig.js +1 -0
- package/lib/module/reanimated2/component/LayoutAnimationConfig.js.map +1 -1
- package/lib/module/reanimated2/component/PerformanceMonitor.js +169 -0
- package/lib/module/reanimated2/component/PerformanceMonitor.js.map +1 -0
- package/lib/module/reanimated2/component/ScrollView.js +1 -0
- package/lib/module/reanimated2/component/ScrollView.js.map +1 -1
- package/lib/module/reanimated2/component/Text.js +1 -0
- package/lib/module/reanimated2/component/Text.js.map +1 -1
- package/lib/module/reanimated2/component/View.js +1 -0
- package/lib/module/reanimated2/component/View.js.map +1 -1
- package/lib/module/reanimated2/core.js +6 -15
- package/lib/module/reanimated2/core.js.map +1 -1
- package/lib/module/reanimated2/errors.js +8 -8
- package/lib/module/reanimated2/errors.js.map +1 -1
- package/lib/module/reanimated2/fabricUtils.js +33 -8
- package/lib/module/reanimated2/fabricUtils.js.map +1 -1
- package/lib/module/reanimated2/fabricUtils.web.js.map +1 -1
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js +2 -2
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -1
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
- package/lib/module/reanimated2/frameCallback/index.js.map +1 -1
- package/lib/module/reanimated2/globals.d.js.map +1 -1
- package/lib/module/reanimated2/helperTypes.js.map +1 -1
- package/lib/module/reanimated2/hook/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/hook/index.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js +1 -0
- package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +3 -4
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedProps.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedReaction.js +1 -0
- package/lib/module/reanimated2/hook/useAnimatedReaction.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedRef.js +12 -7
- package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js +3 -1
- package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedStyle.js +3 -6
- package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/module/reanimated2/hook/useDerivedValue.js +3 -1
- package/lib/module/reanimated2/hook/useDerivedValue.js.map +1 -1
- package/lib/module/reanimated2/hook/useEvent.js +4 -5
- package/lib/module/reanimated2/hook/useEvent.js.map +1 -1
- package/lib/module/reanimated2/hook/useFrameCallback.js +1 -2
- package/lib/module/reanimated2/hook/useFrameCallback.js.map +1 -1
- package/lib/module/reanimated2/hook/useHandler.js +3 -1
- package/lib/module/reanimated2/hook/useHandler.js.map +1 -1
- package/lib/module/reanimated2/hook/useReducedMotion.js.map +1 -1
- package/lib/module/reanimated2/hook/useScrollViewOffset.js +60 -16
- package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -1
- package/lib/module/reanimated2/hook/useSharedValue.js.map +1 -1
- package/lib/module/reanimated2/hook/useWorkletCallback.js.map +1 -1
- package/lib/module/reanimated2/hook/utils.js.map +1 -1
- package/lib/module/reanimated2/index.js +2 -0
- package/lib/module/reanimated2/index.js.map +1 -1
- package/lib/module/reanimated2/initializers.js +1 -5
- package/lib/module/reanimated2/initializers.js.map +1 -1
- package/lib/module/reanimated2/interpolateColor.js +2 -6
- package/lib/module/reanimated2/interpolateColor.js.map +1 -1
- package/lib/module/reanimated2/interpolation.js +1 -1
- package/lib/module/reanimated2/interpolation.js.map +1 -1
- package/lib/module/reanimated2/isSharedValue.js.map +1 -1
- package/lib/module/reanimated2/jestUtils.js +3 -6
- package/lib/module/reanimated2/jestUtils.js.map +1 -1
- package/lib/module/reanimated2/jestUtils.web.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js +5 -9
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/WebSensor.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/index.js +2 -2
- package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/react-native-web.d.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +4 -2
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +12 -11
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +12 -10
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js +11 -4
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +22 -22
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js +22 -22
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js +26 -26
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +10 -10
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +6 -6
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js +10 -10
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +18 -18
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js +18 -18
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +10 -10
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +34 -34
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +17 -4
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +4 -4
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +4 -4
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +4 -4
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +4 -4
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +4 -4
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/ProgressTransitionManager.js +16 -12
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/ProgressTransitionManager.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.js +13 -7
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Bounce.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Fade.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Flip.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Lightspeed.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Pinwheel.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Roll.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Rotate.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Slide.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Stretch.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Zoom.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animationParser.js +0 -2
- package/lib/module/reanimated2/layoutReanimation/web/animationParser.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animationsManager.js +1 -2
- package/lib/module/reanimated2/layoutReanimation/web/animationsManager.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/componentStyle.js +3 -1
- package/lib/module/reanimated2/layoutReanimation/web/componentStyle.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/componentUtils.js +6 -7
- package/lib/module/reanimated2/layoutReanimation/web/componentUtils.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/config.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/createAnimation.js +2 -2
- package/lib/module/reanimated2/layoutReanimation/web/createAnimation.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/domUtils.js +4 -4
- package/lib/module/reanimated2/layoutReanimation/web/domUtils.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/transition/Fading.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/transition/Linear.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/transition/Sequenced.web.js.map +1 -1
- package/lib/module/reanimated2/mappers.js +2 -4
- package/lib/module/reanimated2/mappers.js.map +1 -1
- package/lib/module/reanimated2/mockedRequestAnimationFrame.js.map +1 -1
- package/lib/module/reanimated2/mutables.js +2 -4
- package/lib/module/reanimated2/mutables.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/RNRenderer.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/RNRenderer.web.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/checkCppVersion.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/jsVersion.js +1 -1
- package/lib/module/reanimated2/platform-specific/jsVersion.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/dispatchCommand.js +2 -4
- package/lib/module/reanimated2/platformFunctions/dispatchCommand.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/dispatchCommand.web.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/getRelativeCoords.js +2 -2
- package/lib/module/reanimated2/platformFunctions/getRelativeCoords.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/index.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/measure.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/measure.web.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/scrollTo.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/scrollTo.web.js +1 -1
- package/lib/module/reanimated2/platformFunctions/scrollTo.web.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/setGestureState.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/setGestureState.web.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/setNativeProps.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/setNativeProps.web.js.map +1 -1
- package/lib/module/reanimated2/pluginUtils.js.map +1 -1
- package/lib/module/reanimated2/publicGlobals.js.map +1 -1
- package/lib/module/reanimated2/runtimes.js +11 -19
- package/lib/module/reanimated2/runtimes.js.map +1 -1
- package/lib/module/reanimated2/screenTransition/RNScreensTurboModule.js +20 -0
- package/lib/module/reanimated2/screenTransition/RNScreensTurboModule.js.map +1 -0
- package/lib/module/reanimated2/screenTransition/animationManager.js +41 -0
- package/lib/module/reanimated2/screenTransition/animationManager.js.map +1 -0
- package/lib/module/reanimated2/screenTransition/commonTypes.js +4 -0
- package/lib/module/reanimated2/screenTransition/commonTypes.js.map +1 -0
- package/lib/module/reanimated2/screenTransition/index.js +5 -0
- package/lib/module/reanimated2/screenTransition/index.js.map +1 -0
- package/lib/module/reanimated2/screenTransition/presets.js +157 -0
- package/lib/module/reanimated2/screenTransition/presets.js.map +1 -0
- package/lib/module/reanimated2/screenTransition/styleUpdater.js +62 -0
- package/lib/module/reanimated2/screenTransition/styleUpdater.js.map +1 -0
- package/lib/module/reanimated2/screenTransition/swipeSimulator.js +190 -0
- package/lib/module/reanimated2/screenTransition/swipeSimulator.js.map +1 -0
- package/lib/module/reanimated2/shareableMappingCache.js.map +1 -1
- package/lib/module/reanimated2/shareables.js +27 -10
- package/lib/module/reanimated2/shareables.js.map +1 -1
- package/lib/module/reanimated2/threads.js +9 -34
- package/lib/module/reanimated2/threads.js.map +1 -1
- package/lib/module/reanimated2/valueSetter.js +1 -2
- package/lib/module/reanimated2/valueSetter.js.map +1 -1
- package/lib/module/reanimated2/valueUnpacker.js +4 -3
- package/lib/module/reanimated2/valueUnpacker.js.map +1 -1
- package/lib/module/specs/NativeReanimatedModule.js +5 -0
- package/lib/module/specs/NativeReanimatedModule.js.map +1 -0
- package/lib/typescript/ConfigHelper.d.ts +1 -0
- package/lib/typescript/createAnimatedComponent/InlinePropManager.d.ts +1 -1
- package/lib/typescript/createAnimatedComponent/JSPropsUpdater.web.d.ts +6 -0
- package/lib/typescript/createAnimatedComponent/PropsFilter.d.ts +3 -0
- package/lib/typescript/createAnimatedComponent/getViewInfo.d.ts +9 -0
- package/lib/typescript/reanimated2/NativeReanimated/NativeReanimated.d.ts +8 -13
- package/lib/typescript/reanimated2/UpdateLayoutAnimations.d.ts +12 -1
- package/lib/typescript/reanimated2/WorkletEventHandler.d.ts +16 -9
- package/lib/typescript/reanimated2/animation/util.d.ts +2 -0
- package/lib/typescript/reanimated2/component/LayoutAnimationConfig.d.ts +1 -1
- package/lib/typescript/reanimated2/component/PerformanceMonitor.d.ts +2 -0
- package/lib/typescript/reanimated2/core.d.ts +3 -4
- package/lib/typescript/reanimated2/hook/commonTypes.d.ts +6 -0
- package/lib/typescript/reanimated2/hook/useEvent.d.ts +2 -3
- package/lib/typescript/reanimated2/hook/useScrollViewOffset.d.ts +3 -1
- package/lib/typescript/reanimated2/index.d.ts +3 -0
- package/lib/typescript/reanimated2/js-reanimated/JSReanimated.d.ts +2 -2
- package/lib/typescript/reanimated2/layoutReanimation/animationBuilder/commonTypes.d.ts +2 -1
- package/lib/typescript/reanimated2/layoutReanimation/sharedTransitions/ProgressTransitionManager.d.ts +2 -2
- package/lib/typescript/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.d.ts +2 -2
- package/lib/typescript/reanimated2/platform-specific/jsVersion.d.ts +1 -1
- package/lib/typescript/reanimated2/screenTransition/RNScreensTurboModule.d.ts +2 -0
- package/lib/typescript/reanimated2/screenTransition/animationManager.d.ts +3 -0
- package/lib/typescript/reanimated2/screenTransition/commonTypes.d.ts +38 -0
- package/lib/typescript/reanimated2/screenTransition/index.d.ts +3 -0
- package/lib/typescript/reanimated2/screenTransition/presets.d.ts +11 -0
- package/lib/typescript/reanimated2/screenTransition/styleUpdater.d.ts +3 -0
- package/lib/typescript/reanimated2/screenTransition/swipeSimulator.d.ts +2 -0
- package/lib/typescript/specs/NativeReanimatedModule.d.ts +6 -0
- package/package.json +29 -17
- package/plugin/build/plugin.js +7 -2
- package/src/ConfigHelper.ts +1 -1
- package/src/animationBuilder.tsx +2 -0
- package/src/createAnimatedComponent/InlinePropManager.ts +2 -2
- package/src/createAnimatedComponent/JSPropsUpdater.ts +7 -6
- package/src/createAnimatedComponent/JSPropsUpdater.web.ts +26 -0
- package/src/createAnimatedComponent/PropsFilter.tsx +31 -6
- package/src/createAnimatedComponent/createAnimatedComponent.tsx +108 -60
- package/src/createAnimatedComponent/getViewInfo.ts +39 -0
- package/src/mock.ts +13 -1
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +33 -35
- package/src/reanimated2/PlatformChecker.ts +3 -2
- package/src/reanimated2/PropsRegistry.ts +1 -3
- package/src/reanimated2/UpdateLayoutAnimations.ts +53 -13
- package/src/reanimated2/WorkletEventHandler.ts +98 -39
- package/src/reanimated2/animation/styleAnimation.ts +8 -6
- package/src/reanimated2/animation/timing.ts +9 -1
- package/src/reanimated2/animation/util.ts +28 -3
- package/src/reanimated2/commonTypes.ts +4 -1
- package/src/reanimated2/component/PerformanceMonitor.tsx +216 -0
- package/src/reanimated2/core.ts +9 -31
- package/src/reanimated2/errors.ts +1 -0
- package/src/reanimated2/fabricUtils.ts +43 -18
- package/src/reanimated2/globals.d.ts +11 -1
- package/src/reanimated2/hook/commonTypes.ts +10 -0
- package/src/reanimated2/hook/useAnimatedRef.ts +20 -11
- package/src/reanimated2/hook/useEvent.ts +4 -4
- package/src/reanimated2/hook/useScrollViewOffset.ts +94 -23
- package/src/reanimated2/index.ts +11 -0
- package/src/reanimated2/js-reanimated/JSReanimated.ts +7 -7
- package/src/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.ts +4 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/Keyframe.ts +9 -1
- package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +9 -1
- package/src/reanimated2/layoutReanimation/animationsManager.ts +10 -2
- package/src/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.ts +13 -0
- package/src/reanimated2/layoutReanimation/sharedTransitions/ProgressTransitionManager.ts +17 -8
- package/src/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.ts +26 -7
- package/src/reanimated2/layoutReanimation/web/animationsManager.ts +1 -1
- package/src/reanimated2/layoutReanimation/web/componentStyle.ts +3 -1
- package/src/reanimated2/layoutReanimation/web/componentUtils.ts +1 -1
- package/src/reanimated2/layoutReanimation/web/createAnimation.ts +2 -2
- package/src/reanimated2/platform-specific/jsVersion.ts +1 -1
- package/src/reanimated2/platformFunctions/getRelativeCoords.ts +2 -2
- package/src/reanimated2/screenTransition/RNScreensTurboModule.ts +29 -0
- package/src/reanimated2/screenTransition/animationManager.ts +45 -0
- package/src/reanimated2/screenTransition/commonTypes.ts +63 -0
- package/src/reanimated2/screenTransition/index.ts +12 -0
- package/src/reanimated2/screenTransition/presets.ts +137 -0
- package/src/reanimated2/screenTransition/styleUpdater.ts +73 -0
- package/src/reanimated2/screenTransition/swipeSimulator.ts +238 -0
- package/src/reanimated2/shareables.ts +29 -6
- package/src/reanimated2/valueUnpacker.ts +10 -3
- package/src/specs/NativeReanimatedModule.ts +9 -0
- package/android/src/reactNativeVersionPatch/ReanimatedUIManager/70/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +0 -16
- package/android/src/reactNativeVersionPatch/messageQueueThread/67/com/swmansion/reanimated/ReanimatedMessageQueueThread.java +0 -12
|
@@ -0,0 +1,565 @@
|
|
|
1
|
+
#include "LayoutAnimationsProxy.h"
|
|
2
|
+
#include <react/renderer/animations/utils.h>
|
|
3
|
+
#include <react/renderer/mounting/ShadowViewMutation.h>
|
|
4
|
+
#include "NativeReanimatedModule.h"
|
|
5
|
+
|
|
6
|
+
namespace reanimated {
|
|
7
|
+
|
|
8
|
+
std::optional<SurfaceId> LayoutAnimationsProxy::progressLayoutAnimation(int tag, const jsi::Object &newStyle) {
|
|
9
|
+
auto lock = std::unique_lock<std::recursive_mutex>(mutex);
|
|
10
|
+
LOG(INFO) << "progress layout animation for tag " << tag << std::endl;
|
|
11
|
+
auto layoutAnimationIt = layoutAnimations_.find(tag);
|
|
12
|
+
|
|
13
|
+
// TODO: investigate
|
|
14
|
+
if (layoutAnimationIt == layoutAnimations_.end() ||
|
|
15
|
+
bannedTags.contains(tag)) {
|
|
16
|
+
return {};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
auto &layoutAnimation = layoutAnimationIt->second;
|
|
20
|
+
auto &runtime = nativeReanimatedModule_->getUIRuntime();
|
|
21
|
+
|
|
22
|
+
if (layoutAnimation.opacity && !newStyle.hasProperty(runtime, "opacity")) {
|
|
23
|
+
newStyle.setProperty(runtime, "opacity", jsi::Value(*layoutAnimation.opacity));
|
|
24
|
+
layoutAnimation.opacity.reset();
|
|
25
|
+
}
|
|
26
|
+
auto rawProps =
|
|
27
|
+
std::make_shared<RawProps>(runtime, jsi::Value(runtime, newStyle));
|
|
28
|
+
|
|
29
|
+
PropsParserContext propsParserContext{layoutAnimation.end->surfaceId, *contextContainer_};
|
|
30
|
+
auto newProps = getComponentDescriptorForShadowView(*layoutAnimation.end).cloneProps(propsParserContext, layoutAnimations_.at(tag).end->props, std::move(*rawProps));
|
|
31
|
+
auto &updateMap = surfaceManager.getUpdateMap(layoutAnimation.end->surfaceId);
|
|
32
|
+
updateMap.insert_or_assign(tag, UpdateValues{newProps, Frame(runtime, newStyle)});
|
|
33
|
+
|
|
34
|
+
LOG(INFO) << "free lock" << std::endl;
|
|
35
|
+
return layoutAnimation.end->surfaceId;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
std::optional<SurfaceId> LayoutAnimationsProxy::endLayoutAnimation(int tag, bool shouldRemove) {
|
|
39
|
+
auto lock = std::unique_lock<std::recursive_mutex>(mutex);
|
|
40
|
+
LOG(INFO) << "end layout animation for " << tag << " - should remove "
|
|
41
|
+
<< shouldRemove << std::endl;
|
|
42
|
+
auto layoutAnimationIt = layoutAnimations_.find(tag);
|
|
43
|
+
|
|
44
|
+
// TODO: investigate
|
|
45
|
+
if (layoutAnimationIt == layoutAnimations_.end() ||
|
|
46
|
+
bannedTags.contains(tag)) {
|
|
47
|
+
return {};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
auto &layoutAnimation = layoutAnimationIt->second;
|
|
51
|
+
auto &cleanupMutations = surfaceManager.getCleanupMutations(layoutAnimation.end->surfaceId);
|
|
52
|
+
|
|
53
|
+
if (shouldRemove) {
|
|
54
|
+
if (nodeForTag.contains(tag)){
|
|
55
|
+
auto node = nodeForTag[tag];
|
|
56
|
+
auto mutationNode = std::static_pointer_cast<MutationNode>(node);
|
|
57
|
+
endAnimationsRecursively(mutationNode, cleanupMutations);
|
|
58
|
+
if (node->parent){
|
|
59
|
+
maybeDropAncestors(node->parent, mutationNode, cleanupMutations);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
auto &updateMap = surfaceManager.getUpdateMap(layoutAnimation.end->surfaceId);
|
|
64
|
+
auto surfaceId = layoutAnimation.end->surfaceId;
|
|
65
|
+
layoutAnimations_.erase(tag);
|
|
66
|
+
updateMap.erase(tag);
|
|
67
|
+
|
|
68
|
+
LOG(INFO) << "free lock" << std::endl;
|
|
69
|
+
return surfaceId;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
void LayoutAnimationsProxy::endAnimationsRecursively(std::shared_ptr<MutationNode> node, ShadowViewMutationList& mutations) const{
|
|
73
|
+
nodeForTag.erase(node->tag);
|
|
74
|
+
node->isDone = true;
|
|
75
|
+
for (auto it = node->children.rbegin(); it != node->children.rend(); it++) {
|
|
76
|
+
auto &subNode = *it;
|
|
77
|
+
if (!subNode->isDone) {
|
|
78
|
+
cancelAnimation(subNode->tag);
|
|
79
|
+
endAnimationsRecursively(subNode, mutations);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
mutations.push_back(node->mutation);
|
|
83
|
+
if (node->isExiting){
|
|
84
|
+
dropIndex(node->mutation.parentShadowView.tag, node->mutation.index);
|
|
85
|
+
}
|
|
86
|
+
updateIndices(node->mutation);
|
|
87
|
+
nodeForTag.erase(node->tag);
|
|
88
|
+
LOG(INFO) << "delete "<<node->tag<<std::endl;
|
|
89
|
+
mutations.push_back(ShadowViewMutation::DeleteMutation(node->mutation.oldChildShadowView));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
void LayoutAnimationsProxy::maybeDropAncestors(std::shared_ptr<Node> parent, std::shared_ptr<MutationNode> child, ShadowViewMutationList& cleanupMutations) const{
|
|
93
|
+
parent->removeChild(child);
|
|
94
|
+
if (parent->parent == nullptr){
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
auto node = std::static_pointer_cast<MutationNode>(parent);
|
|
99
|
+
node->animatedChildren.erase(child->tag);
|
|
100
|
+
|
|
101
|
+
if (node->animatedChildren.empty() && !node->isAnimatingExit){
|
|
102
|
+
for (auto subNode: node->children){
|
|
103
|
+
endAnimationsRecursively(subNode, cleanupMutations);
|
|
104
|
+
}
|
|
105
|
+
nodeForTag.erase(node->tag);
|
|
106
|
+
cleanupMutations.push_back(node->mutation);
|
|
107
|
+
if (layoutAnimations_.contains(node->tag)){
|
|
108
|
+
cancelAnimation(node->tag);
|
|
109
|
+
}
|
|
110
|
+
dropIndex(node->mutation.parentShadowView.tag, node->mutation.index);
|
|
111
|
+
updateIndices(node->mutation);
|
|
112
|
+
LOG(INFO) << "delete "<<node->tag<<std::endl;
|
|
113
|
+
cleanupMutations.push_back(ShadowViewMutation::DeleteMutation(node->mutation.oldChildShadowView));
|
|
114
|
+
maybeDropAncestors(node->parent, node, cleanupMutations);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const ComponentDescriptor &LayoutAnimationsProxy::getComponentDescriptorForShadowView(const ShadowView &shadowView) const {
|
|
119
|
+
return componentDescriptorRegistry_->at(shadowView.componentHandle);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
void LayoutAnimationsProxy::addOngoingAnimations(
|
|
123
|
+
SurfaceId surfaceId,
|
|
124
|
+
ShadowViewMutationList &mutations) const {
|
|
125
|
+
auto& updateMap = surfaceManager.getUpdateMap(surfaceId);
|
|
126
|
+
for (auto &[tag, updateValues] : updateMap) {
|
|
127
|
+
if (!layoutAnimations_.contains(tag)) {
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
auto &la = layoutAnimations_.at(tag);
|
|
131
|
+
auto &previous = la.current;
|
|
132
|
+
auto &finalView = la.end;
|
|
133
|
+
auto parent = la.parent;
|
|
134
|
+
auto newView = std::make_shared<ShadowView>(*finalView);
|
|
135
|
+
newView->props = updateValues.newProps;
|
|
136
|
+
auto frame = updateValues.frame;
|
|
137
|
+
updateLayoutMetrics(newView->layoutMetrics, frame);
|
|
138
|
+
|
|
139
|
+
mutations.push_back(ShadowViewMutation::UpdateMutation(*previous, *newView, parent));
|
|
140
|
+
la.current = newView;
|
|
141
|
+
}
|
|
142
|
+
updateMap.clear();
|
|
143
|
+
surfaceManager.consumeCleanupMutations(surfaceId, mutations);
|
|
144
|
+
std::stable_sort(mutations.begin(), mutations.end(), &shouldFirstComeBeforeSecondMutation);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
std::optional<MountingTransaction> LayoutAnimationsProxy::pullTransaction(
|
|
148
|
+
SurfaceId surfaceId,
|
|
149
|
+
MountingTransaction::Number transactionNumber,
|
|
150
|
+
const TransactionTelemetry &telemetry,
|
|
151
|
+
ShadowViewMutationList mutations) const {
|
|
152
|
+
LOG(INFO)<<"\n pullTransaction "<< std::this_thread::get_id()<<" "<<surfaceId<<std::endl;
|
|
153
|
+
auto lock = std::unique_lock<std::recursive_mutex>(mutex);
|
|
154
|
+
PropsParserContext propsParserContext{surfaceId, *contextContainer_};
|
|
155
|
+
ShadowViewMutationList filteredMutations;
|
|
156
|
+
|
|
157
|
+
std::vector<std::shared_ptr<MutationNode>> roots;
|
|
158
|
+
|
|
159
|
+
std::set<Tag> removedTags;
|
|
160
|
+
|
|
161
|
+
// TODO: filter reparentings
|
|
162
|
+
for (auto it = mutations.rbegin(); it != mutations.rend(); it++) {
|
|
163
|
+
auto &mutation = *it;
|
|
164
|
+
if (mutation.type == ShadowViewMutation::Delete){
|
|
165
|
+
removedTags.insert(mutation.oldChildShadowView.tag);
|
|
166
|
+
}
|
|
167
|
+
if (mutation.type == ShadowViewMutation::Remove && removedTags.contains(mutation.oldChildShadowView.tag)) {
|
|
168
|
+
updateIndexForMutation(mutation);
|
|
169
|
+
auto tag = mutation.oldChildShadowView.tag;
|
|
170
|
+
auto parentTag = mutation.parentShadowView.tag;
|
|
171
|
+
// auto parentTag = mutation.parentTag; TODO: uncomment
|
|
172
|
+
|
|
173
|
+
std::shared_ptr<MutationNode> mutationNode;
|
|
174
|
+
std::shared_ptr<Node> node = nodeForTag[tag], parent = nodeForTag[parentTag];
|
|
175
|
+
|
|
176
|
+
if (!node){
|
|
177
|
+
mutationNode = std::make_shared<MutationNode>(mutation);
|
|
178
|
+
} else {
|
|
179
|
+
mutationNode = std::make_shared<MutationNode>(mutation, std::move(*node));
|
|
180
|
+
for (auto subNode: mutationNode->children){
|
|
181
|
+
subNode->parent = mutationNode;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
nodeForTag[tag] = mutationNode;
|
|
185
|
+
|
|
186
|
+
if (!parent){
|
|
187
|
+
parent = std::make_shared<Node>(parentTag);
|
|
188
|
+
nodeForTag[parentTag] = parent;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (!parent->parent){
|
|
192
|
+
roots.push_back(mutationNode);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
parent->addChild(mutationNode);
|
|
196
|
+
mutationNode->parent = parent;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
for (auto it= roots.rbegin(); it != roots.rend(); it++) {
|
|
201
|
+
auto &node = *it;
|
|
202
|
+
if (!startAnimationsRecursively(node, true, true, filteredMutations)) {
|
|
203
|
+
if (layoutAnimations_.contains(node->tag)){
|
|
204
|
+
cancelAnimation(node->tag);
|
|
205
|
+
}
|
|
206
|
+
filteredMutations.push_back(node->mutation);
|
|
207
|
+
updateIndices(node->mutation);
|
|
208
|
+
nodeForTag.erase(node->tag);
|
|
209
|
+
node->parent->removeChild(node);
|
|
210
|
+
LOG(INFO) << "delete "<<node->tag<<std::endl;
|
|
211
|
+
filteredMutations.push_back(ShadowViewMutation::DeleteMutation(node->mutation.oldChildShadowView));
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
for (auto &mutation : mutations) {
|
|
216
|
+
if (mutation.parentShadowView.tag == surfaceId){
|
|
217
|
+
surfaceManager.updateWindow(surfaceId, mutation.parentShadowView.layoutMetrics.frame.size.width, mutation.parentShadowView.layoutMetrics.frame.size.height);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
Tag tag = mutation.type ==
|
|
221
|
+
ShadowViewMutation::Type::Create || mutation.type == ShadowViewMutation::Type::Insert ?
|
|
222
|
+
mutation.newChildShadowView.tag
|
|
223
|
+
: mutation.oldChildShadowView.tag;
|
|
224
|
+
|
|
225
|
+
switch (mutation.type) {
|
|
226
|
+
case ShadowViewMutation::Type::Create:{
|
|
227
|
+
filteredMutations.push_back(mutation);
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
case ShadowViewMutation::Type::Insert: {
|
|
231
|
+
updateIndexForMutation(mutation);
|
|
232
|
+
updateIndices(mutation);
|
|
233
|
+
transferConfigFromNativeTag(mutation.newChildShadowView.props->nativeId, mutation.newChildShadowView.tag);
|
|
234
|
+
|
|
235
|
+
if (!layoutAnimationsManager_->hasLayoutAnimation(tag, ENTERING)) {
|
|
236
|
+
filteredMutations.push_back(mutation);
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
startEnteringAnimation(tag, mutation);
|
|
241
|
+
filteredMutations.push_back(mutation);
|
|
242
|
+
|
|
243
|
+
// temporarily set opacity to 0 to prevent flickering on android
|
|
244
|
+
auto newView = std::make_shared<ShadowView>(mutation.newChildShadowView);
|
|
245
|
+
folly::dynamic opacity = folly::dynamic::object("opacity", 0);
|
|
246
|
+
auto newProps = getComponentDescriptorForShadowView(*newView).cloneProps(propsParserContext, newView->props, RawProps(opacity));
|
|
247
|
+
newView->props = newProps;
|
|
248
|
+
|
|
249
|
+
filteredMutations.push_back(ShadowViewMutation::UpdateMutation(mutation.newChildShadowView, *newView, mutation.parentShadowView));
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
case ShadowViewMutation::Type::Update: {
|
|
254
|
+
if (!layoutAnimationsManager_->hasLayoutAnimation(tag, LAYOUT)) {
|
|
255
|
+
filteredMutations.push_back(mutation);
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
startLayoutAnimation(tag, mutation);
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// REMOVE (w/o INSERT) -- animated exiting | delay mutation, mark the
|
|
263
|
+
// index as used by us
|
|
264
|
+
case ShadowViewMutation::Type::Remove: {
|
|
265
|
+
if (!removedTags.contains(mutation.oldChildShadowView.tag)){
|
|
266
|
+
updateIndexForMutation(mutation);
|
|
267
|
+
filteredMutations.push_back(mutation);
|
|
268
|
+
updateIndices(mutation);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
case ShadowViewMutation::Type::Delete: {
|
|
275
|
+
break;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// REMOVEDRELETETREE
|
|
279
|
+
default:
|
|
280
|
+
filteredMutations.push_back(mutation);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
addOngoingAnimations(surfaceId, filteredMutations);
|
|
285
|
+
|
|
286
|
+
LOG(INFO)<< "free lock" <<std::endl;
|
|
287
|
+
return MountingTransaction{surfaceId, transactionNumber, std::move(filteredMutations), telemetry};
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
bool LayoutAnimationsProxy::startAnimationsRecursively(std::shared_ptr<MutationNode> node, bool shouldRemoveSubviewsWithoutAnimations, bool shouldAnimate, ShadowViewMutationList& mutations) const{
|
|
291
|
+
shouldAnimate = layoutAnimationsManager_->shouldAnimateExiting(node->tag, shouldAnimate);
|
|
292
|
+
if (!std::strcmp(node->mutation.oldChildShadowView.componentName, "RNSScreenStack") || !std::strcmp(node->mutation.oldChildShadowView.componentName, "RNSScreen")){
|
|
293
|
+
shouldAnimate = false;
|
|
294
|
+
}
|
|
295
|
+
bool hasExitAnimation = shouldAnimate && layoutAnimationsManager_->hasLayoutAnimation(node->tag, LayoutAnimationType::EXITING);
|
|
296
|
+
bool hasAnimatedChildren = false;
|
|
297
|
+
|
|
298
|
+
shouldRemoveSubviewsWithoutAnimations = shouldRemoveSubviewsWithoutAnimations && !hasExitAnimation;
|
|
299
|
+
std::vector<std::shared_ptr<MutationNode>> toBeRemoved;
|
|
300
|
+
|
|
301
|
+
for (auto it = node->children.rbegin(); it != node->children.rend(); it++){
|
|
302
|
+
auto &subNode = *it;
|
|
303
|
+
LOG(INFO) << "child "<<subNode->tag<< " "<<subNode->isExiting<<" "<<shouldAnimate<<" "<<shouldRemoveSubviewsWithoutAnimations<< std::endl;
|
|
304
|
+
if (subNode->isExiting){
|
|
305
|
+
if (shouldAnimate){
|
|
306
|
+
node->animatedChildren.insert(subNode->tag);
|
|
307
|
+
hasAnimatedChildren = true;
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
cancelAnimation(subNode->tag);
|
|
311
|
+
endAnimationsRecursively(subNode, mutations);
|
|
312
|
+
}
|
|
313
|
+
} else if (startAnimationsRecursively(subNode, shouldRemoveSubviewsWithoutAnimations, shouldAnimate, mutations)) {
|
|
314
|
+
LOG(INFO) << "child "<<subNode->tag<< " start animations returned true "<<std::endl;
|
|
315
|
+
node->animatedChildren.insert(subNode->tag);
|
|
316
|
+
hasAnimatedChildren = true;
|
|
317
|
+
} else if (shouldRemoveSubviewsWithoutAnimations) {
|
|
318
|
+
if (layoutAnimations_.contains(subNode->tag)){
|
|
319
|
+
cancelAnimation(subNode->tag);
|
|
320
|
+
}
|
|
321
|
+
mutations.push_back(subNode->mutation);
|
|
322
|
+
toBeRemoved.push_back(subNode);
|
|
323
|
+
updateIndices(subNode->mutation);
|
|
324
|
+
nodeForTag.erase(subNode->tag);
|
|
325
|
+
LOG(INFO) << "delete "<<subNode->tag<<std::endl;
|
|
326
|
+
mutations.push_back(ShadowViewMutation::DeleteMutation(subNode->mutation.oldChildShadowView));
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
for (auto& subNode: toBeRemoved){
|
|
331
|
+
node->removeChild(subNode);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
bool wantAnimateExit = hasExitAnimation || hasAnimatedChildren;
|
|
335
|
+
|
|
336
|
+
if (hasExitAnimation) {
|
|
337
|
+
node->isAnimatingExit = true;
|
|
338
|
+
startExitingAnimation(node->tag, node->mutation);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
if (!wantAnimateExit) {
|
|
342
|
+
return false;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
node->isExiting = true;
|
|
346
|
+
takeIndex(node->mutation.parentShadowView.tag, node->mutation.index);
|
|
347
|
+
return true;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
void LayoutAnimationsProxy::updateIndexForMutation(
|
|
351
|
+
ShadowViewMutation &mutation) const {
|
|
352
|
+
if (mutation.index == -1) {
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
int k = mutation.index, i = 0;
|
|
356
|
+
|
|
357
|
+
int tag = mutation.type == ShadowViewMutation::Insert
|
|
358
|
+
? mutation.newChildShadowView.tag
|
|
359
|
+
: mutation.oldChildShadowView.tag;
|
|
360
|
+
|
|
361
|
+
if (!indices.contains(mutation.parentShadowView.tag)) {
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// !!!
|
|
366
|
+
while (true) {
|
|
367
|
+
if (indices.at(mutation.parentShadowView.tag)->contains(i)) {
|
|
368
|
+
i++;
|
|
369
|
+
continue;
|
|
370
|
+
}
|
|
371
|
+
if (!k) {
|
|
372
|
+
break;
|
|
373
|
+
}
|
|
374
|
+
k--;
|
|
375
|
+
i++;
|
|
376
|
+
}
|
|
377
|
+
LOG(INFO)<<"update index for "<<tag<<" in "<<mutation.parentShadowView.tag<<": "<<mutation.index<<" -> "<<i<<std::endl;
|
|
378
|
+
mutation.index = i;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
void LayoutAnimationsProxy::updateIndices(ShadowViewMutation &mutation) const {
|
|
382
|
+
int delta = mutation.type == ShadowViewMutation::Insert ? 1 : -1;
|
|
383
|
+
if (!indices.contains(mutation.parentShadowView.tag)) {
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
auto &s = *indices.at(mutation.parentShadowView.tag);
|
|
388
|
+
auto newS = std::make_shared<std::unordered_set<int>>();
|
|
389
|
+
LOG(INFO)<<"updating indices of "<<mutation.parentShadowView.tag<<"'s children after index "<<mutation.index<<std::endl;
|
|
390
|
+
std::vector<std::shared_ptr<MutationNode>> nodesToFix;
|
|
391
|
+
for (auto i : s) {
|
|
392
|
+
if (i < mutation.index) {
|
|
393
|
+
newS->insert(i);
|
|
394
|
+
} else {
|
|
395
|
+
for (auto &[tag, node] : nodeForTag) {
|
|
396
|
+
if (!node->parent){
|
|
397
|
+
continue;
|
|
398
|
+
}
|
|
399
|
+
auto mutationNode = std::static_pointer_cast<MutationNode>(node);
|
|
400
|
+
if (mutationNode->mutation.parentShadowView.tag == mutation.parentShadowView.tag && mutationNode->mutation.index == i) {
|
|
401
|
+
// !!!
|
|
402
|
+
nodesToFix.push_back(mutationNode);
|
|
403
|
+
break;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
newS->insert(i + delta);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
for (auto node : nodesToFix) {
|
|
410
|
+
LOG(INFO)<<"tag "<<node->mutation.oldChildShadowView.tag<<" index "<<node->mutation.index<<" -> "<<node->mutation.index + delta<<std::endl;
|
|
411
|
+
node->mutation.index += delta;
|
|
412
|
+
}
|
|
413
|
+
indices.insert_or_assign(mutation.parentShadowView.tag, newS);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
void LayoutAnimationsProxy::takeIndex(Tag parentTag, int index) const {
|
|
417
|
+
LOG(INFO)<<"take index "<<index<<" in parent "<<parentTag<<std::endl;
|
|
418
|
+
if (!indices.contains(parentTag)) {
|
|
419
|
+
indices.insert_or_assign(
|
|
420
|
+
parentTag, std::make_shared<std::unordered_set<int>>());
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
indices.at(parentTag)->insert(index);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
void LayoutAnimationsProxy::dropIndex(Tag parentTag, int index) const {
|
|
427
|
+
LOG(INFO)<<"drop index "<<index<<" in parent "<<parentTag<<std::endl;
|
|
428
|
+
if (!indices.contains(parentTag)) {
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
indices.at(parentTag)->erase(index);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
bool LayoutAnimationsProxy::shouldOverridePullTransaction() const {
|
|
436
|
+
return true;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
void LayoutAnimationsProxy::startEnteringAnimation(const int tag, ShadowViewMutation& mutation) const {
|
|
440
|
+
LOG(INFO)<<"start entering animation for tag "<<tag<<std::endl;
|
|
441
|
+
auto finalView = std::make_shared<ShadowView>(mutation.newChildShadowView);
|
|
442
|
+
auto current = std::make_shared<ShadowView>(mutation.oldChildShadowView);
|
|
443
|
+
auto& viewProps = static_cast<const ViewProps&>(*mutation.newChildShadowView.props);
|
|
444
|
+
LayoutAnimation la{
|
|
445
|
+
finalView,
|
|
446
|
+
current,
|
|
447
|
+
mutation.oldChildShadowView,
|
|
448
|
+
mutation.parentShadowView,
|
|
449
|
+
viewProps.opacity
|
|
450
|
+
};
|
|
451
|
+
layoutAnimations_.insert_or_assign(tag, la);
|
|
452
|
+
|
|
453
|
+
Snapshot values(mutation.newChildShadowView, surfaceManager.getWindow(mutation.newChildShadowView.surfaceId));
|
|
454
|
+
|
|
455
|
+
nativeReanimatedModule_->uiScheduler_->scheduleOnUI(
|
|
456
|
+
[values, this, tag]() {
|
|
457
|
+
jsi::Runtime &rt = nativeReanimatedModule_->getUIRuntime();
|
|
458
|
+
jsi::Object yogaValues(rt);
|
|
459
|
+
yogaValues.setProperty(rt, "targetOriginX", values.x);
|
|
460
|
+
yogaValues.setProperty(rt, "targetGlobalOriginX", values.x);
|
|
461
|
+
yogaValues.setProperty(rt, "targetOriginY", values.y);
|
|
462
|
+
yogaValues.setProperty(rt, "targetGlobalOriginY", values.y);
|
|
463
|
+
yogaValues.setProperty(rt, "targetWidth", values.width);
|
|
464
|
+
yogaValues.setProperty(rt, "targetHeight", values.height);
|
|
465
|
+
yogaValues.setProperty(rt, "windowWidth", values.windowWidth);
|
|
466
|
+
yogaValues.setProperty(rt, "windowHeight", values.windowHeight);
|
|
467
|
+
nativeReanimatedModule_->layoutAnimationsManager().startLayoutAnimation(rt, tag, LayoutAnimationType::ENTERING, yogaValues);
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
void LayoutAnimationsProxy::startExitingAnimation(const int tag, ShadowViewMutation& mutation) const {
|
|
472
|
+
LOG(INFO)<<"start exiting animation for tag "<<tag<<std::endl;
|
|
473
|
+
auto finalView = std::make_shared<ShadowView>(mutation.oldChildShadowView);
|
|
474
|
+
auto current = std::make_shared<ShadowView>(mutation.oldChildShadowView);
|
|
475
|
+
LayoutAnimation la{
|
|
476
|
+
finalView,
|
|
477
|
+
current,
|
|
478
|
+
mutation.oldChildShadowView,
|
|
479
|
+
mutation.parentShadowView,
|
|
480
|
+
};
|
|
481
|
+
layoutAnimations_.insert_or_assign(mutation.oldChildShadowView.tag, la);
|
|
482
|
+
|
|
483
|
+
Snapshot values(mutation.oldChildShadowView, surfaceManager.getWindow(mutation.oldChildShadowView.surfaceId));
|
|
484
|
+
|
|
485
|
+
nativeReanimatedModule_->uiScheduler_->scheduleOnUI(
|
|
486
|
+
[values, this, tag]() {
|
|
487
|
+
jsi::Runtime &rt = nativeReanimatedModule_->getUIRuntime();
|
|
488
|
+
jsi::Object yogaValues(rt);
|
|
489
|
+
yogaValues.setProperty(rt, "currentOriginX", values.x);
|
|
490
|
+
yogaValues.setProperty(rt, "currentGlobalOriginX", values.x);
|
|
491
|
+
yogaValues.setProperty(rt, "currentOriginY", values.y);
|
|
492
|
+
yogaValues.setProperty(rt, "currentGlobalOriginY", values.y);
|
|
493
|
+
yogaValues.setProperty(rt, "currentWidth", values.width);
|
|
494
|
+
yogaValues.setProperty(rt, "currentHeight", values.height);
|
|
495
|
+
yogaValues.setProperty(rt, "windowWidth", values.windowWidth);
|
|
496
|
+
yogaValues.setProperty(rt, "windowHeight", values.windowHeight);
|
|
497
|
+
nativeReanimatedModule_->layoutAnimationsManager().startLayoutAnimation(rt, tag, LayoutAnimationType::EXITING, yogaValues);
|
|
498
|
+
layoutAnimationsManager_->clearLayoutAnimationConfig(tag);
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
void LayoutAnimationsProxy::startLayoutAnimation(const int tag, ShadowViewMutation& mutation) const {
|
|
503
|
+
LOG(INFO)<<"start layout animation for tag "<<tag<<std::endl;
|
|
504
|
+
auto &oldChild = mutation.oldChildShadowView;
|
|
505
|
+
auto surfaceId = mutation.newChildShadowView.surfaceId;
|
|
506
|
+
if (layoutAnimations_.contains(tag)) {
|
|
507
|
+
oldChild = *layoutAnimations_.at(tag).current;
|
|
508
|
+
}
|
|
509
|
+
auto finalView = std::make_shared<ShadowView>(mutation.newChildShadowView);
|
|
510
|
+
auto current = std::make_shared<ShadowView>(oldChild);
|
|
511
|
+
LayoutAnimation la{finalView, current, oldChild, mutation.parentShadowView};
|
|
512
|
+
layoutAnimations_.insert_or_assign(tag, la);
|
|
513
|
+
|
|
514
|
+
Snapshot currentValues(oldChild, surfaceManager.getWindow(surfaceId));
|
|
515
|
+
Snapshot targetValues(mutation.newChildShadowView, surfaceManager.getWindow(surfaceId));
|
|
516
|
+
|
|
517
|
+
nativeReanimatedModule_->uiScheduler_->scheduleOnUI(
|
|
518
|
+
[currentValues, targetValues, this, tag]() {
|
|
519
|
+
jsi::Runtime &rt = nativeReanimatedModule_->getUIRuntime();
|
|
520
|
+
jsi::Object yogaValues(rt);
|
|
521
|
+
yogaValues.setProperty(rt, "currentOriginX", currentValues.x);
|
|
522
|
+
yogaValues.setProperty(rt, "currentGlobalOriginX", currentValues.x);
|
|
523
|
+
yogaValues.setProperty(rt, "currentOriginY", currentValues.y);
|
|
524
|
+
yogaValues.setProperty(rt, "currentGlobalOriginY", currentValues.y);
|
|
525
|
+
yogaValues.setProperty(rt, "currentWidth", currentValues.width);
|
|
526
|
+
yogaValues.setProperty(rt, "currentHeight", currentValues.height);
|
|
527
|
+
yogaValues.setProperty(rt, "targetOriginX", targetValues.x);
|
|
528
|
+
yogaValues.setProperty(rt, "targetGlobalOriginX", targetValues.x);
|
|
529
|
+
yogaValues.setProperty(rt, "targetOriginY", targetValues.y);
|
|
530
|
+
yogaValues.setProperty(rt, "targetGlobalOriginY", targetValues.y);
|
|
531
|
+
yogaValues.setProperty(rt, "targetWidth", targetValues.width);
|
|
532
|
+
yogaValues.setProperty(rt, "targetHeight", targetValues.height);
|
|
533
|
+
yogaValues.setProperty(rt, "windowWidth", targetValues.windowWidth);
|
|
534
|
+
yogaValues.setProperty(rt, "windowHeight", targetValues.windowHeight);
|
|
535
|
+
nativeReanimatedModule_->layoutAnimationsManager().startLayoutAnimation(rt, tag, LayoutAnimationType::LAYOUT, yogaValues);
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
void LayoutAnimationsProxy::cancelAnimation(const int tag) const{
|
|
540
|
+
bannedTags.insert(tag);
|
|
541
|
+
nativeReanimatedModule_->uiScheduler_->scheduleOnUI(
|
|
542
|
+
[this, tag]() {
|
|
543
|
+
jsi::Runtime &rt = nativeReanimatedModule_->getUIRuntime();
|
|
544
|
+
nativeReanimatedModule_->layoutAnimationsManager().cancelLayoutAnimation(rt, tag);
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
void LayoutAnimationsProxy::transferConfigFromNativeTag(const std::string nativeIdString, const int tag) const{
|
|
549
|
+
if (nativeIdString.empty()){
|
|
550
|
+
return;
|
|
551
|
+
}
|
|
552
|
+
// TODO: handle exception
|
|
553
|
+
auto nativeId = stoi(nativeIdString);
|
|
554
|
+
std::shared_ptr<Shareable> config = nullptr;
|
|
555
|
+
{
|
|
556
|
+
auto lock = std::unique_lock<std::recursive_mutex>(nativeReanimatedModule_->layoutAnimationsManager_->animationsMutex_);
|
|
557
|
+
config = layoutAnimationsManager_->enteringAnimations_[nativeId];
|
|
558
|
+
if (config) {
|
|
559
|
+
layoutAnimationsManager_->enteringAnimations_.insert_or_assign(tag, config);
|
|
560
|
+
}
|
|
561
|
+
layoutAnimationsManager_->enteringAnimations_.erase(nativeId);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
} // namespace reanimated
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
#include "LayoutAnimationsManager.h"
|
|
3
|
+
#include "PropsRegistry.h"
|
|
4
|
+
#include <react/renderer/mounting/ShadowView.h>
|
|
5
|
+
|
|
6
|
+
#include <react/renderer/mounting/MountingOverrideDelegate.h>
|
|
7
|
+
#include <react/renderer/componentregistry/ComponentDescriptorFactory.h>
|
|
8
|
+
#include "LayoutAnimationsUtils.h"
|
|
9
|
+
|
|
10
|
+
namespace reanimated {
|
|
11
|
+
|
|
12
|
+
class NativeReanimatedModule;
|
|
13
|
+
|
|
14
|
+
using namespace facebook;
|
|
15
|
+
|
|
16
|
+
struct LayoutAnimation {
|
|
17
|
+
std::shared_ptr<ShadowView> end, current;
|
|
18
|
+
ShadowView start, parent;
|
|
19
|
+
std::optional<double> opacity;
|
|
20
|
+
LayoutAnimation& operator=(const LayoutAnimation& other){
|
|
21
|
+
this->end = other.end;
|
|
22
|
+
return *this;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
struct LayoutAnimationsProxy : public MountingOverrideDelegate{
|
|
27
|
+
mutable std::unordered_map<Tag, std::shared_ptr<Node>> nodeForTag;
|
|
28
|
+
mutable std::unordered_map<Tag, LayoutAnimation> layoutAnimations_;
|
|
29
|
+
mutable std::unordered_map<Tag, std::shared_ptr<std::unordered_set<int>>> indices;
|
|
30
|
+
mutable std::unordered_set<Tag> animatedTags;
|
|
31
|
+
mutable std::recursive_mutex mutex;
|
|
32
|
+
mutable std::unordered_set<Tag> bannedTags;
|
|
33
|
+
mutable SurfaceManager surfaceManager;
|
|
34
|
+
std::shared_ptr<std::map<Tag, std::string>> tagToNativeID_ = std::make_shared<std::map<Tag, std::string>>();
|
|
35
|
+
std::shared_ptr<LayoutAnimationsManager> layoutAnimationsManager_;
|
|
36
|
+
ContextContainer::Shared contextContainer_;
|
|
37
|
+
NativeReanimatedModule* nativeReanimatedModule_;
|
|
38
|
+
SharedComponentDescriptorRegistry componentDescriptorRegistry_;
|
|
39
|
+
LayoutAnimationsProxy(std::shared_ptr<LayoutAnimationsManager> layoutAnimationsManager_, NativeReanimatedModule* n, SharedComponentDescriptorRegistry componentDescriptorRegistry_, ContextContainer::Shared contextContainer_): layoutAnimationsManager_(layoutAnimationsManager_), contextContainer_(contextContainer_), nativeReanimatedModule_(n), componentDescriptorRegistry_(componentDescriptorRegistry_){}
|
|
40
|
+
|
|
41
|
+
void startEnteringAnimation(const int tag, ShadowViewMutation& mutation) const;
|
|
42
|
+
void startExitingAnimation(const int tag, ShadowViewMutation& mutation) const;
|
|
43
|
+
void startLayoutAnimation(const int tag, ShadowViewMutation& mutation) const;
|
|
44
|
+
|
|
45
|
+
void transferConfigFromNativeTag(const std::string nativeId, const int tag) const;
|
|
46
|
+
std::optional<SurfaceId> progressLayoutAnimation(int tag, const jsi::Object &newStyle);
|
|
47
|
+
std::optional<SurfaceId> endLayoutAnimation(int tag, bool shouldRemove);
|
|
48
|
+
void cancelAnimation(const int tag) const;
|
|
49
|
+
|
|
50
|
+
void addOngoingAnimations(SurfaceId surfaceId, ShadowViewMutationList& mutations) const;
|
|
51
|
+
|
|
52
|
+
void updateIndexForMutation(ShadowViewMutation &mutation) const;
|
|
53
|
+
void updateIndices(ShadowViewMutation &mutation) const;
|
|
54
|
+
void takeIndex(Tag parentTag, int index) const;
|
|
55
|
+
void dropIndex(Tag parentTag, int index) const;
|
|
56
|
+
|
|
57
|
+
void removeRecursively(std::shared_ptr<MutationNode> node, ShadowViewMutationList& mutations) const;
|
|
58
|
+
bool startAnimationsRecursively(std::shared_ptr<MutationNode> node, bool shouldRemoveSubviewsWithoutAnimations, bool shouldAnimate, ShadowViewMutationList& mutations) const;
|
|
59
|
+
void endAnimationsRecursively(std::shared_ptr<MutationNode> node, ShadowViewMutationList& mutations) const;
|
|
60
|
+
void maybeDropAncestors(std::shared_ptr<Node> node, std::shared_ptr<MutationNode> child, ShadowViewMutationList& cleanupMutations) const;
|
|
61
|
+
|
|
62
|
+
const ComponentDescriptor& getComponentDescriptorForShadowView(const ShadowView& shadowView) const;
|
|
63
|
+
|
|
64
|
+
// MountingOverrideDelegate
|
|
65
|
+
|
|
66
|
+
bool shouldOverridePullTransaction() const override;
|
|
67
|
+
std::optional<MountingTransaction> pullTransaction(
|
|
68
|
+
SurfaceId surfaceId,
|
|
69
|
+
MountingTransaction::Number number,
|
|
70
|
+
const TransactionTelemetry& telemetry,
|
|
71
|
+
ShadowViewMutationList mutations) const override;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
}
|