Skip to content

Commit

Permalink
[BC] Migrate to react-native-webview
Browse files Browse the repository at this point in the history
  • Loading branch information
Minishlink committed Apr 28, 2020
1 parent e9df771 commit c7af1e6
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ resolve: {
alias: {
'react-native': 'react-native-web',
...
'WebView': 'react-native-web-webview',
'react-native-webview': 'react-native-web-webview',
}
}
```
Expand All @@ -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}*)
Expand Down
2 changes: 1 addition & 1 deletion docs/.storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion docs/stories/html.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import WebView from 'WebView';
import { WebView } from 'react-native-webview';

const html = '<html><body><h1>Hello world!</h1></body></html>';

Expand Down
2 changes: 1 addition & 1 deletion docs/stories/method.js
Original file line number Diff line number Diff line change
@@ -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 = () => (
Expand Down
2 changes: 1 addition & 1 deletion docs/stories/uri.js
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down

0 comments on commit c7af1e6

Please sign in to comment.