|
@@ -1,46 +0,0 @@
|
1
|
|
-/**
|
2
|
|
- * Copyright (c) 2015-present, Facebook, Inc.
|
3
|
|
- *
|
4
|
|
- * This source code is licensed under the MIT license found in the
|
5
|
|
- * LICENSE file in the root directory of this source tree.
|
6
|
|
- *
|
7
|
|
- * @format
|
8
|
|
- * @flow
|
9
|
|
- * @providesModule WKWebView
|
10
|
|
- */
|
11
|
|
-
|
12
|
|
-import React from 'react';
|
13
|
|
-
|
14
|
|
-import { requireNativeComponent } from 'react-native';
|
15
|
|
-
|
16
|
|
-import type {DataDetectorTypes} from './WebViewTypes';
|
17
|
|
-
|
18
|
|
-const RNCWKWebView = requireNativeComponent('RNCWKWebView');
|
19
|
|
-
|
20
|
|
-type RNCWKWebViewProps = $ReadOnly<{|
|
21
|
|
- allowsInlineMediaPlayback?: ?boolean,
|
22
|
|
- mediaPlaybackRequiresUserAction?: ?boolean,
|
23
|
|
- dataDetectorTypes?:
|
24
|
|
- | ?DataDetectorTypes
|
25
|
|
- | $ReadOnlyArray<DataDetectorTypes>,
|
26
|
|
-|}>;
|
27
|
|
-
|
28
|
|
-class WKWebView extends React.Component<RNCWKWebViewProps> {
|
29
|
|
- componentWillReceiveProps(nextProps: RNCWKWebViewProps) {
|
30
|
|
- this.showRedboxOnPropChanges(nextProps, 'allowsInlineMediaPlayback');
|
31
|
|
- this.showRedboxOnPropChanges(nextProps, 'mediaPlaybackRequiresUserAction');
|
32
|
|
- this.showRedboxOnPropChanges(nextProps, 'dataDetectorTypes');
|
33
|
|
- }
|
34
|
|
-
|
35
|
|
- showRedboxOnPropChanges(nextProps: RNCWKWebViewProps, propName: string) {
|
36
|
|
- if (this.props[propName] !== nextProps[propName]) {
|
37
|
|
- console.error(`Changes to property ${propName} do nothing after the initial render.`);
|
38
|
|
- }
|
39
|
|
- }
|
40
|
|
-
|
41
|
|
- render() {
|
42
|
|
- return <RNCWKWebView {...this.props} />;
|
43
|
|
- }
|
44
|
|
-}
|
45
|
|
-
|
46
|
|
-module.exports = WKWebView;
|