-
Notifications
You must be signed in to change notification settings - Fork 734
Add isTablet to Constants #499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/helpers/Constants.js
Outdated
@@ -40,6 +40,8 @@ export let screenWidth = width; | |||
export let screenHeight = height; | |||
export let isSmallScreen = screenWidth <= 340; | |||
export let isShortScreen = screenHeight <= 600; | |||
export const ratio = screenWidth < screenHeight ? screenHeight / screenWidth : screenWidth / screenHeight; | |||
export const isTablet = Platform.isPad || (ratio < 1.6 && Math.max(screenWidth, screenHeight) >= 900); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where did you get the 1.6 ratio limit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was a guesstimation in a Stack-Overflow answer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you test it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it worked on the devices I've tested; and I've added the screen size for good measure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool
src/helpers/Constants.js
Outdated
@@ -40,6 +40,8 @@ export let screenWidth = width; | |||
export let screenHeight = height; | |||
export let isSmallScreen = screenWidth <= 340; | |||
export let isShortScreen = screenHeight <= 600; | |||
export const ratio = screenWidth < screenHeight ? screenHeight / screenWidth : screenWidth / screenHeight; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you exporting ratio?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't need it exported, but thought it might be useful.
Do you want me to remove that? - Or maybe change the name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove the export till we need it and change the name to be more descriptive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
No description provided.