@tamagui/animations-react-native 3.0.0-beta.924.1 → 3.0.0

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,584 +0,0 @@
1
- import { getEffectiveAnimation, normalizeTransition } from "@tamagui/animation-helpers";
2
- import { isWeb, useIsomorphicLayoutEffect } from "@tamagui/constants";
3
- import { ResetPresence, usePresence } from "@tamagui/use-presence";
4
- import { useEvent } from "@tamagui/web";
5
- import { useThemeWithState } from "@tamagui/web/internal-runtime";
6
- import React from "react";
7
- import { Animated, processColor } from "react-native-web";
8
-
9
- const isFabric = !isWeb && typeof global !== "undefined" && !!global.__nativeFabricUIManager;
10
- const resolveDynamicValue = (value, isDark) => {
11
- if (value && typeof value === "object" && "dynamic" in value) {
12
- const dynamicValue = isDark ? value.dynamic.dark : value.dynamic.light;
13
- return dynamicValue;
14
- }
15
- return value;
16
- };
17
- const animatedStyleKey = {
18
- transform: true,
19
- opacity: true
20
- };
21
- const colorStyleKey = {
22
- backgroundColor: true,
23
- color: true,
24
- borderColor: true,
25
- borderLeftColor: true,
26
- borderRightColor: true,
27
- borderTopColor: true,
28
- borderBottomColor: true
29
- };
30
- const layoutStyleKey = {
31
- height: true,
32
- width: true,
33
- minHeight: true,
34
- maxHeight: true,
35
- minWidth: true,
36
- maxWidth: true
37
- };
38
- function hasAnimatedLayoutKey(style, isDark, animateOnly) {
39
- for (const key in layoutStyleKey) {
40
- if (animateOnly && !animateOnly.includes(key)) continue;
41
- if (typeof resolveDynamicValue(style[key], isDark) === "number") return true;
42
- }
43
- return false;
44
- }
45
- function isAnimatableColor(value) {
46
- return typeof value === "string" && processColor(value) != null;
47
- }
48
- const costlyToAnimateStyleKey = {
49
- borderRadius: true,
50
- borderTopLeftRadius: true,
51
- borderTopRightRadius: true,
52
- borderBottomLeftRadius: true,
53
- borderBottomRightRadius: true,
54
- borderWidth: true,
55
- borderLeftWidth: true,
56
- borderRightWidth: true,
57
- borderTopWidth: true,
58
- borderBottomWidth: true,
59
- ...colorStyleKey
60
- };
61
- const AnimatedView = Animated.View;
62
- const AnimatedText = Animated.Text;
63
- function useAnimatedNumber(initial) {
64
- const state = React.useRef(null);
65
- if (!state.current) {
66
- state.current = {
67
- composite: null,
68
- val: new Animated.Value(initial),
69
- strategy: { type: "spring" }
70
- };
71
- }
72
- return {
73
- getInstance() {
74
- return state.current.val;
75
- },
76
- getValue() {
77
- return state.current.val["_value"];
78
- },
79
- stop() {
80
- state.current.composite?.stop();
81
- state.current.composite = null;
82
- },
83
- setValue(next, { type, ...config } = { type: "spring" }, onFinish) {
84
- const val = state.current.val;
85
- const handleFinish = onFinish ? ({ finished }) => finished ? onFinish() : null : void 0;
86
- if (type === "direct") {
87
- val.setValue(next);
88
- } else if (type === "spring") {
89
- state.current.composite?.stop();
90
- const composite = Animated.spring(val, {
91
- ...config,
92
- toValue: next,
93
- useNativeDriver: isFabric
94
- });
95
- composite.start(handleFinish);
96
- state.current.composite = composite;
97
- } else {
98
- state.current.composite?.stop();
99
- const composite = Animated.timing(val, {
100
- ...config,
101
- toValue: next,
102
- useNativeDriver: isFabric
103
- });
104
- composite.start(handleFinish);
105
- state.current.composite = composite;
106
- }
107
- }
108
- };
109
- }
110
- const useAnimatedNumberReaction = ({ value }, onValue) => {
111
- const onChange = useEvent((current) => {
112
- onValue(current.value);
113
- });
114
- React.useEffect(() => {
115
- const id = value.getInstance().addListener(onChange);
116
- return () => {
117
- value.getInstance().removeListener(id);
118
- };
119
- }, [value, onChange]);
120
- };
121
- const useAnimatedNumberStyle = (value, getStyle) => {
122
- const instance = value.getInstance();
123
- const animatedStyle = getStyle(instance);
124
- const usesAnimatedNode = hasAnimatedNode(animatedStyle);
125
- const [current, setCurrent] = React.useState(value.getValue());
126
- React.useEffect(() => {
127
- if (usesAnimatedNode) return;
128
- const id = instance.addListener(({ value: next }) => {
129
- setCurrent(next);
130
- });
131
- return () => {
132
- instance.removeListener(id);
133
- };
134
- }, [instance, usesAnimatedNode]);
135
- return usesAnimatedNode ? animatedStyle : getStyle(current);
136
- };
137
- function hasAnimatedNode(value) {
138
- if (!value || typeof value !== "object") return false;
139
- if (typeof value.__getValue === "function") return true;
140
- if (Array.isArray(value)) return value.some(hasAnimatedNode);
141
- return Object.values(value).some(hasAnimatedNode);
142
- }
143
- const useAnimatedNumbersStyle = (vals, getStyle) => {
144
- return getStyle(...vals.map((v) => v.getInstance()));
145
- };
146
- function createAnimations(animations, options) {
147
- const nativeDriver = options?.useNativeDriver ?? isFabric;
148
- return {
149
- inputStyle: "value",
150
- outputStyle: "inline",
151
- avoidReRenders: true,
152
- animations,
153
- needsCustomComponent: true,
154
- View: AnimatedView,
155
- Text: AnimatedText,
156
- useAnimatedNumber,
157
- useAnimatedNumberReaction,
158
- useAnimatedNumberStyle,
159
- useAnimatedNumbersStyle,
160
- usePresence,
161
- ResetPresence,
162
- useAnimations: ({ props, onTransition, style, componentState, presence, stateRef, useStyleEmitter }) => {
163
- const isDisabled = isWeb && componentState.unmounted === true;
164
- const isExiting = presence?.[0] === false;
165
- const sendExitComplete = presence?.[1];
166
- const onTransitionRef = React.useRef(onTransition);
167
- onTransitionRef.current = onTransition;
168
- const emit = (phase, cause, finished) => {
169
- onTransitionRef.current?.(phase === "end" ? {
170
- phase,
171
- cause,
172
- finished
173
- } : {
174
- phase,
175
- cause
176
- });
177
- };
178
- const [, themeState] = useThemeWithState({});
179
- const isDark = themeState?.scheme === "dark" || themeState?.name?.startsWith("dark");
180
- const animateStyles = React.useRef({});
181
- const animatedTranforms = React.useRef([]);
182
- const animationsState = React.useRef(/* @__PURE__ */ new WeakMap());
183
- const pseudoActiveRef = React.useRef(false);
184
- const exitCycleIdRef = React.useRef(0);
185
- const exitCompletedRef = React.useRef(false);
186
- const wasExitingRef = React.useRef(false);
187
- const enterStartedRef = React.useRef(false);
188
- const exitStartedRef = React.useRef(false);
189
- const updateInFlightRef = React.useRef(false);
190
- const updateCycleIdRef = React.useRef(0);
191
- const prevStyleSigRef = React.useRef(null);
192
- const justStartedExiting = isExiting && !wasExitingRef.current;
193
- const justStoppedExiting = !isExiting && wasExitingRef.current;
194
- if (justStartedExiting) {
195
- exitCycleIdRef.current++;
196
- exitCompletedRef.current = false;
197
- }
198
- if (justStoppedExiting) {
199
- exitCycleIdRef.current++;
200
- }
201
- const animateOnly = props.animateOnly || [];
202
- const hasTransitionOnly = !!props.animateOnly;
203
- const isEntering = !!componentState.unmounted;
204
- const wasEnteringRef = React.useRef(isEntering);
205
- const justFinishedEntering = wasEnteringRef.current && !isEntering;
206
- React.useEffect(() => {
207
- wasEnteringRef.current = isEntering;
208
- });
209
- const args = [
210
- JSON.stringify(style),
211
- componentState,
212
- isExiting,
213
- !!onTransition,
214
- isDark,
215
- justFinishedEntering,
216
- hasTransitionOnly
217
- ];
218
- const res = React.useMemo(() => {
219
- const runners = [];
220
- const completions = [];
221
- const animationState = isExiting ? "exit" : isEntering || justFinishedEntering ? "enter" : "default";
222
- const nonAnimatedStyle = {};
223
- const useNativeDriverForNode = nativeDriver && !hasAnimatedLayoutKey(style, isDark, hasTransitionOnly ? animateOnly : void 0);
224
- const seenAnimateKeys = /* @__PURE__ */ new Set();
225
- let sawTransform = false;
226
- let transformCount = 0;
227
- for (const key in style) {
228
- const rawVal = style[key];
229
- const val = resolveDynamicValue(rawVal, isDark);
230
- if (val === void 0) continue;
231
- if (isDisabled) {
232
- continue;
233
- }
234
- if (animatedStyleKey[key] == null && !costlyToAnimateStyleKey[key] && !layoutStyleKey[key]) {
235
- nonAnimatedStyle[key] = val;
236
- continue;
237
- }
238
- if (hasTransitionOnly && !animateOnly.includes(key)) {
239
- nonAnimatedStyle[key] = val;
240
- continue;
241
- }
242
- if (layoutStyleKey[key] && typeof val !== "number") {
243
- nonAnimatedStyle[key] = val;
244
- continue;
245
- }
246
- if (colorStyleKey[key] && !isAnimatableColor(val)) {
247
- nonAnimatedStyle[key] = val;
248
- continue;
249
- }
250
- if (key !== "transform") {
251
- animateStyles.current[key] = update(key, animateStyles.current[key], val);
252
- seenAnimateKeys.add(key);
253
- continue;
254
- }
255
- if (!val) continue;
256
- if (typeof val === "string") {
257
- console.warn(`Warning: Tamagui can't animate string transforms yet!`);
258
- continue;
259
- }
260
- sawTransform = true;
261
- for (const transform of val) {
262
- if (!transform) continue;
263
- const index = transformCount++;
264
- const tkey = Object.keys(transform)[0];
265
- const currentTransform = animatedTranforms.current[index]?.[tkey];
266
- animatedTranforms.current[index] = { [tkey]: update(tkey, currentTransform, transform[tkey]) };
267
- animatedTranforms.current = [...animatedTranforms.current];
268
- }
269
- }
270
- if (!isExiting && !isDisabled && !pseudoActiveRef.current) {
271
- for (const k in animateStyles.current) {
272
- if (!seenAnimateKeys.has(k)) delete animateStyles.current[k];
273
- }
274
- if (!sawTransform) {
275
- if (animatedTranforms.current.length) animatedTranforms.current = [];
276
- } else if (animatedTranforms.current.length > transformCount) {
277
- animatedTranforms.current = animatedTranforms.current.slice(0, transformCount);
278
- }
279
- }
280
- const animatedTransformStyle = animatedTranforms.current.length > 0 ? { transform: animatedTranforms.current.map((r) => {
281
- const key = Object.keys(r)[0];
282
- const val = animationsState.current.get(r[key])?.interpolation || r[key];
283
- return { [key]: val };
284
- }) } : {};
285
- const animatedStyle = {
286
- ...Object.fromEntries(Object.entries(animateStyles.current).map(([k, v]) => [k, animationsState.current.get(v)?.interpolation || v])),
287
- ...animatedTransformStyle
288
- };
289
- return {
290
- runners,
291
- completions,
292
- style: [nonAnimatedStyle, animatedStyle]
293
- };
294
- function update(key, animated, valIn) {
295
- const isColorStyleKey = colorStyleKey[key];
296
- const [val, type] = isColorStyleKey ? [0, void 0] : getValue(valIn);
297
- let animateToValue = val;
298
- const value = animated || new Animated.Value(val);
299
- const curInterpolation = animationsState.current.get(value);
300
- let interpolateArgs;
301
- if (type) {
302
- interpolateArgs = getInterpolated(curInterpolation?.current ?? value["_value"], val, type);
303
- animationsState.current.set(value, {
304
- interpolation: value.interpolate(interpolateArgs),
305
- current: val
306
- });
307
- }
308
- if (isColorStyleKey) {
309
- animateToValue = curInterpolation?.animateToValue ? 0 : 1;
310
- interpolateArgs = getColorInterpolated(curInterpolation?.current, valIn, animateToValue);
311
- animationsState.current.set(value, {
312
- current: valIn,
313
- interpolation: value.interpolate(interpolateArgs),
314
- animateToValue: curInterpolation?.animateToValue ? 0 : 1
315
- });
316
- }
317
- if (value) {
318
- const animationConfig = getAnimationConfig(key, animations, props.transition, animationState);
319
- let resolve;
320
- const promise = new Promise((res2) => {
321
- resolve = res2;
322
- });
323
- completions.push(promise);
324
- runners.push(() => {
325
- value.stopAnimation();
326
- function getAnimation() {
327
- return Animated[animationConfig.type || "spring"](value, {
328
- toValue: animateToValue,
329
- ...animationConfig,
330
- useNativeDriver: useNativeDriverForNode
331
- });
332
- }
333
- const animation = animationConfig.delay ? Animated.sequence([Animated.delay(animationConfig.delay), getAnimation()]) : getAnimation();
334
- animation.start(({ finished }) => {
335
- if (finished || isExiting) {
336
- resolve();
337
- }
338
- });
339
- });
340
- }
341
- if (process.env.NODE_ENV === "development") {
342
- if (props["debug"] === "verbose") {
343
- console.info(" 💠 animate", key, `from (${value["_value"]}) to`, valIn, `(${val})`, "type", type, "interpolate", interpolateArgs);
344
- }
345
- }
346
- return value;
347
- }
348
- }, args);
349
- React.useEffect(() => {
350
- wasExitingRef.current = isExiting;
351
- });
352
- useIsomorphicLayoutEffect(() => {
353
- if (justStoppedExiting && exitStartedRef.current && !exitCompletedRef.current) {
354
- exitStartedRef.current = false;
355
- emit("end", "exit", false);
356
- }
357
- }, [justStoppedExiting]);
358
- useIsomorphicLayoutEffect(() => {
359
- res.runners.forEach((r) => r());
360
- const cycleId = exitCycleIdRef.current;
361
- const cause = isExiting ? "exit" : isEntering || justFinishedEntering ? "enter" : "update";
362
- if (cause === "exit") {
363
- if (enterStartedRef.current) {
364
- enterStartedRef.current = false;
365
- emit("end", "enter", false);
366
- }
367
- if (updateInFlightRef.current) {
368
- updateInFlightRef.current = false;
369
- updateCycleIdRef.current++;
370
- emit("end", "update", false);
371
- }
372
- }
373
- if (cause === "update") {
374
- const sig = args[0];
375
- if (prevStyleSigRef.current === null || prevStyleSigRef.current === sig) {
376
- prevStyleSigRef.current = sig;
377
- return;
378
- }
379
- prevStyleSigRef.current = sig;
380
- if (res.completions.length === 0) return;
381
- if (updateInFlightRef.current) {
382
- emit("end", "update", false);
383
- }
384
- updateInFlightRef.current = true;
385
- const uid = ++updateCycleIdRef.current;
386
- emit("start", "update");
387
- Promise.all(res.completions).then(() => {
388
- if (uid !== updateCycleIdRef.current) return;
389
- updateInFlightRef.current = false;
390
- emit("end", "update", true);
391
- });
392
- return;
393
- }
394
- prevStyleSigRef.current = args[0];
395
- if (res.completions.length === 0) {
396
- emit("start", cause);
397
- emit("end", cause, true);
398
- if (isExiting && !exitCompletedRef.current) {
399
- exitCompletedRef.current = true;
400
- sendExitComplete?.();
401
- }
402
- return;
403
- }
404
- if (cause === "enter" && !enterStartedRef.current) {
405
- enterStartedRef.current = true;
406
- emit("start", "enter");
407
- }
408
- if (cause === "exit" && !exitStartedRef.current) {
409
- exitStartedRef.current = true;
410
- emit("start", "exit");
411
- }
412
- Promise.all(res.completions).then(() => {
413
- if (isExiting && cycleId !== exitCycleIdRef.current) return;
414
- if (isExiting && exitCompletedRef.current) return;
415
- if (isExiting) {
416
- if (exitStartedRef.current) {
417
- exitStartedRef.current = false;
418
- emit("end", "exit", true);
419
- }
420
- exitCompletedRef.current = true;
421
- sendExitComplete?.();
422
- } else if (enterStartedRef.current) {
423
- enterStartedRef.current = false;
424
- emit("end", "enter", true);
425
- }
426
- });
427
- }, args);
428
- useStyleEmitter?.((nextStyle, _effectiveTransition, pseudoActive) => {
429
- pseudoActiveRef.current = pseudoActive === true;
430
- const runners = [];
431
- const seenAnimateKeys = /* @__PURE__ */ new Set();
432
- let transformCount = 0;
433
- let animatedShapeChanged = false;
434
- const useNativeDriverForNode = nativeDriver && !hasAnimatedLayoutKey(nextStyle, isDark) && !Object.keys(animateStyles.current).some((key) => layoutStyleKey[key]);
435
- for (const key in nextStyle) {
436
- const rawVal = nextStyle[key];
437
- const val = resolveDynamicValue(rawVal, isDark);
438
- if (val === void 0) continue;
439
- if (key === "transform" && Array.isArray(val)) {
440
- for (const transform of val) {
441
- if (!transform) continue;
442
- const index = transformCount++;
443
- const tkey = Object.keys(transform)[0];
444
- const currentTransform = animatedTranforms.current[index]?.[tkey];
445
- if (!currentTransform) animatedShapeChanged = true;
446
- animatedTranforms.current[index] = { [tkey]: update(tkey, currentTransform, transform[tkey]) };
447
- }
448
- } else if (animatedStyleKey[key] != null || costlyToAnimateStyleKey[key] || layoutStyleKey[key]) {
449
- if (layoutStyleKey[key] && typeof val !== "number") continue;
450
- if (colorStyleKey[key] && !isAnimatableColor(val)) continue;
451
- if (!animateStyles.current[key]) animatedShapeChanged = true;
452
- animateStyles.current[key] = update(key, animateStyles.current[key], val);
453
- seenAnimateKeys.add(key);
454
- }
455
- }
456
- for (const key in animateStyles.current) {
457
- if (!seenAnimateKeys.has(key)) {
458
- delete animateStyles.current[key];
459
- animatedShapeChanged = true;
460
- }
461
- }
462
- if (animatedTranforms.current.length > transformCount) {
463
- animatedTranforms.current = animatedTranforms.current.slice(0, transformCount);
464
- animatedShapeChanged = true;
465
- }
466
- runners.forEach((r) => r());
467
- if (animatedShapeChanged && stateRef.current.nextState) {
468
- stateRef.current.baseSetStateShallow?.(stateRef.current.nextState);
469
- }
470
- function update(key, animated, valIn) {
471
- const isColor = colorStyleKey[key];
472
- const [numVal, type] = isColor ? [0, void 0] : getValue(valIn);
473
- let animateToValue = numVal;
474
- const value = animated || new Animated.Value(numVal);
475
- const curInterpolation = animationsState.current.get(value);
476
- if (type) {
477
- animationsState.current.set(value, {
478
- interpolation: value.interpolate(getInterpolated(curInterpolation?.current ?? value["_value"], numVal, type)),
479
- current: numVal
480
- });
481
- }
482
- if (isColor) {
483
- animateToValue = curInterpolation?.animateToValue ? 0 : 1;
484
- animationsState.current.set(value, {
485
- current: valIn,
486
- interpolation: value.interpolate(getColorInterpolated(curInterpolation?.current, valIn, animateToValue)),
487
- animateToValue: curInterpolation?.animateToValue ? 0 : 1
488
- });
489
- }
490
- const animationConfig = getAnimationConfig(key, animations, props.transition, "default");
491
- runners.push(() => {
492
- value.stopAnimation();
493
- const anim = Animated[animationConfig.type || "spring"](value, {
494
- toValue: animateToValue,
495
- ...animationConfig,
496
- useNativeDriver: useNativeDriverForNode
497
- });
498
- (animationConfig.delay ? Animated.sequence([Animated.delay(animationConfig.delay), anim]) : anim).start();
499
- });
500
- return value;
501
- }
502
- });
503
- if (process.env.NODE_ENV === "development") {
504
- if (props["debug"] === "verbose") {
505
- console.info(`Animated`, {
506
- response: res,
507
- inputStyle: style,
508
- isExiting
509
- });
510
- }
511
- }
512
- return res;
513
- }
514
- };
515
- }
516
- function getColorInterpolated(currentColor, nextColor, animateToValue) {
517
- const inputRange = [0, 1];
518
- const outputRange = [currentColor ? currentColor : nextColor, nextColor];
519
- if (animateToValue === 0) {
520
- outputRange.reverse();
521
- }
522
- return {
523
- inputRange,
524
- outputRange
525
- };
526
- }
527
- function getInterpolated(current, next, postfix = "deg") {
528
- if (next === current) {
529
- current = next - 1e-9;
530
- }
531
- const inputRange = [current, next];
532
- const outputRange = [`${current}${postfix}`, `${next}${postfix}`];
533
- if (next < current) {
534
- inputRange.reverse();
535
- outputRange.reverse();
536
- }
537
- return {
538
- inputRange,
539
- outputRange
540
- };
541
- }
542
- function getAnimationConfig(key, animations, transition, animationState = "default") {
543
- const normalized = normalizeTransition(transition);
544
- const shortKey = transformShorthands[key];
545
- const propAnimation = normalized.properties[key] ?? normalized.properties[shortKey];
546
- let animationType = null;
547
- let extraConf = {};
548
- if (typeof propAnimation === "string") {
549
- animationType = propAnimation;
550
- } else if (propAnimation && typeof propAnimation === "object") {
551
- animationType = propAnimation.type || getEffectiveAnimation(normalized, animationState);
552
- extraConf = propAnimation;
553
- } else {
554
- animationType = getEffectiveAnimation(normalized, animationState);
555
- }
556
- if (normalized.delay && !extraConf.delay) {
557
- extraConf = {
558
- ...extraConf,
559
- delay: normalized.delay
560
- };
561
- }
562
- const found = animationType ? animations[animationType] : {};
563
- return {
564
- ...found,
565
- ...normalized.config,
566
- ...extraConf
567
- };
568
- }
569
- const transformShorthands = {
570
- x: "translateX",
571
- y: "translateY",
572
- translateX: "x",
573
- translateY: "y"
574
- };
575
- function getValue(input, isColor = false) {
576
- if (typeof input !== "string") {
577
- return [input];
578
- }
579
- const [_, number, after] = input.match(/(-?(?:\d+\.?\d*|\.\d+))(deg|%|px)?/) ?? [];
580
- return [+number, after];
581
- }
582
-
583
- export { AnimatedText, AnimatedView, createAnimations, useAnimatedNumber, useAnimatedNumberReaction, useAnimatedNumberStyle, useAnimatedNumbersStyle };
584
- //# sourceMappingURL=createAnimations.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createAnimations.js","names":[],"sources":["esm/createAnimations.js"],"sourcesContent":["import { getEffectiveAnimation, normalizeTransition } from \"@tamagui/animation-helpers\";\nimport { isWeb, useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { ResetPresence, usePresence } from \"@tamagui/use-presence\";\nimport { useEvent } from \"@tamagui/web\";\nimport { useThemeWithState } from \"@tamagui/web/internal-runtime\";\nimport React from \"react\";\nimport {\n Animated,\n processColor\n} from \"react-native-web\";\nconst isFabric = !isWeb && typeof global !== \"undefined\" && !!global.__nativeFabricUIManager;\nconst resolveDynamicValue = (value, isDark) => {\n if (value && typeof value === \"object\" && \"dynamic\" in value) {\n const dynamicValue = isDark ? value.dynamic.dark : value.dynamic.light;\n return dynamicValue;\n }\n return value;\n};\nconst animatedStyleKey = {\n transform: true,\n opacity: true\n};\nconst colorStyleKey = {\n backgroundColor: true,\n color: true,\n borderColor: true,\n borderLeftColor: true,\n borderRightColor: true,\n borderTopColor: true,\n borderBottomColor: true\n};\nconst layoutStyleKey = {\n height: true,\n width: true,\n minHeight: true,\n maxHeight: true,\n minWidth: true,\n maxWidth: true\n};\nfunction hasAnimatedLayoutKey(style, isDark, animateOnly) {\n for (const key in layoutStyleKey) {\n if (animateOnly && !animateOnly.includes(key)) continue;\n if (typeof resolveDynamicValue(style[key], isDark) === \"number\") return true;\n }\n return false;\n}\nfunction isAnimatableColor(value) {\n return typeof value === \"string\" && processColor(value) != null;\n}\nconst costlyToAnimateStyleKey = {\n borderRadius: true,\n borderTopLeftRadius: true,\n borderTopRightRadius: true,\n borderBottomLeftRadius: true,\n borderBottomRightRadius: true,\n borderWidth: true,\n borderLeftWidth: true,\n borderRightWidth: true,\n borderTopWidth: true,\n borderBottomWidth: true,\n ...colorStyleKey\n};\nconst AnimatedView = Animated.View;\nconst AnimatedText = Animated.Text;\nfunction useAnimatedNumber(initial) {\n const state = React.useRef(\n null\n );\n if (!state.current) {\n state.current = {\n composite: null,\n val: new Animated.Value(initial),\n strategy: { type: \"spring\" }\n };\n }\n return {\n getInstance() {\n return state.current.val;\n },\n getValue() {\n return state.current.val[\"_value\"];\n },\n stop() {\n state.current.composite?.stop();\n state.current.composite = null;\n },\n setValue(next, { type, ...config } = { type: \"spring\" }, onFinish) {\n const val = state.current.val;\n const handleFinish = onFinish ? ({ finished }) => finished ? onFinish() : null : void 0;\n if (type === \"direct\") {\n val.setValue(next);\n } else if (type === \"spring\") {\n state.current.composite?.stop();\n const composite = Animated.spring(val, {\n ...config,\n toValue: next,\n useNativeDriver: isFabric\n });\n composite.start(handleFinish);\n state.current.composite = composite;\n } else {\n state.current.composite?.stop();\n const composite = Animated.timing(val, {\n ...config,\n toValue: next,\n useNativeDriver: isFabric\n });\n composite.start(handleFinish);\n state.current.composite = composite;\n }\n }\n };\n}\nconst useAnimatedNumberReaction = ({ value }, onValue) => {\n const onChange = useEvent((current) => {\n onValue(current.value);\n });\n React.useEffect(() => {\n const id = value.getInstance().addListener(onChange);\n return () => {\n value.getInstance().removeListener(id);\n };\n }, [value, onChange]);\n};\nconst useAnimatedNumberStyle = (value, getStyle) => {\n const instance = value.getInstance();\n const animatedStyle = getStyle(instance);\n const usesAnimatedNode = hasAnimatedNode(animatedStyle);\n const [current, setCurrent] = React.useState(value.getValue());\n React.useEffect(() => {\n if (usesAnimatedNode) return;\n const id = instance.addListener(({ value: next }) => {\n setCurrent(next);\n });\n return () => {\n instance.removeListener(id);\n };\n }, [instance, usesAnimatedNode]);\n return usesAnimatedNode ? animatedStyle : getStyle(current);\n};\nfunction hasAnimatedNode(value) {\n if (!value || typeof value !== \"object\") return false;\n if (typeof value.__getValue === \"function\") return true;\n if (Array.isArray(value)) return value.some(hasAnimatedNode);\n return Object.values(value).some(hasAnimatedNode);\n}\nconst useAnimatedNumbersStyle = (vals, getStyle) => {\n return getStyle(...vals.map((v) => v.getInstance()));\n};\nfunction createAnimations(animations, options) {\n const nativeDriver = options?.useNativeDriver ?? isFabric;\n return {\n inputStyle: \"value\",\n outputStyle: \"inline\",\n avoidReRenders: true,\n animations,\n needsCustomComponent: true,\n View: AnimatedView,\n Text: AnimatedText,\n useAnimatedNumber,\n useAnimatedNumberReaction,\n useAnimatedNumberStyle,\n useAnimatedNumbersStyle,\n usePresence,\n ResetPresence,\n useAnimations: ({\n props,\n onTransition,\n style,\n componentState,\n presence,\n stateRef,\n useStyleEmitter\n }) => {\n const isDisabled = isWeb && componentState.unmounted === true;\n const isExiting = presence?.[0] === false;\n const sendExitComplete = presence?.[1];\n const onTransitionRef = React.useRef(onTransition);\n onTransitionRef.current = onTransition;\n const emit = (phase, cause, finished) => {\n onTransitionRef.current?.(\n phase === \"end\" ? { phase, cause, finished } : { phase, cause }\n );\n };\n const [, themeState] = useThemeWithState({});\n const isDark = themeState?.scheme === \"dark\" || themeState?.name?.startsWith(\"dark\");\n const animateStyles = React.useRef({});\n const animatedTranforms = React.useRef([]);\n const animationsState = React.useRef(\n /* @__PURE__ */ new WeakMap()\n );\n const pseudoActiveRef = React.useRef(false);\n const exitCycleIdRef = React.useRef(0);\n const exitCompletedRef = React.useRef(false);\n const wasExitingRef = React.useRef(false);\n const enterStartedRef = React.useRef(false);\n const exitStartedRef = React.useRef(false);\n const updateInFlightRef = React.useRef(false);\n const updateCycleIdRef = React.useRef(0);\n const prevStyleSigRef = React.useRef(null);\n const justStartedExiting = isExiting && !wasExitingRef.current;\n const justStoppedExiting = !isExiting && wasExitingRef.current;\n if (justStartedExiting) {\n exitCycleIdRef.current++;\n exitCompletedRef.current = false;\n }\n if (justStoppedExiting) {\n exitCycleIdRef.current++;\n }\n const animateOnly = props.animateOnly || [];\n const hasTransitionOnly = !!props.animateOnly;\n const isEntering = !!componentState.unmounted;\n const wasEnteringRef = React.useRef(isEntering);\n const justFinishedEntering = wasEnteringRef.current && !isEntering;\n React.useEffect(() => {\n wasEnteringRef.current = isEntering;\n });\n const args = [\n JSON.stringify(style),\n componentState,\n isExiting,\n !!onTransition,\n isDark,\n justFinishedEntering,\n hasTransitionOnly\n ];\n const res = React.useMemo(() => {\n const runners = [];\n const completions = [];\n const animationState = isExiting ? \"exit\" : isEntering || justFinishedEntering ? \"enter\" : \"default\";\n const nonAnimatedStyle = {};\n const useNativeDriverForNode = nativeDriver && !hasAnimatedLayoutKey(\n style,\n isDark,\n hasTransitionOnly ? animateOnly : void 0\n );\n const seenAnimateKeys = /* @__PURE__ */ new Set();\n let sawTransform = false;\n let transformCount = 0;\n for (const key in style) {\n const rawVal = style[key];\n const val = resolveDynamicValue(rawVal, isDark);\n if (val === void 0) continue;\n if (isDisabled) {\n continue;\n }\n if (animatedStyleKey[key] == null && !costlyToAnimateStyleKey[key] && !layoutStyleKey[key]) {\n nonAnimatedStyle[key] = val;\n continue;\n }\n if (hasTransitionOnly && !animateOnly.includes(key)) {\n nonAnimatedStyle[key] = val;\n continue;\n }\n if (layoutStyleKey[key] && typeof val !== \"number\") {\n nonAnimatedStyle[key] = val;\n continue;\n }\n if (colorStyleKey[key] && !isAnimatableColor(val)) {\n nonAnimatedStyle[key] = val;\n continue;\n }\n if (key !== \"transform\") {\n animateStyles.current[key] = update(key, animateStyles.current[key], val);\n seenAnimateKeys.add(key);\n continue;\n }\n if (!val) continue;\n if (typeof val === \"string\") {\n console.warn(`Warning: Tamagui can't animate string transforms yet!`);\n continue;\n }\n sawTransform = true;\n for (const transform of val) {\n if (!transform) continue;\n const index = transformCount++;\n const tkey = Object.keys(transform)[0];\n const currentTransform = animatedTranforms.current[index]?.[tkey];\n animatedTranforms.current[index] = {\n [tkey]: update(tkey, currentTransform, transform[tkey])\n };\n animatedTranforms.current = [...animatedTranforms.current];\n }\n }\n if (!isExiting && !isDisabled && !pseudoActiveRef.current) {\n for (const k in animateStyles.current) {\n if (!seenAnimateKeys.has(k)) delete animateStyles.current[k];\n }\n if (!sawTransform) {\n if (animatedTranforms.current.length) animatedTranforms.current = [];\n } else if (animatedTranforms.current.length > transformCount) {\n animatedTranforms.current = animatedTranforms.current.slice(0, transformCount);\n }\n }\n const animatedTransformStyle = animatedTranforms.current.length > 0 ? {\n transform: animatedTranforms.current.map((r) => {\n const key = Object.keys(r)[0];\n const val = animationsState.current.get(r[key])?.interpolation || r[key];\n return { [key]: val };\n })\n } : {};\n const animatedStyle = {\n ...Object.fromEntries(\n Object.entries(animateStyles.current).map(([k, v]) => [\n k,\n animationsState.current.get(v)?.interpolation || v\n ])\n ),\n ...animatedTransformStyle\n };\n return {\n runners,\n completions,\n style: [nonAnimatedStyle, animatedStyle]\n };\n function update(key, animated, valIn) {\n const isColorStyleKey = colorStyleKey[key];\n const [val, type] = isColorStyleKey ? [0, void 0] : getValue(valIn);\n let animateToValue = val;\n const value = animated || new Animated.Value(val);\n const curInterpolation = animationsState.current.get(value);\n let interpolateArgs;\n if (type) {\n interpolateArgs = getInterpolated(\n curInterpolation?.current ?? value[\"_value\"],\n val,\n type\n );\n animationsState.current.set(value, {\n interpolation: value.interpolate(interpolateArgs),\n current: val\n });\n }\n if (isColorStyleKey) {\n animateToValue = curInterpolation?.animateToValue ? 0 : 1;\n interpolateArgs = getColorInterpolated(\n curInterpolation?.current,\n // valIn is the next color\n valIn,\n animateToValue\n );\n animationsState.current.set(value, {\n current: valIn,\n interpolation: value.interpolate(interpolateArgs),\n animateToValue: curInterpolation?.animateToValue ? 0 : 1\n });\n }\n if (value) {\n const animationConfig = getAnimationConfig(\n key,\n animations,\n props.transition,\n animationState\n );\n let resolve;\n const promise = new Promise((res2) => {\n resolve = res2;\n });\n completions.push(promise);\n runners.push(() => {\n value.stopAnimation();\n function getAnimation() {\n return Animated[animationConfig.type || \"spring\"](value, {\n toValue: animateToValue,\n ...animationConfig,\n useNativeDriver: useNativeDriverForNode\n });\n }\n const animation = animationConfig.delay ? Animated.sequence([\n Animated.delay(animationConfig.delay),\n getAnimation()\n ]) : getAnimation();\n animation.start(({ finished }) => {\n if (finished || isExiting) {\n resolve();\n }\n });\n });\n }\n if (process.env.NODE_ENV === \"development\") {\n if (props[\"debug\"] === \"verbose\") {\n console.info(\n \" \\u{1F4A0} animate\",\n key,\n `from (${value[\"_value\"]}) to`,\n valIn,\n `(${val})`,\n \"type\",\n type,\n \"interpolate\",\n interpolateArgs\n );\n }\n }\n return value;\n }\n }, args);\n React.useEffect(() => {\n wasExitingRef.current = isExiting;\n });\n useIsomorphicLayoutEffect(() => {\n if (justStoppedExiting && exitStartedRef.current && !exitCompletedRef.current) {\n exitStartedRef.current = false;\n emit(\"end\", \"exit\", false);\n }\n }, [justStoppedExiting]);\n useIsomorphicLayoutEffect(() => {\n res.runners.forEach((r) => r());\n const cycleId = exitCycleIdRef.current;\n const cause = isExiting ? \"exit\" : isEntering || justFinishedEntering ? \"enter\" : \"update\";\n if (cause === \"exit\") {\n if (enterStartedRef.current) {\n enterStartedRef.current = false;\n emit(\"end\", \"enter\", false);\n }\n if (updateInFlightRef.current) {\n updateInFlightRef.current = false;\n updateCycleIdRef.current++;\n emit(\"end\", \"update\", false);\n }\n }\n if (cause === \"update\") {\n const sig = args[0];\n if (prevStyleSigRef.current === null || prevStyleSigRef.current === sig) {\n prevStyleSigRef.current = sig;\n return;\n }\n prevStyleSigRef.current = sig;\n if (res.completions.length === 0) return;\n if (updateInFlightRef.current) {\n emit(\"end\", \"update\", false);\n }\n updateInFlightRef.current = true;\n const uid = ++updateCycleIdRef.current;\n emit(\"start\", \"update\");\n Promise.all(res.completions).then(() => {\n if (uid !== updateCycleIdRef.current) return;\n updateInFlightRef.current = false;\n emit(\"end\", \"update\", true);\n });\n return;\n }\n prevStyleSigRef.current = args[0];\n if (res.completions.length === 0) {\n emit(\"start\", cause);\n emit(\"end\", cause, true);\n if (isExiting && !exitCompletedRef.current) {\n exitCompletedRef.current = true;\n sendExitComplete?.();\n }\n return;\n }\n if (cause === \"enter\" && !enterStartedRef.current) {\n enterStartedRef.current = true;\n emit(\"start\", \"enter\");\n }\n if (cause === \"exit\" && !exitStartedRef.current) {\n exitStartedRef.current = true;\n emit(\"start\", \"exit\");\n }\n Promise.all(res.completions).then(() => {\n if (isExiting && cycleId !== exitCycleIdRef.current) return;\n if (isExiting && exitCompletedRef.current) return;\n if (isExiting) {\n if (exitStartedRef.current) {\n exitStartedRef.current = false;\n emit(\"end\", \"exit\", true);\n }\n exitCompletedRef.current = true;\n sendExitComplete?.();\n } else if (enterStartedRef.current) {\n enterStartedRef.current = false;\n emit(\"end\", \"enter\", true);\n }\n });\n }, args);\n useStyleEmitter?.((nextStyle, _effectiveTransition, pseudoActive) => {\n pseudoActiveRef.current = pseudoActive === true;\n const runners = [];\n const seenAnimateKeys = /* @__PURE__ */ new Set();\n let transformCount = 0;\n let animatedShapeChanged = false;\n const useNativeDriverForNode = nativeDriver && !hasAnimatedLayoutKey(nextStyle, isDark) && !Object.keys(animateStyles.current).some((key) => layoutStyleKey[key]);\n for (const key in nextStyle) {\n const rawVal = nextStyle[key];\n const val = resolveDynamicValue(rawVal, isDark);\n if (val === void 0) continue;\n if (key === \"transform\" && Array.isArray(val)) {\n for (const transform of val) {\n if (!transform) continue;\n const index = transformCount++;\n const tkey = Object.keys(transform)[0];\n const currentTransform = animatedTranforms.current[index]?.[tkey];\n if (!currentTransform) animatedShapeChanged = true;\n animatedTranforms.current[index] = {\n [tkey]: update(tkey, currentTransform, transform[tkey])\n };\n }\n } else if (animatedStyleKey[key] != null || costlyToAnimateStyleKey[key] || layoutStyleKey[key]) {\n if (layoutStyleKey[key] && typeof val !== \"number\") continue;\n if (colorStyleKey[key] && !isAnimatableColor(val)) continue;\n if (!animateStyles.current[key]) animatedShapeChanged = true;\n animateStyles.current[key] = update(key, animateStyles.current[key], val);\n seenAnimateKeys.add(key);\n }\n }\n for (const key in animateStyles.current) {\n if (!seenAnimateKeys.has(key)) {\n delete animateStyles.current[key];\n animatedShapeChanged = true;\n }\n }\n if (animatedTranforms.current.length > transformCount) {\n animatedTranforms.current = animatedTranforms.current.slice(0, transformCount);\n animatedShapeChanged = true;\n }\n runners.forEach((r) => r());\n if (animatedShapeChanged && stateRef.current.nextState) {\n stateRef.current.baseSetStateShallow?.(stateRef.current.nextState);\n }\n function update(key, animated, valIn) {\n const isColor = colorStyleKey[key];\n const [numVal, type] = isColor ? [0, void 0] : getValue(valIn);\n let animateToValue = numVal;\n const value = animated || new Animated.Value(numVal);\n const curInterpolation = animationsState.current.get(value);\n if (type) {\n animationsState.current.set(value, {\n interpolation: value.interpolate(\n getInterpolated(\n curInterpolation?.current ?? value[\"_value\"],\n numVal,\n type\n )\n ),\n current: numVal\n });\n }\n if (isColor) {\n animateToValue = curInterpolation?.animateToValue ? 0 : 1;\n animationsState.current.set(value, {\n current: valIn,\n interpolation: value.interpolate(\n getColorInterpolated(\n curInterpolation?.current,\n valIn,\n animateToValue\n )\n ),\n animateToValue: curInterpolation?.animateToValue ? 0 : 1\n });\n }\n const animationConfig = getAnimationConfig(\n key,\n animations,\n props.transition,\n \"default\"\n );\n runners.push(() => {\n value.stopAnimation();\n const anim = Animated[animationConfig.type || \"spring\"](value, {\n toValue: animateToValue,\n ...animationConfig,\n useNativeDriver: useNativeDriverForNode\n });\n (animationConfig.delay ? Animated.sequence([Animated.delay(animationConfig.delay), anim]) : anim).start();\n });\n return value;\n }\n });\n if (process.env.NODE_ENV === \"development\") {\n if (props[\"debug\"] === \"verbose\") {\n console.info(`Animated`, { response: res, inputStyle: style, isExiting });\n }\n }\n return res;\n }\n };\n}\nfunction getColorInterpolated(currentColor, nextColor, animateToValue) {\n const inputRange = [0, 1];\n const outputRange = [currentColor ? currentColor : nextColor, nextColor];\n if (animateToValue === 0) {\n outputRange.reverse();\n }\n return {\n inputRange,\n outputRange\n };\n}\nfunction getInterpolated(current, next, postfix = \"deg\") {\n if (next === current) {\n current = next - 1e-9;\n }\n const inputRange = [current, next];\n const outputRange = [`${current}${postfix}`, `${next}${postfix}`];\n if (next < current) {\n inputRange.reverse();\n outputRange.reverse();\n }\n return {\n inputRange,\n outputRange\n };\n}\nfunction getAnimationConfig(key, animations, transition, animationState = \"default\") {\n const normalized = normalizeTransition(transition);\n const shortKey = transformShorthands[key];\n const propAnimation = normalized.properties[key] ?? normalized.properties[shortKey];\n let animationType = null;\n let extraConf = {};\n if (typeof propAnimation === \"string\") {\n animationType = propAnimation;\n } else if (propAnimation && typeof propAnimation === \"object\") {\n animationType = propAnimation.type || getEffectiveAnimation(normalized, animationState);\n extraConf = propAnimation;\n } else {\n animationType = getEffectiveAnimation(normalized, animationState);\n }\n if (normalized.delay && !extraConf.delay) {\n extraConf = { ...extraConf, delay: normalized.delay };\n }\n const found = animationType ? animations[animationType] : {};\n return {\n ...found,\n // Apply global spring config overrides (from transition={['bouncy', { stiffness: 1000 }]})\n ...normalized.config,\n // Property-specific config takes highest precedence\n ...extraConf\n };\n}\nconst transformShorthands = {\n x: \"translateX\",\n y: \"translateY\",\n translateX: \"x\",\n translateY: \"y\"\n};\nfunction getValue(input, isColor = false) {\n if (typeof input !== \"string\") {\n return [input];\n }\n const [_, number, after] = input.match(/(-?(?:\\d+\\.?\\d*|\\.\\d+))(deg|%|px)?/) ?? [];\n return [+number, after];\n}\nexport {\n AnimatedText,\n AnimatedView,\n createAnimations,\n useAnimatedNumber,\n useAnimatedNumberReaction,\n useAnimatedNumberStyle,\n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