O'Reilly logo

Hands-On Design Patterns with React Native by Mateusz Grzesiukiewicz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Learning unitless dimensions

In this section, we will learn the dimensions in which React Native applications are measured onscreen.

"The simplest way to set the dimensions of a component is by adding a fixed width and height to style. All dimensions in React Native are unitless, and represent density-independent pixels." - React Native official documentation https://facebook.github.io/react-native/docs/height-and-width.html.

Unlike in CSS, for style properties such as marginbottomtopleftrightheight, and width, you must provide values in dp or percentages.

That's it for the documentation. But you also need to understand the following keywords when it comes to working with screens:

  • Pixels: These are the smallest single elements ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required