diff --git a/README.md b/README.md index c2ee1040..5f22a7fb 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Build Status][travis-image]][travis-url] [![npm version][npm-image]][npm-url] -![gzipped size](https://img.shields.io/badge/gzipped-~22.6k-blue.svg) +![gzipped size](https://img.shields.io/badge/gzipped-~23k-blue.svg) [React Native][react-native-url] components and APIs for the Web. diff --git a/config/webpack.config.example.js b/config/webpack.config.example.js index e26f128e..cebbaa72 100644 --- a/config/webpack.config.example.js +++ b/config/webpack.config.example.js @@ -1,5 +1,6 @@ -var constants = require('./constants') -var webpack = require('webpack') +const constants = require('./constants') +const path = require('path') +const webpack = require('webpack') module.exports = { devServer: { @@ -30,7 +31,7 @@ module.exports = { ], resolve: { alias: { - 'react-native': '../../src' + 'react-native': path.join(__dirname, '../dist/react-native-web') } } } diff --git a/examples/components/GridView.js b/examples/components/GridView.js index 0513e568..661b2e92 100644 --- a/examples/components/GridView.js +++ b/examples/components/GridView.js @@ -1,18 +1,4 @@ -import React, { Component, PropTypes, StyleSheet, View } from '../../src' - -const styles = StyleSheet.create({ - root: { - overflow: 'hidden' - }, - contentContainer: { - flexDirection: 'row', - flexGrow: 1 - }, - // distribute all space (rather than extra space) - column: { - flexBasis: '0%' - } -}) +import React, { Component, PropTypes, StyleSheet, View } from 'react-native' export default class GridView extends Component { static propTypes = { @@ -63,3 +49,17 @@ export default class GridView extends Component { ) } } + +const styles = StyleSheet.create({ + root: { + overflow: 'hidden' + }, + contentContainer: { + flexDirection: 'row', + flexGrow: 1 + }, + // distribute all space (rather than extra space) + column: { + flexBasis: '0%' + } +}) diff --git a/examples/components/Heading.js b/examples/components/Heading.js index cee5ad3f..d22737e6 100644 --- a/examples/components/Heading.js +++ b/examples/components/Heading.js @@ -1,4 +1,12 @@ -import React, { StyleSheet, Text } from '../../src' +import React, { StyleSheet, Text } from 'react-native' + +const Heading = ({ children, size = 'normal' }) => ( + +) const sizeStyles = StyleSheet.create({ xlarge: { @@ -23,12 +31,4 @@ const styles = StyleSheet.create({ } }) -const Heading = ({ children, size = 'normal' }) => ( - -) - export default Heading diff --git a/examples/components/MediaQueryWidget.js b/examples/components/MediaQueryWidget.js index acbbb20e..b18df464 100644 --- a/examples/components/MediaQueryWidget.js +++ b/examples/components/MediaQueryWidget.js @@ -1,21 +1,4 @@ -import React, { StyleSheet, Text, View } from '../../src' - -const styles = StyleSheet.create({ - root: { - alignItems: 'center', - borderWidth: 1, - marginVertical: 10, - padding: 10 - }, - heading: { - fontWeight: 'bold', - padding: 5, - textAlign: 'center' - }, - text: { - textAlign: 'center' - } -}) +import React, { StyleSheet, Text, View } from 'react-native' const MediaQueryWidget = ({ mediaQuery = {} }) => { const active = Object.keys(mediaQuery).reduce((active, alias) => { @@ -36,4 +19,21 @@ const MediaQueryWidget = ({ mediaQuery = {} }) => { ) } +const styles = StyleSheet.create({ + root: { + alignItems: 'center', + borderWidth: 1, + marginVertical: 10, + padding: 10 + }, + heading: { + fontWeight: 'bold', + padding: 5, + textAlign: 'center' + }, + text: { + textAlign: 'center' + } +}) + export default MediaQueryWidget diff --git a/examples/index.js b/examples/index.js index 7999f5c2..da3cc22a 100644 --- a/examples/index.js +++ b/examples/index.js @@ -2,7 +2,7 @@ import { MediaProvider, matchMedia } from 'react-media-queries' import App from './components/App' import createGetter from 'react-media-queries/lib/createMediaQueryGetter' import createListener from 'react-media-queries/lib/createMediaQueryListener' -import React, { AppRegistry } from '../src' +import React, { AppRegistry } from 'react-native' const mediaQueries = { small: '(min-width: 300px)', diff --git a/src/apis/AppRegistry/ReactNativeApp.js b/src/apis/AppRegistry/ReactNativeApp.js index c3e1eda4..e935618b 100644 --- a/src/apis/AppRegistry/ReactNativeApp.js +++ b/src/apis/AppRegistry/ReactNativeApp.js @@ -1,7 +1,7 @@ import Portal from '../../components/Portal' import React, { Component, PropTypes } from 'react' import ReactDOM from 'react-dom' -import StyleSheet from '../../apis/StyleSheet' +import StyleSheet from '../StyleSheet' import View from '../../components/View' export default class ReactNativeApp extends Component { diff --git a/src/apis/NetInfo/index.js b/src/apis/NetInfo/index.js index 26115423..b16621d6 100644 --- a/src/apis/NetInfo/index.js +++ b/src/apis/NetInfo/index.js @@ -75,3 +75,5 @@ const NetInfo = { } } } + +export default NetInfo diff --git a/src/components/ScrollView/index.js b/src/components/ScrollView/index.js index 4c9fef3a..ab4b50bb 100644 --- a/src/components/ScrollView/index.js +++ b/src/components/ScrollView/index.js @@ -3,19 +3,6 @@ import React, { Component, PropTypes } from 'react' import StyleSheet from '../../apis/StyleSheet' import View from '../View' -const styles = StyleSheet.create({ - initial: { - flex: 1, - overflow: 'auto' - }, - initialContentContainer: { - flex: 1 - }, - row: { - flexDirection: 'row' - } -}) - export default class ScrollView extends Component { static propTypes = { children: PropTypes.any, @@ -127,3 +114,16 @@ export default class ScrollView extends Component { ) } } + +const styles = StyleSheet.create({ + initial: { + flex: 1, + overflow: 'auto' + }, + initialContentContainer: { + flex: 1 + }, + row: { + flexDirection: 'row' + } +}) diff --git a/src/components/Text/index.js b/src/components/Text/index.js index f1189fa3..9e047c76 100644 --- a/src/components/Text/index.js +++ b/src/components/Text/index.js @@ -4,24 +4,6 @@ import StyleSheet from '../../apis/StyleSheet' import StyleSheetPropType from '../../apis/StyleSheet/StyleSheetPropType' import TextStylePropTypes from './TextStylePropTypes' -const styles = StyleSheet.create({ - initial: { - color: 'inherit', - display: 'inline', - font: 'inherit', - margin: 0, - padding: 0, - textDecoration: 'none', - wordWrap: 'break-word' - }, - singleLineStyle: { - maxWidth: '100%', - overflow: 'hidden', - textOverflow: 'ellipsis', - whiteSpace: 'nowrap' - } -}) - export default class Text extends Component { static propTypes = { accessibilityLabel: CoreComponent.propTypes.accessibilityLabel, @@ -64,3 +46,21 @@ export default class Text extends Component { ) } } + +const styles = StyleSheet.create({ + initial: { + color: 'inherit', + display: 'inline', + font: 'inherit', + margin: 0, + padding: 0, + textDecoration: 'none', + wordWrap: 'break-word' + }, + singleLineStyle: { + maxWidth: '100%', + overflow: 'hidden', + textOverflow: 'ellipsis', + whiteSpace: 'nowrap' + } +})