|
@@ -22,7 +22,7 @@ The simplest way to use the WebView is to simply pipe in the HTML you want to di
|
22
|
22
|
|
23
|
23
|
```js
|
24
|
24
|
import React, { Component } from 'react';
|
25
|
|
-import { WebView } from 'react-native-webview';
|
|
25
|
+import { WebView } from 'webview';
|
26
|
26
|
|
27
|
27
|
class MyInlineWeb extends Component {
|
28
|
28
|
render() {
|
|
@@ -44,7 +44,7 @@ This is the most common use-case for WebView.
|
44
|
44
|
|
45
|
45
|
```js
|
46
|
46
|
import React, { Component } from 'react';
|
47
|
|
-import { WebView } from 'react-native-webview';
|
|
47
|
+import { WebView } from 'webview';
|
48
|
48
|
|
49
|
49
|
class MyWeb extends Component {
|
50
|
50
|
render() {
|
|
@@ -61,7 +61,7 @@ Sometimes you would have bundled an HTML file along with the app and would like
|
61
|
61
|
|
62
|
62
|
```js
|
63
|
63
|
import React, { Component } from 'react';
|
64
|
|
-import { WebView } from 'react-native-webview';
|
|
64
|
+import { WebView } from 'webview';
|
65
|
65
|
|
66
|
66
|
const myHtmlFile = require("./my-asset-folder/local-site.html");
|
67
|
67
|
|
|
@@ -78,7 +78,7 @@ However on Android, you need to place the HTML file inside your android project'
|
78
|
78
|
|
79
|
79
|
```js
|
80
|
80
|
import React, { Component } from 'react';
|
81
|
|
-import { WebView } from 'react-native-webview';
|
|
81
|
+import { WebView } from 'webview';
|
82
|
82
|
|
83
|
83
|
class MyWeb extends Component {
|
84
|
84
|
render() {
|
|
@@ -95,7 +95,7 @@ Sometimes you want to intercept a user tapping on a link in your webview and do
|
95
|
95
|
|
96
|
96
|
```js
|
97
|
97
|
import React, { Component } from 'react';
|
98
|
|
-import { WebView } from 'react-native-webview';
|
|
98
|
+import { WebView } from 'webview';
|
99
|
99
|
|
100
|
100
|
class MyWeb extends Component {
|
101
|
101
|
webview = null;
|
|
@@ -196,7 +196,7 @@ Add permission in AndroidManifest.xml:
|
196
|
196
|
File Upload using `<input type="file" />` is not supported for Android 4.4 KitKat (see [details](https://github.com/delight-im/Android-AdvancedWebView/issues/4#issuecomment-70372146)):
|
197
|
197
|
|
198
|
198
|
```
|
199
|
|
-import { WebView } from "react-native-webview";
|
|
199
|
+import { WebView } from "webview";
|
200
|
200
|
|
201
|
201
|
WebView.isFileUploadSupported().then(res => {
|
202
|
202
|
if (res === true) {
|
|
@@ -265,7 +265,7 @@ This is a script that runs immediately after the web page loads for the first ti
|
265
|
265
|
```jsx
|
266
|
266
|
import React, { Component } from 'react';
|
267
|
267
|
import { View } from 'react-native';
|
268
|
|
-import { WebView } from 'react-native-webview';
|
|
268
|
+import { WebView } from 'webview';
|
269
|
269
|
|
270
|
270
|
export default class App extends Component {
|
271
|
271
|
render() {
|
|
@@ -279,7 +279,7 @@ export default class App extends Component {
|
279
|
279
|
<WebView
|
280
|
280
|
source={{
|
281
|
281
|
uri:
|
282
|
|
- 'https://github.com/react-native-community/react-native-webview',
|
|
282
|
+ 'https://github.com/react-native-community/webview',
|
283
|
283
|
}}
|
284
|
284
|
injectedJavaScript={runFirst}
|
285
|
285
|
/>
|
|
@@ -306,7 +306,7 @@ This is a script that runs **before** the web page loads for the first time. It
|
306
|
306
|
```jsx
|
307
|
307
|
import React, { Component } from 'react';
|
308
|
308
|
import { View } from 'react-native';
|
309
|
|
-import { WebView } from 'react-native-webview';
|
|
309
|
+import { WebView } from 'webview';
|
310
|
310
|
|
311
|
311
|
export default class App extends Component {
|
312
|
312
|
render() {
|
|
@@ -319,7 +319,7 @@ export default class App extends Component {
|
319
|
319
|
<WebView
|
320
|
320
|
source={{
|
321
|
321
|
uri:
|
322
|
|
- 'https://github.com/react-native-community/react-native-webview',
|
|
322
|
+ 'https://github.com/react-native-community/webview',
|
323
|
323
|
}}
|
324
|
324
|
injectedJavaScriptBeforeContentLoaded={runFirst}
|
325
|
325
|
/>
|
|
@@ -338,7 +338,7 @@ While convenient, the downside to the previously mentioned `injectedJavaScript`
|
338
|
338
|
```jsx
|
339
|
339
|
import React, { Component } from 'react';
|
340
|
340
|
import { View } from 'react-native';
|
341
|
|
-import { WebView } from 'react-native-webview';
|
|
341
|
+import { WebView } from 'webview';
|
342
|
342
|
|
343
|
343
|
export default class App extends Component {
|
344
|
344
|
render() {
|
|
@@ -357,7 +357,7 @@ export default class App extends Component {
|
357
|
357
|
ref={r => (this.webref = r)}
|
358
|
358
|
source={{
|
359
|
359
|
uri:
|
360
|
|
- 'https://github.com/react-native-community/react-native-webview',
|
|
360
|
+ 'https://github.com/react-native-community/webview',
|
361
|
361
|
}}
|
362
|
362
|
/>
|
363
|
363
|
</View>
|
|
@@ -386,7 +386,7 @@ You _must_ set `onMessage` or the `window.ReactNativeWebView.postMessage` method
|
386
|
386
|
```jsx
|
387
|
387
|
import React, { Component } from 'react';
|
388
|
388
|
import { View } from 'react-native';
|
389
|
|
-import { WebView } from 'react-native-webview';
|
|
389
|
+import { WebView } from 'webview';
|
390
|
390
|
|
391
|
391
|
export default class App extends Component {
|
392
|
392
|
render() {
|