|
@@ -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 '@react-native-community/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 '@react-native-community/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 '@react-native-community/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 '@react-native-community/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 '@react-native-community/webview';
|
99
|
99
|
|
100
|
100
|
class MyWeb extends Component {
|
101
|
101
|
webview = null;
|
|
@@ -202,7 +202,7 @@ Normally, apps that do not have permission to use the camera can prompt the user
|
202
|
202
|
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)):
|
203
|
203
|
|
204
|
204
|
```
|
205
|
|
-import { WebView } from "react-native-webview";
|
|
205
|
+import { WebView } from "@react-native-community/webview";
|
206
|
206
|
|
207
|
207
|
WebView.isFileUploadSupported().then(res => {
|
208
|
208
|
if (res === true) {
|
|
@@ -271,7 +271,7 @@ This is a script that runs immediately after the web page loads for the first ti
|
271
|
271
|
```jsx
|
272
|
272
|
import React, { Component } from 'react';
|
273
|
273
|
import { View } from 'react-native';
|
274
|
|
-import { WebView } from 'react-native-webview';
|
|
274
|
+import { WebView } from '@react-native-community/webview';
|
275
|
275
|
|
276
|
276
|
export default class App extends Component {
|
277
|
277
|
render() {
|
|
@@ -285,7 +285,7 @@ export default class App extends Component {
|
285
|
285
|
<WebView
|
286
|
286
|
source={{
|
287
|
287
|
uri:
|
288
|
|
- 'https://github.com/react-native-community/react-native-webview',
|
|
288
|
+ 'https://github.com/react-native-community/webview',
|
289
|
289
|
}}
|
290
|
290
|
injectedJavaScript={runFirst}
|
291
|
291
|
/>
|
|
@@ -312,7 +312,7 @@ This is a script that runs **before** the web page loads for the first time. It
|
312
|
312
|
```jsx
|
313
|
313
|
import React, { Component } from 'react';
|
314
|
314
|
import { View } from 'react-native';
|
315
|
|
-import { WebView } from 'react-native-webview';
|
|
315
|
+import { WebView } from '@react-native-community/webview';
|
316
|
316
|
|
317
|
317
|
export default class App extends Component {
|
318
|
318
|
render() {
|
|
@@ -325,7 +325,7 @@ export default class App extends Component {
|
325
|
325
|
<WebView
|
326
|
326
|
source={{
|
327
|
327
|
uri:
|
328
|
|
- 'https://github.com/react-native-community/react-native-webview',
|
|
328
|
+ 'https://github.com/react-native-community/webview',
|
329
|
329
|
}}
|
330
|
330
|
injectedJavaScriptBeforeContentLoaded={runFirst}
|
331
|
331
|
/>
|
|
@@ -344,7 +344,7 @@ While convenient, the downside to the previously mentioned `injectedJavaScript`
|
344
|
344
|
```jsx
|
345
|
345
|
import React, { Component } from 'react';
|
346
|
346
|
import { View } from 'react-native';
|
347
|
|
-import { WebView } from 'react-native-webview';
|
|
347
|
+import { WebView } from '@react-native-community/webview';
|
348
|
348
|
|
349
|
349
|
export default class App extends Component {
|
350
|
350
|
render() {
|
|
@@ -363,7 +363,7 @@ export default class App extends Component {
|
363
|
363
|
ref={r => (this.webref = r)}
|
364
|
364
|
source={{
|
365
|
365
|
uri:
|
366
|
|
- 'https://github.com/react-native-community/react-native-webview',
|
|
366
|
+ 'https://github.com/react-native-community/webview',
|
367
|
367
|
}}
|
368
|
368
|
/>
|
369
|
369
|
</View>
|
|
@@ -392,7 +392,7 @@ You _must_ set `onMessage` or the `window.ReactNativeWebView.postMessage` method
|
392
|
392
|
```jsx
|
393
|
393
|
import React, { Component } from 'react';
|
394
|
394
|
import { View } from 'react-native';
|
395
|
|
-import { WebView } from 'react-native-webview';
|
|
395
|
+import { WebView } from '@react-native-community/webview';
|
396
|
396
|
|
397
|
397
|
export default class App extends Component {
|
398
|
398
|
render() {
|