Skip to content

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

Merged
merged 2 commits into from
Aug 8, 2019
Merged

Conversation

M-i-k-e-l
Copy link
Collaborator

No description provided.

@@ -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);
Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you test it?

Copy link
Collaborator Author

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

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool

@@ -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;
Copy link
Collaborator

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?

Copy link
Collaborator Author

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?

Copy link
Collaborator

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@Inbal-Tish Inbal-Tish merged commit f9b1430 into master Aug 8, 2019
@M-i-k-e-l M-i-k-e-l deleted the feat/add-is-tablet-to-constants branch September 15, 2019 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants