@tamagui/animations-reanimated 1.0.0-beta.187 → 1.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/createAnimations.js +103 -118
- package/dist/cjs/createAnimations.js.map +2 -2
- package/dist/esm/createAnimations.js +101 -110
- package/dist/esm/createAnimations.js.map +2 -2
- package/dist/jsx/createAnimations.js +101 -110
- package/package.json +6 -6
- package/types/createAnimations.d.ts +16 -1
- package/types/createAnimations.d.ts.map +1 -1
- package/LICENSE +0 -21
|
@@ -2,22 +2,8 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __spreadValues = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
-
if (__propIsEnum.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
7
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
22
8
|
var __export = (target, all) => {
|
|
23
9
|
for (var name in all)
|
|
@@ -51,58 +37,74 @@ function createAnimations(animations) {
|
|
|
51
37
|
animations,
|
|
52
38
|
View: AnimatedView,
|
|
53
39
|
Text: AnimatedText,
|
|
54
|
-
useAnimations: (props,
|
|
55
|
-
|
|
56
|
-
const
|
|
40
|
+
useAnimations: (props, helpers) => {
|
|
41
|
+
var _a, _b;
|
|
42
|
+
const { pseudos, onDidAnimate, delay, getStyle, state, staticConfig } = helpers;
|
|
43
|
+
const [isEntering, safeToUnmount] = (0, import_animate_presence.useEntering)();
|
|
57
44
|
const presence = (0, import_react.useContext)(import_animate_presence.AnimatePresenceContext);
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
"worklet";
|
|
62
|
-
return presence == null ? void 0 : presence.custom;
|
|
63
|
-
}, [presence]);
|
|
64
|
-
const reanimatedOnDidAnimated = (0, import_react.useCallback)((...args) => {
|
|
65
|
-
onDidAnimate == null ? void 0 : onDidAnimate(...args);
|
|
45
|
+
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;
|
|
46
|
+
const reanimatedOnDidAnimated = (0, import_react.useCallback)((...args2) => {
|
|
47
|
+
onDidAnimate == null ? void 0 : onDidAnimate(...args2);
|
|
66
48
|
}, [onDidAnimate]);
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
49
|
+
const all = getStyle({
|
|
50
|
+
isEntering,
|
|
51
|
+
exitVariant: presence == null ? void 0 : presence.exitVariant,
|
|
52
|
+
enterVariant: presence == null ? void 0 : presence.enterVariant
|
|
53
|
+
});
|
|
54
|
+
const [animatedStyles, nonAnimatedStyle] = [{}, {}];
|
|
55
|
+
const animatedStyleKey = {
|
|
56
|
+
transform: true,
|
|
57
|
+
opacity: true
|
|
58
|
+
};
|
|
59
|
+
for (const key of Object.keys(all)) {
|
|
60
|
+
if (animatedStyleKey[key]) {
|
|
61
|
+
animatedStyles[key] = all[key];
|
|
62
|
+
} else {
|
|
63
|
+
nonAnimatedStyle[key] = all[key];
|
|
76
64
|
}
|
|
77
|
-
}
|
|
65
|
+
}
|
|
66
|
+
const args = [
|
|
67
|
+
JSON.stringify(all),
|
|
68
|
+
state.mounted,
|
|
69
|
+
state.hover,
|
|
70
|
+
state.press,
|
|
71
|
+
state.pressIn,
|
|
72
|
+
state.focus,
|
|
73
|
+
delay,
|
|
74
|
+
isEntering,
|
|
75
|
+
onDidAnimate,
|
|
76
|
+
reanimatedOnDidAnimated,
|
|
77
|
+
presence == null ? void 0 : presence.exitVariant,
|
|
78
|
+
presence == null ? void 0 : presence.enterVariant
|
|
79
|
+
];
|
|
78
80
|
const animatedStyle = (0, import_react_native_reanimated.useAnimatedStyle)(() => {
|
|
79
|
-
|
|
81
|
+
const style = animatedStyles;
|
|
80
82
|
const final = {
|
|
81
83
|
transform: []
|
|
82
84
|
};
|
|
83
|
-
const isExiting =
|
|
85
|
+
const isExiting = isEntering === false;
|
|
84
86
|
const transition = animations[props.animation];
|
|
85
|
-
const mergedStyles = __spreadValues(__spreadValues({}, style), isExiting && exitStyle);
|
|
86
87
|
const exitingStyleProps = {};
|
|
87
88
|
if (exitStyle) {
|
|
88
89
|
for (const key of Object.keys(exitStyle)) {
|
|
89
90
|
exitingStyleProps[key] = true;
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
|
-
for (const key in
|
|
93
|
-
const value =
|
|
94
|
-
const
|
|
93
|
+
for (const key in style) {
|
|
94
|
+
const value = style[key];
|
|
95
|
+
const aconf = animationConfig(key, transition);
|
|
96
|
+
const { animation, config, shouldRepeat, repeatCount, repeatReverse } = aconf;
|
|
95
97
|
const callback = /* @__PURE__ */ __name((completed, recentValue) => {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
});
|
|
100
|
-
}
|
|
98
|
+
(0, import_react_native_reanimated.runOnJS)(reanimatedOnDidAnimated)(key, completed, recentValue, {
|
|
99
|
+
attemptedValue: value
|
|
100
|
+
});
|
|
101
101
|
if (isExiting) {
|
|
102
102
|
exitingStyleProps[key] = false;
|
|
103
103
|
const areStylesExiting = Object.values(exitingStyleProps).some(Boolean);
|
|
104
104
|
if (!areStylesExiting) {
|
|
105
|
-
|
|
105
|
+
if (safeToUnmount) {
|
|
106
|
+
(0, import_react_native_reanimated.runOnJS)(safeToUnmount)();
|
|
107
|
+
}
|
|
106
108
|
}
|
|
107
109
|
}
|
|
108
110
|
}, "callback");
|
|
@@ -110,83 +112,69 @@ function createAnimations(animations) {
|
|
|
110
112
|
if (key === "transform") {
|
|
111
113
|
if (!Array.isArray(value)) {
|
|
112
114
|
console.error(`Invalid transform value. Needs to be an array.`);
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
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
|
-
}
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
for (const transformObject of value) {
|
|
118
|
+
const key2 = Object.keys(transformObject)[0];
|
|
119
|
+
const transformValue = transformObject[key2];
|
|
120
|
+
let finalValue2 = animation(transformValue, config, callback);
|
|
121
|
+
if (shouldRepeat) {
|
|
122
|
+
finalValue2 = (0, import_react_native_reanimated.withRepeat)(finalValue2, repeatCount, repeatReverse);
|
|
133
123
|
}
|
|
124
|
+
final["transform"].push({
|
|
125
|
+
[key2]: finalValue2
|
|
126
|
+
});
|
|
134
127
|
}
|
|
135
|
-
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
if (typeof value === "object") {
|
|
136
131
|
final[key] = {};
|
|
137
132
|
for (const innerStyleKey of Object.keys(value || {})) {
|
|
138
|
-
let
|
|
133
|
+
let finalValue2 = animation(value, config, callback);
|
|
139
134
|
if (shouldRepeat) {
|
|
140
|
-
|
|
135
|
+
finalValue2 = (0, import_react_native_reanimated.withRepeat)(finalValue2, repeatCount, repeatReverse);
|
|
141
136
|
}
|
|
142
137
|
if (delayMs != null) {
|
|
143
|
-
final[key][innerStyleKey] = (0, import_react_native_reanimated.withDelay)(delayMs,
|
|
138
|
+
final[key][innerStyleKey] = (0, import_react_native_reanimated.withDelay)(delayMs, finalValue2);
|
|
144
139
|
} else {
|
|
145
|
-
final[key][innerStyleKey] =
|
|
140
|
+
final[key][innerStyleKey] = finalValue2;
|
|
146
141
|
}
|
|
147
142
|
}
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
let finalValue = animation(value, config, callback);
|
|
146
|
+
if (shouldRepeat) {
|
|
147
|
+
finalValue = (0, import_react_native_reanimated.withRepeat)(finalValue, repeatCount, repeatReverse);
|
|
148
|
+
}
|
|
149
|
+
if (delayMs != null && typeof delayMs === "number") {
|
|
150
|
+
final[key] = (0, import_react_native_reanimated.withDelay)(delayMs, finalValue);
|
|
148
151
|
} else {
|
|
149
|
-
|
|
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
|
-
}
|
|
152
|
+
final[key] = finalValue;
|
|
158
153
|
}
|
|
159
154
|
}
|
|
155
|
+
if (process.env.NODE_ENV === "development" && props["debug"]) {
|
|
156
|
+
console.log("animation style", final);
|
|
157
|
+
}
|
|
160
158
|
return final;
|
|
161
|
-
},
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
isPresent,
|
|
168
|
-
onDidAnimate,
|
|
169
|
-
reanimatedOnDidAnimated,
|
|
170
|
-
reanimatedSafeToUnmount
|
|
171
|
-
]);
|
|
172
|
-
return {
|
|
173
|
-
style: animatedStyle
|
|
174
|
-
};
|
|
159
|
+
}, args);
|
|
160
|
+
return (0, import_react.useMemo)(() => {
|
|
161
|
+
return {
|
|
162
|
+
style: [nonAnimatedStyle, animatedStyle]
|
|
163
|
+
};
|
|
164
|
+
}, args);
|
|
175
165
|
}
|
|
176
166
|
};
|
|
177
167
|
}
|
|
178
168
|
__name(createAnimations, "createAnimations");
|
|
179
169
|
function animationDelay(key, transition, defaultDelay) {
|
|
180
|
-
var _a, _b;
|
|
181
170
|
"worklet";
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
delayMs = transition.delay;
|
|
171
|
+
if (!transition || !transition[key] || transition[key].delayMs === void 0 || transition[key].delayMs === null) {
|
|
172
|
+
return {
|
|
173
|
+
delayMs: null
|
|
174
|
+
};
|
|
187
175
|
}
|
|
188
176
|
return {
|
|
189
|
-
delayMs
|
|
177
|
+
delayMs: transition[key].delayMs
|
|
190
178
|
};
|
|
191
179
|
}
|
|
192
180
|
__name(animationDelay, "animationDelay");
|
|
@@ -205,7 +193,7 @@ const isColor = /* @__PURE__ */ __name((styleKey) => {
|
|
|
205
193
|
].includes(styleKey);
|
|
206
194
|
}, "isColor");
|
|
207
195
|
function animationConfig(styleProp, transition) {
|
|
208
|
-
var _a, _b, _c, _d, _e
|
|
196
|
+
var _a, _b, _c, _d, _e;
|
|
209
197
|
"worklet";
|
|
210
198
|
const key = styleProp;
|
|
211
199
|
let repeatCount = 0;
|
|
@@ -214,30 +202,23 @@ function animationConfig(styleProp, transition) {
|
|
|
214
202
|
if (isColor(key) || key === "opacity") {
|
|
215
203
|
animationType = "timing";
|
|
216
204
|
}
|
|
205
|
+
if (!transition) {
|
|
206
|
+
return {};
|
|
207
|
+
}
|
|
217
208
|
if ((_a = transition[key]) == null ? void 0 : _a.type) {
|
|
218
209
|
animationType = (_b = transition[key]) == null ? void 0 : _b.type;
|
|
219
|
-
} else if (transition
|
|
210
|
+
} else if (transition.type) {
|
|
220
211
|
animationType = transition.type;
|
|
221
212
|
}
|
|
222
|
-
const loop = ((_c = transition[key]) == null ? void 0 : _c.loop)
|
|
213
|
+
const loop = ((_c = transition[key]) == null ? void 0 : _c.loop) || transition.loop || null;
|
|
223
214
|
if (loop != null) {
|
|
224
215
|
repeatCount = loop ? -1 : 0;
|
|
225
216
|
}
|
|
226
|
-
if (((_d = transition[key]) == null ? void 0 : _d.repeat) != null) {
|
|
227
|
-
repeatCount = (_e = transition[key]) == null ? void 0 : _e.repeat;
|
|
228
|
-
} else if ((transition == null ? void 0 : transition.repeat) != null) {
|
|
229
|
-
repeatCount = transition.repeat;
|
|
230
|
-
}
|
|
231
|
-
if (((_f = transition[key]) == null ? void 0 : _f.repeatReverse) != null) {
|
|
232
|
-
repeatReverse = (_g = transition[key]) == null ? void 0 : _g.repeatReverse;
|
|
233
|
-
} else if ((transition == null ? void 0 : transition.repeatReverse) != null) {
|
|
234
|
-
repeatReverse = transition.repeatReverse;
|
|
235
|
-
}
|
|
236
217
|
let config = {};
|
|
237
|
-
let animation
|
|
218
|
+
let animation;
|
|
238
219
|
if (animationType === "timing") {
|
|
239
|
-
const duration = ((
|
|
240
|
-
const easing = ((
|
|
220
|
+
const duration = ((_d = transition[key]) == null ? void 0 : _d.duration) ?? (transition == null ? void 0 : transition.duration);
|
|
221
|
+
const easing = ((_e = transition[key]) == null ? void 0 : _e.easing) ?? (transition == null ? void 0 : transition.easing);
|
|
241
222
|
if (easing) {
|
|
242
223
|
config["easing"] = easing;
|
|
243
224
|
}
|
|
@@ -301,4 +282,8 @@ const configKeys = [
|
|
|
301
282
|
"stiffness",
|
|
302
283
|
"velocity"
|
|
303
284
|
];
|
|
285
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
286
|
+
0 && (module.exports = {
|
|
287
|
+
createAnimations
|
|
288
|
+
});
|
|
304
289
|
//# sourceMappingURL=createAnimations.js.map
|
|
@@ -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": "
|
|
4
|
+
"sourcesContent": ["import { AnimatePresenceContext, useEntering } from '@tamagui/animate-presence'\nimport { AnimationDriver } from '@tamagui/core'\nimport { useCallback, useContext, useEffect, 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 } & WithTimingConfig)\n | ({ type: 'spring'; loop?: number } & WithSpringConfig)\n | ({ type: 'decay'; loop?: number } & WithDecayConfig)\n// | ({ type: 'transition' } & TransitionProps)\n\nconst AnimatedView = Animated.View\nconst AnimatedText = Animated.Text\n\nAnimatedView['displayName'] = 'AnimatedView'\nAnimatedText['displayName'] = 'AnimatedText'\n\nexport function createAnimations<A extends AnimationsConfig>(animations: A): AnimationDriver<A> {\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 [isEntering, safeToUnmount] = useEntering()\n const presence = useContext(AnimatePresenceContext)\n\n const exitStyle = presence?.exitVariant\n ? staticConfig.variantsParsed?.[presence.exitVariant]?.true || pseudos.exitStyle\n : pseudos.exitStyle\n\n const reanimatedOnDidAnimated = useCallback<NonNullable<typeof onDidAnimate>>(\n (...args) => {\n onDidAnimate?.(...args)\n },\n [onDidAnimate]\n )\n\n const all = getStyle({\n isEntering,\n exitVariant: presence?.exitVariant,\n enterVariant: presence?.enterVariant,\n })\n const [animatedStyles, nonAnimatedStyle] = [{}, {}]\n const animatedStyleKey = {\n transform: true,\n opacity: true,\n }\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 args = [\n JSON.stringify(all),\n state.mounted,\n state.hover,\n state.press,\n state.pressIn,\n state.focus,\n delay,\n isEntering,\n onDidAnimate,\n reanimatedOnDidAnimated,\n presence?.exitVariant,\n presence?.enterVariant,\n ]\n\n const animatedStyle = useAnimatedStyle(() => {\n const style = animatedStyles\n\n const final = {\n transform: [] as any[],\n }\n\n const isExiting = isEntering === false\n const transition = animations[props.animation]\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 style) {\n const value = style[key]\n const aconf = animationConfig(key, transition)\n const { animation, config, shouldRepeat, repeatCount, repeatReverse } = aconf\n\n const callback: (completed: boolean, value?: any) => void = (completed, recentValue) => {\n runOnJS(reanimatedOnDidAnimated)(key, completed, recentValue, {\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 (safeToUnmount) {\n runOnJS(safeToUnmount)()\n }\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 let finalValue = animation(transformValue, config, callback)\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(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 if (process.env.NODE_ENV === 'development' && props['debug']) {\n console.log('animation style', final)\n }\n\n return final\n }, args)\n\n return useMemo(() => {\n return {\n style: [nonAnimatedStyle, animatedStyle],\n }\n }, args)\n },\n }\n}\n\nfunction animationDelay(\n key: string,\n transition: AnimationConfig | undefined,\n defaultDelay?: number\n) {\n 'worklet'\n if (\n !transition ||\n !transition[key] ||\n transition[key].delayMs === undefined ||\n transition[key].delayMs === null\n ) {\n return {\n delayMs: null,\n }\n }\n return {\n delayMs: transition[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 animationConfig<Animate>(styleProp: string, transition: AnimationConfig | undefined) {\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 if (!transition) {\n return {}\n }\n\n // say that we're looking at `width`\n // first, check if we have transition.width.type\n if (transition[key]?.type) {\n animationType = transition[key]?.type\n } else if (transition.type) {\n // otherwise, fallback to transition.type\n animationType = transition.type\n }\n\n const loop = transition[key]?.loop || transition.loop || null\n\n if (loop != null) {\n repeatCount = loop ? -1 : 0\n }\n\n // if (transition[key]?.repeat != null) {\n // repeatCount = transition[key]?.repeat\n // } else if (transition?.repeat != null) {\n // repeatCount = transition.repeat\n // }\n\n // if (transition[key]?.repeatReverse != null) {\n // repeatReverse = transition[key]?.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: any\n\n if (animationType === 'timing') {\n const duration =\n (transition[key] as WithTimingConfig)?.duration ?? (transition as WithTimingConfig)?.duration\n\n const easing =\n (transition[key] as WithTimingConfig)?.easing ?? (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,mBAA4D;AAC5D,qCAWO;AAYP,MAAM,eAAe,uCAAS;AAC9B,MAAM,eAAe,uCAAS;AAE9B,aAAa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V,cAAc;AAAA,IAChB;AACA,UAAM,cAAwC;AAAA,MAC5C;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AACA,gBAAW,QAAQ,CAAC,cAAc;AAnWtC;AAoWM;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;AA1GS;AA4GT,MAAM,aAAyC;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import { AnimatePresenceContext,
|
|
4
|
-
import { useCallback, useContext,
|
|
3
|
+
import { AnimatePresenceContext, useEntering } from "@tamagui/animate-presence";
|
|
4
|
+
import { useCallback, useContext, useMemo } from "react";
|
|
5
5
|
import Animated, {
|
|
6
6
|
runOnJS,
|
|
7
7
|
useAnimatedStyle,
|
|
8
|
-
useSharedValue,
|
|
9
8
|
withDecay,
|
|
10
9
|
withDelay,
|
|
11
10
|
withRepeat,
|
|
@@ -22,61 +21,74 @@ function createAnimations(animations) {
|
|
|
22
21
|
animations,
|
|
23
22
|
View: AnimatedView,
|
|
24
23
|
Text: AnimatedText,
|
|
25
|
-
useAnimations: (props,
|
|
26
|
-
|
|
27
|
-
const
|
|
24
|
+
useAnimations: (props, helpers) => {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
const { pseudos, onDidAnimate, delay, getStyle, state, staticConfig } = helpers;
|
|
27
|
+
const [isEntering, safeToUnmount] = useEntering();
|
|
28
28
|
const presence = useContext(AnimatePresenceContext);
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
"worklet";
|
|
33
|
-
return presence == null ? void 0 : presence.custom;
|
|
34
|
-
}, [presence]);
|
|
35
|
-
const reanimatedOnDidAnimated = useCallback((...args) => {
|
|
36
|
-
onDidAnimate == null ? void 0 : onDidAnimate(...args);
|
|
29
|
+
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;
|
|
30
|
+
const reanimatedOnDidAnimated = useCallback((...args2) => {
|
|
31
|
+
onDidAnimate == null ? void 0 : onDidAnimate(...args2);
|
|
37
32
|
}, [onDidAnimate]);
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
const all = getStyle({
|
|
34
|
+
isEntering,
|
|
35
|
+
exitVariant: presence == null ? void 0 : presence.exitVariant,
|
|
36
|
+
enterVariant: presence == null ? void 0 : presence.enterVariant
|
|
37
|
+
});
|
|
38
|
+
const [animatedStyles, nonAnimatedStyle] = [{}, {}];
|
|
39
|
+
const animatedStyleKey = {
|
|
40
|
+
transform: true,
|
|
41
|
+
opacity: true
|
|
42
|
+
};
|
|
43
|
+
for (const key of Object.keys(all)) {
|
|
44
|
+
if (animatedStyleKey[key]) {
|
|
45
|
+
animatedStyles[key] = all[key];
|
|
46
|
+
} else {
|
|
47
|
+
nonAnimatedStyle[key] = all[key];
|
|
47
48
|
}
|
|
48
|
-
}
|
|
49
|
+
}
|
|
50
|
+
const args = [
|
|
51
|
+
JSON.stringify(all),
|
|
52
|
+
state.mounted,
|
|
53
|
+
state.hover,
|
|
54
|
+
state.press,
|
|
55
|
+
state.pressIn,
|
|
56
|
+
state.focus,
|
|
57
|
+
delay,
|
|
58
|
+
isEntering,
|
|
59
|
+
onDidAnimate,
|
|
60
|
+
reanimatedOnDidAnimated,
|
|
61
|
+
presence == null ? void 0 : presence.exitVariant,
|
|
62
|
+
presence == null ? void 0 : presence.enterVariant
|
|
63
|
+
];
|
|
49
64
|
const animatedStyle = useAnimatedStyle(() => {
|
|
50
|
-
|
|
65
|
+
const style = animatedStyles;
|
|
51
66
|
const final = {
|
|
52
67
|
transform: []
|
|
53
68
|
};
|
|
54
|
-
const isExiting =
|
|
69
|
+
const isExiting = isEntering === false;
|
|
55
70
|
const transition = animations[props.animation];
|
|
56
|
-
const mergedStyles = {
|
|
57
|
-
...style,
|
|
58
|
-
...isExiting && exitStyle
|
|
59
|
-
};
|
|
60
71
|
const exitingStyleProps = {};
|
|
61
72
|
if (exitStyle) {
|
|
62
73
|
for (const key of Object.keys(exitStyle)) {
|
|
63
74
|
exitingStyleProps[key] = true;
|
|
64
75
|
}
|
|
65
76
|
}
|
|
66
|
-
for (const key in
|
|
67
|
-
const value =
|
|
68
|
-
const
|
|
77
|
+
for (const key in style) {
|
|
78
|
+
const value = style[key];
|
|
79
|
+
const aconf = animationConfig(key, transition);
|
|
80
|
+
const { animation, config, shouldRepeat, repeatCount, repeatReverse } = aconf;
|
|
69
81
|
const callback = /* @__PURE__ */ __name((completed, recentValue) => {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
});
|
|
74
|
-
}
|
|
82
|
+
runOnJS(reanimatedOnDidAnimated)(key, completed, recentValue, {
|
|
83
|
+
attemptedValue: value
|
|
84
|
+
});
|
|
75
85
|
if (isExiting) {
|
|
76
86
|
exitingStyleProps[key] = false;
|
|
77
87
|
const areStylesExiting = Object.values(exitingStyleProps).some(Boolean);
|
|
78
88
|
if (!areStylesExiting) {
|
|
79
|
-
|
|
89
|
+
if (safeToUnmount) {
|
|
90
|
+
runOnJS(safeToUnmount)();
|
|
91
|
+
}
|
|
80
92
|
}
|
|
81
93
|
}
|
|
82
94
|
}, "callback");
|
|
@@ -84,83 +96,69 @@ function createAnimations(animations) {
|
|
|
84
96
|
if (key === "transform") {
|
|
85
97
|
if (!Array.isArray(value)) {
|
|
86
98
|
console.error(`Invalid transform value. Needs to be an array.`);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
|
-
}
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
for (const transformObject of value) {
|
|
102
|
+
const key2 = Object.keys(transformObject)[0];
|
|
103
|
+
const transformValue = transformObject[key2];
|
|
104
|
+
let finalValue2 = animation(transformValue, config, callback);
|
|
105
|
+
if (shouldRepeat) {
|
|
106
|
+
finalValue2 = withRepeat(finalValue2, repeatCount, repeatReverse);
|
|
107
107
|
}
|
|
108
|
+
final["transform"].push({
|
|
109
|
+
[key2]: finalValue2
|
|
110
|
+
});
|
|
108
111
|
}
|
|
109
|
-
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
if (typeof value === "object") {
|
|
110
115
|
final[key] = {};
|
|
111
116
|
for (const innerStyleKey of Object.keys(value || {})) {
|
|
112
|
-
let
|
|
117
|
+
let finalValue2 = animation(value, config, callback);
|
|
113
118
|
if (shouldRepeat) {
|
|
114
|
-
|
|
119
|
+
finalValue2 = withRepeat(finalValue2, repeatCount, repeatReverse);
|
|
115
120
|
}
|
|
116
121
|
if (delayMs != null) {
|
|
117
|
-
final[key][innerStyleKey] = withDelay(delayMs,
|
|
122
|
+
final[key][innerStyleKey] = withDelay(delayMs, finalValue2);
|
|
118
123
|
} else {
|
|
119
|
-
final[key][innerStyleKey] =
|
|
124
|
+
final[key][innerStyleKey] = finalValue2;
|
|
120
125
|
}
|
|
121
126
|
}
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
let finalValue = animation(value, config, callback);
|
|
130
|
+
if (shouldRepeat) {
|
|
131
|
+
finalValue = withRepeat(finalValue, repeatCount, repeatReverse);
|
|
132
|
+
}
|
|
133
|
+
if (delayMs != null && typeof delayMs === "number") {
|
|
134
|
+
final[key] = withDelay(delayMs, finalValue);
|
|
122
135
|
} else {
|
|
123
|
-
|
|
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
|
-
}
|
|
136
|
+
final[key] = finalValue;
|
|
132
137
|
}
|
|
133
138
|
}
|
|
139
|
+
if (process.env.NODE_ENV === "development" && props["debug"]) {
|
|
140
|
+
console.log("animation style", final);
|
|
141
|
+
}
|
|
134
142
|
return final;
|
|
135
|
-
},
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
isPresent,
|
|
142
|
-
onDidAnimate,
|
|
143
|
-
reanimatedOnDidAnimated,
|
|
144
|
-
reanimatedSafeToUnmount
|
|
145
|
-
]);
|
|
146
|
-
return {
|
|
147
|
-
style: animatedStyle
|
|
148
|
-
};
|
|
143
|
+
}, args);
|
|
144
|
+
return useMemo(() => {
|
|
145
|
+
return {
|
|
146
|
+
style: [nonAnimatedStyle, animatedStyle]
|
|
147
|
+
};
|
|
148
|
+
}, args);
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
152
|
__name(createAnimations, "createAnimations");
|
|
153
153
|
function animationDelay(key, transition, defaultDelay) {
|
|
154
|
-
var _a, _b;
|
|
155
154
|
"worklet";
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
delayMs = transition.delay;
|
|
155
|
+
if (!transition || !transition[key] || transition[key].delayMs === void 0 || transition[key].delayMs === null) {
|
|
156
|
+
return {
|
|
157
|
+
delayMs: null
|
|
158
|
+
};
|
|
161
159
|
}
|
|
162
160
|
return {
|
|
163
|
-
delayMs
|
|
161
|
+
delayMs: transition[key].delayMs
|
|
164
162
|
};
|
|
165
163
|
}
|
|
166
164
|
__name(animationDelay, "animationDelay");
|
|
@@ -179,7 +177,7 @@ const isColor = /* @__PURE__ */ __name((styleKey) => {
|
|
|
179
177
|
].includes(styleKey);
|
|
180
178
|
}, "isColor");
|
|
181
179
|
function animationConfig(styleProp, transition) {
|
|
182
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
180
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
183
181
|
"worklet";
|
|
184
182
|
const key = styleProp;
|
|
185
183
|
let repeatCount = 0;
|
|
@@ -188,30 +186,23 @@ function animationConfig(styleProp, transition) {
|
|
|
188
186
|
if (isColor(key) || key === "opacity") {
|
|
189
187
|
animationType = "timing";
|
|
190
188
|
}
|
|
189
|
+
if (!transition) {
|
|
190
|
+
return {};
|
|
191
|
+
}
|
|
191
192
|
if ((_a = transition[key]) == null ? void 0 : _a.type) {
|
|
192
193
|
animationType = (_b = transition[key]) == null ? void 0 : _b.type;
|
|
193
|
-
} else if (transition
|
|
194
|
+
} else if (transition.type) {
|
|
194
195
|
animationType = transition.type;
|
|
195
196
|
}
|
|
196
|
-
const loop = (
|
|
197
|
+
const loop = ((_c = transition[key]) == null ? void 0 : _c.loop) || transition.loop || null;
|
|
197
198
|
if (loop != null) {
|
|
198
199
|
repeatCount = loop ? -1 : 0;
|
|
199
200
|
}
|
|
200
|
-
if (((_e = transition[key]) == null ? void 0 : _e.repeat) != null) {
|
|
201
|
-
repeatCount = (_f = transition[key]) == null ? void 0 : _f.repeat;
|
|
202
|
-
} else if ((transition == null ? void 0 : transition.repeat) != null) {
|
|
203
|
-
repeatCount = transition.repeat;
|
|
204
|
-
}
|
|
205
|
-
if (((_g = transition[key]) == null ? void 0 : _g.repeatReverse) != null) {
|
|
206
|
-
repeatReverse = (_h = transition[key]) == null ? void 0 : _h.repeatReverse;
|
|
207
|
-
} else if ((transition == null ? void 0 : transition.repeatReverse) != null) {
|
|
208
|
-
repeatReverse = transition.repeatReverse;
|
|
209
|
-
}
|
|
210
201
|
let config = {};
|
|
211
|
-
let animation
|
|
202
|
+
let animation;
|
|
212
203
|
if (animationType === "timing") {
|
|
213
|
-
const duration = (
|
|
214
|
-
const easing = (
|
|
204
|
+
const duration = (_e = (_d = transition[key]) == null ? void 0 : _d.duration) != null ? _e : transition == null ? void 0 : transition.duration;
|
|
205
|
+
const easing = (_g = (_f = transition[key]) == null ? void 0 : _f.easing) != null ? _g : transition == null ? void 0 : transition.easing;
|
|
215
206
|
if (easing) {
|
|
216
207
|
config["easing"] = easing;
|
|
217
208
|
}
|
|
@@ -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;
|
|
4
|
+
"sourcesContent": ["import { AnimatePresenceContext, useEntering } from '@tamagui/animate-presence'\nimport { AnimationDriver } from '@tamagui/core'\nimport { useCallback, useContext, useEffect, 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 } & WithTimingConfig)\n | ({ type: 'spring'; loop?: number } & WithSpringConfig)\n | ({ type: 'decay'; loop?: number } & WithDecayConfig)\n// | ({ type: 'transition' } & TransitionProps)\n\nconst AnimatedView = Animated.View\nconst AnimatedText = Animated.Text\n\nAnimatedView['displayName'] = 'AnimatedView'\nAnimatedText['displayName'] = 'AnimatedText'\n\nexport function createAnimations<A extends AnimationsConfig>(animations: A): AnimationDriver<A> {\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 [isEntering, safeToUnmount] = useEntering()\n const presence = useContext(AnimatePresenceContext)\n\n const exitStyle = presence?.exitVariant\n ? staticConfig.variantsParsed?.[presence.exitVariant]?.true || pseudos.exitStyle\n : pseudos.exitStyle\n\n const reanimatedOnDidAnimated = useCallback<NonNullable<typeof onDidAnimate>>(\n (...args) => {\n onDidAnimate?.(...args)\n },\n [onDidAnimate]\n )\n\n const all = getStyle({\n isEntering,\n exitVariant: presence?.exitVariant,\n enterVariant: presence?.enterVariant,\n })\n const [animatedStyles, nonAnimatedStyle] = [{}, {}]\n const animatedStyleKey = {\n transform: true,\n opacity: true,\n }\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 args = [\n JSON.stringify(all),\n state.mounted,\n state.hover,\n state.press,\n state.pressIn,\n state.focus,\n delay,\n isEntering,\n onDidAnimate,\n reanimatedOnDidAnimated,\n presence?.exitVariant,\n presence?.enterVariant,\n ]\n\n const animatedStyle = useAnimatedStyle(() => {\n const style = animatedStyles\n\n const final = {\n transform: [] as any[],\n }\n\n const isExiting = isEntering === false\n const transition = animations[props.animation]\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 style) {\n const value = style[key]\n const aconf = animationConfig(key, transition)\n const { animation, config, shouldRepeat, repeatCount, repeatReverse } = aconf\n\n const callback: (completed: boolean, value?: any) => void = (completed, recentValue) => {\n runOnJS(reanimatedOnDidAnimated)(key, completed, recentValue, {\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 (safeToUnmount) {\n runOnJS(safeToUnmount)()\n }\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 let finalValue = animation(transformValue, config, callback)\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(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 if (process.env.NODE_ENV === 'development' && props['debug']) {\n console.log('animation style', final)\n }\n\n return final\n }, args)\n\n return useMemo(() => {\n return {\n style: [nonAnimatedStyle, animatedStyle],\n }\n }, args)\n },\n }\n}\n\nfunction animationDelay(\n key: string,\n transition: AnimationConfig | undefined,\n defaultDelay?: number\n) {\n 'worklet'\n if (\n !transition ||\n !transition[key] ||\n transition[key].delayMs === undefined ||\n transition[key].delayMs === null\n ) {\n return {\n delayMs: null,\n }\n }\n return {\n delayMs: transition[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 animationConfig<Animate>(styleProp: string, transition: AnimationConfig | undefined) {\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 if (!transition) {\n return {}\n }\n\n // say that we're looking at `width`\n // first, check if we have transition.width.type\n if (transition[key]?.type) {\n animationType = transition[key]?.type\n } else if (transition.type) {\n // otherwise, fallback to transition.type\n animationType = transition.type\n }\n\n const loop = transition[key]?.loop || transition.loop || null\n\n if (loop != null) {\n repeatCount = loop ? -1 : 0\n }\n\n // if (transition[key]?.repeat != null) {\n // repeatCount = transition[key]?.repeat\n // } else if (transition?.repeat != null) {\n // repeatCount = transition.repeat\n // }\n\n // if (transition[key]?.repeatReverse != null) {\n // repeatReverse = transition[key]?.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: any\n\n if (animationType === 'timing') {\n const duration =\n (transition[key] as WithTimingConfig)?.duration ?? (transition as WithTimingConfig)?.duration\n\n const easing =\n (transition[key] as WithTimingConfig)?.easing ?? (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;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuBA,MAAM,eAAe,SAAS;AAC9B,MAAM,eAAe,SAAS;AAE9B,aAAa,iBAAiB;AAC9B,aAAa,iBAAiB;AAEvB,0BAAsD,YAAmC;AAC9F,SAAO;AAAA,IACL,cAAc;AAAA,IACd;AAAA,IACA,MAAM;AAAA,IACN,MAAM;AAAA,IACN,eAAe,CAAC,OAAO,YAAY;AAtCvC;AAuCM,YAAM,EAAE,SAAS,cAAc,OAAO,UAAU,OAAO,iBAAiB;AACxE,YAAM,CAAC,YAAY,iBAAiB,YAAY;AAChD,YAAM,WAAW,WAAW,sBAAsB;AAElD,YAAM,YAAY,sCAAU,eACxB,0BAAa,mBAAb,mBAA8B,SAAS,iBAAvC,mBAAqD,SAAQ,QAAQ,YACrE,QAAQ;AAEZ,YAAM,0BAA0B,YAC9B,IAAI,UAAS;AACX,qDAAe,GAAG;AAAA,MACpB,GACA,CAAC,YAAY,CACf;AAEA,YAAM,MAAM,SAAS;AAAA,QACnB;AAAA,QACA,aAAa,qCAAU;AAAA,QACvB,cAAc,qCAAU;AAAA,MAC1B,CAAC;AACD,YAAM,CAAC,gBAAgB,oBAAoB,CAAC,CAAC,GAAG,CAAC,CAAC;AAClD,YAAM,mBAAmB;AAAA,QACvB,WAAW;AAAA,QACX,SAAS;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C,YAAiD,yCAAiC;AAErF,QAAI,QAAQ;AACV,aAAO,YAAY;AAAA,IACrB;AACA,QAAI,YAAY,MAAM;AACpB,aAAO,cAAc;AAAA,IACvB;AACA,gBAAY;AAAA,EACd,WAAW,kBAAkB,UAAU;AACrC,gBAAY;AACZ,aAAS,CAAC;AACV,eAAW,QAAQ,CAAC,cAAc;AA7UtC;AA8UM;AACA,YAAM,sBAAsB,gDAAa,SAAb,oBAAoB;AAChD,YAAM,yBAAyB,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;AAnWtC;AAoWM;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;AA1GS;AA4GT,MAAM,aAAyC;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import { AnimatePresenceContext,
|
|
4
|
-
import { useCallback, useContext,
|
|
3
|
+
import { AnimatePresenceContext, useEntering } from "@tamagui/animate-presence";
|
|
4
|
+
import { useCallback, useContext, useMemo } from "react";
|
|
5
5
|
import Animated, {
|
|
6
6
|
runOnJS,
|
|
7
7
|
useAnimatedStyle,
|
|
8
|
-
useSharedValue,
|
|
9
8
|
withDecay,
|
|
10
9
|
withDelay,
|
|
11
10
|
withRepeat,
|
|
@@ -22,61 +21,74 @@ function createAnimations(animations) {
|
|
|
22
21
|
animations,
|
|
23
22
|
View: AnimatedView,
|
|
24
23
|
Text: AnimatedText,
|
|
25
|
-
useAnimations: (props,
|
|
26
|
-
|
|
27
|
-
const
|
|
24
|
+
useAnimations: (props, helpers) => {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
const { pseudos, onDidAnimate, delay, getStyle, state, staticConfig } = helpers;
|
|
27
|
+
const [isEntering, safeToUnmount] = useEntering();
|
|
28
28
|
const presence = useContext(AnimatePresenceContext);
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
"worklet";
|
|
33
|
-
return presence == null ? void 0 : presence.custom;
|
|
34
|
-
}, [presence]);
|
|
35
|
-
const reanimatedOnDidAnimated = useCallback((...args) => {
|
|
36
|
-
onDidAnimate == null ? void 0 : onDidAnimate(...args);
|
|
29
|
+
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;
|
|
30
|
+
const reanimatedOnDidAnimated = useCallback((...args2) => {
|
|
31
|
+
onDidAnimate == null ? void 0 : onDidAnimate(...args2);
|
|
37
32
|
}, [onDidAnimate]);
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
const all = getStyle({
|
|
34
|
+
isEntering,
|
|
35
|
+
exitVariant: presence == null ? void 0 : presence.exitVariant,
|
|
36
|
+
enterVariant: presence == null ? void 0 : presence.enterVariant
|
|
37
|
+
});
|
|
38
|
+
const [animatedStyles, nonAnimatedStyle] = [{}, {}];
|
|
39
|
+
const animatedStyleKey = {
|
|
40
|
+
transform: true,
|
|
41
|
+
opacity: true
|
|
42
|
+
};
|
|
43
|
+
for (const key of Object.keys(all)) {
|
|
44
|
+
if (animatedStyleKey[key]) {
|
|
45
|
+
animatedStyles[key] = all[key];
|
|
46
|
+
} else {
|
|
47
|
+
nonAnimatedStyle[key] = all[key];
|
|
47
48
|
}
|
|
48
|
-
}
|
|
49
|
+
}
|
|
50
|
+
const args = [
|
|
51
|
+
JSON.stringify(all),
|
|
52
|
+
state.mounted,
|
|
53
|
+
state.hover,
|
|
54
|
+
state.press,
|
|
55
|
+
state.pressIn,
|
|
56
|
+
state.focus,
|
|
57
|
+
delay,
|
|
58
|
+
isEntering,
|
|
59
|
+
onDidAnimate,
|
|
60
|
+
reanimatedOnDidAnimated,
|
|
61
|
+
presence == null ? void 0 : presence.exitVariant,
|
|
62
|
+
presence == null ? void 0 : presence.enterVariant
|
|
63
|
+
];
|
|
49
64
|
const animatedStyle = useAnimatedStyle(() => {
|
|
50
|
-
|
|
65
|
+
const style = animatedStyles;
|
|
51
66
|
const final = {
|
|
52
67
|
transform: []
|
|
53
68
|
};
|
|
54
|
-
const isExiting =
|
|
69
|
+
const isExiting = isEntering === false;
|
|
55
70
|
const transition = animations[props.animation];
|
|
56
|
-
const mergedStyles = {
|
|
57
|
-
...style,
|
|
58
|
-
...isExiting && exitStyle
|
|
59
|
-
};
|
|
60
71
|
const exitingStyleProps = {};
|
|
61
72
|
if (exitStyle) {
|
|
62
73
|
for (const key of Object.keys(exitStyle)) {
|
|
63
74
|
exitingStyleProps[key] = true;
|
|
64
75
|
}
|
|
65
76
|
}
|
|
66
|
-
for (const key in
|
|
67
|
-
const value =
|
|
68
|
-
const
|
|
77
|
+
for (const key in style) {
|
|
78
|
+
const value = style[key];
|
|
79
|
+
const aconf = animationConfig(key, transition);
|
|
80
|
+
const { animation, config, shouldRepeat, repeatCount, repeatReverse } = aconf;
|
|
69
81
|
const callback = /* @__PURE__ */ __name((completed, recentValue) => {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
});
|
|
74
|
-
}
|
|
82
|
+
runOnJS(reanimatedOnDidAnimated)(key, completed, recentValue, {
|
|
83
|
+
attemptedValue: value
|
|
84
|
+
});
|
|
75
85
|
if (isExiting) {
|
|
76
86
|
exitingStyleProps[key] = false;
|
|
77
87
|
const areStylesExiting = Object.values(exitingStyleProps).some(Boolean);
|
|
78
88
|
if (!areStylesExiting) {
|
|
79
|
-
|
|
89
|
+
if (safeToUnmount) {
|
|
90
|
+
runOnJS(safeToUnmount)();
|
|
91
|
+
}
|
|
80
92
|
}
|
|
81
93
|
}
|
|
82
94
|
}, "callback");
|
|
@@ -84,83 +96,69 @@ function createAnimations(animations) {
|
|
|
84
96
|
if (key === "transform") {
|
|
85
97
|
if (!Array.isArray(value)) {
|
|
86
98
|
console.error(`Invalid transform value. Needs to be an array.`);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
|
-
}
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
for (const transformObject of value) {
|
|
102
|
+
const key2 = Object.keys(transformObject)[0];
|
|
103
|
+
const transformValue = transformObject[key2];
|
|
104
|
+
let finalValue2 = animation(transformValue, config, callback);
|
|
105
|
+
if (shouldRepeat) {
|
|
106
|
+
finalValue2 = withRepeat(finalValue2, repeatCount, repeatReverse);
|
|
107
107
|
}
|
|
108
|
+
final["transform"].push({
|
|
109
|
+
[key2]: finalValue2
|
|
110
|
+
});
|
|
108
111
|
}
|
|
109
|
-
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
if (typeof value === "object") {
|
|
110
115
|
final[key] = {};
|
|
111
116
|
for (const innerStyleKey of Object.keys(value || {})) {
|
|
112
|
-
let
|
|
117
|
+
let finalValue2 = animation(value, config, callback);
|
|
113
118
|
if (shouldRepeat) {
|
|
114
|
-
|
|
119
|
+
finalValue2 = withRepeat(finalValue2, repeatCount, repeatReverse);
|
|
115
120
|
}
|
|
116
121
|
if (delayMs != null) {
|
|
117
|
-
final[key][innerStyleKey] = withDelay(delayMs,
|
|
122
|
+
final[key][innerStyleKey] = withDelay(delayMs, finalValue2);
|
|
118
123
|
} else {
|
|
119
|
-
final[key][innerStyleKey] =
|
|
124
|
+
final[key][innerStyleKey] = finalValue2;
|
|
120
125
|
}
|
|
121
126
|
}
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
let finalValue = animation(value, config, callback);
|
|
130
|
+
if (shouldRepeat) {
|
|
131
|
+
finalValue = withRepeat(finalValue, repeatCount, repeatReverse);
|
|
132
|
+
}
|
|
133
|
+
if (delayMs != null && typeof delayMs === "number") {
|
|
134
|
+
final[key] = withDelay(delayMs, finalValue);
|
|
122
135
|
} else {
|
|
123
|
-
|
|
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
|
-
}
|
|
136
|
+
final[key] = finalValue;
|
|
132
137
|
}
|
|
133
138
|
}
|
|
139
|
+
if (process.env.NODE_ENV === "development" && props["debug"]) {
|
|
140
|
+
console.log("animation style", final);
|
|
141
|
+
}
|
|
134
142
|
return final;
|
|
135
|
-
},
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
isPresent,
|
|
142
|
-
onDidAnimate,
|
|
143
|
-
reanimatedOnDidAnimated,
|
|
144
|
-
reanimatedSafeToUnmount
|
|
145
|
-
]);
|
|
146
|
-
return {
|
|
147
|
-
style: animatedStyle
|
|
148
|
-
};
|
|
143
|
+
}, args);
|
|
144
|
+
return useMemo(() => {
|
|
145
|
+
return {
|
|
146
|
+
style: [nonAnimatedStyle, animatedStyle]
|
|
147
|
+
};
|
|
148
|
+
}, args);
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
152
|
__name(createAnimations, "createAnimations");
|
|
153
153
|
function animationDelay(key, transition, defaultDelay) {
|
|
154
|
-
var _a, _b;
|
|
155
154
|
"worklet";
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
delayMs = transition.delay;
|
|
155
|
+
if (!transition || !transition[key] || transition[key].delayMs === void 0 || transition[key].delayMs === null) {
|
|
156
|
+
return {
|
|
157
|
+
delayMs: null
|
|
158
|
+
};
|
|
161
159
|
}
|
|
162
160
|
return {
|
|
163
|
-
delayMs
|
|
161
|
+
delayMs: transition[key].delayMs
|
|
164
162
|
};
|
|
165
163
|
}
|
|
166
164
|
__name(animationDelay, "animationDelay");
|
|
@@ -179,7 +177,7 @@ const isColor = /* @__PURE__ */ __name((styleKey) => {
|
|
|
179
177
|
].includes(styleKey);
|
|
180
178
|
}, "isColor");
|
|
181
179
|
function animationConfig(styleProp, transition) {
|
|
182
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
180
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
183
181
|
"worklet";
|
|
184
182
|
const key = styleProp;
|
|
185
183
|
let repeatCount = 0;
|
|
@@ -188,30 +186,23 @@ function animationConfig(styleProp, transition) {
|
|
|
188
186
|
if (isColor(key) || key === "opacity") {
|
|
189
187
|
animationType = "timing";
|
|
190
188
|
}
|
|
189
|
+
if (!transition) {
|
|
190
|
+
return {};
|
|
191
|
+
}
|
|
191
192
|
if ((_a = transition[key]) == null ? void 0 : _a.type) {
|
|
192
193
|
animationType = (_b = transition[key]) == null ? void 0 : _b.type;
|
|
193
|
-
} else if (transition
|
|
194
|
+
} else if (transition.type) {
|
|
194
195
|
animationType = transition.type;
|
|
195
196
|
}
|
|
196
|
-
const loop = (
|
|
197
|
+
const loop = ((_c = transition[key]) == null ? void 0 : _c.loop) || transition.loop || null;
|
|
197
198
|
if (loop != null) {
|
|
198
199
|
repeatCount = loop ? -1 : 0;
|
|
199
200
|
}
|
|
200
|
-
if (((_e = transition[key]) == null ? void 0 : _e.repeat) != null) {
|
|
201
|
-
repeatCount = (_f = transition[key]) == null ? void 0 : _f.repeat;
|
|
202
|
-
} else if ((transition == null ? void 0 : transition.repeat) != null) {
|
|
203
|
-
repeatCount = transition.repeat;
|
|
204
|
-
}
|
|
205
|
-
if (((_g = transition[key]) == null ? void 0 : _g.repeatReverse) != null) {
|
|
206
|
-
repeatReverse = (_h = transition[key]) == null ? void 0 : _h.repeatReverse;
|
|
207
|
-
} else if ((transition == null ? void 0 : transition.repeatReverse) != null) {
|
|
208
|
-
repeatReverse = transition.repeatReverse;
|
|
209
|
-
}
|
|
210
201
|
let config = {};
|
|
211
|
-
let animation
|
|
202
|
+
let animation;
|
|
212
203
|
if (animationType === "timing") {
|
|
213
|
-
const duration = (
|
|
214
|
-
const easing = (
|
|
204
|
+
const duration = (_e = (_d = transition[key]) == null ? void 0 : _d.duration) != null ? _e : transition == null ? void 0 : transition.duration;
|
|
205
|
+
const easing = (_g = (_f = transition[key]) == null ? void 0 : _f.easing) != null ? _g : transition == null ? void 0 : transition.easing;
|
|
215
206
|
if (easing) {
|
|
216
207
|
config["easing"] = easing;
|
|
217
208
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/animations-reanimated",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.2",
|
|
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.
|
|
16
|
-
"@tamagui/core": "^1.0.0-beta.
|
|
17
|
-
"react-native-reanimated": "^2.
|
|
15
|
+
"@tamagui/animate-presence": "^1.0.0-beta.2",
|
|
16
|
+
"@tamagui/core": "^1.0.0-beta.2",
|
|
17
|
+
"react-native-reanimated": "^2.3.1"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@tamagui/build": "^1.0.0-beta.
|
|
20
|
+
"@tamagui/build": "^1.0.0-beta.2"
|
|
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": "
|
|
31
|
+
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14"
|
|
32
32
|
}
|
|
@@ -1,3 +1,18 @@
|
|
|
1
1
|
import { AnimationDriver } from '@tamagui/core';
|
|
2
|
-
|
|
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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAnimations.d.ts","sourceRoot":"","sources":["../src/createAnimations.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"createAnimations.d.ts","sourceRoot":"","sources":["../src/createAnimations.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAE/C,OAAiB,EACf,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAQjB,MAAM,yBAAyB,CAAA;AAEhC,aAAK,gBAAgB,CAAC,CAAC,SAAS,MAAM,GAAG,GAAG,IAAI;KAC7C,GAAG,IAAI,MAAM,CAAC,GAAG,eAAe;CAClC,CAAA;AAED,aAAK,eAAe,GAChB,CAAC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,gBAAgB,CAAC,GACtD,CAAC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,gBAAgB,CAAC,GACtD,CAAC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,eAAe,CAAC,CAAA;AASxD,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,gBAAgB,EAAE,UAAU,EAAE,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CA+J9F"}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2020 Nate Wienert
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|