@tamagui/animations-reanimated 1.0.1-rc.8 → 1.0.1
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.
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
import { PresenceContext, usePresence } from "@tamagui/animate-presence";
|
|
1
2
|
import { useEvent } from "@tamagui/core";
|
|
2
|
-
import {
|
|
3
|
-
import { useMemo } from "react";
|
|
4
|
-
import { FlatList, Animated as RNAnimated } from "react-native";
|
|
3
|
+
import { useContext, useMemo } from "react";
|
|
5
4
|
import Animated, {
|
|
6
5
|
runOnJS,
|
|
7
6
|
useAnimatedStyle,
|
|
@@ -11,18 +10,6 @@ import Animated, {
|
|
|
11
10
|
withSpring,
|
|
12
11
|
withTiming
|
|
13
12
|
} from "react-native-reanimated";
|
|
14
|
-
import {
|
|
15
|
-
useAnimatedNumber,
|
|
16
|
-
useAnimatedNumberReaction,
|
|
17
|
-
useAnimatedNumberStyle
|
|
18
|
-
} from "./useAnimatedNumber";
|
|
19
|
-
if (process.env.NODE_ENV === "development") {
|
|
20
|
-
if (FlatList?.["_isProxyWorm"]) {
|
|
21
|
-
console.warn(
|
|
22
|
-
`Using reanimated with excludeReactNativeWebExports including FlatList, adjust your next.config.js, reanimated currently doesn't support tree-shaking and needs *List components around.`
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
13
|
const animatedStyleKey = {
|
|
27
14
|
transform: true,
|
|
28
15
|
opacity: true
|
|
@@ -33,22 +20,27 @@ function createAnimations(animations) {
|
|
|
33
20
|
AnimatedView["displayName"] = "AnimatedView";
|
|
34
21
|
AnimatedText["displayName"] = "AnimatedText";
|
|
35
22
|
return {
|
|
36
|
-
|
|
23
|
+
avoidClasses: true,
|
|
37
24
|
animations,
|
|
38
25
|
View: AnimatedView,
|
|
39
26
|
Text: AnimatedText,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const isExiting = presence?.[0] === false;
|
|
47
|
-
const sendExitComplete = presence?.[1];
|
|
27
|
+
useAnimations: (props, helpers) => {
|
|
28
|
+
var _a, _b;
|
|
29
|
+
const { pseudos, onDidAnimate, delay, getStyle, state, staticConfig } = helpers;
|
|
30
|
+
const [isPresent, sendExitComplete] = usePresence();
|
|
31
|
+
const presence = useContext(PresenceContext);
|
|
32
|
+
const exitStyle = (presence == null ? void 0 : presence.exitVariant) ? ((_b = (_a = staticConfig.variantsParsed) == null ? void 0 : _a[presence.exitVariant]) == null ? void 0 : _b.true) || pseudos.exitStyle : pseudos.exitStyle;
|
|
48
33
|
const reanimatedOnDidAnimated = useEvent((...args) => {
|
|
49
|
-
onDidAnimate
|
|
34
|
+
onDidAnimate == null ? void 0 : onDidAnimate(...args);
|
|
35
|
+
});
|
|
36
|
+
const isExiting = isPresent === false;
|
|
37
|
+
const isEntering = !state.mounted;
|
|
38
|
+
const all = getStyle({
|
|
39
|
+
isExiting,
|
|
40
|
+
isEntering,
|
|
41
|
+
exitVariant: presence == null ? void 0 : presence.exitVariant,
|
|
42
|
+
enterVariant: presence == null ? void 0 : presence.enterVariant
|
|
50
43
|
});
|
|
51
|
-
const all = style;
|
|
52
44
|
const [animatedStyles, nonAnimatedStyle] = [{}, {}];
|
|
53
45
|
for (const key2 of Object.keys(all)) {
|
|
54
46
|
if (animatedStyleKey[key2]) {
|
|
@@ -58,7 +50,18 @@ function createAnimations(animations) {
|
|
|
58
50
|
}
|
|
59
51
|
}
|
|
60
52
|
const animatedString = JSON.stringify(animatedStyles);
|
|
61
|
-
const key = animatedString
|
|
53
|
+
const key = animatedString + JSON.stringify([
|
|
54
|
+
state.mounted,
|
|
55
|
+
state.hover,
|
|
56
|
+
state.press,
|
|
57
|
+
state.pressIn,
|
|
58
|
+
state.focus,
|
|
59
|
+
delay,
|
|
60
|
+
isPresent,
|
|
61
|
+
onDidAnimate,
|
|
62
|
+
presence == null ? void 0 : presence.exitVariant,
|
|
63
|
+
presence == null ? void 0 : presence.enterVariant
|
|
64
|
+
]);
|
|
62
65
|
const callback = (isExiting2, exitingStyleProps, key2, value) => {
|
|
63
66
|
"worklet";
|
|
64
67
|
return (completed, current) => {
|
|
@@ -79,41 +82,35 @@ function createAnimations(animations) {
|
|
|
79
82
|
};
|
|
80
83
|
const animatedStyle = useAnimatedStyle(() => {
|
|
81
84
|
"worklet";
|
|
82
|
-
const
|
|
85
|
+
const style = JSON.parse(animatedString);
|
|
83
86
|
const final = {
|
|
84
87
|
transform: []
|
|
85
88
|
};
|
|
89
|
+
const isExiting2 = isPresent === false;
|
|
86
90
|
const exitingStyleProps = {};
|
|
87
|
-
if (
|
|
88
|
-
for (const key2 in
|
|
91
|
+
if (exitStyle) {
|
|
92
|
+
for (const key2 in exitStyle) {
|
|
89
93
|
if (key2 === "transform") {
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const tkey = Object.keys(attr)[0];
|
|
94
|
-
exitingStyleProps[tkey] = true;
|
|
95
|
-
}
|
|
94
|
+
for (const attr of exitStyle[key2]) {
|
|
95
|
+
const tkey = Object.keys(attr)[0];
|
|
96
|
+
exitingStyleProps[tkey] = true;
|
|
96
97
|
}
|
|
97
98
|
} else {
|
|
98
99
|
exitingStyleProps[key2] = true;
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
|
-
for (const key2 in
|
|
103
|
-
const value =
|
|
103
|
+
for (const key2 in style) {
|
|
104
|
+
const value = style[key2];
|
|
104
105
|
const animationConfig = getAnimationConfig(key2, animations, props.animation);
|
|
105
|
-
const { animation, config, shouldRepeat, repeatCount, repeatReverse } = getAnimation(
|
|
106
|
-
key2,
|
|
107
|
-
animationConfig,
|
|
108
|
-
props.animateOnly
|
|
109
|
-
);
|
|
106
|
+
const { animation, config, shouldRepeat, repeatCount, repeatReverse } = getAnimation(key2, animationConfig, props.animateOnly);
|
|
110
107
|
const { delayMs = null } = animationDelay(key2, animationConfig, delay);
|
|
111
108
|
if (!animation) {
|
|
112
|
-
console.warn("No animation for", key2, "in",
|
|
109
|
+
console.warn("No animation for", key2, "in", style);
|
|
113
110
|
continue;
|
|
114
111
|
}
|
|
115
112
|
if (!config) {
|
|
116
|
-
console.warn("No animation config for", key2, "in",
|
|
113
|
+
console.warn("No animation config for", key2, "in", style);
|
|
117
114
|
continue;
|
|
118
115
|
}
|
|
119
116
|
if (key2 === "transform") {
|
|
@@ -124,11 +121,7 @@ function createAnimations(animations) {
|
|
|
124
121
|
for (const transformObject of value) {
|
|
125
122
|
const key3 = Object.keys(transformObject)[0];
|
|
126
123
|
const transformValue = transformObject[key3];
|
|
127
|
-
let finalValue2 = animation(
|
|
128
|
-
transformValue,
|
|
129
|
-
config,
|
|
130
|
-
callback(isExiting, exitingStyleProps, key3, value)
|
|
131
|
-
);
|
|
124
|
+
let finalValue2 = animation(transformValue, config, callback(isExiting2, exitingStyleProps, key3, value));
|
|
132
125
|
if (shouldRepeat) {
|
|
133
126
|
finalValue2 = withRepeat(finalValue2, repeatCount, repeatReverse);
|
|
134
127
|
}
|
|
@@ -141,11 +134,7 @@ function createAnimations(animations) {
|
|
|
141
134
|
if (typeof value === "object") {
|
|
142
135
|
final[key2] = {};
|
|
143
136
|
for (const innerStyleKey of Object.keys(value || {})) {
|
|
144
|
-
let finalValue2 = animation(
|
|
145
|
-
value,
|
|
146
|
-
config,
|
|
147
|
-
callback(isExiting, exitingStyleProps, key2, value)
|
|
148
|
-
);
|
|
137
|
+
let finalValue2 = animation(value, config, callback(isExiting2, exitingStyleProps, key2, value));
|
|
149
138
|
if (shouldRepeat) {
|
|
150
139
|
finalValue2 = withRepeat(finalValue2, repeatCount, repeatReverse);
|
|
151
140
|
}
|
|
@@ -157,11 +146,7 @@ function createAnimations(animations) {
|
|
|
157
146
|
}
|
|
158
147
|
continue;
|
|
159
148
|
}
|
|
160
|
-
let finalValue = animation(
|
|
161
|
-
value,
|
|
162
|
-
config,
|
|
163
|
-
callback(isExiting, exitingStyleProps, key2, value)
|
|
164
|
-
);
|
|
149
|
+
let finalValue = animation(value, config, callback(isExiting2, exitingStyleProps, key2, value));
|
|
165
150
|
if (shouldRepeat) {
|
|
166
151
|
finalValue = withRepeat(finalValue, repeatCount, repeatReverse);
|
|
167
152
|
}
|
|
@@ -200,8 +185,8 @@ function getAnimationConfig(key, animations, animation) {
|
|
|
200
185
|
}
|
|
201
186
|
}
|
|
202
187
|
} else {
|
|
203
|
-
const val = animation
|
|
204
|
-
type = val
|
|
188
|
+
const val = animation == null ? void 0 : animation[key];
|
|
189
|
+
type = val == null ? void 0 : val.type;
|
|
205
190
|
extraConf = val;
|
|
206
191
|
}
|
|
207
192
|
const found = animations[type];
|
|
@@ -246,7 +231,7 @@ function getAnimation(key, animationConfig, animateOnly) {
|
|
|
246
231
|
}
|
|
247
232
|
let repeatCount = 0;
|
|
248
233
|
const repeatReverse = animationConfig.repeatReverse || false;
|
|
249
|
-
let animationType = animationConfig
|
|
234
|
+
let animationType = (animationConfig == null ? void 0 : animationConfig.type) || "spring";
|
|
250
235
|
if (isColor(key) || key === "opacity") {
|
|
251
236
|
animationType = "timing";
|
|
252
237
|
}
|
|
@@ -270,6 +255,7 @@ function getAnimation(key, animationConfig, animateOnly) {
|
|
|
270
255
|
deceleration: 2
|
|
271
256
|
};
|
|
272
257
|
} else {
|
|
258
|
+
console.warn("no type of animation?", animationType);
|
|
273
259
|
animation = withSpring;
|
|
274
260
|
}
|
|
275
261
|
return {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/createAnimations.tsx"],
|
|
4
|
-
"sourcesContent": ["import { AnimationDriver, AnimationProp, useEvent } from '@tamagui/core'\nimport { PresenceContext, usePresence } from '@tamagui/use-presence'\nimport { useContext, useMemo } from 'react'\n// until we fix Sheet\nimport { FlatList, Animated as RNAnimated } from 'react-native'\nimport Animated, {\n WithDecayConfig,\n WithSpringConfig,\n WithTimingConfig,\n runOnJS,\n useAnimatedStyle,\n withDecay,\n withDelay,\n withRepeat,\n withSpring,\n withTiming,\n} from 'react-native-reanimated'\n\nimport {\n useAnimatedNumber,\n useAnimatedNumberReaction,\n useAnimatedNumberStyle,\n} from './useAnimatedNumber'\n\n// add nice warning for if mis-configured next config:\nif (process.env.NODE_ENV === 'development') {\n if (FlatList?.['_isProxyWorm']) {\n // eslint-disable-next-line no-console\n console.warn(\n `Using reanimated with excludeReactNativeWebExports including FlatList, adjust your next.config.js, reanimated currently doesn't support tree-shaking and needs *List components around.`\n )\n }\n}\n\ntype AnimationsConfig<A extends Object = any> = {\n [Key in keyof A]: AnimationConfig\n}\n\ntype AnimationConfig =\n | ({ type: 'timing'; loop?: number; repeat?: number; repeatReverse?: boolean } & WithTimingConfig)\n | ({ type: 'spring'; loop?: number; repeat?: number; repeatReverse?: boolean } & WithSpringConfig)\n | ({ type: 'decay'; loop?: number; repeat?: number; repeatReverse?: boolean } & WithDecayConfig)\n\nconst animatedStyleKey = {\n transform: true,\n opacity: true,\n // backgroundColor: true,\n // color: true,\n}\n\nexport function createAnimations<A extends AnimationsConfig>(animations: A): AnimationDriver<A> {\n const AnimatedView = Animated.View\n const AnimatedText = Animated.Text\n\n AnimatedView['displayName'] = 'AnimatedView'\n AnimatedText['displayName'] = 'AnimatedText'\n\n return {\n isReactNative: true,\n animations,\n View: AnimatedView,\n Text: AnimatedText,\n\n // temp\n // @ts-ignore\n NumberView: RNAnimated.View,\n\n useAnimatedNumber,\n useAnimatedNumberReaction,\n useAnimatedNumberStyle,\n usePresence,\n useAnimations: ({ props, style, presence, pseudos, onDidAnimate, delay }) => {\n const isExiting = presence?.[0] === false\n const sendExitComplete = presence?.[1]\n const reanimatedOnDidAnimated = useEvent<NonNullable<typeof onDidAnimate>>((...args) => {\n onDidAnimate?.(...args)\n })\n\n const all = style\n\n const [animatedStyles, nonAnimatedStyle] = [{}, {}]\n for (const key of Object.keys(all)) {\n if (animatedStyleKey[key]) {\n animatedStyles[key] = all[key]\n } else {\n nonAnimatedStyle[key] = all[key]\n }\n }\n\n const animatedString = JSON.stringify(animatedStyles)\n const key = animatedString // +\n // JSON.stringify([\n // state.unmounted,\n // state.hover,\n // state.press,\n // state.pressIn,\n // state.focus,\n // delay,\n // isPresent,\n // ])\n\n const callback = (\n isExiting: boolean,\n exitingStyleProps: Record<string, boolean>,\n key: string,\n value: any\n ) => {\n 'worklet'\n return (completed: boolean | undefined, current: any) => {\n 'worklet'\n runOnJS(reanimatedOnDidAnimated)(key, completed, current, {\n attemptedValue: value,\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 if (sendExitComplete) {\n runOnJS(sendExitComplete)()\n }\n }\n }\n }\n }\n\n const animatedStyle = useAnimatedStyle(() => {\n 'worklet'\n\n // getting issues with native unless this :/\n const style = JSON.parse(animatedString)\n\n const final = {\n transform: [] as any[],\n }\n\n const exitingStyleProps: Record<string, boolean> = {}\n\n // TODO this needs various manual checks, untested\n // psuedos.exitStyle wont have the exitVariant on it unless we add that\n if (pseudos.exitStyle) {\n for (const key in pseudos.exitStyle) {\n if (key === 'transform') {\n const val = pseudos.exitStyle[key]\n if (val) {\n for (const attr of val) {\n const tkey = Object.keys(attr)[0]\n exitingStyleProps[tkey] = true\n }\n }\n } else {\n exitingStyleProps[key] = true\n }\n }\n }\n\n for (const key in style) {\n const value = style[key]\n const animationConfig = getAnimationConfig(key, animations, props.animation)\n const { animation, config, shouldRepeat, repeatCount, repeatReverse } = getAnimation(\n key,\n animationConfig,\n props.animateOnly\n )\n\n const { delayMs = null } = animationDelay(key, animationConfig, delay)\n\n if (!animation) {\n // eslint-disable-next-line no-console\n console.warn('No animation for', key, 'in', style)\n continue\n }\n if (!config) {\n // eslint-disable-next-line no-console\n console.warn('No animation config for', key, 'in', style)\n continue\n }\n\n if (key === 'transform') {\n if (!Array.isArray(value)) {\n // eslint-disable-next-line no-console\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 let finalValue = animation(\n transformValue,\n config as any,\n callback(isExiting, exitingStyleProps, key, value)\n )\n if (shouldRepeat) {\n finalValue = withRepeat(finalValue, repeatCount, repeatReverse)\n }\n final['transform'].push({\n [key]: finalValue,\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(\n value,\n config as any,\n callback(isExiting, exitingStyleProps, key, value)\n )\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(\n value,\n config as any,\n callback(isExiting, exitingStyleProps, key, value)\n )\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 }, [key])\n\n return useMemo(() => {\n return {\n style: [nonAnimatedStyle, animatedStyle],\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [key])\n },\n }\n}\n\nfunction getAnimationConfig(key: string, animations: AnimationsConfig, animation?: AnimationProp) {\n 'worklet'\n if (typeof animation === 'string') {\n return animations[animation]\n }\n let type = ''\n let extraConf: any\n if (Array.isArray(animation)) {\n type = animation[0] as string\n const conf = animation[1] && animation[1][key]\n if (conf) {\n if (typeof conf === 'string') {\n type = conf\n } else {\n type = (conf as any).type || type\n extraConf = conf\n }\n }\n } else {\n const val = animation?.[key]\n type = val?.type\n extraConf = val\n }\n const found = animations[type]\n if (!found) {\n throw new Error(`No animation of type \"${type}\" for key \"${key}\"`)\n }\n return {\n ...found,\n ...extraConf,\n type: found.type,\n }\n}\n\nfunction animationDelay(\n key: string,\n animation: AnimationConfig | undefined,\n defaultDelay?: number\n) {\n 'worklet'\n if (\n !animation ||\n !animation[key] ||\n animation[key].delayMs === undefined ||\n animation[key].delayMs === null\n ) {\n return {\n delayMs: null,\n }\n }\n return {\n delayMs: animation[key].delayMs as TransitionConfig['delay'],\n }\n}\n\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 getAnimation(\n key: string,\n animationConfig: AnimationConfig | undefined,\n animateOnly?: string[]\n) {\n 'worklet'\n if (!animationConfig || (animateOnly && !animateOnly.includes(key))) {\n return {}\n }\n\n let repeatCount = 0\n const repeatReverse = animationConfig.repeatReverse || false\n let animationType: Required<TransitionConfig>['type'] = animationConfig?.type || 'spring'\n\n if (isColor(key) || key === 'opacity') {\n animationType = 'timing'\n }\n\n if ('repeat' in animationConfig) {\n repeatCount = animationConfig.repeat || 0\n } else {\n if (animationConfig.loop) {\n repeatCount = animationConfig.loop ? -1 : 0\n }\n }\n\n let config = animationConfig\n let animation: typeof withTiming | typeof withSpring | typeof withDecay\n\n if (animationType === 'timing') {\n animation = withTiming\n } else if (animationType === 'spring') {\n animation = withSpring\n } else if (animationType === 'decay') {\n animation = withDecay\n config = config || {\n velocity: 2,\n deceleration: 2,\n }\n } else {\n animation = withSpring\n }\n\n return {\n animation,\n config,\n repeatReverse,\n repeatCount,\n shouldRepeat: !!repeatCount,\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAA
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["import { PresenceContext, usePresence } from '@tamagui/animate-presence'\nimport { AnimationDriver, AnimationProp, useEvent } from '@tamagui/core'\nimport { useContext, useMemo } from 'react'\nimport Animated, {\n WithDecayConfig,\n WithSpringConfig,\n WithTimingConfig,\n runOnJS,\n useAnimatedStyle,\n withDecay,\n withDelay,\n withRepeat,\n withSpring,\n withTiming,\n} from 'react-native-reanimated'\n\ntype AnimationsConfig<A extends Object = any> = {\n [Key in keyof A]: AnimationConfig\n}\n\ntype AnimationConfig =\n | ({ type: 'timing'; loop?: number; repeat?: number; repeatReverse?: boolean } & WithTimingConfig)\n | ({ type: 'spring'; loop?: number; repeat?: number; repeatReverse?: boolean } & WithSpringConfig)\n | ({ type: 'decay'; loop?: number; repeat?: number; repeatReverse?: boolean } & WithDecayConfig)\n\nconst animatedStyleKey = {\n transform: true,\n opacity: true,\n // backgroundColor: true,\n // color: true,\n}\n\nexport function createAnimations<A extends AnimationsConfig>(animations: A): AnimationDriver<A> {\n const AnimatedView = Animated.View\n const AnimatedText = Animated.Text\n\n AnimatedView['displayName'] = 'AnimatedView'\n AnimatedText['displayName'] = 'AnimatedText'\n\n return {\n avoidClasses: true,\n animations,\n View: AnimatedView,\n Text: AnimatedText,\n useAnimations: (props, helpers) => {\n const { pseudos, onDidAnimate, delay, getStyle, state, staticConfig } = helpers\n const [isPresent, sendExitComplete] = usePresence()\n const presence = useContext(PresenceContext)\n\n const exitStyle = presence?.exitVariant\n ? staticConfig.variantsParsed?.[presence.exitVariant]?.true || pseudos.exitStyle\n : pseudos.exitStyle\n\n const reanimatedOnDidAnimated = useEvent<NonNullable<typeof onDidAnimate>>((...args) => {\n onDidAnimate?.(...args)\n })\n\n const isExiting = isPresent === false\n const isEntering = !state.mounted\n\n const all = getStyle({\n isExiting,\n isEntering,\n exitVariant: presence?.exitVariant,\n enterVariant: presence?.enterVariant,\n })\n\n const [animatedStyles, nonAnimatedStyle] = [{}, {}]\n for (const key of Object.keys(all)) {\n if (animatedStyleKey[key]) {\n animatedStyles[key] = all[key]\n } else {\n nonAnimatedStyle[key] = all[key]\n }\n }\n\n const animatedString = JSON.stringify(animatedStyles)\n const key =\n animatedString +\n JSON.stringify([\n state.mounted,\n state.hover,\n state.press,\n state.pressIn,\n state.focus,\n delay,\n isPresent,\n onDidAnimate,\n presence?.exitVariant,\n presence?.enterVariant,\n ])\n\n const callback = (\n isExiting: boolean,\n exitingStyleProps: Record<string, boolean>,\n key: string,\n value: any\n ) => {\n 'worklet'\n return (completed: boolean | undefined, current: any) => {\n 'worklet'\n runOnJS(reanimatedOnDidAnimated)(key, completed, current, {\n attemptedValue: value,\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 if (sendExitComplete) {\n runOnJS(sendExitComplete)()\n }\n }\n }\n }\n }\n\n const animatedStyle = useAnimatedStyle(() => {\n 'worklet'\n\n // getting issues with native unless this :/\n const style = JSON.parse(animatedString)\n\n const final = {\n transform: [] as any[],\n }\n\n const isExiting = isPresent === false\n\n const exitingStyleProps: Record<string, boolean> = {}\n if (exitStyle) {\n for (const key in exitStyle) {\n if (key === 'transform') {\n for (const attr of exitStyle[key]) {\n const tkey = Object.keys(attr)[0]\n exitingStyleProps[tkey] = true\n }\n } else {\n exitingStyleProps[key] = true\n }\n }\n }\n\n for (const key in style) {\n const value = style[key]\n const animationConfig = getAnimationConfig(key, animations, props.animation)\n const { animation, config, shouldRepeat, repeatCount, repeatReverse } = getAnimation(\n key,\n animationConfig,\n props.animateOnly\n )\n\n const { delayMs = null } = animationDelay(key, animationConfig, delay)\n\n if (!animation) {\n console.warn('No animation for', key, 'in', style)\n continue\n }\n if (!config) {\n console.warn('No animation config for', key, 'in', style)\n continue\n }\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 let finalValue = animation(\n transformValue,\n config as any,\n callback(isExiting, exitingStyleProps, key, value)\n )\n if (shouldRepeat) {\n finalValue = withRepeat(finalValue, repeatCount, repeatReverse)\n }\n final['transform'].push({\n [key]: finalValue,\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(\n value,\n config as any,\n callback(isExiting, exitingStyleProps, key, value)\n )\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(\n value,\n config as any,\n callback(isExiting, exitingStyleProps, key, value)\n )\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 }, [key])\n\n return useMemo(() => {\n return {\n style: [nonAnimatedStyle, animatedStyle],\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [key])\n },\n }\n}\n\nfunction getAnimationConfig(key: string, animations: AnimationsConfig, animation?: AnimationProp) {\n 'worklet'\n if (typeof animation === 'string') {\n return animations[animation]\n }\n let type = ''\n let extraConf: any\n if (Array.isArray(animation)) {\n type = animation[0] as string\n const conf = animation[1] && animation[1][key]\n if (conf) {\n if (typeof conf === 'string') {\n type = conf\n } else {\n type = (conf as any).type || type\n extraConf = conf\n }\n }\n } else {\n const val = animation?.[key]\n type = val?.type\n extraConf = val\n }\n const found = animations[type]\n if (!found) {\n throw new Error(`No animation of type \"${type}\" for key \"${key}\"`)\n }\n return {\n ...found,\n ...extraConf,\n type: found.type,\n }\n}\n\nfunction animationDelay(\n key: string,\n animation: AnimationConfig | undefined,\n defaultDelay?: number\n) {\n 'worklet'\n if (\n !animation ||\n !animation[key] ||\n animation[key].delayMs === undefined ||\n animation[key].delayMs === null\n ) {\n return {\n delayMs: null,\n }\n }\n return {\n delayMs: animation[key].delayMs as TransitionConfig['delay'],\n }\n}\n\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 getAnimation(\n key: string,\n animationConfig: AnimationConfig | undefined,\n animateOnly?: string[]\n) {\n 'worklet'\n if (!animationConfig || (animateOnly && !animateOnly.includes(key))) {\n return {}\n }\n\n let repeatCount = 0\n const repeatReverse = animationConfig.repeatReverse || false\n let animationType: Required<TransitionConfig>['type'] = animationConfig?.type || 'spring'\n\n if (isColor(key) || key === 'opacity') {\n animationType = 'timing'\n }\n\n if ('repeat' in animationConfig) {\n repeatCount = animationConfig.repeat || 0\n } else {\n if (animationConfig.loop) {\n repeatCount = animationConfig.loop ? -1 : 0\n }\n }\n\n let config = animationConfig\n let animation: typeof withTiming | typeof withSpring | typeof withDecay\n\n if (animationType === 'timing') {\n animation = withTiming\n } else if (animationType === 'spring') {\n animation = withSpring\n } else if (animationType === 'decay') {\n animation = withDecay\n config = config || {\n velocity: 2,\n deceleration: 2,\n }\n } else {\n console.warn('no type of animation?', animationType)\n animation = withSpring\n }\n\n return {\n animation,\n config,\n repeatReverse,\n repeatCount,\n shouldRepeat: !!repeatCount,\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBA,MAAM,mBAAmB;AAAA,EACvB,WAAW;AAAA,EACX,SAAS;AAGX;AAEO,0BAAsD,YAAmC;AAC9F,QAAM,eAAe,SAAS;AAC9B,QAAM,eAAe,SAAS;AAE9B,eAAa,iBAAiB;AAC9B,eAAa,iBAAiB;AAE9B,SAAO;AAAA,IACL,cAAc;AAAA,IACd;AAAA,IACA,MAAM;AAAA,IACN,MAAM;AAAA,IACN,eAAe,CAAC,OAAO,YAAY;AA5CvC;AA6CM,YAAM,EAAE,SAAS,cAAc,OAAO,UAAU,OAAO,iBAAiB;AACxE,YAAM,CAAC,WAAW,oBAAoB,YAAY;AAClD,YAAM,WAAW,WAAW,eAAe;AAE3C,YAAM,YAAY,sCAAU,eACxB,0BAAa,mBAAb,mBAA8B,SAAS,iBAAvC,mBAAqD,SAAQ,QAAQ,YACrE,QAAQ;AAEZ,YAAM,0BAA0B,SAA2C,IAAI,SAAS;AACtF,qDAAe,GAAG;AAAA,MACpB,CAAC;AAED,YAAM,YAAY,cAAc;AAChC,YAAM,aAAa,CAAC,MAAM;AAE1B,YAAM,MAAM,SAAS;AAAA,QACnB;AAAA,QACA;AAAA,QACA,aAAa,qCAAU;AAAA,QACvB,cAAc,qCAAU;AAAA,MAC1B,CAAC;AAED,YAAM,CAAC,gBAAgB,oBAAoB,CAAC,CAAC,GAAG,CAAC,CAAC;AAClD,iBAAW,QAAO,OAAO,KAAK,GAAG,GAAG;AAClC,YAAI,iBAAiB,OAAM;AACzB,yBAAe,QAAO,IAA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
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import './polyfill'\n\nexport * from './createAnimations'\
|
|
5
|
-
"mappings": "AAAA
|
|
4
|
+
"sourcesContent": ["import './polyfill'\n\nexport * from './createAnimations'\n"],
|
|
5
|
+
"mappings": "AAAA;AAEA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/useAnimatedNumber.tsx"],
|
|
4
4
|
"sourcesContent": ["// there's some bug with reanimated likely related to worklets\n// for now to not regress, we require react-native Animated alongside\nexport {\n useAnimatedNumber,\n useAnimatedNumberStyle,\n useAnimatedNumberReaction,\n} from '@tamagui/animations-react-native'\n\n// import { UniversalAnimatedNumber } from '@tamagui/core'\n// import {\n// SharedValue,\n// cancelAnimation,\n// useAnimatedReaction,\n// useAnimatedStyle,\n// useSharedValue,\n// withSpring,\n// withTiming,\n// } from 'react-native-reanimated'\n\n// type ReanimatedAnimatedNumber = SharedValue<number>\n\n// export function useAnimatedNumber(\n// initial: number\n// ): UniversalAnimatedNumber<ReanimatedAnimatedNumber> {\n// const val = useSharedValue(initial)\n// return {\n// getInstance() {\n// return val\n// },\n// getValue() {\n// return val.value\n// },\n// stop() {\n// cancelAnimation(val)\n// },\n// setValue(next: number, config = { type: 'spring' }) {\n// if (config.type === 'direct') {\n// val.value = next\n// } else if (config.type === 'spring') {\n// val.value = withSpring(next, config)\n// } else {\n// val.value = withTiming(next, config)\n// }\n// },\n// }\n// }\n\n// export function useAnimatedNumberReaction(\n// value: UniversalAnimatedNumber<ReanimatedAnimatedNumber>,\n// cb: (current: number) => void\n// ) {\n// useAnimatedReaction(\n// () => {\n// 'worklet'\n// return value.getValue()\n// },\n// (result, prev) => {\n// 'worklet'\n// if (result !== prev) cb(result)\n// },\n// [value]\n// )\n// }\n\n// export function useAnimatedNumberStyle<V extends UniversalAnimatedNumber<ReanimatedAnimatedNumber>>(\n// value: V,\n// getStyle: (value: number) => any\n// ) {\n// return useAnimatedStyle(() => {\n// 'worklet'\n// return getStyle(value.getValue())\n// })\n// }\n"],
|
|
5
|
-
"mappings": "AAEA;AAAA
|
|
5
|
+
"mappings": "AAEA;AAAA;AAAA;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/animations-reanimated",
|
|
3
|
-
"version": "1.0.1
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"sideEffects": true,
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
"dist"
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@tamagui/animations-react-native": "^1.0.1
|
|
17
|
-
"@tamagui/core": "^1.0.1
|
|
18
|
-
"@tamagui/use-presence": "^1.0.1
|
|
16
|
+
"@tamagui/animations-react-native": "^1.0.1",
|
|
17
|
+
"@tamagui/core": "^1.0.1",
|
|
18
|
+
"@tamagui/use-presence": "^1.0.1"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@tamagui/build": "^1.0.1
|
|
21
|
+
"@tamagui/build": "^1.0.1",
|
|
22
22
|
"react-native-reanimated": "^2.12.0"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|