diff --git a/README.md b/README.md index 70dc0d50..e6ee7dee 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,8 @@ Demos: Sample: ```js -import React, { AppRegistry, Image, StyleSheet, Text, View } from 'react-native' +import React from 'react' +import { AppRegistry, Image, StyleSheet, Text, View } from 'react-native' // Components const Card = ({ children }) => {children} diff --git a/docs/components/ActivityIndicator.md b/docs/components/ActivityIndicator.md index 31148c50..575a46c8 100644 --- a/docs/components/ActivityIndicator.md +++ b/docs/components/ActivityIndicator.md @@ -23,7 +23,8 @@ Size of the indicator. Small has a height of `20`, large has a height of `36`. ## Examples ```js -import React, { ActivityIndicator, Component, StyleSheet, View } from 'react-native' +import React, { Component } from 'react' +import { ActivityIndicator, StyleSheet, View } from 'react-native' class ToggleAnimatingActivityIndicator extends Component { constructor(props) { diff --git a/docs/components/Image.md b/docs/components/Image.md index d88debd8..c04c8495 100644 --- a/docs/components/Image.md +++ b/docs/components/Image.md @@ -78,7 +78,8 @@ Example usage: ```js import placeholderAvatar from './placeholderAvatar.png' -import React, { Component, Image, PropTypes, StyleSheet } from 'react-native' +import React, { Component } from 'react' +import { Image, PropTypes, StyleSheet } from 'react-native' export default class ImageExample extends Component { constructor(props, context) { diff --git a/docs/components/ListView.md b/docs/components/ListView.md index fd3009b1..cc8308c5 100644 --- a/docs/components/ListView.md +++ b/docs/components/ListView.md @@ -15,7 +15,8 @@ Content to display over the image. ## Examples ```js -import React, { Component, ListView, PropTypes } from 'react-native' +import React, { Component, PropTypes } from 'react' +import { ListView } from 'react-native' export default class ListViewExample extends Component { static propTypes = {} diff --git a/docs/components/Portal.md b/docs/components/Portal.md index 5776f9e1..8ffc7ebb 100644 --- a/docs/components/Portal.md +++ b/docs/components/Portal.md @@ -33,7 +33,8 @@ React component to render. This same tag can later be used in `closeModal`. ## Examples ```js -import React, { Portal, Text, Touchable } from 'react-native' +import React, { Component } from 'react' +import { Portal, Text, Touchable } from 'react-native' export default class PortalExample extends Component { componentWillMount() { diff --git a/docs/components/ScrollView.md b/docs/components/ScrollView.md index 25cfed27..9d2a18e3 100644 --- a/docs/components/ScrollView.md +++ b/docs/components/ScrollView.md @@ -83,7 +83,8 @@ Scrolls to a given `x`, `y` offset (animation is not currently supported). ## Examples ```js -import React, { Component, ScrollView, StyleSheet } from 'react-native' +import React, { Component } from 'react' +import { ScrollView, StyleSheet } from 'react-native' import Item from './Item' export default class ScrollViewExample extends Component { diff --git a/docs/components/Text.md b/docs/components/Text.md index 51f4a266..acc4c23a 100644 --- a/docs/components/Text.md +++ b/docs/components/Text.md @@ -75,7 +75,8 @@ Used to locate this view in end-to-end tests. ## Examples ```js -import React, { Component, PropTypes, StyleSheet, Text } from 'react-native' +import React, { Component, PropTypes } from 'react' +import { StyleSheet, Text } from 'react-native' export default class PrettyText extends Component { static propTypes = { diff --git a/docs/components/TextInput.md b/docs/components/TextInput.md index bea85c3f..c15464e0 100644 --- a/docs/components/TextInput.md +++ b/docs/components/TextInput.md @@ -164,7 +164,8 @@ Focus the underlying DOM input. ## Examples ```js -import React, { Component, StyleSheet, TextInput } from 'react-native' +import React, { Component } from 'react' +import { StyleSheet, TextInput } from 'react-native' export default class TextInputExample extends Component { constructor(props, context) { diff --git a/docs/components/View.md b/docs/components/View.md index 42efd35b..61990bc3 100644 --- a/docs/components/View.md +++ b/docs/components/View.md @@ -184,7 +184,8 @@ Used to locate this view in end-to-end tests. ## Examples ```js -import React, { Component, PropTypes, StyleSheet, View } from 'react-native' +import React, { Component, PropTypes } from 'react' +import { StyleSheet, View } from 'react-native' export default class ViewExample extends Component { render() { diff --git a/docs/guides/react-native.md b/docs/guides/react-native.md index 2227c6ca..30714924 100644 --- a/docs/guides/react-native.md +++ b/docs/guides/react-native.md @@ -40,11 +40,7 @@ module.exports = { Minor platform differences can use the `Platform` module. ```js -import { AppRegistry, Platform, StyleSheet } from 'react-native' - -const styles = StyleSheet.create({ - height: (Platform.OS === 'web') ? 200 : 100 -}) +import { AppRegistry, Platform } from 'react-native' AppRegistry.registerComponent('MyApp', () => MyApp) diff --git a/docs/guides/rendering.md b/docs/guides/rendering.md index 89ed5786..ae762421 100644 --- a/docs/guides/rendering.md +++ b/docs/guides/rendering.md @@ -21,14 +21,15 @@ module.exports = { Rendering without using the `AppRegistry`: ```js -import React from 'react-native' +import ReactDOM from 'react-dom' +import ReactDOMServer from 'react-dom/server' // DOM render -React.render(
, document.getElementById('react-app')) +ReactDOM.render(
, document.getElementById('react-app')) // Server render -React.renderToString(
) -React.renderToStaticMarkup(
) +ReactDOMServer.renderToString(
) +ReactDOMServer.renderToStaticMarkup(
) ``` Rendering using the `AppRegistry`: @@ -36,7 +37,7 @@ Rendering using the `AppRegistry`: ```js // App.js -import React, { AppRegistry } from 'react-native' +import React from 'react' // component that renders the app const AppContainer = (props) => { /* ... */ } @@ -46,8 +47,8 @@ export default AppContainer ```js // client.js -import React, { AppRegistry } from 'react-native' import App from './App' +import { AppRegistry } from 'react-native' // registers the app AppRegistry.registerComponent('App', () => App) @@ -62,7 +63,7 @@ rendering. ```js // AppShell.js -import React from 'react-native' +import React from 'react' const AppShell = (html, styleElement) => ( @@ -82,9 +83,9 @@ export default AppShell ```js // server.js -import React, { AppRegistry } from 'react-native' import App from './App' import AppShell from './AppShell' +import { AppRegistry } from 'react-native' // registers the app AppRegistry.registerComponent('App', () => App) diff --git a/examples/2048/Game2048.js b/examples/2048/Game2048.js index 3be6adbd..7004185d 100644 --- a/examples/2048/Game2048.js +++ b/examples/2048/Game2048.js @@ -16,7 +16,8 @@ */ 'use strict'; -var React = require('react-native'); +var React = require('react'); +var ReactNative = require('react-native'); var { Animated, AppRegistry, @@ -24,7 +25,7 @@ var { Text, TouchableBounce, View, -} = React; +} = ReactNative; var GameBoard = require('./GameBoard'); diff --git a/examples/TicTacToe/TicTacToe.js b/examples/TicTacToe/TicTacToe.js index 3b562194..860d5c53 100644 --- a/examples/TicTacToe/TicTacToe.js +++ b/examples/TicTacToe/TicTacToe.js @@ -16,14 +16,15 @@ */ 'use strict'; -var React = require('react-native'); +var React = require('react'); +var ReactNative = require('react-native'); var { AppRegistry, StyleSheet, Text, TouchableHighlight, View, -} = React; +} = ReactNative; class Board { grid: Array>; diff --git a/examples/components/App.js b/examples/components/App.js index f43df40a..d3140d39 100644 --- a/examples/components/App.js +++ b/examples/components/App.js @@ -1,6 +1,7 @@ import GridView from './GridView' import Heading from './Heading' -import React, { Image, StyleSheet, ScrollView, Text, TextInput, TouchableHighlight, View } from 'react-native' +import React from 'react' +import { Image, StyleSheet, ScrollView, Text, TextInput, TouchableHighlight, View } from 'react-native' export default class App extends React.Component { static propTypes = { diff --git a/examples/index.js b/examples/index.js index 74af3f62..679cb64e 100644 --- a/examples/index.js +++ b/examples/index.js @@ -1,4 +1,4 @@ -import React, { AppRegistry } from 'react-native' +import { AppRegistry } from 'react-native' import Game2048 from './2048/Game2048' import TicTacToeApp from './TicTacToe/TicTacToe' diff --git a/src/__tests__/index-test.js b/src/__tests__/index-test.js deleted file mode 100644 index f8ee8189..00000000 --- a/src/__tests__/index-test.js +++ /dev/null @@ -1,23 +0,0 @@ -/* eslint-env mocha */ - -import assert from 'assert' -import React from '..' - -suite('ReactNativeWeb', () => { - suite('exports', () => { - test('React', () => { - assert.ok(React) - }) - - test('ReactDOM methods', () => { - assert.ok(React.findDOMNode) - assert.ok(React.render) - assert.ok(React.unmountComponentAtNode) - }) - - test('ReactDOM/server methods', () => { - assert.ok(React.renderToString) - assert.ok(React.renderToStaticMarkup) - }) - }) -}) diff --git a/src/index.js b/src/index.js index 3d883619..86c86f55 100644 --- a/src/index.js +++ b/src/index.js @@ -1,7 +1,3 @@ -import React from 'react' -import ReactDOM from 'react-dom' -import ReactDOMServer from 'react-dom/server' - import './apis/PanResponder/injectResponderEventPlugin' // apis @@ -80,12 +76,7 @@ const ReactNative = { // propTypes ColorPropType, EdgeInsetsPropType, - PointPropType, - - // React - ...React, - ...ReactDOM, - ...ReactDOMServer + PointPropType } module.exports = ReactNative