forked from cnjon/react-native-pdf-view
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPDFView.ios.js
More file actions
46 lines (38 loc) · 1.01 KB
/
PDFView.ios.js
File metadata and controls
46 lines (38 loc) · 1.01 KB
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
'use strict';
import React, { Component } from 'react';
import { requireNativeComponent, View, PropTypes } from 'react-native';
class PDFView extends Component {
constructor(props) {
super(props);
this._onChange = this._onChange.bind(this);
}
setNativeProps(nativeProps) {
this._root.setNativeProps(nativeProps);
}
_onChange(event: Event) {
this.props.onLoadComplete &&
this.props.onLoadComplete(Number(event.nativeEvent.message));
}
render() {
return (
<PDFCustomView
ref={component => (this._root = component)}
{...this.props}
onChange={this._onChange}
/>
);
}
}
PDFView.propTypes = {
...View.propTypes,
src: PropTypes.string,
path: PropTypes.string,
pageNumber: PropTypes.number,
zoom: PropTypes.number,
onLoadComplete: PropTypes.func,
};
//var PDFCustomView = requireNativeComponent('RNPDFView', null);
var PDFCustomView = requireNativeComponent('RNPDFView', PDFView, {
nativeOnly: { onChange: true },
});
export default PDFView;