react-device-detect icon indicating copy to clipboard operation
react-device-detect copied to clipboard

useMobileOrientation not working

Open jeremylin8 opened this issue 3 years ago • 2 comments

  1. Bug description When I tried to use "const { isLandscape } = useMobileOrientation()", I get "TypeError: Object(...) is not a function"

  2. Steps to reproduce import { useMobileOrientation } from 'react-device-detect'; const { isLandscape } = useMobileOrientation();

jeremylin8 avatar Nov 09 '21 18:11 jeremylin8

I had the same thing, then I updated react-device-detect to the latest version and tried it a bunch of times but it didn't work. A bit later after restarting my computer I tried with the exakt same code (I had ut commented the code out so I just uncommented it) and suddenly it worked. 🤷

ghost avatar Nov 17 '21 18:11 ghost

It's works with version : 2.1.2

//...
import { useMobileOrientation } from 'react-device-detect';

function App() {

        const mobileOrientation = useMobileOrientation();

        console.log( "Check in console ->", mobileOrientation )
//..

gmkhussain avatar Jan 25 '22 11:01 gmkhussain