Commit 642360de authored by Lorenzo Trujillo Rojas's avatar Lorenzo Trujillo Rojas
Browse files

Se creó un hook que habilita y deshabilita la rotación del telefono

parent 66e7d44a
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
import { useEffect } from "react";
import * as ScreenOrientation from "expo-screen-orientation";

export const useRotationEnabled = () => {
  useEffect(() => {
    const lock = async () => {
      await ScreenOrientation.unlockAsync();
    };
    lock();
    return () => {
      ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.PORTRAIT);
    };
  }, []);
};