@coinbase/cds-mobile 9.10.0 → 9.10.1

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.10.1 (7/30/2026 PST)
12
+
13
+ #### 🐞 Fixes
14
+
15
+ - Size LinearGradient svg to measured pixels under Fabric. [[#810](https://github.com/coinbase/cds/pull/810)]
16
+
11
17
  ## 9.10.0 (7/30/2026 PST)
12
18
 
13
19
  #### 🚀 Updates
@@ -1 +1 @@
1
- {"version":3,"file":"LinearGradient.d.ts","sourceRoot":"","sources":["../../src/gradients/LinearGradient.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,EAAc,IAAI,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAU1E,KAAK,UAAU,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3C,KAAK,mBAAmB,GAAG;IACzB;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,CAAC,eAAe,CAAC,CAAC;IACnE;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC;IACnD;;;OAGG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB;;;SAGK;IACL,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;OAEG;IACH,MAAM,EAAE,WAAW,CAAC,MAAM,CAA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CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,WAAW,CAAC;AAIhB,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,KAAK,EACL,GAAG,EACH,KAAoB,EACpB,MAAM,EACN,QAAQ,EACR,KAAW,EACX,KAAK,EACL,aAAa,EACb,MAAM,GACP,EAAE,mBAAmB,2CA0DrB"}
@@ -1,4 +1,4 @@
1
- import React, { useMemo } from 'react';
1
+ import React, { useCallback, useMemo, useState } from 'react';
2
2
  import { StyleSheet, View } from 'react-native';
3
3
  import { Defs, LinearGradient as Lg, Rect, Stop, Svg } from 'react-native-svg';
4
4
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -23,6 +23,30 @@ export function LinearGradient(_ref) {
23
23
  pointerEvents,
24
24
  testID
25
25
  } = _ref;
26
+ const [pixelSize, setPixelSize] = useState(() => {
27
+ const flat = StyleSheet.flatten(style);
28
+ return flat && typeof flat.width === 'number' && typeof flat.height === 'number' ? {
29
+ width: flat.width,
30
+ height: flat.height
31
+ } : null;
32
+ });
33
+ const handleLayout = useCallback(event => {
34
+ const width = Math.round(event.nativeEvent.layout.width);
35
+ const height = Math.round(event.nativeEvent.layout.height);
36
+ setPixelSize(prev => prev && prev.width === width && prev.height === height ? prev : {
37
+ width,
38
+ height
39
+ });
40
+ }, []);
41
+ const svgWidth = pixelSize ? pixelSize.width : 0;
42
+ const svgHeight = pixelSize ? pixelSize.height : 0;
43
+ const containerStyle = useMemo(() => ({
44
+ position: 'absolute',
45
+ top: 0,
46
+ left: 0,
47
+ width: svgWidth,
48
+ height: svgHeight
49
+ }), [svgWidth, svgHeight]);
26
50
  const svg = useMemo(() => {
27
51
  var _start$x, _start$y, _end$x, _end$y;
28
52
  const anglePI = -angle * Math.PI / 180;
@@ -31,10 +55,10 @@ export function LinearGradient(_ref) {
31
55
  const x2 = (_end$x = end == null ? void 0 : end.x) != null ? _end$x : Math.round(50 + Math.sin(anglePI + Math.PI) * 50) / 100;
32
56
  const y2 = (_end$y = end == null ? void 0 : end.y) != null ? _end$y : Math.round(50 + Math.cos(anglePI + Math.PI) * 50) / 100;
33
57
  return /*#__PURE__*/_jsx(View, {
34
- style: StyleSheet.absoluteFillObject,
58
+ style: containerStyle,
35
59
  children: /*#__PURE__*/_jsxs(Svg, {
36
- height: "100%",
37
- width: "100%",
60
+ height: svgHeight,
61
+ width: svgWidth,
38
62
  children: [/*#__PURE__*/_jsx(Defs, {
39
63
  children: /*#__PURE__*/_jsx(Lg, {
40
64
  id: "LinearGradient",
@@ -50,14 +74,15 @@ export function LinearGradient(_ref) {
50
74
  })
51
75
  }), /*#__PURE__*/_jsx(Rect, {
52
76
  fill: "url(#LinearGradient)",
53
- height: "100%",
54
- width: "100%"
77
+ height: svgHeight,
78
+ width: svgWidth
55
79
  })]
56
80
  })
57
81
  }, "GrandientSvgContainer");
58
- }, [colors, start, end, angle, stops]);
82
+ }, [colors, start, end, angle, stops, containerStyle, svgWidth, svgHeight]);
59
83
  const items = !elevated ? [svg, children] : [children, svg];
60
84
  return /*#__PURE__*/_jsx(View, {
85
+ onLayout: handleLayout,
61
86
  pointerEvents: pointerEvents,
62
87
  style: style,
63
88
  testID: testID,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cds-mobile",
3
- "version": "9.10.0",
3
+ "version": "9.10.1",
4
4
  "description": "Coinbase Design System - Mobile",
5
5
  "repository": {
6
6
  "type": "git",
@@ -218,7 +218,7 @@
218
218
  "react-native-worklets": "0.5.2"
219
219
  },
220
220
  "dependencies": {
221
- "@coinbase/cds-common": "^9.10.0",
221
+ "@coinbase/cds-common": "^9.10.1",
222
222
  "@coinbase/cds-icons": "^5.21.0",
223
223
  "@coinbase/cds-illustrations": "^4.45.0",
224
224
  "@coinbase/cds-lottie-files": "^3.3.4",