mirror of
https://github.com/status-im/react-native-webview.git
synced 2025-02-23 09:18:38 +00:00
feat(android props): Add incognito to Android (#524)
This commit is contained in:
parent
1d649a81c8
commit
25bc5a55c6
@ -329,6 +329,23 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
|||||||
((RNCWebView) view).setMessagingEnabled(enabled);
|
((RNCWebView) view).setMessagingEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ReactProp(name = "incognito")
|
||||||
|
public void setIncognito(WebView view, boolean enabled) {
|
||||||
|
// Remove all previous cookies
|
||||||
|
CookieManager.getInstance().removeAllCookies(null);
|
||||||
|
|
||||||
|
// Disable caching
|
||||||
|
view.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
|
||||||
|
view.getSettings().setAppCacheEnabled(!enabled);
|
||||||
|
view.clearHistory();
|
||||||
|
view.clearCache(enabled);
|
||||||
|
|
||||||
|
// No form data or autofill enabled
|
||||||
|
view.clearFormData();
|
||||||
|
view.getSettings().setSavePassword(!enabled);
|
||||||
|
view.getSettings().setSaveFormData(!enabled);
|
||||||
|
}
|
||||||
|
|
||||||
@ReactProp(name = "source")
|
@ReactProp(name = "source")
|
||||||
public void setSource(WebView view, @Nullable ReadableMap source) {
|
public void setSource(WebView view, @Nullable ReadableMap source) {
|
||||||
if (source != null) {
|
if (source != null) {
|
||||||
|
@ -832,8 +832,8 @@ If true, this will be able horizontal swipe gestures when using the WKWebView. T
|
|||||||
Does not store any data within the lifetime of the WebView.
|
Does not store any data within the lifetime of the WebView.
|
||||||
|
|
||||||
| Type | Required | Platform |
|
| Type | Required | Platform |
|
||||||
| ------- | -------- | ------------- |
|
| ------- | -------- | ---------------------- |
|
||||||
| boolean | No | iOS WKWebView |
|
| boolean | No | Android, iOS WKWebView |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -212,6 +212,7 @@ export type OnShouldStartLoadWithRequest = (
|
|||||||
|
|
||||||
export interface CommonNativeWebViewProps extends ViewProps {
|
export interface CommonNativeWebViewProps extends ViewProps {
|
||||||
cacheEnabled?: boolean;
|
cacheEnabled?: boolean;
|
||||||
|
incognito?: boolean;
|
||||||
injectedJavaScript?: string;
|
injectedJavaScript?: string;
|
||||||
mediaPlaybackRequiresUserAction?: boolean;
|
mediaPlaybackRequiresUserAction?: boolean;
|
||||||
messagingEnabled: boolean;
|
messagingEnabled: boolean;
|
||||||
@ -258,7 +259,6 @@ export interface IOSNativeWebViewProps extends CommonNativeWebViewProps {
|
|||||||
decelerationRate?: number;
|
decelerationRate?: number;
|
||||||
directionalLockEnabled?: boolean;
|
directionalLockEnabled?: boolean;
|
||||||
hideKeyboardAccessoryView?: boolean;
|
hideKeyboardAccessoryView?: boolean;
|
||||||
incognito?: boolean;
|
|
||||||
pagingEnabled?: boolean;
|
pagingEnabled?: boolean;
|
||||||
scrollEnabled?: boolean;
|
scrollEnabled?: boolean;
|
||||||
useSharedProcessPool?: boolean;
|
useSharedProcessPool?: boolean;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user