| 12345678910111213141516171819 |
- /**
- * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
- * SPDX-License-Identifier: MIT
- */
- import { useState, useEffect } from 'react';
- export const useIsMobile = (): boolean => {
- const [isMobile, setIsMobile] = useState<boolean>(false);
- useEffect(() => {
- const checkIsMobile = (): boolean =>
- /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
- setIsMobile(checkIsMobile());
- }, []);
- return isMobile;
- };
|