@@ -51,23 +51,38 @@ function AccountSegment({
5151 readonly pending : boolean ;
5252} ) {
5353 const patternId = useId ( ) . replace ( / : / g, "" ) ;
54+ const [ size , setSize ] = useState ( { width : 0 , height : 0 } ) ;
5455 return (
55- < Svg width = "100%" height = "100%" accessible = { false } >
56- < Defs >
57- < Pattern id = { patternId } width = { 6 } height = { 6 } patternUnits = "userSpaceOnUse" >
58- < Path d = "M-1 1L1 -1M0 6L6 0M5 7L7 5" stroke = { color } strokeWidth = { 1 } opacity = { 0.22 } />
59- </ Pattern >
60- </ Defs >
61- { pending ? (
62- < Rect
63- x = { `${ remaining } %` }
64- width = { `${ 100 - remaining } %` }
65- height = "100%"
66- fill = { `url(#${ patternId } )` }
67- />
56+ < View
57+ pointerEvents = "none"
58+ className = "absolute inset-0"
59+ onLayout = { ( event ) => {
60+ const { width, height } = event . nativeEvent . layout ;
61+ setSize ( ( previous ) =>
62+ previous . width === width && previous . height === height ? previous : { width, height } ,
63+ ) ;
64+ } }
65+ >
66+ { size . width > 0 && size . height > 0 ? (
67+ // Numeric canvas dimensions clear Android SVG geometry cached before a segment resized.
68+ < Svg width = { size . width } height = { size . height } accessible = { false } >
69+ < Defs >
70+ < Pattern id = { patternId } width = { 6 } height = { 6 } patternUnits = "userSpaceOnUse" >
71+ < Path d = "M-1 1L1 -1M0 6L6 0M5 7L7 5" stroke = { color } strokeWidth = { 1 } opacity = { 0.22 } />
72+ </ Pattern >
73+ </ Defs >
74+ { pending ? (
75+ < Rect
76+ x = { `${ remaining } %` }
77+ width = { `${ 100 - remaining } %` }
78+ height = "100%"
79+ fill = { `url(#${ patternId } )` }
80+ />
81+ ) : null }
82+ < Rect width = { `${ remaining } %` } height = "100%" fill = { color } opacity = { 0.35 } />
83+ </ Svg >
6884 ) : null }
69- < Rect width = { `${ remaining } %` } height = "100%" fill = { color } opacity = { 0.35 } />
70- </ Svg >
85+ </ View >
7186 ) ;
7287}
7388
0 commit comments