Skip to content

Commit 3b29f38

Browse files
author
Joe Ipson
committed
Update index.js
1 parent 8da70ba commit 3b29f38

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,18 @@ class DetectDeviceService {
1111
this.pixelDensity = PixelRatio.get();
1212
this.width = windowSize.width;
1313
this.height = windowSize.height;
14+
this.adjustedWidth = this.width * this.pixelDensity;
15+
this.adjustedHeight = this.height * this.pixelDensity;
1416

1517
this.isPhoneOrTablet();
1618
this.isIosOrAndroid();
1719
}
1820

1921
isPhoneOrTablet() {
20-
if(this.pixelDensity < 2 && (this.width >= 1000 || this.height >= 1000)) {
22+
if(this.pixelDensity < 2 && (this.adjustedWidth >= 1000 || this.adjustedHeight >= 1000)) {
2123
this.isTablet = true;
2224
this.isPhone = false;
23-
} else if(this.pixelDensity === 2 && (this.width >= 1920 || this.height >= 1920)) {
25+
} else if(this.pixelDensity === 2 && (this.adjustedWidth >= 1920 || this.adjustedHeight >= 1920)) {
2426
this.isTablet = true;
2527
this.isPhone = false;
2628
} else {
@@ -40,4 +42,4 @@ class DetectDeviceService {
4042
}
4143
}
4244

43-
module.exports = new DetectDeviceService();
45+
module.exports = new DetectDeviceService();

0 commit comments

Comments
 (0)