@coinbase/cds-mobile 9.6.5 → 9.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -8,6 +8,12 @@ All notable changes to this project will be documented in this file.
8
8
 
9
9
  <!-- template-start -->
10
10
 
11
+ ## 9.6.6 (7/14/2026 PST)
12
+
13
+ #### 🐞 Fixes
14
+
15
+ - Fix: do not animate initial animated caret render. [[#792](https://github.com/coinbase/cds/pull/792)]
16
+
11
17
  ## 9.6.5 (7/13/2026 PST)
12
18
 
13
19
  #### 🐞 Fixes
@@ -6,13 +6,12 @@ export type AnimatedCaretBaseProps = SharedProps & {
6
6
  rotate: number;
7
7
  };
8
8
  export type AnimatedCaretProps = AnimatedCaretBaseProps & Partial<Omit<IconProps, 'name'>>;
9
- export declare const useAnimatedCaretAnimation: () => {
9
+ export declare const useAnimatedCaretAnimation: (rotate: number) => {
10
10
  animatedStyles: {
11
11
  transform: {
12
12
  rotate: Animated.AnimatedInterpolation<string | number>;
13
13
  }[];
14
14
  };
15
- animate: (rotate: number) => void;
16
15
  };
17
16
  export declare const AnimatedCaret: React.NamedExoticComponent<AnimatedCaretProps>;
18
17
  //# sourceMappingURL=AnimatedCaret.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AnimatedCaret.d.ts","sourceRoot":"","sources":["../../src/motion/AnimatedCaret.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwD,MAAM,OAAO,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAGxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAG1E,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAGrD,MAAM,MAAM,sBAAsB,GAAG,WAAW,GAAG;IACjD,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;AAE3F,eAAO,MAAM,yBAAyB;;;;;;sBAIzB,MAAM;CAqBlB,CAAC;AAEF,eAAO,MAAM,aAAa,gDA2BxB,CAAC"}
1
+ {"version":3,"file":"AnimatedCaret.d.ts","sourceRoot":"","sources":["../../src/motion/AnimatedCaret.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqD,MAAM,OAAO,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAG1E,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAGrD,MAAM,MAAM,sBAAsB,GAAG,WAAW,GAAG;IACjD,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;AAE3F,eAAO,MAAM,yBAAyB,GAAI,QAAQ,MAAM;;;;;;CA2BvD,CAAC;AAEF,eAAO,MAAM,aAAa,gDAsBxB,CAAC"}
@@ -1,21 +1,25 @@
1
1
  const _excluded = ["rotate", "size", "color", "style"];
2
2
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
3
3
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
4
- import React, { memo, useCallback, useEffect, useMemo, useRef } from 'react';
4
+ import React, { memo, useEffect, useMemo, useRef, useState } from 'react';
5
5
  import { Animated } from 'react-native';
6
- import { usePreviousValue } from '@coinbase/cds-common/hooks/usePreviousValue';
7
6
  import { animateRotateConfig } from '@coinbase/cds-common/motion/animatedCaret';
8
7
  import { convertMotionConfig } from '../animation/convertMotionConfig';
9
8
  import { Icon } from '../icons/Icon';
10
9
  import { HStack } from '../layout/HStack';
11
10
  import { jsx as _jsx } from "react/jsx-runtime";
12
- export const useAnimatedCaretAnimation = () => {
13
- const rotateValue = useRef(new Animated.Value(0)).current;
14
- const animate = useCallback(rotate => {
11
+ export const useAnimatedCaretAnimation = rotate => {
12
+ const [rotateValue] = useState(() => new Animated.Value(rotate));
13
+ const isInitialRender = useRef(true);
14
+ useEffect(() => {
15
+ if (isInitialRender.current) {
16
+ isInitialRender.current = false;
17
+ return;
18
+ }
15
19
  Animated.timing(rotateValue, convertMotionConfig(_extends({}, animateRotateConfig, {
16
20
  toValue: rotate
17
21
  }))).start();
18
- }, [rotateValue]);
22
+ }, [rotate, rotateValue]);
19
23
  const interpolatedRotateValue = rotateValue.interpolate({
20
24
  inputRange: [0, 360],
21
25
  outputRange: ['0deg', '360deg']
@@ -25,9 +29,8 @@ export const useAnimatedCaretAnimation = () => {
25
29
  transform: [{
26
30
  rotate: interpolatedRotateValue
27
31
  }]
28
- },
29
- animate
30
- }), [interpolatedRotateValue, animate]);
32
+ }
33
+ }), [interpolatedRotateValue]);
31
34
  };
32
35
  export const AnimatedCaret = /*#__PURE__*/memo(function AnimatedCaret(_ref) {
33
36
  let {
@@ -38,13 +41,8 @@ export const AnimatedCaret = /*#__PURE__*/memo(function AnimatedCaret(_ref) {
38
41
  } = _ref,
39
42
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
40
43
  const {
41
- animatedStyles,
42
- animate
43
- } = useAnimatedCaretAnimation();
44
- const previousRotate = usePreviousValue(rotate);
45
- useEffect(() => {
46
- if (rotate !== previousRotate) animate(rotate);
47
- }, [rotate, previousRotate, animate]);
44
+ animatedStyles
45
+ } = useAnimatedCaretAnimation(rotate);
48
46
  return (
49
47
  /*#__PURE__*/
50
48
  // HStack to limit rotate boundary
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cds-mobile",
3
- "version": "9.6.5",
3
+ "version": "9.6.6",
4
4
  "description": "Coinbase Design System - Mobile",
5
5
  "repository": {
6
6
  "type": "git",
@@ -206,7 +206,7 @@
206
206
  "react-native-worklets": "0.5.2"
207
207
  },
208
208
  "dependencies": {
209
- "@coinbase/cds-common": "^9.6.5",
209
+ "@coinbase/cds-common": "^9.6.6",
210
210
  "@coinbase/cds-icons": "^5.20.0",
211
211
  "@coinbase/cds-illustrations": "^4.44.0",
212
212
  "@coinbase/cds-lottie-files": "^3.3.4",