@@ -19,10 +19,13 @@ export function useResponsiveView(_breakpoints: Record<string, string> = {}) {
19
19
const ASPECT_RATIO = 4 / 5
20
20
const breakpoints = Object . assign (
21
21
{ base : { width : 320 , height : 670 } } ,
22
- Object . entries ( _breakpoints ) . reduce ( ( acc , nxt ) => {
23
- const width = parseInt ( nxt [ 1 ] . replace ( 'px' , '' ) )
24
- return { ...acc , [ nxt [ 0 ] ] : { width, height : width / ASPECT_RATIO } }
25
- } , { } as Record < string , Record < 'width' | 'height' , number > > ) ,
22
+ Object . entries ( _breakpoints ) . reduce (
23
+ ( acc , nxt ) => {
24
+ const width = parseInt ( nxt [ 1 ] . replace ( 'px' , '' ) )
25
+ return { ...acc , [ nxt [ 0 ] ] : { width, height : width / ASPECT_RATIO } }
26
+ } ,
27
+ { } as Record < string , Record < 'width' | 'height' , number > > ,
28
+ ) ,
26
29
)
27
30
28
31
const [ responsiveSize , setResponsiveSize ] = useState ( breakpoints [ Object . keys ( breakpoints ) [ 0 ] ] )
@@ -42,7 +45,7 @@ export function useResponsiveView(_breakpoints: Record<string, string> = {}) {
42
45
startX ?: number
43
46
startY ?: number
44
47
} > ( )
45
- const timeout = useRef < number > ( )
48
+ const timeout = useRef < number | undefined > ( undefined )
46
49
const constrainedResponsiveSize = constrainSize ( responsiveSize . width , responsiveSize . height )
47
50
48
51
function constrainWidth ( desiredWidth : number ) {
0 commit comments