Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES6-ify View Basics #8366

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions docs/Basics-Component-View.md
Original file line number Diff line number Diff line change
@@ -16,17 +16,19 @@ It is recommended that you wrap your components in a `View` to style and control
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 React, { Component } from 'react';
import { AppRegistry, Text, View } from 'react-native';

const AwesomeProject = () => {
return (
<View style={{marginTop: 22, alignItems: 'center'}}>
<Text>Hello!</Text>
</View>
);
class ViewBasics extends Component {
render() {
return (
<View style={{marginTop: 22, alignItems: 'center'}}>
<Text>Hello!</Text>
</View>
);
}
}

// App registration and rendering
AppRegistry.registerComponent('AwesomeProject', () => AwesomeProject);
AppRegistry.registerComponent('AwesomeProject', () => ViewBasics);
```