Scaling React Native apps for Tablets

Lets make your React Native app look good on Tablets

Akshay Kadam
May 1, 2018 · 5 min read

If you’ve ever worked on a React Native app then you must’ve wondered how do I make this look good on Tablets. Worry not. This tutorial will teach you how to make your React Native app not look weird on Tablets or lets say any other device.

The Problem

When you make a React Native app, you just make it to work on Mobile Phones. The problem occurs when you try to make it work on Tablets. The reason is Tablets have more pixels than Mobile phones. So whatever dimensions you specify for Mobile are definitely not going to work for Tablets. In short, the bigger your device gets, the more pixels it will have.

From the ,

All dimensions in React Native are unitless, and represent density-independent pixels. Setting dimensions this way is common for components that should always render at exactly the same size, regardless of screen dimensions.

The Solution

I created a simple Chat App for this tutorial which already looks good on Mobile & we will learn how to scale the app to make it look good on Tablets.

🔗 The complete source code can be found .

Following picture shows how the App looks when you see it on Mobile (iPhone X) & when you see it on Tablet (iPad Air 2) —

iPhone X (on the left) & iPad Air 2 (on the right) without Scaling

As seen above, the app on Tablet looks very small than on Phone. So we need to scale it to look good on Tablet as well.

Scaling with Flex

Flexbox is helpful while scaling. But, flexbox only scales throughout the entire width or height of the container it is in. It keeps the same proportions among different devices.

Flexbox can scale well if we add some hacks by introducing more containers but its a lot of work.

Also, flex is limited to certain properties like width, height, margin & padding. But we can't use it for some other properties like fontSize, lineHeight or SVGs.

Scaling with Percentages

We can scale our app well using Percentages (%).

React Native v0.42 & above has added support for Percentages (%) but it is only limited to the properties like padding, margin, width, height, minWidth, minHeight, maxWidth, maxHeight, flexBasis.

Other properties like fontSize & lineHeight don't work well with percentages.

Scaling with a Library

is a library written by Nir Hadasi which helps us make our scaling easier by providing 3 simple utility functions.

The library is very small & it contains 3 simple utility functions namely —

scale(size: number) — Returns linear scaled result of the provided size, based on your device's screen width.

verticalScale(size: number) — Returns linear scaled result of the provided size, based on your device's screen height.

moderateScale(size: number, factor?: number) — Returns non-linear scale based on a resize factor (defaults to 0.5). If normal scale will increase by +2X, moderateScale will only increase it by +X.

It has some Guideline sizes which are based on ~5" screen mobile devices that makes it easy to scale for bigger devices.

It also has a ScaledSheet method which is a scaled StyleSheet

It uses the following API —

<size>@s — Applies scale function on size

<size>@vs— Applies verticalScale function on size

<size>@ms — Applies moderateScale function with resize factor of 0.5 on size

<size>@ms<factor> — Applies moderateScale function with resize factor of factor on size

Chat App Demo

Now we’re going to use react-native-size-matters in our Basic Chat App.

We’re going to build a simple Chat Wrapper (the one with Yellow & Blue Background) using react-native-size-matters.

Without using react-native-size-matters

Without react-native-size-matters

Using react-native-size-matters

With react-native-size-matters

As you can see the only thing we needed to change was height, padding, margin & fontSize to scale it well across different devices.


The way I like to scale is always try Flexbox in the beginning. Then I try to use Percentages wherever possible. Later, I try to scale the height property vertically using <size>@vs & for everything else I use either <size>@ms or <size>@s.

The example provided in the repo is a little different as I’ve abstracted the common part into a wrapper to make the code more readable. It also has a switch to check how the App would look if react-native-size-matters is not enabled.

The final solution after applying scaling looks like —

iPhone X (on the left) & iPad Air 2 (on the right) with Scaling

You can scan the following QR code to run this app if you have the client installed on your Android or iOS device:

Have more questions about scaling React Native apps?

Hit me up on ! Don’t be shy to Say Hi 😃

React Native Training

Stories and tutorials for developers interested in React…

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store