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":["isFabric","runOnUI","
|
|
1
|
+
{"version":3,"names":["isFabric","runOnUI","VIEW_TAGS","removeFromPropsRegistry","viewTag","push","length","queueMicrotask","flush","__DEV__","Error","removeFromPropsRegistryOnUI","viewTags","global","_removeFromPropsRegistry"],"sources":["PropsRegistry.ts"],"sourcesContent":["'use strict';\nimport { isFabric } from './PlatformChecker';\nimport { runOnUI } from './threads';\n\nlet VIEW_TAGS: number[] = [];\n\nexport function removeFromPropsRegistry(viewTag: number) {\n VIEW_TAGS.push(viewTag);\n if (VIEW_TAGS.length === 1) {\n queueMicrotask(flush);\n }\n}\n\nfunction flush() {\n if (__DEV__ && !isFabric()) {\n throw new Error('[Reanimated] PropsRegistry is only available on Fabric.');\n }\n runOnUI(removeFromPropsRegistryOnUI)(VIEW_TAGS);\n VIEW_TAGS = [];\n}\n\nfunction removeFromPropsRegistryOnUI(viewTags: number[]) {\n 'worklet';\n global._removeFromPropsRegistry(viewTags);\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,QAAQ,QAAQ,mBAAmB;AAC5C,SAASC,OAAO,QAAQ,WAAW;AAEnC,IAAIC,SAAmB,GAAG,EAAE;AAE5B,OAAO,SAASC,uBAAuBA,CAACC,OAAe,EAAE;EACvDF,SAAS,CAACG,IAAI,CAACD,OAAO,CAAC;EACvB,IAAIF,SAAS,CAACI,MAAM,KAAK,CAAC,EAAE;IAC1BC,cAAc,CAACC,KAAK,CAAC;EACvB;AACF;AAEA,SAASA,KAAKA,CAAA,EAAG;EACf,IAAIC,OAAO,IAAI,CAACT,QAAQ,CAAC,CAAC,EAAE;IAC1B,MAAM,IAAIU,KAAK,CAAC,yDAAyD,CAAC;EAC5E;EACAT,OAAO,CAACU,2BAA2B,CAAC,CAACT,SAAS,CAAC;EAC/CA,SAAS,GAAG,EAAE;AAChB;AAEA,SAASS,2BAA2BA,CAACC,QAAkB,EAAE;EACvD,SAAS;;EACTC,MAAM,CAACC,wBAAwB,CAACF,QAAQ,CAAC;AAC3C","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
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 NativeReanimatedModule from './NativeReanimated';
|
|
7
7
|
import { SensorType } from './commonTypes';
|
|
8
8
|
import { makeMutable } from './mutables';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","
|
|
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","NativeReanimatedModule","SensorType","makeMutable","initSensorData","sensorType","ROTATION","qw","qx","qy","qz","yaw","pitch","roll","interfaceOrientation","x","y","z","Sensor","constructor","config","data","register","eventHandler","sensorId","registerSensor","interval","iosReferenceFrame","isRunning","isAvailable","getSharedValue","unregister","unregisterSensor"],"sources":["Sensor.ts"],"sourcesContent":["'use strict';\nimport NativeReanimatedModule from './NativeReanimated';\nimport type {\n SensorConfig,\n SharedValue,\n Value3D,\n ValueRotation,\n ShareableRef,\n} from './commonTypes';\nimport { SensorType } from './commonTypes';\nimport { makeMutable } from './mutables';\n\nfunction initSensorData(\n sensorType: SensorType\n): SharedValue<Value3D | ValueRotation> {\n if (sensorType === SensorType.ROTATION) {\n return makeMutable<Value3D | ValueRotation>({\n qw: 0,\n qx: 0,\n qy: 0,\n qz: 0,\n yaw: 0,\n pitch: 0,\n roll: 0,\n interfaceOrientation: 0,\n });\n } else {\n return makeMutable<Value3D | ValueRotation>({\n x: 0,\n y: 0,\n z: 0,\n interfaceOrientation: 0,\n });\n }\n}\n\nexport default class Sensor {\n public listenersNumber = 0;\n private sensorId: number | null = null;\n private sensorType: SensorType;\n private data: SharedValue<Value3D | ValueRotation>;\n private config: SensorConfig;\n\n constructor(sensorType: SensorType, config: SensorConfig) {\n this.sensorType = sensorType;\n this.config = config;\n this.data = initSensorData(sensorType);\n }\n\n register(\n eventHandler: ShareableRef<(data: Value3D | ValueRotation) => void>\n ) {\n const config = this.config;\n const sensorType = this.sensorType;\n this.sensorId = NativeReanimatedModule.registerSensor(\n sensorType,\n config.interval === 'auto' ? -1 : config.interval,\n config.iosReferenceFrame,\n eventHandler\n );\n return this.sensorId !== -1;\n }\n\n isRunning() {\n return this.sensorId !== -1 && this.sensorId !== null;\n }\n\n isAvailable() {\n return this.sensorId !== -1;\n }\n\n getSharedValue() {\n return this.data;\n }\n\n unregister() {\n if (this.sensorId !== null && this.sensorId !== -1) {\n NativeReanimatedModule.unregisterSensor(this.sensorId);\n }\n this.sensorId = null;\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,CAAA,QAAAH,CAAA,GAAAG,CAAA,CAAAG,IAAA,CAAAP,CAAA,EAAAG,CAAA,uCAAAF,CAAA,SAAAA,CAAA,YAAAO,SAAA,yEAAAL,CAAA,GAAAM,MAAA,GAAAC,MAAA,EAAAV,CAAA;AACb,OAAOW,sBAAsB,MAAM,oBAAoB;AAQvD,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASC,WAAW,QAAQ,YAAY;AAExC,SAASC,cAAcA,CACrBC,UAAsB,EACgB;EACtC,IAAIA,UAAU,KAAKH,UAAU,CAACI,QAAQ,EAAE;IACtC,OAAOH,WAAW,CAA0B;MAC1CI,EAAE,EAAE,CAAC;MACLC,EAAE,EAAE,CAAC;MACLC,EAAE,EAAE,CAAC;MACLC,EAAE,EAAE,CAAC;MACLC,GAAG,EAAE,CAAC;MACNC,KAAK,EAAE,CAAC;MACRC,IAAI,EAAE,CAAC;MACPC,o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,CAACA,QAAQ,KAAK,CAAC,CAAC,EAAE;MAClDvB,sBAAsB,CAAC+B,gBAAgB,CAAC,IAAI,CAACR,QAAQ,CAAC;IACxD;IACA,IAAI,CAACA,QAAQ,GAAG,IAAI;EACtB;AACF","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
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 Sensor from './Sensor';
|
|
7
7
|
export class SensorContainer {
|
|
8
8
|
constructor() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","
|
|
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","Sensor","SensorContainer","constructor","Map","getSensorId","sensorType","config","iosReferenceFrame","adjustToInterfaceOrientation","initializeSensor","sensorId","nativeSensors","has","newSensor","set","sensor","get","getSharedValue","registerSensor","handler","isAvailable","isRunning","register","listenersNumber","unregisterSensor","unregister"],"sources":["SensorContainer.ts"],"sourcesContent":["'use strict';\nimport type {\n SensorType,\n SensorConfig,\n Value3D,\n ValueRotation,\n ShareableRef,\n SharedValue,\n} from './commonTypes';\nimport Sensor from './Sensor';\n\nexport class SensorContainer {\n private nativeSensors: Map<number, Sensor> = new Map();\n\n getSensorId(sensorType: SensorType, config: SensorConfig) {\n return (\n sensorType * 100 +\n config.iosReferenceFrame * 10 +\n Number(config.adjustToInterfaceOrientation)\n );\n }\n\n initializeSensor(\n sensorType: SensorType,\n config: SensorConfig\n ): SharedValue<Value3D | ValueRotation> {\n const sensorId = this.getSensorId(sensorType, config);\n\n if (!this.nativeSensors.has(sensorId)) {\n const newSensor = new Sensor(sensorType, config);\n this.nativeSensors.set(sensorId, newSensor);\n }\n\n const sensor = this.nativeSensors.get(sensorId);\n return sensor!.getSharedValue();\n }\n\n registerSensor(\n sensorType: SensorType,\n config: SensorConfig,\n handler: ShareableRef<(data: Value3D | ValueRotation) => void>\n ): number {\n const sensorId = this.getSensorId(sensorType, config);\n\n if (!this.nativeSensors.has(sensorId)) {\n return -1;\n }\n\n const sensor = this.nativeSensors.get(sensorId);\n if (\n sensor &&\n sensor.isAvailable() &&\n (sensor.isRunning() || sensor.register(handler))\n ) {\n sensor.listenersNumber++;\n return sensorId;\n }\n return -1;\n }\n\n unregisterSensor(sensorId: number) {\n if (this.nativeSensors.has(sensorId)) {\n const sensor = this.nativeSensors.get(sensorId);\n if (sensor && sensor.isRunning()) {\n sensor.listenersNumber--;\n if (sensor.listenersNumber === 0) {\n sensor.unregister();\n }\n }\n }\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,CAA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AACN,WAAW,CAACC,UAAU,EAAEC,MAAM,CAAC;IAErD,IAAI,CAAC,IAAI,CAACK,aAAa,CAACC,GAAG,CAACF,QAAQ,CAAC,EAAE;MACrC,OAAO,CAAC,CAAC;IACX;IAEA,MAAMK,MAAM,GAAG,IAAI,CAACJ,aAAa,CAACK,GAAG,CAACN,QAAQ,CAAC;IAC/C,IACEK,MAAM,IACNA,MAAM,CAACK,WAAW,CAAC,CAAC,KACnBL,MAAM,CAACM,SAAS,CAAC,CAAC,IAAIN,MAAM,CAACO,QAAQ,CAACH,OAAO,CAAC,CAAC,EAChD;MACAJ,MAAM,CAACQ,eAAe,EAAE;MACxB,OAAOb,QAAQ;IACjB;IACA,OAAO,CAAC,CAAC;EACX;EAEAc,gBAAgBA,CAACd,QAAgB,EAAE;IACjC,IAAI,IAAI,CAACC,aAAa,CAACC,GAAG,CAACF,QAAQ,CAAC,EAAE;MACpC,MAAMK,MAAM,GAAG,IAAI,CAACJ,aAAa,CAACK,GAAG,CAACN,QAAQ,CAAC;MAC/C,IAAIK,MAAM,IAAIA,MAAM,CAACM,SAAS,CAAC,CAAC,EAAE;QAChCN,MAAM,CAACQ,eAAe,EAAE;QACxB,IAAIR,MAAM,CAACQ,eAAe,KAAK,CAAC,EAAE;UAChCR,MAAM,CAACU,UAAU,CAAC,CAAC;QACrB;MACF;IACF;EACF;AACF","ignoreList":[]}
|
|
@@ -4,19 +4,40 @@ import { shouldBeUseWeb } from './PlatformChecker';
|
|
|
4
4
|
import { configureLayoutAnimationBatch, makeShareableCloneRecursive } from './core';
|
|
5
5
|
function createUpdateManager() {
|
|
6
6
|
const animations = [];
|
|
7
|
+
// When a stack is rerendered we reconfigure all the shared elements.
|
|
8
|
+
// To do that we want them to appear in our batch in the correct order,
|
|
9
|
+
// so we defer some of the updates to appear at the end of the batch.
|
|
10
|
+
const deferredAnimations = [];
|
|
7
11
|
return {
|
|
8
|
-
update(batchItem) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
update(batchItem, isUnmounting) {
|
|
13
|
+
if (isUnmounting) {
|
|
14
|
+
deferredAnimations.push(batchItem);
|
|
15
|
+
} else {
|
|
16
|
+
animations.push(batchItem);
|
|
17
|
+
}
|
|
18
|
+
if (animations.length + deferredAnimations.length === 1) {
|
|
19
|
+
// setImmediate(this.flush);
|
|
20
|
+
this.flush();
|
|
12
21
|
}
|
|
13
22
|
},
|
|
14
23
|
flush() {
|
|
15
|
-
configureLayoutAnimationBatch(animations);
|
|
24
|
+
configureLayoutAnimationBatch(animations.concat(deferredAnimations));
|
|
16
25
|
animations.length = 0;
|
|
26
|
+
deferredAnimations.length = 0;
|
|
17
27
|
}
|
|
18
28
|
};
|
|
19
29
|
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Lets you update the current configuration of the layout animation or shared element transition for a given component.
|
|
33
|
+
* Configurations are batched and applied at the end of the current execution block, right before sending the response back to native.
|
|
34
|
+
*
|
|
35
|
+
* @param viewTag - The tag of the component you'd like to configure.
|
|
36
|
+
* @param type - The type of the animation you'd like to configure - {@link LayoutAnimationType}.
|
|
37
|
+
* @param config - The animation configuration - {@link LayoutAnimationFunction}, {@link SharedTransitionAnimationsFunction}, {@link ProgressAnimationCallback} or {@link Keyframe}. Passing `undefined` will remove the animation.
|
|
38
|
+
* @param sharedTransitionTag - The tag of the shared element transition you'd like to configure. Passing `undefined` will remove the transition.
|
|
39
|
+
* @param isUnmounting - Determines whether the configuration should be included at the end of the batch, after all the non-deferred configurations (even those that were updated later). This is used to retain the correct ordering of shared elements. Defaults to `false`.
|
|
40
|
+
*/
|
|
20
41
|
export let updateLayoutAnimations;
|
|
21
42
|
if (shouldBeUseWeb()) {
|
|
22
43
|
updateLayoutAnimations = () => {
|
|
@@ -24,10 +45,11 @@ if (shouldBeUseWeb()) {
|
|
|
24
45
|
};
|
|
25
46
|
} else {
|
|
26
47
|
const updateLayoutAnimationsManager = createUpdateManager();
|
|
27
|
-
updateLayoutAnimations = (viewTag, type, config) => updateLayoutAnimationsManager.update({
|
|
48
|
+
updateLayoutAnimations = (viewTag, type, config, sharedTransitionTag, isUnmounting) => updateLayoutAnimationsManager.update({
|
|
28
49
|
viewTag,
|
|
29
50
|
type,
|
|
30
|
-
config: config ? makeShareableCloneRecursive(config) : undefined
|
|
31
|
-
|
|
51
|
+
config: config ? makeShareableCloneRecursive(config) : undefined,
|
|
52
|
+
sharedTransitionTag
|
|
53
|
+
}, isUnmounting);
|
|
32
54
|
}
|
|
33
55
|
//# sourceMappingURL=UpdateLayoutAnimations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["shouldBeUseWeb","configureLayoutAnimationBatch","makeShareableCloneRecursive","createUpdateManager","animations","update","batchItem","push","length","
|
|
1
|
+
{"version":3,"names":["shouldBeUseWeb","configureLayoutAnimationBatch","makeShareableCloneRecursive","createUpdateManager","animations","deferredAnimations","update","batchItem","isUnmounting","push","length","flush","concat","updateLayoutAnimations","updateLayoutAnimationsManager","viewTag","type","config","sharedTransitionTag","undefined"],"sources":["UpdateLayoutAnimations.ts"],"sourcesContent":["'use strict';\nimport { shouldBeUseWeb } from './PlatformChecker';\nimport {\n configureLayoutAnimationBatch,\n makeShareableCloneRecursive,\n} from './core';\nimport type {\n LayoutAnimationFunction,\n LayoutAnimationType,\n} from './layoutReanimation';\nimport type {\n LayoutAnimationBatchItem,\n ProgressAnimationCallback,\n SharedTransitionAnimationsFunction,\n} from './layoutReanimation/animationBuilder/commonTypes';\n\nfunction createUpdateManager() {\n const animations: LayoutAnimationBatchItem[] = [];\n // When a stack is rerendered we reconfigure all the shared elements.\n // To do that we want them to appear in our batch in the correct order,\n // so we defer some of the updates to appear at the end of the batch.\n const deferredAnimations: LayoutAnimationBatchItem[] = [];\n\n return {\n update(batchItem: LayoutAnimationBatchItem, isUnmounting?: boolean) {\n if (isUnmounting) {\n deferredAnimations.push(batchItem);\n } else {\n animations.push(batchItem);\n }\n if (animations.length + deferredAnimations.length === 1) {\n // setImmediate(this.flush);\n this.flush();\n }\n },\n flush(this: void) {\n configureLayoutAnimationBatch(animations.concat(deferredAnimations));\n animations.length = 0;\n deferredAnimations.length = 0;\n },\n };\n}\n\n/**\n * Lets you update the current configuration of the layout animation or shared element transition for a given component.\n * Configurations are batched and applied at the end of the current execution block, right before sending the response back to native.\n *\n * @param viewTag - The tag of the component you'd like to configure.\n * @param type - The type of the animation you'd like to configure - {@link LayoutAnimationType}.\n * @param config - The animation configuration - {@link LayoutAnimationFunction}, {@link SharedTransitionAnimationsFunction}, {@link ProgressAnimationCallback} or {@link Keyframe}. Passing `undefined` will remove the animation.\n * @param sharedTransitionTag - The tag of the shared element transition you'd like to configure. Passing `undefined` will remove the transition.\n * @param isUnmounting - Determines whether the configuration should be included at the end of the batch, after all the non-deferred configurations (even those that were updated later). This is used to retain the correct ordering of shared elements. Defaults to `false`.\n */\nexport let updateLayoutAnimations: (\n viewTag: number,\n type: LayoutAnimationType,\n config?:\n | Keyframe\n | LayoutAnimationFunction\n | SharedTransitionAnimationsFunction\n | ProgressAnimationCallback,\n sharedTransitionTag?: string,\n isUnmounting?: boolean\n) => void;\n\nif (shouldBeUseWeb()) {\n updateLayoutAnimations = () => {\n // no-op\n };\n} else {\n const updateLayoutAnimationsManager = createUpdateManager();\n updateLayoutAnimations = (\n viewTag,\n type,\n config,\n sharedTransitionTag,\n isUnmounting\n ) =>\n updateLayoutAnimationsManager.update(\n {\n viewTag,\n type,\n config: config ? makeShareableCloneRecursive(config) : undefined,\n sharedTransitionTag,\n },\n isUnmounting\n );\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,cAAc,QAAQ,mBAAmB;AAClD,SACEC,6BAA6B,EAC7BC,2BAA2B,QACtB,QAAQ;AAWf,SAASC,mBAAmBA,CAAA,EAAG;EAC7B,MAAMC,UAAsC,GAAG,EAAE;EACjD;EACA;EACA;EACA,MAAMC,kBAA8C,GAAG,EAAE;EAEzD,OAAO;IACLC,MAAMA,CAACC,SAAmC,EAAEC,YAAsB,EAAE;MAClE,IAAIA,YAAY,EAAE;QAChBH,kBAAkB,CAACI,IAAI,CAACF,SAAS,CAAC;MACpC,CAAC,MAAM;QACLH,UAAU,CAACK,IAAI,CAACF,SAAS,CAAC;MAC5B;MACA,IAAIH,UAAU,CAACM,MAAM,GAAGL,kBAAkB,CAACK,MAAM,KAAK,CAAC,EAAE;QACvD;QACA,IAAI,CAACC,KAAK,CAAC,CAAC;MACd;IACF,CAAC;IACDA,KAAKA,CAAA,EAAa;MAChBV,6BAA6B,CAACG,UAAU,CAACQ,MAAM,CAACP,kBAAkB,CAAC,CAAC;MACpED,UAAU,CAACM,MAAM,GAAG,CAAC;MACrBL,kBAAkB,CAACK,MAAM,GAAG,CAAC;IAC/B;EACF,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAIG,sBAUF;AAET,IAAIb,cAAc,CAAC,CAAC,EAAE;EACpBa,sBAAsB,GAAGA,CAAA,KAAM;IAC7B;EAAA,CACD;AACH,CAAC,MAAM;EACL,MAAMC,6BAA6B,GAAGX,mBAAmB,CAAC,CAAC;EAC3DU,sBAAsB,GAAGA,CACvBE,OAAO,EACPC,IAAI,EACJC,MAAM,EACNC,mBAAmB,EACnBV,YAAY,KAEZM,6BAA6B,CAACR,MAAM,CAClC;IACES,OAAO;IACPC,IAAI;IACJC,MAAM,EAAEA,MAAM,GAAGf,2BAA2B,CAACe,MAAM,CAAC,GAAGE,SAAS;IAChED;EACF,CAAC,EACDV,YACF,CAAC;AACL","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["processColorsInProps","_updatePropsJS","isFabric","isJest","shouldBeUseWeb","runOnUIImmediately","updateProps","_","updates","maybeViewRef","isAnimatedProps","items","forEach","item","_index","viewDescriptors","global","UpdatePropsManager","update","updatePropsJestWrapper","animatedStyle","adapters","adapter","current","value","createUpdatePropsManager","operations","viewDescriptor","push","shadowNodeWrapper","length","queueMicrotask","flush","_updatePropsFabric","tag","name","_updatePropsPaper","maybeThrowError","Error","Proxy","get","set"],"sources":["UpdateProps.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\n'use strict';\nimport type { MutableRefObject } from 'react';\nimport { processColorsInProps } from './Colors';\nimport type { ShadowNodeWrapper, SharedValue, StyleProps } from './commonTypes';\nimport type { AnimatedStyle } from './helperTypes';\nimport type { Descriptor } from './hook/commonTypes';\nimport { _updatePropsJS } from './js-reanimated';\nimport { isFabric, isJest, shouldBeUseWeb } from './PlatformChecker';\nimport type { ViewRefSet } from './ViewDescriptorsSet';\nimport { runOnUIImmediately } from './threads';\n\nlet updateProps: (\n viewDescriptor: SharedValue<Descriptor[]>,\n updates: StyleProps | AnimatedStyle<any>,\n maybeViewRef: ViewRefSet<any> | undefined,\n isAnimatedProps?: boolean\n) => void;\n\nif (shouldBeUseWeb()) {\n updateProps = (_, updates, maybeViewRef, isAnimatedProps) => {\n 'worklet';\n if (maybeViewRef) {\n maybeViewRef.items.forEach((item, _index) => {\n _updatePropsJS(updates, item, isAnimatedProps);\n });\n }\n };\n} else {\n updateProps = (viewDescriptors, updates) => {\n 'worklet';\n processColorsInProps(updates);\n global.UpdatePropsManager.update(viewDescriptors, updates);\n };\n}\n\nexport const updatePropsJestWrapper = (\n viewDescriptors: SharedValue<Descriptor[]>,\n updates: AnimatedStyle<any>,\n maybeViewRef: ViewRefSet<any> | undefined,\n animatedStyle: MutableRefObject<AnimatedStyle<any>>,\n adapters: ((updates: AnimatedStyle<any>) => void)[]\n): void => {\n adapters.forEach((adapter) => {\n adapter(updates);\n });\n animatedStyle.current.value = {\n ...animatedStyle.current.value,\n ...updates,\n };\n\n updateProps(viewDescriptors, updates, maybeViewRef);\n};\n\nexport default updateProps;\n\nconst createUpdatePropsManager = isFabric()\n ? () => {\n 'worklet';\n // Fabric\n const operations: {\n shadowNodeWrapper: ShadowNodeWrapper;\n updates: StyleProps | AnimatedStyle<any>;\n }[] = [];\n return {\n update(\n viewDescriptors: SharedValue<Descriptor[]>,\n updates: StyleProps | AnimatedStyle<any>\n ) {\n viewDescriptors.value.forEach((viewDescriptor) => {\n operations.push({\n shadowNodeWrapper: viewDescriptor.shadowNodeWrapper,\n updates,\n });\n if (operations.length === 1) {\n queueMicrotask(this.flush);\n }\n });\n },\n flush(this: void) {\n global._updatePropsFabric!(operations);\n operations.length = 0;\n },\n };\n }\n : () => {\n 'worklet';\n // Paper\n const operations: {\n tag: number;\n name: string;\n updates: StyleProps | AnimatedStyle<any>;\n }[] = [];\n return {\n update(\n viewDescriptors: SharedValue<Descriptor[]>,\n updates: StyleProps | AnimatedStyle<any>\n ) {\n viewDescriptors.value.forEach((viewDescriptor) => {\n operations.push({\n tag: viewDescriptor.tag,\n name: viewDescriptor.name || 'RCTView',\n updates,\n });\n if (operations.length === 1) {\n queueMicrotask(this.flush);\n }\n });\n },\n flush(this: void) {\n global._updatePropsPaper!(operations);\n operations.length = 0;\n },\n };\n };\n\nif (shouldBeUseWeb()) {\n const maybeThrowError = () => {\n // Jest attempts to access a property of this object to check if it is a Jest mock\n // so we can't throw an error in the getter.\n if (!isJest()) {\n throw new Error(\n '[Reanimated] `UpdatePropsManager` is not available on non-native platform.'\n );\n }\n };\n global.UpdatePropsManager = new Proxy({} as UpdatePropsManager, {\n get: maybeThrowError,\n set: () => {\n maybeThrowError();\n return false;\n },\n });\n} else {\n runOnUIImmediately(() => {\n 'worklet';\n global.UpdatePropsManager = createUpdatePropsManager();\n })();\n}\n\nexport interface UpdatePropsManager {\n update(\n viewDescriptors: SharedValue<Descriptor[]>,\n updates: StyleProps | AnimatedStyle<any>\n ): void;\n flush(): void;\n}\n"],"mappings":"AAAA;AACA,YAAY;;AAEZ,SAASA,oBAAoB,QAAQ,UAAU;AAI/C,SAASC,cAAc,QAAQ,iBAAiB;AAChD,SAASC,QAAQ,EAAEC,MAAM,EAAEC,cAAc,QAAQ,mBAAmB;AAEpE,SAASC,kBAAkB,QAAQ,WAAW;AAE9C,IAAIC,WAKK;AAET,IAAIF,cAAc,
|
|
1
|
+
{"version":3,"names":["processColorsInProps","_updatePropsJS","isFabric","isJest","shouldBeUseWeb","runOnUIImmediately","updateProps","_","updates","maybeViewRef","isAnimatedProps","items","forEach","item","_index","viewDescriptors","global","UpdatePropsManager","update","updatePropsJestWrapper","animatedStyle","adapters","adapter","current","value","createUpdatePropsManager","operations","viewDescriptor","push","shadowNodeWrapper","length","queueMicrotask","flush","_updatePropsFabric","tag","name","_updatePropsPaper","maybeThrowError","Error","Proxy","get","set"],"sources":["UpdateProps.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\n'use strict';\nimport type { MutableRefObject } from 'react';\nimport { processColorsInProps } from './Colors';\nimport type { ShadowNodeWrapper, SharedValue, StyleProps } from './commonTypes';\nimport type { AnimatedStyle } from './helperTypes';\nimport type { Descriptor } from './hook/commonTypes';\nimport { _updatePropsJS } from './js-reanimated';\nimport { isFabric, isJest, shouldBeUseWeb } from './PlatformChecker';\nimport type { ViewRefSet } from './ViewDescriptorsSet';\nimport { runOnUIImmediately } from './threads';\n\nlet updateProps: (\n viewDescriptor: SharedValue<Descriptor[]>,\n updates: StyleProps | AnimatedStyle<any>,\n maybeViewRef: ViewRefSet<any> | undefined,\n isAnimatedProps?: boolean\n) => void;\n\nif (shouldBeUseWeb()) {\n updateProps = (_, updates, maybeViewRef, isAnimatedProps) => {\n 'worklet';\n if (maybeViewRef) {\n maybeViewRef.items.forEach((item, _index) => {\n _updatePropsJS(updates, item, isAnimatedProps);\n });\n }\n };\n} else {\n updateProps = (viewDescriptors, updates) => {\n 'worklet';\n processColorsInProps(updates);\n global.UpdatePropsManager.update(viewDescriptors, updates);\n };\n}\n\nexport const updatePropsJestWrapper = (\n viewDescriptors: SharedValue<Descriptor[]>,\n updates: AnimatedStyle<any>,\n maybeViewRef: ViewRefSet<any> | undefined,\n animatedStyle: MutableRefObject<AnimatedStyle<any>>,\n adapters: ((updates: AnimatedStyle<any>) => void)[]\n): void => {\n adapters.forEach((adapter) => {\n adapter(updates);\n });\n animatedStyle.current.value = {\n ...animatedStyle.current.value,\n ...updates,\n };\n\n updateProps(viewDescriptors, updates, maybeViewRef);\n};\n\nexport default updateProps;\n\nconst createUpdatePropsManager = isFabric()\n ? () => {\n 'worklet';\n // Fabric\n const operations: {\n shadowNodeWrapper: ShadowNodeWrapper;\n updates: StyleProps | AnimatedStyle<any>;\n }[] = [];\n return {\n update(\n viewDescriptors: SharedValue<Descriptor[]>,\n updates: StyleProps | AnimatedStyle<any>\n ) {\n viewDescriptors.value.forEach((viewDescriptor) => {\n operations.push({\n shadowNodeWrapper: viewDescriptor.shadowNodeWrapper,\n updates,\n });\n if (operations.length === 1) {\n queueMicrotask(this.flush);\n }\n });\n },\n flush(this: void) {\n global._updatePropsFabric!(operations);\n operations.length = 0;\n },\n };\n }\n : () => {\n 'worklet';\n // Paper\n const operations: {\n tag: number;\n name: string;\n updates: StyleProps | AnimatedStyle<any>;\n }[] = [];\n return {\n update(\n viewDescriptors: SharedValue<Descriptor[]>,\n updates: StyleProps | AnimatedStyle<any>\n ) {\n viewDescriptors.value.forEach((viewDescriptor) => {\n operations.push({\n tag: viewDescriptor.tag,\n name: viewDescriptor.name || 'RCTView',\n updates,\n });\n if (operations.length === 1) {\n queueMicrotask(this.flush);\n }\n });\n },\n flush(this: void) {\n global._updatePropsPaper!(operations);\n operations.length = 0;\n },\n };\n };\n\nif (shouldBeUseWeb()) {\n const maybeThrowError = () => {\n // Jest attempts to access a property of this object to check if it is a Jest mock\n // so we can't throw an error in the getter.\n if (!isJest()) {\n throw new Error(\n '[Reanimated] `UpdatePropsManager` is not available on non-native platform.'\n );\n }\n };\n global.UpdatePropsManager = new Proxy({} as UpdatePropsManager, {\n get: maybeThrowError,\n set: () => {\n maybeThrowError();\n return false;\n },\n });\n} else {\n runOnUIImmediately(() => {\n 'worklet';\n global.UpdatePropsManager = createUpdatePropsManager();\n })();\n}\n\nexport interface UpdatePropsManager {\n update(\n viewDescriptors: SharedValue<Descriptor[]>,\n updates: StyleProps | AnimatedStyle<any>\n ): void;\n flush(): void;\n}\n"],"mappings":"AAAA;AACA,YAAY;;AAEZ,SAASA,oBAAoB,QAAQ,UAAU;AAI/C,SAASC,cAAc,QAAQ,iBAAiB;AAChD,SAASC,QAAQ,EAAEC,MAAM,EAAEC,cAAc,QAAQ,mBAAmB;AAEpE,SAASC,kBAAkB,QAAQ,WAAW;AAE9C,IAAIC,WAKK;AAET,IAAIF,cAAc,CAAC,CAAC,EAAE;EACpBE,WAAW,GAAGA,CAACC,CAAC,EAAEC,OAAO,EAAEC,YAAY,EAAEC,eAAe,KAAK;IAC3D,SAAS;;IACT,IAAID,YAAY,EAAE;MAChBA,YAAY,CAACE,KAAK,CAACC,OAAO,CAAC,CAACC,IAAI,EAAEC,MAAM,KAAK;QAC3Cb,cAAc,CAACO,OAAO,EAAEK,IAAI,EAAEH,eAAe,CAAC;MAChD,CAAC,CAAC;IACJ;EACF,CAAC;AACH,CAAC,MAAM;EACLJ,WAAW,GAAGA,CAACS,eAAe,EAAEP,OAAO,KAAK;IAC1C,SAAS;;IACTR,oBAAoB,CAACQ,OAAO,CAAC;IAC7BQ,MAAM,CAACC,kBAAkB,CAACC,MAAM,CAACH,eAAe,EAAEP,OAAO,CAAC;EAC5D,CAAC;AACH;AAEA,OAAO,MAAMW,sBAAsB,GAAGA,CACpCJ,eAA0C,EAC1CP,OAA2B,EAC3BC,YAAyC,EACzCW,aAAmD,EACnDC,QAAmD,KAC1C;EACTA,QAAQ,CAACT,OAAO,CAAEU,OAAO,IAAK;IAC5BA,OAAO,CAACd,OAAO,CAAC;EAClB,CAAC,CAAC;EACFY,aAAa,CAACG,OAAO,CAACC,KAAK,GAAG;IAC5B,GAAGJ,aAAa,CAACG,OAAO,CAACC,KAAK;IAC9B,GAAGhB;EACL,CAAC;EAEDF,WAAW,CAACS,eAAe,EAAEP,OAAO,EAAEC,YAAY,CAAC;AACrD,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AAC,CAAC,EAAE;EACpB,MAAMiC,eAAe,GAAGA,CAAA,KAAM;IAC5B;IACA;IACA,IAAI,CAAClC,MAAM,CAAC,CAAC,EAAE;MACb,MAAM,IAAImC,KAAK,CACb,4EACF,CAAC;IACH;EACF,CAAC;EACDtB,MAAM,CAACC,kBAAkB,GAAG,IAAIsB,KAAK,CAAC,CAAC,CAAC,EAAwB;IAC9DC,GAAG,EAAEH,eAAe;IACpBI,GAAG,EAAEA,CAAA,KAAM;MACTJ,eAAe,CAAC,CAAC;MACjB,OAAO,KAAK;IACd;EACF,CAAC,CAAC;AACJ,CAAC,MAAM;EACLhC,kBAAkB,CAAC,MAAM;IACvB,SAAS;;IACTW,MAAM,CAACC,kBAAkB,GAAGQ,wBAAwB,CAAC,CAAC;EACxD,CAAC,CAAC,CAAC,CAAC;AACN","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useRef","makeMutable","shouldBeUseWeb","makeViewDescriptorsSet","shareableViewDescriptors","data","add","item","modify","descriptors","index","findIndex","descriptor","tag","push","remove","viewTag","splice","SHOULD_BE_USE_WEB","useViewRefSet","useViewRefSetJS","useViewRefSetNative","undefined","ref","current","items","Set","has","delete"],"sources":["ViewDescriptorsSet.ts"],"sourcesContent":["'use strict';\nimport { useRef } from 'react';\nimport { makeMutable } from './core';\nimport type { SharedValue } from './commonTypes';\nimport type { Descriptor } from './hook/commonTypes';\nimport { shouldBeUseWeb } from './PlatformChecker';\n\nexport interface ViewRefSet<T> {\n items: Set<T>;\n add: (item: T) => void;\n remove: (item: T) => void;\n}\n\nexport interface ViewDescriptorsSet {\n shareableViewDescriptors: SharedValue<Descriptor[]>;\n add: (item: Descriptor) => void;\n remove: (viewTag: number) => void;\n}\n\nexport function makeViewDescriptorsSet(): ViewDescriptorsSet {\n const shareableViewDescriptors = makeMutable<Descriptor[]>([]);\n const data: ViewDescriptorsSet = {\n shareableViewDescriptors,\n add: (item: Descriptor) => {\n shareableViewDescriptors.modify((descriptors) => {\n 'worklet';\n const index = descriptors.findIndex(\n (descriptor) => descriptor.tag === item.tag\n );\n if (index !== -1) {\n descriptors[index] = item;\n } else {\n descriptors.push(item);\n }\n return descriptors;\n }, false);\n },\n\n remove: (viewTag: number) => {\n shareableViewDescriptors.modify((descriptors) => {\n 'worklet';\n const index = descriptors.findIndex(\n (descriptor) => descriptor.tag === viewTag\n );\n if (index !== -1) {\n descriptors.splice(index, 1);\n }\n return descriptors;\n }, false);\n },\n };\n return data;\n}\n\nconst SHOULD_BE_USE_WEB = shouldBeUseWeb();\n\nexport const useViewRefSet = SHOULD_BE_USE_WEB\n ? useViewRefSetJS\n : useViewRefSetNative;\n\nfunction useViewRefSetNative() {\n // Stub native implementation.\n return undefined;\n}\n\nfunction useViewRefSetJS<T>(): ViewRefSet<T> {\n const ref = useRef<ViewRefSet<T> | null>(null);\n if (ref.current === null) {\n const data: ViewRefSet<T> = {\n items: new Set(),\n\n add: (item: T) => {\n if (data.items.has(item)) return;\n data.items.add(item);\n },\n\n remove: (item: T) => {\n data.items.delete(item);\n },\n };\n ref.current = data;\n }\n\n return ref.current;\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,MAAM,QAAQ,OAAO;AAC9B,SAASC,WAAW,QAAQ,QAAQ;AAGpC,SAASC,cAAc,QAAQ,mBAAmB;AAclD,OAAO,SAASC,sBAAsBA,CAAA,EAAuB;EAC3D,MAAMC,wBAAwB,GAAGH,WAAW,CAAe,EAAE,CAAC;EAC9D,MAAMI,IAAwB,GAAG;IAC/BD,wBAAwB;IACxBE,GAAG,EAAGC,IAAgB,IAAK;MACzBH,wBAAwB,CAACI,MAAM,CAAEC,WAAW,IAAK;QAC/C,SAAS;;QACT,MAAMC,KAAK,GAAGD,WAAW,CAACE,SAAS,CAChCC,UAAU,IAAKA,UAAU,CAACC,GAAG,KAAKN,IAAI,CAACM,
|
|
1
|
+
{"version":3,"names":["useRef","makeMutable","shouldBeUseWeb","makeViewDescriptorsSet","shareableViewDescriptors","data","add","item","modify","descriptors","index","findIndex","descriptor","tag","push","remove","viewTag","splice","SHOULD_BE_USE_WEB","useViewRefSet","useViewRefSetJS","useViewRefSetNative","undefined","ref","current","items","Set","has","delete"],"sources":["ViewDescriptorsSet.ts"],"sourcesContent":["'use strict';\nimport { useRef } from 'react';\nimport { makeMutable } from './core';\nimport type { SharedValue } from './commonTypes';\nimport type { Descriptor } from './hook/commonTypes';\nimport { shouldBeUseWeb } from './PlatformChecker';\n\nexport interface ViewRefSet<T> {\n items: Set<T>;\n add: (item: T) => void;\n remove: (item: T) => void;\n}\n\nexport interface ViewDescriptorsSet {\n shareableViewDescriptors: SharedValue<Descriptor[]>;\n add: (item: Descriptor) => void;\n remove: (viewTag: number) => void;\n}\n\nexport function makeViewDescriptorsSet(): ViewDescriptorsSet {\n const shareableViewDescriptors = makeMutable<Descriptor[]>([]);\n const data: ViewDescriptorsSet = {\n shareableViewDescriptors,\n add: (item: Descriptor) => {\n shareableViewDescriptors.modify((descriptors) => {\n 'worklet';\n const index = descriptors.findIndex(\n (descriptor) => descriptor.tag === item.tag\n );\n if (index !== -1) {\n descriptors[index] = item;\n } else {\n descriptors.push(item);\n }\n return descriptors;\n }, false);\n },\n\n remove: (viewTag: number) => {\n shareableViewDescriptors.modify((descriptors) => {\n 'worklet';\n const index = descriptors.findIndex(\n (descriptor) => descriptor.tag === viewTag\n );\n if (index !== -1) {\n descriptors.splice(index, 1);\n }\n return descriptors;\n }, false);\n },\n };\n return data;\n}\n\nconst SHOULD_BE_USE_WEB = shouldBeUseWeb();\n\nexport const useViewRefSet = SHOULD_BE_USE_WEB\n ? useViewRefSetJS\n : useViewRefSetNative;\n\nfunction useViewRefSetNative() {\n // Stub native implementation.\n return undefined;\n}\n\nfunction useViewRefSetJS<T>(): ViewRefSet<T> {\n const ref = useRef<ViewRefSet<T> | null>(null);\n if (ref.current === null) {\n const data: ViewRefSet<T> = {\n items: new Set(),\n\n add: (item: T) => {\n if (data.items.has(item)) return;\n data.items.add(item);\n },\n\n remove: (item: T) => {\n data.items.delete(item);\n },\n };\n ref.current = data;\n }\n\n return ref.current;\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,MAAM,QAAQ,OAAO;AAC9B,SAASC,WAAW,QAAQ,QAAQ;AAGpC,SAASC,cAAc,QAAQ,mBAAmB;AAclD,OAAO,SAASC,sBAAsBA,CAAA,EAAuB;EAC3D,MAAMC,wBAAwB,GAAGH,WAAW,CAAe,EAAE,CAAC;EAC9D,MAAMI,IAAwB,GAAG;IAC/BD,wBAAwB;IACxBE,GAAG,EAAGC,IAAgB,IAAK;MACzBH,wBAAwB,CAACI,MAAM,CAAEC,WAAW,IAAK;QAC/C,SAAS;;QACT,MAAMC,KAAK,GAAGD,WAAW,CAACE,SAAS,CAChCC,UAAU,IAAKA,UAAU,CAACC,GAAG,KAAKN,IAAI,CAACM,GAC1C,CAAC;QACD,IAAIH,KAAK,KAAK,CAAC,CAAC,EAAE;UAChBD,WAAW,CAACC,KAAK,CAAC,GAAGH,IAAI;QAC3B,CAAC,MAAM;UACLE,WAAW,CAACK,IAAI,CAACP,IAAI,CAAC;QACxB;QACA,OAAOE,WAAW;MACpB,CAAC,EAAE,KAAK,CAAC;IACX,CAAC;IAEDM,MAAM,EAAGC,OAAe,IAAK;MAC3BZ,wBAAwB,CAACI,MAAM,CAAEC,WAAW,IAAK;QAC/C,SAAS;;QACT,MAAMC,KAAK,GAAGD,WAAW,CAACE,SAAS,CAChCC,UAAU,IAAKA,UAAU,CAACC,GAAG,KAAKG,OACrC,CAAC;QACD,IAAIN,KAAK,KAAK,CAAC,CAAC,EAAE;UAChBD,WAAW,CAACQ,MAAM,CAACP,KAAK,EAAE,CAAC,CAAC;QAC9B;QACA,OAAOD,WAAW;MACpB,CAAC,EAAE,KAAK,CAAC;IACX;EACF,CAAC;EACD,OAAOJ,IAAI;AACb;AAEA,MAAMa,iBAAiB,GAAGhB,cAAc,CAAC,CAAC;AAE1C,OAAO,MAAMiB,aAAa,GAAGD,iBAAiB,GAC1CE,eAAe,GACfC,mBAAmB;AAEvB,SAASA,mBAAmBA,CAAA,EAAG;EAC7B;EACA,OAAOC,SAAS;AAClB;AAEA,SAASF,eAAeA,CAAA,EAAqB;EAC3C,MAAMG,GAAG,GAAGvB,MAAM,CAAuB,IAAI,CAAC;EAC9C,IAAIuB,GAAG,CAACC,OAAO,KAAK,IAAI,EAAE;IACxB,MAAMnB,IAAmB,GAAG;MAC1BoB,KAAK,EAAE,IAAIC,GAAG,CAAC,CAAC;MAEhBpB,GAAG,EAAGC,IAAO,IAAK;QAChB,IAAIF,IAAI,CAACoB,KAAK,CAACE,GAAG,CAACpB,IAAI,CAAC,EAAE;QAC1BF,IAAI,CAACoB,KAAK,CAACnB,GAAG,CAACC,IAAI,CAAC;MACtB,CAAC;MAEDQ,MAAM,EAAGR,IAAO,IAAK;QACnBF,IAAI,CAACoB,KAAK,CAACG,MAAM,CAACrB,IAAI,CAAC;MACzB;IACF,CAAC;IACDgB,GAAG,CAACC,OAAO,GAAGnB,IAAI;EACpB;EAEA,OAAOkB,GAAG,CAACC,OAAO;AACpB","ignoreList":[]}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
4
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
3
5
|
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(
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
7
|
+
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); }
|
|
8
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
|
9
|
+
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
|
10
|
+
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
6
11
|
import { registerEventHandler, unregisterEventHandler } from './core';
|
|
7
12
|
import { shouldBeUseWeb } from './PlatformChecker';
|
|
8
13
|
const SHOULD_BE_USE_WEB = shouldBeUseWeb();
|
|
@@ -17,45 +22,83 @@ function jsListener(eventName, handler) {
|
|
|
17
22
|
});
|
|
18
23
|
};
|
|
19
24
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
var _viewTags = /*#__PURE__*/new WeakMap();
|
|
26
|
+
var _registrations = /*#__PURE__*/new WeakMap();
|
|
27
|
+
class WorkletEventHandlerNative {
|
|
28
|
+
// keys are viewTags, values are arrays of registration ID's for each viewTag
|
|
29
|
+
constructor(worklet, eventNames) {
|
|
24
30
|
_defineProperty(this, "eventNames", void 0);
|
|
25
|
-
_defineProperty(this, "
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
_defineProperty(this, "registrations", void 0);
|
|
31
|
+
_defineProperty(this, "worklet", void 0);
|
|
32
|
+
_classPrivateFieldInitSpec(this, _viewTags, void 0);
|
|
33
|
+
_classPrivateFieldInitSpec(this, _registrations, void 0);
|
|
29
34
|
this.worklet = worklet;
|
|
30
35
|
this.eventNames = eventNames;
|
|
31
|
-
this
|
|
32
|
-
this
|
|
33
|
-
this.viewTag = undefined;
|
|
34
|
-
this.registrations = [];
|
|
35
|
-
if (SHOULD_BE_USE_WEB) {
|
|
36
|
-
this.listeners = eventNames.reduce((acc, eventName) => {
|
|
37
|
-
acc[eventName] = jsListener(eventName, worklet);
|
|
38
|
-
return acc;
|
|
39
|
-
}, {});
|
|
40
|
-
}
|
|
36
|
+
_classPrivateFieldSet(_viewTags, this, new Set());
|
|
37
|
+
_classPrivateFieldSet(_registrations, this, new Map());
|
|
41
38
|
}
|
|
42
|
-
|
|
39
|
+
updateEventHandler(newWorklet, newEvents) {
|
|
40
|
+
// Update worklet and event names
|
|
43
41
|
this.worklet = newWorklet;
|
|
44
|
-
this.
|
|
42
|
+
this.eventNames = newEvents;
|
|
43
|
+
|
|
44
|
+
// Detach all events
|
|
45
|
+
_classPrivateFieldGet(_registrations, this).forEach(registrationIDs => {
|
|
46
|
+
registrationIDs.forEach(id => unregisterEventHandler(id));
|
|
47
|
+
// No need to remove registrationIDs from map, since it gets overwritten when attaching
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// Attach new events with new worklet
|
|
51
|
+
Array.from(_classPrivateFieldGet(_viewTags, this)).forEach(tag => {
|
|
52
|
+
const newRegistrations = this.eventNames.map(eventName => registerEventHandler(this.worklet, eventName, tag));
|
|
53
|
+
_classPrivateFieldGet(_registrations, this).set(tag, newRegistrations);
|
|
54
|
+
});
|
|
45
55
|
}
|
|
46
56
|
registerForEvents(viewTag, fallbackEventName) {
|
|
47
|
-
this.viewTag
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
57
|
+
_classPrivateFieldGet(_viewTags, this).add(viewTag);
|
|
58
|
+
const newRegistrations = this.eventNames.map(eventName => registerEventHandler(this.worklet, eventName, viewTag));
|
|
59
|
+
_classPrivateFieldGet(_registrations, this).set(viewTag, newRegistrations);
|
|
60
|
+
if (this.eventNames.length === 0 && fallbackEventName) {
|
|
61
|
+
const newRegistration = registerEventHandler(this.worklet, fallbackEventName, viewTag);
|
|
62
|
+
_classPrivateFieldGet(_registrations, this).set(viewTag, [newRegistration]);
|
|
51
63
|
}
|
|
52
64
|
}
|
|
53
|
-
|
|
54
|
-
|
|
65
|
+
unregisterFromEvents(viewTag) {
|
|
66
|
+
var _classPrivateFieldGet2;
|
|
67
|
+
_classPrivateFieldGet(_viewTags, this).delete(viewTag);
|
|
68
|
+
(_classPrivateFieldGet2 = _classPrivateFieldGet(_registrations, this).get(viewTag)) === null || _classPrivateFieldGet2 === void 0 || _classPrivateFieldGet2.forEach(id => {
|
|
69
|
+
unregisterEventHandler(id);
|
|
70
|
+
});
|
|
71
|
+
_classPrivateFieldGet(_registrations, this).delete(viewTag);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
class WorkletEventHandlerWeb {
|
|
75
|
+
constructor(worklet, eventNames = []) {
|
|
76
|
+
_defineProperty(this, "eventNames", void 0);
|
|
77
|
+
_defineProperty(this, "listeners", void 0);
|
|
78
|
+
_defineProperty(this, "worklet", void 0);
|
|
79
|
+
this.worklet = worklet;
|
|
80
|
+
this.eventNames = eventNames;
|
|
81
|
+
this.listeners = {};
|
|
82
|
+
this.setupWebListeners();
|
|
83
|
+
}
|
|
84
|
+
setupWebListeners() {
|
|
85
|
+
this.listeners = {};
|
|
86
|
+
this.eventNames.forEach(eventName => {
|
|
87
|
+
this.listeners[eventName] = jsListener(eventName, this.worklet);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
updateEventHandler(newWorklet, newEvents) {
|
|
91
|
+
// Update worklet and event names
|
|
92
|
+
this.worklet = newWorklet;
|
|
93
|
+
this.eventNames = newEvents;
|
|
94
|
+
this.setupWebListeners();
|
|
95
|
+
}
|
|
96
|
+
registerForEvents(_viewTag, _fallbackEventName) {
|
|
97
|
+
// noop
|
|
55
98
|
}
|
|
56
|
-
unregisterFromEvents() {
|
|
57
|
-
|
|
58
|
-
this.registrations = [];
|
|
99
|
+
unregisterFromEvents(_viewTag) {
|
|
100
|
+
// noop
|
|
59
101
|
}
|
|
60
102
|
}
|
|
103
|
+
export const WorkletEventHandler = SHOULD_BE_USE_WEB ? WorkletEventHandlerWeb : WorkletEventHandlerNative;
|
|
61
104
|
//# sourceMappingURL=WorkletEventHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_classPrivateFieldInitSpec","obj","privateMap","value","_checkPrivateRedeclaration","set","privateCollection","has","TypeError","_defineProperty","key","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","String","Number","_classPrivateFieldGet","s","a","get","_assertClassBrand","_classPrivateFieldSet","n","arguments","length","registerEventHandler","unregisterEventHandler","shouldBeUseWeb","SHOULD_BE_USE_WEB","jsListener","eventName","handler","evt","nativeEvent","_viewTags","WeakMap","_registrations","WorkletEventHandlerNative","constructor","worklet","eventNames","Set","Map","updateEventHandler","newWorklet","newEvents","forEach","registrationIDs","id","Array","from","tag","newRegistrations","map","registerForEvents","viewTag","fallbackEventName","add","newRegistration","unregisterFromEvents","_classPrivateFieldGet2","delete","WorkletEventHandlerWeb","listeners","setupWebListeners","_viewTag","_fallbackEventName","WorkletEventHandler"],"sources":["WorkletEventHandler.ts"],"sourcesContent":["'use strict';\nimport type { NativeSyntheticEvent } from 'react-native';\nimport { registerEventHandler, unregisterEventHandler } from './core';\nimport type {\n EventPayload,\n ReanimatedEvent,\n IWorkletEventHandler,\n} from './hook/commonTypes';\nimport { shouldBeUseWeb } from './PlatformChecker';\n\nconst SHOULD_BE_USE_WEB = shouldBeUseWeb();\n\ntype JSEvent<Event extends object> = NativeSyntheticEvent<EventPayload<Event>>;\n\n// In JS implementation (e.g. for web) we don't use Reanimated's\n// event emitter, therefore we have to handle here\n// the event that came from React Native and convert it.\nfunction jsListener<Event extends object>(\n eventName: string,\n handler: (event: ReanimatedEvent<Event>) => void\n) {\n return (evt: JSEvent<Event>) => {\n handler({ ...evt.nativeEvent, eventName } as ReanimatedEvent<Event>);\n };\n}\n\nclass WorkletEventHandlerNative<Event extends object>\n implements IWorkletEventHandler<Event>\n{\n eventNames: string[];\n worklet: (event: ReanimatedEvent<Event>) => void;\n #viewTags: Set<number>;\n #registrations: Map<number, number[]>; // keys are viewTags, values are arrays of registration ID's for each viewTag\n constructor(\n worklet: (event: ReanimatedEvent<Event>) => void,\n eventNames: string[]\n ) {\n this.worklet = worklet;\n this.eventNames = eventNames;\n this.#viewTags = new Set<number>();\n this.#registrations = new Map<number, number[]>();\n }\n\n updateEventHandler(\n newWorklet: (event: ReanimatedEvent<Event>) => void,\n newEvents: string[]\n ): void {\n // Update worklet and event names\n this.worklet = newWorklet;\n this.eventNames = newEvents;\n\n // Detach all events\n this.#registrations.forEach((registrationIDs) => {\n registrationIDs.forEach((id) => unregisterEventHandler(id));\n // No need to remove registrationIDs from map, since it gets overwritten when attaching\n });\n\n // Attach new events with new worklet\n Array.from(this.#viewTags).forEach((tag) => {\n const newRegistrations = this.eventNames.map((eventName) =>\n registerEventHandler(this.worklet, eventName, tag)\n );\n this.#registrations.set(tag, newRegistrations);\n });\n }\n\n registerForEvents(viewTag: number, fallbackEventName?: string): void {\n this.#viewTags.add(viewTag);\n\n const newRegistrations = this.eventNames.map((eventName) =>\n registerEventHandler(this.worklet, eventName, viewTag)\n );\n this.#registrations.set(viewTag, newRegistrations);\n\n if (this.eventNames.length === 0 && fallbackEventName) {\n const newRegistration = registerEventHandler(\n this.worklet,\n fallbackEventName,\n viewTag\n );\n this.#registrations.set(viewTag, [newRegistration]);\n }\n }\n\n unregisterFromEvents(viewTag: number): void {\n this.#viewTags.delete(viewTag);\n this.#registrations.get(viewTag)?.forEach((id) => {\n unregisterEventHandler(id);\n });\n this.#registrations.delete(viewTag);\n }\n}\n\nclass WorkletEventHandlerWeb<Event extends object>\n implements IWorkletEventHandler<Event>\n{\n eventNames: string[];\n listeners:\n | Record<string, (event: ReanimatedEvent<ReanimatedEvent<Event>>) => void>\n | Record<string, (event: JSEvent<Event>) => void>;\n\n worklet: (event: ReanimatedEvent<Event>) => void;\n\n constructor(\n worklet: (event: ReanimatedEvent<Event>) => void,\n eventNames: string[] = []\n ) {\n this.worklet = worklet;\n this.eventNames = eventNames;\n this.listeners = {};\n this.setupWebListeners();\n }\n\n setupWebListeners() {\n this.listeners = {};\n this.eventNames.forEach((eventName) => {\n this.listeners[eventName] = jsListener(eventName, this.worklet);\n });\n }\n\n updateEventHandler(\n newWorklet: (event: ReanimatedEvent<Event>) => void,\n newEvents: string[]\n ): void {\n // Update worklet and event names\n this.worklet = newWorklet;\n this.eventNames = newEvents;\n this.setupWebListeners();\n }\n\n registerForEvents(_viewTag: number, _fallbackEventName?: string): void {\n // noop\n }\n\n unregisterFromEvents(_viewTag: number): void {\n // noop\n }\n}\n\nexport const WorkletEventHandler = SHOULD_BE_USE_WEB\n ? WorkletEventHandlerWeb\n : WorkletEventHandlerNative;\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,2BAAAC,GAAA,EAAAC,UAAA,EAAAC,KAAA,IAAAC,0BAAA,CAAAH,GAAA,EAAAC,UAAA,GAAAA,UAAA,CAAAG,GAAA,CAAAJ,GAAA,EAAAE,KAAA;AAAA,SAAAC,2BAAAH,GAAA,EAAAK,iBAAA,QAAAA,iBAAA,CAAAC,GAAA,CAAAN,GAAA,eAAAO,SAAA;AAAA,SAAAC,gBAAAR,GAAA,EAAAS,GAAA,EAAAP,KAAA,IAAAO,GAAA,GAAAC,cAAA,CAAAD,GAAA,OAAAA,GAAA,IAAAT,GAAA,IAAAW,MAAA,CAAAC,cAAA,CAAAZ,GAAA,EAAAS,GAAA,IAAAP,KAAA,EAAAA,KAAA,EAAAW,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAf,GAAA,CAAAS,GAAA,IAAAP,KAAA,WAAAF,GAAA;AAAA,SAAAU,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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AGD,UAAU,CAACC,SAAS,EAAE,IAAI,CAACS,OAAO,CAAC;IACjE,CAAC,CAAC;EACJ;EAEAI,kBAAkBA,CAChBC,UAAmD,EACnDC,SAAmB,EACb;IACN;IACA,IAAI,CAACN,OAAO,GAAGK,UAAU;IACzB,IAAI,CAACJ,UAAU,GAAGK,SAAS;IAC3B,IAAI,CAACmB,iBAAiB,CAAC,CAAC;EAC1B;EAEAV,iBAAiBA,CAACW,QAAgB,EAAEC,kBAA2B,EAAQ;IACrE;EAAA;EAGFP,oBAAoBA,CAACM,QAAgB,EAAQ;IAC3C;EAAA;AAEJ;AAEA,OAAO,MAAME,mBAAmB,GAAGvC,iBAAiB,GAChDkC,sBAAsB,GACtBzB,yBAAyB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["defineAnimation","getReduceMotionForAnimation","recognizePrefixSuffix","withClamp","config","_animationToClamp","animationToClamp","strippedMin","min","undefined","strippedValue","strippedMax","max","clampOnFrame","animation","now","finished","onFrame","current","console","warn","prefix","suffix","newValue","onStart","value","previousAnimation","animationBeforeClamped","callback","isHigherOrder","reduceMotion"],"sources":["clamp.ts"],"sourcesContent":["'use strict';\nimport {\n defineAnimation,\n getReduceMotionForAnimation,\n recognizePrefixSuffix,\n} from './util';\nimport type {\n Animation,\n Timestamp,\n AnimatableValue,\n AnimationObject,\n ReduceMotion,\n} from '../commonTypes';\nimport type { ClampAnimation } from './commonTypes';\n\ntype withClampType = <T extends number | string>(\n config: {\n min?: T;\n max?: T;\n },\n clampedAnimation: T\n) => T;\n\nexport const withClamp = function <T extends number | string>(\n config: { min?: T; max?: T; reduceMotion?: ReduceMotion },\n _animationToClamp: AnimationObject<T> | (() => AnimationObject<T>)\n): Animation<ClampAnimation> {\n 'worklet';\n return defineAnimation<ClampAnimation, AnimationObject<T>>(\n _animationToClamp,\n (): ClampAnimation => {\n 'worklet';\n const animationToClamp =\n typeof _animationToClamp === 'function'\n ? _animationToClamp()\n : _animationToClamp;\n\n const strippedMin =\n config.min === undefined\n ? undefined\n : recognizePrefixSuffix(config.min).strippedValue;\n\n const strippedMax =\n config.max === undefined\n ? undefined\n : recognizePrefixSuffix(config.max).strippedValue;\n\n function clampOnFrame(\n animation: ClampAnimation,\n now: Timestamp\n ): boolean {\n const finished = animationToClamp.onFrame(animationToClamp, now);\n\n if (animationToClamp.current === undefined) {\n console.warn(\n \"[Reanimated] Error inside 'withClamp' animation, the inner animation has invalid current value\"\n );\n return true;\n } else {\n const { prefix, strippedValue, suffix } = recognizePrefixSuffix(\n animationToClamp.current\n );\n\n let newValue;\n\n if (strippedMax !== undefined && strippedMax < strippedValue) {\n newValue = strippedMax;\n } else if (strippedMin !== undefined && strippedMin > strippedValue) {\n newValue = strippedMin;\n } else {\n newValue = strippedValue;\n }\n\n animation.current =\n typeof animationToClamp.current === 'number'\n ? newValue\n : `${prefix === undefined ? '' : prefix}${newValue}${\n suffix === undefined ? '' : suffix\n }`;\n }\n\n return finished;\n }\n\n function onStart(\n animation: Animation<any>,\n value: AnimatableValue,\n now: Timestamp,\n previousAnimation: Animation<any> | null\n ): void {\n animation.current = value;\n animation.previousAnimation = animationToClamp;\n const animationBeforeClamped = previousAnimation?.previousAnimation;\n if (\n config.max !== undefined &&\n config.min !== undefined &&\n config.max < config.min\n ) {\n console.warn(\n '[Reanimated] Wrong config was provided to withClamp. Min value is bigger than max'\n );\n }\n\n animationToClamp.onStart(\n animationToClamp,\n /** provide the current value of the previous animation of the clamped animation \n so we can animate from the original \"un-truncated\" value\n */\n animationBeforeClamped?.current || value,\n now,\n animationBeforeClamped\n );\n }\n\n const callback = (finished?: boolean): void => {\n if (animationToClamp.callback) {\n animationToClamp.callback(finished);\n }\n };\n\n return {\n isHigherOrder: true,\n onFrame: clampOnFrame,\n onStart,\n current: animationToClamp.current!,\n callback,\n previousAnimation: null,\n reduceMotion: getReduceMotionForAnimation(config.reduceMotion),\n };\n }\n );\n} as withClampType;\n"],"mappings":"AAAA,YAAY;;AACZ,SACEA,eAAe,EACfC,2BAA2B,EAC3BC,qBAAqB,QAChB,QAAQ;AAkBf,OAAO,MAAMC,SAAS,GAAG,SAAAA,CACvBC,MAAyD,EACzDC,iBAAkE,EACvC;EAC3B,SAAS;;EACT,OAAOL,eAAe,CACpBK,iBAAiB,EACjB,MAAsB;IACpB,SAAS;;IACT,MAAMC,gBAAgB,GACpB,OAAOD,iBAAiB,KAAK,UAAU,GACnCA,iBAAiB,
|
|
1
|
+
{"version":3,"names":["defineAnimation","getReduceMotionForAnimation","recognizePrefixSuffix","withClamp","config","_animationToClamp","animationToClamp","strippedMin","min","undefined","strippedValue","strippedMax","max","clampOnFrame","animation","now","finished","onFrame","current","console","warn","prefix","suffix","newValue","onStart","value","previousAnimation","animationBeforeClamped","callback","isHigherOrder","reduceMotion"],"sources":["clamp.ts"],"sourcesContent":["'use strict';\nimport {\n defineAnimation,\n getReduceMotionForAnimation,\n recognizePrefixSuffix,\n} from './util';\nimport type {\n Animation,\n Timestamp,\n AnimatableValue,\n AnimationObject,\n ReduceMotion,\n} from '../commonTypes';\nimport type { ClampAnimation } from './commonTypes';\n\ntype withClampType = <T extends number | string>(\n config: {\n min?: T;\n max?: T;\n },\n clampedAnimation: T\n) => T;\n\nexport const withClamp = function <T extends number | string>(\n config: { min?: T; max?: T; reduceMotion?: ReduceMotion },\n _animationToClamp: AnimationObject<T> | (() => AnimationObject<T>)\n): Animation<ClampAnimation> {\n 'worklet';\n return defineAnimation<ClampAnimation, AnimationObject<T>>(\n _animationToClamp,\n (): ClampAnimation => {\n 'worklet';\n const animationToClamp =\n typeof _animationToClamp === 'function'\n ? _animationToClamp()\n : _animationToClamp;\n\n const strippedMin =\n config.min === undefined\n ? undefined\n : recognizePrefixSuffix(config.min).strippedValue;\n\n const strippedMax =\n config.max === undefined\n ? undefined\n : recognizePrefixSuffix(config.max).strippedValue;\n\n function clampOnFrame(\n animation: ClampAnimation,\n now: Timestamp\n ): boolean {\n const finished = animationToClamp.onFrame(animationToClamp, now);\n\n if (animationToClamp.current === undefined) {\n console.warn(\n \"[Reanimated] Error inside 'withClamp' animation, the inner animation has invalid current value\"\n );\n return true;\n } else {\n const { prefix, strippedValue, suffix } = recognizePrefixSuffix(\n animationToClamp.current\n );\n\n let newValue;\n\n if (strippedMax !== undefined && strippedMax < strippedValue) {\n newValue = strippedMax;\n } else if (strippedMin !== undefined && strippedMin > strippedValue) {\n newValue = strippedMin;\n } else {\n newValue = strippedValue;\n }\n\n animation.current =\n typeof animationToClamp.current === 'number'\n ? newValue\n : `${prefix === undefined ? '' : prefix}${newValue}${\n suffix === undefined ? '' : suffix\n }`;\n }\n\n return finished;\n }\n\n function onStart(\n animation: Animation<any>,\n value: AnimatableValue,\n now: Timestamp,\n previousAnimation: Animation<any> | null\n ): void {\n animation.current = value;\n animation.previousAnimation = animationToClamp;\n const animationBeforeClamped = previousAnimation?.previousAnimation;\n if (\n config.max !== undefined &&\n config.min !== undefined &&\n config.max < config.min\n ) {\n console.warn(\n '[Reanimated] Wrong config was provided to withClamp. Min value is bigger than max'\n );\n }\n\n animationToClamp.onStart(\n animationToClamp,\n /** provide the current value of the previous animation of the clamped animation \n so we can animate from the original \"un-truncated\" value\n */\n animationBeforeClamped?.current || value,\n now,\n animationBeforeClamped\n );\n }\n\n const callback = (finished?: boolean): void => {\n if (animationToClamp.callback) {\n animationToClamp.callback(finished);\n }\n };\n\n return {\n isHigherOrder: true,\n onFrame: clampOnFrame,\n onStart,\n current: animationToClamp.current!,\n callback,\n previousAnimation: null,\n reduceMotion: getReduceMotionForAnimation(config.reduceMotion),\n };\n }\n );\n} as withClampType;\n"],"mappings":"AAAA,YAAY;;AACZ,SACEA,eAAe,EACfC,2BAA2B,EAC3BC,qBAAqB,QAChB,QAAQ;AAkBf,OAAO,MAAMC,SAAS,GAAG,SAAAA,CACvBC,MAAyD,EACzDC,iBAAkE,EACvC;EAC3B,SAAS;;EACT,OAAOL,eAAe,CACpBK,iBAAiB,EACjB,MAAsB;IACpB,SAA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OAAON,QAAQ;IACjB;IAEA,SAASQ,OAAOA,CACdV,SAAyB,EACzBW,KAAsB,EACtBV,GAAc,EACdW,iBAAwC,EAClC;MACNZ,SAAS,CAACI,OAAO,GAAGO,KAAK;MACzBX,SAAS,CAACY,iBAAiB,GAAGpB,gBAAgB;MAC9C,MAAMqB,sBAAsB,GAAGD,iBAAiB,aAAjBA,iBAAiB,uBAAjBA,iBAAiB,CAAEA,iBAAiB;MACnE,IACEtB,MAAM,CAACQ,GAAG,KAAKH,SAAS,IACxBL,MAAM,CAACI,GAAG,KAAKC,SAAS,IACxBL,MAAM,CAACQ,GAAG,GAAGR,MAAM,CAACI,GAAG,EACvB;QACAW,OAAO,CAACC,IAAI,CACV,mFACF,CAAC;MACH;MAEAd,gBAAgB,CAACkB,OAAO,CACtBlB,gBAAgB;MAChB;AACV;AACA;MACU,CAAAqB,sBAAsB,aAAtBA,sBAAsB,uBAAtBA,sBAAsB,CAAET,OAAO,KAAIO,KAAK,EACxCV,GAAG,EACHY,sBACF,CAAC;IACH;IAEA,MAAMC,QAAQ,GAAIZ,QAAkB,IAAW;MAC7C,IAAIV,gBAAgB,CAACsB,QAAQ,EAAE;QAC7BtB,gBAAgB,CAACsB,QAAQ,CAACZ,QAAQ,CAAC;MACrC;IACF,CAAC;IAED,OAAO;MACLa,aAAa,EAAE,IAAI;MACnBZ,OAAO,EAAEJ,YAAY;MACrBW,OAAO;MACPN,OAAO,EAAEZ,gBAAgB,CAACY,OAAQ;MAClCU,QAAQ;MACRF,iBAAiB,EAAE,IAAI;MACvBI,YAAY,EAAE7B,2BAA2B,CAACG,MAAM,CAAC0B,YAAY;IAC/D,CAAC;EACH,CACF,CAAC;AACH,CAAkB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["commonTypes.ts"],"sourcesContent":["'use strict';\nimport type {\n StyleProps,\n AnimatableValue,\n AnimationObject,\n Animation,\n Timestamp,\n AnimationCallback,\n} from '../commonTypes';\nimport type { AnimatedStyle } from '../helperTypes';\n\nexport interface HigherOrderAnimation {\n isHigherOrder?: boolean;\n}\n\nexport type NextAnimation<T extends AnimationObject> = T | (() => T);\n\nexport interface ClampAnimation\n extends Animation<ClampAnimation>,\n HigherOrderAnimation {\n current: AnimatableValue;\n}\n\nexport interface DelayAnimation\n extends Animation<DelayAnimation>,\n HigherOrderAnimation {\n startTime: Timestamp;\n started: boolean;\n previousAnimation: DelayAnimation | null;\n current: AnimatableValue;\n}\n\nexport interface RepeatAnimation\n extends Animation<RepeatAnimation>,\n HigherOrderAnimation {\n reps: number;\n startValue: AnimatableValue;\n toValue?: AnimatableValue;\n previousAnimation?: RepeatAnimation;\n}\n\nexport interface SequenceAnimation\n extends Animation<SequenceAnimation>,\n HigherOrderAnimation {\n animationIndex: number;\n}\n\nexport interface StyleLayoutAnimation extends HigherOrderAnimation {\n current: StyleProps;\n styleAnimations: AnimatedStyle<any>;\n onFrame: (animation: StyleLayoutAnimation, timestamp: Timestamp) => boolean;\n onStart: (\n nextAnimation: StyleLayoutAnimation,\n current: AnimatedStyle<any>,\n timestamp: Timestamp,\n previousAnimation: StyleLayoutAnimation\n ) => void;\n callback?: AnimationCallback;\n}\n"],"mappings":"AAAA,YAAY;;AAAC"}
|
|
1
|
+
{"version":3,"names":[],"sources":["commonTypes.ts"],"sourcesContent":["'use strict';\nimport type {\n StyleProps,\n AnimatableValue,\n AnimationObject,\n Animation,\n Timestamp,\n AnimationCallback,\n} from '../commonTypes';\nimport type { AnimatedStyle } from '../helperTypes';\n\nexport interface HigherOrderAnimation {\n isHigherOrder?: boolean;\n}\n\nexport type NextAnimation<T extends AnimationObject> = T | (() => T);\n\nexport interface ClampAnimation\n extends Animation<ClampAnimation>,\n HigherOrderAnimation {\n current: AnimatableValue;\n}\n\nexport interface DelayAnimation\n extends Animation<DelayAnimation>,\n HigherOrderAnimation {\n startTime: Timestamp;\n started: boolean;\n previousAnimation: DelayAnimation | null;\n current: AnimatableValue;\n}\n\nexport interface RepeatAnimation\n extends Animation<RepeatAnimation>,\n HigherOrderAnimation {\n reps: number;\n startValue: AnimatableValue;\n toValue?: AnimatableValue;\n previousAnimation?: RepeatAnimation;\n}\n\nexport interface SequenceAnimation\n extends Animation<SequenceAnimation>,\n HigherOrderAnimation {\n animationIndex: number;\n}\n\nexport interface StyleLayoutAnimation extends HigherOrderAnimation {\n current: StyleProps;\n styleAnimations: AnimatedStyle<any>;\n onFrame: (animation: StyleLayoutAnimation, timestamp: Timestamp) => boolean;\n onStart: (\n nextAnimation: StyleLayoutAnimation,\n current: AnimatedStyle<any>,\n timestamp: Timestamp,\n previousAnimation: StyleLayoutAnimation\n ) => void;\n callback?: AnimationCallback;\n}\n"],"mappings":"AAAA,YAAY;;AAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["defineAnimation","getReduceMotionForAnimation","rubberBandDecay","isValidRubberBandConfig","rigidDecay","validateConfig","config","clamp","Array","isArray","Error","length","velocityFactor","rubberBandEffect","withDecay","userConfig","callback","deceleration","velocity","rubberBandFactor","Object","keys","forEach","key","decay","animation","now","onStart","value","current","lastTimestamp","startTimestamp","initialVelocity","reduceMotion","onFrame"],"sources":["decay.ts"],"sourcesContent":["'use strict';\nimport { defineAnimation, getReduceMotionForAnimation } from '../util';\nimport type {\n AnimationCallback,\n Timestamp,\n Animation,\n} from '../../commonTypes';\nimport { rubberBandDecay } from './rubberBandDecay';\nimport { isValidRubberBandConfig } from './utils';\nimport type {\n DecayAnimation,\n DecayConfig,\n DefaultDecayConfig,\n InnerDecayAnimation,\n} from './utils';\nimport { rigidDecay } from './rigidDecay';\n\nexport type WithDecayConfig = DecayConfig;\n\n// TODO TYPESCRIPT This is a temporary type to get rid of .d.ts file.\ntype withDecayType = (\n userConfig: DecayConfig,\n callback?: AnimationCallback\n) => number;\n\nfunction validateConfig(config: DefaultDecayConfig): void {\n 'worklet';\n if (config.clamp) {\n if (!Array.isArray(config.clamp)) {\n throw new Error(\n `[Reanimated] \\`config.clamp\\` must be an array but is ${typeof config.clamp}.`\n );\n }\n if (config.clamp.length !== 2) {\n throw new Error(\n `[Reanimated] \\`clamp array\\` must contain 2 items but is given ${\n config.clamp.length as number\n }.`\n );\n }\n }\n if (config.velocityFactor <= 0) {\n throw new Error(\n `[Reanimated] \\`config.velocityFactor\\` must be greather then 0 but is ${config.velocityFactor}.`\n );\n }\n if (config.rubberBandEffect && !config.clamp) {\n throw new Error(\n '[Reanimated] You need to set `clamp` property when using `rubberBandEffect`.'\n );\n }\n}\n\n/**\n * Lets you create animations that mimic objects in motion with friction.\n *\n * @param config - The decay animation configuration - {@link DecayConfig}.\n * @param callback - A function called upon animation completion - {@link AnimationCallback}.\n * @returns An [animation object](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#animation-object) which holds the current state of the animation.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/animations/withDecay\n */\nexport const withDecay = function (\n userConfig: DecayConfig,\n callback?: AnimationCallback\n): Animation<DecayAnimation> {\n 'worklet';\n\n return defineAnimation<DecayAnimation>(0, () => {\n 'worklet';\n const config: DefaultDecayConfig = {\n deceleration: 0.998,\n velocityFactor: 1,\n velocity: 0,\n rubberBandFactor: 0.6,\n };\n if (userConfig) {\n Object.keys(userConfig).forEach(\n (key) =>\n ((config as any)[key] = userConfig[key as keyof typeof userConfig])\n );\n }\n\n const decay: (animation: InnerDecayAnimation, now: number) => boolean =\n isValidRubberBandConfig(config)\n ? (animation, now) => rubberBandDecay(animation, now, config)\n : (animation, now) => rigidDecay(animation, now, config);\n\n function onStart(\n animation: DecayAnimation,\n value: number,\n now: Timestamp\n ): void {\n animation.current = value;\n animation.lastTimestamp = now;\n animation.startTimestamp = now;\n animation.initialVelocity = config.velocity;\n validateConfig(config);\n\n if (animation.reduceMotion && config.clamp) {\n if (value < config.clamp[0]) {\n animation.current = config.clamp[0];\n } else if (value > config.clamp[1]) {\n animation.current = config.clamp[1];\n }\n }\n }\n\n return {\n onFrame: decay,\n onStart,\n callback,\n velocity: config.velocity ?? 0,\n initialVelocity: 0,\n current: 0,\n lastTimestamp: 0,\n startTimestamp: 0,\n reduceMotion: getReduceMotionForAnimation(config.reduceMotion),\n } as DecayAnimation;\n });\n} as unknown as withDecayType;\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,eAAe,EAAEC,2BAA2B,QAAQ,SAAS;AAMtE,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,uBAAuB,QAAQ,SAAS;AAOjD,SAASC,UAAU,QAAQ,cAAc;;AAIzC;;AAMA,SAASC,cAAcA,CAACC,MAA0B,EAAQ;EACxD,SAAS;;EACT,IAAIA,MAAM,CAACC,KAAK,EAAE;IAChB,IAAI,CAACC,KAAK,CAACC,OAAO,CAACH,MAAM,CAACC,KAAK,CAAC,EAAE;MAChC,MAAM,IAAIG,KAAK,CACZ,yDAAwD,OAAOJ,MAAM,CAACC,KAAM,
|
|
1
|
+
{"version":3,"names":["defineAnimation","getReduceMotionForAnimation","rubberBandDecay","isValidRubberBandConfig","rigidDecay","validateConfig","config","clamp","Array","isArray","Error","length","velocityFactor","rubberBandEffect","withDecay","userConfig","callback","deceleration","velocity","rubberBandFactor","Object","keys","forEach","key","decay","animation","now","onStart","value","current","lastTimestamp","startTimestamp","initialVelocity","reduceMotion","onFrame"],"sources":["decay.ts"],"sourcesContent":["'use strict';\nimport { defineAnimation, getReduceMotionForAnimation } from '../util';\nimport type {\n AnimationCallback,\n Timestamp,\n Animation,\n} from '../../commonTypes';\nimport { rubberBandDecay } from './rubberBandDecay';\nimport { isValidRubberBandConfig } from './utils';\nimport type {\n DecayAnimation,\n DecayConfig,\n DefaultDecayConfig,\n InnerDecayAnimation,\n} from './utils';\nimport { rigidDecay } from './rigidDecay';\n\nexport type WithDecayConfig = DecayConfig;\n\n// TODO TYPESCRIPT This is a temporary type to get rid of .d.ts file.\ntype withDecayType = (\n userConfig: DecayConfig,\n callback?: AnimationCallback\n) => number;\n\nfunction validateConfig(config: DefaultDecayConfig): void {\n 'worklet';\n if (config.clamp) {\n if (!Array.isArray(config.clamp)) {\n throw new Error(\n `[Reanimated] \\`config.clamp\\` must be an array but is ${typeof config.clamp}.`\n );\n }\n if (config.clamp.length !== 2) {\n throw new Error(\n `[Reanimated] \\`clamp array\\` must contain 2 items but is given ${\n config.clamp.length as number\n }.`\n );\n }\n }\n if (config.velocityFactor <= 0) {\n throw new Error(\n `[Reanimated] \\`config.velocityFactor\\` must be greather then 0 but is ${config.velocityFactor}.`\n );\n }\n if (config.rubberBandEffect && !config.clamp) {\n throw new Error(\n '[Reanimated] You need to set `clamp` property when using `rubberBandEffect`.'\n );\n }\n}\n\n/**\n * Lets you create animations that mimic objects in motion with friction.\n *\n * @param config - The decay animation configuration - {@link DecayConfig}.\n * @param callback - A function called upon animation completion - {@link AnimationCallback}.\n * @returns An [animation object](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#animation-object) which holds the current state of the animation.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/animations/withDecay\n */\nexport const withDecay = function (\n userConfig: DecayConfig,\n callback?: AnimationCallback\n): Animation<DecayAnimation> {\n 'worklet';\n\n return defineAnimation<DecayAnimation>(0, () => {\n 'worklet';\n const config: DefaultDecayConfig = {\n deceleration: 0.998,\n velocityFactor: 1,\n velocity: 0,\n rubberBandFactor: 0.6,\n };\n if (userConfig) {\n Object.keys(userConfig).forEach(\n (key) =>\n ((config as any)[key] = userConfig[key as keyof typeof userConfig])\n );\n }\n\n const decay: (animation: InnerDecayAnimation, now: number) => boolean =\n isValidRubberBandConfig(config)\n ? (animation, now) => rubberBandDecay(animation, now, config)\n : (animation, now) => rigidDecay(animation, now, config);\n\n function onStart(\n animation: DecayAnimation,\n value: number,\n now: Timestamp\n ): void {\n animation.current = value;\n animation.lastTimestamp = now;\n animation.startTimestamp = now;\n animation.initialVelocity = config.velocity;\n validateConfig(config);\n\n if (animation.reduceMotion && config.clamp) {\n if (value < config.clamp[0]) {\n animation.current = config.clamp[0];\n } else if (value > config.clamp[1]) {\n animation.current = config.clamp[1];\n }\n }\n }\n\n return {\n onFrame: decay,\n onStart,\n callback,\n velocity: config.velocity ?? 0,\n initialVelocity: 0,\n current: 0,\n lastTimestamp: 0,\n startTimestamp: 0,\n reduceMotion: getReduceMotionForAnimation(config.reduceMotion),\n } as DecayAnimation;\n });\n} as unknown as withDecayType;\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,eAAe,EAAEC,2BAA2B,QAAQ,SAAS;AAMtE,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,uBAAuB,QAAQ,SAAS;AAOjD,SAASC,UAAU,QAAQ,cAAc;;AAIzC;;AAMA,SAASC,cAAcA,CAACC,MAA0B,EAAQ;EACxD,SAAS;;EACT,IAAIA,MAAM,CAACC,KAAK,EAAE;IAChB,IAAI,CAACC,KAAK,CAACC,OAAO,CAACH,MAAM,CAACC,KAAK,CAAC,EAAE;MAChC,MAAM,IAAIG,KAAK,CACZ,yDAAwD,OAAOJ,MAAM,CAACC,KAAM,GAC/E,CAAC;IACH;IACA,IAAID,MAAM,CAACC,KAAK,CAACI,MAAM,KAAK,CAAC,EAAE;MAC7B,MAAM,IAAID,KAAK,CACZ,kEACCJ,MAAM,CAACC,KAAK,CAACI,MACd,GACH,CAAC;IACH;EACF;EACA,IAAIL,MAAM,CAACM,cAAc,IAAI,CAAC,EAAE;IAC9B,MAAM,IAAIF,KAAK,CACZ,yEAAwEJ,MAAM,CAACM,cAAe,GACjG,CAAC;EACH;EACA,IAAIN,MAAM,CAACO,gBAAgB,IAAI,CAACP,MAAM,CAACC,KAAK,EAAE;IAC5C,MAAM,IAAIG,KAAK,CACb,8EACF,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMI,SAAS,GAAG,SAAAA,CACvBC,UAAuB,EACvBC,QAA4B,EACD;EAC3B,SAAS;;EAET,OAAOhB,eAAe,CAAiB,CAAC,EAAE,MAAM;IAC9C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EAAEV,KAAK;MACdG,OAAO;MACPX,QAAQ;MACRE,QAAQ,EAAEZ,MAAM,CAACY,QAAQ,IAAI,CAAC;MAC9Bc,eAAe,EAAE,CAAC;MAClBH,OAAO,EAAE,CAAC;MACVC,aAAa,EAAE,CAAC;MAChBC,cAAc,EAAE,CAAC;MACjBE,YAAY,EAAEhC,2BAA2B,CAACK,MAAM,CAAC2B,YAAY;IAC/D,CAAC;EACH,CAAC,CAAC;AACJ,CAA6B","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withDecay"],"sources":["index.ts"],"sourcesContent":["'use strict';\nexport type { WithDecayConfig } from './decay';\nexport { withDecay } from './decay';\nexport type { DecayAnimation } from './utils';\n"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,SAAS,QAAQ,SAAS"}
|
|
1
|
+
{"version":3,"names":["withDecay"],"sources":["index.ts"],"sourcesContent":["'use strict';\nexport type { WithDecayConfig } from './decay';\nexport { withDecay } from './decay';\nexport type { DecayAnimation } from './utils';\n"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,SAAS,QAAQ,SAAS","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SLOPE_FACTOR","VELOCITY_EPS","rigidDecay","animation","now","config","lastTimestamp","startTimestamp","initialVelocity","current","velocity","deltaTime","Math","min","v","exp","deceleration","velocityFactor","clamp","abs"],"sources":["rigidDecay.ts"],"sourcesContent":["'use strict';\nimport { SLOPE_FACTOR, VELOCITY_EPS } from './utils';\nimport type { DefaultDecayConfig, InnerDecayAnimation } from './utils';\n\nexport function rigidDecay(\n animation: InnerDecayAnimation,\n now: number,\n config: DefaultDecayConfig\n): boolean {\n 'worklet';\n const { lastTimestamp, startTimestamp, initialVelocity, current, velocity } =\n animation;\n\n const deltaTime = Math.min(now - lastTimestamp, 64);\n const v =\n velocity *\n Math.exp(\n -(1 - config.deceleration) * (now - startTimestamp) * SLOPE_FACTOR\n );\n animation.current = current + (v * config.velocityFactor * deltaTime) / 1000;\n animation.velocity = v;\n animation.lastTimestamp = now;\n\n if (config.clamp) {\n if (initialVelocity < 0 && animation.current <= config.clamp[0]) {\n animation.current = config.clamp[0];\n return true;\n } else if (initialVelocity > 0 && animation.current >= config.clamp[1]) {\n animation.current = config.clamp[1];\n return true;\n }\n }\n return Math.abs(v) < VELOCITY_EPS;\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,YAAY,EAAEC,YAAY,QAAQ,SAAS;AAGpD,OAAO,SAASC,UAAUA,CACxBC,SAA8B,EAC9BC,GAAW,EACXC,MAA0B,EACjB;EACT,SAAS;;EACT,MAAM;IAAEC,aAAa;IAAEC,cAAc;IAAEC,eAAe;IAAEC,OAAO;IAAEC;EAAS,CAAC,GACzEP,SAAS;EAEX,MAAMQ,SAAS,GAAGC,IAAI,CAACC,GAAG,CAACT,GAAG,GAAGE,aAAa,EAAE,EAAE,CAAC;EACnD,MAAMQ,CAAC,GACLJ,QAAQ,GACRE,IAAI,CAACG,GAAG,CACN,EAAE,CAAC,GAAGV,MAAM,CAACW,YAAY,CAAC,IAAIZ,GAAG,GAAGG,cAAc,CAAC,GAAGP,
|
|
1
|
+
{"version":3,"names":["SLOPE_FACTOR","VELOCITY_EPS","rigidDecay","animation","now","config","lastTimestamp","startTimestamp","initialVelocity","current","velocity","deltaTime","Math","min","v","exp","deceleration","velocityFactor","clamp","abs"],"sources":["rigidDecay.ts"],"sourcesContent":["'use strict';\nimport { SLOPE_FACTOR, VELOCITY_EPS } from './utils';\nimport type { DefaultDecayConfig, InnerDecayAnimation } from './utils';\n\nexport function rigidDecay(\n animation: InnerDecayAnimation,\n now: number,\n config: DefaultDecayConfig\n): boolean {\n 'worklet';\n const { lastTimestamp, startTimestamp, initialVelocity, current, velocity } =\n animation;\n\n const deltaTime = Math.min(now - lastTimestamp, 64);\n const v =\n velocity *\n Math.exp(\n -(1 - config.deceleration) * (now - startTimestamp) * SLOPE_FACTOR\n );\n animation.current = current + (v * config.velocityFactor * deltaTime) / 1000;\n animation.velocity = v;\n animation.lastTimestamp = now;\n\n if (config.clamp) {\n if (initialVelocity < 0 && animation.current <= config.clamp[0]) {\n animation.current = config.clamp[0];\n return true;\n } else if (initialVelocity > 0 && animation.current >= config.clamp[1]) {\n animation.current = config.clamp[1];\n return true;\n }\n }\n return Math.abs(v) < VELOCITY_EPS;\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,YAAY,EAAEC,YAAY,QAAQ,SAAS;AAGpD,OAAO,SAASC,UAAUA,CACxBC,SAA8B,EAC9BC,GAAW,EACXC,MAA0B,EACjB;EACT,SAAS;;EACT,MAAM;IAAEC,aAAa;IAAEC,cAAc;IAAEC,eAAe;IAAEC,OAAO;IAAEC;EAAS,CAAC,GACzEP,SAAS;EAEX,MAAMQ,SAAS,GAAGC,IAAI,CAACC,GAAG,CAACT,GAAG,GAAGE,aAAa,EAAE,EAAE,CAAC;EACnD,MAAMQ,CAAC,GACLJ,QAAQ,GACRE,IAAI,CAACG,GAAG,CACN,EAAE,CAAC,GAAGV,MAAM,CAACW,YAAY,CAAC,IAAIZ,GAAG,GAAGG,cAAc,CAAC,GAAGP,YACxD,CAAC;EACHG,SAAS,CAACM,OAAO,GAAGA,OAAO,GAAIK,CAAC,GAAGT,MAAM,CAACY,cAAc,GAAGN,SAAS,GAAI,IAAI;EAC5ER,SAAS,CAACO,QAAQ,GAAGI,CAAC;EACtBX,SAAS,CAACG,aAAa,GAAGF,GAAG;EAE7B,IAAIC,MAAM,CAACa,KAAK,EAAE;IAChB,IAAIV,eAAe,GAAG,CAAC,IAAIL,SAAS,CAACM,OAAO,IAAIJ,MAAM,CAACa,KAAK,CAAC,CAAC,CAAC,EAAE;MAC/Df,SAAS,CAACM,OAAO,GAAGJ,MAAM,CAACa,KAAK,CAAC,CAAC,CAAC;MACnC,OAAO,IAAI;IACb,CAAC,MAAM,IAAIV,eAAe,GAAG,CAAC,IAAIL,SAAS,CAACM,OAAO,IAAIJ,MAAM,CAACa,KAAK,CAAC,CAAC,CAAC,EAAE;MACtEf,SAAS,CAACM,OAAO,GAAGJ,MAAM,CAACa,KAAK,CAAC,CAAC,CAAC;MACnC,OAAO,IAAI;IACb;EACF;EACA,OAAON,IAAI,CAACO,GAAG,CAACL,CAAC,CAAC,GAAGb,YAAY;AACnC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SLOPE_FACTOR","VELOCITY_EPS","DERIVATIVE_EPS","rubberBandDecay","animation","now","config","lastTimestamp","startTimestamp","current","velocity","deltaTime","Math","min","clampIndex","abs","clamp","derivative","v","exp","deceleration","rubberBandFactor","springActive","velocityFactor"],"sources":["rubberBandDecay.ts"],"sourcesContent":["'use strict';\nimport type { RubberBandDecayConfig, InnerDecayAnimation } from './utils';\nimport { SLOPE_FACTOR, VELOCITY_EPS } from './utils';\n\nconst DERIVATIVE_EPS = 0.1;\n\nexport function rubberBandDecay(\n animation: InnerDecayAnimation,\n now: number,\n config: RubberBandDecayConfig\n): boolean {\n 'worklet';\n const { lastTimestamp, startTimestamp, current, velocity } = animation;\n\n const deltaTime = Math.min(now - lastTimestamp, 64);\n const clampIndex =\n Math.abs(current - config.clamp[0]) < Math.abs(current - config.clamp[1])\n ? 0\n : 1;\n\n let derivative = 0;\n if (current < config.clamp[0] || current > config.clamp[1]) {\n derivative = current - config.clamp[clampIndex];\n }\n\n const v =\n velocity *\n Math.exp(\n -(1 - config.deceleration) * (now - startTimestamp) * SLOPE_FACTOR\n ) -\n derivative * config.rubberBandFactor;\n\n if (Math.abs(derivative) > DERIVATIVE_EPS) {\n animation.springActive = true;\n } else if (animation.springActive) {\n animation.current = config.clamp[clampIndex];\n return true;\n } else if (Math.abs(v) < VELOCITY_EPS) {\n return true;\n }\n\n animation.current = current + (v * config.velocityFactor * deltaTime) / 1000;\n animation.velocity = v;\n animation.lastTimestamp = now;\n return false;\n}\n"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,YAAY,EAAEC,YAAY,QAAQ,SAAS;AAEpD,MAAMC,cAAc,GAAG,GAAG;AAE1B,OAAO,SAASC,eAAeA,CAC7BC,SAA8B,EAC9BC,GAAW,EACXC,MAA6B,EACpB;EACT,SAAS;;EACT,MAAM;IAAEC,aAAa;IAAEC,cAAc;IAAEC,OAAO;IAAEC;EAAS,CAAC,GAAGN,SAAS;EAEtE,MAAMO,SAAS,GAAGC,IAAI,CAACC,GAAG,CAACR,GAAG,GAAGE,aAAa,EAAE,EAAE,CAAC;EACnD,MAAMO,UAAU,GACdF,IAAI,CAACG,GAAG,CAACN,OAAO,GAAGH,MAAM,CAACU,KAAK,CAAC,CAAC,CAAC,CAAC,GAAGJ,IAAI,CAACG,GAAG,CAACN,OAAO,GAAGH,MAAM,CAACU,KAAK,CAAC,CAAC,CAAC,CAAC,GACrE,CAAC,GACD,CAAC;EAEP,IAAIC,UAAU,GAAG,CAAC;EAClB,IAAIR,OAAO,GAAGH,MAAM,CAACU,KAAK,CAAC,CAAC,CAAC,IAAIP,OAAO,GAAGH,MAAM,CAACU,KAAK,CAAC,CAAC,CAAC,EAAE;IAC1DC,UAAU,GAAGR,OAAO,GAAGH,MAAM,CAACU,KAAK,CAACF,UAAU,CAAC;EACjD;EAEA,MAAMI,CAAC,GACLR,QAAQ,GACNE,IAAI,CAACO,GAAG,CACN,EAAE,CAAC,GAAGb,MAAM,CAACc,YAAY,CAAC,IAAIf,GAAG,GAAGG,cAAc,CAAC,GAAGR,
|
|
1
|
+
{"version":3,"names":["SLOPE_FACTOR","VELOCITY_EPS","DERIVATIVE_EPS","rubberBandDecay","animation","now","config","lastTimestamp","startTimestamp","current","velocity","deltaTime","Math","min","clampIndex","abs","clamp","derivative","v","exp","deceleration","rubberBandFactor","springActive","velocityFactor"],"sources":["rubberBandDecay.ts"],"sourcesContent":["'use strict';\nimport type { RubberBandDecayConfig, InnerDecayAnimation } from './utils';\nimport { SLOPE_FACTOR, VELOCITY_EPS } from './utils';\n\nconst DERIVATIVE_EPS = 0.1;\n\nexport function rubberBandDecay(\n animation: InnerDecayAnimation,\n now: number,\n config: RubberBandDecayConfig\n): boolean {\n 'worklet';\n const { lastTimestamp, startTimestamp, current, velocity } = animation;\n\n const deltaTime = Math.min(now - lastTimestamp, 64);\n const clampIndex =\n Math.abs(current - config.clamp[0]) < Math.abs(current - config.clamp[1])\n ? 0\n : 1;\n\n let derivative = 0;\n if (current < config.clamp[0] || current > config.clamp[1]) {\n derivative = current - config.clamp[clampIndex];\n }\n\n const v =\n velocity *\n Math.exp(\n -(1 - config.deceleration) * (now - startTimestamp) * SLOPE_FACTOR\n ) -\n derivative * config.rubberBandFactor;\n\n if (Math.abs(derivative) > DERIVATIVE_EPS) {\n animation.springActive = true;\n } else if (animation.springActive) {\n animation.current = config.clamp[clampIndex];\n return true;\n } else if (Math.abs(v) < VELOCITY_EPS) {\n return true;\n }\n\n animation.current = current + (v * config.velocityFactor * deltaTime) / 1000;\n animation.velocity = v;\n animation.lastTimestamp = now;\n return false;\n}\n"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,YAAY,EAAEC,YAAY,QAAQ,SAAS;AAEpD,MAAMC,cAAc,GAAG,GAAG;AAE1B,OAAO,SAASC,eAAeA,CAC7BC,SAA8B,EAC9BC,GAAW,EACXC,MAA6B,EACpB;EACT,SAAS;;EACT,MAAM;IAAEC,aAAa;IAAEC,cAAc;IAAEC,OAAO;IAAEC;EAAS,CAAC,GAAGN,SAAS;EAEtE,MAAMO,SAAS,GAAGC,IAAI,CAACC,GAAG,CAACR,GAAG,GAAGE,aAAa,EAAE,EAAE,CAAC;EACnD,MAAMO,UAAU,GACdF,IAAI,CAACG,GAAG,CAACN,OAAO,GAAGH,MAAM,CAACU,KAAK,CAAC,CAAC,CAAC,CAAC,GAAGJ,IAAI,CAACG,GAAG,CAACN,OAAO,GAAGH,MAAM,CAACU,KAAK,CAAC,CAAC,CAAC,CAAC,GACrE,CAAC,GACD,CAAC;EAEP,IAAIC,UAAU,GAAG,CAAC;EAClB,IAAIR,OAAO,GAAGH,MAAM,CAACU,KAAK,CAAC,CAAC,CAAC,IAAIP,OAAO,GAAGH,MAAM,CAACU,KAAK,CAAC,CAAC,CAAC,EAAE;IAC1DC,UAAU,GAAGR,OAAO,GAAGH,MAAM,CAACU,KAAK,CAACF,UAAU,CAAC;EACjD;EAEA,MAAMI,CAAC,GACLR,QAAQ,GACNE,IAAI,CAACO,GAAG,CACN,EAAE,CAAC,GAAGb,MAAM,CAACc,YAAY,CAAC,IAAIf,GAAG,GAAGG,cAAc,CAAC,GAAGR,YACxD,CAAC,GACHiB,UAAU,GAAGX,MAAM,CAACe,gBAAgB;EAEtC,IAAIT,IAAI,CAACG,GAAG,CAACE,UAAU,CAAC,GAAGf,cAAc,EAAE;IACzCE,SAAS,CAACkB,YAAY,GAAG,IAAI;EAC/B,CAAC,MAAM,IAAIlB,SAAS,CAACkB,YAAY,EAAE;IACjClB,SAAS,CAACK,OAAO,GAAGH,MAAM,CAACU,KAAK,CAACF,UAAU,CAAC;IAC5C,OAAO,IAAI;EACb,CAAC,MAAM,IAAIF,IAAI,CAACG,GAAG,CAACG,CAAC,CAAC,GAAGjB,YAAY,EAAE;IACrC,OAAO,IAAI;EACb;EAEAG,SAAS,CAACK,OAAO,GAAGA,OAAO,GAAIS,CAAC,GAAGZ,MAAM,CAACiB,cAAc,GAAGZ,SAAS,GAAI,IAAI;EAC5EP,SAAS,CAACM,QAAQ,GAAGQ,CAAC;EACtBd,SAAS,CAACG,aAAa,GAAGF,GAAG;EAC7B,OAAO,KAAK;AACd","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isWeb","IS_WEB","VELOCITY_EPS","SLOPE_FACTOR","isValidRubberBandConfig","config","rubberBandEffect","Array","isArray","clamp","length"],"sources":["utils.ts"],"sourcesContent":["'use strict';\nimport type {\n AnimatableValue,\n AnimationObject,\n Animation,\n ReduceMotion,\n Timestamp,\n RequiredKeys,\n} from '../../../reanimated2/commonTypes';\nimport { isWeb } from '../../PlatformChecker';\n\nconst IS_WEB = isWeb();\nexport const VELOCITY_EPS = IS_WEB ? 1 / 20 : 1;\nexport const SLOPE_FACTOR = 0.1;\n\nexport interface DecayAnimation extends Animation<DecayAnimation> {\n lastTimestamp: Timestamp;\n startTimestamp: Timestamp;\n initialVelocity: number;\n velocity: number;\n current: AnimatableValue;\n}\n\nexport interface InnerDecayAnimation\n extends Omit<DecayAnimation, 'current'>,\n AnimationObject {\n current: number;\n springActive?: boolean;\n}\n\n/**\n * The decay animation configuration.\n *\n * @param velocity - Initial velocity of the animation. Defaults to 0.\n * @param deceleration - The rate at which the velocity decreases over time. Defaults to 0.998.\n * @param clamp - Array of two numbers which restricts animation's range. Defaults to [].\n * @param velocityFactor - Velocity multiplier. Defaults to 1.\n * @param rubberBandEffect - Makes the animation bounce over the limit specified in `clamp`. Defaults to `false`.\n * @param rubberBandFactor - Strength of the rubber band effect. Defaults to 0.6.\n * @param reduceMotion - Determines how the animation responds to the device's reduced motion accessibility setting. Default to `ReduceMotion.System` - {@link ReduceMotion}.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/animations/withDecay#config\n */\nexport type DecayConfig = {\n deceleration?: number;\n velocityFactor?: number;\n velocity?: number;\n reduceMotion?: ReduceMotion;\n} & (\n | {\n rubberBandEffect?: false;\n clamp?: [min: number, max: number];\n }\n | {\n rubberBandEffect: true;\n clamp: [min: number, max: number];\n rubberBandFactor?: number;\n }\n);\n\nexport type DefaultDecayConfig = RequiredKeys<\n DecayConfig,\n 'deceleration' | 'velocityFactor' | 'velocity'\n> & { rubberBandFactor: number };\n\n// If user wants to use rubber band decay animation we have to make sure he has provided clamp\nexport type RubberBandDecayConfig = RequiredKeys<\n DefaultDecayConfig,\n 'clamp'\n> & { rubberBandEffect: true };\n\nexport function isValidRubberBandConfig(\n config: DefaultDecayConfig\n): config is RubberBandDecayConfig {\n 'worklet';\n return (\n !!config.rubberBandEffect &&\n Array.isArray(config.clamp) &&\n config.clamp.length === 2\n );\n}\n"],"mappings":"AAAA,YAAY;;AASZ,SAASA,KAAK,QAAQ,uBAAuB;AAE7C,MAAMC,MAAM,GAAGD,KAAK,
|
|
1
|
+
{"version":3,"names":["isWeb","IS_WEB","VELOCITY_EPS","SLOPE_FACTOR","isValidRubberBandConfig","config","rubberBandEffect","Array","isArray","clamp","length"],"sources":["utils.ts"],"sourcesContent":["'use strict';\nimport type {\n AnimatableValue,\n AnimationObject,\n Animation,\n ReduceMotion,\n Timestamp,\n RequiredKeys,\n} from '../../../reanimated2/commonTypes';\nimport { isWeb } from '../../PlatformChecker';\n\nconst IS_WEB = isWeb();\nexport const VELOCITY_EPS = IS_WEB ? 1 / 20 : 1;\nexport const SLOPE_FACTOR = 0.1;\n\nexport interface DecayAnimation extends Animation<DecayAnimation> {\n lastTimestamp: Timestamp;\n startTimestamp: Timestamp;\n initialVelocity: number;\n velocity: number;\n current: AnimatableValue;\n}\n\nexport interface InnerDecayAnimation\n extends Omit<DecayAnimation, 'current'>,\n AnimationObject {\n current: number;\n springActive?: boolean;\n}\n\n/**\n * The decay animation configuration.\n *\n * @param velocity - Initial velocity of the animation. Defaults to 0.\n * @param deceleration - The rate at which the velocity decreases over time. Defaults to 0.998.\n * @param clamp - Array of two numbers which restricts animation's range. Defaults to [].\n * @param velocityFactor - Velocity multiplier. Defaults to 1.\n * @param rubberBandEffect - Makes the animation bounce over the limit specified in `clamp`. Defaults to `false`.\n * @param rubberBandFactor - Strength of the rubber band effect. Defaults to 0.6.\n * @param reduceMotion - Determines how the animation responds to the device's reduced motion accessibility setting. Default to `ReduceMotion.System` - {@link ReduceMotion}.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/animations/withDecay#config\n */\nexport type DecayConfig = {\n deceleration?: number;\n velocityFactor?: number;\n velocity?: number;\n reduceMotion?: ReduceMotion;\n} & (\n | {\n rubberBandEffect?: false;\n clamp?: [min: number, max: number];\n }\n | {\n rubberBandEffect: true;\n clamp: [min: number, max: number];\n rubberBandFactor?: number;\n }\n);\n\nexport type DefaultDecayConfig = RequiredKeys<\n DecayConfig,\n 'deceleration' | 'velocityFactor' | 'velocity'\n> & { rubberBandFactor: number };\n\n// If user wants to use rubber band decay animation we have to make sure he has provided clamp\nexport type RubberBandDecayConfig = RequiredKeys<\n DefaultDecayConfig,\n 'clamp'\n> & { rubberBandEffect: true };\n\nexport function isValidRubberBandConfig(\n config: DefaultDecayConfig\n): config is RubberBandDecayConfig {\n 'worklet';\n return (\n !!config.rubberBandEffect &&\n Array.isArray(config.clamp) &&\n config.clamp.length === 2\n );\n}\n"],"mappings":"AAAA,YAAY;;AASZ,SAASA,KAAK,QAAQ,uBAAuB;AAE7C,MAAMC,MAAM,GAAGD,KAAK,CAAC,CAAC;AACtB,OAAO,MAAME,YAAY,GAAGD,MAAM,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC;AAC/C,OAAO,MAAME,YAAY,GAAG,GAAG;;AAiB/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAuBA;;AAMA,OAAO,SAASC,uBAAuBA,CACrCC,MAA0B,EACO;EACjC,SAAS;;EACT,OACE,CAAC,CAACA,MAAM,CAACC,gBAAgB,IACzBC,KAAK,CAACC,OAAO,CAACH,MAAM,CAACI,KAAK,CAAC,IAC3BJ,MAAM,CAACI,KAAK,CAACC,MAAM,KAAK,CAAC;AAE7B","ignoreList":[]}
|