mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 23:16:52 +08:00
fix(platform): account for larger tablets (#17630)
* fix(platform): account for larger tablets * lint files * add utils file, clean up tests, add more tests * update tests with extra desktop checks * change window to win
This commit is contained in:
@ -35,6 +35,10 @@ const isIOS = (win: Window) =>
|
||||
const isAndroid = (win: Window) =>
|
||||
testUserAgent(win, /android|sink/i);
|
||||
|
||||
const isAndroidTablet = (win: Window) => {
|
||||
return isAndroid(win) && !testUserAgent(win, /mobile/i);
|
||||
};
|
||||
|
||||
const isPhablet = (win: Window) => {
|
||||
const width = win.innerWidth;
|
||||
const height = win.innerHeight;
|
||||
@ -50,8 +54,15 @@ const isTablet = (win: Window) => {
|
||||
const height = win.innerHeight;
|
||||
const smallest = Math.min(width, height);
|
||||
const largest = Math.max(width, height);
|
||||
return (smallest > 460 && smallest < 820) &&
|
||||
(largest > 780 && largest < 1400);
|
||||
|
||||
return (
|
||||
isIpad(win) ||
|
||||
isAndroidTablet(win) ||
|
||||
(
|
||||
(smallest > 460 && smallest < 820) &&
|
||||
(largest > 780 && largest < 1400)
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
const isMobile = (win: Window) =>
|
||||
|
||||
Reference in New Issue
Block a user