@hanzogui/animations-reanimated 7.3.1 → 8.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.
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { getEffectiveAnimation, normalizeTransition } from "@hanzogui/animation-helpers";
3
3
  import { getSplitStyles, hooks, isWeb, Text, useComposedRefs, useEvent, useIsomorphicLayoutEffect, useThemeWithState, View } from "@hanzogui/core";
4
4
  import { ResetPresence, usePresence } from "@hanzogui/use-presence";
5
+ import normalizeColor from "@react-native/normalize-colors";
5
6
  import React, { forwardRef, useMemo, useRef } from "react";
6
7
  import Animated_, { cancelAnimation, runOnJS, runOnUI, useAnimatedReaction, useAnimatedStyle, useDerivedValue, useSharedValue, withDelay, withSpring, withTiming } from "react-native-reanimated";
7
8
  function _type_of(obj) {
@@ -17,6 +18,16 @@ var getDefaultExport = function (module) {
17
18
  return mod;
18
19
  };
19
20
  var Animated = getDefaultExport(Animated_);
21
+ var silenceAnimatedComponentDevCheck = function (style) {
22
+ if (process.env.NODE_ENV !== "development" || isWeb || !style || (typeof style === "undefined" ? "undefined" : _type_of(style)) !== "object") {
23
+ return;
24
+ }
25
+ Object.defineProperty(style, "_requiresAnimatedComponent", {
26
+ configurable: true,
27
+ enumerable: false,
28
+ value: true
29
+ });
30
+ };
20
31
  var resolveDynamicValue = function (value, isDark) {
21
32
  if (value !== null && (typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && "dynamic" in value && _type_of(value.dynamic) === "object") {
22
33
  var dynamic = value.dynamic;
@@ -24,21 +35,372 @@ var resolveDynamicValue = function (value, isDark) {
24
35
  }
25
36
  return value;
26
37
  };
27
- var applyAnimation = function (targetValue, config, callback) {
38
+ var updateMapperState = isWeb ? function (state, emitted) {
39
+ state.value.emitted = emitted;
40
+ } : function (state, emitted) {
28
41
  "worklet";
29
42
 
43
+ if (!globalThis._WORKLET) return;
44
+ state.modify(function (current) {
45
+ current.emitted = emitted;
46
+ return current;
47
+ }, false);
48
+ };
49
+ var cloneAnimationValue = function (value) {
50
+ if (Array.isArray(value)) {
51
+ return value.map(cloneAnimationValue);
52
+ }
53
+ if (value && (typeof value === "undefined" ? "undefined" : _type_of(value)) === "object") {
54
+ var next = {};
55
+ for (var key in value) {
56
+ next[key] = cloneAnimationValue(value[key]);
57
+ }
58
+ return next;
59
+ }
60
+ return value;
61
+ };
62
+ var cloneStyleRecord = function (style) {
63
+ var next = {};
64
+ for (var key in style) {
65
+ next[key] = cloneAnimationValue(style[key]);
66
+ }
67
+ return next;
68
+ };
69
+ var cloneTransitionConfig = function (config) {
70
+ return cloneAnimationValue(config);
71
+ };
72
+ var getAnimatedTransforms = function (value) {
73
+ if (!Array.isArray(value)) return [];
74
+ return value.filter(function (item) {
75
+ return item !== null && (typeof item === "undefined" ? "undefined" : _type_of(item)) === "object" && !Array.isArray(item);
76
+ });
77
+ };
78
+ var getRemovedAnimatedKeys = function (current, previous) {
79
+ var removedKeys = {};
80
+ var _iteratorNormalCompletion = true,
81
+ _didIteratorError = false,
82
+ _iteratorError = void 0;
83
+ try {
84
+ for (var _iterator = previous[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
85
+ var key = _step.value;
86
+ if (!current.has(key)) removedKeys[key] = true;
87
+ }
88
+ } catch (err) {
89
+ _didIteratorError = true;
90
+ _iteratorError = err;
91
+ } finally {
92
+ try {
93
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
94
+ _iterator.return();
95
+ }
96
+ } finally {
97
+ if (_didIteratorError) {
98
+ throw _iteratorError;
99
+ }
100
+ }
101
+ }
102
+ return removedKeys;
103
+ };
104
+ var getImplicitDefault = function (key, targetValue) {
105
+ "worklet";
106
+
107
+ var value = key === "opacity" || key === "scale" || key === "scaleX" || key === "scaleY" ? 1 : 0;
108
+ if (typeof targetValue !== "string") return value;
109
+ var suffixIndex = 0;
110
+ while (suffixIndex < targetValue.length) {
111
+ var character = targetValue[suffixIndex];
112
+ var code = character.charCodeAt(0);
113
+ if (code >= 48 && code <= 57 || character === "." || character === "-" || character === "+") {
114
+ suffixIndex++;
115
+ } else {
116
+ break;
117
+ }
118
+ }
119
+ return suffixIndex > 0 ? `${value}${targetValue.slice(suffixIndex)}` : value;
120
+ };
121
+ var COLOR_STYLE_KEYS = {
122
+ backgroundColor: true,
123
+ borderColor: true,
124
+ borderLeftColor: true,
125
+ borderRightColor: true,
126
+ borderTopColor: true,
127
+ borderBottomColor: true,
128
+ color: true
129
+ };
130
+ var toReanimatedColor = function (value) {
131
+ "worklet";
132
+
133
+ if (typeof value === "number") {
134
+ var color = value >>> 0;
135
+ var alpha = (color >>> 24 & 255) / 255;
136
+ var red = color >>> 16 & 255;
137
+ var green = color >>> 8 & 255;
138
+ var blue = color & 255;
139
+ return `rgba(${red}, ${green}, ${blue}, ${alpha})`;
140
+ }
141
+ if (typeof value !== "string") return value;
142
+ var trimmed = value.trim();
143
+ if (trimmed === "transparent") return "rgba(0, 0, 0, 0)";
144
+ return trimmed;
145
+ };
146
+ var isReanimatedColorHistory = function (value) {
147
+ "worklet";
148
+
149
+ var normalized = toReanimatedColor(value);
150
+ return typeof normalized === "string" && normalized.startsWith("rgba(");
151
+ };
152
+ var normalizeAnimationColor = function (value) {
153
+ if (typeof value === "number") {
154
+ return toReanimatedColor(value);
155
+ }
156
+ if (typeof value !== "string") return;
157
+ var color = normalizeColor(value);
158
+ if (color == null) return;
159
+ var red = Math.round((color & 4278190080) >>> 24);
160
+ var green = Math.round((color & 16711680) >>> 16);
161
+ var blue = Math.round((color & 65280) >>> 8);
162
+ var alpha = (color & 255) / 255;
163
+ return `rgba(${red}, ${green}, ${blue}, ${alpha})`;
164
+ };
165
+ var buildSnapshot = function (animated, statics, transforms, previousKeys, lastPainted) {
166
+ var snapshotAnimated = {};
167
+ var snapshotStatics = cloneStyleRecord(statics);
168
+ for (var key in snapshotStatics) {
169
+ if (!COLOR_STYLE_KEYS[key]) continue;
170
+ var normalized = normalizeAnimationColor(snapshotStatics[key]);
171
+ if (normalized !== void 0) snapshotStatics[key] = normalized;
172
+ }
173
+ for (var key1 in animated) {
174
+ if (key1 === "transform") continue;
175
+ var value = animated[key1];
176
+ if (COLOR_STYLE_KEYS[key1]) {
177
+ var normalized1 = normalizeAnimationColor(value);
178
+ if (normalized1 === void 0) {
179
+ snapshotStatics[key1] = cloneAnimationValue(value);
180
+ continue;
181
+ }
182
+ snapshotAnimated[key1] = normalized1;
183
+ } else {
184
+ snapshotAnimated[key1] = cloneAnimationValue(value);
185
+ }
186
+ }
187
+ var snapshotTransforms = transforms.map(cloneStyleRecord);
188
+ var keys = new Set(Object.keys(snapshotAnimated));
189
+ var _iteratorNormalCompletion = true,
190
+ _didIteratorError = false,
191
+ _iteratorError = void 0;
192
+ try {
193
+ for (var _iterator = snapshotTransforms[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
194
+ var transform = _step.value;
195
+ var key2 = Object.keys(transform)[0];
196
+ var value1 = key2 ? transform[key2] : void 0;
197
+ if (key2 && (typeof value1 === "number" || typeof value1 === "string")) {
198
+ keys.add(`transform:${key2}`);
199
+ }
200
+ }
201
+ } catch (err) {
202
+ _didIteratorError = true;
203
+ _iteratorError = err;
204
+ } finally {
205
+ try {
206
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
207
+ _iterator.return();
208
+ }
209
+ } finally {
210
+ if (_didIteratorError) {
211
+ throw _iteratorError;
212
+ }
213
+ }
214
+ }
215
+ var seeds = {};
216
+ var _iteratorNormalCompletion1 = true,
217
+ _didIteratorError1 = false,
218
+ _iteratorError1 = void 0;
219
+ try {
220
+ for (var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
221
+ var key3 = _step1.value;
222
+ var value2 = lastPainted[key3];
223
+ if (typeof value2 !== "number" && typeof value2 !== "string") continue;
224
+ if (value2 === "auto" || typeof value2 === "string" && value2.startsWith("calc")) {
225
+ continue;
226
+ }
227
+ if (COLOR_STYLE_KEYS[key3]) value2 = normalizeAnimationColor(value2);
228
+ if (value2 !== void 0) seeds[key3] = value2;
229
+ }
230
+ } catch (err) {
231
+ _didIteratorError1 = true;
232
+ _iteratorError1 = err;
233
+ } finally {
234
+ try {
235
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
236
+ _iterator1.return();
237
+ }
238
+ } finally {
239
+ if (_didIteratorError1) {
240
+ throw _iteratorError1;
241
+ }
242
+ }
243
+ }
244
+ var gatedKeys = {};
245
+ var _iteratorNormalCompletion2 = true,
246
+ _didIteratorError2 = false,
247
+ _iteratorError2 = void 0;
248
+ try {
249
+ for (var _iterator2 = keys[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
250
+ var key4 = _step2.value;
251
+ gatedKeys[key4] = true;
252
+ }
253
+ } catch (err) {
254
+ _didIteratorError2 = true;
255
+ _iteratorError2 = err;
256
+ } finally {
257
+ try {
258
+ if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
259
+ _iterator2.return();
260
+ }
261
+ } finally {
262
+ if (_didIteratorError2) {
263
+ throw _iteratorError2;
264
+ }
265
+ }
266
+ }
267
+ var removedKeys = getRemovedAnimatedKeys(keys, previousKeys);
268
+ var painted = {
269
+ ...snapshotStatics,
270
+ ...snapshotAnimated
271
+ };
272
+ var staticTransforms = getAnimatedTransforms(snapshotStatics.transform);
273
+ delete painted.transform;
274
+ var _iteratorNormalCompletion3 = true,
275
+ _didIteratorError3 = false,
276
+ _iteratorError3 = void 0;
277
+ try {
278
+ for (var _iterator3 = staticTransforms[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
279
+ var transform1 = _step3.value;
280
+ var key5 = Object.keys(transform1)[0];
281
+ if (key5) painted[`transform:${key5}`] = transform1[key5];
282
+ }
283
+ } catch (err) {
284
+ _didIteratorError3 = true;
285
+ _iteratorError3 = err;
286
+ } finally {
287
+ try {
288
+ if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
289
+ _iterator3.return();
290
+ }
291
+ } finally {
292
+ if (_didIteratorError3) {
293
+ throw _iteratorError3;
294
+ }
295
+ }
296
+ }
297
+ var _iteratorNormalCompletion4 = true,
298
+ _didIteratorError4 = false,
299
+ _iteratorError4 = void 0;
300
+ try {
301
+ for (var _iterator4 = snapshotTransforms[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
302
+ var transform2 = _step4.value;
303
+ var key6 = Object.keys(transform2)[0];
304
+ if (key6) painted[`transform:${key6}`] = transform2[key6];
305
+ }
306
+ } catch (err) {
307
+ _didIteratorError4 = true;
308
+ _iteratorError4 = err;
309
+ } finally {
310
+ try {
311
+ if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
312
+ _iterator4.return();
313
+ }
314
+ } finally {
315
+ if (_didIteratorError4) {
316
+ throw _iteratorError4;
317
+ }
318
+ }
319
+ }
320
+ return {
321
+ value: {
322
+ animated: snapshotAnimated,
323
+ statics: snapshotStatics,
324
+ transforms: snapshotTransforms,
325
+ gatedKeys,
326
+ seeds,
327
+ removedKeys,
328
+ removeTransform: Object.keys(removedKeys).some(function (key7) {
329
+ return key7.startsWith("transform:");
330
+ }),
331
+ clearValue: isWeb ? "" : null
332
+ },
333
+ painted,
334
+ keys
335
+ };
336
+ };
337
+ var getGatedKeys = function (snapshot) {
338
+ return Object.keys(snapshot.gatedKeys);
339
+ };
340
+ var createReanimatedConfig = function (config) {
341
+ "worklet";
342
+
343
+ var next = {};
344
+ var source = config;
345
+ for (var key in source) {
346
+ if (key === "type" || key === "delay") continue;
347
+ var value = source[key];
348
+ if (value !== void 0) {
349
+ next[key] = value;
350
+ }
351
+ }
352
+ return next;
353
+ };
354
+ var applyAnimation = function (targetValue, config, callback, seedValue) {
355
+ "worklet";
356
+
357
+ var validateStartAsColor = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : false;
30
358
  var delay = config.delay;
359
+ var reanimatedConfig = createReanimatedConfig(config);
31
360
  var animatedValue;
32
361
  if (config.type === "timing") {
33
- animatedValue = withTiming(targetValue, config, callback);
362
+ animatedValue = withTiming(targetValue, reanimatedConfig, callback);
34
363
  } else {
35
- animatedValue = withSpring(targetValue, config, callback);
364
+ animatedValue = withSpring(targetValue, reanimatedConfig, callback);
365
+ }
366
+ if (seedValue !== void 0 || validateStartAsColor) {
367
+ var innerOnStart = animatedValue.onStart;
368
+ animatedValue.onStart = function (animation, value, timestamp, previousAnimation) {
369
+ "worklet";
370
+
371
+ var startValue = validateStartAsColor ? isReanimatedColorHistory(value) ? toReanimatedColor(value) : seedValue !== null && seedValue !== void 0 ? seedValue : targetValue : seedValue;
372
+ innerOnStart(animation, startValue, timestamp, previousAnimation);
373
+ };
36
374
  }
37
375
  if (delay && delay > 0) {
38
376
  animatedValue = withDelay(delay, animatedValue);
39
377
  }
40
378
  return animatedValue;
41
379
  };
380
+ var animateSnapshotValue = function (key, implicitKey, targetValue, config, previouslyEmitted, seedValue, gated, currentlyExiting, exitCycleId, currentlyCompletingAnimation, didAnimateCycleId, markExitKeyDone, markDidAnimateKeyDone) {
381
+ "worklet";
382
+
383
+ var validateStartAsColor = arguments.length > 13 && arguments[13] !== void 0 ? arguments[13] : false;
384
+ var cycleGated = gated && (currentlyExiting || currentlyCompletingAnimation);
385
+ if (!previouslyEmitted && seedValue === void 0 && !cycleGated) {
386
+ return targetValue;
387
+ }
388
+ var callback;
389
+ if (gated && currentlyExiting) {
390
+ callback = function (finished) {
391
+ "worklet";
392
+
393
+ runOnJS(markExitKeyDone)(key, exitCycleId, finished !== null && finished !== void 0 ? finished : false);
394
+ };
395
+ } else if (gated && currentlyCompletingAnimation) {
396
+ callback = function (finished) {
397
+ "worklet";
398
+
399
+ runOnJS(markDidAnimateKeyDone)(key, didAnimateCycleId, finished !== null && finished !== void 0 ? finished : false);
400
+ };
401
+ }
402
+ return applyAnimation(targetValue, config, callback, previouslyEmitted ? void 0 : seedValue !== null && seedValue !== void 0 ? seedValue : getImplicitDefault(implicitKey, targetValue), validateStartAsColor);
403
+ };
42
404
  var ANIMATABLE_PROPERTIES = {
43
405
  // Transform
44
406
  transform: true,
@@ -113,6 +475,23 @@ var canAnimateProperty = function (key, value, animateOnly) {
113
475
  if (animateOnly && !animateOnly.includes(key)) return false;
114
476
  return true;
115
477
  };
478
+ var splitAnimationStyles = function (style, isDark, disableAnimation, animateOnly) {
479
+ var animated = {};
480
+ var statics = {};
481
+ for (var key in style) {
482
+ var value = resolveDynamicValue(style[key], isDark);
483
+ if (value === void 0) continue;
484
+ if (!disableAnimation && canAnimateProperty(key, value, animateOnly)) {
485
+ animated[key] = cloneAnimationValue(value);
486
+ } else {
487
+ statics[key] = cloneAnimationValue(value);
488
+ }
489
+ }
490
+ return {
491
+ animated,
492
+ statics
493
+ };
494
+ };
116
495
  function createWebAnimatedComponent(defaultTag) {
117
496
  var isText = defaultTag === "span";
118
497
  var Component = Animated.createAnimatedComponent(/* @__PURE__ */forwardRef(function (propsIn, ref) {
@@ -155,27 +534,27 @@ function buildTransitionConfig(transition, animations, animationState, styleKeys
155
534
  var normalized = normalizeTransition(transition);
156
535
  var effectiveKey = getEffectiveAnimation(normalized, animationState);
157
536
  var _animations_effectiveKey;
158
- var base = effectiveKey ? (_animations_effectiveKey = animations[effectiveKey]) !== null && _animations_effectiveKey !== void 0 ? _animations_effectiveKey : {
537
+ var base = cloneTransitionConfig(effectiveKey ? (_animations_effectiveKey = animations[effectiveKey]) !== null && _animations_effectiveKey !== void 0 ? _animations_effectiveKey : {
159
538
  type: "spring"
160
539
  } : {
161
540
  type: "spring"
162
- };
541
+ });
163
542
  if (normalized.delay) {
164
- base = {
543
+ base = cloneTransitionConfig({
165
544
  ...base,
166
545
  delay: normalized.delay
167
- };
546
+ });
168
547
  }
169
548
  if (normalized.config) {
170
- base = {
549
+ base = cloneTransitionConfig({
171
550
  ...base,
172
551
  ...normalized.config
173
- };
552
+ });
174
553
  if (base.type !== "timing" && normalized.config.duration !== void 0 && normalized.config.damping === void 0 && normalized.config.stiffness === void 0 && normalized.config.mass === void 0) {
175
- base = {
554
+ base = cloneTransitionConfig({
176
555
  ...base,
177
556
  type: "timing"
178
- };
557
+ });
179
558
  }
180
559
  }
181
560
  var propertyConfigs = {};
@@ -188,17 +567,17 @@ function buildTransitionConfig(transition, animations, animationState, styleKeys
188
567
  var propAnimation = normalized.properties[key];
189
568
  if (typeof propAnimation === "string") {
190
569
  var _animations_propAnimation;
191
- propertyConfigs[key] = (_animations_propAnimation = animations[propAnimation]) !== null && _animations_propAnimation !== void 0 ? _animations_propAnimation : base;
570
+ propertyConfigs[key] = cloneTransitionConfig((_animations_propAnimation = animations[propAnimation]) !== null && _animations_propAnimation !== void 0 ? _animations_propAnimation : base);
192
571
  } else if (propAnimation && (typeof propAnimation === "undefined" ? "undefined" : _type_of(propAnimation)) === "object") {
193
572
  var configType = propAnimation.type;
194
573
  var _animations_configType;
195
574
  var baseForProp = configType ? (_animations_configType = animations[configType]) !== null && _animations_configType !== void 0 ? _animations_configType : base : base;
196
- propertyConfigs[key] = {
575
+ propertyConfigs[key] = cloneTransitionConfig({
197
576
  ...baseForProp,
198
577
  ...propAnimation
199
- };
578
+ });
200
579
  } else {
201
- propertyConfigs[key] = base;
580
+ propertyConfigs[key] = cloneTransitionConfig(base);
202
581
  }
203
582
  }
204
583
  } catch (err) {
@@ -253,10 +632,10 @@ function getStyleKeys(style) {
253
632
  function createAnimations(animationsConfig) {
254
633
  var animations = {};
255
634
  for (var key in animationsConfig) {
256
- animations[key] = {
635
+ animations[key] = cloneTransitionConfig({
257
636
  type: "spring",
258
637
  ...animationsConfig[key]
259
- };
638
+ });
260
639
  }
261
640
  return {
262
641
  needsCustomComponent: true,
@@ -295,19 +674,22 @@ function createAnimations(animationsConfig) {
295
674
  sharedValue.value = next;
296
675
  onFinish === null || onFinish === void 0 ? void 0 : onFinish();
297
676
  } else {
298
- var cb = onFinish ? function () {
677
+ var cb = onFinish ? function (finished) {
299
678
  "worklet";
300
679
 
301
- runOnJS(onFinish)();
680
+ if (finished !== false) {
681
+ runOnJS(onFinish)();
682
+ }
302
683
  } : void 0;
684
+ var animationConfig = cloneTransitionConfig(config);
303
685
  if (isWeb) {
304
- sharedValue.value = config.type === "spring" ? withSpring(next, config, cb) : withTiming(next, config, cb);
686
+ sharedValue.value = applyAnimation(next, animationConfig, cb);
305
687
  } else {
306
- runOnUI(function () {
688
+ runOnUI(function (targetValue, animationConfig2) {
307
689
  "worklet";
308
690
 
309
- sharedValue.value = config.type === "spring" ? withSpring(next, config, cb) : withTiming(next, config, cb);
310
- })();
691
+ sharedValue.value = applyAnimation(targetValue, animationConfig2, cb);
692
+ })(next, animationConfig);
311
693
  }
312
694
  }
313
695
  },
@@ -350,17 +732,19 @@ function createAnimations(animationsConfig) {
350
732
 
351
733
  return getStyle(instance.value);
352
734
  });
353
- return useAnimatedStyle(function () {
735
+ var animatedStyle = useAnimatedStyle(function () {
354
736
  "worklet";
355
737
 
356
738
  return styleVal.value;
357
739
  });
740
+ silenceAnimatedComponentDevCheck(animatedStyle);
741
+ return animatedStyle;
358
742
  },
359
743
  useAnimatedNumbersStyle(vals, getStyle) {
360
744
  var instances = vals.map(function (v) {
361
745
  return v.getInstance();
362
746
  });
363
- return useAnimatedStyle(function () {
747
+ var animatedStyle = useAnimatedStyle(function () {
364
748
  "worklet";
365
749
 
366
750
  var currentValues = instances.map(function (inst) {
@@ -368,6 +752,8 @@ function createAnimations(animationsConfig) {
368
752
  });
369
753
  return getStyle(...currentValues);
370
754
  }, isWeb ? [getStyle, ...instances] : void 0);
755
+ silenceAnimatedComponentDevCheck(animatedStyle);
756
+ return animatedStyle;
371
757
  },
372
758
  // =========================================================================
373
759
  // useAnimations - Main animation hook for components
@@ -381,7 +767,8 @@ function createAnimations(animationsConfig) {
381
767
  useStyleEmitter,
382
768
  themeName,
383
769
  stateRef,
384
- styleState
770
+ styleState,
771
+ onDidAnimate
385
772
  } = animationProps;
386
773
  var isHydrating = componentState.unmounted === true;
387
774
  var isMounting = componentState.unmounted === "should-enter";
@@ -400,16 +787,36 @@ function createAnimations(animationsConfig) {
400
787
  var disableAnimation = isHydrating || !animationKey;
401
788
  var isDark = (themeName === null || themeName === void 0 ? void 0 : themeName.startsWith("dark")) || false;
402
789
  var sendExitComplete = presence === null || presence === void 0 ? void 0 : presence[1];
790
+ var onDidAnimateRef = useRef(onDidAnimate);
791
+ useIsomorphicLayoutEffect(function () {
792
+ onDidAnimateRef.current = onDidAnimate;
793
+ }, [onDidAnimate]);
794
+ var didAnimateCycleIdRef = useRef(0);
795
+ var pendingDidAnimateKeysRef = useRef(/* @__PURE__ */new Set());
796
+ var didAnimateCompletedRef = useRef(false);
797
+ var isCompletingAnimationRef = useSharedValue(false);
798
+ var didAnimateCycleIdShared = useSharedValue(0);
799
+ var markDidAnimateKeyDone = useEvent(function (key2, cycleId, finished) {
800
+ if (!finished || cycleId !== didAnimateCycleIdRef.current) return;
801
+ if (didAnimateCompletedRef.current) return;
802
+ pendingDidAnimateKeysRef.current.delete(key2);
803
+ if (pendingDidAnimateKeysRef.current.size === 0) {
804
+ var _onDidAnimateRef_current;
805
+ didAnimateCompletedRef.current = true;
806
+ isCompletingAnimationRef.value = false;
807
+ (_onDidAnimateRef_current = onDidAnimateRef.current) === null || _onDidAnimateRef_current === void 0 ? void 0 : _onDidAnimateRef_current.call(onDidAnimateRef);
808
+ }
809
+ });
403
810
  var exitCycleIdRef = useRef(0);
404
811
  var pendingExitKeysRef = useRef(/* @__PURE__ */new Set());
405
812
  var exitCompletedRef = useRef(false);
406
813
  var wasExitingRef = useRef(false);
407
814
  var justStartedExiting = isExiting && !wasExitingRef.current;
408
815
  var justStoppedExiting = !isExiting && wasExitingRef.current;
409
- var markExitKeyDone = useEvent(function (key3, cycleId, finished) {
816
+ var markExitKeyDone = useEvent(function (key2, cycleId, finished) {
410
817
  if (cycleId !== exitCycleIdRef.current) return;
411
818
  if (exitCompletedRef.current) return;
412
- pendingExitKeysRef.current.delete(key3);
819
+ pendingExitKeysRef.current.delete(key2);
413
820
  if (pendingExitKeysRef.current.size === 0) {
414
821
  exitCompletedRef.current = true;
415
822
  sendExitComplete === null || sendExitComplete === void 0 ? void 0 : sendExitComplete();
@@ -421,6 +828,9 @@ function createAnimations(animationsConfig) {
421
828
  exitCycleIdRef.current++;
422
829
  exitCompletedRef.current = false;
423
830
  pendingExitKeysRef.current.clear();
831
+ didAnimateCycleIdRef.current++;
832
+ pendingDidAnimateKeysRef.current.clear();
833
+ didAnimateCompletedRef.current = true;
424
834
  }
425
835
  if (justStoppedExiting) {
426
836
  exitCycleIdRef.current++;
@@ -429,44 +839,89 @@ function createAnimations(animationsConfig) {
429
839
  useIsomorphicLayoutEffect(function () {
430
840
  isExitingRef.value = isExiting;
431
841
  exitCycleIdShared.value = exitCycleIdRef.current;
432
- }, [isExiting, exitCycleIdRef.current]);
842
+ if (justStartedExiting) {
843
+ isCompletingAnimationRef.value = false;
844
+ didAnimateCycleIdShared.value = didAnimateCycleIdRef.current;
845
+ }
846
+ }, [isExiting, exitCycleIdRef.current, justStartedExiting]);
433
847
  React.useEffect(function () {
434
848
  wasExitingRef.current = isExiting;
435
849
  });
436
- var animatedTargetsRef = useSharedValue(null);
437
- var staticTargetsRef = useSharedValue(null);
438
- var transformTargetsRef = useSharedValue(null);
850
+ var committedRenderKeysRef = useRef(/* @__PURE__ */new Set());
851
+ var lastPaintedRef = useRef({});
852
+ var carryRef = useRef({});
439
853
  var {
440
854
  animatedStyles,
441
- staticStyles
855
+ staticStyles,
856
+ nextCarry
442
857
  } = useMemo(function () {
443
- var animated = {};
444
- var staticStyles2 = {};
445
- var animateOnly2 = props.animateOnly;
446
- for (var key3 in style) {
447
- var rawValue = style[key3];
448
- var value = resolveDynamicValue(rawValue, isDark);
449
- if (value === void 0) continue;
450
- if (disableAnimation) {
451
- staticStyles2[key3] = value;
452
- continue;
453
- }
454
- if (canAnimateProperty(key3, value, animateOnly2)) {
455
- animated[key3] = value;
456
- } else {
457
- staticStyles2[key3] = value;
458
- }
858
+ var animateOnly = props.animateOnly;
859
+ var {
860
+ animated,
861
+ statics
862
+ } = splitAnimationStyles(style, isDark, disableAnimation, animateOnly);
863
+ var nextCarry2 = cloneStyleRecord(carryRef.current);
864
+ for (var key2 in nextCarry2) {
865
+ if (!(key2 in animated)) delete nextCarry2[key2];
459
866
  }
460
- if (isMounting) {
461
- for (var key1 in animated) {
462
- staticStyles2[key1] = animated[key1];
867
+ for (var key1 in animated) {
868
+ if (!(key1 in nextCarry2)) {
869
+ nextCarry2[key1] = cloneAnimationValue(animated[key1]);
463
870
  }
871
+ statics[key1] = nextCarry2[key1];
464
872
  }
465
873
  return {
466
874
  animatedStyles: animated,
467
- staticStyles: staticStyles2
875
+ staticStyles: statics,
876
+ nextCarry: nextCarry2
468
877
  };
469
- }, [disableAnimation, style, isDark, isMounting, props.animateOnly]);
878
+ }, [disableAnimation, style, isDark, props.animateOnly]);
879
+ var renderSnapshot = useMemo(function () {
880
+ return buildSnapshot(animatedStyles, staticStyles, getAnimatedTransforms(animatedStyles.transform), committedRenderKeysRef.current, lastPaintedRef.current);
881
+ }, [animatedStyles, staticStyles]);
882
+ var renderSnapshotRef = useSharedValue({
883
+ animated: {},
884
+ statics: {},
885
+ transforms: [],
886
+ gatedKeys: {},
887
+ seeds: {},
888
+ removedKeys: {},
889
+ removeTransform: false,
890
+ clearValue: isWeb ? "" : null
891
+ });
892
+ var emitterSnapshotRef = useSharedValue(null);
893
+ var emitterKeysRef = useRef(null);
894
+ useIsomorphicLayoutEffect(function () {
895
+ carryRef.current = nextCarry;
896
+ committedRenderKeysRef.current = renderSnapshot.keys;
897
+ lastPaintedRef.current = renderSnapshot.painted;
898
+ }, [nextCarry, renderSnapshot]);
899
+ var pseudoActiveRef = useRef(false);
900
+ var isExitingJSRef = useRef(false);
901
+ isExitingJSRef.current = isExiting;
902
+ var publishedSnapshotRef = useRef(null);
903
+ useIsomorphicLayoutEffect(function () {
904
+ var droppingLatch = (isExiting || !pseudoActiveRef.current) && emitterSnapshotRef.value !== null;
905
+ var emitterKeys = droppingLatch ? emitterKeysRef.current : null;
906
+ if (droppingLatch || publishedSnapshotRef.current !== renderSnapshot.value) {
907
+ var removedKeys = emitterKeys ? {
908
+ ...renderSnapshot.value.removedKeys,
909
+ ...getRemovedAnimatedKeys(renderSnapshot.keys, emitterKeys)
910
+ } : renderSnapshot.value.removedKeys;
911
+ renderSnapshotRef.value = {
912
+ ...renderSnapshot.value,
913
+ removedKeys,
914
+ removeTransform: Object.keys(removedKeys).some(function (key2) {
915
+ return key2.startsWith("transform:");
916
+ })
917
+ };
918
+ publishedSnapshotRef.current = renderSnapshot.value;
919
+ }
920
+ if (droppingLatch) {
921
+ emitterSnapshotRef.value = null;
922
+ emitterKeysRef.current = null;
923
+ }
924
+ });
470
925
  var {
471
926
  baseConfig,
472
927
  propertyConfigs
@@ -480,8 +935,8 @@ function createAnimations(animationsConfig) {
480
935
  propertyConfigs: {}
481
936
  };
482
937
  }
483
- return buildTransitionConfig(props.transition, animations, animationState, getStyleKeys(animatedStyles));
484
- }, [isHydrating, props.transition, animatedStyles, animationState]);
938
+ return buildTransitionConfig(effectiveTransition, animations, animationState, getStyleKeys(animatedStyles));
939
+ }, [isHydrating, effectiveTransition, animatedStyles, animationState]);
485
940
  var configRef = useSharedValue({
486
941
  baseConfig,
487
942
  propertyConfigs,
@@ -489,130 +944,76 @@ function createAnimations(animationsConfig) {
489
944
  isHydrating
490
945
  });
491
946
  useIsomorphicLayoutEffect(function () {
492
- configRef.set({
947
+ configRef.value = {
493
948
  baseConfig,
494
949
  propertyConfigs,
495
950
  disableAnimation,
496
951
  isHydrating
497
- });
952
+ };
498
953
  }, [baseConfig, propertyConfigs, disableAnimation, isHydrating]);
499
- useStyleEmitter === null || useStyleEmitter === void 0 ? void 0 : useStyleEmitter(function (nextStyle, effectiveTransition2) {
500
- var animateOnly2 = props.animateOnly;
501
- var animated = {};
502
- var statics = {};
503
- var transforms2 = [];
954
+ useStyleEmitter === null || useStyleEmitter === void 0 ? void 0 : useStyleEmitter(function (nextStyle, effectiveTransition2, pseudoActive) {
955
+ if (isExitingJSRef.current) return;
956
+ pseudoActiveRef.current = pseudoActive === true;
957
+ var animateOnly = props.animateOnly;
504
958
  var transitionToUse = effectiveTransition2 !== null && effectiveTransition2 !== void 0 ? effectiveTransition2 : props.transition;
505
959
  var {
506
960
  baseConfig: newBase,
507
961
  propertyConfigs: newPropertyConfigs
508
962
  } = buildTransitionConfig(transitionToUse, animations, animationState, getStyleKeys(nextStyle));
509
- configRef.set({
963
+ configRef.value = {
510
964
  baseConfig: newBase,
511
965
  propertyConfigs: newPropertyConfigs,
512
- disableAnimation: configRef.get().disableAnimation,
513
- isHydrating: configRef.get().isHydrating
514
- });
515
- for (var key3 in nextStyle) {
516
- var rawValue = nextStyle[key3];
517
- var value = resolveDynamicValue(rawValue, isDark);
518
- if (value == void 0) continue;
519
- if (configRef.get().disableAnimation) {
520
- statics[key3] = value;
521
- continue;
522
- }
523
- if (key3 === "transform" && Array.isArray(value)) {
524
- var _iteratorNormalCompletion2 = true,
525
- _didIteratorError2 = false,
526
- _iteratorError2 = void 0;
527
- try {
528
- for (var _iterator2 = value[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
529
- var t2 = _step2.value;
530
- if (t2 && (typeof t2 === "undefined" ? "undefined" : _type_of(t2)) === "object") {
531
- var tKey2 = Object.keys(t2)[0];
532
- var tVal = t2[tKey2];
533
- if (typeof tVal === "number" || typeof tVal === "string") {
534
- transforms2.push(t2);
535
- }
536
- }
537
- }
538
- } catch (err) {
539
- _didIteratorError2 = true;
540
- _iteratorError2 = err;
541
- } finally {
542
- try {
543
- if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
544
- _iterator2.return();
545
- }
546
- } finally {
547
- if (_didIteratorError2) {
548
- throw _iteratorError2;
549
- }
550
- }
551
- }
552
- continue;
553
- }
554
- if (canAnimateProperty(key3, value, animateOnly2)) {
555
- animated[key3] = value;
556
- } else {
557
- statics[key3] = value;
558
- }
559
- }
560
- animatedTargetsRef.set(animated);
561
- staticTargetsRef.set(statics);
562
- transformTargetsRef.set(transforms2);
966
+ disableAnimation: configRef.value.disableAnimation,
967
+ isHydrating: configRef.value.isHydrating
968
+ };
969
+ var _emitterKeysRef_current;
970
+ var previousKeys = (_emitterKeysRef_current = emitterKeysRef.current) !== null && _emitterKeysRef_current !== void 0 ? _emitterKeysRef_current : committedRenderKeysRef.current;
971
+ var {
972
+ animated,
973
+ statics
974
+ } = splitAnimationStyles(nextStyle, isDark, configRef.value.disableAnimation, animateOnly);
975
+ var snapshot = buildSnapshot(animated, statics, getAnimatedTransforms(animated.transform), previousKeys, lastPaintedRef.current);
976
+ emitterSnapshotRef.value = snapshot.value;
977
+ emitterKeysRef.current = snapshot.keys;
978
+ lastPaintedRef.current = snapshot.painted;
563
979
  if (process.env.NODE_ENV === "development" && props.debug && props.debug !== "profile") {
564
980
  console.info("[animations-reanimated] useStyleEmitter update", {
565
981
  animated,
566
982
  statics,
567
- transforms: transforms2
983
+ transforms: snapshot.value.transforms
568
984
  });
569
985
  }
570
986
  });
571
987
  var exitKeysRegistered = useRef(false);
572
988
  if (justStartedExiting && sendExitComplete) {
573
- var exitKeys = [];
574
- var animateOnly = props.animateOnly;
575
- for (var key2 in animatedStyles) {
576
- if (key2 === "transform") continue;
577
- if (canAnimateProperty(key2, animatedStyles[key2], animateOnly)) {
578
- exitKeys.push(key2);
579
- }
580
- }
581
- var transforms = animatedStyles.transform;
582
- if (transforms && Array.isArray(transforms)) {
583
- var _iteratorNormalCompletion = true,
584
- _didIteratorError = false,
585
- _iteratorError = void 0;
586
- try {
587
- for (var _iterator = transforms[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
588
- var t = _step.value;
589
- if (!t) continue;
590
- var tKey = Object.keys(t)[0];
591
- if (tKey) {
592
- if (animateOnly && !animateOnly.includes(tKey)) {
593
- continue;
594
- }
595
- exitKeys.push(`transform:${tKey}`);
596
- }
597
- }
598
- } catch (err) {
599
- _didIteratorError = true;
600
- _iteratorError = err;
601
- } finally {
602
- try {
603
- if (!_iteratorNormalCompletion && _iterator.return != null) {
604
- _iterator.return();
605
- }
606
- } finally {
607
- if (_didIteratorError) {
608
- throw _iteratorError;
609
- }
610
- }
611
- }
612
- }
989
+ var exitKeys = getGatedKeys(renderSnapshot.value);
613
990
  pendingExitKeysRef.current = new Set(exitKeys);
614
991
  exitKeysRegistered.current = exitKeys.length > 0;
615
992
  }
993
+ var previousDidAnimateStyleRef = useRef(null);
994
+ var didAnimateStyle = onDidAnimate ? JSON.stringify(style) : null;
995
+ var previousDidAnimateStyle = previousDidAnimateStyleRef.current;
996
+ var shouldRegisterDidAnimate = didAnimateStyle !== null && previousDidAnimateStyle !== null && previousDidAnimateStyle !== didAnimateStyle && !isExiting && !isEntering && !justFinishedEntering;
997
+ var didAnimateKeys = shouldRegisterDidAnimate ? getGatedKeys(renderSnapshot.value) : [];
998
+ useIsomorphicLayoutEffect(function () {
999
+ if (didAnimateStyle === null) {
1000
+ previousDidAnimateStyleRef.current = null;
1001
+ isCompletingAnimationRef.value = false;
1002
+ return;
1003
+ }
1004
+ var previousStyleStillCurrent = previousDidAnimateStyleRef.current === previousDidAnimateStyle;
1005
+ previousDidAnimateStyleRef.current = didAnimateStyle;
1006
+ if (!shouldRegisterDidAnimate || !previousStyleStillCurrent) return;
1007
+ var cycleId = ++didAnimateCycleIdRef.current;
1008
+ pendingDidAnimateKeysRef.current = new Set(didAnimateKeys);
1009
+ didAnimateCompletedRef.current = didAnimateKeys.length === 0;
1010
+ isCompletingAnimationRef.value = didAnimateKeys.length > 0;
1011
+ didAnimateCycleIdShared.value = cycleId;
1012
+ if (didAnimateKeys.length === 0) {
1013
+ var _onDidAnimateRef_current;
1014
+ (_onDidAnimateRef_current = onDidAnimateRef.current) === null || _onDidAnimateRef_current === void 0 ? void 0 : _onDidAnimateRef_current.call(onDidAnimateRef);
1015
+ }
1016
+ }, [didAnimateStyle, shouldRegisterDidAnimate]);
616
1017
  React.useEffect(function () {
617
1018
  if (!justStartedExiting || !sendExitComplete) return;
618
1019
  if (!exitKeysRegistered.current && pendingExitKeysRef.current.size === 0) {
@@ -622,99 +1023,98 @@ function createAnimations(animationsConfig) {
622
1023
  }
623
1024
  }
624
1025
  }, [justStartedExiting, sendExitComplete]);
1026
+ var mapperStateRef = useSharedValue({
1027
+ emitted: {}
1028
+ });
625
1029
  var animatedStyle = useAnimatedStyle(function () {
626
1030
  "worklet";
627
1031
 
628
- var _loop = function (key12) {
629
- if (key12 === "transform") return "continue";
630
- var targetValue = animatedValues[key12];
631
- var _config_propertyConfigs_key;
632
- var propConfig = (_config_propertyConfigs_key = config.propertyConfigs[key12]) !== null && _config_propertyConfigs_key !== void 0 ? _config_propertyConfigs_key : config.baseConfig;
633
- var callback = void 0;
634
- if (currentlyExiting) {
635
- var capturedKey = key12;
636
- var capturedCycleId = currentCycleId;
637
- callback = function (finished) {
638
- "worklet";
639
-
640
- runOnJS(markExitKeyDone)(capturedKey, capturedCycleId, finished !== null && finished !== void 0 ? finished : false);
641
- };
642
- }
643
- result[key12] = applyAnimation(targetValue, propConfig, callback);
644
- };
645
- if (disableAnimation || isHydrating) {
1032
+ var mapperState = mapperStateRef.value;
1033
+ var config = configRef.value;
1034
+ if (config.disableAnimation || config.isHydrating) {
1035
+ updateMapperState(mapperStateRef, {});
646
1036
  return {};
647
1037
  }
1038
+ var previouslyEmitted = mapperState.emitted;
1039
+ var emitted = {};
648
1040
  var result = {};
649
- var config = configRef.get();
650
- var emitterAnimated = animatedTargetsRef.value;
651
- var emitterStatic = staticTargetsRef.value;
652
- var emitterTransforms = transformTargetsRef.value;
653
- var hasEmitterUpdates = emitterAnimated !== null;
654
- var animatedValues = hasEmitterUpdates ? emitterAnimated : animatedStyles;
655
- var staticValues = hasEmitterUpdates ? emitterStatic : {};
1041
+ var emitterSnapshot = emitterSnapshotRef.value;
1042
+ var snapshot = emitterSnapshot !== null && emitterSnapshot !== void 0 ? emitterSnapshot : renderSnapshotRef.value;
1043
+ var animatedValues = snapshot.animated;
1044
+ var staticValues = snapshot.statics;
656
1045
  var currentlyExiting = isExitingRef.value;
657
1046
  var currentCycleId = exitCycleIdShared.value;
658
- for (var key3 in staticValues) {
659
- result[key3] = staticValues[key3];
1047
+ var currentlyCompletingAnimation = isCompletingAnimationRef.value;
1048
+ var currentDidAnimateCycleId = didAnimateCycleIdShared.value;
1049
+ for (var key2 in staticValues) {
1050
+ result[key2] = staticValues[key2];
1051
+ }
1052
+ for (var key1 in snapshot.removedKeys) {
1053
+ if (!key1.startsWith("transform:") && !(key1 in staticValues)) {
1054
+ result[key1] = snapshot.clearValue;
1055
+ }
1056
+ }
1057
+ for (var key22 in animatedValues) {
1058
+ if (key22 === "transform") continue;
1059
+ var targetValue = animatedValues[key22];
1060
+ emitted[key22] = true;
1061
+ if (typeof targetValue !== "number" && typeof targetValue !== "string") {
1062
+ result[key22] = targetValue;
1063
+ continue;
1064
+ }
1065
+ var _config_propertyConfigs_key;
1066
+ result[key22] = animateSnapshotValue(key22, key22, targetValue, (_config_propertyConfigs_key = config.propertyConfigs[key22]) !== null && _config_propertyConfigs_key !== void 0 ? _config_propertyConfigs_key : config.baseConfig, !!previouslyEmitted[key22], snapshot.seeds[key22], !!snapshot.gatedKeys[key22], currentlyExiting, currentCycleId, currentlyCompletingAnimation, currentDidAnimateCycleId, markExitKeyDone, markDidAnimateKeyDone, !!COLOR_STYLE_KEYS[key22]);
660
1067
  }
661
- for (var key1 in animatedValues) _loop(key1);
662
- var transforms2 = hasEmitterUpdates ? emitterTransforms : animatedStyles.transform;
663
- if (transforms2 && Array.isArray(transforms2)) {
1068
+ var transforms = snapshot.transforms;
1069
+ if (transforms.length > 0 || snapshot.removeTransform) {
664
1070
  var validTransforms = [];
665
- var _iteratorNormalCompletion2 = true,
666
- _didIteratorError2 = false,
667
- _iteratorError2 = void 0;
1071
+ var _iteratorNormalCompletion = true,
1072
+ _didIteratorError = false,
1073
+ _iteratorError = void 0;
668
1074
  try {
669
- var _loop1 = function () {
670
- var t2 = _step2.value;
671
- if (!t2) return "continue";
672
- var keys = Object.keys(t2);
673
- if (keys.length === 0) return "continue";
674
- var value = t2[keys[0]];
1075
+ for (var _iterator = transforms[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
1076
+ var t = _step.value;
1077
+ if (!t) continue;
1078
+ var keys = Object.keys(t);
1079
+ if (keys.length === 0) continue;
1080
+ var transformKey = keys[0];
1081
+ var value = t[transformKey];
675
1082
  if (typeof value === "number" || typeof value === "string") {
676
- var transformKey = Object.keys(t2)[0];
677
- var targetValue = t2[transformKey];
678
1083
  var _config_propertyConfigs_transformKey;
679
1084
  var propConfig = (_config_propertyConfigs_transformKey = config.propertyConfigs[transformKey]) !== null && _config_propertyConfigs_transformKey !== void 0 ? _config_propertyConfigs_transformKey : config.baseConfig;
680
- var callback = void 0;
681
- if (currentlyExiting) {
682
- var capturedKey = `transform:${transformKey}`;
683
- var capturedCycleId = currentCycleId;
684
- callback = function (finished) {
685
- "worklet";
686
-
687
- runOnJS(markExitKeyDone)(capturedKey, capturedCycleId, finished !== null && finished !== void 0 ? finished : false);
688
- };
689
- }
1085
+ var subKey = `transform:${transformKey}`;
1086
+ emitted[subKey] = true;
690
1087
  validTransforms.push({
691
- [transformKey]: applyAnimation(targetValue, propConfig, callback)
1088
+ [transformKey]: animateSnapshotValue(subKey, transformKey, value, propConfig, !!previouslyEmitted[subKey], snapshot.seeds[subKey], !!snapshot.gatedKeys[subKey], currentlyExiting, currentCycleId, currentlyCompletingAnimation, currentDidAnimateCycleId, markExitKeyDone, markDidAnimateKeyDone)
692
1089
  });
1090
+ } else {
1091
+ validTransforms.push(t);
693
1092
  }
694
- };
695
- for (var _iterator2 = transforms2[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) _loop1();
1093
+ }
696
1094
  } catch (err) {
697
- _didIteratorError2 = true;
698
- _iteratorError2 = err;
1095
+ _didIteratorError = true;
1096
+ _iteratorError = err;
699
1097
  } finally {
700
1098
  try {
701
- if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
702
- _iterator2.return();
1099
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
1100
+ _iterator.return();
703
1101
  }
704
1102
  } finally {
705
- if (_didIteratorError2) {
706
- throw _iteratorError2;
1103
+ if (_didIteratorError) {
1104
+ throw _iteratorError;
707
1105
  }
708
1106
  }
709
1107
  }
710
- if (validTransforms.length > 0) {
1108
+ if (validTransforms.length > 0 || !("transform" in staticValues)) {
711
1109
  result.transform = validTransforms;
712
1110
  }
713
1111
  }
1112
+ updateMapperState(mapperStateRef, emitted);
714
1113
  return result;
715
- }, isWeb ? [animatedStyles, baseConfig, propertyConfigs, disableAnimation, isHydrating,
716
- // pass SharedValues so the mapper watches them on web (no babel plugin)
717
- animatedTargetsRef, staticTargetsRef, transformTargetsRef, isExitingRef, exitCycleIdShared, markExitKeyDone] : void 0);
1114
+ }, isWeb ? [
1115
+ // pass SharedValues so the stable mapper watches them on web (no babel plugin)
1116
+ renderSnapshotRef, emitterSnapshotRef, configRef, isExitingRef, exitCycleIdShared, markExitKeyDone, isCompletingAnimationRef, didAnimateCycleIdShared, markDidAnimateKeyDone] : void 0);
1117
+ silenceAnimatedComponentDevCheck(animatedStyle);
718
1118
  if (process.env.NODE_ENV === "development" && props.debug && props.debug !== "profile") {
719
1119
  console.info("[animations-reanimated] useAnimations", {
720
1120
  animationKey,