Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

133
Views
JavaScript function that detects phone orientation change

Long story short I'm writing a calculator app in react-native and i want to have 2 different views for when the phone is vertiacly and horizontaly, is there a quick way to get the phone orientation without installing any packages

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

import { Dimensions } from 'react-native';

function useIsHorizonal() {
  const [isHorizonal, setIsHorizonal] = useState( Dimensions.screen.width > Dimensions.screen.height )
  useEffect(()=> {
     Dimensions.addEventListener(
         'change',
         ({ screen: { width, height }}) =>
              setIsHorizonal(width > height)
     )
   }, [])
   return isHorizonal
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!