react-native-reanimated 3.6.0 → 3.6.2
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/lib/module/createAnimatedComponent/createAnimatedComponent.js +12 -0
- package/lib/module/createAnimatedComponent/createAnimatedComponent.js.map +1 -1
- package/lib/module/createAnimatedComponent/setAndForwardRef.js +2 -0
- package/lib/module/createAnimatedComponent/setAndForwardRef.js.map +1 -1
- package/lib/module/reanimated2/Easing.js +3 -3
- package/lib/module/reanimated2/Easing.js.map +1 -1
- package/lib/module/reanimated2/PlatformChecker.js.map +1 -1
- package/lib/module/reanimated2/animation/decay/decay.js +9 -0
- package/lib/module/reanimated2/animation/decay/decay.js.map +1 -1
- package/lib/module/reanimated2/animation/decay/utils.js +13 -0
- package/lib/module/reanimated2/animation/decay/utils.js.map +1 -1
- package/lib/module/reanimated2/animation/delay.js +9 -0
- package/lib/module/reanimated2/animation/delay.js.map +1 -1
- package/lib/module/reanimated2/animation/repeat.js +11 -0
- package/lib/module/reanimated2/animation/repeat.js.map +1 -1
- package/lib/module/reanimated2/animation/sequence.js +10 -0
- package/lib/module/reanimated2/animation/sequence.js.map +1 -1
- package/lib/module/reanimated2/animation/spring.js +9 -0
- package/lib/module/reanimated2/animation/spring.js.map +1 -1
- package/lib/module/reanimated2/animation/springUtils.js +16 -0
- package/lib/module/reanimated2/animation/springUtils.js.map +1 -1
- package/lib/module/reanimated2/animation/timing.js +18 -0
- package/lib/module/reanimated2/animation/timing.js.map +1 -1
- package/lib/module/reanimated2/animation/util.js +7 -0
- package/lib/module/reanimated2/animation/util.js.map +1 -1
- package/lib/module/reanimated2/commonTypes.js +30 -7
- package/lib/module/reanimated2/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/component/FlatList.js.map +1 -1
- package/lib/module/reanimated2/component/LayoutAnimationConfig.js +7 -0
- package/lib/module/reanimated2/component/LayoutAnimationConfig.js.map +1 -1
- package/lib/module/reanimated2/component/ScrollView.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/useAnimatedKeyboard.js +8 -0
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedProps.js +9 -0
- package/lib/module/reanimated2/hook/useAnimatedProps.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedReaction.js +6 -4
- package/lib/module/reanimated2/hook/useAnimatedReaction.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedRef.js +7 -0
- package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js +10 -2
- package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedSensor.js +10 -0
- package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedStyle.js +8 -0
- package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/module/reanimated2/hook/useDerivedValue.js +14 -8
- package/lib/module/reanimated2/hook/useDerivedValue.js.map +1 -1
- package/lib/module/reanimated2/hook/useEvent.js +7 -6
- package/lib/module/reanimated2/hook/useEvent.js.map +1 -1
- package/lib/module/reanimated2/hook/useFrameCallback.js +17 -0
- package/lib/module/reanimated2/hook/useFrameCallback.js.map +1 -1
- package/lib/module/reanimated2/hook/useHandler.js +8 -2
- package/lib/module/reanimated2/hook/useHandler.js.map +1 -1
- package/lib/module/reanimated2/hook/useReducedMotion.js +9 -0
- package/lib/module/reanimated2/hook/useReducedMotion.js.map +1 -1
- package/lib/module/reanimated2/hook/useScrollViewOffset.js +8 -0
- package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -1
- package/lib/module/reanimated2/hook/useSharedValue.js +11 -3
- package/lib/module/reanimated2/hook/useSharedValue.js.map +1 -1
- package/lib/module/reanimated2/hook/useWorkletCallback.js +3 -0
- package/lib/module/reanimated2/hook/useWorkletCallback.js.map +1 -1
- package/lib/module/reanimated2/index.js +1 -1
- package/lib/module/reanimated2/index.js.map +1 -1
- package/lib/module/reanimated2/interpolateColor.js +21 -0
- package/lib/module/reanimated2/interpolateColor.js.map +1 -1
- package/lib/module/reanimated2/interpolation.js +51 -21
- package/lib/module/reanimated2/interpolation.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +29 -2
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +67 -2
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +6 -3
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +4 -0
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +80 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js +79 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js +96 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +31 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +15 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js +31 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +63 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js +64 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +32 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +128 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +8 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +9 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +8 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +8 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +10 -3
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +8 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.js +49 -3
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/createAnimation.js +4 -4
- package/lib/module/reanimated2/layoutReanimation/web/createAnimation.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/checkCppVersion.js +0 -2
- 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 +9 -0
- package/lib/module/reanimated2/platformFunctions/dispatchCommand.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/getRelativeCoords.js +14 -4
- package/lib/module/reanimated2/platformFunctions/getRelativeCoords.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/measure.js +7 -0
- package/lib/module/reanimated2/platformFunctions/measure.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/scrollTo.js +9 -0
- package/lib/module/reanimated2/platformFunctions/scrollTo.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/setNativeProps.js +8 -0
- package/lib/module/reanimated2/platformFunctions/setNativeProps.js.map +1 -1
- package/lib/module/reanimated2/runtimes.js +8 -0
- package/lib/module/reanimated2/runtimes.js.map +1 -1
- package/lib/module/reanimated2/threads.js +16 -6
- package/lib/module/reanimated2/threads.js.map +1 -1
- package/lib/typescript/createAnimatedComponent/createAnimatedComponent.d.ts +12 -0
- package/lib/typescript/reanimated2/Easing.d.ts +3 -3
- package/lib/typescript/reanimated2/animation/decay/decay.d.ts +8 -0
- package/lib/typescript/reanimated2/animation/decay/utils.d.ts +12 -0
- package/lib/typescript/reanimated2/animation/delay.d.ts +9 -0
- package/lib/typescript/reanimated2/animation/repeat.d.ts +11 -0
- package/lib/typescript/reanimated2/animation/sequence.d.ts +8 -0
- package/lib/typescript/reanimated2/animation/spring.d.ts +9 -0
- package/lib/typescript/reanimated2/animation/springUtils.d.ts +15 -0
- package/lib/typescript/reanimated2/animation/timing.d.ts +17 -0
- package/lib/typescript/reanimated2/animation/util.d.ts +6 -0
- package/lib/typescript/reanimated2/commonTypes.d.ts +25 -7
- package/lib/typescript/reanimated2/component/FlatList.d.ts +6 -0
- package/lib/typescript/reanimated2/component/LayoutAnimationConfig.d.ts +7 -0
- package/lib/typescript/reanimated2/component/ScrollView.d.ts +3 -2
- package/lib/typescript/reanimated2/helperTypes.d.ts +45 -3
- package/lib/typescript/reanimated2/hook/useAnimatedKeyboard.d.ts +7 -0
- package/lib/typescript/reanimated2/hook/useAnimatedProps.d.ts +9 -0
- package/lib/typescript/reanimated2/hook/useAnimatedReaction.d.ts +6 -4
- package/lib/typescript/reanimated2/hook/useAnimatedRef.d.ts +6 -0
- package/lib/typescript/reanimated2/hook/useAnimatedScrollHandler.d.ts +10 -0
- package/lib/typescript/reanimated2/hook/useAnimatedSensor.d.ts +8 -0
- package/lib/typescript/reanimated2/hook/useAnimatedStyle.d.ts +8 -0
- package/lib/typescript/reanimated2/hook/useDerivedValue.d.ts +9 -1
- package/lib/typescript/reanimated2/hook/useEvent.d.ts +8 -5
- package/lib/typescript/reanimated2/hook/useFrameCallback.d.ts +14 -0
- package/lib/typescript/reanimated2/hook/useHandler.d.ts +8 -0
- package/lib/typescript/reanimated2/hook/useReducedMotion.d.ts +8 -0
- package/lib/typescript/reanimated2/hook/useScrollViewOffset.d.ts +7 -0
- package/lib/typescript/reanimated2/hook/useSharedValue.d.ts +8 -1
- package/lib/typescript/reanimated2/hook/useWorkletCallback.d.ts +3 -0
- package/lib/typescript/reanimated2/index.d.ts +1 -1
- package/lib/typescript/reanimated2/interpolateColor.d.ts +17 -0
- package/lib/typescript/reanimated2/interpolation.d.ts +30 -2
- package/lib/typescript/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.d.ts +25 -2
- package/lib/typescript/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.d.ts +56 -1
- package/lib/typescript/reanimated2/layoutReanimation/animationBuilder/commonTypes.d.ts +4 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultAnimations/Bounce.d.ts +70 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultAnimations/Fade.d.ts +70 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultAnimations/Flip.d.ts +84 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.d.ts +28 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.d.ts +14 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultAnimations/Roll.d.ts +28 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultAnimations/Rotate.d.ts +56 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultAnimations/Slide.d.ts +56 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultAnimations/Stretch.d.ts +28 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultAnimations/Zoom.d.ts +112 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.d.ts +7 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.d.ts +8 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.d.ts +7 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.d.ts +7 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.d.ts +10 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.d.ts +7 -0
- package/lib/typescript/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.d.ts +43 -1
- package/lib/typescript/reanimated2/layoutReanimation/web/createAnimation.d.ts +4 -4
- package/lib/typescript/reanimated2/platform-specific/jsVersion.d.ts +1 -1
- package/lib/typescript/reanimated2/platformFunctions/dispatchCommand.d.ts +8 -0
- package/lib/typescript/reanimated2/platformFunctions/getRelativeCoords.d.ts +11 -3
- package/lib/typescript/reanimated2/platformFunctions/measure.d.ts +7 -0
- package/lib/typescript/reanimated2/platformFunctions/scrollTo.d.ts +9 -0
- package/lib/typescript/reanimated2/platformFunctions/setNativeProps.d.ts +7 -0
- package/lib/typescript/reanimated2/runtimes.d.ts +8 -0
- package/lib/typescript/reanimated2/threads.d.ts +17 -2
- package/package.json +2 -1
- package/src/createAnimatedComponent/createAnimatedComponent.tsx +18 -0
- package/src/createAnimatedComponent/setAndForwardRef.ts +2 -0
- package/src/reanimated2/Easing.ts +3 -3
- package/src/reanimated2/PlatformChecker.ts +1 -1
- package/src/reanimated2/animation/decay/decay.ts +8 -0
- package/src/reanimated2/animation/decay/utils.ts +12 -0
- package/src/reanimated2/animation/delay.ts +9 -0
- package/src/reanimated2/animation/repeat.ts +11 -0
- package/src/reanimated2/animation/sequence.ts +8 -0
- package/src/reanimated2/animation/spring.ts +9 -0
- package/src/reanimated2/animation/springUtils.ts +15 -0
- package/src/reanimated2/animation/timing.ts +17 -0
- package/src/reanimated2/animation/util.ts +6 -0
- package/src/reanimated2/commonTypes.ts +25 -7
- package/src/reanimated2/component/FlatList.tsx +6 -0
- package/src/reanimated2/component/LayoutAnimationConfig.tsx +7 -0
- package/src/reanimated2/component/ScrollView.tsx +3 -1
- package/src/reanimated2/globals.d.ts +1 -1
- package/src/reanimated2/helperTypes.ts +45 -3
- package/src/reanimated2/hook/useAnimatedKeyboard.ts +7 -0
- package/src/reanimated2/hook/useAnimatedProps.ts +9 -0
- package/src/reanimated2/hook/useAnimatedReaction.ts +6 -4
- package/src/reanimated2/hook/useAnimatedRef.ts +6 -0
- package/src/reanimated2/hook/useAnimatedScrollHandler.ts +10 -0
- package/src/reanimated2/hook/useAnimatedSensor.ts +8 -0
- package/src/reanimated2/hook/useAnimatedStyle.ts +8 -0
- package/src/reanimated2/hook/useDerivedValue.ts +15 -7
- package/src/reanimated2/hook/useEvent.ts +9 -6
- package/src/reanimated2/hook/useFrameCallback.ts +14 -0
- package/src/reanimated2/hook/useHandler.ts +8 -0
- package/src/reanimated2/hook/useReducedMotion.ts +8 -0
- package/src/reanimated2/hook/useScrollViewOffset.ts +7 -0
- package/src/reanimated2/hook/useSharedValue.ts +12 -3
- package/src/reanimated2/hook/useWorkletCallback.ts +3 -0
- package/src/reanimated2/index.ts +1 -1
- package/src/reanimated2/interpolateColor.ts +17 -0
- package/src/reanimated2/interpolation.ts +48 -22
- package/src/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.ts +26 -3
- package/src/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.ts +57 -2
- package/src/reanimated2/layoutReanimation/animationBuilder/Keyframe.ts +7 -6
- package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +4 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Bounce.ts +71 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Fade.ts +70 -1
- package/src/reanimated2/layoutReanimation/defaultAnimations/Flip.ts +84 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.ts +28 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.ts +14 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Roll.ts +28 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Rotate.ts +56 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +56 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Stretch.ts +28 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +112 -0
- package/src/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.ts +7 -0
- package/src/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.ts +8 -0
- package/src/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.ts +7 -0
- package/src/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.ts +8 -0
- package/src/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.ts +10 -3
- package/src/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.ts +7 -0
- package/src/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.ts +45 -3
- package/src/reanimated2/layoutReanimation/web/createAnimation.ts +4 -4
- package/src/reanimated2/platform-specific/checkCppVersion.ts +0 -4
- package/src/reanimated2/platform-specific/jsVersion.ts +1 -1
- package/src/reanimated2/platformFunctions/dispatchCommand.ts +8 -0
- package/src/reanimated2/platformFunctions/getRelativeCoords.ts +12 -4
- package/src/reanimated2/platformFunctions/measure.ts +7 -0
- package/src/reanimated2/platformFunctions/scrollTo.ts +9 -0
- package/src/reanimated2/platformFunctions/setNativeProps.ts +7 -0
- package/src/reanimated2/runtimes.ts +8 -0
- package/src/reanimated2/threads.ts +18 -7
|
@@ -36,6 +36,18 @@ function isSameAnimatedStyle(style1, style2) {
|
|
|
36
36
|
return (style1 === null || style1 === void 0 ? void 0 : style1.viewsRef) === (style2 === null || style2 === void 0 ? void 0 : style2.viewsRef);
|
|
37
37
|
}
|
|
38
38
|
const isSameAnimatedProps = isSameAnimatedStyle;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Lets you create an Animated version of any React Native component.
|
|
42
|
+
*
|
|
43
|
+
* @param component - The component you want to make animatable.
|
|
44
|
+
* @returns A component that Reanimated is capable of animating.
|
|
45
|
+
* @see https://docs.swmansion.com/react-native-reanimated/docs/core/createAnimatedComponent
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated Please use `Animated.FlatList` component instead of calling `Animated.createAnimatedComponent(FlatList)` manually.
|
|
50
|
+
*/ // @ts-ignore This is required to create this overload, since type of createAnimatedComponent is incorrect and doesn't include typeof FlatList
|
|
39
51
|
export function createAnimatedComponent(Component, options) {
|
|
40
52
|
invariant(typeof Component !== 'function' || Component.prototype && Component.prototype.isReactComponent, `Looks like you're passing a function component \`${Component.name}\` to \`createAnimatedComponent\` function which supports only class components. Please wrap your function component with \`React.forwardRef()\` or use a class component instead.`);
|
|
41
53
|
class AnimatedComponent extends React.Component {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","_defineProperty","obj","value","_toPropertyKey","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","TypeError","Number","React","findNodeHandle","Platform","WorkletEventHandler","invariant","adaptViewConfig","RNRenderer","configureLayoutAnimations","enableLayoutAnimations","SharedTransition","LayoutAnimationType","getShadowNodeWrapperFromRef","removeFromPropsRegistry","getReduceMotionFromConfig","maybeBuild","SkipEnteringContext","JSPropsUpdater","has","flattenArray","setAndForwardRef","isFabric","isJest","isWeb","shouldBeUseWeb","InlinePropManager","PropsFilter","startWebLayoutAnimation","tryActivateLayoutTransition","configureWebLayoutAnimations","getReducedMotionFromConfig","IS_WEB","IS_FABRIC","onlyAnimatedStyles","styles","filter","style","viewDescriptors","isSameAnimatedStyle","style1","style2","viewsRef","isSameAnimatedProps","createAnimatedComponent","Component","options","isReactComponent","name","AnimatedComponent","constructor","props","getForwardedRef","forwardedRef","setLocalRef","ref","tag","layout","entering","exiting","sharedTransitionTag","_this$context","LAYOUT","displayName","skipEntering","context","current","_this$props","ENTERING","reduceMotionInExiting","getReduceMotion","_this$props2","EXITING","sharedElementTransition","sharedTransitionStyle","reduceMotionInTransition","registerTransition","_sharedElementTransition","_component","animatedStyle","componentDidMount","_attachNativeEvents","_jsPropsUpdater","addOnJSPropsChangeListener","_attachAnimatedStyles","_InlinePropManager","attachInlineProps","_getViewInfo","_isFirstRender","componentWillUnmount","_this$_sharedElementT","_detachNativeEvents","removeOnJSPropsChangeListener","_detachStyles","detachInlineProps","unregisterTransition","_viewTag","_getEventViewRef","_this$_component","_getScrollableNode","_ref","getScrollableNode","node","viewTag","prop","setNativeProps","registerForEvents","unregisterFromEvents","_styles","remove","_this$props$animatedP","animatedProps","_reattachNativeEvents","prevProps","reattachNeeded","_updateFromNative","_this$_component2","_this$_component2$set","_this$_component3","_getAnimatableRef","_ref2","_viewInfo","viewName","shadowNodeWrapper","viewConfig","component","getAnimatableRef","_hostInstance$viewCon","hostInstance","findHostInstance_DEPRECATED","Error","_nativeTag","uiViewClassName","_this$props$animatedP2","_this$props$animatedP3","prevStyles","prevAnimatedProps","_animatedProps","hasReanimated2Props","hasOneSameStyle","prevStyle","isPresent","some","forEach","add","initial","componentDidUpdate","_prevState","snapshot","getSnapshotBeforeUpdate","getBoundingClientRect","render","_PropsFilter","filterNonAnimatedProps","visibility","platformProps","select","web","default","collapsable","createElement","_setComponentRef","forwardRef"],"sources":["createAnimatedComponent.tsx"],"sourcesContent":["'use strict';\nimport type {\n Component,\n ComponentClass,\n ComponentType,\n FunctionComponent,\n MutableRefObject,\n} from 'react';\nimport React from 'react';\nimport { findNodeHandle, Platform } from 'react-native';\nimport WorkletEventHandler from '../reanimated2/WorkletEventHandler';\nimport '../reanimated2/layoutReanimation/animationsManager';\nimport invariant from 'invariant';\nimport { adaptViewConfig } from '../ConfigHelper';\nimport { RNRenderer } from '../reanimated2/platform-specific/RNRenderer';\nimport {\n configureLayoutAnimations,\n enableLayoutAnimations,\n} from '../reanimated2/core';\nimport {\n SharedTransition,\n LayoutAnimationType,\n} from '../reanimated2/layoutReanimation';\nimport type { StyleProps, ShadowNodeWrapper } from '../reanimated2/commonTypes';\nimport { getShadowNodeWrapperFromRef } from '../reanimated2/fabricUtils';\nimport { removeFromPropsRegistry } from '../reanimated2/PropsRegistry';\nimport { getReduceMotionFromConfig } from '../reanimated2/animation/util';\nimport { maybeBuild } from '../animationBuilder';\nimport { SkipEnteringContext } from '../reanimated2/component/LayoutAnimationConfig';\nimport type { AnimateProps } from '../reanimated2';\nimport JSPropsUpdater from './JSPropsUpdater';\nimport type {\n AnimatedComponentProps,\n AnimatedProps,\n InitialComponentProps,\n AnimatedComponentRef,\n IAnimatedComponentInternal,\n ViewInfo,\n} from './commonTypes';\nimport { has, flattenArray } from './utils';\nimport setAndForwardRef from './setAndForwardRef';\nimport {\n isFabric,\n isJest,\n isWeb,\n shouldBeUseWeb,\n} from '../reanimated2/PlatformChecker';\nimport { InlinePropManager } from './InlinePropManager';\nimport { PropsFilter } from './PropsFilter';\nimport {\n startWebLayoutAnimation,\n tryActivateLayoutTransition,\n configureWebLayoutAnimations,\n getReducedMotionFromConfig,\n} from '../reanimated2/layoutReanimation/web';\nimport type { CustomConfig } from '../reanimated2/layoutReanimation/web/config';\n\nconst IS_WEB = isWeb();\nconst IS_FABRIC = isFabric();\n\nfunction onlyAnimatedStyles(styles: StyleProps[]): StyleProps[] {\n return styles.filter((style) => style?.viewDescriptors);\n}\n\nfunction isSameAnimatedStyle(\n style1?: StyleProps,\n style2?: StyleProps\n): boolean {\n // We cannot use equality check to compare useAnimatedStyle outputs directly.\n // Instead, we can compare its viewsRefs.\n return style1?.viewsRef === style2?.viewsRef;\n}\n\nconst isSameAnimatedProps = isSameAnimatedStyle;\n\ntype Options<P> = {\n setNativeProps: (ref: AnimatedComponentRef, props: P) => void;\n};\n\nexport function createAnimatedComponent<P extends object>(\n component: FunctionComponent<P>,\n options?: Options<P>\n): FunctionComponent<AnimateProps<P>>;\n\nexport function createAnimatedComponent<P extends object>(\n component: ComponentClass<P>,\n options?: Options<P>\n): ComponentClass<AnimateProps<P>>;\n\nexport function createAnimatedComponent(\n Component: ComponentType<InitialComponentProps>,\n options?: Options<InitialComponentProps>\n): any {\n invariant(\n typeof Component !== 'function' ||\n (Component.prototype && Component.prototype.isReactComponent),\n `Looks like you're passing a function component \\`${Component.name}\\` to \\`createAnimatedComponent\\` function which supports only class components. Please wrap your function component with \\`React.forwardRef()\\` or use a class component instead.`\n );\n\n class AnimatedComponent\n extends React.Component<AnimatedComponentProps<InitialComponentProps>>\n implements IAnimatedComponentInternal\n {\n _styles: StyleProps[] | null = null;\n _animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;\n _viewTag = -1;\n _isFirstRender = true;\n animatedStyle: { value: StyleProps } = { value: {} };\n _component: AnimatedComponentRef | HTMLElement | null = null;\n _sharedElementTransition: SharedTransition | null = null;\n _jsPropsUpdater = new JSPropsUpdater();\n _InlinePropManager = new InlinePropManager();\n _PropsFilter = new PropsFilter();\n _viewInfo?: ViewInfo;\n static displayName: string;\n static contextType = SkipEnteringContext;\n context!: React.ContextType<typeof SkipEnteringContext>;\n\n constructor(props: AnimatedComponentProps<InitialComponentProps>) {\n super(props);\n if (isJest()) {\n this.animatedStyle = { value: {} };\n }\n }\n\n componentDidMount() {\n this._attachNativeEvents();\n this._jsPropsUpdater.addOnJSPropsChangeListener(this);\n this._attachAnimatedStyles();\n this._InlinePropManager.attachInlineProps(this, this._getViewInfo());\n\n if (IS_WEB) {\n configureWebLayoutAnimations();\n\n if (!this.props.entering) {\n this._isFirstRender = false;\n return;\n }\n\n if (getReducedMotionFromConfig(this.props.entering as CustomConfig)) {\n this._isFirstRender = false;\n return;\n }\n\n startWebLayoutAnimation(\n this.props,\n this._component as HTMLElement,\n LayoutAnimationType.ENTERING\n );\n }\n\n this._isFirstRender = false;\n }\n\n componentWillUnmount() {\n this._detachNativeEvents();\n this._jsPropsUpdater.removeOnJSPropsChangeListener(this);\n this._detachStyles();\n this._InlinePropManager.detachInlineProps();\n this._sharedElementTransition?.unregisterTransition(this._viewTag);\n\n if (\n IS_WEB &&\n this.props.exiting &&\n !getReducedMotionFromConfig(this.props.exiting as CustomConfig)\n ) {\n startWebLayoutAnimation(\n this.props,\n this._component as HTMLElement,\n LayoutAnimationType.EXITING\n );\n }\n }\n\n _getEventViewRef() {\n // Make sure to get the scrollable node for components that implement\n // `ScrollResponder.Mixin`.\n return (this._component as AnimatedComponentRef)?.getScrollableNode\n ? (this._component as AnimatedComponentRef).getScrollableNode?.()\n : this._component;\n }\n\n _attachNativeEvents() {\n const node = this._getEventViewRef() as AnimatedComponentRef;\n let viewTag = null; // We set it only if needed\n\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n if (viewTag === null) {\n viewTag = findNodeHandle(options?.setNativeProps ? this : node);\n }\n prop.current.registerForEvents(viewTag as number, key);\n }\n }\n }\n\n _detachNativeEvents() {\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n prop.current.unregisterFromEvents();\n }\n }\n }\n\n _detachStyles() {\n if (IS_WEB && this._styles !== null) {\n for (const style of this._styles) {\n if (style?.viewsRef) {\n style.viewsRef.remove(this);\n }\n }\n } else if (this._viewTag !== -1 && this._styles !== null) {\n for (const style of this._styles) {\n style.viewDescriptors.remove(this._viewTag);\n }\n if (this.props.animatedProps?.viewDescriptors) {\n this.props.animatedProps.viewDescriptors.remove(this._viewTag);\n }\n if (IS_FABRIC) {\n removeFromPropsRegistry(this._viewTag);\n }\n }\n }\n\n _reattachNativeEvents(\n prevProps: AnimatedComponentProps<InitialComponentProps>\n ) {\n for (const key in prevProps) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler &&\n prop.current.reattachNeeded\n ) {\n prop.current.unregisterFromEvents();\n }\n }\n\n let viewTag = null;\n\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler &&\n prop.current.reattachNeeded\n ) {\n if (viewTag === null) {\n const node = this._getEventViewRef() as AnimatedComponentRef;\n viewTag = findNodeHandle(options?.setNativeProps ? this : node);\n }\n prop.current.registerForEvents(viewTag as number, key);\n prop.current.reattachNeeded = false;\n }\n }\n }\n\n _updateFromNative(props: StyleProps) {\n if (options?.setNativeProps) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n options.setNativeProps(this._component as AnimatedComponentRef, props);\n } else {\n // eslint-disable-next-line no-unused-expressions\n (this._component as AnimatedComponentRef)?.setNativeProps?.(props);\n }\n }\n\n _getViewInfo(): ViewInfo {\n if (this._viewInfo !== undefined) {\n return this._viewInfo;\n }\n\n let viewTag: number | HTMLElement | null;\n let viewName: string | null;\n let shadowNodeWrapper: ShadowNodeWrapper | null = null;\n let viewConfig;\n // Component can specify ref which should be animated when animated version of the component is created.\n // Otherwise, we animate the component itself.\n const component = (this._component as AnimatedComponentRef)\n ?.getAnimatableRef\n ? (this._component as AnimatedComponentRef).getAnimatableRef?.()\n : this;\n\n if (IS_WEB) {\n // At this point I assume that `_setComponentRef` was already called and `_component` is set.\n // `this._component` on web represents HTMLElement of our component, that's why we use casting\n viewTag = this._component as HTMLElement;\n viewName = null;\n shadowNodeWrapper = null;\n viewConfig = null;\n } else {\n // hostInstance can be null for a component that doesn't render anything (render function returns null). Example: svg Stop: https://github.com/react-native-svg/react-native-svg/blob/develop/src/elements/Stop.tsx\n const hostInstance = RNRenderer.findHostInstance_DEPRECATED(component);\n if (!hostInstance) {\n throw new Error(\n '[Reanimated] Cannot find host instance for this component. Maybe it renders nothing?'\n );\n }\n // we can access view tag in the same way it's accessed here https://github.com/facebook/react/blob/e3f4eb7272d4ca0ee49f27577156b57eeb07cf73/packages/react-native-renderer/src/ReactFabric.js#L146\n viewTag = hostInstance?._nativeTag;\n /**\n * RN uses viewConfig for components for storing different properties of the component(example: https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Components/ScrollView/ScrollViewNativeComponent.js#L24).\n * The name we're looking for is in the field named uiViewClassName.\n */\n viewName = hostInstance?.viewConfig?.uiViewClassName;\n\n viewConfig = hostInstance?.viewConfig;\n\n if (IS_FABRIC) {\n shadowNodeWrapper = getShadowNodeWrapperFromRef(this);\n }\n }\n this._viewInfo = { viewTag, viewName, shadowNodeWrapper, viewConfig };\n return this._viewInfo;\n }\n\n _attachAnimatedStyles() {\n const styles = this.props.style\n ? onlyAnimatedStyles(flattenArray<StyleProps>(this.props.style))\n : [];\n const prevStyles = this._styles;\n this._styles = styles;\n\n const prevAnimatedProps = this._animatedProps;\n this._animatedProps = this.props.animatedProps;\n\n const { viewTag, viewName, shadowNodeWrapper, viewConfig } =\n this._getViewInfo();\n\n // update UI props whitelist for this view\n const hasReanimated2Props =\n this.props.animatedProps?.viewDescriptors || styles.length;\n if (hasReanimated2Props && viewConfig) {\n adaptViewConfig(viewConfig);\n }\n\n this._viewTag = viewTag as number;\n\n // remove old styles\n if (prevStyles) {\n // in most of the cases, views have only a single animated style and it remains unchanged\n const hasOneSameStyle =\n styles.length === 1 &&\n prevStyles.length === 1 &&\n isSameAnimatedStyle(styles[0], prevStyles[0]);\n\n if (!hasOneSameStyle) {\n // otherwise, remove each style that is not present in new styles\n for (const prevStyle of prevStyles) {\n const isPresent = styles.some((style) =>\n isSameAnimatedStyle(style, prevStyle)\n );\n if (!isPresent) {\n prevStyle.viewDescriptors.remove(viewTag);\n }\n }\n }\n }\n\n styles.forEach((style) => {\n style.viewDescriptors.add({\n tag: viewTag,\n name: viewName,\n shadowNodeWrapper,\n });\n if (isJest()) {\n /**\n * We need to connect Jest's TestObject instance whose contains just props object\n * with the updateProps() function where we update the properties of the component.\n * We can't update props object directly because TestObject contains a copy of props - look at render function:\n * const props = this._filterNonAnimatedProps(this.props);\n */\n this.animatedStyle.value = {\n ...this.animatedStyle.value,\n ...style.initial.value,\n };\n style.animatedStyle.current = this.animatedStyle;\n }\n });\n\n // detach old animatedProps\n if (\n prevAnimatedProps &&\n !isSameAnimatedProps(prevAnimatedProps, this.props.animatedProps)\n ) {\n prevAnimatedProps.viewDescriptors!.remove(viewTag as number);\n }\n\n // attach animatedProps property\n if (this.props.animatedProps?.viewDescriptors) {\n this.props.animatedProps.viewDescriptors.add({\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n tag: viewTag as number,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n name: viewName!,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n shadowNodeWrapper: shadowNodeWrapper!,\n });\n }\n }\n\n componentDidUpdate(\n prevProps: AnimatedComponentProps<InitialComponentProps>,\n _prevState: Readonly<unknown>,\n // This type comes straight from React\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n snapshot: DOMRect | null\n ) {\n this._reattachNativeEvents(prevProps);\n this._attachAnimatedStyles();\n this._InlinePropManager.attachInlineProps(this, this._getViewInfo());\n\n // Snapshot won't be undefined because it comes from getSnapshotBeforeUpdate method\n if (\n IS_WEB &&\n snapshot !== null &&\n this.props.layout &&\n !getReducedMotionFromConfig(this.props.layout as CustomConfig)\n ) {\n tryActivateLayoutTransition(\n this.props,\n this._component as HTMLElement,\n snapshot\n );\n }\n }\n\n _setComponentRef = setAndForwardRef<Component | HTMLElement>({\n getForwardedRef: () =>\n this.props.forwardedRef as MutableRefObject<\n Component<Record<string, unknown>, Record<string, unknown>, unknown>\n >,\n setLocalRef: (ref) => {\n // TODO update config\n\n const tag = IS_WEB\n ? (ref as HTMLElement)\n : findNodeHandle(ref as Component);\n\n const { layout, entering, exiting, sharedTransitionTag } = this.props;\n if (\n (layout || entering || exiting || sharedTransitionTag) &&\n tag != null\n ) {\n if (!shouldBeUseWeb()) {\n enableLayoutAnimations(true, false);\n }\n if (layout) {\n configureLayoutAnimations(\n tag,\n LayoutAnimationType.LAYOUT,\n maybeBuild(\n layout,\n undefined /* We don't have to warn user if style has common properties with animation for LAYOUT */,\n AnimatedComponent.displayName\n )\n );\n }\n const skipEntering = this.context?.current;\n if (entering && !skipEntering) {\n configureLayoutAnimations(\n tag,\n LayoutAnimationType.ENTERING,\n maybeBuild(\n entering,\n this.props?.style,\n AnimatedComponent.displayName\n )\n );\n }\n if (exiting) {\n const reduceMotionInExiting =\n 'getReduceMotion' in exiting &&\n typeof exiting.getReduceMotion === 'function'\n ? getReduceMotionFromConfig(exiting.getReduceMotion())\n : getReduceMotionFromConfig();\n if (!reduceMotionInExiting) {\n configureLayoutAnimations(\n tag,\n LayoutAnimationType.EXITING,\n maybeBuild(\n exiting,\n this.props?.style,\n AnimatedComponent.displayName\n )\n );\n }\n }\n if (sharedTransitionTag && !IS_WEB) {\n const sharedElementTransition =\n this.props.sharedTransitionStyle ?? new SharedTransition();\n const reduceMotionInTransition = getReduceMotionFromConfig(\n sharedElementTransition.getReduceMotion()\n );\n if (!reduceMotionInTransition) {\n sharedElementTransition.registerTransition(\n tag as number,\n sharedTransitionTag\n );\n this._sharedElementTransition = sharedElementTransition;\n }\n }\n }\n\n if (ref !== this._component) {\n this._component = ref;\n }\n },\n });\n\n // This is a component lifecycle method from React, therefore we are not calling it directly.\n // It is called before the component gets rerendered. This way we can access components' position before it changed\n // and later on, in componentDidUpdate, calculate translation for layout transition.\n getSnapshotBeforeUpdate() {\n if (\n (this._component as HTMLElement).getBoundingClientRect !== undefined\n ) {\n return (this._component as HTMLElement).getBoundingClientRect();\n }\n\n return null;\n }\n\n render() {\n const props = this._PropsFilter.filterNonAnimatedProps(this);\n\n if (isJest()) {\n props.animatedStyle = this.animatedStyle;\n }\n\n // Layout animations on web are set inside `componentDidMount` method, which is called after first render.\n // Because of that we can encounter a situation in which component is visible for a short amount of time, and later on animation triggers.\n // I've tested that on various browsers and devices and it did not happen to me. To be sure that it won't happen to someone else,\n // I've decided to hide component at first render. Its visibility is reset in `componentDidMount`.\n if (\n this._isFirstRender &&\n IS_WEB &&\n props.entering &&\n !getReducedMotionFromConfig(props.entering as CustomConfig)\n ) {\n props.style = {\n ...(props.style ?? {}),\n visibility: 'hidden', // Hide component until `componentDidMount` triggers\n };\n }\n\n const platformProps = Platform.select({\n web: {},\n default: { collapsable: false },\n });\n\n return (\n <Component\n {...props}\n // Casting is used here, because ref can be null - in that case it cannot be assigned to HTMLElement.\n // After spending some time trying to figure out what to do with this problem, we decided to leave it this way\n ref={this._setComponentRef as (ref: Component) => void}\n {...platformProps}\n />\n );\n }\n }\n\n AnimatedComponent.displayName = `AnimatedComponent(${\n Component.displayName || Component.name || 'Component'\n })`;\n\n return React.forwardRef<Component>((props, ref) => {\n return (\n <AnimatedComponent\n {...props}\n {...(ref === null ? null : { forwardedRef: ref })}\n />\n );\n });\n}\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,SAAA,IAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAA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EA;MACA;MACA;MACA;MACA,IACE,IAAI,CAACS,cAAc,IACnBxD,MAAM,IACNmB,KAAK,CAACO,QAAQ,IACd,CAAC3B,0BAA0B,CAACoB,KAAK,CAACO,QAAQ,CAAiB,EAC3D;QACAP,KAAK,CAACd,KAAK,GAAG;UACZ,IAAIc,KAAK,CAACd,KAAK,IAAI,CAAC,CAAC,CAAC;UACtBqH,UAAU,EAAE,QAAQ,CAAE;QACxB,CAAC;MACH;;MAEA,MAAMC,aAAa,GAAGvJ,QAAQ,CAACwJ,MAAM,CAAC;QACpCC,GAAG,EAAE,CAAC,CAAC;QACPC,OAAO,EAAE;UAAEC,WAAW,EAAE;QAAM;MAChC,CAAC,CAAC;MAEF,oBACE7J,KAAA,CAAA8J,aAAA,CAACnH,SAAS,EAAA7E,QAAA,KACJmF,KAAK;QACT;QACA;QACAI,GAAG,EAAE,IAAI,CAAC0G;MAA6C,GACnDN,aAAa,EACjB;IAEN;EACF;EAAC7K,eAAA,CAtdKmE,iBAAiB;EAAAnE,eAAA,CAAjBmE,iBAAiB,iBAgBAhC,mBAAmB;EAwc1CgC,iBAAiB,CAACc,WAAW,GAAI,qBAC/BlB,SAAS,CAACkB,WAAW,IAAIlB,SAAS,CAACG,IAAI,IAAI,WAC5C,GAAE;EAEH,oBAAO9C,KAAK,CAACgK,UAAU,CAAY,CAAC/G,KAAK,EAAEI,GAAG,KAAK;IACjD,oBACErD,KAAA,CAAA8J,aAAA,CAAC/G,iBAAiB,EAAAjF,QAAA,KACZmF,KAAK,EACJI,GAAG,KAAK,IAAI,GAAG,IAAI,GAAG;MAAEF,YAAY,EAAEE;IAAI,CAAC,EAChD;EAEN,CAAC,CAAC;AACJ"}
|
|
1
|
+
{"version":3,"names":["_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","_defineProperty","obj","value","_toPropertyKey","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","TypeError","Number","React","findNodeHandle","Platform","WorkletEventHandler","invariant","adaptViewConfig","RNRenderer","configureLayoutAnimations","enableLayoutAnimations","SharedTransition","LayoutAnimationType","getShadowNodeWrapperFromRef","removeFromPropsRegistry","getReduceMotionFromConfig","maybeBuild","SkipEnteringContext","JSPropsUpdater","has","flattenArray","setAndForwardRef","isFabric","isJest","isWeb","shouldBeUseWeb","InlinePropManager","PropsFilter","startWebLayoutAnimation","tryActivateLayoutTransition","configureWebLayoutAnimations","getReducedMotionFromConfig","IS_WEB","IS_FABRIC","onlyAnimatedStyles","styles","filter","style","viewDescriptors","isSameAnimatedStyle","style1","style2","viewsRef","isSameAnimatedProps","createAnimatedComponent","Component","options","isReactComponent","name","AnimatedComponent","constructor","props","getForwardedRef","forwardedRef","setLocalRef","ref","tag","layout","entering","exiting","sharedTransitionTag","_this$context","LAYOUT","displayName","skipEntering","context","current","_this$props","ENTERING","reduceMotionInExiting","getReduceMotion","_this$props2","EXITING","sharedElementTransition","sharedTransitionStyle","reduceMotionInTransition","registerTransition","_sharedElementTransition","_component","animatedStyle","componentDidMount","_attachNativeEvents","_jsPropsUpdater","addOnJSPropsChangeListener","_attachAnimatedStyles","_InlinePropManager","attachInlineProps","_getViewInfo","_isFirstRender","componentWillUnmount","_this$_sharedElementT","_detachNativeEvents","removeOnJSPropsChangeListener","_detachStyles","detachInlineProps","unregisterTransition","_viewTag","_getEventViewRef","_this$_component","_getScrollableNode","_ref","getScrollableNode","node","viewTag","prop","setNativeProps","registerForEvents","unregisterFromEvents","_styles","remove","_this$props$animatedP","animatedProps","_reattachNativeEvents","prevProps","reattachNeeded","_updateFromNative","_this$_component2","_this$_component2$set","_this$_component3","_getAnimatableRef","_ref2","_viewInfo","viewName","shadowNodeWrapper","viewConfig","component","getAnimatableRef","_hostInstance$viewCon","hostInstance","findHostInstance_DEPRECATED","Error","_nativeTag","uiViewClassName","_this$props$animatedP2","_this$props$animatedP3","prevStyles","prevAnimatedProps","_animatedProps","hasReanimated2Props","hasOneSameStyle","prevStyle","isPresent","some","forEach","add","initial","componentDidUpdate","_prevState","snapshot","getSnapshotBeforeUpdate","getBoundingClientRect","render","_PropsFilter","filterNonAnimatedProps","visibility","platformProps","select","web","default","collapsable","createElement","_setComponentRef","forwardRef"],"sources":["createAnimatedComponent.tsx"],"sourcesContent":["'use strict';\nimport type {\n Component,\n ComponentClass,\n ComponentType,\n FunctionComponent,\n MutableRefObject,\n} from 'react';\nimport React from 'react';\nimport { findNodeHandle, Platform } from 'react-native';\nimport WorkletEventHandler from '../reanimated2/WorkletEventHandler';\nimport '../reanimated2/layoutReanimation/animationsManager';\nimport invariant from 'invariant';\nimport { adaptViewConfig } from '../ConfigHelper';\nimport { RNRenderer } from '../reanimated2/platform-specific/RNRenderer';\nimport {\n configureLayoutAnimations,\n enableLayoutAnimations,\n} from '../reanimated2/core';\nimport {\n SharedTransition,\n LayoutAnimationType,\n} from '../reanimated2/layoutReanimation';\nimport type { StyleProps, ShadowNodeWrapper } from '../reanimated2/commonTypes';\nimport { getShadowNodeWrapperFromRef } from '../reanimated2/fabricUtils';\nimport { removeFromPropsRegistry } from '../reanimated2/PropsRegistry';\nimport { getReduceMotionFromConfig } from '../reanimated2/animation/util';\nimport { maybeBuild } from '../animationBuilder';\nimport { SkipEnteringContext } from '../reanimated2/component/LayoutAnimationConfig';\nimport type { AnimateProps } from '../reanimated2';\nimport JSPropsUpdater from './JSPropsUpdater';\nimport type {\n AnimatedComponentProps,\n AnimatedProps,\n InitialComponentProps,\n AnimatedComponentRef,\n IAnimatedComponentInternal,\n ViewInfo,\n} from './commonTypes';\nimport { has, flattenArray } from './utils';\nimport setAndForwardRef from './setAndForwardRef';\nimport {\n isFabric,\n isJest,\n isWeb,\n shouldBeUseWeb,\n} from '../reanimated2/PlatformChecker';\nimport { InlinePropManager } from './InlinePropManager';\nimport { PropsFilter } from './PropsFilter';\nimport {\n startWebLayoutAnimation,\n tryActivateLayoutTransition,\n configureWebLayoutAnimations,\n getReducedMotionFromConfig,\n} from '../reanimated2/layoutReanimation/web';\nimport type { CustomConfig } from '../reanimated2/layoutReanimation/web/config';\nimport type { FlatList, FlatListProps } from 'react-native';\n\nconst IS_WEB = isWeb();\nconst IS_FABRIC = isFabric();\n\nfunction onlyAnimatedStyles(styles: StyleProps[]): StyleProps[] {\n return styles.filter((style) => style?.viewDescriptors);\n}\n\nfunction isSameAnimatedStyle(\n style1?: StyleProps,\n style2?: StyleProps\n): boolean {\n // We cannot use equality check to compare useAnimatedStyle outputs directly.\n // Instead, we can compare its viewsRefs.\n return style1?.viewsRef === style2?.viewsRef;\n}\n\nconst isSameAnimatedProps = isSameAnimatedStyle;\n\ntype Options<P> = {\n setNativeProps: (ref: AnimatedComponentRef, props: P) => void;\n};\n\n/**\n * Lets you create an Animated version of any React Native component.\n *\n * @param component - The component you want to make animatable.\n * @returns A component that Reanimated is capable of animating.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/core/createAnimatedComponent\n */\n\n/**\n * @deprecated Please use `Animated.FlatList` component instead of calling `Animated.createAnimatedComponent(FlatList)` manually.\n */\n// @ts-ignore This is required to create this overload, since type of createAnimatedComponent is incorrect and doesn't include typeof FlatList\nexport function createAnimatedComponent(\n component: typeof FlatList<unknown>,\n options?: Options<any>\n): ComponentClass<AnimateProps<FlatListProps<unknown>>>;\n\nexport function createAnimatedComponent<P extends object>(\n component: FunctionComponent<P>,\n options?: Options<P>\n): FunctionComponent<AnimateProps<P>>;\n\nexport function createAnimatedComponent<P extends object>(\n component: ComponentClass<P>,\n options?: Options<P>\n): ComponentClass<AnimateProps<P>>;\n\nexport function createAnimatedComponent(\n Component: ComponentType<InitialComponentProps>,\n options?: Options<InitialComponentProps>\n): any {\n invariant(\n typeof Component !== 'function' ||\n (Component.prototype && Component.prototype.isReactComponent),\n `Looks like you're passing a function component \\`${Component.name}\\` to \\`createAnimatedComponent\\` function which supports only class components. Please wrap your function component with \\`React.forwardRef()\\` or use a class component instead.`\n );\n\n class AnimatedComponent\n extends React.Component<AnimatedComponentProps<InitialComponentProps>>\n implements IAnimatedComponentInternal\n {\n _styles: StyleProps[] | null = null;\n _animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;\n _viewTag = -1;\n _isFirstRender = true;\n animatedStyle: { value: StyleProps } = { value: {} };\n _component: AnimatedComponentRef | HTMLElement | null = null;\n _sharedElementTransition: SharedTransition | null = null;\n _jsPropsUpdater = new JSPropsUpdater();\n _InlinePropManager = new InlinePropManager();\n _PropsFilter = new PropsFilter();\n _viewInfo?: ViewInfo;\n static displayName: string;\n static contextType = SkipEnteringContext;\n context!: React.ContextType<typeof SkipEnteringContext>;\n\n constructor(props: AnimatedComponentProps<InitialComponentProps>) {\n super(props);\n if (isJest()) {\n this.animatedStyle = { value: {} };\n }\n }\n\n componentDidMount() {\n this._attachNativeEvents();\n this._jsPropsUpdater.addOnJSPropsChangeListener(this);\n this._attachAnimatedStyles();\n this._InlinePropManager.attachInlineProps(this, this._getViewInfo());\n\n if (IS_WEB) {\n configureWebLayoutAnimations();\n\n if (!this.props.entering) {\n this._isFirstRender = false;\n return;\n }\n\n if (getReducedMotionFromConfig(this.props.entering as CustomConfig)) {\n this._isFirstRender = false;\n return;\n }\n\n startWebLayoutAnimation(\n this.props,\n this._component as HTMLElement,\n LayoutAnimationType.ENTERING\n );\n }\n\n this._isFirstRender = false;\n }\n\n componentWillUnmount() {\n this._detachNativeEvents();\n this._jsPropsUpdater.removeOnJSPropsChangeListener(this);\n this._detachStyles();\n this._InlinePropManager.detachInlineProps();\n this._sharedElementTransition?.unregisterTransition(this._viewTag);\n\n if (\n IS_WEB &&\n this.props.exiting &&\n !getReducedMotionFromConfig(this.props.exiting as CustomConfig)\n ) {\n startWebLayoutAnimation(\n this.props,\n this._component as HTMLElement,\n LayoutAnimationType.EXITING\n );\n }\n }\n\n _getEventViewRef() {\n // Make sure to get the scrollable node for components that implement\n // `ScrollResponder.Mixin`.\n return (this._component as AnimatedComponentRef)?.getScrollableNode\n ? (this._component as AnimatedComponentRef).getScrollableNode?.()\n : this._component;\n }\n\n _attachNativeEvents() {\n const node = this._getEventViewRef() as AnimatedComponentRef;\n let viewTag = null; // We set it only if needed\n\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n if (viewTag === null) {\n viewTag = findNodeHandle(options?.setNativeProps ? this : node);\n }\n prop.current.registerForEvents(viewTag as number, key);\n }\n }\n }\n\n _detachNativeEvents() {\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n prop.current.unregisterFromEvents();\n }\n }\n }\n\n _detachStyles() {\n if (IS_WEB && this._styles !== null) {\n for (const style of this._styles) {\n if (style?.viewsRef) {\n style.viewsRef.remove(this);\n }\n }\n } else if (this._viewTag !== -1 && this._styles !== null) {\n for (const style of this._styles) {\n style.viewDescriptors.remove(this._viewTag);\n }\n if (this.props.animatedProps?.viewDescriptors) {\n this.props.animatedProps.viewDescriptors.remove(this._viewTag);\n }\n if (IS_FABRIC) {\n removeFromPropsRegistry(this._viewTag);\n }\n }\n }\n\n _reattachNativeEvents(\n prevProps: AnimatedComponentProps<InitialComponentProps>\n ) {\n for (const key in prevProps) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler &&\n prop.current.reattachNeeded\n ) {\n prop.current.unregisterFromEvents();\n }\n }\n\n let viewTag = null;\n\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler &&\n prop.current.reattachNeeded\n ) {\n if (viewTag === null) {\n const node = this._getEventViewRef() as AnimatedComponentRef;\n viewTag = findNodeHandle(options?.setNativeProps ? this : node);\n }\n prop.current.registerForEvents(viewTag as number, key);\n prop.current.reattachNeeded = false;\n }\n }\n }\n\n _updateFromNative(props: StyleProps) {\n if (options?.setNativeProps) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n options.setNativeProps(this._component as AnimatedComponentRef, props);\n } else {\n // eslint-disable-next-line no-unused-expressions\n (this._component as AnimatedComponentRef)?.setNativeProps?.(props);\n }\n }\n\n _getViewInfo(): ViewInfo {\n if (this._viewInfo !== undefined) {\n return this._viewInfo;\n }\n\n let viewTag: number | HTMLElement | null;\n let viewName: string | null;\n let shadowNodeWrapper: ShadowNodeWrapper | null = null;\n let viewConfig;\n // Component can specify ref which should be animated when animated version of the component is created.\n // Otherwise, we animate the component itself.\n const component = (this._component as AnimatedComponentRef)\n ?.getAnimatableRef\n ? (this._component as AnimatedComponentRef).getAnimatableRef?.()\n : this;\n\n if (IS_WEB) {\n // At this point I assume that `_setComponentRef` was already called and `_component` is set.\n // `this._component` on web represents HTMLElement of our component, that's why we use casting\n viewTag = this._component as HTMLElement;\n viewName = null;\n shadowNodeWrapper = null;\n viewConfig = null;\n } else {\n // hostInstance can be null for a component that doesn't render anything (render function returns null). Example: svg Stop: https://github.com/react-native-svg/react-native-svg/blob/develop/src/elements/Stop.tsx\n const hostInstance = RNRenderer.findHostInstance_DEPRECATED(component);\n if (!hostInstance) {\n throw new Error(\n '[Reanimated] Cannot find host instance for this component. Maybe it renders nothing?'\n );\n }\n // we can access view tag in the same way it's accessed here https://github.com/facebook/react/blob/e3f4eb7272d4ca0ee49f27577156b57eeb07cf73/packages/react-native-renderer/src/ReactFabric.js#L146\n viewTag = hostInstance?._nativeTag;\n /**\n * RN uses viewConfig for components for storing different properties of the component(example: https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Components/ScrollView/ScrollViewNativeComponent.js#L24).\n * The name we're looking for is in the field named uiViewClassName.\n */\n viewName = hostInstance?.viewConfig?.uiViewClassName;\n\n viewConfig = hostInstance?.viewConfig;\n\n if (IS_FABRIC) {\n shadowNodeWrapper = getShadowNodeWrapperFromRef(this);\n }\n }\n this._viewInfo = { viewTag, viewName, shadowNodeWrapper, viewConfig };\n return this._viewInfo;\n }\n\n _attachAnimatedStyles() {\n const styles = this.props.style\n ? onlyAnimatedStyles(flattenArray<StyleProps>(this.props.style))\n : [];\n const prevStyles = this._styles;\n this._styles = styles;\n\n const prevAnimatedProps = this._animatedProps;\n this._animatedProps = this.props.animatedProps;\n\n const { viewTag, viewName, shadowNodeWrapper, viewConfig } =\n this._getViewInfo();\n\n // update UI props whitelist for this view\n const hasReanimated2Props =\n this.props.animatedProps?.viewDescriptors || styles.length;\n if (hasReanimated2Props && viewConfig) {\n adaptViewConfig(viewConfig);\n }\n\n this._viewTag = viewTag as number;\n\n // remove old styles\n if (prevStyles) {\n // in most of the cases, views have only a single animated style and it remains unchanged\n const hasOneSameStyle =\n styles.length === 1 &&\n prevStyles.length === 1 &&\n isSameAnimatedStyle(styles[0], prevStyles[0]);\n\n if (!hasOneSameStyle) {\n // otherwise, remove each style that is not present in new styles\n for (const prevStyle of prevStyles) {\n const isPresent = styles.some((style) =>\n isSameAnimatedStyle(style, prevStyle)\n );\n if (!isPresent) {\n prevStyle.viewDescriptors.remove(viewTag);\n }\n }\n }\n }\n\n styles.forEach((style) => {\n style.viewDescriptors.add({\n tag: viewTag,\n name: viewName,\n shadowNodeWrapper,\n });\n if (isJest()) {\n /**\n * We need to connect Jest's TestObject instance whose contains just props object\n * with the updateProps() function where we update the properties of the component.\n * We can't update props object directly because TestObject contains a copy of props - look at render function:\n * const props = this._filterNonAnimatedProps(this.props);\n */\n this.animatedStyle.value = {\n ...this.animatedStyle.value,\n ...style.initial.value,\n };\n style.animatedStyle.current = this.animatedStyle;\n }\n });\n\n // detach old animatedProps\n if (\n prevAnimatedProps &&\n !isSameAnimatedProps(prevAnimatedProps, this.props.animatedProps)\n ) {\n prevAnimatedProps.viewDescriptors!.remove(viewTag as number);\n }\n\n // attach animatedProps property\n if (this.props.animatedProps?.viewDescriptors) {\n this.props.animatedProps.viewDescriptors.add({\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n tag: viewTag as number,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n name: viewName!,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n shadowNodeWrapper: shadowNodeWrapper!,\n });\n }\n }\n\n componentDidUpdate(\n prevProps: AnimatedComponentProps<InitialComponentProps>,\n _prevState: Readonly<unknown>,\n // This type comes straight from React\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n snapshot: DOMRect | null\n ) {\n this._reattachNativeEvents(prevProps);\n this._attachAnimatedStyles();\n this._InlinePropManager.attachInlineProps(this, this._getViewInfo());\n\n // Snapshot won't be undefined because it comes from getSnapshotBeforeUpdate method\n if (\n IS_WEB &&\n snapshot !== null &&\n this.props.layout &&\n !getReducedMotionFromConfig(this.props.layout as CustomConfig)\n ) {\n tryActivateLayoutTransition(\n this.props,\n this._component as HTMLElement,\n snapshot\n );\n }\n }\n\n _setComponentRef = setAndForwardRef<Component | HTMLElement>({\n getForwardedRef: () =>\n this.props.forwardedRef as MutableRefObject<\n Component<Record<string, unknown>, Record<string, unknown>, unknown>\n >,\n setLocalRef: (ref) => {\n // TODO update config\n\n const tag = IS_WEB\n ? (ref as HTMLElement)\n : findNodeHandle(ref as Component);\n\n const { layout, entering, exiting, sharedTransitionTag } = this.props;\n if (\n (layout || entering || exiting || sharedTransitionTag) &&\n tag != null\n ) {\n if (!shouldBeUseWeb()) {\n enableLayoutAnimations(true, false);\n }\n if (layout) {\n configureLayoutAnimations(\n tag,\n LayoutAnimationType.LAYOUT,\n maybeBuild(\n layout,\n undefined /* We don't have to warn user if style has common properties with animation for LAYOUT */,\n AnimatedComponent.displayName\n )\n );\n }\n const skipEntering = this.context?.current;\n if (entering && !skipEntering) {\n configureLayoutAnimations(\n tag,\n LayoutAnimationType.ENTERING,\n maybeBuild(\n entering,\n this.props?.style,\n AnimatedComponent.displayName\n )\n );\n }\n if (exiting) {\n const reduceMotionInExiting =\n 'getReduceMotion' in exiting &&\n typeof exiting.getReduceMotion === 'function'\n ? getReduceMotionFromConfig(exiting.getReduceMotion())\n : getReduceMotionFromConfig();\n if (!reduceMotionInExiting) {\n configureLayoutAnimations(\n tag,\n LayoutAnimationType.EXITING,\n maybeBuild(\n exiting,\n this.props?.style,\n AnimatedComponent.displayName\n )\n );\n }\n }\n if (sharedTransitionTag && !IS_WEB) {\n const sharedElementTransition =\n this.props.sharedTransitionStyle ?? new SharedTransition();\n const reduceMotionInTransition = getReduceMotionFromConfig(\n sharedElementTransition.getReduceMotion()\n );\n if (!reduceMotionInTransition) {\n sharedElementTransition.registerTransition(\n tag as number,\n sharedTransitionTag\n );\n this._sharedElementTransition = sharedElementTransition;\n }\n }\n }\n\n if (ref !== this._component) {\n this._component = ref;\n }\n },\n });\n\n // This is a component lifecycle method from React, therefore we are not calling it directly.\n // It is called before the component gets rerendered. This way we can access components' position before it changed\n // and later on, in componentDidUpdate, calculate translation for layout transition.\n getSnapshotBeforeUpdate() {\n if (\n (this._component as HTMLElement).getBoundingClientRect !== undefined\n ) {\n return (this._component as HTMLElement).getBoundingClientRect();\n }\n\n return null;\n }\n\n render() {\n const props = this._PropsFilter.filterNonAnimatedProps(this);\n\n if (isJest()) {\n props.animatedStyle = this.animatedStyle;\n }\n\n // Layout animations on web are set inside `componentDidMount` method, which is called after first render.\n // Because of that we can encounter a situation in which component is visible for a short amount of time, and later on animation triggers.\n // I've tested that on various browsers and devices and it did not happen to me. To be sure that it won't happen to someone else,\n // I've decided to hide component at first render. Its visibility is reset in `componentDidMount`.\n if (\n this._isFirstRender &&\n IS_WEB &&\n props.entering &&\n !getReducedMotionFromConfig(props.entering as CustomConfig)\n ) {\n props.style = {\n ...(props.style ?? {}),\n visibility: 'hidden', // Hide component until `componentDidMount` triggers\n };\n }\n\n const platformProps = Platform.select({\n web: {},\n default: { collapsable: false },\n });\n\n return (\n <Component\n {...props}\n // Casting is used here, because ref can be null - in that case it cannot be assigned to HTMLElement.\n // After spending some time trying to figure out what to do with this problem, we decided to leave it this way\n ref={this._setComponentRef as (ref: Component) => void}\n {...platformProps}\n />\n );\n }\n }\n\n AnimatedComponent.displayName = `AnimatedComponent(${\n Component.displayName || Component.name || 'Component'\n })`;\n\n return React.forwardRef<Component>((props, ref) => {\n return (\n <AnimatedComponent\n {...props}\n {...(ref === null ? null : { forwardedRef: ref })}\n />\n );\n });\n}\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,SAAA,IAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,GAAAF,SAAA,CAAAD,CAAA,YAAAI,GAAA,IAAAD,MAAA,QAAAP,MAAA,CAAAS,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAJ,MAAA,EAAAC,GAAA,KAAAL,MAAA,CAAAK,GAAA,IAAAD,MAAA,CAAAC,GAAA,gBAAAL,MAAA,YAAAJ,QAAA,CAAAa,KAAA,OAAAP,SAAA;AAAA,SAAAQ,gBAAAC,GAAA,EAAAN,GAAA,EAAAO,KAAA,IAAAP,GAAA,GAAAQ,cAAA,CAAAR,GAAA,OAAAA,GAAA,IAAAM,GAAA,IAAAd,MAAA,CAAAiB,cAAA,CAAAH,GAAA,EAAAN,GAAA,IAAAO,KAAA,EAAAA,KAAA,EAAAG,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAN,GAAA,CAAAN,GAAA,IAAAO,KAAA,WAAAD,GAAA;AAAA,SAAAE,eAAAK,GAAA,QAAAb,GAAA,GAAAc,YAAA,CAAAD,GAAA,2BAAAb,GAAA,gBAAAA,GAAA,GAAAe,MAAA,CAAAf,GAAA;AAAA,SAAAc,aAAAE,KAAA,EAAAC,IAAA,eAAAD,KAAA,iBAAAA,KAAA,kBAAAA,KAAA,MAAAE,IAAA,GAAAF,KAAA,CAAAG,MAAA,CAAAC,WAAA,OAAAF,IAAA,KAAAG,SAAA,QAAAC,GAAA,GAAAJ,IAAA,CAAAf,IAAA,CAAAa,KAAA,EAAAC,IAAA,2BAAAK,GAAA,sBA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,IAAI,GAAG;MAAEF,YAAY,EAAEE;IAAI,CAAC,EAChD;EAEN,CAAC,CAAC;AACJ"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* imported from react-native
|
|
5
5
|
*/
|
|
6
|
+
/* eslint-disable */
|
|
6
7
|
/**
|
|
7
8
|
* This is a helper function for when a component needs to be able to forward a ref
|
|
8
9
|
* to a child component, but still needs to have access to that component as part of
|
|
@@ -33,6 +34,7 @@
|
|
|
33
34
|
*
|
|
34
35
|
* module.exports = MyViewWithRef;
|
|
35
36
|
*/
|
|
37
|
+
/* eslint-enable */
|
|
36
38
|
function setAndForwardRef(_ref) {
|
|
37
39
|
let {
|
|
38
40
|
getForwardedRef,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["setAndForwardRef","_ref","getForwardedRef","setLocalRef","forwardRef","ref","forwardedRef","current"],"sources":["setAndForwardRef.ts"],"sourcesContent":["'use strict';\n/**\n * imported from react-native\n */\n\nimport type { MutableRefObject } from 'react';\n\n/**\n * This is a helper function for when a component needs to be able to forward a ref\n * to a child component, but still needs to have access to that component as part of\n * its implementation.\n *\n * Its main use case is in wrappers for native components.\n *\n * Usage:\n *\n * class MyView extends React.Component {\n * _nativeRef = null;\n *\n * _setNativeRef = setAndForwardRef({\n * getForwardedRef: () => this.props.forwardedRef,\n * setLocalRef: ref => {\n * this._nativeRef = ref;\n * },\n * });\n *\n * render() {\n * return <View ref={this._setNativeRef} />;\n * }\n * }\n *\n * const MyViewWithRef = React.forwardRef((props, ref) => (\n * <MyView {...props} forwardedRef={ref} />\n * ));\n *\n * module.exports = MyViewWithRef;\n */\n\ntype ForwardedRef<T> = () => MutableRefObject<T> | ((ref: T) => void);\n\nfunction setAndForwardRef<T>({\n getForwardedRef,\n setLocalRef,\n}: {\n getForwardedRef: ForwardedRef<T>;\n setLocalRef: (ref: T) => void;\n}): (ref: T) => void {\n return function forwardRef(ref: T) {\n const forwardedRef = getForwardedRef();\n\n setLocalRef(ref);\n\n // Forward to user ref prop (if one has been specified)\n if (typeof forwardedRef === 'function') {\n // Handle function-based refs. String-based refs are handled as functions.\n forwardedRef(ref);\n } else if (typeof forwardedRef === 'object' && forwardedRef != null) {\n // Handle createRef-based refs\n forwardedRef.current = ref;\n }\n };\n}\n\nexport default setAndForwardRef;\n"],"mappings":"AAAA,YAAY;;AACZ;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA,SAASA,gBAAgBA,CAAAC,IAAA,EAMJ;EAAA,IANQ;IAC3BC,eAAe;IACfC;EAIF,CAAC,GAAAF,IAAA;EACC,OAAO,SAASG,UAAUA,CAACC,GAAM,EAAE;IACjC,MAAMC,YAAY,GAAGJ,eAAe,EAAE;IAEtCC,WAAW,CAACE,GAAG,CAAC;;IAEhB;IACA,IAAI,OAAOC,YAAY,KAAK,UAAU,EAAE;MACtC;MACAA,YAAY,CAACD,GAAG,CAAC;IACnB,CAAC,MAAM,IAAI,OAAOC,YAAY,KAAK,QAAQ,IAAIA,YAAY,IAAI,IAAI,EAAE;MACnE;MACAA,YAAY,CAACC,OAAO,GAAGF,GAAG;IAC5B;EACF,CAAC;AACH;AAEA,eAAeL,gBAAgB"}
|
|
1
|
+
{"version":3,"names":["setAndForwardRef","_ref","getForwardedRef","setLocalRef","forwardRef","ref","forwardedRef","current"],"sources":["setAndForwardRef.ts"],"sourcesContent":["'use strict';\n/**\n * imported from react-native\n */\n\nimport type { MutableRefObject } from 'react';\n\n/* eslint-disable */\n/**\n * This is a helper function for when a component needs to be able to forward a ref\n * to a child component, but still needs to have access to that component as part of\n * its implementation.\n *\n * Its main use case is in wrappers for native components.\n *\n * Usage:\n *\n * class MyView extends React.Component {\n * _nativeRef = null;\n *\n * _setNativeRef = setAndForwardRef({\n * getForwardedRef: () => this.props.forwardedRef,\n * setLocalRef: ref => {\n * this._nativeRef = ref;\n * },\n * });\n *\n * render() {\n * return <View ref={this._setNativeRef} />;\n * }\n * }\n *\n * const MyViewWithRef = React.forwardRef((props, ref) => (\n * <MyView {...props} forwardedRef={ref} />\n * ));\n *\n * module.exports = MyViewWithRef;\n */\n/* eslint-enable */\n\ntype ForwardedRef<T> = () => MutableRefObject<T> | ((ref: T) => void);\n\nfunction setAndForwardRef<T>({\n getForwardedRef,\n setLocalRef,\n}: {\n getForwardedRef: ForwardedRef<T>;\n setLocalRef: (ref: T) => void;\n}): (ref: T) => void {\n return function forwardRef(ref: T) {\n const forwardedRef = getForwardedRef();\n\n setLocalRef(ref);\n\n // Forward to user ref prop (if one has been specified)\n if (typeof forwardedRef === 'function') {\n // Handle function-based refs. String-based refs are handled as functions.\n forwardedRef(ref);\n } else if (typeof forwardedRef === 'object' && forwardedRef != null) {\n // Handle createRef-based refs\n forwardedRef.current = ref;\n }\n };\n}\n\nexport default setAndForwardRef;\n"],"mappings":"AAAA,YAAY;;AACZ;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA,SAASA,gBAAgBA,CAAAC,IAAA,EAMJ;EAAA,IANQ;IAC3BC,eAAe;IACfC;EAIF,CAAC,GAAAF,IAAA;EACC,OAAO,SAASG,UAAUA,CAACC,GAAM,EAAE;IACjC,MAAMC,YAAY,GAAGJ,eAAe,EAAE;IAEtCC,WAAW,CAACE,GAAG,CAAC;;IAEhB;IACA,IAAI,OAAOC,YAAY,KAAK,UAAU,EAAE;MACtC;MACAA,YAAY,CAACD,GAAG,CAAC;IACnB,CAAC,MAAM,IAAI,OAAOC,YAAY,KAAK,QAAQ,IAAIA,YAAY,IAAI,IAAI,EAAE;MACnE;MACAA,YAAY,CAACC,OAAO,GAAGF,GAAG;IAC5B;EACF,CAAC;AACH;AAEA,eAAeL,gBAAgB"}
|
|
@@ -49,11 +49,11 @@ import { Bezier } from './Bezier';
|
|
|
49
49
|
*/
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
|
-
* @deprecated Please use
|
|
52
|
+
* @deprecated Please use {@link EasingFunction} type instead.
|
|
53
53
|
*/
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
|
-
* @deprecated Please use
|
|
56
|
+
* @deprecated Please use {@link EasingFunctionFactory} type instead.
|
|
57
57
|
*/
|
|
58
58
|
|
|
59
59
|
/**
|
|
@@ -158,7 +158,7 @@ function exp(t) {
|
|
|
158
158
|
* forth.
|
|
159
159
|
*
|
|
160
160
|
* Default bounciness is 1, which overshoots a little bit once. 0 bounciness
|
|
161
|
-
* doesn't overshoot at all, and bounciness of N
|
|
161
|
+
* doesn't overshoot at all, and bounciness of N \> 1 will overshoot about N
|
|
162
162
|
* times.
|
|
163
163
|
*
|
|
164
164
|
* http://easings.net/#easeInElastic
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Bezier","linear","t","ease","quad","cubic","poly","n","Math","pow","sin","cos","PI","circle","sqrt","exp","elastic","bounciness","arguments","length","undefined","p","back","s","bounce","t2","bezier","x1","y1","x2","y2","factory","bezierFn","in_","easing","out","inOut","steps","roundToNextStep","value","min","max","ceil","floor","EasingObject","in","Easing"],"sources":["Easing.ts"],"sourcesContent":["'use strict';\nimport { Bezier } from './Bezier';\n\n/**\n * The `Easing` module implements common easing functions. This module is used\n * by [Animate.timing()](docs/animate.html#timing) to convey physically\n * believable motion in animations.\n *\n * You can find a visualization of some common easing functions at\n * http://easings.net/\n *\n * ### Predefined animations\n *\n * The `Easing` module provides several predefined animations through the\n * following methods:\n *\n * - [`back`](docs/easing.html#back) provides a simple animation where the\n * object goes slightly back before moving forward\n * - [`bounce`](docs/easing.html#bounce) provides a bouncing animation\n * - [`ease`](docs/easing.html#ease) provides a simple inertial animation\n * - [`elastic`](docs/easing.html#elastic) provides a simple spring interaction\n *\n * ### Standard functions\n *\n * Three standard easing functions are provided:\n *\n * - [`linear`](docs/easing.html#linear)\n * - [`quad`](docs/easing.html#quad)\n * - [`cubic`](docs/easing.html#cubic)\n *\n * The [`poly`](docs/easing.html#poly) function can be used to implement\n * quartic, quintic, and other higher power functions.\n *\n * ### Additional functions\n *\n * Additional mathematical functions are provided by the following methods:\n *\n * - [`bezier`](docs/easing.html#bezier) provides a cubic bezier curve\n * - [`circle`](docs/easing.html#circle) provides a circular function\n * - [`sin`](docs/easing.html#sin) provides a sinusoidal function\n * - [`exp`](docs/easing.html#exp) provides an exponential function\n *\n * The following helpers are used to modify other easing functions.\n *\n * - [`in`](docs/easing.html#in) runs an easing function forwards\n * - [`inOut`](docs/easing.html#inout) makes any easing function symmetrical\n * - [`out`](docs/easing.html#out) runs an easing function backwards\n */\n\nexport type EasingFunction = (t: number) => number;\n\n/**\n * @deprecated Please use `EasingFunction` type instead.\n */\nexport type EasingFn = EasingFunction;\n\nexport type EasingFunctionFactory = { factory: () => EasingFunction };\n\n/**\n * @deprecated Please use `EasingFunctionFactory` type instead.\n */\nexport type EasingFactoryFn = EasingFunctionFactory;\n/**\n * A linear function, `f(t) = t`. Position correlates to elapsed time one to\n * one.\n *\n * http://cubic-bezier.com/#0,0,1,1\n */\nfunction linear(t: number): number {\n 'worklet';\n return t;\n}\n\n/**\n * A simple inertial interaction, similar to an object slowly accelerating to\n * speed.\n *\n * http://cubic-bezier.com/#.42,0,1,1\n */\nfunction ease(t: number): number {\n 'worklet';\n return Bezier(0.42, 0, 1, 1)(t);\n}\n\n/**\n * A quadratic function, `f(t) = t * t`. Position equals the square of elapsed\n * time.\n *\n * http://easings.net/#easeInQuad\n */\nfunction quad(t: number): number {\n 'worklet';\n return t * t;\n}\n\n/**\n * A cubic function, `f(t) = t * t * t`. Position equals the cube of elapsed\n * time.\n *\n * http://easings.net/#easeInCubic\n */\nfunction cubic(t: number): number {\n 'worklet';\n return t * t * t;\n}\n\n/**\n * A power function. Position is equal to the Nth power of elapsed time.\n *\n * n = 4: http://easings.net/#easeInQuart\n * n = 5: http://easings.net/#easeInQuint\n */\nfunction poly(n: number): EasingFunction {\n 'worklet';\n return (t) => {\n 'worklet';\n return Math.pow(t, n);\n };\n}\n\n/**\n * A sinusoidal function.\n *\n * http://easings.net/#easeInSine\n */\nfunction sin(t: number): number {\n 'worklet';\n return 1 - Math.cos((t * Math.PI) / 2);\n}\n\n/**\n * A circular function.\n *\n * http://easings.net/#easeInCirc\n */\nfunction circle(t: number): number {\n 'worklet';\n return 1 - Math.sqrt(1 - t * t);\n}\n\n/**\n * An exponential function.\n *\n * http://easings.net/#easeInExpo\n */\nfunction exp(t: number): number {\n 'worklet';\n return Math.pow(2, 10 * (t - 1));\n}\n\n/**\n * A simple elastic interaction, similar to a spring oscillating back and\n * forth.\n *\n * Default bounciness is 1, which overshoots a little bit once. 0 bounciness\n * doesn't overshoot at all, and bounciness of N > 1 will overshoot about N\n * times.\n *\n * http://easings.net/#easeInElastic\n */\nfunction elastic(bounciness = 1): EasingFunction {\n 'worklet';\n const p = bounciness * Math.PI;\n return (t) => {\n 'worklet';\n return 1 - Math.pow(Math.cos((t * Math.PI) / 2), 3) * Math.cos(t * p);\n };\n}\n\n/**\n * Use with `Animated.parallel()` to create a simple effect where the object\n * animates back slightly as the animation starts.\n *\n * Wolfram Plot:\n *\n * - http://tiny.cc/back_default (s = 1.70158, default)\n */\nfunction back(s = 1.70158): (t: number) => number {\n 'worklet';\n return (t) => {\n 'worklet';\n return t * t * ((s + 1) * t - s);\n };\n}\n\n/**\n * Provides a simple bouncing effect.\n *\n * http://easings.net/#easeInBounce\n */\nfunction bounce(t: number): number {\n 'worklet';\n if (t < 1 / 2.75) {\n return 7.5625 * t * t;\n }\n\n if (t < 2 / 2.75) {\n const t2 = t - 1.5 / 2.75;\n return 7.5625 * t2 * t2 + 0.75;\n }\n\n if (t < 2.5 / 2.75) {\n const t2 = t - 2.25 / 2.75;\n return 7.5625 * t2 * t2 + 0.9375;\n }\n\n const t2 = t - 2.625 / 2.75;\n return 7.5625 * t2 * t2 + 0.984375;\n}\n\n/**\n * Provides a cubic bezier curve, equivalent to CSS Transitions'\n * `transition-timing-function`.\n *\n * A useful tool to visualize cubic bezier curves can be found at\n * http://cubic-bezier.com/\n */\nfunction bezier(\n x1: number,\n y1: number,\n x2: number,\n y2: number\n): { factory: () => (x: number) => number } {\n 'worklet';\n return {\n factory: () => {\n 'worklet';\n return Bezier(x1, y1, x2, y2);\n },\n };\n}\n\nfunction bezierFn(\n x1: number,\n y1: number,\n x2: number,\n y2: number\n): (x: number) => number {\n 'worklet';\n return Bezier(x1, y1, x2, y2);\n}\n\n/**\n * Runs an easing function forwards.\n */\nfunction in_(easing: EasingFunction): EasingFunction {\n 'worklet';\n return easing;\n}\n\n/**\n * Runs an easing function backwards.\n */\nfunction out(easing: EasingFunction): EasingFunction {\n 'worklet';\n return (t) => {\n 'worklet';\n return 1 - easing(1 - t);\n };\n}\n\n/**\n * Makes any easing function symmetrical. The easing function will run\n * forwards for half of the duration, then backwards for the rest of the\n * duration.\n */\nfunction inOut(easing: EasingFunction): EasingFunction {\n 'worklet';\n return (t) => {\n 'worklet';\n if (t < 0.5) {\n return easing(t * 2) / 2;\n }\n return 1 - easing((1 - t) * 2) / 2;\n };\n}\n\n/**\n * The `steps` easing function jumps between discrete values at regular intervals,\n * creating a stepped animation effect. The `n` parameter determines the number of\n * steps in the animation, and the `roundToNextStep` parameter determines whether the animation\n * should start at the beginning or end of each step.\n */\nfunction steps(n = 10, roundToNextStep = true): EasingFunction {\n 'worklet';\n return (t) => {\n 'worklet';\n const value = Math.min(Math.max(t, 0), 1) * n;\n if (roundToNextStep) {\n return Math.ceil(value) / n;\n }\n return Math.floor(value) / n;\n };\n}\n\nconst EasingObject = {\n linear,\n ease,\n quad,\n cubic,\n poly,\n sin,\n circle,\n exp,\n elastic,\n back,\n bounce,\n bezier,\n bezierFn,\n steps,\n in: in_,\n out,\n inOut,\n};\n\nexport const Easing = EasingObject;\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,MAAM,QAAQ,UAAU;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,MAAMA,CAACC,CAAS,EAAU;EACjC,SAAS;;EACT,OAAOA,CAAC;AACV;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,IAAIA,CAACD,CAAS,EAAU;EAC/B,SAAS;;EACT,OAAOF,MAAM,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAACE,CAAC,CAAC;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASE,IAAIA,CAACF,CAAS,EAAU;EAC/B,SAAS;;EACT,OAAOA,CAAC,GAAGA,CAAC;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASG,KAAKA,CAACH,CAAS,EAAU;EAChC,SAAS;;EACT,OAAOA,CAAC,GAAGA,CAAC,GAAGA,CAAC;AAClB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASI,IAAIA,CAACC,CAAS,EAAkB;EACvC,SAAS;;EACT,OAAQL,CAAC,IAAK;IACZ,SAAS;;IACT,OAAOM,IAAI,CAACC,GAAG,CAACP,CAAC,EAAEK,CAAC,CAAC;EACvB,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,SAASG,GAAGA,CAACR,CAAS,EAAU;EAC9B,SAAS;;EACT,OAAO,CAAC,GAAGM,IAAI,CAACG,GAAG,CAAET,CAAC,GAAGM,IAAI,CAACI,EA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AAO;EACPM,IAAI;EACJE,MAAM;EACNE,MAAM;EACNM,QAAQ;EACRK,KAAK;EACLQ,EAAE,EAAEZ,GAAG;EACPE,GAAG;EACHC;AACF,CAAC;AAED,OAAO,MAAMU,MAAM,GAAGF,YAAY"}
|
|
1
|
+
{"version":3,"names":["Bezier","linear","t","ease","quad","cubic","poly","n","Math","pow","sin","cos","PI","circle","sqrt","exp","elastic","bounciness","arguments","length","undefined","p","back","s","bounce","t2","bezier","x1","y1","x2","y2","factory","bezierFn","in_","easing","out","inOut","steps","roundToNextStep","value","min","max","ceil","floor","EasingObject","in","Easing"],"sources":["Easing.ts"],"sourcesContent":["'use strict';\nimport { Bezier } from './Bezier';\n\n/**\n * The `Easing` module implements common easing functions. This module is used\n * by [Animate.timing()](docs/animate.html#timing) to convey physically\n * believable motion in animations.\n *\n * You can find a visualization of some common easing functions at\n * http://easings.net/\n *\n * ### Predefined animations\n *\n * The `Easing` module provides several predefined animations through the\n * following methods:\n *\n * - [`back`](docs/easing.html#back) provides a simple animation where the\n * object goes slightly back before moving forward\n * - [`bounce`](docs/easing.html#bounce) provides a bouncing animation\n * - [`ease`](docs/easing.html#ease) provides a simple inertial animation\n * - [`elastic`](docs/easing.html#elastic) provides a simple spring interaction\n *\n * ### Standard functions\n *\n * Three standard easing functions are provided:\n *\n * - [`linear`](docs/easing.html#linear)\n * - [`quad`](docs/easing.html#quad)\n * - [`cubic`](docs/easing.html#cubic)\n *\n * The [`poly`](docs/easing.html#poly) function can be used to implement\n * quartic, quintic, and other higher power functions.\n *\n * ### Additional functions\n *\n * Additional mathematical functions are provided by the following methods:\n *\n * - [`bezier`](docs/easing.html#bezier) provides a cubic bezier curve\n * - [`circle`](docs/easing.html#circle) provides a circular function\n * - [`sin`](docs/easing.html#sin) provides a sinusoidal function\n * - [`exp`](docs/easing.html#exp) provides an exponential function\n *\n * The following helpers are used to modify other easing functions.\n *\n * - [`in`](docs/easing.html#in) runs an easing function forwards\n * - [`inOut`](docs/easing.html#inout) makes any easing function symmetrical\n * - [`out`](docs/easing.html#out) runs an easing function backwards\n */\n\nexport type EasingFunction = (t: number) => number;\n\n/**\n * @deprecated Please use {@link EasingFunction} type instead.\n */\nexport type EasingFn = EasingFunction;\n\nexport type EasingFunctionFactory = { factory: () => EasingFunction };\n\n/**\n * @deprecated Please use {@link EasingFunctionFactory} type instead.\n */\nexport type EasingFactoryFn = EasingFunctionFactory;\n/**\n * A linear function, `f(t) = t`. Position correlates to elapsed time one to\n * one.\n *\n * http://cubic-bezier.com/#0,0,1,1\n */\nfunction linear(t: number): number {\n 'worklet';\n return t;\n}\n\n/**\n * A simple inertial interaction, similar to an object slowly accelerating to\n * speed.\n *\n * http://cubic-bezier.com/#.42,0,1,1\n */\nfunction ease(t: number): number {\n 'worklet';\n return Bezier(0.42, 0, 1, 1)(t);\n}\n\n/**\n * A quadratic function, `f(t) = t * t`. Position equals the square of elapsed\n * time.\n *\n * http://easings.net/#easeInQuad\n */\nfunction quad(t: number): number {\n 'worklet';\n return t * t;\n}\n\n/**\n * A cubic function, `f(t) = t * t * t`. Position equals the cube of elapsed\n * time.\n *\n * http://easings.net/#easeInCubic\n */\nfunction cubic(t: number): number {\n 'worklet';\n return t * t * t;\n}\n\n/**\n * A power function. Position is equal to the Nth power of elapsed time.\n *\n * n = 4: http://easings.net/#easeInQuart\n * n = 5: http://easings.net/#easeInQuint\n */\nfunction poly(n: number): EasingFunction {\n 'worklet';\n return (t) => {\n 'worklet';\n return Math.pow(t, n);\n };\n}\n\n/**\n * A sinusoidal function.\n *\n * http://easings.net/#easeInSine\n */\nfunction sin(t: number): number {\n 'worklet';\n return 1 - Math.cos((t * Math.PI) / 2);\n}\n\n/**\n * A circular function.\n *\n * http://easings.net/#easeInCirc\n */\nfunction circle(t: number): number {\n 'worklet';\n return 1 - Math.sqrt(1 - t * t);\n}\n\n/**\n * An exponential function.\n *\n * http://easings.net/#easeInExpo\n */\nfunction exp(t: number): number {\n 'worklet';\n return Math.pow(2, 10 * (t - 1));\n}\n\n/**\n * A simple elastic interaction, similar to a spring oscillating back and\n * forth.\n *\n * Default bounciness is 1, which overshoots a little bit once. 0 bounciness\n * doesn't overshoot at all, and bounciness of N \\> 1 will overshoot about N\n * times.\n *\n * http://easings.net/#easeInElastic\n */\nfunction elastic(bounciness = 1): EasingFunction {\n 'worklet';\n const p = bounciness * Math.PI;\n return (t) => {\n 'worklet';\n return 1 - Math.pow(Math.cos((t * Math.PI) / 2), 3) * Math.cos(t * p);\n };\n}\n\n/**\n * Use with `Animated.parallel()` to create a simple effect where the object\n * animates back slightly as the animation starts.\n *\n * Wolfram Plot:\n *\n * - http://tiny.cc/back_default (s = 1.70158, default)\n */\nfunction back(s = 1.70158): (t: number) => number {\n 'worklet';\n return (t) => {\n 'worklet';\n return t * t * ((s + 1) * t - s);\n };\n}\n\n/**\n * Provides a simple bouncing effect.\n *\n * http://easings.net/#easeInBounce\n */\nfunction bounce(t: number): number {\n 'worklet';\n if (t < 1 / 2.75) {\n return 7.5625 * t * t;\n }\n\n if (t < 2 / 2.75) {\n const t2 = t - 1.5 / 2.75;\n return 7.5625 * t2 * t2 + 0.75;\n }\n\n if (t < 2.5 / 2.75) {\n const t2 = t - 2.25 / 2.75;\n return 7.5625 * t2 * t2 + 0.9375;\n }\n\n const t2 = t - 2.625 / 2.75;\n return 7.5625 * t2 * t2 + 0.984375;\n}\n\n/**\n * Provides a cubic bezier curve, equivalent to CSS Transitions'\n * `transition-timing-function`.\n *\n * A useful tool to visualize cubic bezier curves can be found at\n * http://cubic-bezier.com/\n */\nfunction bezier(\n x1: number,\n y1: number,\n x2: number,\n y2: number\n): { factory: () => (x: number) => number } {\n 'worklet';\n return {\n factory: () => {\n 'worklet';\n return Bezier(x1, y1, x2, y2);\n },\n };\n}\n\nfunction bezierFn(\n x1: number,\n y1: number,\n x2: number,\n y2: number\n): (x: number) => number {\n 'worklet';\n return Bezier(x1, y1, x2, y2);\n}\n\n/**\n * Runs an easing function forwards.\n */\nfunction in_(easing: EasingFunction): EasingFunction {\n 'worklet';\n return easing;\n}\n\n/**\n * Runs an easing function backwards.\n */\nfunction out(easing: EasingFunction): EasingFunction {\n 'worklet';\n return (t) => {\n 'worklet';\n return 1 - easing(1 - t);\n };\n}\n\n/**\n * Makes any easing function symmetrical. The easing function will run\n * forwards for half of the duration, then backwards for the rest of the\n * duration.\n */\nfunction inOut(easing: EasingFunction): EasingFunction {\n 'worklet';\n return (t) => {\n 'worklet';\n if (t < 0.5) {\n return easing(t * 2) / 2;\n }\n return 1 - easing((1 - t) * 2) / 2;\n };\n}\n\n/**\n * The `steps` easing function jumps between discrete values at regular intervals,\n * creating a stepped animation effect. The `n` parameter determines the number of\n * steps in the animation, and the `roundToNextStep` parameter determines whether the animation\n * should start at the beginning or end of each step.\n */\nfunction steps(n = 10, roundToNextStep = true): EasingFunction {\n 'worklet';\n return (t) => {\n 'worklet';\n const value = Math.min(Math.max(t, 0), 1) * n;\n if (roundToNextStep) {\n return Math.ceil(value) / n;\n }\n return Math.floor(value) / n;\n };\n}\n\nconst EasingObject = {\n linear,\n ease,\n quad,\n cubic,\n poly,\n sin,\n circle,\n exp,\n elastic,\n back,\n bounce,\n bezier,\n bezierFn,\n steps,\n in: in_,\n out,\n inOut,\n};\n\nexport const Easing = EasingObject;\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,MAAM,QAAQ,UAAU;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,MAAMA,CAACC,CAAS,EAAU;EACjC,SAAS;;EACT,OAAOA,CAAC;AACV;;AAEA;AACA;AACA;AACA;AACA;AACA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;AACA;AACA;AACA,SAASmC,KAAKA,CAAA,EAAiD;EAC7D,SAAS;;EAAC,IADG9B,CAAC,GAAAW,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAAA,IAAEoB,eAAe,GAAApB,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;EAE3C,OAAQhB,CAAC,IAAK;IACZ,SAAS;;IACT,MAAMqC,KAAK,GAAG/B,IAAI,CAACgC,GAAG,CAAChC,IAAI,CAACiC,GAAG,CAACvC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,GAAGK,CAAC;IAC7C,IAAI+B,eAAe,EAAE;MACnB,OAAO9B,IAAI,CAACkC,IAAI,CAACH,KAAK,CAAC,GAAGhC,CAAC;IAC7B;IACA,OAAOC,IAAI,CAACmC,KAAK,CAACJ,KAAK,CAAC,GAAGhC,CAAC;EAC9B,CAAC;AACH;AAEA,MAAMqC,YAAY,GAAG;EACnB3C,MAAM;EACNE,IAAI;EACJC,IAAI;EACJC,KAAK;EACLC,IAAI;EACJI,GAAG;EACHG,MAAM;EACNE,GAAG;EACHC,OAAO;EACPM,IAAI;EACJE,MAAM;EACNE,MAAM;EACNM,QAAQ;EACRK,KAAK;EACLQ,EAAE,EAAEZ,GAAG;EACPE,GAAG;EACHC;AACF,CAAC;AAED,OAAO,MAAMU,MAAM,GAAGF,YAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","isJest","process","env","JEST_WORKER_ID","isChromeDebugger","global","nativeCallSyncHook","__REMOTEDEV__","isWeb","OS","isAndroid","isWindows","shouldBeUseWeb","nativeShouldBeMock","isFabric","_IS_FABRIC","isWindowAvailable","window","isReducedMotion","matchMedia","matches","_REANIMATED_IS_REDUCED_MOTION"],"sources":["PlatformChecker.ts"],"sourcesContent":["'use strict';\nimport { Platform } from 'react-native';\n\n// This type is necessary since some libraries tend to do a lib check\n// and this file causes type errors on `global` access.\ntype localGlobal = typeof global & Record<string, unknown>;\n\nexport function isJest(): boolean {\n return !!process.env.JEST_WORKER_ID;\n}\n\n// `isChromeDebugger` also returns true in Jest environment, so `isJest()` check should always be performed first\nexport function isChromeDebugger(): boolean {\n return (\n !(global as localGlobal).nativeCallSyncHook ||\n !!(global as localGlobal).__REMOTEDEV__\n );\n}\n\nexport function isWeb(): boolean {\n return Platform.OS === 'web';\n}\n\nexport function isAndroid(): boolean {\n return Platform.OS === 'android';\n}\n\nfunction isWindows(): boolean {\n return Platform.OS === 'windows';\n}\n\nexport function shouldBeUseWeb() {\n return isJest() || isChromeDebugger() || isWeb() || isWindows();\n}\n\nexport function nativeShouldBeMock() {\n return isJest() || isChromeDebugger() || isWindows();\n}\n\nexport function isFabric() {\n return !!global._IS_FABRIC;\n}\n\nexport function isWindowAvailable() {\n // the window object is unavailable when building the server portion of a site that uses SSG\n // this function shouldn't be used to conditionally render components\n // https://www.joshwcomeau.com/react/the-perils-of-rehydration/\n // @ts-ignore Fallback if `window` is undefined.\n return typeof window !== 'undefined';\n}\n\nexport function isReducedMotion() {\n return isWeb()\n ? isWindowAvailable()\n ? // @ts-ignore Fallback if `window` is undefined.\n !window.matchMedia('(prefers-reduced-motion: no-preference)').matches\n : false\n : !!(global as localGlobal)._REANIMATED_IS_REDUCED_MOTION;\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,QAAQ,QAAQ,cAAc;;AAEvC;AACA;AAGA,OAAO,SAASC,MAAMA,CAAA,EAAY;EAChC,OAAO,CAAC,CAACC,OAAO,CAACC,GAAG,CAACC,cAAc;AACrC;;AAEA;AACA,OAAO,SAASC,gBAAgBA,CAAA,EAAY;EAC1C,OACE,CAAEC,MAAM,CAAiBC,kBAAkB,IAC3C,CAAC,CAAED,MAAM,CAAiBE,aAAa;AAE3C;AAEA,OAAO,SAASC,KAAKA,CAAA,EAAY;EAC/B,OAAOT,QAAQ,CAACU,EAAE,KAAK,KAAK;AAC9B;AAEA,OAAO,SAASC,SAASA,CAAA,EAAY;EACnC,OAAOX,QAAQ,CAACU,EAAE,KAAK,SAAS;AAClC;AAEA,SAASE,SAASA,CAAA,EAAY;EAC5B,OAAOZ,QAAQ,CAACU,EAAE,KAAK,SAAS;AAClC;AAEA,OAAO,SAASG,cAAcA,CAAA,EAAG;EAC/B,OAAOZ,MAAM,EAAE,IAAII,gBAAgB,EAAE,IAAII,KAAK,EAAE,IAAIG,SAAS,EAAE;AACjE;AAEA,OAAO,SAASE,kBAAkBA,CAAA,EAAG;EACnC,OAAOb,MAAM,EAAE,IAAII,gBAAgB,EAAE,IAAIO,SAAS,EAAE;AACtD;AAEA,OAAO,SAASG,QAAQA,CAAA,EAAG;EACzB,OAAO,CAAC,
|
|
1
|
+
{"version":3,"names":["Platform","isJest","process","env","JEST_WORKER_ID","isChromeDebugger","global","nativeCallSyncHook","__REMOTEDEV__","isWeb","OS","isAndroid","isWindows","shouldBeUseWeb","nativeShouldBeMock","isFabric","_IS_FABRIC","isWindowAvailable","window","isReducedMotion","matchMedia","matches","_REANIMATED_IS_REDUCED_MOTION"],"sources":["PlatformChecker.ts"],"sourcesContent":["'use strict';\nimport { Platform } from 'react-native';\n\n// This type is necessary since some libraries tend to do a lib check\n// and this file causes type errors on `global` access.\ntype localGlobal = typeof global & Record<string, unknown>;\n\nexport function isJest(): boolean {\n return !!process.env.JEST_WORKER_ID;\n}\n\n// `isChromeDebugger` also returns true in Jest environment, so `isJest()` check should always be performed first\nexport function isChromeDebugger(): boolean {\n return (\n !(global as localGlobal).nativeCallSyncHook ||\n !!(global as localGlobal).__REMOTEDEV__\n );\n}\n\nexport function isWeb(): boolean {\n return Platform.OS === 'web';\n}\n\nexport function isAndroid(): boolean {\n return Platform.OS === 'android';\n}\n\nfunction isWindows(): boolean {\n return Platform.OS === 'windows';\n}\n\nexport function shouldBeUseWeb() {\n return isJest() || isChromeDebugger() || isWeb() || isWindows();\n}\n\nexport function nativeShouldBeMock() {\n return isJest() || isChromeDebugger() || isWindows();\n}\n\nexport function isFabric() {\n return !!(global as localGlobal)._IS_FABRIC;\n}\n\nexport function isWindowAvailable() {\n // the window object is unavailable when building the server portion of a site that uses SSG\n // this function shouldn't be used to conditionally render components\n // https://www.joshwcomeau.com/react/the-perils-of-rehydration/\n // @ts-ignore Fallback if `window` is undefined.\n return typeof window !== 'undefined';\n}\n\nexport function isReducedMotion() {\n return isWeb()\n ? isWindowAvailable()\n ? // @ts-ignore Fallback if `window` is undefined.\n !window.matchMedia('(prefers-reduced-motion: no-preference)').matches\n : false\n : !!(global as localGlobal)._REANIMATED_IS_REDUCED_MOTION;\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,QAAQ,QAAQ,cAAc;;AAEvC;AACA;AAGA,OAAO,SAASC,MAAMA,CAAA,EAAY;EAChC,OAAO,CAAC,CAACC,OAAO,CAACC,GAAG,CAACC,cAAc;AACrC;;AAEA;AACA,OAAO,SAASC,gBAAgBA,CAAA,EAAY;EAC1C,OACE,CAAEC,MAAM,CAAiBC,kBAAkB,IAC3C,CAAC,CAAED,MAAM,CAAiBE,aAAa;AAE3C;AAEA,OAAO,SAASC,KAAKA,CAAA,EAAY;EAC/B,OAAOT,QAAQ,CAACU,EAAE,KAAK,KAAK;AAC9B;AAEA,OAAO,SAASC,SAASA,CAAA,EAAY;EACnC,OAAOX,QAAQ,CAACU,EAAE,KAAK,SAAS;AAClC;AAEA,SAASE,SAASA,CAAA,EAAY;EAC5B,OAAOZ,QAAQ,CAACU,EAAE,KAAK,SAAS;AAClC;AAEA,OAAO,SAASG,cAAcA,CAAA,EAAG;EAC/B,OAAOZ,MAAM,EAAE,IAAII,gBAAgB,EAAE,IAAII,KAAK,EAAE,IAAIG,SAAS,EAAE;AACjE;AAEA,OAAO,SAASE,kBAAkBA,CAAA,EAAG;EACnC,OAAOb,MAAM,EAAE,IAAII,gBAAgB,EAAE,IAAIO,SAAS,EAAE;AACtD;AAEA,OAAO,SAASG,QAAQA,CAAA,EAAG;EACzB,OAAO,CAAC,CAAET,MAAM,CAAiBU,UAAU;AAC7C;AAEA,OAAO,SAASC,iBAAiBA,CAAA,EAAG;EAClC;EACA;EACA;EACA;EACA,OAAO,OAAOC,MAAM,KAAK,WAAW;AACtC;AAEA,OAAO,SAASC,eAAeA,CAAA,EAAG;EAChC,OAAOV,KAAK,EAAE,GACVQ,iBAAiB,EAAE;EACjB;EACA,CAACC,MAAM,CAACE,UAAU,CAAC,yCAAyC,CAAC,CAACC,OAAO,GACrE,KAAK,GACP,CAAC,CAAEf,MAAM,CAAiBgB,6BAA6B;AAC7D"}
|
|
@@ -25,6 +25,15 @@ function validateConfig(config) {
|
|
|
25
25
|
throw new Error('[Reanimated] You need to set `clamp` property when using `rubberBandEffect`.');
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Lets you create animations that mimic objects in motion with friction.
|
|
31
|
+
*
|
|
32
|
+
* @param config - The decay animation configuration - {@link DecayConfig}.
|
|
33
|
+
* @param callback - A function called upon animation completion - {@link AnimationCallback}.
|
|
34
|
+
* @returns An [animation object](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#animation-object) which holds the current state of the animation.
|
|
35
|
+
* @see https://docs.swmansion.com/react-native-reanimated/docs/animations/withDecay
|
|
36
|
+
*/
|
|
28
37
|
export const withDecay = function (userConfig, callback) {
|
|
29
38
|
'worklet';
|
|
30
39
|
|
|
@@ -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 ${config.clamp.length}.`\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\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,GAAE,CAChF;IACH;IACA,IAAID,MAAM,CAACC,KAAK,CAACI,MAAM,KAAK,CAAC,EAAE;MAC7B,MAAM,IAAID,KAAK,CACZ,kEAAiEJ,MAAM,CAACC,KAAK,CAACI,MAAO,GAAE,CACzF;IACH;EACF;EACA,IAAIL,MAAM,CAACM,cAAc,IAAI,CAAC,EAAE;IAC9B,MAAM,IAAIF,KAAK,CACZ,yEAAwEJ,MAAM,CAACM,cAAe,GAAE,CAClG;EACH;EACA,IAAIN,MAAM,CAACO,gBAAgB,IAAI,CAACP,MAAM,CAACC,KAAK,EAAE;IAC5C,MAAM,IAAIG,KAAK,CACb,8EAA8E,CAC/E;EACH;AACF;
|
|
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 ${config.clamp.length}.`\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,CAAC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ND,SAAS,CAACI,OAAO,GAAGD,KAAK;MACzBH,SAAS,CAACK,aAAa,GAAGJ,GAAG;MAC7BD,SAAS,CAACM,cAAc,GAAGL,GAAG;MAC9BD,SAAS,CAACO,eAAe,GAAG1B,MAAM,CAACY,QAAQ;MAC3Cb,cAAc,CAACC,MAAM,CAAC;MAEtB,IAAImB,SAAS,CAACQ,YAAY,IAAI3B,MAAM,CAACC,KAAK,EAAE;QAC1C,IAAIqB,KAAK,GAAGtB,MAAM,CAACC,KAAK,CAAC,CAAC,CAAC,EAAE;UAC3BkB,SAAS,CAACI,OAAO,GAAGvB,MAAM,CAACC,KAAK,CAAC,CAAC,CAAC;QACrC,CAAC,MAAM,IAAIqB,KAAK,GAAGtB,MAAM,CAACC,KAAK,CAAC,CAAC,CAAC,EAAE;UAClCkB,SAAS,CAACI,OAAO,GAAGvB,MAAM,CAACC,KAAK,CAAC,CAAC,CAAC;QACrC;MACF;IACF;IAEA,OAAO;MACL2B,OAAO,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"}
|
|
@@ -5,6 +5,19 @@ const IS_WEB = isWeb();
|
|
|
5
5
|
export const VELOCITY_EPS = IS_WEB ? 1 / 20 : 1;
|
|
6
6
|
export const SLOPE_FACTOR = 0.1;
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* The decay animation configuration.
|
|
10
|
+
*
|
|
11
|
+
* @param velocity - Initial velocity of the animation. Defaults to 0.
|
|
12
|
+
* @param deceleration - The rate at which the velocity decreases over time. Defaults to 0.998.
|
|
13
|
+
* @param clamp - Array of two numbers which restricts animation's range. Defaults to [].
|
|
14
|
+
* @param velocityFactor - Velocity multiplier. Defaults to 1.
|
|
15
|
+
* @param rubberBandEffect - Makes the animation bounce over the limit specified in `clamp`. Defaults to `false`.
|
|
16
|
+
* @param rubberBandFactor - Strength of the rubber band effect. Defaults to 0.6.
|
|
17
|
+
* @param reduceMotion - Determines how the animation responds to the device's reduced motion accessibility setting. Default to `ReduceMotion.System` - {@link ReduceMotion}.
|
|
18
|
+
* @see https://docs.swmansion.com/react-native-reanimated/docs/animations/withDecay#config
|
|
19
|
+
*/
|
|
20
|
+
|
|
8
21
|
// If user wants to use rubber band decay animation we have to make sure he has provided clamp
|
|
9
22
|
|
|
10
23
|
export function isValidRubberBandConfig(config) {
|
|
@@ -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\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,EAAE;AACtB,OAAO,MAAME,YAAY,GAAGD,MAAM,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC;AAC/C,OAAO,MAAME,YAAY,GAAG,GAAG;;
|
|
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,EAAE;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"}
|
|
@@ -4,6 +4,15 @@ import { defineAnimation, getReduceMotionForAnimation } from './util';
|
|
|
4
4
|
|
|
5
5
|
// TODO TYPESCRIPT This is a temporary type to get rid of .d.ts file.
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* An animation modifier that lets you start an animation with a delay.
|
|
9
|
+
*
|
|
10
|
+
* @param delayMs - Duration (in milliseconds) before the animation starts.
|
|
11
|
+
* @param nextAnimation - The animation to delay.
|
|
12
|
+
* @param reduceMotion - Determines how the animation responds to the device's reduced motion accessibility setting. Default to `ReduceMotion.System` - {@link ReduceMotion}.
|
|
13
|
+
* @returns An [animation object](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#animation-object) which holds the current state of the animation.
|
|
14
|
+
* @see https://docs.swmansion.com/react-native-reanimated/docs/animations/withDelay
|
|
15
|
+
*/
|
|
7
16
|
export const withDelay = function (delayMs, _nextAnimation, reduceMotion) {
|
|
8
17
|
'worklet';
|
|
9
18
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["defineAnimation","getReduceMotionForAnimation","withDelay","delayMs","_nextAnimation","reduceMotion","nextAnimation","delay","animation","now","startTime","started","previousAnimation","current","onStart","finished","onFrame","value","undefined","callback","isHigherOrder"],"sources":["delay.ts"],"sourcesContent":["'use strict';\nimport { defineAnimation, getReduceMotionForAnimation } from './util';\nimport type {\n Animation,\n Timestamp,\n AnimatableValue,\n AnimationObject,\n ReduceMotion,\n} from '../commonTypes';\nimport type { DelayAnimation } from './commonTypes';\n\n// TODO TYPESCRIPT This is a temporary type to get rid of .d.ts file.\ntype withDelayType = <T extends AnimatableValue>(\n delayMs: number,\n delayedAnimation: T,\n reduceMotion?: ReduceMotion\n) => T;\n\nexport const withDelay = function <T extends AnimationObject>(\n delayMs: number,\n _nextAnimation: T | (() => T),\n reduceMotion?: ReduceMotion\n): Animation<DelayAnimation> {\n 'worklet';\n return defineAnimation<DelayAnimation, T>(\n _nextAnimation,\n (): DelayAnimation => {\n 'worklet';\n const nextAnimation =\n typeof _nextAnimation === 'function'\n ? _nextAnimation()\n : _nextAnimation;\n\n function delay(animation: DelayAnimation, now: Timestamp): boolean {\n const { startTime, started, previousAnimation } = animation;\n const current: AnimatableValue = animation.current;\n\n if (now - startTime > delayMs || animation.reduceMotion) {\n if (!started) {\n nextAnimation.onStart(\n nextAnimation,\n current,\n now,\n previousAnimation!\n );\n animation.previousAnimation = null;\n animation.started = true;\n }\n const finished = nextAnimation.onFrame(nextAnimation, now);\n animation.current = nextAnimation.current!;\n return finished;\n } else if (previousAnimation) {\n const finished =\n previousAnimation.finished ||\n previousAnimation.onFrame(previousAnimation, now);\n animation.current = previousAnimation.current;\n if (finished) {\n animation.previousAnimation = null;\n }\n }\n return false;\n }\n\n function onStart(\n animation: Animation<any>,\n value: AnimatableValue,\n now: Timestamp,\n previousAnimation: Animation<any> | null\n ): void {\n animation.startTime = now;\n animation.started = false;\n animation.current = value;\n if (previousAnimation === animation) {\n animation.previousAnimation = previousAnimation.previousAnimation;\n } else {\n animation.previousAnimation = previousAnimation;\n }\n\n // child animations inherit the setting, unless they already have it defined\n // they will have it defined only if the user used the `reduceMotion` prop\n if (nextAnimation.reduceMotion === undefined) {\n nextAnimation.reduceMotion = animation.reduceMotion;\n }\n }\n\n const callback = (finished?: boolean): void => {\n if (nextAnimation.callback) {\n nextAnimation.callback(finished);\n }\n };\n\n return {\n isHigherOrder: true,\n onFrame: delay,\n onStart,\n current: nextAnimation.current!,\n callback,\n previousAnimation: null,\n startTime: 0,\n started: false,\n reduceMotion: getReduceMotionForAnimation(reduceMotion),\n };\n }\n );\n} as withDelayType;\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,eAAe,EAAEC,2BAA2B,QAAQ,QAAQ;;AAUrE;;AAOA,OAAO,MAAMC,SAAS,GAAG,SAAAA,CACvBC,OAAe,EACfC,cAA6B,EAC7BC,YAA2B,EACA;EAC3B,SAAS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I,KAAK;MACzB,IAAIL,iBAAiB,KAAKJ,SAAS,EAAE;QACnCA,SAAS,CAACI,iBAAiB,GAAGA,iBAAiB,CAACA,iBAAiB;MACnE,CAAC,MAAM;QACLJ,SAAS,CAACI,iBAAiB,GAAGA,iBAAiB;MACjD;;MAEA;MACA;MACA,IAAIN,aAAa,CAACD,YAAY,KAAKa,SAAS,EAAE;QAC5CZ,aAAa,CAACD,YAAY,GAAGG,SAAS,CAACH,YAAY;MACrD;IACF;IAEA,MAAMc,QAAQ,GAAIJ,QAAkB,IAAW;MAC7C,IAAIT,aAAa,CAACa,QAAQ,EAAE;QAC1Bb,aAAa,CAACa,QAAQ,CAACJ,QAAQ,CAAC;MAClC;IACF,CAAC;IAED,OAAO;MACLK,aAAa,EAAE,IAAI;MACnBJ,OAAO,EAAET,KAAK;MACdO,OAAO;MACPD,OAAO,EAAEP,aAAa,CAACO,OAAQ;MAC/BM,QAAQ;MACRP,iBAAiB,EAAE,IAAI;MACvBF,SAAS,EAAE,CAAC;MACZC,OAAO,EAAE,KAAK;MACdN,YAAY,EAAEJ,2BAA2B,CAACI,YAAY;IACxD,CAAC;EACH,CAAC,CACF;AACH,CAAkB"}
|
|
1
|
+
{"version":3,"names":["defineAnimation","getReduceMotionForAnimation","withDelay","delayMs","_nextAnimation","reduceMotion","nextAnimation","delay","animation","now","startTime","started","previousAnimation","current","onStart","finished","onFrame","value","undefined","callback","isHigherOrder"],"sources":["delay.ts"],"sourcesContent":["'use strict';\nimport { defineAnimation, getReduceMotionForAnimation } from './util';\nimport type {\n Animation,\n Timestamp,\n AnimatableValue,\n AnimationObject,\n ReduceMotion,\n} from '../commonTypes';\nimport type { DelayAnimation } from './commonTypes';\n\n// TODO TYPESCRIPT This is a temporary type to get rid of .d.ts file.\ntype withDelayType = <T extends AnimatableValue>(\n delayMs: number,\n delayedAnimation: T,\n reduceMotion?: ReduceMotion\n) => T;\n\n/**\n * An animation modifier that lets you start an animation with a delay.\n *\n * @param delayMs - Duration (in milliseconds) before the animation starts.\n * @param nextAnimation - The animation to delay.\n * @param reduceMotion - Determines how the animation responds to the device's reduced motion accessibility setting. Default to `ReduceMotion.System` - {@link ReduceMotion}.\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/withDelay\n */\nexport const withDelay = function <T extends AnimationObject>(\n delayMs: number,\n _nextAnimation: T | (() => T),\n reduceMotion?: ReduceMotion\n): Animation<DelayAnimation> {\n 'worklet';\n return defineAnimation<DelayAnimation, T>(\n _nextAnimation,\n (): DelayAnimation => {\n 'worklet';\n const nextAnimation =\n typeof _nextAnimation === 'function'\n ? _nextAnimation()\n : _nextAnimation;\n\n function delay(animation: DelayAnimation, now: Timestamp): boolean {\n const { startTime, started, previousAnimation } = animation;\n const current: AnimatableValue = animation.current;\n\n if (now - startTime > delayMs || animation.reduceMotion) {\n if (!started) {\n nextAnimation.onStart(\n nextAnimation,\n current,\n now,\n previousAnimation!\n );\n animation.previousAnimation = null;\n animation.started = true;\n }\n const finished = nextAnimation.onFrame(nextAnimation, now);\n animation.current = nextAnimation.current!;\n return finished;\n } else if (previousAnimation) {\n const finished =\n previousAnimation.finished ||\n previousAnimation.onFrame(previousAnimation, now);\n animation.current = previousAnimation.current;\n if (finished) {\n animation.previousAnimation = null;\n }\n }\n return false;\n }\n\n function onStart(\n animation: Animation<any>,\n value: AnimatableValue,\n now: Timestamp,\n previousAnimation: Animation<any> | null\n ): void {\n animation.startTime = now;\n animation.started = false;\n animation.current = value;\n if (previousAnimation === animation) {\n animation.previousAnimation = previousAnimation.previousAnimation;\n } else {\n animation.previousAnimation = previousAnimation;\n }\n\n // child animations inherit the setting, unless they already have it defined\n // they will have it defined only if the user used the `reduceMotion` prop\n if (nextAnimation.reduceMotion === undefined) {\n nextAnimation.reduceMotion = animation.reduceMotion;\n }\n }\n\n const callback = (finished?: boolean): void => {\n if (nextAnimation.callback) {\n nextAnimation.callback(finished);\n }\n };\n\n return {\n isHigherOrder: true,\n onFrame: delay,\n onStart,\n current: nextAnimation.current!,\n callback,\n previousAnimation: null,\n startTime: 0,\n started: false,\n reduceMotion: getReduceMotionForAnimation(reduceMotion),\n };\n }\n );\n} as withDelayType;\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,eAAe,EAAEC,2BAA2B,QAAQ,QAAQ;;AAUrE;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,SAAS,GAAG,SAAAA,CACvBC,OAAe,EACfC,cAA6B,EAC7BC,YAA2B,EACA;EAC3B,SAAS;;EACT,OAAOL,eAAe,CACpBI,cAAc,EACd,MAAsB;IACpB,SAAS;;IACT,MAAME,aAAa,GACjB,OAAOF,cAAc,KAAK,UAAU,GAChCA,cAAc,EAAE,GAChBA,cAAc;IAEpB,SAASG,KAAKA,CAACC,SAAyB,EAAEC,GAAc,EAAW;MACjE,MAAM;QAAEC,SAAS;QAAEC,OAAO;QAAEC;MAAkB,CAAC,GAAGJ,SAAS;MAC3D,MAAMK,OAAwB,GAAGL,SAAS,CAACK,OAAO;MAElD,IAAIJ,GAAG,GAAGC,SAAS,GAAGP,OAAO,IAAIK,SAAS,CAACH,YAAY,EAAE;QACvD,IAAI,CAACM,OAAO,EAAE;UACZL,aAAa,CAACQ,OAAO,CACnBR,aAAa,EACbO,OAAO,EACPJ,GAAG,EACHG,iBAAiB,CAClB;UACDJ,SAAS,CAACI,iBAAiB,GAAG,IAAI;UAClCJ,SAAS,CAACG,OAAO,GAAG,IAAI;QAC1B;QACA,MAAMI,QAAQ,GAAGT,aAAa,CAACU,OAAO,CAACV,aAAa,EAAEG,GAAG,CAAC;QAC1DD,SAAS,CAACK,OAAO,GAAGP,aAAa,CAACO,OAAQ;QAC1C,OAAOE,QAAQ;MACjB,CAAC,MAAM,IAAIH,iBAAiB,EAAE;QAC5B,MAAMG,QAAQ,GACZH,iBAAiB,CAACG,QAAQ,IAC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This is a temporary type to get rid of .d.ts file.
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Lets you repeat an animation given number of times or run it indefinitely.
|
|
9
|
+
*
|
|
10
|
+
* @param animation - An animation object you want to repeat.
|
|
11
|
+
* @param numberOfReps - The number of times the animation is going to be repeated. Defaults to 2.
|
|
12
|
+
* @param reverse - Whether the animation should run in reverse every other repetition. Defaults to false.
|
|
13
|
+
* @param callback - A function called on animation complete.
|
|
14
|
+
* @param reduceMotion - Determines how the animation responds to the device's reduced motion accessibility setting. Default to `ReduceMotion.System` - {@link ReduceMotion}.
|
|
15
|
+
* @returns An [animation object](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#animation-object) which holds the current state of the animation.
|
|
16
|
+
* @see https://docs.swmansion.com/react-native-reanimated/docs/animations/withRepeat
|
|
17
|
+
*/
|
|
7
18
|
export const withRepeat = function (_nextAnimation) {
|
|
8
19
|
'worklet';
|
|
9
20
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["defineAnimation","getReduceMotionForAnimation","withRepeat","_nextAnimation","numberOfReps","arguments","length","undefined","reverse","callback","reduceMotion","nextAnimation","repeat","animation","now","finished","onFrame","current","reps","startValue","toValue","onStart","previousAnimation","repCallback","value","isHigherOrder"],"sources":["repeat.ts"],"sourcesContent":["'use strict';\nimport { defineAnimation, getReduceMotionForAnimation } from './util';\nimport type {\n Animation,\n AnimationCallback,\n AnimatableValue,\n Timestamp,\n AnimationObject,\n ReduceMotion,\n} from '../commonTypes';\nimport type { RepeatAnimation } from './commonTypes';\n\n// TODO TYPESCRIPT This is a temporary type to get rid of .d.ts file.\ntype withRepeatType = <T extends AnimatableValue>(\n animation: T,\n numberOfReps?: number,\n reverse?: boolean,\n callback?: AnimationCallback,\n reduceMotion?: ReduceMotion\n) => T;\n\nexport const withRepeat = function <T extends AnimationObject>(\n _nextAnimation: T | (() => T),\n numberOfReps = 2,\n reverse = false,\n callback?: AnimationCallback,\n reduceMotion?: ReduceMotion\n): Animation<RepeatAnimation> {\n 'worklet';\n\n return defineAnimation<RepeatAnimation, T>(\n _nextAnimation,\n (): RepeatAnimation => {\n 'worklet';\n\n const nextAnimation =\n typeof _nextAnimation === 'function'\n ? _nextAnimation()\n : _nextAnimation;\n\n function repeat(animation: RepeatAnimation, now: Timestamp): boolean {\n const finished = nextAnimation.onFrame(nextAnimation, now);\n animation.current = nextAnimation.current;\n if (finished) {\n animation.reps += 1;\n // call inner animation's callback on every repetition\n // as the second argument the animation's current value is passed\n if (nextAnimation.callback) {\n nextAnimation.callback(true /* finished */, animation.current);\n }\n if (\n animation.reduceMotion ||\n (numberOfReps > 0 && animation.reps >= numberOfReps)\n ) {\n return true;\n }\n\n const startValue = reverse\n ? (nextAnimation.current as number)\n : animation.startValue;\n if (reverse) {\n nextAnimation.toValue = animation.startValue;\n animation.startValue = startValue;\n }\n nextAnimation.onStart(\n nextAnimation,\n startValue,\n now,\n nextAnimation.previousAnimation as RepeatAnimation\n );\n return false;\n }\n return false;\n }\n\n const repCallback = (finished?: boolean): void => {\n if (callback) {\n callback(finished);\n }\n // when cancelled call inner animation's callback\n if (!finished && nextAnimation.callback) {\n nextAnimation.callback(false /* finished */);\n }\n };\n\n function onStart(\n animation: RepeatAnimation,\n value: AnimatableValue,\n now: Timestamp,\n previousAnimation: Animation<any> | null\n ): void {\n animation.startValue = value;\n animation.reps = 0;\n\n // child animations inherit the setting, unless they already have it defined\n // they will have it defined only if the user used the `reduceMotion` prop\n if (nextAnimation.reduceMotion === undefined) {\n nextAnimation.reduceMotion = animation.reduceMotion;\n }\n\n // don't start the animation if reduced motion is enabled and\n // the animation would end at its starting point\n if (\n animation.reduceMotion &&\n reverse &&\n (numberOfReps <= 0 || numberOfReps % 2 === 0)\n ) {\n animation.current = animation.startValue;\n animation.onFrame = () => true;\n } else {\n nextAnimation.onStart(nextAnimation, value, now, previousAnimation);\n }\n }\n\n return {\n isHigherOrder: true,\n onFrame: repeat,\n onStart,\n reps: 0,\n current: nextAnimation.current,\n callback: repCallback,\n startValue: 0,\n reduceMotion: getReduceMotionForAnimation(reduceMotion),\n };\n }\n );\n} as withRepeatType;\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,eAAe,EAAEC,2BAA2B,QAAQ,QAAQ;;AAWrE;;AASA,OAAO,MAAMC,UAAU,GAAG,SAAAA,CACxBC,cAA6B,EAKD;EAC5B,SAAS;;EAAC,IALVC,YAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EAAA,IAChBG,OAAO,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,KAAK;EAAA,IACfI,QAA4B,GAAAJ,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAAA,IAC5BG,YAA2B,GAAAL,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAI3B,OAAOP,eAAe,CACpBG,cAAc,EACd,MAAuB;IACrB,SAAS;;IAET,MAAMQ,aAAa,GACjB,OAAOR,cAAc,KAAK,UAAU,GAChCA,cAAc,EAAE,GAChBA,cAAc;IAEpB,SAASS,MAAMA,CAACC,SAA0B,EAAEC,GAAc,EAAW;MACnE,MAAMC,QAAQ,GAAGJ,aAAa,CAACK,OAAO,CAACL,aAAa,EAAEG,GAAG,CAAC;MAC1DD,SAAS,CAACI,OAAO,GAAGN,aAAa,CAACM,OAAO;MACzC,IAAIF,QAAQ,EAAE;QACZF,SAAS,CAACK,IAAI,IAAI,CAAC;QACnB;QACA;QACA,IAAIP,aAAa,CAACF,QAAQ,EAAE;UAC1BE,aAAa,CAACF,QAAQ,CAAC,IAAI,CAAC,gBAAgBI,SAAS,CAACI,OAAO,CAAC;QAChE;QACA,IACEJ,SAAS,CAACH,YAAY,IACrBN,YAAY,GAAG,CAAC,IAAIS,SAAS,CAACK,IAAI,IAAId,YAAa,EACpD;UACA,OAAO,IAAI;QACb;Q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nBT,OAAO,EAAEJ,MAAM;MACfS,OAAO;MACPH,IAAI,EAAE,CAAC;MACPD,OAAO,EAAEN,aAAa,CAACM,OAAO;MAC9BR,QAAQ,EAAEc,WAAW;MACrBJ,UAAU,EAAE,CAAC;MACbT,YAAY,EAAET,2BAA2B,CAACS,YAAY;IACxD,CAAC;EACH,CAAC,CACF;AACH,CAAmB"}
|
|
1
|
+
{"version":3,"names":["defineAnimation","getReduceMotionForAnimation","withRepeat","_nextAnimation","numberOfReps","arguments","length","undefined","reverse","callback","reduceMotion","nextAnimation","repeat","animation","now","finished","onFrame","current","reps","startValue","toValue","onStart","previousAnimation","repCallback","value","isHigherOrder"],"sources":["repeat.ts"],"sourcesContent":["'use strict';\nimport { defineAnimation, getReduceMotionForAnimation } from './util';\nimport type {\n Animation,\n AnimationCallback,\n AnimatableValue,\n Timestamp,\n AnimationObject,\n ReduceMotion,\n} from '../commonTypes';\nimport type { RepeatAnimation } from './commonTypes';\n\n// TODO TYPESCRIPT This is a temporary type to get rid of .d.ts file.\ntype withRepeatType = <T extends AnimatableValue>(\n animation: T,\n numberOfReps?: number,\n reverse?: boolean,\n callback?: AnimationCallback,\n reduceMotion?: ReduceMotion\n) => T;\n\n/**\n * Lets you repeat an animation given number of times or run it indefinitely.\n *\n * @param animation - An animation object you want to repeat.\n * @param numberOfReps - The number of times the animation is going to be repeated. Defaults to 2.\n * @param reverse - Whether the animation should run in reverse every other repetition. Defaults to false.\n * @param callback - A function called on animation complete.\n * @param reduceMotion - Determines how the animation responds to the device's reduced motion accessibility setting. Default to `ReduceMotion.System` - {@link ReduceMotion}.\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/withRepeat\n */\nexport const withRepeat = function <T extends AnimationObject>(\n _nextAnimation: T | (() => T),\n numberOfReps = 2,\n reverse = false,\n callback?: AnimationCallback,\n reduceMotion?: ReduceMotion\n): Animation<RepeatAnimation> {\n 'worklet';\n\n return defineAnimation<RepeatAnimation, T>(\n _nextAnimation,\n (): RepeatAnimation => {\n 'worklet';\n\n const nextAnimation =\n typeof _nextAnimation === 'function'\n ? _nextAnimation()\n : _nextAnimation;\n\n function repeat(animation: RepeatAnimation, now: Timestamp): boolean {\n const finished = nextAnimation.onFrame(nextAnimation, now);\n animation.current = nextAnimation.current;\n if (finished) {\n animation.reps += 1;\n // call inner animation's callback on every repetition\n // as the second argument the animation's current value is passed\n if (nextAnimation.callback) {\n nextAnimation.callback(true /* finished */, animation.current);\n }\n if (\n animation.reduceMotion ||\n (numberOfReps > 0 && animation.reps >= numberOfReps)\n ) {\n return true;\n }\n\n const startValue = reverse\n ? (nextAnimation.current as number)\n : animation.startValue;\n if (reverse) {\n nextAnimation.toValue = animation.startValue;\n animation.startValue = startValue;\n }\n nextAnimation.onStart(\n nextAnimation,\n startValue,\n now,\n nextAnimation.previousAnimation as RepeatAnimation\n );\n return false;\n }\n return false;\n }\n\n const repCallback = (finished?: boolean): void => {\n if (callback) {\n callback(finished);\n }\n // when cancelled call inner animation's callback\n if (!finished && nextAnimation.callback) {\n nextAnimation.callback(false /* finished */);\n }\n };\n\n function onStart(\n animation: RepeatAnimation,\n value: AnimatableValue,\n now: Timestamp,\n previousAnimation: Animation<any> | null\n ): void {\n animation.startValue = value;\n animation.reps = 0;\n\n // child animations inherit the setting, unless they already have it defined\n // they will have it defined only if the user used the `reduceMotion` prop\n if (nextAnimation.reduceMotion === undefined) {\n nextAnimation.reduceMotion = animation.reduceMotion;\n }\n\n // don't start the animation if reduced motion is enabled and\n // the animation would end at its starting point\n if (\n animation.reduceMotion &&\n reverse &&\n (numberOfReps <= 0 || numberOfReps % 2 === 0)\n ) {\n animation.current = animation.startValue;\n animation.onFrame = () => true;\n } else {\n nextAnimation.onStart(nextAnimation, value, now, previousAnimation);\n }\n }\n\n return {\n isHigherOrder: true,\n onFrame: repeat,\n onStart,\n reps: 0,\n current: nextAnimation.current,\n callback: repCallback,\n startValue: 0,\n reduceMotion: getReduceMotionForAnimation(reduceMotion),\n };\n }\n );\n} as withRepeatType;\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,eAAe,EAAEC,2BAA2B,QAAQ,QAAQ;;AAWrE;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,UAAU,GAAG,SAAAA,CACxBC,cAA6B,EAKD;EAC5B,SAAS;;EAAC,IALVC,YAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EAAA,IAChBG,OAAO,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,KAAK;EAAA,IACfI,QAA4B,GAAAJ,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAAA,IAC5BG,YAA2B,GAAAL,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAI3B,OAAOP,eAAe,CACpBG,cAAc,EACd,MAAuB;IACrB,SAAS;;IAET,MAAMQ,aAAa,GACjB,OAAOR,cAAc,KAAK,UAAU,GAChCA,cAAc,EAAE,GAChBA,cAAc;IAEpB,SAASS,MAAMA,CAACC,SAA0B,EAAEC,GAAc,EAAW;MACnE,MAAMC,QAAQ,GAAGJ,aAAa,CAACK,OAAO,CAACL,aAAa,EAAEG,GAAG,CAAC;MAC1DD,SAAS,CAACI,OAAO,GAAGN,aAAa,CAACM,OAAO;MACzC,IAAIF,QAAQ,EAAE;QACZF,SAAS,CAACK,IAAI,IAAI,CAAC;QACnB;QACA;QACA,IAAIP,aAAa,CAACF,QAAQ,EAAE;UAC1BE,aAAa,CAACF,QAAQ,CAAC,IAAI,CAAC,gBAAgBI,SAAS,CAACI,OAAO,CAAC;QAChE;QACA,IACEJ,SAAS,CAACH,YAAY,IACrBN,YAAY,GAAG,CAAC,IAAIS,SAAS,CAACK,IAAI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ACF;IAEA,OAAO;MACLG,aAAa,EAAE,IAAI;MACnBT,OAAO,EAAEJ,MAAM;MACfS,OAAO;MACPH,IAAI,EAAE,CAAC;MACPD,OAAO,EAAEN,aAAa,CAACM,OAAO;MAC9BR,QAAQ,EAAEc,WAAW;MACrBJ,UAAU,EAAE,CAAC;MACbT,YAAY,EAAET,2BAA2B,CAACS,YAAY;IACxD,CAAC;EACH,CAAC,CACF;AACH,CAAmB"}
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
import { defineAnimation, getReduceMotionForAnimation } from './util';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Lets you run animations in a sequence.
|
|
7
|
+
*
|
|
8
|
+
* @param reduceMotion - Determines how the animation responds to the device's reduced motion accessibility setting. Default to `ReduceMotion.System` - {@link ReduceMotion}.
|
|
9
|
+
* @param animations - Any number of animation objects to be run in a sequence.
|
|
10
|
+
* @returns An [animation object](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#animation-object) which holds the current state of the animation/
|
|
11
|
+
* @see https://docs.swmansion.com/react-native-reanimated/docs/animations/withSequence
|
|
12
|
+
*/
|
|
13
|
+
|
|
4
14
|
export function withSequence(_reduceMotionOrFirstAnimation) {
|
|
5
15
|
'worklet';
|
|
6
16
|
|