57 lines
1.4 KiB
JavaScript
57 lines
1.4 KiB
JavaScript
import React from 'react';
|
|
import {View, StyleSheet, Dimensions} from 'react-native';
|
|
|
|
import Pdf from 'react-native-pdf';
|
|
import {FileSystem} from 'react-native-unimodules';
|
|
|
|
class PDFScreen extends React.Component {
|
|
render() {
|
|
const {uuid} = this.props.route.params;
|
|
const source = {
|
|
uri: FileSystem.documentDirectory + uuid + '.pdf',
|
|
cache: false,
|
|
};
|
|
return (
|
|
<View style={styles.container}>
|
|
<Pdf
|
|
source={source}
|
|
onLoadComplete={(numberOfPages, filePath) => {
|
|
console.log(`number of pages: ${numberOfPages}`);
|
|
}}
|
|
onPageChanged={(page, numberOfPages) => {
|
|
console.log(`current page: ${page}`);
|
|
}}
|
|
onError={error => {
|
|
console.log(error);
|
|
}}
|
|
onPressLink={uri => {
|
|
console.log(`Link presse: ${uri}`);
|
|
}}
|
|
style={styles.pdf}
|
|
/>
|
|
</View>
|
|
);
|
|
}
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
container: {
|
|
flex: 1,
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
},
|
|
text: {
|
|
height: 40,
|
|
width: 300,
|
|
borderColor: 'grey',
|
|
borderWidth: 1,
|
|
marginBottom: 20,
|
|
},
|
|
pdf: {
|
|
flex: 1,
|
|
width: Dimensions.get('window').width,
|
|
height: Dimensions.get('window').height,
|
|
},
|
|
});
|
|
|
|
export default PDFScreen;
|