-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
91 lines (80 loc) · 1.99 KB
/
App.tsx
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import React, { Component } from 'react';
import {
StyleSheet,
useColorScheme,
Dimensions,
// SafeAreaView,
// ScrollView,
// StatusBar,
// Text,
View,
// Platform
} from 'react-native';
import Pdf from 'react-native-pdf';
class PdfScreen extends Component {
static navigationOptions = {
title: 'PDF',
};
render() {
const source = {uri:'bundle-assets://pdf.pdf', cache:true };
return (
<Pdf
trustAllCerts={false}
onLoadComplete={()=>{
// can add code here for analytics
}}
fitPolicy={1}
maxScale={10}
source={source}
style={styles.pdf}/>
)
}
}
function App(): JSX.Element {
const isDarkMode = useColorScheme() === 'dark';
return (
<>
<View style={styles.container}>
<PdfScreen/>
</View>
</>
);
}
const iitr = true // !TODO: Figure out a way to pass this through a parameter while running the app. Well, it would get fixed soon anyways if I am able to implement the save zoom level feature.
const styles = StyleSheet.create({
sectionContainer: {
marginTop: 32,
paddingHorizontal: 24,
},
sectionTitle: {
fontSize: 24,
fontWeight: '600',
},
sectionDescription: {
marginTop: 8,
fontSize: 18,
fontWeight: '400',
},
highlight: {
fontWeight: '700',
},
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
pdf: {
flex: 1,
width: Dimensions.get('window').width,
transform: [{translateX: 0}]
// transform: [{scale: 2}]//, {translateX: Dimensions.get('window').width/8}, {translateY: Dimensions.get('window').height/32}]
// Used this for reference: https://reactnative.dev/docs/transforms
// however using this (transform) does not let me zoom out properly. It seems like it is a react-native-pdf bug
},
});
// Special default zoom configuration for IITR E-ID
if(iitr){
styles.pdf.width = Dimensions.get('window').width*3
styles.pdf.transform = [{translateX: 150}]
}
export default App;