31 lines
809 B
TypeScript
31 lines
809 B
TypeScript
// Metro module 14603 (f14604).
|
|
import { useRef, useEffect } from "react";
|
|
import { isMetaQuest } from "../../device/MetaQuestUtils.android";
|
|
import { lockOrientation, unlockOrientation } from "../../device/native/DeviceOrientation";
|
|
let c10295_3 = 0;
|
|
export function useShopOrientationLock() {
|
|
const ref = useRef(false);
|
|
useEffect(() => {
|
|
if (isMetaQuest()) {
|
|
return void 0;
|
|
}
|
|
if (c10295_3 === 0) {
|
|
lockOrientation("PORTRAIT", true);
|
|
}
|
|
ref.current = true;
|
|
c10295_3 = c10295_3 + 1;
|
|
return () => {
|
|
if (ref.current) {
|
|
const r0 = c10295_3 - 1;
|
|
c10295_3 = r0;
|
|
if (r0 === 0) {
|
|
unlockOrientation({
|
|
unlockAfterRotatingToPreviousLock: false
|
|
});
|
|
}
|
|
ref.current = false;
|
|
}
|
|
};
|
|
}, []);
|
|
}
|