|
@@ -51,11 +51,10 @@ function processDecelerationRate(decelerationRate) {
|
51
|
51
|
return decelerationRate;
|
52
|
52
|
}
|
53
|
53
|
|
54
|
|
-const RCTUIWebViewManager = NativeModules.UIWebViewManager;
|
55
|
|
-const RCTWKWebViewManager = NativeModules.WKWebViewManager;
|
|
54
|
+const RNCUIWebViewManager = NativeModules.RNCUIWebViewManager;
|
|
55
|
+const RNCWKWebViewManager = NativeModules.RNCWKWebViewManager;
|
56
|
56
|
|
57
|
57
|
const BGWASH = 'rgba(255,255,255,0.8)';
|
58
|
|
-const RCT_WEBVIEW_REF = 'webview';
|
59
|
58
|
|
60
|
59
|
const WebViewState = keyMirror({
|
61
|
60
|
IDLE: null,
|
|
@@ -143,6 +142,8 @@ class WebView extends React.Component<WebViewSharedProps, State> {
|
143
|
142
|
startInLoadingState: true,
|
144
|
143
|
};
|
145
|
144
|
|
|
145
|
+ webViewRef = React.createRef();
|
|
146
|
+
|
146
|
147
|
UNSAFE_componentWillMount() {
|
147
|
148
|
if (this.props.startInLoadingState) {
|
148
|
149
|
this.setState({ viewState: WebViewState.LOADING });
|
|
@@ -181,7 +182,7 @@ class WebView extends React.Component<WebViewSharedProps, State> {
|
181
|
182
|
);
|
182
|
183
|
} else if (this.state.viewState !== WebViewState.IDLE) {
|
183
|
184
|
console.error(
|
184
|
|
- 'RCTWebView invalid state encountered: ' + this.state.viewState,
|
|
185
|
+ 'RNCWebView invalid state encountered: ' + this.state.viewState,
|
185
|
186
|
);
|
186
|
187
|
}
|
187
|
188
|
|
|
@@ -199,9 +200,9 @@ class WebView extends React.Component<WebViewSharedProps, State> {
|
199
|
200
|
let viewManager = nativeConfig.viewManager;
|
200
|
201
|
|
201
|
202
|
if (this.props.useWebKit) {
|
202
|
|
- viewManager = viewManager || RCTWKWebViewManager;
|
|
203
|
+ viewManager = viewManager || RNCWKWebViewManager;
|
203
|
204
|
} else {
|
204
|
|
- viewManager = viewManager || RCTUIWebViewManager;
|
|
205
|
+ viewManager = viewManager || RNCUIWebViewManager;
|
205
|
206
|
}
|
206
|
207
|
|
207
|
208
|
const compiledWhitelist = [
|
|
@@ -247,14 +248,14 @@ class WebView extends React.Component<WebViewSharedProps, State> {
|
247
|
248
|
let NativeWebView = nativeConfig.component;
|
248
|
249
|
|
249
|
250
|
if (this.props.useWebKit) {
|
250
|
|
- NativeWebView = NativeWebView || RCTWKWebView;
|
|
251
|
+ NativeWebView = NativeWebView || RNCWKWebView;
|
251
|
252
|
} else {
|
252
|
|
- NativeWebView = NativeWebView || RCTWebView;
|
|
253
|
+ NativeWebView = NativeWebView || RNCUIWebView;
|
253
|
254
|
}
|
254
|
255
|
|
255
|
256
|
const webView = (
|
256
|
257
|
<NativeWebView
|
257
|
|
- ref={RCT_WEBVIEW_REF}
|
|
258
|
+ ref={webViewRef}
|
258
|
259
|
key="webViewKey"
|
259
|
260
|
style={webViewStyles}
|
260
|
261
|
source={resolveAssetSource(source)}
|
|
@@ -292,10 +293,10 @@ class WebView extends React.Component<WebViewSharedProps, State> {
|
292
|
293
|
|
293
|
294
|
_getCommands() {
|
294
|
295
|
if (!this.props.useWebKit) {
|
295
|
|
- return UIManager.RCTWebView.Commands;
|
|
296
|
+ return UIManager.RNCUIWebView.Commands;
|
296
|
297
|
}
|
297
|
298
|
|
298
|
|
- return UIManager.RCTWKWebView.Commands;
|
|
299
|
+ return UIManager.RNCWKWebView.Commands;
|
299
|
300
|
}
|
300
|
301
|
|
301
|
302
|
/**
|
|
@@ -389,7 +390,7 @@ class WebView extends React.Component<WebViewSharedProps, State> {
|
389
|
390
|
* Returns the native `WebView` node.
|
390
|
391
|
*/
|
391
|
392
|
getWebViewHandle = () => {
|
392
|
|
- return ReactNative.findNodeHandle(this.refs[RCT_WEBVIEW_REF]);
|
|
393
|
+ return ReactNative.findNodeHandle(webViewRef.current);
|
393
|
394
|
};
|
394
|
395
|
|
395
|
396
|
_onLoadingStart = (event: WebViewNavigationEvent) => {
|
|
@@ -451,8 +452,8 @@ class WebView extends React.Component<WebViewSharedProps, State> {
|
451
|
452
|
}
|
452
|
453
|
}
|
453
|
454
|
|
454
|
|
-const RCTWebView = requireNativeComponent('RCTWebView');
|
455
|
|
-const RCTWKWebView = requireNativeComponent('RCTWKWebView');
|
|
455
|
+const RNCUIWebView = requireNativeComponent('RNCUIWebView');
|
|
456
|
+const RNCWKWebView = requireNativeComponent('RNCWKWebView');
|
456
|
457
|
|
457
|
458
|
const styles = StyleSheet.create({
|
458
|
459
|
container: {
|