File tree 2 files changed +11
-3
lines changed
src/components/uis/Scouter
2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -16,8 +16,9 @@ import SvgStatsWater from '../../svgs/SvgStatsWater';
16
16
17
17
type Axis = { x : number ; y : number } ;
18
18
19
- const Container = styled . View `
19
+ const Container = styled . View < { width : number } > `
20
20
padding: 32px;
21
+ width: ${ ( { width} ) => width } + 'px';
21
22
22
23
justify-content: center;
23
24
align-items: center;
@@ -229,7 +230,7 @@ const StatsChart = ({
229
230
const posTree = convertPosition ( centerPosition , tree , 'tree' ) ;
230
231
231
232
return (
232
- < Container style = { { width : width + 72 } } >
233
+ < Container width = { width + 72 } >
233
234
< StatUnits centerPosition = { centerPosition } onPressStat = { onPressStat } />
234
235
< StatsContainer >
235
236
< ImageBackground
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ const Scouter = ({
30
30
> ;
31
31
style ?: StyleProp < ViewStyle > ;
32
32
} ) : ReactElement => {
33
+ const [ width , setWidth ] = useState ( 0 ) ;
33
34
const [ selectedStat , setSelectedStat ] = useState < StatType | null > ( null ) ;
34
35
const [ tierName , setTierName ] = useState < ScoreType [ 'tierName' ] > ( 'Silver' ) ;
35
36
const pluginStats = ! githubLogin
@@ -68,8 +69,14 @@ const Scouter = ({
68
69
} ;
69
70
70
71
return (
71
- < Container style = { style } >
72
+ < Container
73
+ style = { style }
74
+ onLayout = { ( e ) => {
75
+ setWidth ( e . nativeEvent . layout . width ) ;
76
+ } }
77
+ >
72
78
< StatsChart
79
+ width = { width > 330 ? 330 : width - 64 }
73
80
selectedStat = { selectedStat }
74
81
onPressStat = { onPressStat }
75
82
statsScore = { {
You can’t perform that action at this time.
0 commit comments