diff --git a/docs/Basics-Component-Image.md b/docs/Basics-Component-Image.md deleted file mode 100644 index 0682fa62aff56d..00000000000000 --- a/docs/Basics-Component-Image.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -id: basics-component-image -title: Image -layout: docs -category: The Basics -permalink: docs/basics-component-image.html -next: basics-component-view ---- - -Another basic React Native component is the [`Image`](/react-native/docs/image.html#content) component. Like `Text`, the `Image` component simply renders an image. - -> An `Image` is analogous to the `` HTML tag when building websites. - -The simplest way to render an image is to provide a source file to that image via the `source` attribute. - -This example displays a checkbox `Image` on the device. - -```ReactNativeWebPlayer -import React, { Component } from 'react'; -import { AppRegistry, Image } from 'react-native'; - -class ImageBasics extends Component { - render() { - return ( - - ); - } -} - -// App registration and rendering -AppRegistry.registerComponent('AwesomeProject', () => ImageBasics); -``` diff --git a/docs/Basics-Component-ScrollView.md b/docs/Basics-Component-ScrollView.md deleted file mode 100644 index 7acdb6404a8b2b..00000000000000 --- a/docs/Basics-Component-ScrollView.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -id: basics-component-scrollview -title: ScrollView -layout: docs -category: The Basics -permalink: docs/basics-component-scrollview.html -next: basics-component-listview ---- - -Given the screen sizes of mobile devices, the ability to scroll through data is generally paramount for a proper usability experience. - -The [`ScrollView`](/react-native/docs/scrollview.html) is a generic scrolling container that can host multiple components and views. The scrollable items need not be homogenous, and you can scroll both vertically and horizontally (by setting the `horizontal` property). - -`ScrollView` works best to present a list of short, static items of a known quantity. All the elements and views of a `ScrollView` are rendered a priori, even if they are not currently shown on the screen. Contrast this with a `ListView`, which render only those views that are on the screen and remove views that go off-screen. - -> [`TextView`](/react-native/docs/basics-component-textview.html) and [`ListView`](/react-native/docs/basics-component-listview.html) are specialized scrollable containers. - -This contrived example creates a horizontal `ScrollView` with a static amount of heterogenous elements (images and text). - -```ReactNativeWebPlayer -import React, { Component } from 'react'; -import{ AppRegistry, ScrollView, Image, Text, View } from 'react-native' - -class ScrollViewBasics extends Component { - render() { - return( - - - - - - - - - - - - Text1 - - - Text2 - - - Text3 - - - Text4 - - - - - - - - - - - - Text5 - - - Text6 - - - ); - } -} - - -AppRegistry.registerComponent('AwesomeProject', () => ScrollViewBasics); -``` diff --git a/docs/Basics-Component-Text.md b/docs/Basics-Component-Text.md deleted file mode 100644 index b2b888ef704194..00000000000000 --- a/docs/Basics-Component-Text.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -id: basics-component-text -title: Text -layout: docs -category: The Basics -permalink: docs/basics-component-text.html -next: basics-component-image ---- - -The most basic component in React Native is the [`Text`](/react-native/docs/text.html#content) component. The `Text` component simply renders text. - -This example displays the `string` `"Hello World!"` on the device. - -```ReactNativeWebPlayer -import React, { Component } from 'react'; -import { AppRegistry, Text } from 'react-native'; - -class TextBasics extends Component { - render() { - return ( - Hello World! - ); - } -} - -// App registration and rendering -AppRegistry.registerComponent('AwesomeProject', () => TextBasics); -``` - -In this slightly more advanced example we will display the `string` `"Hello World"` retrieved from this.state on the device and stored in the `text` variable. The value of the `text` variable is rendered by using `{text}`. - -```ReactNativeWebPlayer -import React, {Component} from 'react'; -import { AppRegistry, Text } from 'react-native'; - -class TextBasicsWithState extends Component { - constructor(props) { - super(props); - this.state = {text: "Hello World"}; - } - render() { - var text = this.state.text; - return ( - - {text} - - ) - } -} - -// App registration and rendering -AppRegistry.registerComponent('AwesomeProject', () => TextBasicsWithState); -``` diff --git a/docs/Basics-Component-TextInput.md b/docs/Basics-Component-TextInput.md deleted file mode 100644 index bee7a574dcd500..00000000000000 --- a/docs/Basics-Component-TextInput.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -id: basics-component-textinput -title: TextInput -layout: docs -category: The Basics -permalink: docs/basics-component-textinput.html -next: basics-component-scrollview ---- - -Direct text-based user input is a foundation for many apps. Writing a post or comment on a page is a canonical example of this. [`TextInput`](/react-native/docs/textinput.html#content) is a basic component that allows the user to enter text. - -This example creates a simple `TextInput` box with the `string` `Type something here` as the placeholder when the `TextInput` is empty. - -```ReactNativeWebPlayer -import React, { Component } from 'react'; -import { AppRegistry, Text, TextInput, View } from 'react-native'; - -class TextInputBasics extends Component { - render() { - return ( - - - - ); - } -} - -// App registration and rendering -AppRegistry.registerComponent('AwesomeProject', () => TextInputBasics); -``` diff --git a/docs/Basics-Component-View.md b/docs/Basics-Component-View.md deleted file mode 100644 index 52b83bdd89ade6..00000000000000 --- a/docs/Basics-Component-View.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -id: basics-component-view -title: View -layout: docs -category: The Basics -permalink: docs/basics-component-view.html -next: style ---- - -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 `
` 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, { Component } from 'react'; -import { AppRegistry, Text, View } from 'react-native'; - -class ViewBasics extends Component { - render() { - return ( - - Hello! - - ); - } -} - -// App registration and rendering -AppRegistry.registerComponent('AwesomeProject', () => ViewBasics); -``` diff --git a/docs/Basics-Components.md b/docs/Basics-Components.md deleted file mode 100644 index beeb418cbc77bd..00000000000000 --- a/docs/Basics-Components.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -id: basics-components -title: Components -layout: docs -category: The Basics -permalink: docs/basics-components.html -next: basics-component-text ---- - -Components are the building blocks for a React Native application. A React Native user interface (UI) is specified by declaring components, often nested. Those components are then mapped to the native UI on the targeted platform. - -####Props#### - -#####`this.props`##### - -Components can be configured by passing properties `props` to the constructor. You can access `props` from your component's methods by accessing `this.props`. You should not alter your props within component methods. - -####State#### - -#####`this.state`##### - -Components maintain their state using the state object. You can access your component state via `this.state`. Each component should manage its own state. Parent components should not manage children state and children components should not manage parent component state. - -#####`this.setState({key: value, ...})`##### - -To update or change the state of your component passing a new object representing your newly desired state to `this.setState(obj)`. The specificed keys will be merged into `this.state`. Any existing keys will be overridden by new values. - -## Core Components. - -React Native has a number of core components that are commonly used in applications, either on their own or combined to build new components. - -- [Text](/react-native/docs/basics-component-text.html) -- [Image](/react-native/docs/basics-component-image.html) -- [View](/react-native/docs/basics-component-view.html) -- [TextInput](/react-native/docs/basics-component-textinput.html) -- [ListView](/react-native/docs/basics-component-listview.html) \ No newline at end of file diff --git a/docs/QuickStart-GettingStarted.md b/docs/GettingStarted.md similarity index 90% rename from docs/QuickStart-GettingStarted.md rename to docs/GettingStarted.md index 03863fcb59c43c..2532eff21a6734 100644 --- a/docs/QuickStart-GettingStarted.md +++ b/docs/GettingStarted.md @@ -4,9 +4,17 @@ title: Getting Started layout: docs category: The Basics permalink: docs/getting-started.html -next: basics-components +next: tutorial --- +Welcome to React Native! This page will help you install React Native on +your system, so that you can build apps with it right away. If you already +have React Native installed, you can skip ahead to the +[Tutorial](/react-native/docs/tutorial.html). + +The instructions are a bit different depending on your development operating system, and whether you want to start developing for iOS or Android. If you +want to develop for both iOS and Android, that's fine - you just have to pick +one to start with, since the setup is a bit different.
-Target: +Mobile OS: iOS Android Development OS: @@ -58,13 +66,13 @@ block { display: none; } -## Dependencies +## Dependencies for Mac + iOS You will need Xcode, node.js, the React Native command line tools, and Watchman. -## Dependencies +## Dependencies for Mac + Android You will need Android Studio, node.js, the React Native command line tools, and Watchman. @@ -98,9 +106,15 @@ If you plan to make changes in Java code, we recommend [Gradle Daemon](https://d - + -## Dependencies +## Dependencies for Linux + Android + + + +## Dependencies for Windows + Android + + You will need node.js, the React Native command line tools, Watchman, and Android Studio. @@ -228,11 +242,14 @@ Congratulations! You've successfully run and modified a React Native app. -## Special Cases +## Now What? + +- If you want to add this new React Native code to an existing application, check out the [Integration guide](docs/integration-with-existing-apps.html). -- This page explains how to create a new React Native app. If you are adding React Native components to an existing application, check out the [Integration guide](docs/integration-with-existing-apps.html). +- If you can't get this to work, see the [Troubleshooting](docs/troubleshooting.html#content) page. -- If you run into any issues getting started, see the [Troubleshooting](docs/troubleshooting.html#content) page. +- If you're curious to learn more about React Native, continue on +to the [Tutorial](docs/tutorial.html).