|
@@ -13,6 +13,7 @@ This document lays out the current public properties and methods for the React N
|
13
|
13
|
- [`mediaPlaybackRequiresUserAction`](Reference.md#mediaplaybackrequiresuseraction)
|
14
|
14
|
- [`nativeConfig`](Reference.md#nativeconfig)
|
15
|
15
|
- [`onError`](Reference.md#onerror)
|
|
16
|
+- [`onRenderProcessGone`](Reference.md#onRenderProcessGone)
|
16
|
17
|
- [`onLoad`](Reference.md#onload)
|
17
|
18
|
- [`onLoadEnd`](Reference.md#onloadend)
|
18
|
19
|
- [`onLoadStart`](Reference.md#onloadstart)
|
|
@@ -34,6 +35,7 @@ This document lays out the current public properties and methods for the React N
|
34
|
35
|
- [`javaScriptEnabled`](Reference.md#javascriptenabled)
|
35
|
36
|
- [`javaScriptCanOpenWindowsAutomatically`](Reference.md#javascriptcanopenwindowsautomatically)
|
36
|
37
|
- [`androidHardwareAccelerationDisabled`](Reference.md#androidHardwareAccelerationDisabled)
|
|
38
|
+- [`androidLayerType`](Reference.md#androidLayerType)
|
37
|
39
|
- [`mixedContentMode`](Reference.md#mixedcontentmode)
|
38
|
40
|
- [`thirdPartyCookiesEnabled`](Reference.md#thirdpartycookiesenabled)
|
39
|
41
|
- [`userAgent`](Reference.md#useragent)
|
|
@@ -44,6 +46,7 @@ This document lays out the current public properties and methods for the React N
|
44
|
46
|
- [`overScrollMode`](Reference.md#overscrollmode)
|
45
|
47
|
- [`contentInset`](Reference.md#contentinset)
|
46
|
48
|
- [`contentInsetAdjustmentBehavior`](Reference.md#contentInsetAdjustmentBehavior)
|
|
49
|
+- [`contentMode`](Reference.md#contentMode)
|
47
|
50
|
- [`dataDetectorTypes`](Reference.md#datadetectortypes)
|
48
|
51
|
- [`scrollEnabled`](Reference.md#scrollenabled)
|
49
|
52
|
- [`directionalLockEnabled`](Reference.md#directionalLockEnabled)
|
|
@@ -65,6 +68,7 @@ This document lays out the current public properties and methods for the React N
|
65
|
68
|
- [`allowsLinkPreview`](Reference.md#allowsLinkPreview)
|
66
|
69
|
- [`sharedCookiesEnabled`](Reference.md#sharedCookiesEnabled)
|
67
|
70
|
- [`textZoom`](Reference.md#textZoom)
|
|
71
|
+- [`pullToRefreshEnabled`](Reference.md#pullToRefreshEnabled)
|
68
|
72
|
- [`ignoreSilentHardwareSwitch`](Reference.md#ignoreSilentHardwareSwitch)
|
69
|
73
|
- [`onFileDownload`](Reference.md#onFileDownload)
|
70
|
74
|
|
|
@@ -88,7 +92,7 @@ This document lays out the current public properties and methods for the React N
|
88
|
92
|
|
89
|
93
|
## Props
|
90
|
94
|
|
91
|
|
-### `source`
|
|
95
|
+### `source`[⬆](#props-index)<!-- Link generated with jump2header -->
|
92
|
96
|
|
93
|
97
|
Loads static HTML or a URI (with optional headers) in the WebView. Note that static HTML will require setting [`originWhitelist`](Reference.md#originwhitelist) to `["*"]`.
|
94
|
98
|
|
|
@@ -114,7 +118,7 @@ _Note that using static HTML requires the WebView property [originWhiteList](Ref
|
114
|
118
|
|
115
|
119
|
---
|
116
|
120
|
|
117
|
|
-### `automaticallyAdjustContentInsets`
|
|
121
|
+### `automaticallyAdjustContentInsets`[⬆](#props-index)<!-- Link generated with jump2header -->
|
118
|
122
|
|
119
|
123
|
Controls whether to adjust the content inset for web views that are placed behind a navigation bar, tab bar, or toolbar. The default value is `true`.
|
120
|
124
|
|
|
@@ -124,7 +128,7 @@ Controls whether to adjust the content inset for web views that are placed behin
|
124
|
128
|
|
125
|
129
|
---
|
126
|
130
|
|
127
|
|
-### `injectedJavaScript`
|
|
131
|
+### `injectedJavaScript`[⬆](#props-index)<!-- Link generated with jump2header -->
|
128
|
132
|
|
129
|
133
|
Set this to provide JavaScript that will be injected into the web page after the document finishes loading, but before other subresources finish loading.
|
130
|
134
|
|
|
@@ -156,7 +160,7 @@ const INJECTED_JAVASCRIPT = `(function() {
|
156
|
160
|
|
157
|
161
|
---
|
158
|
162
|
|
159
|
|
-### `injectedJavaScriptBeforeContentLoaded`
|
|
163
|
+### `injectedJavaScriptBeforeContentLoaded`[⬆](#props-index)<!-- Link generated with jump2header -->
|
160
|
164
|
|
161
|
165
|
Set this to provide JavaScript that will be injected into the web page after the document element is created, but before other subresources finish loading.
|
162
|
166
|
|
|
@@ -188,7 +192,7 @@ const INJECTED_JAVASCRIPT = `(function() {
|
188
|
192
|
|
189
|
193
|
---
|
190
|
194
|
|
191
|
|
-### `injectedJavaScriptForMainFrameOnly`
|
|
195
|
+### `injectedJavaScriptForMainFrameOnly`[⬆](#props-index)<!-- Link generated with jump2header -->
|
192
|
196
|
|
193
|
197
|
If `true` (default; mandatory for Android), loads the `injectedJavaScript` only into the main frame.
|
194
|
198
|
|
|
@@ -200,7 +204,7 @@ If `false`, (only supported on iOS and macOS), loads it into all frames (e.g. if
|
200
|
204
|
|
201
|
205
|
---
|
202
|
206
|
|
203
|
|
-### `injectedJavaScriptBeforeContentLoadedForMainFrameOnly`
|
|
207
|
+### `injectedJavaScriptBeforeContentLoadedForMainFrameOnly`[⬆](#props-index)<!-- Link generated with jump2header -->
|
204
|
208
|
|
205
|
209
|
If `true` (default; mandatory for Android), loads the `injectedJavaScriptBeforeContentLoaded` only into the main frame.
|
206
|
210
|
|
|
@@ -212,7 +216,7 @@ If `false`, (only supported on iOS and macOS), loads it into all frames (e.g. if
|
212
|
216
|
|
213
|
217
|
---
|
214
|
218
|
|
215
|
|
-### `mediaPlaybackRequiresUserAction`
|
|
219
|
+### `mediaPlaybackRequiresUserAction`[⬆](#props-index)<!-- Link generated with jump2header -->
|
216
|
220
|
|
217
|
221
|
Boolean that determines whether HTML5 audio and video requires the user to tap them before they start playing. The default value is `true`. (Android API minimum version 17).
|
218
|
222
|
|
|
@@ -224,7 +228,7 @@ NOTE: the default `true` value might cause some videos to hang loading on iOS. S
|
224
|
228
|
|
225
|
229
|
---
|
226
|
230
|
|
227
|
|
-### `nativeConfig`
|
|
231
|
+### `nativeConfig`[⬆](#props-index)<!-- Link generated with jump2header -->
|
228
|
232
|
|
229
|
233
|
Override the native component used to render the WebView. Enables a custom native WebView which uses the same JavaScript as the original WebView.
|
230
|
234
|
|
|
@@ -240,7 +244,7 @@ The `nativeConfig` prop expects an object with the following keys:
|
240
|
244
|
|
241
|
245
|
---
|
242
|
246
|
|
243
|
|
-### `onError`
|
|
247
|
+### `onError`[⬆](#props-index)<!-- Link generated with jump2header -->
|
244
|
248
|
|
245
|
249
|
Function that is invoked when the `WebView` load fails.
|
246
|
250
|
|
|
@@ -280,7 +284,7 @@ url
|
280
|
284
|
|
281
|
285
|
---
|
282
|
286
|
|
283
|
|
-### `onLoad`
|
|
287
|
+### `onLoad`[⬆](#props-index)<!-- Link generated with jump2header -->
|
284
|
288
|
|
285
|
289
|
Function that is invoked when the `WebView` has finished loading.
|
286
|
290
|
|
|
@@ -313,7 +317,7 @@ url
|
313
|
317
|
|
314
|
318
|
---
|
315
|
319
|
|
316
|
|
-### `onLoadEnd`
|
|
320
|
+### `onLoadEnd`[⬆](#props-index)<!-- Link generated with jump2header -->
|
317
|
321
|
|
318
|
322
|
Function that is invoked when the `WebView` load succeeds or fails.
|
319
|
323
|
|
|
@@ -347,7 +351,7 @@ url
|
347
|
351
|
|
348
|
352
|
---
|
349
|
353
|
|
350
|
|
-### `onLoadStart`
|
|
354
|
+### `onLoadStart`[⬆](#props-index)<!-- Link generated with jump2header -->
|
351
|
355
|
|
352
|
356
|
Function that is invoked when the `WebView` starts loading.
|
353
|
357
|
|
|
@@ -381,7 +385,7 @@ url
|
381
|
385
|
|
382
|
386
|
---
|
383
|
387
|
|
384
|
|
-### `onLoadProgress`
|
|
388
|
+### `onLoadProgress`[⬆](#props-index)<!-- Link generated with jump2header -->
|
385
|
389
|
|
386
|
390
|
Function that is invoked when the `WebView` is loading.
|
387
|
391
|
|
|
@@ -414,7 +418,7 @@ url
|
414
|
418
|
|
415
|
419
|
---
|
416
|
420
|
|
417
|
|
-### `onHttpError`
|
|
421
|
+### `onHttpError`[⬆](#props-index)<!-- Link generated with jump2header -->
|
418
|
422
|
|
419
|
423
|
Function that is invoked when the `WebView` receives an http error.
|
420
|
424
|
|
|
@@ -458,7 +462,40 @@ url
|
458
|
462
|
|
459
|
463
|
---
|
460
|
464
|
|
461
|
|
-### `onMessage`
|
|
465
|
+### `onRenderProcessGone`[⬆](#props-index)<!-- Link generated with jump2header -->
|
|
466
|
+
|
|
467
|
+Function that is invoked when the `WebView` process crashes or is killed by the OS on Android.
|
|
468
|
+
|
|
469
|
+> **_Note_**
|
|
470
|
+> Android API minimum level 26. Android Only
|
|
471
|
+
|
|
472
|
+| Type | Required |
|
|
473
|
+| -------- | -------- |
|
|
474
|
+| function | No |
|
|
475
|
+
|
|
476
|
+Example:
|
|
477
|
+
|
|
478
|
+```jsx
|
|
479
|
+<WebView
|
|
480
|
+ source={{ uri: 'https://reactnative.dev' }}
|
|
481
|
+ onRenderProcessGone={syntheticEvent => {
|
|
482
|
+ const { nativeEvent } = syntheticEvent;
|
|
483
|
+ console.warn(
|
|
484
|
+ 'WebView Crashed: ',
|
|
485
|
+ nativeEvent.didCrash,
|
|
486
|
+ );
|
|
487
|
+ }}
|
|
488
|
+/>
|
|
489
|
+```
|
|
490
|
+
|
|
491
|
+Function passed to `onRenderProcessGone` is called with a SyntheticEvent wrapping a nativeEvent with these properties:
|
|
492
|
+
|
|
493
|
+```
|
|
494
|
+didCrash
|
|
495
|
+```
|
|
496
|
+---
|
|
497
|
+
|
|
498
|
+### `onMessage`[⬆](#props-index)<!-- Link generated with jump2header -->
|
462
|
499
|
|
463
|
500
|
Function that is invoked when the webview calls `window.ReactNativeWebView.postMessage`. Setting this property will inject this global into your webview.
|
464
|
501
|
|
|
@@ -472,7 +509,7 @@ To learn more, read the [Communicating between JS and Native](Guide.md#communica
|
472
|
509
|
|
473
|
510
|
---
|
474
|
511
|
|
475
|
|
-### `onNavigationStateChange`
|
|
512
|
+### `onNavigationStateChange`[⬆](#props-index)<!-- Link generated with jump2header -->
|
476
|
513
|
|
477
|
514
|
Function that is invoked when the `WebView` loading starts or ends.
|
478
|
515
|
|
|
@@ -508,7 +545,7 @@ Note that this method will not be invoked on hash URL changes (e.g. from `https:
|
508
|
545
|
|
509
|
546
|
---
|
510
|
547
|
|
511
|
|
-### `onContentProcessDidTerminate`
|
|
548
|
+### `onContentProcessDidTerminate`[⬆](#props-index)<!-- Link generated with jump2header -->
|
512
|
549
|
|
513
|
550
|
Function that is invoked when the `WebView` content process is terminated.
|
514
|
551
|
|
|
@@ -542,7 +579,7 @@ url
|
542
|
579
|
|
543
|
580
|
---
|
544
|
581
|
|
545
|
|
-### `originWhitelist`
|
|
582
|
+### `originWhitelist`[⬆](#props-index)<!-- Link generated with jump2header -->
|
546
|
583
|
|
547
|
584
|
List of origin strings to allow being navigated to. The strings allow wildcards and get matched against _just_ the origin (not the full URL). If the user taps to navigate to a new page but the new page is not in this whitelist, the URL will be handled by the OS. The default whitelisted origins are "http://*" and "https://*".
|
548
|
585
|
|
|
@@ -562,7 +599,7 @@ Example:
|
562
|
599
|
|
563
|
600
|
---
|
564
|
601
|
|
565
|
|
-### `renderError`
|
|
602
|
+### `renderError`[⬆](#props-index)<!-- Link generated with jump2header -->
|
566
|
603
|
|
567
|
604
|
Function that returns a view to show if there's an error.
|
568
|
605
|
|
|
@@ -583,7 +620,7 @@ The function passed to `renderError` will be called with the name of the error
|
583
|
620
|
|
584
|
621
|
---
|
585
|
622
|
|
586
|
|
-### `renderLoading`
|
|
623
|
+### `renderLoading`[⬆](#props-index)<!-- Link generated with jump2header -->
|
587
|
624
|
|
588
|
625
|
Function that returns a loading indicator. The startInLoadingState prop must be set to true in order to use this prop.
|
589
|
626
|
|
|
@@ -603,7 +640,7 @@ Example:
|
603
|
640
|
|
604
|
641
|
---
|
605
|
642
|
|
606
|
|
-### `scalesPageToFit`
|
|
643
|
+### `scalesPageToFit`[⬆](#props-index)<!-- Link generated with jump2header -->
|
607
|
644
|
|
608
|
645
|
Boolean that controls whether the web content is scaled to fit the view and enables the user to change the scale. The default value is `true`.
|
609
|
646
|
|
|
@@ -613,7 +650,7 @@ Boolean that controls whether the web content is scaled to fit the view and enab
|
613
|
650
|
|
614
|
651
|
---
|
615
|
652
|
|
616
|
|
-### `onShouldStartLoadWithRequest`
|
|
653
|
+### `onShouldStartLoadWithRequest`[⬆](#props-index)<!-- Link generated with jump2header -->
|
617
|
654
|
|
618
|
655
|
Function that allows custom handling of any web view requests. Return `true` from the function to continue loading the request and `false` to stop loading.
|
619
|
656
|
|
|
@@ -647,11 +684,12 @@ canGoForward
|
647
|
684
|
lockIdentifier
|
648
|
685
|
mainDocumentURL (iOS only)
|
649
|
686
|
navigationType
|
|
687
|
+isTopFrame
|
650
|
688
|
```
|
651
|
689
|
|
652
|
690
|
---
|
653
|
691
|
|
654
|
|
-### `startInLoadingState`
|
|
692
|
+### `startInLoadingState`[⬆](#props-index)<!-- Link generated with jump2header -->
|
655
|
693
|
|
656
|
694
|
Boolean value that forces the `WebView` to show the loading view on the first load. This prop must be set to `true` in order for the `renderLoading` prop to work.
|
657
|
695
|
|
|
@@ -661,7 +699,7 @@ Boolean value that forces the `WebView` to show the loading view on the first lo
|
661
|
699
|
|
662
|
700
|
---
|
663
|
701
|
|
664
|
|
-### `style`
|
|
702
|
+### `style`[⬆](#props-index)<!-- Link generated with jump2header -->
|
665
|
703
|
|
666
|
704
|
A style object that allow you to customize the `WebView` style. Please note that there are default styles (example: you need to add `flex: 0` to the style if you want to use `height` property).
|
667
|
705
|
|
|
@@ -680,7 +718,7 @@ Example:
|
680
|
718
|
|
681
|
719
|
---
|
682
|
720
|
|
683
|
|
-### `containerStyle`
|
|
721
|
+### `containerStyle`[⬆](#props-index)<!-- Link generated with jump2header -->
|
684
|
722
|
|
685
|
723
|
A style object that allow you to customize the `WebView` container style. Please note that there are default styles (example: you need to add `flex: 0` to the style if you want to use `height` property).
|
686
|
724
|
|
|
@@ -699,7 +737,7 @@ Example:
|
699
|
737
|
|
700
|
738
|
---
|
701
|
739
|
|
702
|
|
-### `decelerationRate`
|
|
740
|
+### `decelerationRate`[⬆](#props-index)<!-- Link generated with jump2header -->
|
703
|
741
|
|
704
|
742
|
A floating-point number that determines how quickly the scroll view decelerates after the user lifts their finger. You may also use the string shortcuts `"normal"` and `"fast"` which match the underlying iOS settings for `UIScrollViewDecelerationRateNormal` and `UIScrollViewDecelerationRateFast` respectively:
|
705
|
743
|
|
|
@@ -712,7 +750,7 @@ A floating-point number that determines how quickly the scroll view decelerates
|
712
|
750
|
|
713
|
751
|
---
|
714
|
752
|
|
715
|
|
-### `domStorageEnabled`
|
|
753
|
+### `domStorageEnabled`[⬆](#props-index)<!-- Link generated with jump2header -->
|
716
|
754
|
|
717
|
755
|
Boolean value to control whether DOM Storage is enabled. Used only in Android.
|
718
|
756
|
|
|
@@ -722,7 +760,7 @@ Boolean value to control whether DOM Storage is enabled. Used only in Android.
|
722
|
760
|
|
723
|
761
|
---
|
724
|
762
|
|
725
|
|
-### `javaScriptEnabled`
|
|
763
|
+### `javaScriptEnabled`[⬆](#props-index)<!-- Link generated with jump2header -->
|
726
|
764
|
|
727
|
765
|
Boolean value to enable JavaScript in the `WebView`. The default value is `true`.
|
728
|
766
|
|
|
@@ -732,7 +770,7 @@ Boolean value to enable JavaScript in the `WebView`. The default value is `true`
|
732
|
770
|
|
733
|
771
|
---
|
734
|
772
|
|
735
|
|
-### `javaScriptCanOpenWindowsAutomatically`
|
|
773
|
+### `javaScriptCanOpenWindowsAutomatically`[⬆](#props-index)<!-- Link generated with jump2header -->
|
736
|
774
|
|
737
|
775
|
A Boolean value indicating whether JavaScript can open windows without user interaction. The default value is `false`.
|
738
|
776
|
|
|
@@ -742,9 +780,9 @@ A Boolean value indicating whether JavaScript can open windows without user inte
|
742
|
780
|
|
743
|
781
|
---
|
744
|
782
|
|
745
|
|
-### `androidHardwareAccelerationDisabled`
|
|
783
|
+### `androidHardwareAccelerationDisabled`[⬆](#props-index)<!-- Link generated with jump2header -->
|
746
|
784
|
|
747
|
|
-Boolean value to disable Hardware Acceleration in the `WebView`. Used on Android only as Hardware Acceleration is a feature only for Android. The default value is `false`.
|
|
785
|
+**Deprecated.** Use the `androidLayerType` prop instead.
|
748
|
786
|
|
749
|
787
|
| Type | Required | Platform |
|
750
|
788
|
| ---- | -------- | -------- |
|
|
@@ -752,7 +790,25 @@ Boolean value to disable Hardware Acceleration in the `WebView`. Used on Android
|
752
|
790
|
|
753
|
791
|
---
|
754
|
792
|
|
755
|
|
-### `mixedContentMode`
|
|
793
|
+### `androidLayerType`[⬆](#props-index)<!-- Link generated with jump2header -->
|
|
794
|
+
|
|
795
|
+Specifies the layer type.
|
|
796
|
+
|
|
797
|
+Possible values for `androidLayerType` are:
|
|
798
|
+
|
|
799
|
+- `none` (default) - The view does not have a layer.
|
|
800
|
+- `software` - The view has a software layer. A software layer is backed by a bitmap and causes the view to be rendered using Android's software rendering pipeline, even if hardware acceleration is enabled.
|
|
801
|
+- `hardware` - The view has a hardware layer. A hardware layer is backed by a hardware specific texture and causes the view to be rendered using Android's hardware rendering pipeline, but only if hardware acceleration is turned on for the view hierarchy.
|
|
802
|
+
|
|
803
|
+Avoid setting both `androidLayerType` and `androidHardwareAccelerationDisabled` props at the same time, as this may cause undefined behaviour.
|
|
804
|
+
|
|
805
|
+| Type | Required | Platform |
|
|
806
|
+| ------ | -------- | -------- |
|
|
807
|
+| string | No | Android |
|
|
808
|
+
|
|
809
|
+---
|
|
810
|
+
|
|
811
|
+### `mixedContentMode`[⬆](#props-index)<!-- Link generated with jump2header -->
|
756
|
812
|
|
757
|
813
|
Specifies the mixed content mode. i.e WebView will allow a secure origin to load content from any other origin.
|
758
|
814
|
|
|
@@ -768,7 +824,7 @@ Possible values for `mixedContentMode` are:
|
768
|
824
|
|
769
|
825
|
---
|
770
|
826
|
|
771
|
|
-### `thirdPartyCookiesEnabled`
|
|
827
|
+### `thirdPartyCookiesEnabled`[⬆](#props-index)<!-- Link generated with jump2header -->
|
772
|
828
|
|
773
|
829
|
Boolean value to enable third party cookies in the `WebView`. Used on Android Lollipop and above only as third party cookies are enabled by default on Android Kitkat and below and on iOS. The default value is `true`. For more on cookies, read the [Guide](Guide.md#Managing-Cookies)
|
774
|
830
|
|
|
@@ -778,7 +834,7 @@ Boolean value to enable third party cookies in the `WebView`. Used on Android Lo
|
778
|
834
|
|
779
|
835
|
---
|
780
|
836
|
|
781
|
|
-### `userAgent`
|
|
837
|
+### `userAgent`[⬆](#props-index)<!-- Link generated with jump2header -->
|
782
|
838
|
|
783
|
839
|
Sets the user-agent for the `WebView`.
|
784
|
840
|
|
|
@@ -788,7 +844,7 @@ Sets the user-agent for the `WebView`.
|
788
|
844
|
|
789
|
845
|
---
|
790
|
846
|
|
791
|
|
-### `applicationNameForUserAgent`
|
|
847
|
+### `applicationNameForUserAgent`[⬆](#props-index)<!-- Link generated with jump2header -->
|
792
|
848
|
|
793
|
849
|
Append to the existing user-agent. Setting `userAgent` will override this.
|
794
|
850
|
|
|
@@ -806,7 +862,7 @@ Append to the existing user-agent. Setting `userAgent` will override this.
|
806
|
862
|
// Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 DemoApp/1.1.0
|
807
|
863
|
```
|
808
|
864
|
|
809
|
|
-### `allowsFullscreenVideo`
|
|
865
|
+### `allowsFullscreenVideo`[⬆](#props-index)<!-- Link generated with jump2header -->
|
810
|
866
|
|
811
|
867
|
Boolean that determines whether videos are allowed to be played in fullscreen. The default value is `false`.
|
812
|
868
|
|
|
@@ -816,7 +872,7 @@ Boolean that determines whether videos are allowed to be played in fullscreen. T
|
816
|
872
|
|
817
|
873
|
---
|
818
|
874
|
|
819
|
|
-### `allowsInlineMediaPlayback`
|
|
875
|
+### `allowsInlineMediaPlayback`[⬆](#props-index)<!-- Link generated with jump2header -->
|
820
|
876
|
|
821
|
877
|
Boolean that determines whether HTML5 videos play inline or use the native full-screen controller. The default value is `false`.
|
822
|
878
|
|
|
@@ -830,7 +886,7 @@ Boolean that determines whether HTML5 videos play inline or use the native full-
|
830
|
886
|
|
831
|
887
|
---
|
832
|
888
|
|
833
|
|
-### `bounces`
|
|
889
|
+### `bounces`[⬆](#props-index)<!-- Link generated with jump2header -->
|
834
|
890
|
|
835
|
891
|
Boolean value that determines whether the web view bounces when it reaches the edge of the content. The default value is `true`.
|
836
|
892
|
|
|
@@ -840,7 +896,7 @@ Boolean value that determines whether the web view bounces when it reaches the e
|
840
|
896
|
|
841
|
897
|
---
|
842
|
898
|
|
843
|
|
-### `overScrollMode`
|
|
899
|
+### `overScrollMode`[⬆](#props-index)<!-- Link generated with jump2header -->
|
844
|
900
|
|
845
|
901
|
Specifies the over scroll mode.
|
846
|
902
|
|
|
@@ -856,7 +912,7 @@ Possible values for `overScrollMode` are:
|
856
|
912
|
|
857
|
913
|
---
|
858
|
914
|
|
859
|
|
-### `contentInset`
|
|
915
|
+### `contentInset`[⬆](#props-index)<!-- Link generated with jump2header -->
|
860
|
916
|
|
861
|
917
|
The amount by which the web view content is inset from the edges of the scroll view. Defaults to {top: 0, left: 0, bottom: 0, right: 0}.
|
862
|
918
|
|
|
@@ -866,7 +922,7 @@ The amount by which the web view content is inset from the edges of the scroll v
|
866
|
922
|
|
867
|
923
|
---
|
868
|
924
|
|
869
|
|
-### `contentInsetAdjustmentBehavior`
|
|
925
|
+### `contentInsetAdjustmentBehavior`[⬆](#props-index)<!-- Link generated with jump2header -->
|
870
|
926
|
|
871
|
927
|
This property specifies how the safe area insets are used to modify the content area of the scroll view. The default value of this property is "never". Available on iOS 11 and later. Defaults to `never`.
|
872
|
928
|
|
|
@@ -883,7 +939,25 @@ Possible values:
|
883
|
939
|
|
884
|
940
|
---
|
885
|
941
|
|
886
|
|
-### `dataDetectorTypes`
|
|
942
|
+### `contentMode`[⬆](#props-index)<!-- Link generated with jump2header -->
|
|
943
|
+
|
|
944
|
+Controls the type of content to load. Available on iOS 13 and later. Defaults to `recommended`, which loads mobile content on iPhone & iPad Mini but desktop content on larger iPads.
|
|
945
|
+
|
|
946
|
+See [Introducing Desktop-class Browsing on iPad](https://developer.apple.com/videos/play/wwdc2019/203/) for more.
|
|
947
|
+
|
|
948
|
+Possible values:
|
|
949
|
+
|
|
950
|
+- `recommended`
|
|
951
|
+- `mobile`
|
|
952
|
+- `desktop`
|
|
953
|
+
|
|
954
|
+| Type | Required | Platform |
|
|
955
|
+| ------ | -------- | -------- |
|
|
956
|
+| string | No | iOS |
|
|
957
|
+
|
|
958
|
+---
|
|
959
|
+
|
|
960
|
+### `dataDetectorTypes`[⬆](#props-index)<!-- Link generated with jump2header -->
|
887
|
961
|
|
888
|
962
|
Determines the types of data converted to clickable URLs in the web view's content. By default only phone numbers are detected.
|
889
|
963
|
|
|
@@ -907,7 +981,7 @@ Possible values for `dataDetectorTypes` are:
|
907
|
981
|
|
908
|
982
|
---
|
909
|
983
|
|
910
|
|
-### `scrollEnabled`
|
|
984
|
+### `scrollEnabled`[⬆](#props-index)<!-- Link generated with jump2header -->
|
911
|
985
|
|
912
|
986
|
Boolean value that determines whether scrolling is enabled in the `WebView`. The default value is `true`. Setting this to `false` will prevent the webview from moving the document body when the keyboard appears over an input.
|
913
|
987
|
|
|
@@ -917,7 +991,7 @@ Boolean value that determines whether scrolling is enabled in the `WebView`. The
|
917
|
991
|
|
918
|
992
|
---
|
919
|
993
|
|
920
|
|
-### `directionalLockEnabled`
|
|
994
|
+### `directionalLockEnabled`[⬆](#props-index)<!-- Link generated with jump2header -->
|
921
|
995
|
|
922
|
996
|
A Boolean value that determines whether scrolling is disabled in a particular direction.
|
923
|
997
|
The default value is `true`.
|
|
@@ -928,7 +1002,7 @@ The default value is `true`.
|
928
|
1002
|
|
929
|
1003
|
---
|
930
|
1004
|
|
931
|
|
-### `showsHorizontalScrollIndicator`
|
|
1005
|
+### `showsHorizontalScrollIndicator`[⬆](#props-index)<!-- Link generated with jump2header -->
|
932
|
1006
|
|
933
|
1007
|
Boolean value that determines whether a horizontal scroll indicator is shown in the `WebView`. The default value is `true`.
|
934
|
1008
|
|
|
@@ -938,7 +1012,7 @@ Boolean value that determines whether a horizontal scroll indicator is shown in
|
938
|
1012
|
|
939
|
1013
|
---
|
940
|
1014
|
|
941
|
|
-### `showsVerticalScrollIndicator`
|
|
1015
|
+### `showsVerticalScrollIndicator`[⬆](#props-index)<!-- Link generated with jump2header -->
|
942
|
1016
|
|
943
|
1017
|
Boolean value that determines whether a vertical scroll indicator is shown in the `WebView`. The default value is `true`.
|
944
|
1018
|
|
|
@@ -948,7 +1022,7 @@ Boolean value that determines whether a vertical scroll indicator is shown in th
|
948
|
1022
|
|
949
|
1023
|
---
|
950
|
1024
|
|
951
|
|
-### `geolocationEnabled`
|
|
1025
|
+### `geolocationEnabled`[⬆](#props-index)<!-- Link generated with jump2header -->
|
952
|
1026
|
|
953
|
1027
|
Set whether Geolocation is enabled in the `WebView`. The default value is `false`. Used only in Android.
|
954
|
1028
|
|
|
@@ -958,7 +1032,7 @@ Set whether Geolocation is enabled in the `WebView`. The default value is `false
|
958
|
1032
|
|
959
|
1033
|
---
|
960
|
1034
|
|
961
|
|
-### `allowFileAccessFromFileURLs`
|
|
1035
|
+### `allowFileAccessFromFileURLs`[⬆](#props-index)<!-- Link generated with jump2header -->
|
962
|
1036
|
|
963
|
1037
|
Boolean that sets whether JavaScript running in the context of a file scheme URL should be allowed to access content from other file scheme URLs. The default value is `false`.
|
964
|
1038
|
|
|
@@ -968,7 +1042,7 @@ Boolean that sets whether JavaScript running in the context of a file scheme URL
|
968
|
1042
|
|
969
|
1043
|
---
|
970
|
1044
|
|
971
|
|
-### `allowUniversalAccessFromFileURLs`
|
|
1045
|
+### `allowUniversalAccessFromFileURLs`[⬆](#props-index)<!-- Link generated with jump2header -->
|
972
|
1046
|
|
973
|
1047
|
Boolean that sets whether JavaScript running in the context of a file scheme URL should be allowed to access content from any origin. Including accessing content from other file scheme URLs. The default value is `false`.
|
974
|
1048
|
|
|
@@ -978,7 +1052,7 @@ Boolean that sets whether JavaScript running in the context of a file scheme URL
|
978
|
1052
|
|
979
|
1053
|
---
|
980
|
1054
|
|
981
|
|
-### `allowingReadAccessToURL`
|
|
1055
|
+### `allowingReadAccessToURL`[⬆](#props-index)<!-- Link generated with jump2header -->
|
982
|
1056
|
|
983
|
1057
|
A String value that indicates which URLs the WebView's file can then reference in scripts, AJAX requests, and CSS imports. This is only used in for WebViews that are loaded with a source.uri set to a `'file://'` URL. If not provided, the default is to only allow read access to the URL provided in source.uri itself.
|
984
|
1058
|
|
|
@@ -988,7 +1062,7 @@ A String value that indicates which URLs the WebView's file can then reference i
|
988
|
1062
|
|
989
|
1063
|
---
|
990
|
1064
|
|
991
|
|
-### `url`
|
|
1065
|
+### `url`[⬆](#props-index)<!-- Link generated with jump2header -->
|
992
|
1066
|
|
993
|
1067
|
**Deprecated.** Use the `source` prop instead.
|
994
|
1068
|
|
|
@@ -998,7 +1072,7 @@ A String value that indicates which URLs the WebView's file can then reference i
|
998
|
1072
|
|
999
|
1073
|
---
|
1000
|
1074
|
|
1001
|
|
-### `html`
|
|
1075
|
+### `html`[⬆](#props-index)<!-- Link generated with jump2header -->
|
1002
|
1076
|
|
1003
|
1077
|
**Deprecated.** Use the `source` prop instead.
|
1004
|
1078
|
|
|
@@ -1008,7 +1082,7 @@ A String value that indicates which URLs the WebView's file can then reference i
|
1008
|
1082
|
|
1009
|
1083
|
---
|
1010
|
1084
|
|
1011
|
|
-### `keyboardDisplayRequiresUserAction`
|
|
1085
|
+### `keyboardDisplayRequiresUserAction`[⬆](#props-index)<!-- Link generated with jump2header -->
|
1012
|
1086
|
|
1013
|
1087
|
If false, web content can programmatically display the keyboard. The default value is `true`.
|
1014
|
1088
|
|
|
@@ -1018,7 +1092,7 @@ If false, web content can programmatically display the keyboard. The default val
|
1018
|
1092
|
|
1019
|
1093
|
---
|
1020
|
1094
|
|
1021
|
|
-### `hideKeyboardAccessoryView`
|
|
1095
|
+### `hideKeyboardAccessoryView`[⬆](#props-index)<!-- Link generated with jump2header -->
|
1022
|
1096
|
|
1023
|
1097
|
If true, this will hide the keyboard accessory view (< > and Done).
|
1024
|
1098
|
|
|
@@ -1028,7 +1102,7 @@ If true, this will hide the keyboard accessory view (< > and Done).
|
1028
|
1102
|
|
1029
|
1103
|
---
|
1030
|
1104
|
|
1031
|
|
-### `allowsBackForwardNavigationGestures`
|
|
1105
|
+### `allowsBackForwardNavigationGestures`[⬆](#props-index)<!-- Link generated with jump2header -->
|
1032
|
1106
|
|
1033
|
1107
|
If true, this will be able horizontal swipe gestures. The default value is `false`.
|
1034
|
1108
|
|
|
@@ -1038,7 +1112,7 @@ If true, this will be able horizontal swipe gestures. The default value is `fals
|
1038
|
1112
|
|
1039
|
1113
|
---
|
1040
|
1114
|
|
1041
|
|
-### `incognito`
|
|
1115
|
+### `incognito`[⬆](#props-index)<!-- Link generated with jump2header -->
|
1042
|
1116
|
|
1043
|
1117
|
Does not store any data within the lifetime of the WebView.
|
1044
|
1118
|
|
|
@@ -1048,7 +1122,7 @@ Does not store any data within the lifetime of the WebView.
|
1048
|
1122
|
|
1049
|
1123
|
---
|
1050
|
1124
|
|
1051
|
|
-### `allowFileAccess`
|
|
1125
|
+### `allowFileAccess`[⬆](#props-index)<!-- Link generated with jump2header -->
|
1052
|
1126
|
|
1053
|
1127
|
If true, this will allow access to the file system via `file://` URI's. The default value is `false`.
|
1054
|
1128
|
|
|
@@ -1058,7 +1132,7 @@ If true, this will allow access to the file system via `file://` URI's. The defa
|
1058
|
1132
|
|
1059
|
1133
|
---
|
1060
|
1134
|
|
1061
|
|
-### `saveFormDataDisabled`
|
|
1135
|
+### `saveFormDataDisabled`[⬆](#props-index)<!-- Link generated with jump2header -->
|
1062
|
1136
|
|
1063
|
1137
|
Sets whether the WebView should disable saving form data. The default value is `false`. This function does not have any effect from Android API level 26 onwards as there is an Autofill feature which stores form data.
|
1064
|
1138
|
|
|
@@ -1068,7 +1142,7 @@ Sets whether the WebView should disable saving form data. The default value is `
|
1068
|
1142
|
|
1069
|
1143
|
---
|
1070
|
1144
|
|
1071
|
|
-### `cacheEnabled`
|
|
1145
|
+### `cacheEnabled`[⬆](#props-index)<!-- Link generated with jump2header -->
|
1072
|
1146
|
|
1073
|
1147
|
Sets whether WebView should use browser caching.
|
1074
|
1148
|
|
|
@@ -1078,7 +1152,7 @@ Sets whether WebView should use browser caching.
|
1078
|
1152
|
|
1079
|
1153
|
---
|
1080
|
1154
|
|
1081
|
|
-### `cacheMode`
|
|
1155
|
+### `cacheMode`[⬆](#props-index)<!-- Link generated with jump2header -->
|
1082
|
1156
|
|
1083
|
1157
|
Overrides the way the cache is used. The way the cache is used is based on the navigation type. For a normal page load, the cache is checked and content is re-validated as needed. When navigating back, content is not revalidated, instead the content is just retrieved from the cache. This property allows the client to override this behavior.
|
1084
|
1158
|
|
|
@@ -1095,7 +1169,7 @@ Possible values are:
|
1095
|
1169
|
|
1096
|
1170
|
---
|
1097
|
1171
|
|
1098
|
|
-### `pagingEnabled`
|
|
1172
|
+### `pagingEnabled`[⬆](#props-index)<!-- Link generated with jump2header -->
|
1099
|
1173
|
|
1100
|
1174
|
If the value of this property is true, the scroll view stops on multiples of the scroll view’s bounds when the user scrolls. The default value is false.
|
1101
|
1175
|
|
|
@@ -1105,7 +1179,7 @@ If the value of this property is true, the scroll view stops on multiples of the
|
1105
|
1179
|
|
1106
|
1180
|
---
|
1107
|
1181
|
|
1108
|
|
-### `allowsLinkPreview`
|
|
1182
|
+### `allowsLinkPreview`[⬆](#props-index)<!-- Link generated with jump2header -->
|
1109
|
1183
|
|
1110
|
1184
|
A Boolean value that determines whether pressing on a link displays a preview of the destination for the link. In iOS this property is available on devices that support 3D Touch. In iOS 10 and later, the default value is true; before that, the default value is false.
|
1111
|
1185
|
|
|
@@ -1115,7 +1189,7 @@ A Boolean value that determines whether pressing on a link displays a preview of
|
1115
|
1189
|
|
1116
|
1190
|
---
|
1117
|
1191
|
|
1118
|
|
-### `sharedCookiesEnabled`
|
|
1192
|
+### `sharedCookiesEnabled`[⬆](#props-index)<!-- Link generated with jump2header -->
|
1119
|
1193
|
|
1120
|
1194
|
Set `true` if shared cookies from `[NSHTTPCookieStorage sharedHTTPCookieStorage]` should used for every load request in the WebView. The default value is `false`. For more on cookies, read the [Guide](Guide.md#Managing-Cookies)
|
1121
|
1195
|
|
|
@@ -1125,7 +1199,7 @@ Set `true` if shared cookies from `[NSHTTPCookieStorage sharedHTTPCookieStorage]
|
1125
|
1199
|
|
1126
|
1200
|
---
|
1127
|
1201
|
|
1128
|
|
-### `textZoom`
|
|
1202
|
+### `textZoom`[⬆](#props-index)<!-- Link generated with jump2header -->
|
1129
|
1203
|
|
1130
|
1204
|
If the user has set a custom font size in the Android system, an undesirable scale of the site interface in WebView occurs.
|
1131
|
1205
|
|
|
@@ -1139,7 +1213,17 @@ Example:
|
1139
|
1213
|
|
1140
|
1214
|
`<WebView textZoom={100} />`
|
1141
|
1215
|
|
1142
|
|
-### `ignoreSilentHardwareSwitch`
|
|
1216
|
+---
|
|
1217
|
+
|
|
1218
|
+### `pullToRefreshEnabled`[⬆](#props-index)<!-- Link generated with jump2header -->
|
|
1219
|
+
|
|
1220
|
+Boolean value that determines whether a pull to refresh gesture is available in the `WebView`. The default value is `false`. If `true`, sets `bounces` automatically to `true`.
|
|
1221
|
+
|
|
1222
|
+| Type | Required | Platform |
|
|
1223
|
+| ------- | -------- | -------- |
|
|
1224
|
+| boolean | No | iOS |
|
|
1225
|
+
|
|
1226
|
+### `ignoreSilentHardwareSwitch`[⬆](#props-index)<!-- Link generated with jump2header -->
|
1143
|
1227
|
|
1144
|
1228
|
(ios only)
|
1145
|
1229
|
|
|
@@ -1149,7 +1233,7 @@ When set to true the hardware silent switch is ignored. Default: `false`
|
1149
|
1233
|
| ------- | -------- | -------- |
|
1150
|
1234
|
| boolean | No | iOS |
|
1151
|
1235
|
|
1152
|
|
-### `onFileDownload`
|
|
1236
|
+### `onFileDownload`[⬆](#props-index)<!-- Link generated with jump2header -->
|
1153
|
1237
|
This property is iOS-only.
|
1154
|
1238
|
|
1155
|
1239
|
Function that is invoked when the client needs to download a file.
|
|
@@ -1183,13 +1267,13 @@ Example:
|
1183
|
1267
|
|
1184
|
1268
|
## Methods
|
1185
|
1269
|
|
1186
|
|
-### `extraNativeComponentConfig()`
|
|
1270
|
+### `extraNativeComponentConfig()`[⬆](#methods-index)<!-- Link generated with jump2header -->
|
1187
|
1271
|
|
1188
|
1272
|
```javascript
|
1189
|
1273
|
static extraNativeComponentConfig()
|
1190
|
1274
|
```
|
1191
|
1275
|
|
1192
|
|
-### `goForward()`
|
|
1276
|
+### `goForward()`[⬆](#methods-index)<!-- Link generated with jump2header -->
|
1193
|
1277
|
|
1194
|
1278
|
```javascript
|
1195
|
1279
|
goForward();
|
|
@@ -1197,7 +1281,7 @@ goForward();
|
1197
|
1281
|
|
1198
|
1282
|
Go forward one page in the web view's history.
|
1199
|
1283
|
|
1200
|
|
-### `goBack()`
|
|
1284
|
+### `goBack()`[⬆](#methods-index)<!-- Link generated with jump2header -->
|
1201
|
1285
|
|
1202
|
1286
|
```javascript
|
1203
|
1287
|
goBack();
|
|
@@ -1205,7 +1289,7 @@ goBack();
|
1205
|
1289
|
|
1206
|
1290
|
Go back one page in the web view's history.
|
1207
|
1291
|
|
1208
|
|
-### `reload()`
|
|
1292
|
+### `reload()`[⬆](#methods-index)<!-- Link generated with jump2header -->
|
1209
|
1293
|
|
1210
|
1294
|
```javascript
|
1211
|
1295
|
reload();
|
|
@@ -1213,7 +1297,7 @@ reload();
|
1213
|
1297
|
|
1214
|
1298
|
Reloads the current page.
|
1215
|
1299
|
|
1216
|
|
-### `stopLoading()`
|
|
1300
|
+### `stopLoading()`[⬆](#methods-index)<!-- Link generated with jump2header -->
|
1217
|
1301
|
|
1218
|
1302
|
```javascript
|
1219
|
1303
|
stopLoading();
|
|
@@ -1221,7 +1305,7 @@ stopLoading();
|
1221
|
1305
|
|
1222
|
1306
|
Stop loading the current page.
|
1223
|
1307
|
|
1224
|
|
-### `injectJavaScript(str)`
|
|
1308
|
+### `injectJavaScript(str)`[⬆](#methods-index)<!-- Link generated with jump2header -->
|
1225
|
1309
|
|
1226
|
1310
|
```javascript
|
1227
|
1311
|
injectJavaScript('... javascript string ...');
|
|
@@ -1231,7 +1315,7 @@ Executes the JavaScript string.
|
1231
|
1315
|
|
1232
|
1316
|
To learn more, read the [Communicating between JS and Native](Guide.md#communicating-between-js-and-native) guide.
|
1233
|
1317
|
|
1234
|
|
-### `requestFocus()`
|
|
1318
|
+### `requestFocus()`[⬆](#methods-index)<!-- Link generated with jump2header -->
|
1235
|
1319
|
|
1236
|
1320
|
```javascript
|
1237
|
1321
|
requestFocus();
|
|
@@ -1239,14 +1323,14 @@ requestFocus();
|
1239
|
1323
|
|
1240
|
1324
|
Request the webView to ask for focus. (People working on TV apps might want having a look at this!)
|
1241
|
1325
|
|
1242
|
|
-### `postMessage(str)`
|
|
1326
|
+### `postMessage(str)`[⬆](#methods-index)<!-- Link generated with jump2header -->
|
1243
|
1327
|
|
1244
|
1328
|
```javascript
|
1245
|
1329
|
postMessage('message');
|
1246
|
1330
|
```
|
1247
|
1331
|
Post a message to WebView, handled by [`onMessage`](Reference.md#onmessage).
|
1248
|
1332
|
|
1249
|
|
-### `clearFormData()`
|
|
1333
|
+### `clearFormData()`[⬆](#methods-index)<!-- Link generated with jump2header -->
|
1250
|
1334
|
|
1251
|
1335
|
(android only)
|
1252
|
1336
|
|
|
@@ -1256,7 +1340,7 @@ clearFormData();
|
1256
|
1340
|
|
1257
|
1341
|
Removes the autocomplete popup from the currently focused form field, if present. [developer.android.com reference](<https://developer.android.com/reference/android/webkit/WebView.html#clearFormData()>)
|
1258
|
1342
|
|
1259
|
|
-### `clearCache(bool)`
|
|
1343
|
+### `clearCache(bool)`[⬆](#methods-index)<!-- Link generated with jump2header -->
|
1260
|
1344
|
|
1261
|
1345
|
(android only)
|
1262
|
1346
|
|
|
@@ -1266,7 +1350,7 @@ clearCache(true);
|
1266
|
1350
|
|
1267
|
1351
|
Clears the resource cache. Note that the cache is per-application, so this will clear the cache for all WebViews used. [developer.android.com reference](<https://developer.android.com/reference/android/webkit/WebView.html#clearCache(boolean)>)
|
1268
|
1352
|
|
1269
|
|
-### `clearHistory()`
|
|
1353
|
+### `clearHistory()`[⬆](#methods-index)<!-- Link generated with jump2header -->
|
1270
|
1354
|
|
1271
|
1355
|
(android only)
|
1272
|
1356
|
|