yocontra/react-responsive

not working on window-resizing

sagartmg opened this issue · 1 comments

while using toggle-device-toolbar in chrome, it does work but while resizing chrome window, it doesnot

// code
// sizes according to bootstrap
const isDesktopOrLaptop = useMediaQuery({ minDeviceWidth: 1200 })
const isTablet = useMediaQuery({ maxDeviceWidth: 1199, minDeviceWidth: 768 })
const isMobileDevice = useMediaQuery({ maxDeviceWidth: 767 })

and in render method

Device Test!


{isDesktopOrLaptop &&

You are a desktop or laptop

}
{isTablet &&

You are a tablet or mobile phone

}
{isMobileDevice &&

mobile mobile phone

}

works while using chrome toggle device toolbar
chrome_kh8Fdz0epu

doesnot works while doing simple window resizing.
chrome_ywI5MzCfOw

fixed using minWidth instted of minDeviceWidth in
const isDesktopOrLaptop = useMediaQuery({ minDeviceWidth: 1200 })
const isTablet = useMediaQuery({ maxDeviceWidth: 1199, minDeviceWidth: 768 })
const isMobileDevice = useMediaQuery({ maxDeviceWidth: 767 })