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 margin, bottom, top, left, right, height, 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 ...

Get Hands-On Design Patterns with React Native now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.