react-native-reanimated 3.8.1 → 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.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 +3 -8
- 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/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/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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["JSReanimated","isWeb","PropsAllowlists","createReactDOMStyle","createTransformValue","createTextShadowValue","require","default","e","reanimatedJS","global","_makeShareableClone","Error","_scheduleOnJS","_scheduleOnRuntime","_updatePropsJS","updates","viewRef","isAnimatedProps","_component","component","rawStyles","Object","keys","reduce","acc","key","value","index","setNativeProps","undefined","style","updatePropsDOM","props","length","forEach","dashedKey","replace","m","toLowerCase","_touchableNode","setAttribute","componentName","className","console","warn","newProps","_component$setNativeP2","_component$setNativeP","uiProps","isNativeProp","call","previousStyle","currentStyle","domStyle","Array","isArray","transform","textShadowColor","textShadowRadius","textShadowOffset","textShadow","propName","NATIVE_THREAD_PROPS_WHITELIST"],"sources":["index.ts"],"sourcesContent":["'use strict';\nimport JSReanimated from './JSReanimated';\nimport type { StyleProps } from '../commonTypes';\nimport type { AnimatedStyle } from '../helperTypes';\nimport { isWeb } from '../PlatformChecker';\nimport { PropsAllowlists } from '../../propsAllowlists';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet createReactDOMStyle: (style: any) => any;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet createTransformValue: (transform: any) => any;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet createTextShadowValue: (style: any) => void | string;\n\nif (isWeb()) {\n try {\n createReactDOMStyle =\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n require('react-native-web/dist/exports/StyleSheet/compiler/createReactDOMStyle').default;\n } catch (e) {}\n\n try {\n // React Native Web 0.19+\n createTransformValue =\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n require('react-native-web/dist/exports/StyleSheet/preprocess').createTransformValue;\n } catch (e) {}\n\n try {\n createTextShadowValue =\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n require('react-native-web/dist/exports/StyleSheet/preprocess').createTextShadowValue;\n } catch (e) {}\n}\n\nconst reanimatedJS = new JSReanimated();\n\nglobal._makeShareableClone = () => {\n throw new Error(\n '[Reanimated] _makeShareableClone should never be called in JSReanimated.'\n );\n};\n\nglobal._scheduleOnJS = () => {\n throw new Error(\n '[Reanimated] _scheduleOnJS should never be called in JSReanimated.'\n );\n};\n\nglobal._scheduleOnRuntime = () => {\n throw new Error(\n '[Reanimated] _scheduleOnRuntime should never be called in JSReanimated.'\n );\n};\n\ninterface JSReanimatedComponent {\n previousStyle: StyleProps;\n setNativeProps?: (style: StyleProps) => void;\n style?: StyleProps;\n props: Record<string, string | number>;\n _touchableNode: {\n setAttribute: (key: string, props: unknown) => void;\n };\n}\n\nexport interface ReanimatedHTMLElement extends HTMLElement {\n previousStyle: StyleProps;\n setNativeProps?: (style: StyleProps) => void;\n props: Record<string, string | number>;\n _touchableNode: {\n setAttribute: (key: string, props: unknown) => void;\n };\n reanimatedDummy?: boolean;\n removedAfterAnimation?: boolean;\n}\n\nexport const _updatePropsJS = (\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n updates: StyleProps | AnimatedStyle<any>,\n viewRef: { _component?: JSReanimatedComponent | ReanimatedHTMLElement },\n isAnimatedProps?: boolean\n): void => {\n if (viewRef._component) {\n const component = viewRef._component;\n const [rawStyles] = Object.keys(updates).reduce(\n (acc: [StyleProps, AnimatedStyle<any>], key) => {\n const value = updates[key];\n const index = typeof value === 'function' ? 1 : 0;\n acc[index][key] = value;\n return acc;\n },\n [{}, {}]\n );\n\n if (typeof component.setNativeProps === 'function') {\n // This is the legacy way to update props on React Native Web <= 0.18.\n // Also, some components (e.g. from react-native-svg) don't have styles\n // and always provide setNativeProps function instead (even on React Native Web 0.19+).\n setNativeProps(component, rawStyles, isAnimatedProps);\n } else if (\n createReactDOMStyle !== undefined &&\n component.style !== undefined\n ) {\n // React Native Web 0.19+ no longer provides setNativeProps function,\n // so we need to update DOM nodes directly.\n updatePropsDOM(component, rawStyles, isAnimatedProps);\n } else if (Object.keys(component.props).length > 0) {\n Object.keys(component.props).forEach((key) => {\n if (!rawStyles[key]) {\n return;\n }\n const dashedKey = key.replace(/[A-Z]/g, (m) => '-' + m.toLowerCase());\n component._touchableNode.setAttribute(dashedKey, rawStyles[key]);\n });\n } else {\n const componentName =\n 'className' in component ? component?.className : '';\n console.warn(\n `[Reanimated] It's not possible to manipulate the component ${componentName}`\n );\n }\n }\n};\n\nconst setNativeProps = (\n component: JSReanimatedComponent | ReanimatedHTMLElement,\n newProps: StyleProps,\n isAnimatedProps?: boolean\n): void => {\n if (isAnimatedProps) {\n const uiProps: Record<string, unknown> = {};\n for (const key in newProps) {\n if (isNativeProp(key)) {\n uiProps[key] = newProps[key];\n }\n }\n // Only update UI props directly on the component,\n // other props can be updated as standard style props.\n component.setNativeProps?.(uiProps);\n }\n\n const previousStyle = component.previousStyle ? component.previousStyle : {};\n const currentStyle = { ...previousStyle, ...newProps };\n component.previousStyle = currentStyle;\n\n component.setNativeProps?.({ style: currentStyle });\n};\n\nconst updatePropsDOM = (\n component: JSReanimatedComponent | HTMLElement,\n style: StyleProps,\n isAnimatedProps?: boolean\n): void => {\n const previousStyle = (component as JSReanimatedComponent).previousStyle\n ? (component as JSReanimatedComponent).previousStyle\n : {};\n const currentStyle = { ...previousStyle, ...style };\n (component as JSReanimatedComponent).previousStyle = currentStyle;\n\n const domStyle = createReactDOMStyle(currentStyle);\n if (Array.isArray(domStyle.transform) && createTransformValue !== undefined) {\n domStyle.transform = createTransformValue(domStyle.transform);\n }\n\n if (\n createTextShadowValue !== undefined &&\n (domStyle.textShadowColor ||\n domStyle.textShadowRadius ||\n domStyle.textShadowOffset)\n ) {\n domStyle.textShadow = createTextShadowValue({\n textShadowColor: domStyle.textShadowColor,\n textShadowOffset: domStyle.textShadowOffset,\n textShadowRadius: domStyle.textShadowRadius,\n });\n }\n\n for (const key in domStyle) {\n if (isAnimatedProps) {\n (component as HTMLElement).setAttribute(key, domStyle[key]);\n } else {\n (component.style as StyleProps)[key] = domStyle[key];\n }\n }\n};\n\nfunction isNativeProp(propName: string): boolean {\n return !!PropsAllowlists.NATIVE_THREAD_PROPS_WHITELIST[propName];\n}\n\nexport default reanimatedJS;\n"],"mappings":"AAAA,YAAY;;AACZ,OAAOA,YAAY,MAAM,gBAAgB;AAGzC,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,eAAe,QAAQ,uBAAuB;;AAEvD;AACA,IAAIC,mBAAwC;AAC5C;AACA,IAAIC,oBAA6C;AACjD;AACA,IAAIC,qBAAoD;AAExD,IAAIJ,KAAK,EAAE,EAAE;EACX,IAAI;IACFE,mBAAmB;IACjB;IACAG,OAAO,CAAC,uEAAuE,CAAC,CAACC,OAAO;EAC5F,CAAC,CAAC,OAAOC,CAAC,EAAE,CAAC;EAEb,IAAI;IACF;IACAJ,oBAAoB;IAClB;IACAE,OAAO,CAAC,qDAAqD,CAAC,CAACF,oBAAoB;EACvF,CAAC,CAAC,OAAOI,CAAC,EAAE,CAAC;EAEb,IAAI;IACFH,qBAAqB;IACnB;IACAC,OAAO,CAAC,qDAAqD,CAAC,CAACD,qBAAqB;EACxF,CAAC,CAAC,OAAOG,CAAC,EAAE,CAAC;AACf;AAEA,MAAMC,YAAY,GAAG,IAAIT,YAAY,EAAE;AAEvCU,MAAM,CAACC,mBAAmB,GAAG,MAAM;EACjC,MAAM,I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W,KAAK,CAAgBL,GAAG,CAAC,GAAG4B,QAAQ,CAAC5B,GAAG,CAAC;IACtD;EACF;AACF,CAAC;AAED,SAASwB,YAAYA,CAACY,QAAgB,EAAW;EAC/C,OAAO,CAAC,CAAC5D,eAAe,CAAC6D,6BAA6B,CAACD,QAAQ,CAAC;AAClE;AAEA,eAAerD,YAAY"}
|
|
1
|
+
{"version":3,"names":["JSReanimated","isWeb","PropsAllowlists","createReactDOMStyle","createTransformValue","createTextShadowValue","require","default","e","reanimatedJS","global","_makeShareableClone","Error","_scheduleOnJS","_scheduleOnRuntime","_updatePropsJS","updates","viewRef","isAnimatedProps","_component","component","rawStyles","Object","keys","reduce","acc","key","value","index","setNativeProps","undefined","style","updatePropsDOM","props","length","forEach","dashedKey","replace","m","toLowerCase","_touchableNode","setAttribute","componentName","className","console","warn","newProps","_component$setNativeP2","_component$setNativeP","uiProps","isNativeProp","call","previousStyle","currentStyle","domStyle","Array","isArray","transform","textShadowColor","textShadowRadius","textShadowOffset","textShadow","propName","NATIVE_THREAD_PROPS_WHITELIST"],"sources":["index.ts"],"sourcesContent":["'use strict';\nimport JSReanimated from './JSReanimated';\nimport type { StyleProps } from '../commonTypes';\nimport type { AnimatedStyle } from '../helperTypes';\nimport { isWeb } from '../PlatformChecker';\nimport { PropsAllowlists } from '../../propsAllowlists';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet createReactDOMStyle: (style: any) => any;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet createTransformValue: (transform: any) => any;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet createTextShadowValue: (style: any) => void | string;\n\nif (isWeb()) {\n try {\n createReactDOMStyle =\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n require('react-native-web/dist/exports/StyleSheet/compiler/createReactDOMStyle').default;\n } catch (e) {}\n\n try {\n // React Native Web 0.19+\n createTransformValue =\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n require('react-native-web/dist/exports/StyleSheet/preprocess').createTransformValue;\n } catch (e) {}\n\n try {\n createTextShadowValue =\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n require('react-native-web/dist/exports/StyleSheet/preprocess').createTextShadowValue;\n } catch (e) {}\n}\n\nconst reanimatedJS = new JSReanimated();\n\nglobal._makeShareableClone = () => {\n throw new Error(\n '[Reanimated] _makeShareableClone should never be called in JSReanimated.'\n );\n};\n\nglobal._scheduleOnJS = () => {\n throw new Error(\n '[Reanimated] _scheduleOnJS should never be called in JSReanimated.'\n );\n};\n\nglobal._scheduleOnRuntime = () => {\n throw new Error(\n '[Reanimated] _scheduleOnRuntime should never be called in JSReanimated.'\n );\n};\n\ninterface JSReanimatedComponent {\n previousStyle: StyleProps;\n setNativeProps?: (style: StyleProps) => void;\n style?: StyleProps;\n props: Record<string, string | number>;\n _touchableNode: {\n setAttribute: (key: string, props: unknown) => void;\n };\n}\n\nexport interface ReanimatedHTMLElement extends HTMLElement {\n previousStyle: StyleProps;\n setNativeProps?: (style: StyleProps) => void;\n props: Record<string, string | number>;\n _touchableNode: {\n setAttribute: (key: string, props: unknown) => void;\n };\n reanimatedDummy?: boolean;\n removedAfterAnimation?: boolean;\n}\n\nexport const _updatePropsJS = (\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n updates: StyleProps | AnimatedStyle<any>,\n viewRef: { _component?: JSReanimatedComponent | ReanimatedHTMLElement },\n isAnimatedProps?: boolean\n): void => {\n if (viewRef._component) {\n const component = viewRef._component;\n const [rawStyles] = Object.keys(updates).reduce(\n (acc: [StyleProps, AnimatedStyle<any>], key) => {\n const value = updates[key];\n const index = typeof value === 'function' ? 1 : 0;\n acc[index][key] = value;\n return acc;\n },\n [{}, {}]\n );\n\n if (typeof component.setNativeProps === 'function') {\n // This is the legacy way to update props on React Native Web <= 0.18.\n // Also, some components (e.g. from react-native-svg) don't have styles\n // and always provide setNativeProps function instead (even on React Native Web 0.19+).\n setNativeProps(component, rawStyles, isAnimatedProps);\n } else if (\n createReactDOMStyle !== undefined &&\n component.style !== undefined\n ) {\n // React Native Web 0.19+ no longer provides setNativeProps function,\n // so we need to update DOM nodes directly.\n updatePropsDOM(component, rawStyles, isAnimatedProps);\n } else if (Object.keys(component.props).length > 0) {\n Object.keys(component.props).forEach((key) => {\n if (!rawStyles[key]) {\n return;\n }\n const dashedKey = key.replace(/[A-Z]/g, (m) => '-' + m.toLowerCase());\n component._touchableNode.setAttribute(dashedKey, rawStyles[key]);\n });\n } else {\n const componentName =\n 'className' in component ? component?.className : '';\n console.warn(\n `[Reanimated] It's not possible to manipulate the component ${componentName}`\n );\n }\n }\n};\n\nconst setNativeProps = (\n component: JSReanimatedComponent | ReanimatedHTMLElement,\n newProps: StyleProps,\n isAnimatedProps?: boolean\n): void => {\n if (isAnimatedProps) {\n const uiProps: Record<string, unknown> = {};\n for (const key in newProps) {\n if (isNativeProp(key)) {\n uiProps[key] = newProps[key];\n }\n }\n // Only update UI props directly on the component,\n // other props can be updated as standard style props.\n component.setNativeProps?.(uiProps);\n }\n\n const previousStyle = component.previousStyle ? component.previousStyle : {};\n const currentStyle = { ...previousStyle, ...newProps };\n component.previousStyle = currentStyle;\n\n component.setNativeProps?.({ style: currentStyle });\n};\n\nconst updatePropsDOM = (\n component: JSReanimatedComponent | HTMLElement,\n style: StyleProps,\n isAnimatedProps?: boolean\n): void => {\n const previousStyle = (component as JSReanimatedComponent).previousStyle\n ? (component as JSReanimatedComponent).previousStyle\n : {};\n const currentStyle = { ...previousStyle, ...style };\n (component as JSReanimatedComponent).previousStyle = currentStyle;\n\n const domStyle = createReactDOMStyle(currentStyle);\n if (Array.isArray(domStyle.transform) && createTransformValue !== undefined) {\n domStyle.transform = createTransformValue(domStyle.transform);\n }\n\n if (\n createTextShadowValue !== undefined &&\n (domStyle.textShadowColor ||\n domStyle.textShadowRadius ||\n domStyle.textShadowOffset)\n ) {\n domStyle.textShadow = createTextShadowValue({\n textShadowColor: domStyle.textShadowColor,\n textShadowOffset: domStyle.textShadowOffset,\n textShadowRadius: domStyle.textShadowRadius,\n });\n }\n\n for (const key in domStyle) {\n if (isAnimatedProps) {\n (component as HTMLElement).setAttribute(key, domStyle[key]);\n } else {\n (component.style as StyleProps)[key] = domStyle[key];\n }\n }\n};\n\nfunction isNativeProp(propName: string): boolean {\n return !!PropsAllowlists.NATIVE_THREAD_PROPS_WHITELIST[propName];\n}\n\nexport default reanimatedJS;\n"],"mappings":"AAAA,YAAY;;AACZ,OAAOA,YAAY,MAAM,gBAAgB;AAGzC,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,eAAe,QAAQ,uBAAuB;;AAEvD;AACA,IAAIC,mBAAwC;AAC5C;AACA,IAAIC,oBAA6C;AACjD;AACA,IAAIC,qBAAoD;AAExD,IAAIJ,KAAK,CAAC,CAAC,EAAE;EACX,IAAI;IACFE,mBAAmB;IACjB;IACAG,OAAO,CAAC,uEAAuE,CAAC,CAACC,OAAO;EAC5F,CAAC,CAAC,OAAOC,CAAC,EAAE,CAAC;EAEb,IAAI;IACF;IACAJ,oBAAoB;IAClB;IACAE,OAAO,CAAC,qDAAqD,CAAC,CAACF,oBAAoB;EACvF,CAAC,CAAC,OAAOI,CAAC,EAAE,CAAC;EAEb,IAAI;IACFH,qBAAqB;IACnB;IACAC,OAAO,CAAC,qDAAqD,CAAC,CAACD,qBAAqB;EACxF,CAAC,CAAC,OAAOG,CAAC,EAAE,CAAC;AACf;AAEA,MAAMC,YAAY,GAAG,IAAIT,YAAY,CAAC,CAAC;AAEvCU,MAAM,CAACC,mBAAmB,GAAG,MAAM;EACjC,MAAM,IAAIC,KAAK,CACb,0EACF,CAAC;AACH,CAAC;AAEDF,MAAM,CAACG,aAAa,GAAG,MAAM;EAC3B,MAAM,IAAID,KAAK,CACb,oEACF,CAAC;AACH,CAAC;AAEDF,MAAM,CAACI,kBAAkB,GAAG,MAAM;EAChC,MAAM,IAAIF,KAAK,CACb,yEACF,CAAC;AACH,CAAC;AAuBD,OAAO,MAAMG,cAAc,GAAGA,C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-
{"version":3,"names":[],"sources":["react-native-web.d.ts"],"sourcesContent":["'use strict';\ndeclare module 'react-native-web/dist/exports/StyleSheet/compiler/createReactDOMStyle';\ndeclare module 'react-native-web/dist/exports/StyleSheet/preprocess';\n"],"mappings":"AAAA,YAAY"}
|
|
1
|
+
{"version":3,"names":[],"sources":["react-native-web.d.ts"],"sourcesContent":["'use strict';\ndeclare module 'react-native-web/dist/exports/StyleSheet/compiler/createReactDOMStyle';\ndeclare module 'react-native-web/dist/exports/StyleSheet/preprocess';\n"],"mappings":"AAAA,YAAY","ignoreList":[]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var _BaseAnimationBuilder;
|
|
3
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
-
function _toPropertyKey(
|
|
5
|
-
function _toPrimitive(
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
7
|
import { withDelay } from '../../animation';
|
|
7
8
|
import { ReduceMotion } from '../../commonTypes';
|
|
8
9
|
import { getReduceMotionFromConfig } from '../../animation/util';
|
|
@@ -119,5 +120,6 @@ export class BaseAnimationBuilder {
|
|
|
119
120
|
return instance.build();
|
|
120
121
|
}
|
|
121
122
|
}
|
|
123
|
+
_BaseAnimationBuilder = BaseAnimationBuilder;
|
|
122
124
|
_defineProperty(BaseAnimationBuilder, "createInstance", void 0);
|
|
123
125
|
//# sourceMappingURL=BaseAnimationBuilder.js.map
|
package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","
|
|
1
|
+
{"version":3,"names":["_BaseAnimationBuilder","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","withDelay","ReduceMotion","getReduceMotionFromConfig","BaseAnimationBuilder","constructor","System","Error","duration","durationMs","instance","createInstance","durationV","delay","delayMs","delayV","withCallback","callback","callbackV","reduceMotion","reduceMotionV","getDuration","randomDelay","randomizeDelay","getDelay","Math","random","getReduceMotion","getDelayFunction","isDelayProvided","animation","_","build"],"sources":["BaseAnimationBuilder.ts"],"sourcesContent":["'use strict';\nimport { withDelay } from '../../animation';\nimport type {\n EntryExitAnimationFunction,\n AnimationFunction,\n LayoutAnimationFunction,\n} from './commonTypes';\n\nimport { ReduceMotion } from '../../commonTypes';\nimport { getReduceMotionFromConfig } from '../../animation/util';\n\nexport class BaseAnimationBuilder {\n durationV?: number;\n delayV?: number;\n reduceMotionV: ReduceMotion = ReduceMotion.System;\n randomizeDelay = false;\n callbackV?: (finished: boolean) => void;\n\n static createInstance: <T extends typeof BaseAnimationBuilder>(\n this: T\n ) => InstanceType<T>;\n\n build = (): EntryExitAnimationFunction | LayoutAnimationFunction => {\n throw new Error('[Reanimated] Unimplemented method in child class.');\n };\n\n /**\n * Lets you adjust the animation duration. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param durationMs - Length of the animation (in milliseconds).\n */\n static duration<T extends typeof BaseAnimationBuilder>(\n this: T,\n durationMs: number\n ): InstanceType<T> {\n const instance = this.createInstance();\n return instance.duration(durationMs);\n }\n\n duration(durationMs: number): this {\n this.durationV = durationMs;\n return this;\n }\n\n /**\n * Lets you adjust the delay before the animation starts (in milliseconds). Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param delayMs - Delay before the animation starts (in milliseconds).\n */\n static delay<T extends typeof BaseAnimationBuilder>(\n this: T,\n delayMs: number\n ): InstanceType<T> {\n const instance = this.createInstance();\n return instance.delay(delayMs);\n }\n\n delay(delayMs: number): this {\n this.delayV = delayMs;\n return this;\n }\n\n /**\n * The callback that will fire after the animation ends. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param callback - Callback that will fire after the animation ends.\n */\n static withCallback<T extends typeof BaseAnimationBuilder>(\n this: T,\n callback: (finished: boolean) => void\n ): InstanceType<T> {\n const instance = this.createInstance();\n return instance.withCallback(callback);\n }\n\n withCallback(callback: (finished: boolean) => void): this {\n this.callbackV = callback;\n return this;\n }\n\n /**\n * Lets you adjust the behavior when the device's reduced motion accessibility setting is turned on. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param reduceMotion - Determines how the animation responds to the device's reduced motion accessibility setting. Default to `ReduceMotion.System` - {@link ReduceMotion}.\n */\n static reduceMotion<T extends typeof BaseAnimationBuilder>(\n this: T,\n reduceMotion: ReduceMotion\n ): InstanceType<T> {\n const instance = this.createInstance();\n return instance.reduceMotion(reduceMotion);\n }\n\n reduceMotion(reduceMotionV: ReduceMotion): this {\n this.reduceMotionV = reduceMotionV;\n return this;\n }\n\n // 300ms is the default animation duration. If any animation has different default has to override this method.\n static getDuration(): number {\n return 300;\n }\n\n getDuration(): number {\n return this.durationV ?? 300;\n }\n\n /**\n * @deprecated Use `.delay()` with `Math.random()` instead\n */\n static randomDelay<T extends typeof BaseAnimationBuilder>(\n this: T\n ): InstanceType<T> {\n const instance = this.createInstance();\n return instance.randomDelay();\n }\n\n randomDelay(): this {\n this.randomizeDelay = true;\n return this;\n }\n\n // when randomizeDelay is set to true, randomize delay between 0 and provided value (or 1000ms if delay is not provided)\n getDelay(): number {\n return this.randomizeDelay\n ? Math.random() * (this.delayV ?? 1000)\n : this.delayV ?? 0;\n }\n\n getReduceMotion(): ReduceMotion {\n return this.reduceMotionV;\n }\n\n getDelayFunction(): AnimationFunction {\n const isDelayProvided = this.randomizeDelay || this.delayV;\n const reduceMotion = this.getReduceMotion();\n return isDelayProvided\n ? (delay, animation) => {\n 'worklet';\n return withDelay(delay, animation, reduceMotion);\n }\n : (_, animation) => {\n 'worklet';\n animation.reduceMotion = getReduceMotionFromConfig(reduceMotion);\n return animation;\n };\n }\n\n static build<T extends typeof BaseAnimationBuilder>(\n this: T\n ): EntryExitAnimationFunction | LayoutAnimationFunction {\n const instance = this.createInstance();\n return instance.build();\n }\n}\n"],"mappings":"AAAA,YAAY;;AAAC,IAAAA,qBAAA;AAAA,SAAAC,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAF,CAAA,uCAAAC,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAF,CAAA,EAAAG,CAAA,2BAAAH,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAI,CAAA,GAAAJ,CAAA,CAAAK,MAAA,CAAAC,WAAA,kBAAAF,CAAA,QAAAH,CAAA,GAAAG,CAAA,CAAAG,IAAA,CAAAP,CAAA,EAAAG,CAAA,uCAAAF,CAAA,SAAAA,CAAA,YAAAO,SAAA,yEAAAL,CAAA,GAAAM,M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ChB,SAAS;;MACTA,SAAS,CAACX,YAAY,GAAGhB,yBAAyB,CAACgB,YAAY,CAAC;MAChE,OAAOW,SAAS;IAClB,CAAC;EACP;EAEA,OAAOE,KAAKA,CAAA,EAE4C;IACtD,MAAMtB,QAAQ,GAAG,IAAI,CAACC,cAAc,CAAC,CAAC;IACtC,OAAOD,QAAQ,CAACsB,KAAK,CAAC,CAAC;EACzB;AACF;AAACrD,qBAAA,GA/IYyB,oBAAoB;AAAAxB,eAAA,CAApBwB,oBAAoB","ignoreList":[]}
|
package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
-
function _toPropertyKey(
|
|
5
|
-
function _toPrimitive(
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
6
|
import { withTiming, withSpring } from '../../animation';
|
|
7
7
|
import { BaseAnimationBuilder } from './BaseAnimationBuilder';
|
|
8
|
+
import { assertEasingIsWorklet } from '../../animation/util';
|
|
8
9
|
export class ComplexAnimationBuilder extends BaseAnimationBuilder {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(...
|
|
10
|
+
constructor(...args) {
|
|
11
|
+
super(...args);
|
|
11
12
|
_defineProperty(this, "easingV", void 0);
|
|
12
13
|
_defineProperty(this, "rotateV", void 0);
|
|
13
14
|
_defineProperty(this, "type", void 0);
|
|
@@ -30,6 +31,9 @@ export class ComplexAnimationBuilder extends BaseAnimationBuilder {
|
|
|
30
31
|
return instance.easing(easingFunction);
|
|
31
32
|
}
|
|
32
33
|
easing(easingFunction) {
|
|
34
|
+
if (__DEV__) {
|
|
35
|
+
assertEasingIsWorklet(easingFunction);
|
|
36
|
+
}
|
|
33
37
|
this.easingV = easingFunction;
|
|
34
38
|
return this;
|
|
35
39
|
}
|
|
@@ -223,13 +227,10 @@ export class ComplexAnimationBuilder extends BaseAnimationBuilder {
|
|
|
223
227
|
}, {
|
|
224
228
|
variableName: 'rotate',
|
|
225
229
|
value: rotate
|
|
226
|
-
}].forEach(
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
} = _ref;
|
|
231
|
-
return maybeSetConfigValue(value, variableName);
|
|
232
|
-
});
|
|
230
|
+
}].forEach(({
|
|
231
|
+
value,
|
|
232
|
+
variableName
|
|
233
|
+
}) => maybeSetConfigValue(value, variableName));
|
|
233
234
|
return [animation, config];
|
|
234
235
|
}
|
|
235
236
|
}
|
package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","withTiming","withSpring","BaseAnimationBuilder","ComplexAnimationBuilder","constructor","arguments","easing","easingFunction","instance","createInstance","easingV","rotate","degree","rotateV","springify","duration","durationV","type","dampingRatio","dampingRatioV","damping","dampingV","mass","massV","stiffness","stiffnessV","overshootClamping","overshootClampingV","restDisplacementThreshold","restDisplacementThresholdV","restSpeedThreshold","restSpeedThresholdV","withInitialValues","values","initialValues","getAnimationAndConfig","animation","config","maybeSetConfigValue","variableName","forEach","_ref"],"sources":["ComplexAnimationBuilder.ts"],"sourcesContent":["'use strict';\nimport { withTiming, withSpring } from '../../animation';\nimport type {\n AnimationFunction,\n BaseBuilderAnimationConfig,\n LayoutAnimationAndConfig,\n} from './commonTypes';\nimport type { EasingFunction } from '../../Easing';\nimport { BaseAnimationBuilder } from './BaseAnimationBuilder';\nimport type { StyleProps } from '../../commonTypes';\n\nexport class ComplexAnimationBuilder extends BaseAnimationBuilder {\n easingV?: EasingFunction;\n rotateV?: string;\n type?: AnimationFunction;\n dampingV?: number;\n dampingRatioV?: number;\n massV?: number;\n stiffnessV?: number;\n overshootClampingV?: number;\n restDisplacementThresholdV?: number;\n restSpeedThresholdV?: number;\n initialValues?: StyleProps;\n\n static createInstance: <T extends typeof BaseAnimationBuilder>(\n this: T\n ) => InstanceType<T>;\n\n /**\n * Lets you change the easing curve of the animation. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param easingFunction - An easing function which defines the animation curve.\n */\n static easing<T extends typeof ComplexAnimationBuilder>(\n this: T,\n easingFunction: EasingFunction\n ) {\n const instance = this.createInstance();\n return instance.easing(easingFunction);\n }\n\n easing(easingFunction: EasingFunction): this {\n this.easingV = easingFunction;\n return this;\n }\n\n /**\n * Lets you rotate the element. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param degree - The rotation degree.\n */\n static rotate<T extends typeof ComplexAnimationBuilder>(\n this: T,\n degree: string\n ) {\n const instance = this.createInstance();\n return instance.rotate(degree);\n }\n\n rotate(degree: string): this {\n this.rotateV = degree;\n return this;\n }\n\n /**\n * Enables the spring-based animation configuration. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param duration - An optional duration of the spring animation (in milliseconds).\n */\n static springify<T extends typeof ComplexAnimationBuilder>(\n this: T,\n duration?: number\n ): ComplexAnimationBuilder {\n const instance = this.createInstance();\n return instance.springify(duration);\n }\n\n springify(duration?: number): this {\n this.durationV = duration;\n this.type = withSpring as AnimationFunction;\n return this;\n }\n\n /**\n * Lets you adjust the spring animation damping ratio. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param dampingRatio - How damped the spring is.\n */\n static dampingRatio<T extends typeof ComplexAnimationBuilder>(\n this: T,\n dampingRatio: number\n ) {\n const instance = this.createInstance();\n return instance.dampingRatio(dampingRatio);\n }\n\n dampingRatio(value: number): this {\n this.dampingRatioV = value;\n return this;\n }\n\n /**\n * Lets you adjust the spring animation damping. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param value - Decides how quickly a spring stops moving. Higher damping means the spring will come to rest faster.\n */\n static damping<T extends typeof ComplexAnimationBuilder>(\n this: T,\n damping: number\n ) {\n const instance = this.createInstance();\n return instance.damping(damping);\n }\n\n damping(damping: number): this {\n this.dampingV = damping;\n return this;\n }\n\n /**\n * Lets you adjust the spring animation mass. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param mass - The weight of the spring. Reducing this value makes the animation faster.\n */\n static mass<T extends typeof ComplexAnimationBuilder>(this: T, mass: number) {\n const instance = this.createInstance();\n return instance.mass(mass);\n }\n\n mass(mass: number): this {\n this.massV = mass;\n return this;\n }\n\n /**\n * Lets you adjust the stiffness of the spring animation. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param stiffness - How bouncy the spring is.\n */\n static stiffness<T extends typeof ComplexAnimationBuilder>(\n this: T,\n stiffness: number\n ) {\n const instance = this.createInstance();\n return instance.stiffness(stiffness);\n }\n\n stiffness(stiffness: number): this {\n this.stiffnessV = stiffness;\n return this;\n }\n\n /**\n * Lets you adjust overshoot clamping of the spring. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param overshootClamping - Whether a spring can bounce over the final position.\n */\n static overshootClamping<T extends typeof ComplexAnimationBuilder>(\n this: T,\n overshootClamping: number\n ) {\n const instance = this.createInstance();\n return instance.overshootClamping(overshootClamping);\n }\n\n overshootClamping(overshootClamping: number): this {\n this.overshootClampingV = overshootClamping;\n return this;\n }\n\n /**\n * Lets you adjust the rest displacement threshold of the spring animation. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param restDisplacementThreshold - The displacement below which the spring will snap to the designated position without further oscillations.\n */\n static restDisplacementThreshold<T extends typeof ComplexAnimationBuilder>(\n this: T,\n restDisplacementThreshold: number\n ) {\n const instance = this.createInstance();\n return instance.restDisplacementThreshold(restDisplacementThreshold);\n }\n\n restDisplacementThreshold(restDisplacementThreshold: number) {\n this.restDisplacementThresholdV = restDisplacementThreshold;\n return this;\n }\n\n /**\n * Lets you adjust the rest speed threshold of the spring animation. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param restSpeedThreshold - The speed in pixels per second from which the spring will snap to the designated position without further oscillations.\n */\n static restSpeedThreshold<T extends typeof ComplexAnimationBuilder>(\n this: T,\n restSpeedThreshold: number\n ) {\n const instance = this.createInstance();\n return instance.restSpeedThreshold(restSpeedThreshold);\n }\n\n restSpeedThreshold(restSpeedThreshold: number): this {\n this.restSpeedThresholdV = restSpeedThreshold;\n return this;\n }\n\n /**\n * Lets you override the initial config of the animation\n *\n * @param values - An object containing the styles to override.\n */\n static withInitialValues<T extends typeof ComplexAnimationBuilder>(\n this: T,\n values: StyleProps\n ) {\n const instance = this.createInstance();\n return instance.withInitialValues(values);\n }\n\n withInitialValues(values: StyleProps): this {\n this.initialValues = values;\n return this;\n }\n\n getAnimationAndConfig(): LayoutAnimationAndConfig {\n const duration = this.durationV;\n const easing = this.easingV;\n const rotate = this.rotateV;\n const type = this.type ? this.type : (withTiming as AnimationFunction);\n const damping = this.dampingV;\n const dampingRatio = this.dampingRatioV;\n const mass = this.massV;\n const stiffness = this.stiffnessV;\n const overshootClamping = this.overshootClampingV;\n const restDisplacementThreshold = this.restDisplacementThresholdV;\n const restSpeedThreshold = this.restSpeedThresholdV;\n\n const animation = type;\n\n const config: BaseBuilderAnimationConfig = {};\n\n function maybeSetConfigValue<Key extends keyof BaseBuilderAnimationConfig>(\n value: BaseBuilderAnimationConfig[Key],\n variableName: Key\n ) {\n if (value) {\n config[variableName] = value;\n }\n }\n\n if (type === withTiming) {\n maybeSetConfigValue(easing, 'easing');\n }\n\n (\n [\n { variableName: 'damping', value: damping },\n { variableName: 'dampingRatio', value: dampingRatio },\n { variableName: 'mass', value: mass },\n { variableName: 'stiffness', value: stiffness },\n { variableName: 'overshootClamping', value: overshootClamping },\n {\n variableName: 'restDisplacementThreshold',\n value: restDisplacementThreshold,\n },\n { variableName: 'restSpeedThreshold', value: restSpeedThreshold },\n { variableName: 'duration', value: duration },\n { variableName: 'rotate', value: rotate },\n ] as const\n ).forEach(({ value, variableName }) =>\n maybeSetConfigValue(value, variableName)\n );\n\n return [animation, config];\n }\n}\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,GAAA,QAAAR,GAAA,GAAAS,YAAA,CAAAD,GAAA,2BAAAR,GAAA,gBAAAA,GAAA,GAAAU,MAAA,CAAAV,GAAA;AAAA,SAAAS,aA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AAkB,CAAC,EAC/D;MACEa,YAAY,EAAE,2BAA2B;MACzC3D,KAAK,EAAEgD;IACT,CAAC,EACD;MAAEW,YAAY,EAAE,oBAAoB;MAAE3D,KAAK,EAAEkD;IAAmB,CAAC,EACjE;MAAES,YAAY,EAAE,UAAU;MAAE3D,KAAK,EAAEmC;IAAS,CAAC,EAC7C;MAAEwB,YAAY,EAAE,QAAQ;MAAE3D,KAAK,EAAE+B;IAAO,CAAC,CAC1C,CACD6B,OAAO,CAACC,IAAA;MAAA,IAAC;QAAE7D,KAAK;QAAE2D;MAAa,CAAC,GAAAE,IAAA;MAAA,OAChCH,mBAAmB,CAAC1D,KAAK,EAAE2D,YAAY,CAAC;IAAA,EACzC;IAED,OAAO,CAACH,SAAS,EAAEC,MAAM,CAAC;EAC5B;AACF;AAAC5D,eAAA,CAxQY0B,uBAAuB"}
|
|
1
|
+
{"version":3,"names":["_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","withTiming","withSpring","BaseAnimationBuilder","assertEasingIsWorklet","ComplexAnimationBuilder","constructor","args","easing","easingFunction","instance","createInstance","__DEV__","easingV","rotate","degree","rotateV","springify","duration","durationV","type","dampingRatio","dampingRatioV","damping","dampingV","mass","massV","stiffness","stiffnessV","overshootClamping","overshootClampingV","restDisplacementThreshold","restDisplacementThresholdV","restSpeedThreshold","restSpeedThresholdV","withInitialValues","values","initialValues","getAnimationAndConfig","animation","config","maybeSetConfigValue","variableName","forEach"],"sources":["ComplexAnimationBuilder.ts"],"sourcesContent":["'use strict';\nimport { withTiming, withSpring } from '../../animation';\nimport type {\n AnimationFunction,\n BaseBuilderAnimationConfig,\n LayoutAnimationAndConfig,\n} from './commonTypes';\nimport type { EasingFunction } from '../../Easing';\nimport { BaseAnimationBuilder } from './BaseAnimationBuilder';\nimport type { StyleProps } from '../../commonTypes';\nimport { assertEasingIsWorklet } from '../../animation/util';\n\nexport class ComplexAnimationBuilder extends BaseAnimationBuilder {\n easingV?: EasingFunction;\n rotateV?: string;\n type?: AnimationFunction;\n dampingV?: number;\n dampingRatioV?: number;\n massV?: number;\n stiffnessV?: number;\n overshootClampingV?: number;\n restDisplacementThresholdV?: number;\n restSpeedThresholdV?: number;\n initialValues?: StyleProps;\n\n static createInstance: <T extends typeof BaseAnimationBuilder>(\n this: T\n ) => InstanceType<T>;\n\n /**\n * Lets you change the easing curve of the animation. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param easingFunction - An easing function which defines the animation curve.\n */\n static easing<T extends typeof ComplexAnimationBuilder>(\n this: T,\n easingFunction: EasingFunction\n ) {\n const instance = this.createInstance();\n return instance.easing(easingFunction);\n }\n\n easing(easingFunction: EasingFunction): this {\n if (__DEV__) {\n assertEasingIsWorklet(easingFunction);\n }\n this.easingV = easingFunction;\n return this;\n }\n\n /**\n * Lets you rotate the element. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param degree - The rotation degree.\n */\n static rotate<T extends typeof ComplexAnimationBuilder>(\n this: T,\n degree: string\n ) {\n const instance = this.createInstance();\n return instance.rotate(degree);\n }\n\n rotate(degree: string): this {\n this.rotateV = degree;\n return this;\n }\n\n /**\n * Enables the spring-based animation configuration. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param duration - An optional duration of the spring animation (in milliseconds).\n */\n static springify<T extends typeof ComplexAnimationBuilder>(\n this: T,\n duration?: number\n ): ComplexAnimationBuilder {\n const instance = this.createInstance();\n return instance.springify(duration);\n }\n\n springify(duration?: number): this {\n this.durationV = duration;\n this.type = withSpring as AnimationFunction;\n return this;\n }\n\n /**\n * Lets you adjust the spring animation damping ratio. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param dampingRatio - How damped the spring is.\n */\n static dampingRatio<T extends typeof ComplexAnimationBuilder>(\n this: T,\n dampingRatio: number\n ) {\n const instance = this.createInstance();\n return instance.dampingRatio(dampingRatio);\n }\n\n dampingRatio(value: number): this {\n this.dampingRatioV = value;\n return this;\n }\n\n /**\n * Lets you adjust the spring animation damping. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param value - Decides how quickly a spring stops moving. Higher damping means the spring will come to rest faster.\n */\n static damping<T extends typeof ComplexAnimationBuilder>(\n this: T,\n damping: number\n ) {\n const instance = this.createInstance();\n return instance.damping(damping);\n }\n\n damping(damping: number): this {\n this.dampingV = damping;\n return this;\n }\n\n /**\n * Lets you adjust the spring animation mass. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param mass - The weight of the spring. Reducing this value makes the animation faster.\n */\n static mass<T extends typeof ComplexAnimationBuilder>(this: T, mass: number) {\n const instance = this.createInstance();\n return instance.mass(mass);\n }\n\n mass(mass: number): this {\n this.massV = mass;\n return this;\n }\n\n /**\n * Lets you adjust the stiffness of the spring animation. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param stiffness - How bouncy the spring is.\n */\n static stiffness<T extends typeof ComplexAnimationBuilder>(\n this: T,\n stiffness: number\n ) {\n const instance = this.createInstance();\n return instance.stiffness(stiffness);\n }\n\n stiffness(stiffness: number): this {\n this.stiffnessV = stiffness;\n return this;\n }\n\n /**\n * Lets you adjust overshoot clamping of the spring. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param overshootClamping - Whether a spring can bounce over the final position.\n */\n static overshootClamping<T extends typeof ComplexAnimationBuilder>(\n this: T,\n overshootClamping: number\n ) {\n const instance = this.createInstance();\n return instance.overshootClamping(overshootClamping);\n }\n\n overshootClamping(overshootClamping: number): this {\n this.overshootClampingV = overshootClamping;\n return this;\n }\n\n /**\n * Lets you adjust the rest displacement threshold of the spring animation. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param restDisplacementThreshold - The displacement below which the spring will snap to the designated position without further oscillations.\n */\n static restDisplacementThreshold<T extends typeof ComplexAnimationBuilder>(\n this: T,\n restDisplacementThreshold: number\n ) {\n const instance = this.createInstance();\n return instance.restDisplacementThreshold(restDisplacementThreshold);\n }\n\n restDisplacementThreshold(restDisplacementThreshold: number) {\n this.restDisplacementThresholdV = restDisplacementThreshold;\n return this;\n }\n\n /**\n * Lets you adjust the rest speed threshold of the spring animation. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param restSpeedThreshold - The speed in pixels per second from which the spring will snap to the designated position without further oscillations.\n */\n static restSpeedThreshold<T extends typeof ComplexAnimationBuilder>(\n this: T,\n restSpeedThreshold: number\n ) {\n const instance = this.createInstance();\n return instance.restSpeedThreshold(restSpeedThreshold);\n }\n\n restSpeedThreshold(restSpeedThreshold: number): this {\n this.restSpeedThresholdV = restSpeedThreshold;\n return this;\n }\n\n /**\n * Lets you override the initial config of the animation\n *\n * @param values - An object containing the styles to override.\n */\n static withInitialValues<T extends typeof ComplexAnimationBuilder>(\n this: T,\n values: StyleProps\n ) {\n const instance = this.createInstance();\n return instance.withInitialValues(values);\n }\n\n withInitialValues(values: StyleProps): this {\n this.initialValues = values;\n return this;\n }\n\n getAnimationAndConfig(): LayoutAnimationAndConfig {\n const duration = this.durationV;\n const easing = this.easingV;\n const rotate = this.rotateV;\n const type = this.type ? this.type : (withTiming as AnimationFunction);\n const damping = this.dampingV;\n const dampingRatio = this.dampingRatioV;\n const mass = this.massV;\n const stiffness = this.stiffnessV;\n const overshootClamping = this.overshootClampingV;\n const restDisplacementThreshold = this.restDisplacementThresholdV;\n const restSpeedThreshold = this.restSpeedThresholdV;\n\n const animation = type;\n\n const config: BaseBuilderAnimationConfig = {};\n\n function maybeSetConfigValue<Key extends keyof BaseBuilderAnimationConfig>(\n value: BaseBuilderAnimationConfig[Key],\n variableName: Key\n ) {\n if (value) {\n config[variableName] = value;\n }\n }\n\n if (type === withTiming) {\n maybeSetConfigValue(easing, 'easing');\n }\n\n (\n [\n { variableName: 'damping', value: damping },\n { variableName: 'dampingRatio', value: dampingRatio },\n { variableName: 'mass', value: mass },\n { variableName: 'stiffness', value: stiffness },\n { variableName: 'overshootClamping', value: overshootClamping },\n {\n variableName: 'restDisplacementThreshold',\n value: restDisplacementThreshold,\n },\n { variableName: 'restSpeedThreshold', value: restSpeedThreshold },\n { variableName: 'duration', value: duration },\n { variableName: 'rotate', value: rotate },\n ] as const\n ).forEach(({ value, variableName }) =>\n maybeSetConfigValue(value, variableName)\n );\n\n return [animation, config];\n }\n}\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAF,CAAA,uCAAAC,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAF,CAAA,EAAAG,CAAA,2BAAAH,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAI,CAAA,GAAAJ,CAAA,CAAAK,MAAA,CAAAC,WAAA,kBAAAF,CAA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AmB;MAAE3D,KAAK,EAAE8C;IAAkB,CAAC,EAC/D;MACEa,YAAY,EAAE,2BAA2B;MACzC3D,KAAK,EAAEgD;IACT,CAAC,EACD;MAAEW,YAAY,EAAE,oBAAoB;MAAE3D,KAAK,EAAEkD;IAAmB,CAAC,EACjE;MAAES,YAAY,EAAE,UAAU;MAAE3D,KAAK,EAAEmC;IAAS,CAAC,EAC7C;MAAEwB,YAAY,EAAE,QAAQ;MAAE3D,KAAK,EAAE+B;IAAO,CAAC,CAC1C,CACD6B,OAAO,CAAC,CAAC;MAAE5D,KAAK;MAAE2D;IAAa,CAAC,KAChCD,mBAAmB,CAAC1D,KAAK,EAAE2D,YAAY,CACzC,CAAC;IAED,OAAO,CAACH,SAAS,EAAEC,MAAM,CAAC;EAC5B;AACF;AAAC5D,eAAA,CA3QYyB,uBAAuB","ignoreList":[]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
-
function _toPropertyKey(
|
|
5
|
-
function _toPrimitive(
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
6
|
import { Easing } from '../../Easing';
|
|
7
7
|
import { withDelay, withSequence, withTiming } from '../../animation';
|
|
8
8
|
import { ReduceMotion } from '../../commonTypes';
|
|
9
|
-
import { getReduceMotionFromConfig } from '../../animation/util';
|
|
9
|
+
import { assertEasingIsWorklet, getReduceMotionFromConfig } from '../../animation/util';
|
|
10
10
|
class InnerKeyframe {
|
|
11
11
|
/*
|
|
12
12
|
Keyframe definition should be passed in the constructor as the map
|
|
@@ -138,16 +138,18 @@ class InnerKeyframe {
|
|
|
138
138
|
/*
|
|
139
139
|
Other keyframes can't contain properties that were not specified in initial keyframe.
|
|
140
140
|
*/
|
|
141
|
-
const addKeyPoint =
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
} = _ref;
|
|
141
|
+
const addKeyPoint = ({
|
|
142
|
+
key,
|
|
143
|
+
value,
|
|
144
|
+
currentKeyPoint,
|
|
145
|
+
easing
|
|
146
|
+
}) => {
|
|
148
147
|
if (!(key in parsedKeyframes)) {
|
|
149
148
|
throw new Error("[Reanimated] Keyframe can contain only that set of properties that were provide with initial values (keyframe 0 or 'from')");
|
|
150
149
|
}
|
|
150
|
+
if (__DEV__ && easing) {
|
|
151
|
+
assertEasingIsWorklet(easing);
|
|
152
|
+
}
|
|
151
153
|
parsedKeyframes[key].push({
|
|
152
154
|
duration: getAnimationDuration(key, currentKeyPoint),
|
|
153
155
|
value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","Easing","withDelay","withSequence","withTiming","ReduceMotion","getReduceMotionFromConfig","InnerKeyframe","constructor","definitions","System","delay","delayV","delayFunction","getDelayFunction","keyframes","initialValues","parseDefinitions","callback","callbackV","animations","addAnimation","keyframePoints","length","animation","duration","easing","linear","map","keyframePoint","includes","transform","push","split","keys","forEach","transformProp","index","transformPropKey","makeKeyframeKey","parsedKeyframes","from","Error","to","styleProp","Array","isArray","transformStyle","durationV","animationKeyPoints","getAnimationDuration","currentKeyPoint","maxDuration","currentDuration","reduce","acc","addKeyPoint","_ref","filter","parseInt","sort","a","b","keyPoint","keyframe","addKeyPointWith","durationMs","delayMs","withCallback","reduceMotion","reduceMotionV","_","Keyframe"],"sources":["Keyframe.ts"],"sourcesContent":["'use strict';\nimport type { EasingFunction } from '../../Easing';\nimport { Easing } from '../../Easing';\nimport { withDelay, withSequence, withTiming } from '../../animation';\nimport type {\n AnimationFunction,\n EntryExitAnimationFunction,\n IEntryExitAnimationBuilder,\n KeyframeProps,\n StylePropsWithArrayTransform,\n} from './commonTypes';\nimport type { StyleProps } from '../../commonTypes';\nimport type { TransformArrayItem } from '../../helperTypes';\nimport { ReduceMotion } from '../../commonTypes';\nimport { getReduceMotionFromConfig } from '../../animation/util';\n\ninterface KeyframePoint {\n duration: number;\n value: number | string;\n easing?: EasingFunction;\n}\ninterface ParsedKeyframesDefinition {\n initialValues: StyleProps;\n keyframes: Record<string, KeyframePoint[]>;\n}\nclass InnerKeyframe implements IEntryExitAnimationBuilder {\n durationV?: number;\n delayV?: number;\n reduceMotionV: ReduceMotion = ReduceMotion.System;\n callbackV?: (finished: boolean) => void;\n definitions: Record<string, KeyframeProps>;\n\n /*\n Keyframe definition should be passed in the constructor as the map\n which keys are between range 0 - 100 (%) and correspond to the point in the animation progress.\n */\n constructor(definitions: Record<string, KeyframeProps>) {\n this.definitions = definitions;\n }\n\n private parseDefinitions(): ParsedKeyframesDefinition {\n /* \n Each style property contain an array with all their key points: \n value, duration of transition to that value, and optional easing function (defaults to Linear)\n */\n const parsedKeyframes: Record<string, KeyframePoint[]> = {};\n /*\n Parsing keyframes 'from' and 'to'.\n */\n if (this.definitions.from) {\n if (this.definitions['0']) {\n throw new Error(\n \"[Reanimated] You cannot provide both keyframe 0 and 'from' as they both specified initial values.\"\n );\n }\n this.definitions['0'] = this.definitions.from;\n delete this.definitions.from;\n }\n if (this.definitions.to) {\n if (this.definitions['100']) {\n throw new Error(\n \"[Reanimated] You cannot provide both keyframe 100 and 'to' as they both specified values at the end of the animation.\"\n );\n }\n this.definitions['100'] = this.definitions.to;\n delete this.definitions.to;\n }\n /* \n One of the assumptions is that keyframe 0 is required to properly set initial values.\n Every other keyframe should contain properties from the set provided as initial values.\n */\n if (!this.definitions['0']) {\n throw new Error(\n \"[Reanimated] Please provide 0 or 'from' keyframe with initial state of your object.\"\n );\n }\n const initialValues: StyleProps = this.definitions['0'] as StyleProps;\n /*\n Initialize parsedKeyframes for properties provided in initial keyframe\n */\n Object.keys(initialValues).forEach((styleProp: string) => {\n if (styleProp === 'transform') {\n if (!Array.isArray(initialValues.transform)) {\n return;\n }\n initialValues.transform.forEach((transformStyle, index) => {\n Object.keys(transformStyle).forEach((transformProp: string) => {\n parsedKeyframes[makeKeyframeKey(index, transformProp)] = [];\n });\n });\n } else {\n parsedKeyframes[styleProp] = [];\n }\n });\n\n const duration: number = this.durationV ? this.durationV : 500;\n const animationKeyPoints: Array<string> = Array.from(\n Object.keys(this.definitions)\n );\n\n const getAnimationDuration = (\n key: string,\n currentKeyPoint: number\n ): number => {\n const maxDuration = (currentKeyPoint / 100) * duration;\n const currentDuration = parsedKeyframes[key].reduce(\n (acc: number, value: KeyframePoint) => acc + value.duration,\n 0\n );\n return maxDuration - currentDuration;\n };\n\n /* \n Other keyframes can't contain properties that were not specified in initial keyframe.\n */\n const addKeyPoint = ({\n key,\n value,\n currentKeyPoint,\n easing,\n }: {\n key: string;\n value: string | number;\n currentKeyPoint: number;\n easing?: EasingFunction;\n }): void => {\n if (!(key in parsedKeyframes)) {\n throw new Error(\n \"[Reanimated] Keyframe can contain only that set of properties that were provide with initial values (keyframe 0 or 'from')\"\n );\n }\n parsedKeyframes[key].push({\n duration: getAnimationDuration(key, currentKeyPoint),\n value,\n easing,\n });\n };\n animationKeyPoints\n .filter((value: string) => parseInt(value) !== 0)\n .sort((a: string, b: string) => parseInt(a) - parseInt(b))\n .forEach((keyPoint: string) => {\n if (parseInt(keyPoint) < 0 || parseInt(keyPoint) > 100) {\n throw new Error(\n '[Reanimated] Keyframe should be in between range 0 - 100.'\n );\n }\n const keyframe: KeyframeProps = this.definitions[keyPoint];\n const easing = keyframe.easing;\n delete keyframe.easing;\n const addKeyPointWith = (key: string, value: string | number) =>\n addKeyPoint({\n key,\n value,\n currentKeyPoint: parseInt(keyPoint),\n easing,\n });\n Object.keys(keyframe).forEach((key: string) => {\n if (key === 'transform') {\n if (!Array.isArray(keyframe.transform)) {\n return;\n }\n keyframe.transform.forEach((transformStyle, index) => {\n Object.keys(transformStyle).forEach((transformProp: string) => {\n addKeyPointWith(\n makeKeyframeKey(index, transformProp),\n transformStyle[\n transformProp as keyof typeof transformStyle\n ] as number | string // Here we assume that user has passed props of proper type.\n // I don't think it's worthwhile to check if he passed i.e. `Animated.Node`.\n );\n });\n });\n } else {\n addKeyPointWith(key, keyframe[key]);\n }\n });\n });\n return { initialValues, keyframes: parsedKeyframes };\n }\n\n duration(durationMs: number): InnerKeyframe {\n this.durationV = durationMs;\n return this;\n }\n\n delay(delayMs: number): InnerKeyframe {\n this.delayV = delayMs;\n return this;\n }\n\n withCallback(callback: (finsihed: boolean) => void): InnerKeyframe {\n this.callbackV = callback;\n return this;\n }\n\n reduceMotion(reduceMotionV: ReduceMotion): this {\n this.reduceMotionV = reduceMotionV;\n return this;\n }\n\n private getDelayFunction(): AnimationFunction {\n const delay = this.delayV;\n const reduceMotion = this.reduceMotionV;\n return delay\n ? // eslint-disable-next-line @typescript-eslint/no-shadow\n (delay, animation) => {\n 'worklet';\n return withDelay(delay, animation, reduceMotion);\n }\n : (_, animation) => {\n 'worklet';\n animation.reduceMotion = getReduceMotionFromConfig(reduceMotion);\n return animation;\n };\n }\n\n build = (): EntryExitAnimationFunction => {\n const delay = this.delayV;\n const delayFunction = this.getDelayFunction();\n const { keyframes, initialValues } = this.parseDefinitions();\n const callback = this.callbackV;\n\n return () => {\n 'worklet';\n const animations: StylePropsWithArrayTransform = {};\n\n /* \n For each style property, an animations sequence is created that corresponds with its key points.\n Transform style properties require special handling because of their nested structure.\n */\n const addAnimation = (key: string) => {\n const keyframePoints = keyframes[key];\n // in case if property was only passed as initial value\n if (keyframePoints.length === 0) {\n return;\n }\n const animation = delayFunction(\n delay,\n keyframePoints.length === 1\n ? withTiming(keyframePoints[0].value, {\n duration: keyframePoints[0].duration,\n easing: keyframePoints[0].easing\n ? keyframePoints[0].easing\n : Easing.linear,\n })\n : withSequence(\n ...keyframePoints.map((keyframePoint: KeyframePoint) =>\n withTiming(keyframePoint.value, {\n duration: keyframePoint.duration,\n easing: keyframePoint.easing\n ? keyframePoint.easing\n : Easing.linear,\n })\n )\n )\n );\n if (key.includes('transform')) {\n if (!('transform' in animations)) {\n animations.transform = [];\n }\n animations.transform!.push(<TransformArrayItem>{\n [key.split(':')[1]]: animation,\n });\n } else {\n animations[key] = animation;\n }\n };\n Object.keys(initialValues).forEach((key: string) => {\n if (key.includes('transform')) {\n initialValues[key].forEach(\n (transformProp: Record<string, number | string>, index: number) => {\n Object.keys(transformProp).forEach((transformPropKey: string) => {\n addAnimation(makeKeyframeKey(index, transformPropKey));\n });\n }\n );\n } else {\n addAnimation(key);\n }\n });\n return {\n animations,\n initialValues,\n callback,\n };\n };\n };\n}\n\nfunction makeKeyframeKey(index: number, transformProp: string) {\n 'worklet';\n return `${index}_transform:${transformProp}`;\n}\n\n// TODO TYPESCRIPT This is a temporary type to get rid of .d.ts file.\nexport declare class ReanimatedKeyframe {\n constructor(definitions: Record<string, KeyframeProps>);\n duration(durationMs: number): ReanimatedKeyframe;\n delay(delayMs: number): ReanimatedKeyframe;\n reduceMotion(reduceMotionV: ReduceMotion): ReanimatedKeyframe;\n withCallback(callback: (finished: boolean) => void): ReanimatedKeyframe;\n}\n\n// TODO TYPESCRIPT This temporary cast is to get rid of .d.ts file.\nexport const Keyframe = InnerKeyframe as unknown as typeof ReanimatedKeyframe;\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,E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IACA,CAACA,KAAK,EAAEa,SAAS,KAAK;MACpB,SAAS;;MACT,OAAOtB,SAAS,CAACS,KAAK,EAAEa,SAAS,EAAE6C,YAAY,CAAC;IAClD,CAAC,GACD,CAACE,CAAC,EAAE/C,SAAS,KAAK;MAChB,SAAS;;MACTA,SAAS,CAAC6C,YAAY,GAAG/D,yBAAyB,CAAC+D,YAAY,CAAC;MAChE,OAAO7C,SAAS;IAClB,CAAC;EACP;AAyEF;AAEA,SAASe,eAAeA,CAACF,KAAa,EAAED,aAAqB,EAAE;EAC7D,SAAS;;EACT,OAAQ,GAAEC,KAAM,cAAaD,aAAc,EAAC;AAC9C;;AAEA;;AASA;AACA,OAAO,MAAMoC,QAAQ,GAAGjE,aAAqD"}
|
|
1
|
+
{"version":3,"names":["_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","Easing","withDelay","withSequence","withTiming","ReduceMotion","assertEasingIsWorklet","getReduceMotionFromConfig","InnerKeyframe","constructor","definitions","System","delay","delayV","delayFunction","getDelayFunction","keyframes","initialValues","parseDefinitions","callback","callbackV","animations","addAnimation","keyframePoints","length","animation","duration","easing","linear","map","keyframePoint","includes","transform","push","split","keys","forEach","transformProp","index","transformPropKey","makeKeyframeKey","parsedKeyframes","from","Error","to","styleProp","Array","isArray","transformStyle","durationV","animationKeyPoints","getAnimationDuration","currentKeyPoint","maxDuration","currentDuration","reduce","acc","addKeyPoint","__DEV__","filter","parseInt","sort","a","b","keyPoint","keyframe","addKeyPointWith","durationMs","delayMs","withCallback","reduceMotion","reduceMotionV","_","Keyframe"],"sources":["Keyframe.ts"],"sourcesContent":["'use strict';\nimport type { EasingFunction } from '../../Easing';\nimport { Easing } from '../../Easing';\nimport { withDelay, withSequence, withTiming } from '../../animation';\nimport type {\n AnimationFunction,\n EntryExitAnimationFunction,\n IEntryExitAnimationBuilder,\n KeyframeProps,\n StylePropsWithArrayTransform,\n} from './commonTypes';\nimport type { StyleProps } from '../../commonTypes';\nimport type { TransformArrayItem } from '../../helperTypes';\nimport { ReduceMotion } from '../../commonTypes';\nimport {\n assertEasingIsWorklet,\n getReduceMotionFromConfig,\n} from '../../animation/util';\n\ninterface KeyframePoint {\n duration: number;\n value: number | string;\n easing?: EasingFunction;\n}\ninterface ParsedKeyframesDefinition {\n initialValues: StyleProps;\n keyframes: Record<string, KeyframePoint[]>;\n}\nclass InnerKeyframe implements IEntryExitAnimationBuilder {\n durationV?: number;\n delayV?: number;\n reduceMotionV: ReduceMotion = ReduceMotion.System;\n callbackV?: (finished: boolean) => void;\n definitions: Record<string, KeyframeProps>;\n\n /*\n Keyframe definition should be passed in the constructor as the map\n which keys are between range 0 - 100 (%) and correspond to the point in the animation progress.\n */\n constructor(definitions: Record<string, KeyframeProps>) {\n this.definitions = definitions;\n }\n\n private parseDefinitions(): ParsedKeyframesDefinition {\n /* \n Each style property contain an array with all their key points: \n value, duration of transition to that value, and optional easing function (defaults to Linear)\n */\n const parsedKeyframes: Record<string, KeyframePoint[]> = {};\n /*\n Parsing keyframes 'from' and 'to'.\n */\n if (this.definitions.from) {\n if (this.definitions['0']) {\n throw new Error(\n \"[Reanimated] You cannot provide both keyframe 0 and 'from' as they both specified initial values.\"\n );\n }\n this.definitions['0'] = this.definitions.from;\n delete this.definitions.from;\n }\n if (this.definitions.to) {\n if (this.definitions['100']) {\n throw new Error(\n \"[Reanimated] You cannot provide both keyframe 100 and 'to' as they both specified values at the end of the animation.\"\n );\n }\n this.definitions['100'] = this.definitions.to;\n delete this.definitions.to;\n }\n /* \n One of the assumptions is that keyframe 0 is required to properly set initial values.\n Every other keyframe should contain properties from the set provided as initial values.\n */\n if (!this.definitions['0']) {\n throw new Error(\n \"[Reanimated] Please provide 0 or 'from' keyframe with initial state of your object.\"\n );\n }\n const initialValues: StyleProps = this.definitions['0'] as StyleProps;\n /*\n Initialize parsedKeyframes for properties provided in initial keyframe\n */\n Object.keys(initialValues).forEach((styleProp: string) => {\n if (styleProp === 'transform') {\n if (!Array.isArray(initialValues.transform)) {\n return;\n }\n initialValues.transform.forEach((transformStyle, index) => {\n Object.keys(transformStyle).forEach((transformProp: string) => {\n parsedKeyframes[makeKeyframeKey(index, transformProp)] = [];\n });\n });\n } else {\n parsedKeyframes[styleProp] = [];\n }\n });\n\n const duration: number = this.durationV ? this.durationV : 500;\n const animationKeyPoints: Array<string> = Array.from(\n Object.keys(this.definitions)\n );\n\n const getAnimationDuration = (\n key: string,\n currentKeyPoint: number\n ): number => {\n const maxDuration = (currentKeyPoint / 100) * duration;\n const currentDuration = parsedKeyframes[key].reduce(\n (acc: number, value: KeyframePoint) => acc + value.duration,\n 0\n );\n return maxDuration - currentDuration;\n };\n\n /* \n Other keyframes can't contain properties that were not specified in initial keyframe.\n */\n const addKeyPoint = ({\n key,\n value,\n currentKeyPoint,\n easing,\n }: {\n key: string;\n value: string | number;\n currentKeyPoint: number;\n easing?: EasingFunction;\n }): void => {\n if (!(key in parsedKeyframes)) {\n throw new Error(\n \"[Reanimated] Keyframe can contain only that set of properties that were provide with initial values (keyframe 0 or 'from')\"\n );\n }\n\n if (__DEV__ && easing) {\n assertEasingIsWorklet(easing);\n }\n\n parsedKeyframes[key].push({\n duration: getAnimationDuration(key, currentKeyPoint),\n value,\n easing,\n });\n };\n animationKeyPoints\n .filter((value: string) => parseInt(value) !== 0)\n .sort((a: string, b: string) => parseInt(a) - parseInt(b))\n .forEach((keyPoint: string) => {\n if (parseInt(keyPoint) < 0 || parseInt(keyPoint) > 100) {\n throw new Error(\n '[Reanimated] Keyframe should be in between range 0 - 100.'\n );\n }\n const keyframe: KeyframeProps = this.definitions[keyPoint];\n const easing = keyframe.easing;\n delete keyframe.easing;\n const addKeyPointWith = (key: string, value: string | number) =>\n addKeyPoint({\n key,\n value,\n currentKeyPoint: parseInt(keyPoint),\n easing,\n });\n Object.keys(keyframe).forEach((key: string) => {\n if (key === 'transform') {\n if (!Array.isArray(keyframe.transform)) {\n return;\n }\n keyframe.transform.forEach((transformStyle, index) => {\n Object.keys(transformStyle).forEach((transformProp: string) => {\n addKeyPointWith(\n makeKeyframeKey(index, transformProp),\n transformStyle[\n transformProp as keyof typeof transformStyle\n ] as number | string // Here we assume that user has passed props of proper type.\n // I don't think it's worthwhile to check if he passed i.e. `Animated.Node`.\n );\n });\n });\n } else {\n addKeyPointWith(key, keyframe[key]);\n }\n });\n });\n return { initialValues, keyframes: parsedKeyframes };\n }\n\n duration(durationMs: number): InnerKeyframe {\n this.durationV = durationMs;\n return this;\n }\n\n delay(delayMs: number): InnerKeyframe {\n this.delayV = delayMs;\n return this;\n }\n\n withCallback(callback: (finsihed: boolean) => void): InnerKeyframe {\n this.callbackV = callback;\n return this;\n }\n\n reduceMotion(reduceMotionV: ReduceMotion): this {\n this.reduceMotionV = reduceMotionV;\n return this;\n }\n\n private getDelayFunction(): AnimationFunction {\n const delay = this.delayV;\n const reduceMotion = this.reduceMotionV;\n return delay\n ? // eslint-disable-next-line @typescript-eslint/no-shadow\n (delay, animation) => {\n 'worklet';\n return withDelay(delay, animation, reduceMotion);\n }\n : (_, animation) => {\n 'worklet';\n animation.reduceMotion = getReduceMotionFromConfig(reduceMotion);\n return animation;\n };\n }\n\n build = (): EntryExitAnimationFunction => {\n const delay = this.delayV;\n const delayFunction = this.getDelayFunction();\n const { keyframes, initialValues } = this.parseDefinitions();\n const callback = this.callbackV;\n\n return () => {\n 'worklet';\n const animations: StylePropsWithArrayTransform = {};\n\n /* \n For each style property, an animations sequence is created that corresponds with its key points.\n Transform style properties require special handling because of their nested structure.\n */\n const addAnimation = (key: string) => {\n const keyframePoints = keyframes[key];\n // in case if property was only passed as initial value\n if (keyframePoints.length === 0) {\n return;\n }\n const animation = delayFunction(\n delay,\n keyframePoints.length === 1\n ? withTiming(keyframePoints[0].value, {\n duration: keyframePoints[0].duration,\n easing: keyframePoints[0].easing\n ? keyframePoints[0].easing\n : Easing.linear,\n })\n : withSequence(\n ...keyframePoints.map((keyframePoint: KeyframePoint) =>\n withTiming(keyframePoint.value, {\n duration: keyframePoint.duration,\n easing: keyframePoint.easing\n ? keyframePoint.easing\n : Easing.linear,\n })\n )\n )\n );\n if (key.includes('transform')) {\n if (!('transform' in animations)) {\n animations.transform = [];\n }\n animations.transform!.push(<TransformArrayItem>{\n [key.split(':')[1]]: animation,\n });\n } else {\n animations[key] = animation;\n }\n };\n Object.keys(initialValues).forEach((key: string) => {\n if (key.includes('transform')) {\n initialValues[key].forEach(\n (transformProp: Record<string, number | string>, index: number) => {\n Object.keys(transformProp).forEach((transformPropKey: string) => {\n addAnimation(makeKeyframeKey(index, transformPropKey));\n });\n }\n );\n } else {\n addAnimation(key);\n }\n });\n return {\n animations,\n initialValues,\n callback,\n };\n };\n };\n}\n\nfunction makeKeyframeKey(index: number, transformProp: string) {\n 'worklet';\n return `${index}_transform:${transformProp}`;\n}\n\n// TODO TYPESCRIPT This is a temporary type to get rid of .d.ts file.\nexport declare class ReanimatedKeyframe {\n constructor(definitions: Record<string, KeyframeProps>);\n duration(durationMs: number): ReanimatedKeyframe;\n delay(delayMs: number): ReanimatedKeyframe;\n reduceMotion(reduceMotionV: ReduceMotion): ReanimatedKeyframe;\n withCallback(callback: (finished: boolean) => void): ReanimatedKeyframe;\n}\n\n// TODO TYPESCRIPT This temporary cast is to get rid of .d.ts file.\nexport const Keyframe = InnerKeyframe as unknown as typeof ReanimatedKeyframe;\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,CAAA,QAAAC,C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ACD,CAACE,CAAC,EAAE/C,SAAS,KAAK;MAChB,SAAS;;MACTA,SAAS,CAAC6C,YAAY,GAAG/D,yBAAyB,CAAC+D,YAAY,CAAC;MAChE,OAAO7C,SAAS;IAClB,CAAC;EACP;AAyEF;AAEA,SAASe,eAAeA,CAACF,KAAa,EAAED,aAAqB,EAAE;EAC7D,SAAS;;EACT,OAAQ,GAAEC,KAAM,cAAaD,aAAc,EAAC;AAC9C;;AAEA;;AASA;AACA,OAAO,MAAMoC,QAAQ,GAAGjE,aAAqD","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["LayoutAnimationType","SharedTransitionType"],"sources":["commonTypes.ts"],"sourcesContent":["'use strict';\nimport type { TransformArrayItem } from '../../helperTypes';\nimport type { EasingFunction } from '../../Easing';\nimport type { ShareableRef, StyleProps } from '../../commonTypes';\n\nexport type LayoutAnimationsOptions =\n | 'originX'\n | 'originY'\n | 'width'\n | 'height'\n | 'borderRadius'\n | 'globalOriginX'\n | 'globalOriginY';\n\ntype CurrentLayoutAnimationsValues = {\n [K in LayoutAnimationsOptions as `current${Capitalize<string & K>}`]: number;\n};\n\ntype TargetLayoutAnimationsValues = {\n [K in LayoutAnimationsOptions as `target${Capitalize<string & K>}`]: number;\n};\n\ninterface WindowDimensions {\n windowWidth: number;\n windowHeight: number;\n}\n\nexport interface KeyframeProps extends StyleProps {\n easing?: EasingFunction;\n}\n\nexport type LayoutAnimation = {\n initialValues: StyleProps;\n animations: StyleProps;\n callback?: (finished: boolean) => void;\n};\n\nexport type AnimationFunction = (a?: any, b?: any, c?: any) => any; // this is just a temporary mock\n\nexport type EntryAnimationsValues = TargetLayoutAnimationsValues &\n WindowDimensions;\n\nexport type ExitAnimationsValues = CurrentLayoutAnimationsValues &\n WindowDimensions;\n\nexport type EntryExitAnimationFunction =\n | ((targetValues: EntryAnimationsValues) => LayoutAnimation)\n | ((targetValues: ExitAnimationsValues) => LayoutAnimation)\n | (() => LayoutAnimation);\n\nexport type AnimationConfigFunction<T> = (targetValues: T) => LayoutAnimation;\n\nexport type LayoutAnimationsValues = CurrentLayoutAnimationsValues &\n TargetLayoutAnimationsValues &\n WindowDimensions;\n\nexport interface SharedTransitionAnimationsValues\n extends LayoutAnimationsValues {\n currentTransformMatrix: number[];\n targetTransformMatrix: number[];\n}\n\nexport type SharedTransitionAnimationsFunction = (\n values: SharedTransitionAnimationsValues\n) => LayoutAnimation;\n\nexport enum LayoutAnimationType {\n ENTERING = 1,\n EXITING = 2,\n LAYOUT = 3,\n SHARED_ELEMENT_TRANSITION = 4,\n SHARED_ELEMENT_TRANSITION_PROGRESS = 5,\n}\n\nexport type LayoutAnimationFunction = (\n targetValues: LayoutAnimationsValues\n) => LayoutAnimation;\n\nexport type LayoutAnimationStartFunction = (\n tag: number,\n type: LayoutAnimationType,\n yogaValues: Partial<SharedTransitionAnimationsValues>,\n config: LayoutAnimationFunction\n) => void;\n\nexport interface ILayoutAnimationBuilder {\n build: () => LayoutAnimationFunction;\n}\n\nexport interface BaseLayoutAnimationConfig {\n duration?: number;\n easing?: EasingFunction;\n type?: AnimationFunction;\n damping?: number;\n dampingRatio?: number;\n mass?: number;\n stiffness?: number;\n overshootClamping?: number;\n restDisplacementThreshold?: number;\n restSpeedThreshold?: number;\n}\n\nexport interface BaseBuilderAnimationConfig extends BaseLayoutAnimationConfig {\n rotate?: number | string;\n}\n\nexport type LayoutAnimationAndConfig = [\n AnimationFunction,\n BaseBuilderAnimationConfig\n];\n\nexport interface IEntryExitAnimationBuilder {\n build: () => EntryExitAnimationFunction;\n}\n\nexport interface IEntryAnimationBuilder {\n build: () => AnimationConfigFunction<EntryAnimationsValues>;\n}\n\nexport interface IExitAnimationBuilder {\n build: () => AnimationConfigFunction<ExitAnimationsValues>;\n}\n\nexport type ProgressAnimationCallback = (\n viewTag: number,\n progress: number\n) => void;\n\nexport type ProgressAnimation = (\n viewTag: number,\n values: SharedTransitionAnimationsValues,\n progress: number\n) => void;\n\nexport type CustomProgressAnimation = (\n values: SharedTransitionAnimationsValues,\n progress: number\n) => StyleProps;\n\n/**\n * Used to configure the `.defaultTransitionType()` shared transition modifier.\n * @experimental\n */\nexport enum SharedTransitionType {\n ANIMATION = 'animation',\n PROGRESS_ANIMATION = 'progressAnimation',\n}\n\nexport type EntryExitAnimationsValues =\n | EntryAnimationsValues\n | ExitAnimationsValues;\n\nexport type StylePropsWithArrayTransform = StyleProps & {\n transform?: TransformArrayItem[];\n};\n\nexport interface LayoutAnimationBatchItem {\n viewTag: number;\n type: LayoutAnimationType;\n config
|
|
1
|
+
{"version":3,"names":["LayoutAnimationType","SharedTransitionType"],"sources":["commonTypes.ts"],"sourcesContent":["'use strict';\nimport type { TransformArrayItem } from '../../helperTypes';\nimport type { EasingFunction } from '../../Easing';\nimport type { ShareableRef, StyleProps } from '../../commonTypes';\n\nexport type LayoutAnimationsOptions =\n | 'originX'\n | 'originY'\n | 'width'\n | 'height'\n | 'borderRadius'\n | 'globalOriginX'\n | 'globalOriginY';\n\ntype CurrentLayoutAnimationsValues = {\n [K in LayoutAnimationsOptions as `current${Capitalize<string & K>}`]: number;\n};\n\ntype TargetLayoutAnimationsValues = {\n [K in LayoutAnimationsOptions as `target${Capitalize<string & K>}`]: number;\n};\n\ninterface WindowDimensions {\n windowWidth: number;\n windowHeight: number;\n}\n\nexport interface KeyframeProps extends StyleProps {\n easing?: EasingFunction;\n}\n\nexport type LayoutAnimation = {\n initialValues: StyleProps;\n animations: StyleProps;\n callback?: (finished: boolean) => void;\n};\n\nexport type AnimationFunction = (a?: any, b?: any, c?: any) => any; // this is just a temporary mock\n\nexport type EntryAnimationsValues = TargetLayoutAnimationsValues &\n WindowDimensions;\n\nexport type ExitAnimationsValues = CurrentLayoutAnimationsValues &\n WindowDimensions;\n\nexport type EntryExitAnimationFunction =\n | ((targetValues: EntryAnimationsValues) => LayoutAnimation)\n | ((targetValues: ExitAnimationsValues) => LayoutAnimation)\n | (() => LayoutAnimation);\n\nexport type AnimationConfigFunction<T> = (targetValues: T) => LayoutAnimation;\n\nexport type LayoutAnimationsValues = CurrentLayoutAnimationsValues &\n TargetLayoutAnimationsValues &\n WindowDimensions;\n\nexport interface SharedTransitionAnimationsValues\n extends LayoutAnimationsValues {\n currentTransformMatrix: number[];\n targetTransformMatrix: number[];\n}\n\nexport type SharedTransitionAnimationsFunction = (\n values: SharedTransitionAnimationsValues\n) => LayoutAnimation;\n\nexport enum LayoutAnimationType {\n ENTERING = 1,\n EXITING = 2,\n LAYOUT = 3,\n SHARED_ELEMENT_TRANSITION = 4,\n SHARED_ELEMENT_TRANSITION_PROGRESS = 5,\n}\n\nexport type LayoutAnimationFunction = (\n targetValues: LayoutAnimationsValues\n) => LayoutAnimation;\n\nexport type LayoutAnimationStartFunction = (\n tag: number,\n type: LayoutAnimationType,\n yogaValues: Partial<SharedTransitionAnimationsValues>,\n config: LayoutAnimationFunction\n) => void;\n\nexport interface ILayoutAnimationBuilder {\n build: () => LayoutAnimationFunction;\n}\n\nexport interface BaseLayoutAnimationConfig {\n duration?: number;\n easing?: EasingFunction;\n type?: AnimationFunction;\n damping?: number;\n dampingRatio?: number;\n mass?: number;\n stiffness?: number;\n overshootClamping?: number;\n restDisplacementThreshold?: number;\n restSpeedThreshold?: number;\n}\n\nexport interface BaseBuilderAnimationConfig extends BaseLayoutAnimationConfig {\n rotate?: number | string;\n}\n\nexport type LayoutAnimationAndConfig = [\n AnimationFunction,\n BaseBuilderAnimationConfig\n];\n\nexport interface IEntryExitAnimationBuilder {\n build: () => EntryExitAnimationFunction;\n}\n\nexport interface IEntryAnimationBuilder {\n build: () => AnimationConfigFunction<EntryAnimationsValues>;\n}\n\nexport interface IExitAnimationBuilder {\n build: () => AnimationConfigFunction<ExitAnimationsValues>;\n}\n\nexport type ProgressAnimationCallback = (\n viewTag: number,\n progress: number\n) => void;\n\nexport type ProgressAnimation = (\n viewTag: number,\n values: SharedTransitionAnimationsValues,\n progress: number\n) => void;\n\nexport type CustomProgressAnimation = (\n values: SharedTransitionAnimationsValues,\n progress: number\n) => StyleProps;\n\n/**\n * Used to configure the `.defaultTransitionType()` shared transition modifier.\n * @experimental\n */\nexport enum SharedTransitionType {\n ANIMATION = 'animation',\n PROGRESS_ANIMATION = 'progressAnimation',\n}\n\nexport type EntryExitAnimationsValues =\n | EntryAnimationsValues\n | ExitAnimationsValues;\n\nexport type StylePropsWithArrayTransform = StyleProps & {\n transform?: TransformArrayItem[];\n};\n\nexport interface LayoutAnimationBatchItem {\n viewTag: number;\n type: LayoutAnimationType;\n config:\n | ShareableRef<\n | Keyframe\n | LayoutAnimationFunction\n | SharedTransitionAnimationsFunction\n | ProgressAnimationCallback\n >\n | undefined;\n sharedTransitionTag?: string;\n}\n"],"mappings":"AAAA,YAAY;;AAqCwD;;AA6BpE,WAAYA,mBAAmB,0BAAnBA,mBAAmB;EAAnBA,mBAAmB,CAAnBA,mBAAmB;EAAnBA,mBAAmB,CAAnBA,mBAAmB;EAAnBA,mBAAmB,CAAnBA,mBAAmB;EAAnBA,mBAAmB,CAAnBA,mBAAmB;EAAnBA,mBAAmB,CAAnBA,mBAAmB;EAAA,OAAnBA,mBAAmB;AAAA;AAyE/B;AACA;AACA;AACA;AACA,WAAYC,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BaseAnimationBuilder","ComplexAnimationBuilder","Keyframe","LayoutAnimationType","SharedTransitionType"],"sources":["index.ts"],"sourcesContent":["'use strict';\nexport { BaseAnimationBuilder } from './BaseAnimationBuilder';\nexport { ComplexAnimationBuilder } from './ComplexAnimationBuilder';\nexport { Keyframe } from './Keyframe';\nexport { LayoutAnimationType, SharedTransitionType } from './commonTypes';\nexport type {\n LayoutAnimation,\n AnimationFunction,\n EntryAnimationsValues,\n ExitAnimationsValues,\n EntryExitAnimationFunction,\n AnimationConfigFunction,\n IEntryAnimationBuilder,\n IExitAnimationBuilder,\n LayoutAnimationsValues,\n LayoutAnimationFunction,\n LayoutAnimationStartFunction,\n ILayoutAnimationBuilder,\n BaseLayoutAnimationConfig,\n BaseBuilderAnimationConfig,\n LayoutAnimationAndConfig,\n IEntryExitAnimationBuilder,\n} from './commonTypes';\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,QAAQ,QAAQ,YAAY;AACrC,SAASC,mBAAmB,EAAEC,oBAAoB,QAAQ,eAAe"}
|
|
1
|
+
{"version":3,"names":["BaseAnimationBuilder","ComplexAnimationBuilder","Keyframe","LayoutAnimationType","SharedTransitionType"],"sources":["index.ts"],"sourcesContent":["'use strict';\nexport { BaseAnimationBuilder } from './BaseAnimationBuilder';\nexport { ComplexAnimationBuilder } from './ComplexAnimationBuilder';\nexport { Keyframe } from './Keyframe';\nexport { LayoutAnimationType, SharedTransitionType } from './commonTypes';\nexport type {\n LayoutAnimation,\n AnimationFunction,\n EntryAnimationsValues,\n ExitAnimationsValues,\n EntryExitAnimationFunction,\n AnimationConfigFunction,\n IEntryAnimationBuilder,\n IExitAnimationBuilder,\n LayoutAnimationsValues,\n LayoutAnimationFunction,\n LayoutAnimationStartFunction,\n ILayoutAnimationBuilder,\n BaseLayoutAnimationConfig,\n BaseBuilderAnimationConfig,\n LayoutAnimationAndConfig,\n IEntryExitAnimationBuilder,\n} from './commonTypes';\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,QAAQ,QAAQ,YAAY;AACrC,SAASC,mBAAmB,EAAEC,oBAAoB,QAAQ,eAAe","ignoreList":[]}
|
|
@@ -4,7 +4,9 @@ import { withStyleAnimation } from '../animation/styleAnimation';
|
|
|
4
4
|
import { makeUIMutable } from '../mutables';
|
|
5
5
|
import { LayoutAnimationType } from './animationBuilder';
|
|
6
6
|
import { runOnUIImmediately } from '../threads';
|
|
7
|
+
import { isFabric } from '../PlatformChecker';
|
|
7
8
|
const TAG_OFFSET = 1e9;
|
|
9
|
+
const IS_FABRIC = isFabric();
|
|
8
10
|
function startObservingProgress(tag, sharedValue, animationType) {
|
|
9
11
|
'worklet';
|
|
10
12
|
|
|
@@ -13,10 +15,9 @@ function startObservingProgress(tag, sharedValue, animationType) {
|
|
|
13
15
|
global._notifyAboutProgress(tag, sharedValue.value, isSharedTransition);
|
|
14
16
|
});
|
|
15
17
|
}
|
|
16
|
-
function stopObservingProgress(tag, sharedValue) {
|
|
18
|
+
function stopObservingProgress(tag, sharedValue, removeView = false) {
|
|
17
19
|
'worklet';
|
|
18
20
|
|
|
19
|
-
let removeView = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
20
21
|
sharedValue.removeListener(tag + TAG_OFFSET);
|
|
21
22
|
global._notifyAboutEnd(tag, removeView);
|
|
22
23
|
}
|
|
@@ -35,7 +36,10 @@ function createLayoutAnimationManager() {
|
|
|
35
36
|
global.ProgressTransitionRegister.onTransitionStart(tag, yogaValues);
|
|
36
37
|
return;
|
|
37
38
|
}
|
|
39
|
+
// console.log('start', tag, type, yogaValues, config);
|
|
40
|
+
|
|
38
41
|
const style = config(yogaValues);
|
|
42
|
+
// console.log(style);
|
|
39
43
|
let currentAnimation = style.animations;
|
|
40
44
|
|
|
41
45
|
// When layout animation is requested, but a previous one is still running, we merge
|
|
@@ -53,7 +57,9 @@ function createLayoutAnimationManager() {
|
|
|
53
57
|
value = makeUIMutable(style.initialValues);
|
|
54
58
|
mutableValuesForTag.set(tag, value);
|
|
55
59
|
} else {
|
|
56
|
-
|
|
60
|
+
if (!IS_FABRIC) {
|
|
61
|
+
stopObservingProgress(tag, value);
|
|
62
|
+
}
|
|
57
63
|
value._value = style.initialValues;
|
|
58
64
|
}
|
|
59
65
|
|
|
@@ -76,7 +82,8 @@ function createLayoutAnimationManager() {
|
|
|
76
82
|
if (!value) {
|
|
77
83
|
return;
|
|
78
84
|
}
|
|
79
|
-
|
|
85
|
+
value.removeListener(tag + TAG_OFFSET);
|
|
86
|
+
// stopObservingProgress(tag, value);
|
|
80
87
|
}
|
|
81
88
|
};
|
|
82
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withStyleAnimation","makeUIMutable","LayoutAnimationType","runOnUIImmediately","TAG_OFFSET","startObservingProgress","tag","sharedValue","animationType","isSharedTransition","SHARED_ELEMENT_TRANSITION","addListener","global","_notifyAboutProgress","value","stopObservingProgress","removeView","
|
|
1
|
+
{"version":3,"names":["withStyleAnimation","makeUIMutable","LayoutAnimationType","runOnUIImmediately","isFabric","TAG_OFFSET","IS_FABRIC","startObservingProgress","tag","sharedValue","animationType","isSharedTransition","SHARED_ELEMENT_TRANSITION","addListener","global","_notifyAboutProgress","value","stopObservingProgress","removeView","removeListener","_notifyAboutEnd","createLayoutAnimationManager","currentAnimationForTag","Map","mutableValuesForTag","start","type","yogaValues","config","SHARED_ELEMENT_TRANSITION_PROGRESS","ProgressTransitionRegister","onTransitionStart","style","currentAnimation","animations","previousAnimation","get","set","undefined","initialValues","_value","animation","callback","finished","delete","shouldRemoveView","EXITING","stop","LayoutAnimationsManager"],"sources":["animationsManager.ts"],"sourcesContent":["'use strict';\nimport { withStyleAnimation } from '../animation/styleAnimation';\nimport type { SharedValue } from '../commonTypes';\nimport { makeUIMutable } from '../mutables';\nimport { LayoutAnimationType } from './animationBuilder';\nimport { runOnUIImmediately } from '../threads';\nimport type {\n SharedTransitionAnimationsValues,\n LayoutAnimation,\n} from './animationBuilder/commonTypes';\nimport { isFabric } from '../PlatformChecker';\n\nconst TAG_OFFSET = 1e9;\n\nconst IS_FABRIC = isFabric();\n\nfunction startObservingProgress(\n tag: number,\n sharedValue: SharedValue<Record<string, unknown>>,\n animationType: LayoutAnimationType\n): void {\n 'worklet';\n const isSharedTransition =\n animationType === LayoutAnimationType.SHARED_ELEMENT_TRANSITION;\n sharedValue.addListener(tag + TAG_OFFSET, () => {\n global._notifyAboutProgress(tag, sharedValue.value, isSharedTransition);\n });\n}\n\nfunction stopObservingProgress(\n tag: number,\n sharedValue: SharedValue<number>,\n removeView = false\n): void {\n 'worklet';\n sharedValue.removeListener(tag + TAG_OFFSET);\n global._notifyAboutEnd(tag, removeView);\n}\n\nfunction createLayoutAnimationManager() {\n 'worklet';\n const currentAnimationForTag = new Map();\n const mutableValuesForTag = new Map();\n\n return {\n start(\n tag: number,\n type: LayoutAnimationType,\n /**\n * createLayoutAnimationManager creates an animation manager for both Layout animations and Shared Transition Elements animations.\n */\n yogaValues: Partial<SharedTransitionAnimationsValues>,\n config: (\n arg: Partial<SharedTransitionAnimationsValues>\n ) => LayoutAnimation\n ) {\n if (type === LayoutAnimationType.SHARED_ELEMENT_TRANSITION_PROGRESS) {\n global.ProgressTransitionRegister.onTransitionStart(tag, yogaValues);\n return;\n }\n // console.log('start', tag, type, yogaValues, config);\n\n const style = config(yogaValues);\n // console.log(style);\n let currentAnimation = style.animations;\n\n // When layout animation is requested, but a previous one is still running, we merge\n // new layout animation targets into the ongoing animation\n const previousAnimation = currentAnimationForTag.get(tag);\n if (previousAnimation) {\n currentAnimation = { ...previousAnimation, ...style.animations };\n }\n currentAnimationForTag.set(tag, currentAnimation);\n\n let value = mutableValuesForTag.get(tag);\n if (value === undefined) {\n value = makeUIMutable(style.initialValues);\n mutableValuesForTag.set(tag, value);\n } else {\n if (!IS_FABRIC) {\n stopObservingProgress(tag, value);\n }\n value._value = style.initialValues;\n }\n\n // @ts-ignore The line below started failing because I added types to the method – don't have time to fix it right now\n const animation = withStyleAnimation(currentAnimation);\n\n animation.callback = (finished?: boolean) => {\n if (finished) {\n currentAnimationForTag.delete(tag);\n mutableValuesForTag.delete(tag);\n const shouldRemoveView = type === LayoutAnimationType.EXITING;\n stopObservingProgress(tag, value, shouldRemoveView);\n }\n style.callback &&\n style.callback(finished === undefined ? false : finished);\n };\n\n startObservingProgress(tag, value, type);\n value.value = animation;\n },\n stop(tag: number) {\n const value = mutableValuesForTag.get(tag);\n if (!value) {\n return;\n }\n value.removeListener(tag + TAG_OFFSET);\n // stopObservingProgress(tag, value);\n },\n };\n}\n\nrunOnUIImmediately(() => {\n 'worklet';\n global.LayoutAnimationsManager = createLayoutAnimationManager();\n})();\n\nexport type LayoutAnimationsManager = ReturnType<\n typeof createLayoutAnimationManager\n>;\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,kBAAkB,QAAQ,6BAA6B;AAEhE,SAASC,aAAa,QAAQ,aAAa;AAC3C,SAASC,mBAAmB,QAAQ,oBAAoB;AACxD,SAASC,kBAAkB,QAAQ,YAAY;AAK/C,SAASC,QAAQ,QAAQ,oBAAoB;AAE7C,MAAMC,UAAU,GAAG,GAAG;AAEtB,MAAMC,SAAS,GAAGF,QAAQ,CAAC,CAAC;AAE5B,SAASG,sBAAsBA,CAC7BC,GAAW,EACXC,WAAiD,EACjDC,aAAkC,EAC5B;EACN,SAAS;;EACT,MAAMC,kBAAkB,GACtBD,aAAa,KAAKR,mBAAmB,CAACU,yBAAyB;EACjEH,WAAW,CAACI,WAAW,CAACL,GAAG,GAAGH,UAAU,EAAE,MAAM;IAC9CS,MAAM,CAACC,oBAAoB,CAACP,GAAG,EAAEC,WAAW,CAACO,KAAK,EAAEL,kBAAkB,CAAC;EACzE,CAAC,CAAC;AACJ;AAEA,SAASM,qBAAqBA,CAC5BT,GAAW,EACXC,WAAgC,EAChCS,UAAU,GAAG,KAAK,EACZ;EACN,SAAS;;EACTT,WAAW,CAACU,cAAc,CAACX,GAAG,GAAGH,UAAU,CAAC;EAC5CS,MAAM,CAACM,eAAe,CAACZ,GAAG,EAAEU,UAAU,CAAC;AACzC;AAEA,SAASG,4BAA4BA,CAAA,EAAG;EACtC,SAAS;;EACT,MAAMC,sBAAsB,GAAG,IAAIC,GAAG,CAAC,CAAC;EACxC,MAAMC,mBAAmB,GAAG,IAAID,GAAG,CAAC,CAAC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