The most fundamental component for building a UI. View is a container that supports layout with flexbox, style, some touch handling, and accessibility controls. View maps directly to the native view equivalent on whatever platform React Native is running on, whether it's a UIView, <div>, android.view, etc.

A View is designed to be nested inside other views and can have zero to many children of any type.

Style Properties

Style properties allow you to customize the look and feel of the component. Combinations of styles applied to components can be saved as Stylesheets to easily reuse styles throughout your app. Styles can also be set dynamically using Variables. To learn more about all the different styling properties and how they work, take a look at Intro to Styling.

Configuration Properties

Basic

PropertyDescription
Component NameTo alter the name of the component. The name is reflected in the Components tree. Defaults to View.

Advanced

PropertyDescription
collapsableEnable to automatically remove the View from the native hierarchy if it's unneeded in order to optimize performance.
hitSlopDefines how far away a touch event will be registered from the View.
removeClippedSubviewsUsed for scrolling content that contains offscreen subviews (subviews must have overflow set to hidden).
shouldRasterizeIOSEnable to render the View as a bitmap before compositing.
pointerEventsDetermines if a View can handle touch events.
renderToHardwareTextureAndroidDetermine if the View and its children should be rendered into one hardware texture on the GPU.
needsOffscreenAlphaCompositingDetermine if the View should be rendered offscreen and composited with alpha in order to preserve original colors and blending behaviour.

Accessibility

You can apply the following accessibility configurations on a View component:

PropertyDescription
accessibilityLiveRegionDetermine how accessibility services should inform the user of any changes made to the View.
importantForAccessibilityDetermines the View's importance for accessibility and also how accessibility events work.
accessibleWhen enabled, the element will be defined as accessible (defaults to false).
accessibilityLabelText in this input will override what the user's screen reader would read by default.
accessibilityHintAdditional explanation of what happens when a user interacts with an accessibility element.
accessibilityElementsHiddenEnable to hide accessibility elements within the View (defaults to false).
accessibilityRoleDefines the role of the element for the user's screen reader.
accessibilityIgnoresInvertColorsEnable to prevent the color of the View from being inverted if color inversion is turned on.

Data Properties

Conditional Display

You can conditionally display a component based on a given condition. Learn more about conditionally displaying components in the Conditional Display doc.

Triggers

NameDescription
On LayoutRuns the Actions immediately once the layout has been calculated when the component is mounted and on layout changes

Actions for the On Layout Trigger will have access to an event variable which contains the event object:

{
    layout: {
        width: 520,
        height: 70.5,
        x: 0,
        y: 42.5
    },
    target: 1127
}