forked from Pushwoosh/pushwoosh-react-native-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInlineInApp.js
71 lines (61 loc) · 1.56 KB
/
InlineInApp.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import PropTypes from 'prop-types';
import React from 'react';
import {requireNativeComponent} from 'react-native';
class InlineInAppView extends React.Component {
_onLoaded = (event) => {
if (!this.props.onLoaded) {
return;
}
// process raw event...
this.props.onLoaded(event.nativeEvent);
}
_onClosed = (event) => {
if (!this.props.onClosed) {
return;
}
// process raw event...
this.props.onClosed(event.nativeEvent);
}
_onSizeChanged = (event) => {
if (!this.props.onSizeChanged) {
return;
}
// process raw event...
this.props.onSizeChanged(event.nativeEvent);
}
render() {
return (
<PWInlineInAppView
{...this.props}
onLoaded = {this._onLoaded}
onClosed = {this._onClosed}
onSizeChanged = {this._onSizeChanged}
/>
);
}
}
InlineInAppView.propTypes = {
/**
* Value of the identifier property must be equal to the
* identifier attribute value of the in-app message you've
* created in Pushwoosh Control Panel
*/
identifier: PropTypes.string,
/**
* This event is called to notify you that an inline in-app
* was loaded and has been added to the view
*/
onLoaded: PropTypes.func,
/**
* This event is called to notify you that an inline in-app
* view has been closed by the user
*/
onClosed: PropTypes.func,
/**
* This event is called to notify you that an inline in-app
* view size has been changed
*/
onSizeChanged: PropTypes.func,
};
var PWInlineInAppView = requireNativeComponent('PWInlineInAppView', InlineInAppView)
export default InlineInAppView