diff --git a/README.md b/README.md index ff88003..1a8d83f 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ resolve: { alias: { 'react-native': 'react-native-web', ... - 'WebView': 'react-native-web-webview', + 'react-native-webview': 'react-native-web-webview', } } ``` @@ -32,16 +32,17 @@ const rule = { ## Usage ```js -import WebView from 'WebView'; // don't import from react-native +import { WebView } from 'react-native-webview'; ``` -See [RN's doc](https://facebook.github.io/react-native/docs/webview.html). +See [RN's doc](https://github.com/react-native-community/react-native-webview). Supported props are: - `source` - `onMessage` - `scrollEnabled` - `injectedJavaScript` +- `style` Additional, web-specific props are: - `newWindow`: (*boolean*|*{ name: string, features: string}*) diff --git a/docs/.storybook/webpack.config.js b/docs/.storybook/webpack.config.js index 673187e..f91097c 100644 --- a/docs/.storybook/webpack.config.js +++ b/docs/.storybook/webpack.config.js @@ -30,7 +30,7 @@ module.exports = (storybookBaseConfig, configType) => { storybookBaseConfig.resolve.alias = { 'react-native': 'react-native-web', - WebView: path.join(__dirname, '../../src/'), + 'react-native-webview': path.join(__dirname, '../../src/'), }; return storybookBaseConfig; diff --git a/docs/stories/html.js b/docs/stories/html.js index 245f751..09308a2 100644 --- a/docs/stories/html.js +++ b/docs/stories/html.js @@ -1,5 +1,5 @@ import React from 'react'; -import WebView from 'WebView'; +import { WebView } from 'react-native-webview'; const html = '

Hello world!

'; diff --git a/docs/stories/method.js b/docs/stories/method.js index 2fb5577..09ed1a6 100644 --- a/docs/stories/method.js +++ b/docs/stories/method.js @@ -1,5 +1,5 @@ import React from 'react'; -import WebView from 'WebView'; +import { WebView } from 'react-native-webview'; import { text } from '@storybook/addon-knobs'; export const basic = () => ( diff --git a/docs/stories/uri.js b/docs/stories/uri.js index 82ba4f6..98de3dc 100644 --- a/docs/stories/uri.js +++ b/docs/stories/uri.js @@ -1,5 +1,5 @@ import React from 'react'; -import WebView from 'WebView'; +import { WebView } from 'react-native-webview'; import { action } from '@storybook/addon-actions'; import { text } from '@storybook/addon-knobs'; diff --git a/src/index.js b/src/index.js index 4c2be9e..ddad4be 100644 --- a/src/index.js +++ b/src/index.js @@ -2,7 +2,7 @@ import Qs from 'qs'; import React, { Component } from 'react'; import { StyleSheet, View, ActivityIndicator, createElement } from 'react-native'; -export default class extends Component { +export class WebView extends Component { static defaultProps = { scrollEnabled: true, };