mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
d464f1d1c2
Summary: > ListView is not supported by React Native Web as of yet, so it will not have it. Closes https://github.com/facebook/react-native/pull/8331 Differential Revision: D3472019 Pulled By: lacker fbshipit-source-id: e5fb430b6c8f4d437943c159beb00b9d9252c92d
33 lines
1.2 KiB
Markdown
33 lines
1.2 KiB
Markdown
---
|
|
id: basics-component-view
|
|
title: View
|
|
layout: docs
|
|
category: The Basics
|
|
permalink: docs/basics-component-view.html
|
|
next: basics-component-textinput
|
|
---
|
|
|
|
A [`View`](/react-native/docs/view.html#content) is the most basic building block for a React Native application. The `View` is an abstraction on top of the target platform's native equivalent, such as iOS's `UIView`.
|
|
|
|
> A `View` is analogous to using a `<div>` HTML tag for building websites.
|
|
|
|
It is recommended that you wrap your components in a `View` to style and control layout.
|
|
|
|
The example below creates a `View` that aligns the `string` `Hello` in the top center of the device, something which could not be done with a `Text` component alone (i.e., a `Text` component without a `View` would place the `string` in a fixed location in the upper corner):
|
|
|
|
```ReactNativeWebPlayer
|
|
import React from 'react';
|
|
import { AppRegistry, Text, View } from 'react-native';
|
|
|
|
const AwesomeProject = () => {
|
|
return (
|
|
<View style={{marginTop: 22, alignItems: 'center'}}>
|
|
<Text>Hello!</Text>
|
|
</View>
|
|
);
|
|
}
|
|
|
|
// App registration and rendering
|
|
AppRegistry.registerComponent('AwesomeProject', () => AwesomeProject);
|
|
```
|