File tree 3 files changed +10
-15
lines changed
3 files changed +10
-15
lines changed Original file line number Diff line number Diff line change 1
1
// React imports
2
2
import React , { useRef } from 'react'
3
+ import { useMediaQuery } from 'react-responsive'
3
4
// The Modal is a screen that appears on top of the main app, and can be toggled
4
5
// on and off.
5
6
import Modal from 'react-bootstrap/Modal'
@@ -21,6 +22,9 @@ function LiveVideoModal(props) {
21
22
const modalBodyRef = useRef ( null )
22
23
const margin = convertRemToPixels ( 1 )
23
24
25
+ // Flag to check if the current orientation is portrait
26
+ const isPortrait = useMediaQuery ( { query : '(orientation: portrait)' } )
27
+
24
28
return (
25
29
< Modal
26
30
show = { props . show }
@@ -34,7 +38,7 @@ function LiveVideoModal(props) {
34
38
fullscreen = { true }
35
39
>
36
40
< Modal . Header closeButton >
37
- < Modal . Title id = 'contained-modal-title-vcenter' style = { { fontSize : '3vh' } } >
41
+ < Modal . Title id = 'contained-modal-title-vcenter' style = { { fontSize : isPortrait ? '3vh' : '6vh ' } } >
38
42
Live Video
39
43
</ Modal . Title >
40
44
</ Modal . Header >
Original file line number Diff line number Diff line change @@ -40,9 +40,9 @@ const PlateLocator = (props) => {
40
40
// done button width
41
41
let doneButtonWidth = '47vw'
42
42
// button height
43
- let buttonHeight = '8vh '
43
+ let buttonHeight = isPortrait ? '6vh' : '11vh '
44
44
// arrow button width
45
- let arrowButtonWidth = '13vw '
45
+ let arrowButtonWidth = '16vw '
46
46
47
47
/**
48
48
* Callback function for when the user presses one of the buttons to teleop
Original file line number Diff line number Diff line change 1
- import React , { useCallback , useRef } from 'react'
1
+ import React from 'react'
2
2
import ReactDOM from 'react-dom'
3
3
import './index.css'
4
4
import App from './App'
@@ -7,20 +7,11 @@ import { View } from 'react-native'
7
7
import { useWindowSize } from './helpers'
8
8
9
9
const AppComponent = ( ) => {
10
- // set initial value of window height
11
- let windowHeight = useRef ( 0 )
12
- // set a variable for storing window inner height
13
- let newHeight = window . innerHeight
14
- // callback function when height is resized
15
- const resizeHeight = useCallback ( ( ) => {
16
- windowHeight . current = newHeight
17
- } , [ newHeight ] )
18
- // update window size when orienttaion changes with callback
19
- useWindowSize ( resizeHeight )
10
+ let windowSize = useWindowSize ( null )
20
11
21
12
return (
22
13
< >
23
- < View style = { { flex : 1 , height : windowHeight . current } } >
14
+ < View style = { { flex : 1 , height : windowSize . height } } >
24
15
< App />
25
16
</ View >
26
17
</ >
You can’t perform that action at this time.
0 commit comments