-
Notifications
You must be signed in to change notification settings - Fork 7
/
web.js
50 lines (44 loc) · 1.04 KB
/
web.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import React, { Component } from 'react';
import {
NativeModules,
UIManager,
findNodeHandle,
requireNativeComponent,
View,
} from 'react-native';
import PropTypes from 'prop-types';
const { RNX5 } = NativeModules;
const RCT_X5_VIEW_REF = 'RCTX5View';
const iface = {
name: RCT_X5_VIEW_REF,
propTypes: {
...View.propTypes,
enableJavaScript: PropTypes.bool,
enableJavaScriptCanOpenWindowsAutomatically: PropTypes.bool,
enableWideViewPort: PropTypes.bool,
},
};
const RCTX5View = requireNativeComponent('RCTX5View', iface);
export default class X5View extends Component {
static defaultProps = {
enableJavaScript: false,
enableJavaScriptCanOpenWindowsAutomatically: false,
enableWideViewPort: false,
};
load(url) {
UIManager.dispatchViewManagerCommand(
findNodeHandle(this.refs[RCT_X5_VIEW_REF]),
UIManager.RCTX5View.Commands.load,
[url]
)
}
render() {
const { props } = this;
return (
<RCTX5View
{...props}
ref={RCT_X5_VIEW_REF}
/>
);
}
}