Skip to content

Commit cfd6259

Browse files
committed
chore: update
1 parent 79dc38e commit cfd6259

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

playground/src/hooks/useResponsiveView.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@ export function useResponsiveView(_breakpoints: Record<string, string> = {}) {
1919
const ASPECT_RATIO = 4 / 5
2020
const breakpoints = Object.assign(
2121
{ 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+
),
2629
)
2730

2831
const [responsiveSize, setResponsiveSize] = useState(breakpoints[Object.keys(breakpoints)[0]])
@@ -42,7 +45,7 @@ export function useResponsiveView(_breakpoints: Record<string, string> = {}) {
4245
startX?: number
4346
startY?: number
4447
}>()
45-
const timeout = useRef<number>()
48+
const timeout = useRef<number | undefined>(undefined)
4649
const constrainedResponsiveSize = constrainSize(responsiveSize.width, responsiveSize.height)
4750

4851
function constrainWidth(desiredWidth: number) {

0 commit comments

Comments
 (0)