Files
react-native/docs/Basics-Component-View.md
Kevin Lacker 072ef0a0d4 More Resources doc, updating Support doc and quickstart too
Summary:
TLDR even more docs changes

So I created a More Resources doc that aggregates the high-quality-but-off-site stuff. Let's try to put more outlinks there. Also I removed the stuff on Support that was not support, and some misc changes to clean stuff up.
Closes https://github.com/facebook/react-native/pull/8329

Differential Revision: D3471669

Pulled By: JoelMarcey

fbshipit-source-id: 54edd543ced1b3a8f3d0baca5475ac96bae6e487
2016-06-22 14:28:44 -07:00

33 lines
1.1 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):
```JavaScript
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);
```