@tamagui/animations-reanimated 3.2.1 → 3.2.3

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.
@@ -124,6 +124,14 @@ const getImplicitDefault = (key, targetValue) => {
124
124
  }
125
125
  return suffixIndex > 0 ? `${value}${targetValue.slice(suffixIndex)}` : value;
126
126
  };
127
+ const nativeNumericClear = (key) => {
128
+ "worklet";
129
+ if (key === "opacity" || key.endsWith("Radius")) {
130
+ const value = getImplicitDefault(key, 0);
131
+ return typeof value === "number" ? value : void 0;
132
+ }
133
+ return void 0;
134
+ };
127
135
  const getLeadingRatio = (metrics) => {
128
136
  const ratio = metrics?.lineHeight;
129
137
  return typeof ratio === "number" && Number.isFinite(ratio) && ratio >= 0 ? ratio : void 0;
@@ -278,13 +286,15 @@ const applyAnimation = (targetValue, config, callback, seedValue, validateStartA
278
286
  animatedValue = (0, import_react_native_reanimated.withTiming)(targetValue, reanimatedConfig, callback);
279
287
  } else {
280
288
  animatedValue = (0, import_react_native_reanimated.withSpring)(targetValue, reanimatedConfig, callback);
289
+ }
290
+ const isAnimationDescriptor = animatedValue !== null && typeof animatedValue !== "number" && typeof animatedValue !== "string" && typeof animatedValue !== "boolean" && typeof animatedValue !== "undefined";
291
+ if (isAnimationDescriptor && config.type !== "timing") {
281
292
  const innerOnFrame = animatedValue.onFrame;
282
293
  animatedValue.onFrame = (animation, now) => {
283
294
  "worklet";
284
295
  return innerOnFrame(animation, now < animation.lastTimestamp ? animation.lastTimestamp : now);
285
296
  };
286
297
  }
287
- const isAnimationDescriptor = animatedValue !== null && typeof animatedValue !== "number" && typeof animatedValue !== "string" && typeof animatedValue !== "boolean" && typeof animatedValue !== "undefined";
288
298
  if (isAnimationDescriptor && delay && delay > 0) {
289
299
  animatedValue = (0, import_react_native_reanimated.withDelay)(delay, animatedValue);
290
300
  }
@@ -1082,8 +1092,13 @@ function createAnimations(animations) {
1082
1092
  }
1083
1093
  for (const key in snapshot.removedKeys) {
1084
1094
  if (!key.startsWith("transform:") && !(key in staticValues)) {
1085
- if (snapshot.clearValue === null && (key === "color" || key.endsWith("Color"))) {
1086
- if (key !== "color") result[key] = "transparent";
1095
+ if (snapshot.clearValue === null) {
1096
+ if (key === "color" || key.endsWith("Color")) {
1097
+ if (key !== "color") result[key] = "transparent";
1098
+ } else {
1099
+ const cleared = nativeNumericClear(key);
1100
+ result[key] = cleared === void 0 ? snapshot.clearValue : cleared;
1101
+ }
1087
1102
  } else {
1088
1103
  result[key] = snapshot.clearValue;
1089
1104
  }
@@ -145,6 +145,14 @@ var getImplicitDefault = function getImplicitDefault2(key, targetValue) {
145
145
  }
146
146
  return suffixIndex > 0 ? `${value}${targetValue.slice(suffixIndex)}` : value;
147
147
  };
148
+ var nativeNumericClear = function nativeNumericClear2(key) {
149
+ "worklet";
150
+ if (key === "opacity" || key.endsWith("Radius")) {
151
+ var value = getImplicitDefault(key, 0);
152
+ return typeof value === "number" ? value : void 0;
153
+ }
154
+ return void 0;
155
+ };
148
156
  var getLeadingRatio = function getLeadingRatio2(metrics) {
149
157
  var ratio = metrics === null || metrics === void 0 ? void 0 : metrics.lineHeight;
150
158
  return typeof ratio === "number" && Number.isFinite(ratio) && ratio >= 0 ? ratio : void 0;
@@ -412,13 +420,15 @@ var applyAnimation = function applyAnimation2(targetValue, config, callback, see
412
420
  animatedValue = (0, import_react_native_reanimated.withTiming)(targetValue, reanimatedConfig, callback);
413
421
  } else {
414
422
  animatedValue = (0, import_react_native_reanimated.withSpring)(targetValue, reanimatedConfig, callback);
423
+ }
424
+ var isAnimationDescriptor = animatedValue !== null && typeof animatedValue !== "number" && typeof animatedValue !== "string" && typeof animatedValue !== "boolean" && typeof animatedValue !== "undefined";
425
+ if (isAnimationDescriptor && config.type !== "timing") {
415
426
  var innerOnFrame = animatedValue.onFrame;
416
427
  animatedValue.onFrame = function(animation, now) {
417
428
  "worklet";
418
429
  return innerOnFrame(animation, now < animation.lastTimestamp ? animation.lastTimestamp : now);
419
430
  };
420
431
  }
421
- var isAnimationDescriptor = animatedValue !== null && typeof animatedValue !== "number" && typeof animatedValue !== "string" && typeof animatedValue !== "boolean" && typeof animatedValue !== "undefined";
422
432
  if (isAnimationDescriptor && delay && delay > 0) {
423
433
  animatedValue = (0, import_react_native_reanimated.withDelay)(delay, animatedValue);
424
434
  }
@@ -1314,8 +1324,13 @@ function createAnimations(animations) {
1314
1324
  }
1315
1325
  for (var key1 in snapshot.removedKeys) {
1316
1326
  if (!key1.startsWith("transform:") && !(key1 in staticValues)) {
1317
- if (snapshot.clearValue === null && (key1 === "color" || key1.endsWith("Color"))) {
1318
- if (key1 !== "color") result[key1] = "transparent";
1327
+ if (snapshot.clearValue === null) {
1328
+ if (key1 === "color" || key1.endsWith("Color")) {
1329
+ if (key1 !== "color") result[key1] = "transparent";
1330
+ } else {
1331
+ var cleared = nativeNumericClear(key1);
1332
+ result[key1] = cleared === void 0 ? snapshot.clearValue : cleared;
1333
+ }
1319
1334
  } else {
1320
1335
  result[key1] = snapshot.clearValue;
1321
1336
  }
@@ -145,6 +145,14 @@ var getImplicitDefault = function getImplicitDefault2(key, targetValue) {
145
145
  }
146
146
  return suffixIndex > 0 ? `${value}${targetValue.slice(suffixIndex)}` : value;
147
147
  };
148
+ var nativeNumericClear = function nativeNumericClear2(key) {
149
+ "worklet";
150
+ if (key === "opacity" || key.endsWith("Radius")) {
151
+ var value = getImplicitDefault(key, 0);
152
+ return typeof value === "number" ? value : void 0;
153
+ }
154
+ return void 0;
155
+ };
148
156
  var getLeadingRatio = function getLeadingRatio2(metrics) {
149
157
  var ratio = metrics === null || metrics === void 0 ? void 0 : metrics.lineHeight;
150
158
  return typeof ratio === "number" && Number.isFinite(ratio) && ratio >= 0 ? ratio : void 0;
@@ -412,13 +420,15 @@ var applyAnimation = function applyAnimation2(targetValue, config, callback, see
412
420
  animatedValue = (0, import_react_native_reanimated.withTiming)(targetValue, reanimatedConfig, callback);
413
421
  } else {
414
422
  animatedValue = (0, import_react_native_reanimated.withSpring)(targetValue, reanimatedConfig, callback);
423
+ }
424
+ var isAnimationDescriptor = animatedValue !== null && typeof animatedValue !== "number" && typeof animatedValue !== "string" && typeof animatedValue !== "boolean" && typeof animatedValue !== "undefined";
425
+ if (isAnimationDescriptor && config.type !== "timing") {
415
426
  var innerOnFrame = animatedValue.onFrame;
416
427
  animatedValue.onFrame = function(animation, now) {
417
428
  "worklet";
418
429
  return innerOnFrame(animation, now < animation.lastTimestamp ? animation.lastTimestamp : now);
419
430
  };
420
431
  }
421
- var isAnimationDescriptor = animatedValue !== null && typeof animatedValue !== "number" && typeof animatedValue !== "string" && typeof animatedValue !== "boolean" && typeof animatedValue !== "undefined";
422
432
  if (isAnimationDescriptor && delay && delay > 0) {
423
433
  animatedValue = (0, import_react_native_reanimated.withDelay)(delay, animatedValue);
424
434
  }
@@ -1314,8 +1324,13 @@ function createAnimations(animations) {
1314
1324
  }
1315
1325
  for (var key1 in snapshot.removedKeys) {
1316
1326
  if (!key1.startsWith("transform:") && !(key1 in staticValues)) {
1317
- if (snapshot.clearValue === null && (key1 === "color" || key1.endsWith("Color"))) {
1318
- if (key1 !== "color") result[key1] = "transparent";
1327
+ if (snapshot.clearValue === null) {
1328
+ if (key1 === "color" || key1.endsWith("Color")) {
1329
+ if (key1 !== "color") result[key1] = "transparent";
1330
+ } else {
1331
+ var cleared = nativeNumericClear(key1);
1332
+ result[key1] = cleared === void 0 ? snapshot.clearValue : cleared;
1333
+ }
1319
1334
  } else {
1320
1335
  result[key1] = snapshot.clearValue;
1321
1336
  }