Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

134
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda