<View>

A View is a fundamental 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 that is a UIView, <div>, android.view, etc.

Special PropsstyletestIDnativeIDhitSloppointerEventsfocusable AndroidnextFocusDown AndroidnextFocusForward AndroidnextFocusLeft AndroidnextFocusRight AndroidnextFocusUp Android Performance Propscollapsible AndroidneedsOffscreenAlphaCompositingremoveClippedSubviewsshouldRasterizeIOS iOSrenderToHardwareTextureAndroid Android
Accessibility PropsaccessibilityActionsaccessibilityElementsHidden iOSaccessibilityHintaccessibilityIgnoresInvertColors iOSaccessibilityLabelaccessibilityLiveRegion AndroidaccessibilityRoleaccessibilityStateaccessibilityValueaccessibilityViewIsModal iOSaccessibleimportantForAccessibility AndroidonAccessibilityActiononAccessibilityEscape iOSonAccessibilityTap Other Event PropsonLayoutonMagicTap iOSonMoveShouldSetResponderonMoveShouldSetResponderCaptureonResponderGrantonResponderMoveonResponderRejectonResponderReleaseonResponderTerminateonResponderTerminationRequestonStartShouldSetResponderonStartShouldSetResponderCapture

testID is a string used to locate the view in end-to-end tests.nativeID is a string used to locate this view from native classes.

hitSlop defines how far a touch event can start away from the view. Eg.:

pointerEvents indicates whether the View can be the target of touch events. Can be:

'auto': The View can be the target of touch events.

'none': The View is never the target of touch events.

'box-none': The View is never the target of touch events but its subviews can be.

'box-only': The view can be the target of touch events but its subviews cannot be.

focusable indicates whether the View should be focusable with a non-touch input device, eg. receive focus with a hardware keyboard.

nextFocus{Down|Up|Left|Right|Forward} is a number that designates the next view to receive focus as the user navigates around.

collapsible.Views that are only used to layout their children or otherwise don't draw anything may be automatically removed from the native hierarchy as an optimization. Set this property to false to disable this optimization and ensure that this View exists in the native view hierarchy.

needsOffscreenAlphaCompositing indicates whether the View needs to be rendered offscreen and composited with alpha to preserve 100% correct colors and blending behavior. (defaults to false)

removeClippedSubviews is a reserved performance property exposed by RCTView and is useful for scrolling content when there are many subviews, most of which are offscreen. The subviews and containing view must have {overflow: hidden}.

shouldRasterizeIOS indicates whether the View should be rendered as a bitmap before compositing. On iOS, this is useful for animations and interactions that do not modify this component's dimensions nor its children; for example, when translating the position of a static view, rasterization allows the renderer to reuse a cached bitmap of a static view and quickly composite it during each frame. Rasterization incurs an off-screen drawing pass and the bitmap consumes memory. Test and measure when using this property.

renderToHardwareTextureAndroidindictes whether this View should render itself (and all its children) into a single hardware texture on the GPU. On Android, this is useful for animations and interactions that only modify opacity, rotation, translation, and/or scale: in those cases, the view doesn't have to be redrawn and display lists don't need to be re-executed. The texture can be re-used and re-composited with different parameters. The downside is that this can use up limited video memory, so this prop should be set back to false at the end of the interaction/animation.

[ Accessibility p rops ] define the behaviors of assistive technology.

onLayout is invoked on mount and layout changes.

The [other event props] define touch interactions.

There are a few subclasses of <View>: <KeyboardAvoidingView>, <ScrollView>, <SafeAreaView>, <InputAccessoryView>.