|
|
/**
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
* All rights reserved.
|
|
|
*
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
* LICENSE file in the root directory of this source tree.
|
|
|
*
|
|
|
* @providesModule WebView
|
|
|
* @format
|
|
|
* @noflow
|
|
|
*/
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
var ActivityIndicator = require('ActivityIndicator');
|
|
|
var EdgeInsetsPropType = require('EdgeInsetsPropType');
|
|
|
var React = require('React');
|
|
|
var PropTypes = require('prop-types');
|
|
|
var ReactNative = require('ReactNative');
|
|
|
var StyleSheet = require('StyleSheet');
|
|
|
var Text = require('Text');
|
|
|
var UIManager = require('UIManager');
|
|
|
var View = require('View');
|
|
|
var ViewPropTypes = require('ViewPropTypes');
|
|
|
var ScrollView = require('ScrollView');
|
|
|
|
|
|
var deprecatedPropType = require('deprecatedPropType');
|
|
|
var invariant = require('fbjs/lib/invariant');
|
|
|
var keyMirror = require('fbjs/lib/keyMirror');
|
|
|
var processDecelerationRate = require('processDecelerationRate');
|
|
|
var requireNativeComponent = require('requireNativeComponent');
|
|
|
var resolveAssetSource = require('resolveAssetSource');
|
|
|
|
|
|
var RCTWebViewManager = require('NativeModules').WebViewManager;
|
|
|
|
|
|
var BGWASH = 'rgba(255,255,255,0.8)';
|
|
|
var RCT_WEBVIEW_REF = 'webview';
|
|
|
|
|
|
var WebViewState = keyMirror({
|
|
|
const ActivityIndicator = require('ActivityIndicator');
|
|
|
const EdgeInsetsPropType = require('EdgeInsetsPropType');
|
|
|
const Linking = require('Linking');
|
|
|
const PropTypes = require('prop-types');
|
|
|
const React = require('React');
|
|
|
const ReactNative = require('ReactNative');
|
|
|
const ScrollView = require('ScrollView');
|
|
|
const StyleSheet = require('StyleSheet');
|
|
|
const Text = require('Text');
|
|
|
const UIManager = require('UIManager');
|
|
|
const View = require('View');
|
|
|
const ViewPropTypes = require('ViewPropTypes');
|
|
|
const WebViewShared = require('WebViewShared');
|
|
|
|
|
|
const deprecatedPropType = require('deprecatedPropType');
|
|
|
const invariant = require('fbjs/lib/invariant');
|
|
|
const keyMirror = require('fbjs/lib/keyMirror');
|
|
|
const processDecelerationRate = require('processDecelerationRate');
|
|
|
const requireNativeComponent = require('requireNativeComponent');
|
|
|
const resolveAssetSource = require('resolveAssetSource');
|
|
|
|
|
|
const RCTWKWebViewManager = require('NativeModules').WKWebViewManager;
|
|
|
|
|
|
const BGWASH = 'rgba(255,255,255,0.8)';
|
|
|
const RCT_WEBVIEW_REF = 'webview';
|
|
|
|
|
|
const WebViewState = keyMirror({
|
|
|
IDLE: null,
|
|
|
LOADING: null,
|
|
|
ERROR: null,
|
...
|
...
|
@@ -56,7 +57,7 @@ type ErrorEvent = { |
|
|
domain: any,
|
|
|
code: any,
|
|
|
description: any,
|
|
|
}
|
|
|
};
|
|
|
|
|
|
type Event = Object;
|
|
|
|
...
|
...
|
@@ -65,29 +66,24 @@ const DataDetectorTypes = [ |
|
|
'link',
|
|
|
'address',
|
|
|
'calendarEvent',
|
|
|
'trackingNumber',
|
|
|
'flightNumber',
|
|
|
'lookupSuggestion',
|
|
|
'none',
|
|
|
'all',
|
|
|
];
|
|
|
|
|
|
var defaultRenderLoading = () => (
|
|
|
const defaultRenderLoading = () => (
|
|
|
<View style={styles.loadingView}>
|
|
|
<ActivityIndicator />
|
|
|
</View>
|
|
|
);
|
|
|
var defaultRenderError = (errorDomain, errorCode, errorDesc) => (
|
|
|
const defaultRenderError = (errorDomain, errorCode, errorDesc) => (
|
|
|
<View style={styles.errorContainer}>
|
|
|
<Text style={styles.errorTextTitle}>
|
|
|
Error loading page
|
|
|
</Text>
|
|
|
<Text style={styles.errorText}>
|
|
|
{'Domain: ' + errorDomain}
|
|
|
</Text>
|
|
|
<Text style={styles.errorText}>
|
|
|
{'Error Code: ' + errorCode}
|
|
|
</Text>
|
|
|
<Text style={styles.errorText}>
|
|
|
{'Description: ' + errorDesc}
|
|
|
</Text>
|
|
|
<Text style={styles.errorTextTitle}>Error loading page</Text>
|
|
|
<Text style={styles.errorText}>{'Domain: ' + errorDomain}</Text>
|
|
|
<Text style={styles.errorText}>{'Error Code: ' + errorCode}</Text>
|
|
|
<Text style={styles.errorText}>{'Description: ' + errorDesc}</Text>
|
|
|
</View>
|
|
|
);
|
|
|
|
...
|
...
|
@@ -116,30 +112,15 @@ var defaultRenderError = (errorDomain, errorCode, errorDesc) => ( |
|
|
class WebView extends React.Component {
|
|
|
static JSNavigationScheme = JSNavigationScheme;
|
|
|
static NavigationType = NavigationType;
|
|
|
static get extraNativeComponentConfig() {
|
|
|
return {
|
|
|
nativeOnly: {
|
|
|
onLoadingStart: true,
|
|
|
onLoadingError: true,
|
|
|
onLoadingFinish: true,
|
|
|
onMessage: true,
|
|
|
messagingEnabled: PropTypes.bool,
|
|
|
},
|
|
|
};
|
|
|
}
|
|
|
|
|
|
static propTypes = {
|
|
|
...ViewPropTypes,
|
|
|
|
|
|
html: deprecatedPropType(
|
|
|
PropTypes.string,
|
|
|
'Use the `source` prop instead.'
|
|
|
'Use the `source` prop instead.',
|
|
|
),
|
|
|
|
|
|
url: deprecatedPropType(
|
|
|
PropTypes.string,
|
|
|
'Use the `source` prop instead.'
|
|
|
),
|
|
|
url: deprecatedPropType(PropTypes.string, 'Use the `source` prop instead.'),
|
|
|
|
|
|
/**
|
|
|
* Loads static html or a uri (with optional headers) in the WebView.
|
...
|
...
|
@@ -185,6 +166,12 @@ class WebView extends React.Component { |
|
|
]),
|
|
|
|
|
|
/**
|
|
|
* If true, use WKWebView instead of UIWebView.
|
|
|
* @platform ios
|
|
|
*/
|
|
|
useWebKit: PropTypes.bool,
|
|
|
|
|
|
/**
|
|
|
* Function that returns a view to show if there's an error.
|
|
|
*/
|
|
|
renderError: PropTypes.func, // view to show if there's an error
|
...
|
...
|
@@ -225,7 +212,10 @@ class WebView extends React.Component { |
|
|
* - fast: 0.99 (the default for iOS web view)
|
|
|
* @platform ios
|
|
|
*/
|
|
|
decelerationRate: ScrollView.propTypes.decelerationRate,
|
|
|
decelerationRate: PropTypes.oneOfType([
|
|
|
PropTypes.oneOf(['fast', 'normal']),
|
|
|
PropTypes.number,
|
|
|
]),
|
|
|
/**
|
|
|
* Boolean value that determines whether scrolling is enabled in the
|
|
|
* `WebView`. The default value is `true`.
|
...
|
...
|
@@ -283,6 +273,11 @@ class WebView extends React.Component { |
|
|
* - `'none'`
|
|
|
* - `'all'`
|
|
|
*
|
|
|
* With the new WebKit implementation, we have three new values:
|
|
|
* - `'trackingNumber'`,
|
|
|
* - `'flightNumber'`,
|
|
|
* - `'lookupSuggestion'`,
|
|
|
*
|
|
|
* @platform ios
|
|
|
*/
|
|
|
dataDetectorTypes: PropTypes.oneOfType([
|
...
|
...
|
@@ -328,6 +323,8 @@ class WebView extends React.Component { |
|
|
* 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`.
|
|
|
*
|
|
|
* On iOS, when `useWebKit=true`, this prop will not work.
|
|
|
*/
|
|
|
scalesPageToFit: PropTypes.bool,
|
|
|
|
...
|
...
|
@@ -357,6 +354,15 @@ class WebView extends React.Component { |
|
|
mediaPlaybackRequiresUserAction: PropTypes.bool,
|
|
|
|
|
|
/**
|
|
|
* 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, we will open the URL in Safari.
|
|
|
* The default whitelisted origins are "http://*" and "https://*".
|
|
|
*/
|
|
|
originWhitelist: PropTypes.arrayOf(PropTypes.string),
|
|
|
|
|
|
/**
|
|
|
* Function that accepts a string that will be passed to the WebView and
|
|
|
* executed immediately as JavaScript.
|
|
|
*/
|
...
|
...
|
@@ -372,11 +378,7 @@ class WebView extends React.Component { |
|
|
* - `'compatibility'` - WebView will attempt to be compatible with the approach of a modern web browser with regard to mixed content.
|
|
|
* @platform android
|
|
|
*/
|
|
|
mixedContentMode: PropTypes.oneOf([
|
|
|
'never',
|
|
|
'always',
|
|
|
'compatibility'
|
|
|
]),
|
|
|
mixedContentMode: PropTypes.oneOf(['never', 'always', 'compatibility']),
|
|
|
|
|
|
/**
|
|
|
* Override the native component used to render the WebView. Enables a custom native
|
...
|
...
|
@@ -393,7 +395,7 @@ class WebView extends React.Component { |
|
|
*/
|
|
|
props: PropTypes.object,
|
|
|
/*
|
|
|
* Set the ViewManager to use for communcation with the native side.
|
|
|
* Set the ViewManager to use for communication with the native side.
|
|
|
* @platform ios
|
|
|
*/
|
|
|
viewManager: PropTypes.object,
|
...
|
...
|
@@ -401,7 +403,7 @@ class WebView extends React.Component { |
|
|
};
|
|
|
|
|
|
static defaultProps = {
|
|
|
scalesPageToFit: true,
|
|
|
originWhitelist: WebViewShared.defaultOriginWhitelist,
|
|
|
};
|
|
|
|
|
|
state = {
|
...
|
...
|
@@ -414,50 +416,90 @@ class WebView extends React.Component { |
|
|
if (this.props.startInLoadingState) {
|
|
|
this.setState({viewState: WebViewState.LOADING});
|
|
|
}
|
|
|
|
|
|
if (
|
|
|
this.props.useWebKit === true &&
|
|
|
this.props.scalesPageToFit !== undefined
|
|
|
) {
|
|
|
console.warn(
|
|
|
'The scalesPageToFit property is not supported when useWebKit = true',
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
render() {
|
|
|
var otherView = null;
|
|
|
let otherView = null;
|
|
|
|
|
|
let scalesPageToFit;
|
|
|
|
|
|
if (this.props.useWebKit) {
|
|
|
({scalesPageToFit} = this.props);
|
|
|
} else {
|
|
|
({scalesPageToFit = true} = this.props);
|
|
|
}
|
|
|
|
|
|
if (this.state.viewState === WebViewState.LOADING) {
|
|
|
otherView = (this.props.renderLoading || defaultRenderLoading)();
|
|
|
} else if (this.state.viewState === WebViewState.ERROR) {
|
|
|
var errorEvent = this.state.lastErrorEvent;
|
|
|
invariant(
|
|
|
errorEvent != null,
|
|
|
'lastErrorEvent expected to be non-null'
|
|
|
);
|
|
|
const errorEvent = this.state.lastErrorEvent;
|
|
|
invariant(errorEvent != null, 'lastErrorEvent expected to be non-null');
|
|
|
otherView = (this.props.renderError || defaultRenderError)(
|
|
|
errorEvent.domain,
|
|
|
errorEvent.code,
|
|
|
errorEvent.description
|
|
|
errorEvent.description,
|
|
|
);
|
|
|
} else if (this.state.viewState !== WebViewState.IDLE) {
|
|
|
console.error(
|
|
|
'RCTWebView invalid state encountered: ' + this.state.loading
|
|
|
'RCTWebView invalid state encountered: ' + this.state.loading,
|
|
|
);
|
|
|
}
|
|
|
|
|
|
var webViewStyles = [styles.container, styles.webView, this.props.style];
|
|
|
if (this.state.viewState === WebViewState.LOADING ||
|
|
|
this.state.viewState === WebViewState.ERROR) {
|
|
|
const webViewStyles = [styles.container, styles.webView, this.props.style];
|
|
|
if (
|
|
|
this.state.viewState === WebViewState.LOADING ||
|
|
|
this.state.viewState === WebViewState.ERROR
|
|
|
) {
|
|
|
// if we're in either LOADING or ERROR states, don't show the webView
|
|
|
webViewStyles.push(styles.hidden);
|
|
|
}
|
|
|
|
|
|
const nativeConfig = this.props.nativeConfig || {};
|
|
|
|
|
|
const viewManager = nativeConfig.viewManager || RCTWebViewManager;
|
|
|
let viewManager = nativeConfig.viewManager;
|
|
|
|
|
|
var onShouldStartLoadWithRequest = this.props.onShouldStartLoadWithRequest && ((event: Event) => {
|
|
|
var shouldStart = this.props.onShouldStartLoadWithRequest &&
|
|
|
this.props.onShouldStartLoadWithRequest(event.nativeEvent);
|
|
|
viewManager.startLoadWithResult(!!shouldStart, event.nativeEvent.lockIdentifier);
|
|
|
});
|
|
|
viewManager = viewManager || RCTWKWebViewManager;
|
|
|
|
|
|
const compiledWhitelist = [
|
|
|
'about:blank',
|
|
|
...(this.props.originWhitelist || []),
|
|
|
].map(WebViewShared.originWhitelistToRegex);
|
|
|
const onShouldStartLoadWithRequest = (event: Event) => {
|
|
|
let shouldStart = true;
|
|
|
const {url} = event.nativeEvent;
|
|
|
const origin = WebViewShared.extractOrigin(url);
|
|
|
const passesWhitelist = compiledWhitelist.some(x =>
|
|
|
new RegExp(x).test(origin),
|
|
|
);
|
|
|
shouldStart = shouldStart && passesWhitelist;
|
|
|
if (!passesWhitelist) {
|
|
|
Linking.openURL(url);
|
|
|
}
|
|
|
if (this.props.onShouldStartLoadWithRequest) {
|
|
|
shouldStart =
|
|
|
shouldStart &&
|
|
|
this.props.onShouldStartLoadWithRequest(event.nativeEvent);
|
|
|
}
|
|
|
viewManager.startLoadWithResult(
|
|
|
!!shouldStart,
|
|
|
event.nativeEvent.lockIdentifier,
|
|
|
);
|
|
|
};
|
|
|
|
|
|
var decelerationRate = processDecelerationRate(this.props.decelerationRate);
|
|
|
const decelerationRate = processDecelerationRate(
|
|
|
this.props.decelerationRate,
|
|
|
);
|
|
|
|
|
|
var source = this.props.source || {};
|
|
|
const source = this.props.source || {};
|
|
|
if (this.props.html) {
|
|
|
source.html = this.props.html;
|
|
|
} else if (this.props.url) {
|
...
|
...
|
@@ -466,9 +508,15 @@ class WebView extends React.Component { |
|
|
|
|
|
const messagingEnabled = typeof this.props.onMessage === 'function';
|
|
|
|
|
|
const NativeWebView = nativeConfig.component || RCTWebView;
|
|
|
let NativeWebView = nativeConfig.component;
|
|
|
|
|
|
var webView =
|
|
|
if (this.props.useWebKit) {
|
|
|
NativeWebView = NativeWebView || RCTWKWebView;
|
|
|
} else {
|
|
|
NativeWebView = NativeWebView || RCTWebView;
|
|
|
}
|
|
|
|
|
|
const webView = (
|
|
|
<NativeWebView
|
|
|
ref={RCT_WEBVIEW_REF}
|
|
|
key="webViewKey"
|
...
|
...
|
@@ -479,19 +527,24 @@ class WebView extends React.Component { |
|
|
scrollEnabled={this.props.scrollEnabled}
|
|
|
decelerationRate={decelerationRate}
|
|
|
contentInset={this.props.contentInset}
|
|
|
automaticallyAdjustContentInsets={this.props.automaticallyAdjustContentInsets}
|
|
|
automaticallyAdjustContentInsets={
|
|
|
this.props.automaticallyAdjustContentInsets
|
|
|
}
|
|
|
onLoadingStart={this._onLoadingStart}
|
|
|
onLoadingFinish={this._onLoadingFinish}
|
|
|
onLoadingError={this._onLoadingError}
|
|
|
messagingEnabled={messagingEnabled}
|
|
|
onMessage={this._onMessage}
|
|
|
onShouldStartLoadWithRequest={onShouldStartLoadWithRequest}
|
|
|
scalesPageToFit={this.props.scalesPageToFit}
|
|
|
scalesPageToFit={scalesPageToFit}
|
|
|
allowsInlineMediaPlayback={this.props.allowsInlineMediaPlayback}
|
|
|
mediaPlaybackRequiresUserAction={this.props.mediaPlaybackRequiresUserAction}
|
|
|
mediaPlaybackRequiresUserAction={
|
|
|
this.props.mediaPlaybackRequiresUserAction
|
|
|
}
|
|
|
dataDetectorTypes={this.props.dataDetectorTypes}
|
|
|
{...nativeConfig.props}
|
|
|
/>;
|
|
|
/>
|
|
|
);
|
|
|
|
|
|
return (
|
|
|
<View style={styles.container}>
|
...
|
...
|
@@ -501,14 +554,22 @@ class WebView extends React.Component { |
|
|
);
|
|
|
}
|
|
|
|
|
|
_getCommands() {
|
|
|
if (!this.props.useWebKit) {
|
|
|
return UIManager.RCTWebView.Commands;
|
|
|
}
|
|
|
|
|
|
return UIManager.RCTWKWebView.Commands;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Go forward one page in the web view's history.
|
|
|
*/
|
|
|
goForward = () => {
|
|
|
UIManager.dispatchViewManagerCommand(
|
|
|
this.getWebViewHandle(),
|
|
|
UIManager.RCTWebView.Commands.goForward,
|
|
|
null
|
|
|
this._getCommands().goForward,
|
|
|
null,
|
|
|
);
|
|
|
};
|
|
|
|
...
|
...
|
@@ -518,8 +579,8 @@ class WebView extends React.Component { |
|
|
goBack = () => {
|
|
|
UIManager.dispatchViewManagerCommand(
|
|
|
this.getWebViewHandle(),
|
|
|
UIManager.RCTWebView.Commands.goBack,
|
|
|
null
|
|
|
this._getCommands().goBack,
|
|
|
null,
|
|
|
);
|
|
|
};
|
|
|
|
...
|
...
|
@@ -530,8 +591,8 @@ class WebView extends React.Component { |
|
|
this.setState({viewState: WebViewState.LOADING});
|
|
|
UIManager.dispatchViewManagerCommand(
|
|
|
this.getWebViewHandle(),
|
|
|
UIManager.RCTWebView.Commands.reload,
|
|
|
null
|
|
|
this._getCommands().reload,
|
|
|
null,
|
|
|
);
|
|
|
};
|
|
|
|
...
|
...
|
@@ -541,8 +602,8 @@ class WebView extends React.Component { |
|
|
stopLoading = () => {
|
|
|
UIManager.dispatchViewManagerCommand(
|
|
|
this.getWebViewHandle(),
|
|
|
UIManager.RCTWebView.Commands.stopLoading,
|
|
|
null
|
|
|
this._getCommands().stopLoading,
|
|
|
null,
|
|
|
);
|
|
|
};
|
|
|
|
...
|
...
|
@@ -556,25 +617,25 @@ class WebView extends React.Component { |
|
|
* document.addEventListener('message', e => { document.title = e.data; });
|
|
|
* ```
|
|
|
*/
|
|
|
postMessage = (data) => {
|
|
|
postMessage = data => {
|
|
|
UIManager.dispatchViewManagerCommand(
|
|
|
this.getWebViewHandle(),
|
|
|
UIManager.RCTWebView.Commands.postMessage,
|
|
|
[String(data)]
|
|
|
this._getCommands().postMessage,
|
|
|
[String(data)],
|
|
|
);
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* Injects a javascript string into the referenced WebView. Deliberately does not
|
|
|
* return a response because using eval() to return a response breaks this method
|
|
|
* on pages with a Content Security Policy that disallows eval(). If you need that
|
|
|
* functionality, look into postMessage/onMessage.
|
|
|
*/
|
|
|
injectJavaScript = (data) => {
|
|
|
* Injects a javascript string into the referenced WebView. Deliberately does not
|
|
|
* return a response because using eval() to return a response breaks this method
|
|
|
* on pages with a Content Security Policy that disallows eval(). If you need that
|
|
|
* functionality, look into postMessage/onMessage.
|
|
|
*/
|
|
|
injectJavaScript = data => {
|
|
|
UIManager.dispatchViewManagerCommand(
|
|
|
this.getWebViewHandle(),
|
|
|
UIManager.RCTWebView.Commands.injectJavaScript,
|
|
|
[data]
|
|
|
this._getCommands().injectJavaScript,
|
|
|
[data],
|
|
|
);
|
|
|
};
|
|
|
|
...
|
...
|
@@ -596,26 +657,26 @@ class WebView extends React.Component { |
|
|
};
|
|
|
|
|
|
_onLoadingStart = (event: Event) => {
|
|
|
var onLoadStart = this.props.onLoadStart;
|
|
|
const onLoadStart = this.props.onLoadStart;
|
|
|
onLoadStart && onLoadStart(event);
|
|
|
this._updateNavigationState(event);
|
|
|
};
|
|
|
|
|
|
_onLoadingError = (event: Event) => {
|
|
|
event.persist(); // persist this event because we need to store it
|
|
|
var {onError, onLoadEnd} = this.props;
|
|
|
const {onError, onLoadEnd} = this.props;
|
|
|
onError && onError(event);
|
|
|
onLoadEnd && onLoadEnd(event);
|
|
|
console.warn('Encountered an error loading page', event.nativeEvent);
|
|
|
|
|
|
this.setState({
|
|
|
lastErrorEvent: event.nativeEvent,
|
|
|
viewState: WebViewState.ERROR
|
|
|
viewState: WebViewState.ERROR,
|
|
|
});
|
|
|
};
|
|
|
|
|
|
_onLoadingFinish = (event: Event) => {
|
|
|
var {onLoad, onLoadEnd} = this.props;
|
|
|
const {onLoad, onLoadEnd} = this.props;
|
|
|
onLoad && onLoad(event);
|
|
|
onLoadEnd && onLoadEnd(event);
|
|
|
this.setState({
|
...
|
...
|
@@ -625,14 +686,47 @@ class WebView extends React.Component { |
|
|
};
|
|
|
|
|
|
_onMessage = (event: Event) => {
|
|
|
var {onMessage} = this.props;
|
|
|
const {onMessage} = this.props;
|
|
|
onMessage && onMessage(event);
|
|
|
};
|
|
|
|
|
|
componentDidUpdate(prevProps) {
|
|
|
if (!(prevProps.useWebKit && this.props.useWebKit)) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
this._showRedboxOnPropChanges(prevProps, 'allowsInlineMediaPlayback');
|
|
|
this._showRedboxOnPropChanges(prevProps, 'mediaPlaybackRequiresUserAction');
|
|
|
this._showRedboxOnPropChanges(prevProps, 'dataDetectorTypes');
|
|
|
|
|
|
if (this.props.scalesPageToFit !== undefined) {
|
|
|
console.warn(
|
|
|
'The scalesPageToFit property is not supported when useWebKit = true',
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
_showRedboxOnPropChanges(prevProps, propName: string) {
|
|
|
if (this.props[propName] !== prevProps[propName]) {
|
|
|
console.error(
|
|
|
`Changes to property ${propName} do nothing after the initial render.`,
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var RCTWebView = requireNativeComponent('RCTWebView', WebView, WebView.extraNativeComponentConfig);
|
|
|
const RCTWebView = requireNativeComponent(
|
|
|
'RCTWebView',
|
|
|
WebView,
|
|
|
WebView.extraNativeComponentConfig,
|
|
|
);
|
|
|
const RCTWKWebView = requireNativeComponent(
|
|
|
'RCTWKWebView',
|
|
|
WebView,
|
|
|
WebView.extraNativeComponentConfig,
|
|
|
);
|
|
|
|
|
|
var styles = StyleSheet.create({
|
|
|
const styles = StyleSheet.create({
|
|
|
container: {
|
|
|
flex: 1,
|
|
|
},
|
...
|
...
|
@@ -665,7 +759,7 @@ var styles = StyleSheet.create({ |
|
|
},
|
|
|
webView: {
|
|
|
backgroundColor: '#ffffff',
|
|
|
}
|
|
|
},
|
|
|
});
|
|
|
|
|
|
module.exports = WebView; |
...
|
...
|
|