diff --git a/website/src/react-native/_index.js b/website/src/react-native/_index.js index 5b84e7f1e..95f216e85 100644 --- a/website/src/react-native/_index.js +++ b/website/src/react-native/_index.js @@ -32,7 +32,9 @@ var index = React.createClass({

Native iOS Components

-

With React Native, you can use the platform components such as iOS UITabBar and UINavigationController.

+

+ With React Native, you can use the standard platform components such as UITabBar and UINavigationController on iOS. This gives your app a consistent look and feel with the rest of the platform ecosystem, and keeps the quality bar high. These components are easily incorporated into your app using their React component counterparts, such as TabBarIOS and NavigatorIOS. +

{`var React = require('react-native'); var { TabBarIOS, NavigatorIOS } = React; @@ -49,13 +51,16 @@ module.exports = React.createClass({ });`} -

Async

- -

Decoding images off of the main thread... Asynchronous bridge, Chrome Dev Tools...

- +

Asynchronous

+

+ All operations between the JavaScript application code and the native platform are performed asynchronously, and the native modules can also make use of additional threads as well. This means we can decode images off of the main thread, save to disk in the background, measure text and compute layouts without blocking the UI, and more. As a result, React Native apps are naturally fluid and responsive. The communication is also fully serializable, which allows us to leverage Chrome Developer Tools to debug JS while running the app in the full app environment, in the sim or on a real device. +

+

Touch Handling

-

iOS has a very powerful system called Responder to handle touches which the web lacks. React Native implements iOS responder system and provides high level components such as TouchableHighlight that work well right off the bat.

+

+ iOS has a very powerful system called the Responder Chain to negotiate touches in complex view hierarchies which does not have a universal analog on the web. React Native implements a similar responder system and provides high level components such as TouchableHighlight that integrate properly with scroll views and other elements without any additional configutation. +

{`var React = require('react-native'); var { ScrollView, TouchableHighlight, Text } = React; @@ -63,7 +68,7 @@ module.exports = React.createClass({ render: function() { return ( - + console.log('pressed')}> Proper Touch Handling @@ -72,9 +77,10 @@ module.exports = React.createClass({ });`} -

Flexbox

-

Laying out views should be easy

- +

Flexbox and Styling

+

+ Laying out views should be easy, which is why we brought the flexbox layout model from the web to React Native. Flexbox makes it easy to build the most common UI layouts, such as stacked and nested boxes with margin and padding. React Native also supports common web syles, such as fontWeight, and the StyleSheet abstraction makes it easy to declare all your styles and layout right along with the components that use them and used inline. +

{`var React = require('react-native'); var { Image, StyleSheet, Text, View } = React; @@ -87,8 +93,12 @@ module.exports = React.createClass({ style={styles.image} /> - React Native - Build high quality mobile apps using React + + React Native + + + Build high quality mobile apps using React + ); @@ -104,8 +114,33 @@ var styles = StyleSheet.create({

Polyfills

-

React Native attempts to innovate on the view layer, for the rest, it polyfills web standards. You can use npm to install JavaScript dependencies, XMLHttpRequest, requestAnimationFrame, navigator.geolocation...

- +

+ React Native is focused on changing the way view code is written. For the rest, we look to the web for universal standards and polyfill those APIs where appropriate. You can use npm to install JavaScript libraries that work on top of the functionality baked into React Native, such as XMLHttpRequest, requestAnimationFrame, and navigator.geolocation. We are working on expanding the available APIs, and are excited for the Open Source community to contribute as well. +

+ +{`var React = require('react-native'); +var { Text } = React; +module.exports = React.createClass({ + getInitialState: function() { + return { + position: 'unknown', + }; + }, + componentDidMount: function() { + navigator.geolocation.getCurrentPosition( + (position) => this.setState({position}), + (error) => console.error(error) + ); + }, + render: function() { + return ( + + Position: {JSON.stringify(this.state.position)} + + ); + }, +});`} + ); diff --git a/website/src/react-native/img/chrome_breakpoint.png b/website/src/react-native/img/chrome_breakpoint.png new file mode 100644 index 000000000..c5ab5f3e1 Binary files /dev/null and b/website/src/react-native/img/chrome_breakpoint.png differ