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
View is designed to be nested inside other views and can have zero to many children of any type.
Adding a View component
- Select the View component from the Components drawer. You can open the list of components by clicking the
+button next to Components.
The example below creates a View with a background color, fixed width, and height. It also wraps another View with a different background color, width, and height.
To customize styles of a View component, check the Styles documentation.
Basic Configuration Properties
|Component Name||To alter the name of the component. The name is reflected in the Components tree. Defaults to View.|
Advanced Configuration Properties
|collapsable||Enable to automatically remove the View from the native hierarchy if it's unneeded in order to optimize performance.|
|hitSlop||Defines how far away a touch event will be registered from the View.|
|pointerEvents||Determines if a View can handle touch events.|
|removeClippedSubviews||Used for scrolling content that contains offscreen subviews (subviews must have |
|needsOffscreenAlphaCompositing||Determine if the View should be rendered offscreen and composited with alpha in order to preserve original colors and blending behaviour.|
|renderToHardwareTextureAndroid||Determine if the View and its children should be rendered into one hardware texture on the GPU.|
|shouldRasterizeIOS||Enable to render the View as a bitmap before compositing.|
Accessibility Configuration Properties
You can apply the following accessibility configurations on a View component:
|accessibilityLiveRegion||Determine how accessibility services should inform the user of any changes made to the View.|
|importantForAccessibility||Determines the View's importance for accessibility and also how accessibility events work.|
|accessible||When enabled, the element will be defined as accessible (defaults to false).|
|accessibilityLabel||Text in this input will override what the user's screen reader would read by default.|
|accessibilityHint||Additional explanation of what happens when a user interacts with an accessibility element.|
|accessibilityElementsHidden||Enable to hide accessibility elements within the View (defaults to false).|
|accessibilityRole||Defines the role of the element for the user's screen reader.|
|accessibilityIgnoresInvertColors||Enable to prevent the color of the View from being inverted if color inversion is turned on.|
Updated 7 months ago