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