Determining whether the device is a Tablet or a phone

Mehmet Ali Yılgın
2 min readJul 12, 2022

FOR REACT-NATIVE

Hello everyone. Today, I will explain this topic. I did research a lot of things about how can I design tablet and phone in same time. And I found 3 solution about it.

1. In the first method, what you need to do is to use a mathematical percentage. In this way, you can adjust the screen as you want on wide or narrow devices. But one thing to remember is that after version 9 on iPad devices, the screen does not detect vertical or horizontal rotation.

usage mathematical percentage

2. The perfect method:

Understand whether the device rotates horizontally or vertically. Then pull and use the variables assigned here wherever you want. Your designs will be error free with no slippage.

3. USAGE ? <DESIGN>:<DESIGN>

This method is the average method. The width of the average tablet devices starts from 400 pixels. For this reason, you need to do something like the following code snippet to the section you want to make original design.

SO BASIC

That’s it, you’ve made it. If you have any problems, contact me: mehmetaliyilgin.com

Good luck.

--

--