-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
56 lines (49 loc) · 1.25 KB
/
index.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
51
52
53
54
55
56
import PropTypes from "prop-types";
import React from "react";
import { requireNativeComponent, View } from "react-native";
class WebViewWithRefreshView extends React.Component {
_onUrlMatch = event => {
console.log(event.nativeEvent);
if (!this.props.onUrlMatch) {
return;
}
this.props.onUrlMatch(event.nativeEvent);
};
_onStartLoad = event => {
console.log(event.nativeEvent);
if (!this.props.onStartLoad) {
return;
}
this.props.onStartLoad(event.nativeEvent);
};
_onFinishLoad = event => {
console.log(event.nativeEvent);
if (!this.props.onFinishLoad) {
return;
}
this.props.onFinishLoad(event.nativeEvent);
};
render() {
return (
<WebViewWithRefresh
{...this.props}
onUrlMatch={this._onUrlMatch}
onStartLoad={this._onStartLoad}
onFinishLoad={this._onFinishLoad}
/>
);
}
}
WebViewWithRefreshView.propTypes = {
url: PropTypes.string,
matchCondition: PropTypes.string,
onUrlMatch: PropTypes.func,
onStartLoad: PropTypes.func,
onFinishLoad: PropTypes.func,
...View.propTypes
};
const WebViewWithRefresh = requireNativeComponent(
"WebViewWithRefresh",
WebViewWithRefreshView
);
module.exports = WebViewWithRefreshView;