Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7a07a4d

Browse files
committed
width/height listener
1 parentd964c3e commit7a07a4d

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

‎web-app/src/Routes.tsx

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,33 @@ interface Props {
1313
conststyles={
1414
page:{
1515
margin:0,
16-
width:window.innerWidth-20,// 220
17-
height:window.innerHeight-20,// 655
1816
backgroundColor:'white',
1917
},
2018
}
2119

22-
console.log('page styles')
23-
console.log(JSON.stringify(styles.page))
24-
2520
constRoutes=({ state}:Props)=>{
21+
const[dimensions,setDimensions]=React.useState({
22+
width:window.innerWidth-20,
23+
height:window.innerHeight-20,
24+
})
25+
26+
// solution for windows getting off size
27+
// without adding multiple listeners
28+
React.useEffect(()=>{
29+
constdimensionsInterval=setInterval(()=>{
30+
setDimensions({
31+
width:window.innerWidth-20,
32+
height:window.innerHeight-20,
33+
})
34+
},5000)
35+
return()=>{
36+
clearInterval(dimensionsInterval)
37+
}
38+
})
39+
2640
// TODO: refactor cond to user <Router><Route> and accept first route as if/else if
2741
return(
28-
<divstyle={styles.page}>
42+
<divstyle={{ ...styles.page, ...dimensions}}>
2943
<Condstate={state}path="SelectTutorial.Startup">
3044
<Loading/>
3145
</Cond>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp