Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3264 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 3264 Rev 3266
Línea 1... Línea 1...
1
import { useEffect, useState } from 'react'
1
import { useEffect, useState } from 'react'
Línea -... Línea 2...
-
 
2
 
-
 
3
import { isAndroidDevice, isIOSDevice } from '@utils'
2
 
4
 
3
export function useMobile() {
5
export function useMobile() {
Línea 4... Línea 6...
4
  const [isMobile, setIsMobile] = useState(false)
6
  const [isMobile, setIsMobile] = useState(false)
5
 
-
 
6
  useEffect(() => {
-
 
7
    const isIOSDevice = () => {
-
 
8
      const userAgent = navigator.userAgent || navigator.vendor || window.opera
-
 
9
      return /iPad|iPhone|iPod/.test(userAgent) && !window.MSStream
-
 
10
    }
-
 
11
 
-
 
12
    const isAndroidDevice = () => {
-
 
13
      const userAgent = navigator.userAgent || navigator.vendor || window.opera
-
 
14
      return /android/i.test(userAgent)
-
 
15
    }
7
 
Línea 16... Línea 8...
16
 
8
  useEffect(() => {
17
    const isMobileDevice = isIOSDevice() || isAndroidDevice()
9
    const isMobileDevice = isIOSDevice() || isAndroidDevice()
18
 
10