mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
cb632408f9
Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
13 lines
345 B
TypeScript
13 lines
345 B
TypeScript
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);
|
|
}, []);
|
|
return {isMobile};
|
|
}
|