View Component

Also called View

Mentioned in
Interop Layer
Updated

What is View Component in React Native?

View is the most basic layout container in React Native — the equivalent of a div on the web, a UIView on iOS and an android.view on Android.

<View> · UIView · android.view · <div>
Text inside the inner ViewViewHeld byView is the basic layout container: it draws nothing itself, groups children, and carries layout and styles such as background, padding and borders. It is a UIView on iOS, an android.view on Android and roughly a div on the web. Every View is a flexbox container whose default direction is column, not row. Views nest freely; Fabric made deep nesting much cheaper than it was, but a flatter tree is still easier to reason about.

View is the fundamental layout container in React Native. It draws nothing by itself; it exists to group children, apply layout, and carry styling such as background colour, padding, and borders. It maps to UIView on iOS, android.view on Android, and behaves roughly like a <div> on the web.

Every View is a flexbox container by default, and unlike the web the default flexDirection is column, not row. Views nest freely, and nesting is how you build layout:

<View style={{ flex: 1, padding: 16 }}>
  <View style={{ flexDirection: 'row', gap: 8 }}>
    <Text>Left</Text>
    <Text>Right</Text>
  </View>
</View>

Deeply nested views used to cost real performance on the old architecture. With the Fabric renderer the cost is far lower, but a flatter tree is still easier to reason about.

See the View documentation for the full prop list.