plane/web/hooks/use-platform-os.tsx

13 lines
348 B
TypeScript
Raw Normal View History

import { useEffect, useState } from "react";
export const usePlatformOS = () => {
const [isMobile, setIsMobile] = useState(false);
useEffect(() => {
const userAgent = window.navigator.userAgent;
const isMobile = /iPhone|iPad|iPod|Android/i.test(userAgent);
if (isMobile) setIsMobile(isMobile);
}, []);
2024-03-19 14:38:35 +00:00
return { isMobile };
};