@tamagui/animations-reanimated 1.0.0-beta.187 → 1.0.0-beta.202

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.
@@ -110,51 +110,53 @@ function createAnimations(animations) {
110
110
  if (key === "transform") {
111
111
  if (!Array.isArray(value)) {
112
112
  console.error(`Invalid transform value. Needs to be an array.`);
113
- } else {
114
- for (const transformObject of value) {
115
- const key2 = Object.keys(transformObject)[0];
116
- const transformValue = transformObject[key2];
117
- const transform = {};
118
- if (((_a = transition == null ? void 0 : transition[key2]) == null ? void 0 : _a.delay) != null) {
119
- delayMs = ((_b = transition == null ? void 0 : transition[key2]) == null ? void 0 : _b.delay) ?? null;
120
- }
121
- let finalValue = animation(transformValue, config, callback);
122
- if (shouldRepeat) {
123
- finalValue = (0, import_react_native_reanimated.withRepeat)(finalValue, repeatCount, repeatReverse);
124
- }
125
- if (delayMs != null) {
126
- transform[key2] = (0, import_react_native_reanimated.withDelay)(delayMs, finalValue);
127
- } else {
128
- transform[key2] = finalValue;
129
- }
130
- if (Object.keys(transform).length) {
131
- final["transform"].push(transform);
132
- }
113
+ continue;
114
+ }
115
+ for (const transformObject of value) {
116
+ const key2 = Object.keys(transformObject)[0];
117
+ const transformValue = transformObject[key2];
118
+ const transform = {};
119
+ if (((_a = transition == null ? void 0 : transition[key2]) == null ? void 0 : _a.delay) != null) {
120
+ delayMs = ((_b = transition == null ? void 0 : transition[key2]) == null ? void 0 : _b.delay) ?? null;
121
+ }
122
+ let finalValue2 = animation(transformValue, config, callback);
123
+ if (shouldRepeat) {
124
+ finalValue2 = (0, import_react_native_reanimated.withRepeat)(finalValue2, repeatCount, repeatReverse);
125
+ }
126
+ if (delayMs != null) {
127
+ transform[key2] = (0, import_react_native_reanimated.withDelay)(delayMs, finalValue2);
128
+ } else {
129
+ transform[key2] = finalValue2;
130
+ }
131
+ if (Object.keys(transform).length) {
132
+ final["transform"].push(transform);
133
133
  }
134
134
  }
135
- } else if (typeof value === "object") {
135
+ continue;
136
+ }
137
+ if (typeof value === "object") {
136
138
  final[key] = {};
137
139
  for (const innerStyleKey of Object.keys(value || {})) {
138
- let finalValue = animation(value, config, callback);
140
+ let finalValue2 = animation(value, config, callback);
139
141
  if (shouldRepeat) {
140
- finalValue = (0, import_react_native_reanimated.withRepeat)(finalValue, repeatCount, repeatReverse);
142
+ finalValue2 = (0, import_react_native_reanimated.withRepeat)(finalValue2, repeatCount, repeatReverse);
141
143
  }
142
144
  if (delayMs != null) {
143
- final[key][innerStyleKey] = (0, import_react_native_reanimated.withDelay)(delayMs, finalValue);
145
+ final[key][innerStyleKey] = (0, import_react_native_reanimated.withDelay)(delayMs, finalValue2);
144
146
  } else {
145
- final[key][innerStyleKey] = finalValue;
147
+ final[key][innerStyleKey] = finalValue2;
146
148
  }
147
149
  }
150
+ continue;
151
+ }
152
+ let finalValue = animation(value, config, callback);
153
+ if (shouldRepeat) {
154
+ finalValue = (0, import_react_native_reanimated.withRepeat)(finalValue, repeatCount, repeatReverse);
155
+ }
156
+ if (delayMs != null && typeof delayMs === "number") {
157
+ final[key] = (0, import_react_native_reanimated.withDelay)(delayMs, finalValue);
148
158
  } else {
149
- let finalValue = animation(value, config, callback);
150
- if (shouldRepeat) {
151
- finalValue = (0, import_react_native_reanimated.withRepeat)(finalValue, repeatCount, repeatReverse);
152
- }
153
- if (delayMs != null && typeof delayMs === "number") {
154
- final[key] = (0, import_react_native_reanimated.withDelay)(delayMs, finalValue);
155
- } else {
156
- final[key] = finalValue;
157
- }
159
+ final[key] = finalValue;
158
160
  }
159
161
  }
160
162
  return final;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/createAnimations.tsx"],
4
- "sourcesContent": ["import { AnimatePresenceContext, usePresence } from '@tamagui/animate-presence'\nimport { AnimationDriver, UseAnimationProps, UseAnimationState } from '@tamagui/core'\nimport { createContext, useCallback, useContext, useEffect } from 'react'\nimport {\n PerpectiveTransform,\n RotateTransform,\n RotateXTransform,\n RotateYTransform,\n RotateZTransform,\n ScaleTransform,\n ScaleXTransform,\n ScaleYTransform,\n SkewXTransform,\n SkewYTransform,\n TranslateXTransform,\n TranslateYTransform,\n} from 'react-native'\nimport Animated, {\n WithDecayConfig,\n WithSpringConfig,\n WithTimingConfig,\n runOnJS,\n useAnimatedStyle,\n useSharedValue,\n withDecay,\n withDelay,\n withRepeat,\n withSpring,\n withTiming,\n} from 'react-native-reanimated'\n\nconst AnimatedView = Animated.View\nconst AnimatedText = Animated.Text\n\nAnimatedView['displayName'] = 'AnimatedView'\nAnimatedText['displayName'] = 'AnimatedText'\n\nexport function createAnimations<A extends Object>(animations: A): AnimationDriver<A> {\n return {\n avoidClasses: true,\n animations,\n View: AnimatedView,\n Text: AnimatedText,\n useAnimations: (props: UseAnimationProps, state: UseAnimationState) => {\n const { style, exitStyle, onDidAnimate, delay } = state\n const [isPresent, safeToUnmount] = usePresence()\n const presence = useContext(AnimatePresenceContext)\n const isMounted = useSharedValue(false)\n const hasExitStyle = !!exitStyle\n const custom = useCallback(() => {\n 'worklet'\n return presence?.custom\n }, [presence])\n\n const reanimatedOnDidAnimated = useCallback<NonNullable<typeof onDidAnimate>>(\n (...args) => {\n onDidAnimate?.(...args)\n },\n [onDidAnimate]\n )\n const reanimatedSafeToUnmount = useCallback(() => {\n safeToUnmount?.()\n }, [safeToUnmount])\n\n useEffect(() => {\n isMounted.value = true\n }, [isMounted])\n\n useEffect(\n function allowUnMountIfMissingExit() {\n if (!isPresent && !hasExitStyle) {\n reanimatedSafeToUnmount()\n }\n },\n [hasExitStyle, isPresent, reanimatedSafeToUnmount]\n )\n\n const animatedStyle = useAnimatedStyle(() => {\n const final = {\n transform: [] as any[],\n }\n\n const isExiting = !isPresent && !!exitStyle\n const transition = animations[props.animation]\n\n const mergedStyles = {\n ...style,\n // ...isExiting && exitStyle(custom()),\n ...(isExiting && exitStyle),\n }\n\n // console.log('wut', style, hoverStyle, pressStyle, isExiting)\n\n const exitingStyleProps: Record<string, boolean> = {}\n if (exitStyle) {\n for (const key of Object.keys(exitStyle)) {\n exitingStyleProps[key] = true\n }\n }\n\n for (const key in mergedStyles) {\n const value = mergedStyles[key]\n const { animation, config, shouldRepeat, repeatCount, repeatReverse } = animationConfig(\n key,\n transition\n )\n\n const callback: (completed: boolean, value?: any) => void = (completed, recentValue) => {\n if (onDidAnimate) {\n runOnJS(reanimatedOnDidAnimated)(key as any, completed, recentValue, {\n attemptedValue: value,\n })\n }\n if (isExiting) {\n exitingStyleProps[key] = false\n const areStylesExiting = Object.values(exitingStyleProps).some(Boolean)\n // if this is true, then we've finished our exit animations\n if (!areStylesExiting) {\n runOnJS(reanimatedSafeToUnmount)()\n }\n }\n }\n\n let { delayMs = null } = animationDelay(key, transition, delay)\n\n if (key === 'transform') {\n if (!Array.isArray(value)) {\n console.error(`Invalid transform value. Needs to be an array.`)\n } else {\n for (const transformObject of value) {\n const key = Object.keys(transformObject)[0]\n const transformValue = transformObject[key]\n const transform = {} as any\n if (transition?.[key]?.delay != null) {\n delayMs = transition?.[key]?.delay ?? null\n }\n let finalValue = animation(transformValue, config, callback)\n if (shouldRepeat) {\n finalValue = withRepeat(finalValue, repeatCount, repeatReverse)\n }\n if (delayMs != null) {\n transform[key] = withDelay(delayMs, finalValue)\n } else {\n transform[key] = finalValue\n }\n if (Object.keys(transform).length) {\n final['transform'].push(transform)\n }\n }\n }\n } else if (typeof value === 'object') {\n // shadows\n final[key] = {}\n for (const innerStyleKey of Object.keys(value || {})) {\n let finalValue = animation(value, config, callback)\n if (shouldRepeat) {\n finalValue = withRepeat(finalValue, repeatCount, repeatReverse)\n }\n if (delayMs != null) {\n final[key][innerStyleKey] = withDelay(delayMs, finalValue)\n } else {\n final[key][innerStyleKey] = finalValue\n }\n }\n } else {\n let finalValue = animation(value, config, callback)\n if (shouldRepeat) {\n finalValue = withRepeat(finalValue, repeatCount, repeatReverse)\n }\n if (delayMs != null && typeof delayMs === 'number') {\n final[key] = withDelay(delayMs, finalValue)\n } else {\n final[key] = finalValue\n }\n }\n\n // end for (key in mergedStyles)\n }\n\n return final\n }, [\n style,\n custom,\n delay,\n // disableInitialAnimation,\n // exitProp,\n // exitTransitionProp,\n // fromProp,\n hasExitStyle,\n isMounted,\n isPresent,\n onDidAnimate,\n reanimatedOnDidAnimated,\n reanimatedSafeToUnmount,\n // state,\n // stylePriority,\n // transitionProp,\n ])\n\n return {\n style: animatedStyle,\n }\n },\n }\n}\n\nfunction animationDelay<Animate>(\n key: string,\n transition: MotiTransition<Animate> | undefined,\n defaultDelay?: number\n) {\n 'worklet'\n let delayMs: TransitionConfig['delay'] = defaultDelay\n\n if (transition[key as keyof Animate]?.delay != null) {\n delayMs = transition[key as keyof Animate]?.delay\n } else if (transition?.delay != null) {\n delayMs = transition.delay\n }\n\n return {\n delayMs,\n }\n}\n\ntype MotiTransition<A> = any\ntype Transforms = PerpectiveTransform &\n RotateTransform &\n RotateXTransform &\n RotateYTransform &\n RotateZTransform &\n ScaleTransform &\n ScaleXTransform &\n ScaleYTransform &\n TranslateXTransform &\n TranslateYTransform &\n SkewXTransform &\n SkewYTransform\ntype TransitionConfigWithoutRepeats = (\n | ({ type?: 'spring' } & WithSpringConfig)\n | ({ type: 'timing' } & WithTimingConfig)\n | ({ type: 'decay' } & WithDecayConfig)\n) & {\n delay?: number\n}\n\ntype TransitionConfig = TransitionConfigWithoutRepeats & {\n /**\n * Number of times this animation should repeat. To make it infinite, use the `loop` boolean.\n *\n * Default: `0`\n *\n * It's worth noting that this value isn't *exactly* a `repeat`. Instead, it uses Reanimated's `withRepeat` function under the hood, which repeats back to the **previous value**. If you want a repeated animation, I recommend setting it to `true` from the start, and make sure you have a `from` value.\n *\n * As a result, this value cannot be reliably changed on the fly. If you would like animations to repeat based on the `from` value, `repeat` must be a number when the component initializes. You can set it to `0` to stop it, but you won't be able to start it again. You might be better off using the sequence array API if you need to update its repetitiveness on the fly.\n */\n repeat?: number\n /**\n * Setting this to `true` is the same as `repeat: Infinity`\n *\n * Default: `false`\n *\n * Note: this value cannot be set on the fly. If you would like animations to repeat based on the `from` value, it must be `true` when the component initializes. You can set it to `false` to stop it, but you won't be able to start it again. You might be better off using the sequence array API if you need to update its repetitiveness on the fly.\n */\n loop?: boolean\n /**\n * Whether or not the animation repetition should alternate in direction.\n *\n * By default, this is `true`.\n *\n * If `false`, any animations with `loop` or `repeat` will not go back and forth. Instead, they will go from 0 -> 1, and again from 0 -> 1.\n *\n * If `true`, then animations will go 0 -> 1 -> 0.\n *\n * Setting this to `true` is like setting `animationDirection: alternate` in CSS.\n */\n repeatReverse?: boolean\n}\n\nconst isColor = (styleKey: string) => {\n 'worklet'\n return [\n 'backgroundColor',\n 'borderBottomColor',\n 'borderColor',\n 'borderEndColor',\n 'borderLeftColor',\n 'borderRightColor',\n 'borderStartColor',\n 'borderTopColor',\n 'color',\n ].includes(styleKey)\n}\n\nfunction animationConfig<Animate>(\n styleProp: string,\n transition: MotiTransition<Animate> | undefined\n) {\n 'worklet'\n const key = styleProp\n let repeatCount = 0\n let repeatReverse = true\n let animationType: Required<TransitionConfig>['type'] = 'spring'\n\n if (isColor(key) || key === 'opacity') {\n animationType = 'timing'\n }\n\n // say that we're looking at `width`\n // first, check if we have transition.width.type\n if (transition[key as keyof Animate]?.type) {\n animationType = (transition as any)[key]?.type\n } else if (transition?.type) {\n // otherwise, fallback to transition.type\n animationType = transition.type\n }\n\n const loop = transition[key as keyof Animate]?.loop ?? transition?.loop\n\n if (loop != null) {\n repeatCount = loop ? -1 : 0\n }\n\n if (transition[key as keyof Animate]?.repeat != null) {\n repeatCount = transition[key as keyof Animate]?.repeat\n } else if (transition?.repeat != null) {\n repeatCount = transition.repeat\n }\n\n if (transition[key as keyof Animate]?.repeatReverse != null) {\n repeatReverse = transition[key as keyof Animate]?.repeatReverse\n } else if (transition?.repeatReverse != null) {\n repeatReverse = transition.repeatReverse\n }\n\n let config = {}\n // so sad, but fix it later :(\n let animation = (...props: any): any => props\n\n if (animationType === 'timing') {\n const duration =\n (transition[key as keyof Animate] as WithTimingConfig)?.duration ??\n (transition as WithTimingConfig)?.duration\n\n const easing =\n (transition[key as keyof Animate] as WithTimingConfig)?.easing ??\n (transition as WithTimingConfig)?.easing\n\n if (easing) {\n config['easing'] = easing\n }\n if (duration != null) {\n config['duration'] = duration\n }\n animation = withTiming\n } else if (animationType === 'spring') {\n animation = withSpring\n config = {} as WithSpringConfig\n configKeys.forEach((configKey) => {\n 'worklet'\n const styleSpecificConfig = transition?.[key]?.[configKey]\n const transitionConfigForKey = transition?.[configKey]\n if (styleSpecificConfig != null) {\n config[configKey] = styleSpecificConfig\n } else if (transitionConfigForKey != null) {\n config[configKey] = transitionConfigForKey\n }\n })\n } else if (animationType === 'decay') {\n animation = withDecay\n config = {\n velocity: 2,\n deceleration: 2,\n }\n const configKeys: (keyof WithDecayConfig)[] = [\n 'clamp',\n 'velocity',\n 'deceleration',\n 'velocityFactor',\n ]\n configKeys.forEach((configKey) => {\n 'worklet'\n // is this necessary ^ don't think so...?\n const styleSpecificConfig = transition?.[key]?.[configKey]\n const transitionConfigForKey = transition?.[configKey]\n\n if (styleSpecificConfig != null) {\n config[configKey] = styleSpecificConfig\n } else if (transitionConfigForKey != null) {\n config[configKey] = transitionConfigForKey\n }\n })\n }\n\n return {\n animation,\n config,\n repeatReverse,\n repeatCount,\n shouldRepeat: !!repeatCount,\n }\n}\n\nconst configKeys: (keyof WithSpringConfig)[] = [\n 'damping',\n 'mass',\n 'overshootClamping',\n 'restDisplacementThreshold',\n 'restSpeedThreshold',\n 'stiffness',\n 'velocity',\n]\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAoD;AAEpD,mBAAkE;AAelE,qCAYO;AAEP,MAAM,eAAe,uCAAS;AAC9B,MAAM,eAAe,uCAAS;AAE9B,aAAa,iBAAiB;AAC9B,aAAa,iBAAiB;AAEvB,0BAA4C,YAAmC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AM;AAC/B,eAAO,aAAa;AAAA,MACtB,WAAW,0BAA0B,MAAM;AACzC,eAAO,aAAa;AAAA,MACtB;AAAA,IACF,CAAC;AAAA,EACH,WAAW,kBAAkB,SAAS;AACpC,gBAAY;AACZ,aAAS;AAAA,MACP,UAAU;AAAA,MACV,cAAc;AAAA,IAChB;AACA,UAAM,cAAwC;AAAA,MAC5C;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AACA,gBAAW,QAAQ,CAAC,cAAc;AA5XtC;AA6XM;AAEA,YAAM,sBAAsB,gDAAa,SAAb,oBAAoB;AAChD,YAAM,yBAAyB,yCAAa;AAE5C,UAAI,uBAAuB,MAAM;AAC/B,eAAO,aAAa;AAAA,MACtB,WAAW,0BAA0B,MAAM;AACzC,eAAO,aAAa;AAAA,MACtB;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc,CAAC,CAAC;AAAA,EAClB;AACF;AA3GS;AA6GT,MAAM,aAAyC;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
4
+ "sourcesContent": ["import { AnimatePresenceContext, usePresence } from '@tamagui/animate-presence'\nimport { AnimationDriver, UseAnimationProps, UseAnimationState } from '@tamagui/core'\nimport { createContext, useCallback, useContext, useEffect } from 'react'\nimport {\n PerpectiveTransform,\n RotateTransform,\n RotateXTransform,\n RotateYTransform,\n RotateZTransform,\n ScaleTransform,\n ScaleXTransform,\n ScaleYTransform,\n SkewXTransform,\n SkewYTransform,\n TranslateXTransform,\n TranslateYTransform,\n} from 'react-native'\nimport Animated, {\n WithDecayConfig,\n WithSpringConfig,\n WithTimingConfig,\n runOnJS,\n useAnimatedStyle,\n useSharedValue,\n withDecay,\n withDelay,\n withRepeat,\n withSpring,\n withTiming,\n} from 'react-native-reanimated'\n\nconst AnimatedView = Animated.View\nconst AnimatedText = Animated.Text\n\nAnimatedView['displayName'] = 'AnimatedView'\nAnimatedText['displayName'] = 'AnimatedText'\n\nexport function createAnimations<A extends Object>(animations: A): AnimationDriver<A> {\n return {\n avoidClasses: true,\n animations,\n View: AnimatedView,\n Text: AnimatedText,\n useAnimations: (props: UseAnimationProps, state: UseAnimationState) => {\n const { style, exitStyle, onDidAnimate, delay } = state\n const [isPresent, safeToUnmount] = usePresence()\n const presence = useContext(AnimatePresenceContext)\n const isMounted = useSharedValue(false)\n const hasExitStyle = !!exitStyle\n const custom = useCallback(() => {\n 'worklet'\n return presence?.custom\n }, [presence])\n\n const reanimatedOnDidAnimated = useCallback<NonNullable<typeof onDidAnimate>>(\n (...args) => {\n onDidAnimate?.(...args)\n },\n [onDidAnimate]\n )\n const reanimatedSafeToUnmount = useCallback(() => {\n safeToUnmount?.()\n }, [safeToUnmount])\n\n useEffect(() => {\n isMounted.value = true\n }, [isMounted])\n\n useEffect(\n function allowUnMountIfMissingExit() {\n if (!isPresent && !hasExitStyle) {\n reanimatedSafeToUnmount()\n }\n },\n [hasExitStyle, isPresent, reanimatedSafeToUnmount]\n )\n\n const animatedStyle = useAnimatedStyle(() => {\n const final = {\n transform: [] as any[],\n }\n\n const isExiting = !isPresent && !!exitStyle\n const transition = animations[props.animation]\n\n const mergedStyles = {\n ...style,\n ...(isExiting && exitStyle),\n }\n\n const exitingStyleProps: Record<string, boolean> = {}\n if (exitStyle) {\n for (const key of Object.keys(exitStyle)) {\n exitingStyleProps[key] = true\n }\n }\n\n for (const key in mergedStyles) {\n const value = mergedStyles[key]\n const { animation, config, shouldRepeat, repeatCount, repeatReverse } = animationConfig(\n key,\n transition\n )\n\n const callback: (completed: boolean, value?: any) => void = (completed, recentValue) => {\n if (onDidAnimate) {\n runOnJS(reanimatedOnDidAnimated)(key as any, completed, recentValue, {\n attemptedValue: value,\n })\n }\n if (isExiting) {\n exitingStyleProps[key] = false\n const areStylesExiting = Object.values(exitingStyleProps).some(Boolean)\n // if this is true, then we've finished our exit animations\n if (!areStylesExiting) {\n runOnJS(reanimatedSafeToUnmount)()\n }\n }\n }\n\n let { delayMs = null } = animationDelay(key, transition, delay)\n\n if (key === 'transform') {\n if (!Array.isArray(value)) {\n console.error(`Invalid transform value. Needs to be an array.`)\n continue\n }\n\n for (const transformObject of value) {\n const key = Object.keys(transformObject)[0]\n const transformValue = transformObject[key]\n const transform = {} as any\n if (transition?.[key]?.delay != null) {\n delayMs = transition?.[key]?.delay ?? null\n }\n let finalValue = animation(transformValue, config, callback)\n if (shouldRepeat) {\n finalValue = withRepeat(finalValue, repeatCount, repeatReverse)\n }\n if (delayMs != null) {\n transform[key] = withDelay(delayMs, finalValue)\n } else {\n transform[key] = finalValue\n }\n if (Object.keys(transform).length) {\n final['transform'].push(transform)\n }\n }\n continue\n }\n\n if (typeof value === 'object') {\n // shadows\n final[key] = {}\n for (const innerStyleKey of Object.keys(value || {})) {\n let finalValue = animation(value, config, callback)\n if (shouldRepeat) {\n finalValue = withRepeat(finalValue, repeatCount, repeatReverse)\n }\n if (delayMs != null) {\n final[key][innerStyleKey] = withDelay(delayMs, finalValue)\n } else {\n final[key][innerStyleKey] = finalValue\n }\n }\n continue\n }\n\n let finalValue = animation(value, config, callback)\n if (shouldRepeat) {\n finalValue = withRepeat(finalValue, repeatCount, repeatReverse)\n }\n if (delayMs != null && typeof delayMs === 'number') {\n final[key] = withDelay(delayMs, finalValue)\n } else {\n final[key] = finalValue\n }\n\n // end for (key in mergedStyles)\n }\n\n return final\n }, [\n style,\n custom,\n delay,\n // disableInitialAnimation,\n // exitProp,\n // exitTransitionProp,\n // fromProp,\n hasExitStyle,\n isMounted,\n isPresent,\n onDidAnimate,\n reanimatedOnDidAnimated,\n reanimatedSafeToUnmount,\n // state,\n // stylePriority,\n // transitionProp,\n ])\n\n return {\n style: animatedStyle,\n }\n },\n }\n}\n\nfunction animationDelay<Animate>(\n key: string,\n transition: MotiTransition<Animate> | undefined,\n defaultDelay?: number\n) {\n 'worklet'\n let delayMs: TransitionConfig['delay'] = defaultDelay\n\n if (transition[key as keyof Animate]?.delay != null) {\n delayMs = transition[key as keyof Animate]?.delay\n } else if (transition?.delay != null) {\n delayMs = transition.delay\n }\n\n return {\n delayMs,\n }\n}\n\ntype MotiTransition<A> = any\ntype Transforms = PerpectiveTransform &\n RotateTransform &\n RotateXTransform &\n RotateYTransform &\n RotateZTransform &\n ScaleTransform &\n ScaleXTransform &\n ScaleYTransform &\n TranslateXTransform &\n TranslateYTransform &\n SkewXTransform &\n SkewYTransform\ntype TransitionConfigWithoutRepeats = (\n | ({ type?: 'spring' } & WithSpringConfig)\n | ({ type: 'timing' } & WithTimingConfig)\n | ({ type: 'decay' } & WithDecayConfig)\n) & {\n delay?: number\n}\n\ntype TransitionConfig = TransitionConfigWithoutRepeats & {\n /**\n * Number of times this animation should repeat. To make it infinite, use the `loop` boolean.\n *\n * Default: `0`\n *\n * It's worth noting that this value isn't *exactly* a `repeat`. Instead, it uses Reanimated's `withRepeat` function under the hood, which repeats back to the **previous value**. If you want a repeated animation, I recommend setting it to `true` from the start, and make sure you have a `from` value.\n *\n * As a result, this value cannot be reliably changed on the fly. If you would like animations to repeat based on the `from` value, `repeat` must be a number when the component initializes. You can set it to `0` to stop it, but you won't be able to start it again. You might be better off using the sequence array API if you need to update its repetitiveness on the fly.\n */\n repeat?: number\n /**\n * Setting this to `true` is the same as `repeat: Infinity`\n *\n * Default: `false`\n *\n * Note: this value cannot be set on the fly. If you would like animations to repeat based on the `from` value, it must be `true` when the component initializes. You can set it to `false` to stop it, but you won't be able to start it again. You might be better off using the sequence array API if you need to update its repetitiveness on the fly.\n */\n loop?: boolean\n /**\n * Whether or not the animation repetition should alternate in direction.\n *\n * By default, this is `true`.\n *\n * If `false`, any animations with `loop` or `repeat` will not go back and forth. Instead, they will go from 0 -> 1, and again from 0 -> 1.\n *\n * If `true`, then animations will go 0 -> 1 -> 0.\n *\n * Setting this to `true` is like setting `animationDirection: alternate` in CSS.\n */\n repeatReverse?: boolean\n}\n\nconst isColor = (styleKey: string) => {\n 'worklet'\n return [\n 'backgroundColor',\n 'borderBottomColor',\n 'borderColor',\n 'borderEndColor',\n 'borderLeftColor',\n 'borderRightColor',\n 'borderStartColor',\n 'borderTopColor',\n 'color',\n ].includes(styleKey)\n}\n\nfunction animationConfig<Animate>(\n styleProp: string,\n transition: MotiTransition<Animate> | undefined\n) {\n 'worklet'\n const key = styleProp\n let repeatCount = 0\n let repeatReverse = true\n let animationType: Required<TransitionConfig>['type'] = 'spring'\n\n if (isColor(key) || key === 'opacity') {\n animationType = 'timing'\n }\n\n // say that we're looking at `width`\n // first, check if we have transition.width.type\n if (transition[key as keyof Animate]?.type) {\n animationType = (transition as any)[key]?.type\n } else if (transition?.type) {\n // otherwise, fallback to transition.type\n animationType = transition.type\n }\n\n const loop = transition[key as keyof Animate]?.loop ?? transition?.loop\n\n if (loop != null) {\n repeatCount = loop ? -1 : 0\n }\n\n if (transition[key as keyof Animate]?.repeat != null) {\n repeatCount = transition[key as keyof Animate]?.repeat\n } else if (transition?.repeat != null) {\n repeatCount = transition.repeat\n }\n\n if (transition[key as keyof Animate]?.repeatReverse != null) {\n repeatReverse = transition[key as keyof Animate]?.repeatReverse\n } else if (transition?.repeatReverse != null) {\n repeatReverse = transition.repeatReverse\n }\n\n let config = {}\n // so sad, but fix it later :(\n let animation = (...props: any): any => props\n\n if (animationType === 'timing') {\n const duration =\n (transition[key as keyof Animate] as WithTimingConfig)?.duration ??\n (transition as WithTimingConfig)?.duration\n\n const easing =\n (transition[key as keyof Animate] as WithTimingConfig)?.easing ??\n (transition as WithTimingConfig)?.easing\n\n if (easing) {\n config['easing'] = easing\n }\n if (duration != null) {\n config['duration'] = duration\n }\n animation = withTiming\n } else if (animationType === 'spring') {\n animation = withSpring\n config = {} as WithSpringConfig\n configKeys.forEach((configKey) => {\n 'worklet'\n const styleSpecificConfig = transition?.[key]?.[configKey]\n const transitionConfigForKey = transition?.[configKey]\n if (styleSpecificConfig != null) {\n config[configKey] = styleSpecificConfig\n } else if (transitionConfigForKey != null) {\n config[configKey] = transitionConfigForKey\n }\n })\n } else if (animationType === 'decay') {\n animation = withDecay\n config = {\n velocity: 2,\n deceleration: 2,\n }\n const configKeys: (keyof WithDecayConfig)[] = [\n 'clamp',\n 'velocity',\n 'deceleration',\n 'velocityFactor',\n ]\n configKeys.forEach((configKey) => {\n 'worklet'\n // is this necessary ^ don't think so...?\n const styleSpecificConfig = transition?.[key]?.[configKey]\n const transitionConfigForKey = transition?.[configKey]\n\n if (styleSpecificConfig != null) {\n config[configKey] = styleSpecificConfig\n } else if (transitionConfigForKey != null) {\n config[configKey] = transitionConfigForKey\n }\n })\n }\n\n return {\n animation,\n config,\n repeatReverse,\n repeatCount,\n shouldRepeat: !!repeatCount,\n }\n}\n\nconst configKeys: (keyof WithSpringConfig)[] = [\n 'damping',\n 'mass',\n 'overshootClamping',\n 'restDisplacementThreshold',\n 'restSpeedThreshold',\n 'stiffness',\n 'velocity',\n]\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAoD;AAEpD,mBAAkE;AAelE,qCAYO;AAEP,MAAM,eAAe,uCAAS;AAC9B,MAAM,eAAe,uCAAS;AAE9B,aAAa,iBAAiB;AAC9B,aAAa,iBAAiB;AAEvB,0BAA4C,YAAmC;AACpF,SAAO;AAAA,IACL,cAAc;AAAA,IACd;AAAA,IACA,MAAM;AAAA,IACN,MAAM;AAAA,IACN,eAAe,CAAC,OAA0B,UAA6B;AACrE,YAAM,EAAE,OAAO,WAAW,cAAc,UAAU;AAClD,YAAM,CAAC,WAAW,iBAAiB,yCAAY;AAC/C,YAAM,WAAW,6BAAW,8CAAsB;AAClD,YAAM,YAAY,mDAAe,KAAK;AACtC,YAAM,eAAe,CAAC,CAAC;AACvB,YAAM,SAAS,8BAAY,MAAM;AAC/B;AACA,eAAO,qCAAU;AAAA,MACnB,GAAG,CAAC,QA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;AAE5C,UAAI,uBAAuB,MAAM;AAC/B,eAAO,aAAa;AAAA,MACtB,WAAW,0BAA0B,MAAM;AACzC,eAAO,aAAa;AAAA,MACtB;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc,CAAC,CAAC;AAAA,EAClB;AACF;AA3GS;AA6GT,MAAM,aAAyC;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
6
6
  "names": []
7
7
  }
@@ -84,51 +84,53 @@ function createAnimations(animations) {
84
84
  if (key === "transform") {
85
85
  if (!Array.isArray(value)) {
86
86
  console.error(`Invalid transform value. Needs to be an array.`);
87
- } else {
88
- for (const transformObject of value) {
89
- const key2 = Object.keys(transformObject)[0];
90
- const transformValue = transformObject[key2];
91
- const transform = {};
92
- if (((_a = transition == null ? void 0 : transition[key2]) == null ? void 0 : _a.delay) != null) {
93
- delayMs = (_c = (_b = transition == null ? void 0 : transition[key2]) == null ? void 0 : _b.delay) != null ? _c : null;
94
- }
95
- let finalValue = animation(transformValue, config, callback);
96
- if (shouldRepeat) {
97
- finalValue = withRepeat(finalValue, repeatCount, repeatReverse);
98
- }
99
- if (delayMs != null) {
100
- transform[key2] = withDelay(delayMs, finalValue);
101
- } else {
102
- transform[key2] = finalValue;
103
- }
104
- if (Object.keys(transform).length) {
105
- final["transform"].push(transform);
106
- }
87
+ continue;
88
+ }
89
+ for (const transformObject of value) {
90
+ const key2 = Object.keys(transformObject)[0];
91
+ const transformValue = transformObject[key2];
92
+ const transform = {};
93
+ if (((_a = transition == null ? void 0 : transition[key2]) == null ? void 0 : _a.delay) != null) {
94
+ delayMs = (_c = (_b = transition == null ? void 0 : transition[key2]) == null ? void 0 : _b.delay) != null ? _c : null;
95
+ }
96
+ let finalValue2 = animation(transformValue, config, callback);
97
+ if (shouldRepeat) {
98
+ finalValue2 = withRepeat(finalValue2, repeatCount, repeatReverse);
99
+ }
100
+ if (delayMs != null) {
101
+ transform[key2] = withDelay(delayMs, finalValue2);
102
+ } else {
103
+ transform[key2] = finalValue2;
104
+ }
105
+ if (Object.keys(transform).length) {
106
+ final["transform"].push(transform);
107
107
  }
108
108
  }
109
- } else if (typeof value === "object") {
109
+ continue;
110
+ }
111
+ if (typeof value === "object") {
110
112
  final[key] = {};
111
113
  for (const innerStyleKey of Object.keys(value || {})) {
112
- let finalValue = animation(value, config, callback);
114
+ let finalValue2 = animation(value, config, callback);
113
115
  if (shouldRepeat) {
114
- finalValue = withRepeat(finalValue, repeatCount, repeatReverse);
116
+ finalValue2 = withRepeat(finalValue2, repeatCount, repeatReverse);
115
117
  }
116
118
  if (delayMs != null) {
117
- final[key][innerStyleKey] = withDelay(delayMs, finalValue);
119
+ final[key][innerStyleKey] = withDelay(delayMs, finalValue2);
118
120
  } else {
119
- final[key][innerStyleKey] = finalValue;
121
+ final[key][innerStyleKey] = finalValue2;
120
122
  }
121
123
  }
124
+ continue;
125
+ }
126
+ let finalValue = animation(value, config, callback);
127
+ if (shouldRepeat) {
128
+ finalValue = withRepeat(finalValue, repeatCount, repeatReverse);
129
+ }
130
+ if (delayMs != null && typeof delayMs === "number") {
131
+ final[key] = withDelay(delayMs, finalValue);
122
132
  } else {
123
- let finalValue = animation(value, config, callback);
124
- if (shouldRepeat) {
125
- finalValue = withRepeat(finalValue, repeatCount, repeatReverse);
126
- }
127
- if (delayMs != null && typeof delayMs === "number") {
128
- final[key] = withDelay(delayMs, finalValue);
129
- } else {
130
- final[key] = finalValue;
131
- }
133
+ final[key] = finalValue;
132
134
  }
133
135
  }
134
136
  return final;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/createAnimations.tsx"],
4
- "sourcesContent": ["import { AnimatePresenceContext, usePresence } from '@tamagui/animate-presence'\nimport { AnimationDriver, UseAnimationProps, UseAnimationState } from '@tamagui/core'\nimport { createContext, useCallback, useContext, useEffect } from 'react'\nimport {\n PerpectiveTransform,\n RotateTransform,\n RotateXTransform,\n RotateYTransform,\n RotateZTransform,\n ScaleTransform,\n ScaleXTransform,\n ScaleYTransform,\n SkewXTransform,\n SkewYTransform,\n TranslateXTransform,\n TranslateYTransform,\n} from 'react-native'\nimport Animated, {\n WithDecayConfig,\n WithSpringConfig,\n WithTimingConfig,\n runOnJS,\n useAnimatedStyle,\n useSharedValue,\n withDecay,\n withDelay,\n withRepeat,\n withSpring,\n withTiming,\n} from 'react-native-reanimated'\n\nconst AnimatedView = Animated.View\nconst AnimatedText = Animated.Text\n\nAnimatedView['displayName'] = 'AnimatedView'\nAnimatedText['displayName'] = 'AnimatedText'\n\nexport function createAnimations<A extends Object>(animations: A): AnimationDriver<A> {\n return {\n avoidClasses: true,\n animations,\n View: AnimatedView,\n Text: AnimatedText,\n useAnimations: (props: UseAnimationProps, state: UseAnimationState) => {\n const { style, exitStyle, onDidAnimate, delay } = state\n const [isPresent, safeToUnmount] = usePresence()\n const presence = useContext(AnimatePresenceContext)\n const isMounted = useSharedValue(false)\n const hasExitStyle = !!exitStyle\n const custom = useCallback(() => {\n 'worklet'\n return presence?.custom\n }, [presence])\n\n const reanimatedOnDidAnimated = useCallback<NonNullable<typeof onDidAnimate>>(\n (...args) => {\n onDidAnimate?.(...args)\n },\n [onDidAnimate]\n )\n const reanimatedSafeToUnmount = useCallback(() => {\n safeToUnmount?.()\n }, [safeToUnmount])\n\n useEffect(() => {\n isMounted.value = true\n }, [isMounted])\n\n useEffect(\n function allowUnMountIfMissingExit() {\n if (!isPresent && !hasExitStyle) {\n reanimatedSafeToUnmount()\n }\n },\n [hasExitStyle, isPresent, reanimatedSafeToUnmount]\n )\n\n const animatedStyle = useAnimatedStyle(() => {\n const final = {\n transform: [] as any[],\n }\n\n const isExiting = !isPresent && !!exitStyle\n const transition = animations[props.animation]\n\n const mergedStyles = {\n ...style,\n // ...isExiting && exitStyle(custom()),\n ...(isExiting && exitStyle),\n }\n\n // console.log('wut', style, hoverStyle, pressStyle, isExiting)\n\n const exitingStyleProps: Record<string, boolean> = {}\n if (exitStyle) {\n for (const key of Object.keys(exitStyle)) {\n exitingStyleProps[key] = true\n }\n }\n\n for (const key in mergedStyles) {\n const value = mergedStyles[key]\n const { animation, config, shouldRepeat, repeatCount, repeatReverse } = animationConfig(\n key,\n transition\n )\n\n const callback: (completed: boolean, value?: any) => void = (completed, recentValue) => {\n if (onDidAnimate) {\n runOnJS(reanimatedOnDidAnimated)(key as any, completed, recentValue, {\n attemptedValue: value,\n })\n }\n if (isExiting) {\n exitingStyleProps[key] = false\n const areStylesExiting = Object.values(exitingStyleProps).some(Boolean)\n // if this is true, then we've finished our exit animations\n if (!areStylesExiting) {\n runOnJS(reanimatedSafeToUnmount)()\n }\n }\n }\n\n let { delayMs = null } = animationDelay(key, transition, delay)\n\n if (key === 'transform') {\n if (!Array.isArray(value)) {\n console.error(`Invalid transform value. Needs to be an array.`)\n } else {\n for (const transformObject of value) {\n const key = Object.keys(transformObject)[0]\n const transformValue = transformObject[key]\n const transform = {} as any\n if (transition?.[key]?.delay != null) {\n delayMs = transition?.[key]?.delay ?? null\n }\n let finalValue = animation(transformValue, config, callback)\n if (shouldRepeat) {\n finalValue = withRepeat(finalValue, repeatCount, repeatReverse)\n }\n if (delayMs != null) {\n transform[key] = withDelay(delayMs, finalValue)\n } else {\n transform[key] = finalValue\n }\n if (Object.keys(transform).length) {\n final['transform'].push(transform)\n }\n }\n }\n } else if (typeof value === 'object') {\n // shadows\n final[key] = {}\n for (const innerStyleKey of Object.keys(value || {})) {\n let finalValue = animation(value, config, callback)\n if (shouldRepeat) {\n finalValue = withRepeat(finalValue, repeatCount, repeatReverse)\n }\n if (delayMs != null) {\n final[key][innerStyleKey] = withDelay(delayMs, finalValue)\n } else {\n final[key][innerStyleKey] = finalValue\n }\n }\n } else {\n let finalValue = animation(value, config, callback)\n if (shouldRepeat) {\n finalValue = withRepeat(finalValue, repeatCount, repeatReverse)\n }\n if (delayMs != null && typeof delayMs === 'number') {\n final[key] = withDelay(delayMs, finalValue)\n } else {\n final[key] = finalValue\n }\n }\n\n // end for (key in mergedStyles)\n }\n\n return final\n }, [\n style,\n custom,\n delay,\n // disableInitialAnimation,\n // exitProp,\n // exitTransitionProp,\n // fromProp,\n hasExitStyle,\n isMounted,\n isPresent,\n onDidAnimate,\n reanimatedOnDidAnimated,\n reanimatedSafeToUnmount,\n // state,\n // stylePriority,\n // transitionProp,\n ])\n\n return {\n style: animatedStyle,\n }\n },\n }\n}\n\nfunction animationDelay<Animate>(\n key: string,\n transition: MotiTransition<Animate> | undefined,\n defaultDelay?: number\n) {\n 'worklet'\n let delayMs: TransitionConfig['delay'] = defaultDelay\n\n if (transition[key as keyof Animate]?.delay != null) {\n delayMs = transition[key as keyof Animate]?.delay\n } else if (transition?.delay != null) {\n delayMs = transition.delay\n }\n\n return {\n delayMs,\n }\n}\n\ntype MotiTransition<A> = any\ntype Transforms = PerpectiveTransform &\n RotateTransform &\n RotateXTransform &\n RotateYTransform &\n RotateZTransform &\n ScaleTransform &\n ScaleXTransform &\n ScaleYTransform &\n TranslateXTransform &\n TranslateYTransform &\n SkewXTransform &\n SkewYTransform\ntype TransitionConfigWithoutRepeats = (\n | ({ type?: 'spring' } & WithSpringConfig)\n | ({ type: 'timing' } & WithTimingConfig)\n | ({ type: 'decay' } & WithDecayConfig)\n) & {\n delay?: number\n}\n\ntype TransitionConfig = TransitionConfigWithoutRepeats & {\n /**\n * Number of times this animation should repeat. To make it infinite, use the `loop` boolean.\n *\n * Default: `0`\n *\n * It's worth noting that this value isn't *exactly* a `repeat`. Instead, it uses Reanimated's `withRepeat` function under the hood, which repeats back to the **previous value**. If you want a repeated animation, I recommend setting it to `true` from the start, and make sure you have a `from` value.\n *\n * As a result, this value cannot be reliably changed on the fly. If you would like animations to repeat based on the `from` value, `repeat` must be a number when the component initializes. You can set it to `0` to stop it, but you won't be able to start it again. You might be better off using the sequence array API if you need to update its repetitiveness on the fly.\n */\n repeat?: number\n /**\n * Setting this to `true` is the same as `repeat: Infinity`\n *\n * Default: `false`\n *\n * Note: this value cannot be set on the fly. If you would like animations to repeat based on the `from` value, it must be `true` when the component initializes. You can set it to `false` to stop it, but you won't be able to start it again. You might be better off using the sequence array API if you need to update its repetitiveness on the fly.\n */\n loop?: boolean\n /**\n * Whether or not the animation repetition should alternate in direction.\n *\n * By default, this is `true`.\n *\n * If `false`, any animations with `loop` or `repeat` will not go back and forth. Instead, they will go from 0 -> 1, and again from 0 -> 1.\n *\n * If `true`, then animations will go 0 -> 1 -> 0.\n *\n * Setting this to `true` is like setting `animationDirection: alternate` in CSS.\n */\n repeatReverse?: boolean\n}\n\nconst isColor = (styleKey: string) => {\n 'worklet'\n return [\n 'backgroundColor',\n 'borderBottomColor',\n 'borderColor',\n 'borderEndColor',\n 'borderLeftColor',\n 'borderRightColor',\n 'borderStartColor',\n 'borderTopColor',\n 'color',\n ].includes(styleKey)\n}\n\nfunction animationConfig<Animate>(\n styleProp: string,\n transition: MotiTransition<Animate> | undefined\n) {\n 'worklet'\n const key = styleProp\n let repeatCount = 0\n let repeatReverse = true\n let animationType: Required<TransitionConfig>['type'] = 'spring'\n\n if (isColor(key) || key === 'opacity') {\n animationType = 'timing'\n }\n\n // say that we're looking at `width`\n // first, check if we have transition.width.type\n if (transition[key as keyof Animate]?.type) {\n animationType = (transition as any)[key]?.type\n } else if (transition?.type) {\n // otherwise, fallback to transition.type\n animationType = transition.type\n }\n\n const loop = transition[key as keyof Animate]?.loop ?? transition?.loop\n\n if (loop != null) {\n repeatCount = loop ? -1 : 0\n }\n\n if (transition[key as keyof Animate]?.repeat != null) {\n repeatCount = transition[key as keyof Animate]?.repeat\n } else if (transition?.repeat != null) {\n repeatCount = transition.repeat\n }\n\n if (transition[key as keyof Animate]?.repeatReverse != null) {\n repeatReverse = transition[key as keyof Animate]?.repeatReverse\n } else if (transition?.repeatReverse != null) {\n repeatReverse = transition.repeatReverse\n }\n\n let config = {}\n // so sad, but fix it later :(\n let animation = (...props: any): any => props\n\n if (animationType === 'timing') {\n const duration =\n (transition[key as keyof Animate] as WithTimingConfig)?.duration ??\n (transition as WithTimingConfig)?.duration\n\n const easing =\n (transition[key as keyof Animate] as WithTimingConfig)?.easing ??\n (transition as WithTimingConfig)?.easing\n\n if (easing) {\n config['easing'] = easing\n }\n if (duration != null) {\n config['duration'] = duration\n }\n animation = withTiming\n } else if (animationType === 'spring') {\n animation = withSpring\n config = {} as WithSpringConfig\n configKeys.forEach((configKey) => {\n 'worklet'\n const styleSpecificConfig = transition?.[key]?.[configKey]\n const transitionConfigForKey = transition?.[configKey]\n if (styleSpecificConfig != null) {\n config[configKey] = styleSpecificConfig\n } else if (transitionConfigForKey != null) {\n config[configKey] = transitionConfigForKey\n }\n })\n } else if (animationType === 'decay') {\n animation = withDecay\n config = {\n velocity: 2,\n deceleration: 2,\n }\n const configKeys: (keyof WithDecayConfig)[] = [\n 'clamp',\n 'velocity',\n 'deceleration',\n 'velocityFactor',\n ]\n configKeys.forEach((configKey) => {\n 'worklet'\n // is this necessary ^ don't think so...?\n const styleSpecificConfig = transition?.[key]?.[configKey]\n const transitionConfigForKey = transition?.[configKey]\n\n if (styleSpecificConfig != null) {\n config[configKey] = styleSpecificConfig\n } else if (transitionConfigForKey != null) {\n config[configKey] = transitionConfigForKey\n }\n })\n }\n\n return {\n animation,\n config,\n repeatReverse,\n repeatCount,\n shouldRepeat: !!repeatCount,\n }\n}\n\nconst configKeys: (keyof WithSpringConfig)[] = [\n 'damping',\n 'mass',\n 'overshootClamping',\n 'restDisplacementThreshold',\n 'restSpeedThreshold',\n 'stiffness',\n 'velocity',\n]\n"],
5
- "mappings": ";;AAAA;AAEA;AAeA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcA,MAAM,eAAe,SAAS;AAC9B,MAAM,eAAe,SAAS;AAE9B,aAAa,iBAAiB;AAC9B,aAAa,iBAAiB;AAEvB,0BAA4C,YAAm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AyB,yCAAa;AAC5C,UAAI,uBAAuB,MAAM;AAC/B,eAAO,aAAa;AAAA,MACtB,WAAW,0BAA0B,MAAM;AACzC,eAAO,aAAa;AAAA,MACtB;AAAA,IACF,CAAC;AAAA,EACH,WAAW,kBAAkB,SAAS;AACpC,gBAAY;AACZ,aAAS;AAAA,MACP,UAAU;AAAA,MACV,cAAc;AAAA,IAChB;AACA,UAAM,cAAwC;AAAA,MAC5C;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AACA,gBAAW,QAAQ,CAAC,cAAc;AA5XtC;AA6XM;AAEA,YAAM,sBAAsB,gDAAa,SAAb,oBAAoB;AAChD,YAAM,yBAAyB,yCAAa;AAE5C,UAAI,uBAAuB,MAAM;AAC/B,eAAO,aAAa;AAAA,MACtB,WAAW,0BAA0B,MAAM;AACzC,eAAO,aAAa;AAAA,MACtB;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc,CAAC,CAAC;AAAA,EAClB;AACF;AA3GS;AA6GT,MAAM,aAAyC;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
4
+ "sourcesContent": ["import { AnimatePresenceContext, usePresence } from '@tamagui/animate-presence'\nimport { AnimationDriver, UseAnimationProps, UseAnimationState } from '@tamagui/core'\nimport { createContext, useCallback, useContext, useEffect } from 'react'\nimport {\n PerpectiveTransform,\n RotateTransform,\n RotateXTransform,\n RotateYTransform,\n RotateZTransform,\n ScaleTransform,\n ScaleXTransform,\n ScaleYTransform,\n SkewXTransform,\n SkewYTransform,\n TranslateXTransform,\n TranslateYTransform,\n} from 'react-native'\nimport Animated, {\n WithDecayConfig,\n WithSpringConfig,\n WithTimingConfig,\n runOnJS,\n useAnimatedStyle,\n useSharedValue,\n withDecay,\n withDelay,\n withRepeat,\n withSpring,\n withTiming,\n} from 'react-native-reanimated'\n\nconst AnimatedView = Animated.View\nconst AnimatedText = Animated.Text\n\nAnimatedView['displayName'] = 'AnimatedView'\nAnimatedText['displayName'] = 'AnimatedText'\n\nexport function createAnimations<A extends Object>(animations: A): AnimationDriver<A> {\n return {\n avoidClasses: true,\n animations,\n View: AnimatedView,\n Text: AnimatedText,\n useAnimations: (props: UseAnimationProps, state: UseAnimationState) => {\n const { style, exitStyle, onDidAnimate, delay } = state\n const [isPresent, safeToUnmount] = usePresence()\n const presence = useContext(AnimatePresenceContext)\n const isMounted = useSharedValue(false)\n const hasExitStyle = !!exitStyle\n const custom = useCallback(() => {\n 'worklet'\n return presence?.custom\n }, [presence])\n\n const reanimatedOnDidAnimated = useCallback<NonNullable<typeof onDidAnimate>>(\n (...args) => {\n onDidAnimate?.(...args)\n },\n [onDidAnimate]\n )\n const reanimatedSafeToUnmount = useCallback(() => {\n safeToUnmount?.()\n }, [safeToUnmount])\n\n useEffect(() => {\n isMounted.value = true\n }, [isMounted])\n\n useEffect(\n function allowUnMountIfMissingExit() {\n if (!isPresent && !hasExitStyle) {\n reanimatedSafeToUnmount()\n }\n },\n [hasExitStyle, isPresent, reanimatedSafeToUnmount]\n )\n\n const animatedStyle = useAnimatedStyle(() => {\n const final = {\n transform: [] as any[],\n }\n\n const isExiting = !isPresent && !!exitStyle\n const transition = animations[props.animation]\n\n const mergedStyles = {\n ...style,\n ...(isExiting && exitStyle),\n }\n\n const exitingStyleProps: Record<string, boolean> = {}\n if (exitStyle) {\n for (const key of Object.keys(exitStyle)) {\n exitingStyleProps[key] = true\n }\n }\n\n for (const key in mergedStyles) {\n const value = mergedStyles[key]\n const { animation, config, shouldRepeat, repeatCount, repeatReverse } = animationConfig(\n key,\n transition\n )\n\n const callback: (completed: boolean, value?: any) => void = (completed, recentValue) => {\n if (onDidAnimate) {\n runOnJS(reanimatedOnDidAnimated)(key as any, completed, recentValue, {\n attemptedValue: value,\n })\n }\n if (isExiting) {\n exitingStyleProps[key] = false\n const areStylesExiting = Object.values(exitingStyleProps).some(Boolean)\n // if this is true, then we've finished our exit animations\n if (!areStylesExiting) {\n runOnJS(reanimatedSafeToUnmount)()\n }\n }\n }\n\n let { delayMs = null } = animationDelay(key, transition, delay)\n\n if (key === 'transform') {\n if (!Array.isArray(value)) {\n console.error(`Invalid transform value. Needs to be an array.`)\n continue\n }\n\n for (const transformObject of value) {\n const key = Object.keys(transformObject)[0]\n const transformValue = transformObject[key]\n const transform = {} as any\n if (transition?.[key]?.delay != null) {\n delayMs = transition?.[key]?.delay ?? null\n }\n let finalValue = animation(transformValue, config, callback)\n if (shouldRepeat) {\n finalValue = withRepeat(finalValue, repeatCount, repeatReverse)\n }\n if (delayMs != null) {\n transform[key] = withDelay(delayMs, finalValue)\n } else {\n transform[key] = finalValue\n }\n if (Object.keys(transform).length) {\n final['transform'].push(transform)\n }\n }\n continue\n }\n\n if (typeof value === 'object') {\n // shadows\n final[key] = {}\n for (const innerStyleKey of Object.keys(value || {})) {\n let finalValue = animation(value, config, callback)\n if (shouldRepeat) {\n finalValue = withRepeat(finalValue, repeatCount, repeatReverse)\n }\n if (delayMs != null) {\n final[key][innerStyleKey] = withDelay(delayMs, finalValue)\n } else {\n final[key][innerStyleKey] = finalValue\n }\n }\n continue\n }\n\n let finalValue = animation(value, config, callback)\n if (shouldRepeat) {\n finalValue = withRepeat(finalValue, repeatCount, repeatReverse)\n }\n if (delayMs != null && typeof delayMs === 'number') {\n final[key] = withDelay(delayMs, finalValue)\n } else {\n final[key] = finalValue\n }\n\n // end for (key in mergedStyles)\n }\n\n return final\n }, [\n style,\n custom,\n delay,\n // disableInitialAnimation,\n // exitProp,\n // exitTransitionProp,\n // fromProp,\n hasExitStyle,\n isMounted,\n isPresent,\n onDidAnimate,\n reanimatedOnDidAnimated,\n reanimatedSafeToUnmount,\n // state,\n // stylePriority,\n // transitionProp,\n ])\n\n return {\n style: animatedStyle,\n }\n },\n }\n}\n\nfunction animationDelay<Animate>(\n key: string,\n transition: MotiTransition<Animate> | undefined,\n defaultDelay?: number\n) {\n 'worklet'\n let delayMs: TransitionConfig['delay'] = defaultDelay\n\n if (transition[key as keyof Animate]?.delay != null) {\n delayMs = transition[key as keyof Animate]?.delay\n } else if (transition?.delay != null) {\n delayMs = transition.delay\n }\n\n return {\n delayMs,\n }\n}\n\ntype MotiTransition<A> = any\ntype Transforms = PerpectiveTransform &\n RotateTransform &\n RotateXTransform &\n RotateYTransform &\n RotateZTransform &\n ScaleTransform &\n ScaleXTransform &\n ScaleYTransform &\n TranslateXTransform &\n TranslateYTransform &\n SkewXTransform &\n SkewYTransform\ntype TransitionConfigWithoutRepeats = (\n | ({ type?: 'spring' } & WithSpringConfig)\n | ({ type: 'timing' } & WithTimingConfig)\n | ({ type: 'decay' } & WithDecayConfig)\n) & {\n delay?: number\n}\n\ntype TransitionConfig = TransitionConfigWithoutRepeats & {\n /**\n * Number of times this animation should repeat. To make it infinite, use the `loop` boolean.\n *\n * Default: `0`\n *\n * It's worth noting that this value isn't *exactly* a `repeat`. Instead, it uses Reanimated's `withRepeat` function under the hood, which repeats back to the **previous value**. If you want a repeated animation, I recommend setting it to `true` from the start, and make sure you have a `from` value.\n *\n * As a result, this value cannot be reliably changed on the fly. If you would like animations to repeat based on the `from` value, `repeat` must be a number when the component initializes. You can set it to `0` to stop it, but you won't be able to start it again. You might be better off using the sequence array API if you need to update its repetitiveness on the fly.\n */\n repeat?: number\n /**\n * Setting this to `true` is the same as `repeat: Infinity`\n *\n * Default: `false`\n *\n * Note: this value cannot be set on the fly. If you would like animations to repeat based on the `from` value, it must be `true` when the component initializes. You can set it to `false` to stop it, but you won't be able to start it again. You might be better off using the sequence array API if you need to update its repetitiveness on the fly.\n */\n loop?: boolean\n /**\n * Whether or not the animation repetition should alternate in direction.\n *\n * By default, this is `true`.\n *\n * If `false`, any animations with `loop` or `repeat` will not go back and forth. Instead, they will go from 0 -> 1, and again from 0 -> 1.\n *\n * If `true`, then animations will go 0 -> 1 -> 0.\n *\n * Setting this to `true` is like setting `animationDirection: alternate` in CSS.\n */\n repeatReverse?: boolean\n}\n\nconst isColor = (styleKey: string) => {\n 'worklet'\n return [\n 'backgroundColor',\n 'borderBottomColor',\n 'borderColor',\n 'borderEndColor',\n 'borderLeftColor',\n 'borderRightColor',\n 'borderStartColor',\n 'borderTopColor',\n 'color',\n ].includes(styleKey)\n}\n\nfunction animationConfig<Animate>(\n styleProp: string,\n transition: MotiTransition<Animate> | undefined\n) {\n 'worklet'\n const key = styleProp\n let repeatCount = 0\n let repeatReverse = true\n let animationType: Required<TransitionConfig>['type'] = 'spring'\n\n if (isColor(key) || key === 'opacity') {\n animationType = 'timing'\n }\n\n // say that we're looking at `width`\n // first, check if we have transition.width.type\n if (transition[key as keyof Animate]?.type) {\n animationType = (transition as any)[key]?.type\n } else if (transition?.type) {\n // otherwise, fallback to transition.type\n animationType = transition.type\n }\n\n const loop = transition[key as keyof Animate]?.loop ?? transition?.loop\n\n if (loop != null) {\n repeatCount = loop ? -1 : 0\n }\n\n if (transition[key as keyof Animate]?.repeat != null) {\n repeatCount = transition[key as keyof Animate]?.repeat\n } else if (transition?.repeat != null) {\n repeatCount = transition.repeat\n }\n\n if (transition[key as keyof Animate]?.repeatReverse != null) {\n repeatReverse = transition[key as keyof Animate]?.repeatReverse\n } else if (transition?.repeatReverse != null) {\n repeatReverse = transition.repeatReverse\n }\n\n let config = {}\n // so sad, but fix it later :(\n let animation = (...props: any): any => props\n\n if (animationType === 'timing') {\n const duration =\n (transition[key as keyof Animate] as WithTimingConfig)?.duration ??\n (transition as WithTimingConfig)?.duration\n\n const easing =\n (transition[key as keyof Animate] as WithTimingConfig)?.easing ??\n (transition as WithTimingConfig)?.easing\n\n if (easing) {\n config['easing'] = easing\n }\n if (duration != null) {\n config['duration'] = duration\n }\n animation = withTiming\n } else if (animationType === 'spring') {\n animation = withSpring\n config = {} as WithSpringConfig\n configKeys.forEach((configKey) => {\n 'worklet'\n const styleSpecificConfig = transition?.[key]?.[configKey]\n const transitionConfigForKey = transition?.[configKey]\n if (styleSpecificConfig != null) {\n config[configKey] = styleSpecificConfig\n } else if (transitionConfigForKey != null) {\n config[configKey] = transitionConfigForKey\n }\n })\n } else if (animationType === 'decay') {\n animation = withDecay\n config = {\n velocity: 2,\n deceleration: 2,\n }\n const configKeys: (keyof WithDecayConfig)[] = [\n 'clamp',\n 'velocity',\n 'deceleration',\n 'velocityFactor',\n ]\n configKeys.forEach((configKey) => {\n 'worklet'\n // is this necessary ^ don't think so...?\n const styleSpecificConfig = transition?.[key]?.[configKey]\n const transitionConfigForKey = transition?.[configKey]\n\n if (styleSpecificConfig != null) {\n config[configKey] = styleSpecificConfig\n } else if (transitionConfigForKey != null) {\n config[configKey] = transitionConfigForKey\n }\n })\n }\n\n return {\n animation,\n config,\n repeatReverse,\n repeatCount,\n shouldRepeat: !!repeatCount,\n }\n}\n\nconst configKeys: (keyof WithSpringConfig)[] = [\n 'damping',\n 'mass',\n 'overshootClamping',\n 'restDisplacementThreshold',\n 'restSpeedThreshold',\n 'stiffness',\n 'velocity',\n]\n"],
5
+ "mappings": ";;AAAA;AAEA;AAeA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcA,MAAM,eAAe,SAAS;AAC9B,MAAM,eAAe,SAAS;AAE9B,aAAa,iBAAiB;AAC9B,aAAa,iBAAiB;AAEvB,0BAA4C,YAAmC;AACpF,SAAO;AAAA,IACL,cAAc;AAAA,IACd;AAAA,IACA,MAAM;AAAA,IACN,MAAM;AAAA,IACN,eAAe,CAAC,OAA0B,UAA6B;AACrE,YAAM,EAAE,OAAO,WAAW,cAAc,UAAU;AAClD,YAAM,CAAC,WAAW,iBAAiB,YAAY;AAC/C,YAAM,WAAW,WAAW,sBAAsB;AAClD,YAAM,YAAY,eAAe,KAAK;AACtC,YAAM,eAAe,CAAC,CAAC;AACvB,YAAM,SAAS,YAAY,MAAM;AAC/B;AACA,eAAO,qCAAU;AAAA,MACnB,GAAG,CAAC,QAAQ,CAAC;A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;AAChD,YAAM,yBAAyB,yCAAa;AAE5C,UAAI,uBAAuB,MAAM;AAC/B,eAAO,aAAa;AAAA,MACtB,WAAW,0BAA0B,MAAM;AACzC,eAAO,aAAa;AAAA,MACtB;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc,CAAC,CAAC;AAAA,EAClB;AACF;AA3GS;AA6GT,MAAM,aAAyC;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
6
6
  "names": []
7
7
  }
@@ -84,51 +84,53 @@ function createAnimations(animations) {
84
84
  if (key === "transform") {
85
85
  if (!Array.isArray(value)) {
86
86
  console.error(`Invalid transform value. Needs to be an array.`);
87
- } else {
88
- for (const transformObject of value) {
89
- const key2 = Object.keys(transformObject)[0];
90
- const transformValue = transformObject[key2];
91
- const transform = {};
92
- if (((_a = transition == null ? void 0 : transition[key2]) == null ? void 0 : _a.delay) != null) {
93
- delayMs = (_c = (_b = transition == null ? void 0 : transition[key2]) == null ? void 0 : _b.delay) != null ? _c : null;
94
- }
95
- let finalValue = animation(transformValue, config, callback);
96
- if (shouldRepeat) {
97
- finalValue = withRepeat(finalValue, repeatCount, repeatReverse);
98
- }
99
- if (delayMs != null) {
100
- transform[key2] = withDelay(delayMs, finalValue);
101
- } else {
102
- transform[key2] = finalValue;
103
- }
104
- if (Object.keys(transform).length) {
105
- final["transform"].push(transform);
106
- }
87
+ continue;
88
+ }
89
+ for (const transformObject of value) {
90
+ const key2 = Object.keys(transformObject)[0];
91
+ const transformValue = transformObject[key2];
92
+ const transform = {};
93
+ if (((_a = transition == null ? void 0 : transition[key2]) == null ? void 0 : _a.delay) != null) {
94
+ delayMs = (_c = (_b = transition == null ? void 0 : transition[key2]) == null ? void 0 : _b.delay) != null ? _c : null;
95
+ }
96
+ let finalValue2 = animation(transformValue, config, callback);
97
+ if (shouldRepeat) {
98
+ finalValue2 = withRepeat(finalValue2, repeatCount, repeatReverse);
99
+ }
100
+ if (delayMs != null) {
101
+ transform[key2] = withDelay(delayMs, finalValue2);
102
+ } else {
103
+ transform[key2] = finalValue2;
104
+ }
105
+ if (Object.keys(transform).length) {
106
+ final["transform"].push(transform);
107
107
  }
108
108
  }
109
- } else if (typeof value === "object") {
109
+ continue;
110
+ }
111
+ if (typeof value === "object") {
110
112
  final[key] = {};
111
113
  for (const innerStyleKey of Object.keys(value || {})) {
112
- let finalValue = animation(value, config, callback);
114
+ let finalValue2 = animation(value, config, callback);
113
115
  if (shouldRepeat) {
114
- finalValue = withRepeat(finalValue, repeatCount, repeatReverse);
116
+ finalValue2 = withRepeat(finalValue2, repeatCount, repeatReverse);
115
117
  }
116
118
  if (delayMs != null) {
117
- final[key][innerStyleKey] = withDelay(delayMs, finalValue);
119
+ final[key][innerStyleKey] = withDelay(delayMs, finalValue2);
118
120
  } else {
119
- final[key][innerStyleKey] = finalValue;
121
+ final[key][innerStyleKey] = finalValue2;
120
122
  }
121
123
  }
124
+ continue;
125
+ }
126
+ let finalValue = animation(value, config, callback);
127
+ if (shouldRepeat) {
128
+ finalValue = withRepeat(finalValue, repeatCount, repeatReverse);
129
+ }
130
+ if (delayMs != null && typeof delayMs === "number") {
131
+ final[key] = withDelay(delayMs, finalValue);
122
132
  } else {
123
- let finalValue = animation(value, config, callback);
124
- if (shouldRepeat) {
125
- finalValue = withRepeat(finalValue, repeatCount, repeatReverse);
126
- }
127
- if (delayMs != null && typeof delayMs === "number") {
128
- final[key] = withDelay(delayMs, finalValue);
129
- } else {
130
- final[key] = finalValue;
131
- }
133
+ final[key] = finalValue;
132
134
  }
133
135
  }
134
136
  return final;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/animations-reanimated",
3
- "version": "1.0.0-beta.187+b4ae9217",
3
+ "version": "1.0.0-beta.202+a1a54793",
4
4
  "source": "src/index.ts",
5
5
  "license": "MIT",
6
6
  "typings": "types",
@@ -12,12 +12,12 @@
12
12
  "dist"
13
13
  ],
14
14
  "dependencies": {
15
- "@tamagui/animate-presence": "^1.0.0-beta.187+b4ae9217",
16
- "@tamagui/core": "^1.0.0-beta.187+b4ae9217",
15
+ "@tamagui/animate-presence": "^1.0.0-beta.202+a1a54793",
16
+ "@tamagui/core": "^1.0.0-beta.202+a1a54793",
17
17
  "react-native-reanimated": "^2.4.1"
18
18
  },
19
19
  "devDependencies": {
20
- "@tamagui/build": "^1.0.0-beta.187+b4ae9217"
20
+ "@tamagui/build": "^1.0.0-beta.202+a1a54793"
21
21
  },
22
22
  "scripts": {
23
23
  "build": "tamagui-build",
@@ -28,5 +28,5 @@
28
28
  "publishConfig": {
29
29
  "access": "public"
30
30
  },
31
- "gitHead": "b4ae92179a688f73380c8f41296ecfc881b1cbc0"
31
+ "gitHead": "a1a54793ee1890507fc934f42f2eb3a4020b57c5"
32
32
  }
@@ -1,3 +1,18 @@
1
1
  import { AnimationDriver } from '@tamagui/core';
2
- export declare function createAnimations<A extends Object>(animations: A): AnimationDriver<A>;
2
+ import { WithDecayConfig, WithSpringConfig, WithTimingConfig } from 'react-native-reanimated';
3
+ declare type AnimationsConfig<A extends Object = any> = {
4
+ [Key in keyof A]: AnimationConfig;
5
+ };
6
+ declare type AnimationConfig = ({
7
+ type: 'timing';
8
+ loop?: number;
9
+ } & WithTimingConfig) | ({
10
+ type: 'spring';
11
+ loop?: number;
12
+ } & WithSpringConfig) | ({
13
+ type: 'decay';
14
+ loop?: number;
15
+ } & WithDecayConfig);
16
+ export declare function createAnimations<A extends AnimationsConfig>(animations: A): AnimationDriver<A>;
17
+ export {};
3
18
  //# sourceMappingURL=createAnimations.d.ts.map