Absolute and relative positioning

This section is on the basics of positioning things. In React Native, everything is relative by default. This means that if I nest View into another View that has marginTop: 40, this positioning will affect my nested View too.

In React Native, we can also change positioning to absolute. Then the position will be calculated by a fixed number of pixels from our parent. Use the top/bottom + left/right keys in StyleSheet. Remember, other Views will not take this position into account. This is handy if you want to make Views overlap:

Three boxes overlap other because they are absolute-positioned to do so

Check ...

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.