Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 47d2d2e

Browse files
Doctor-wuantfu
andauthored
feat(isIOS): detect new iPad (#3582)
Co-authored-by: Anthony Fu <[email protected]>
1 parent 8cbfd9d commit 47d2d2e

File tree

1 file changed

+6
-1
lines changed
  • packages/shared/utils

1 file changed

+6
-1
lines changed

packages/shared/utils/is.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,10 @@ export const hasOwn = <T extends object, K extends keyof T>(val: T, key: K): key
2424
export const isIOS = /* #__PURE__ */ getIsIOS()
2525

2626
function getIsIOS() {
27-
return isClient && /* #__PURE__ */ window?.navigator?.userAgent && /* #__PURE__ */ /iP(ad|hone|od)/.test(/* #__PURE__ */ window.navigator.userAgent)
27+
return isClient && window?.navigator?.userAgent && (
28+
(/iP(ad|hone|od)/.test(window.navigator.userAgent))
29+
// The new iPad Pro Gen3 does not identify itself as iPad, but as Macintosh.
30+
// https://github.com/vueuse/vueuse/issues/3577
31+
|| (window?.navigator?.maxTouchPoints > 2 && /iPad|Macintosh/.test(window?.navigator.userAgent))
32+
)
2833
}

0 commit comments

Comments
 (0)