-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwaitprep.js
More file actions
67 lines (58 loc) · 1.64 KB
/
waitprep.js
File metadata and controls
67 lines (58 loc) · 1.64 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
'use strict';
import React, { Component } from 'react';
import { Text, Linking,View,ToastAndroid, TouchableOpacity} from 'react-native';
import { withNavigation } from 'react-navigation';
import {Button} from 'react-native-elements'
class ScanScreen extends Component {
state = {
data:""
}
postit = () =>{
fetch('http://34.93.231.96:5000/sendReportToDB', {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({pid:"hello123"})
})
.then((response) => response.json())
.then((responseJson) => {
this.setState({text:(responseJson.pdf_url).toString()})})
.catch((error) => {
console.error(error);
});
}
static navigationOptions = () => ({
headerStyle: {
backgroundColor: '#2B56BE',
elevation: 0,
},
headerTintColor: '#000',
headerTitleStyle: {
fontWeight: 'bold',
alignItems: 'center',
fontSize: 22,
},
headerTitle: (
<Text style={{color:'#fff',fontSize:26}}> Active Session</Text>
),
headerLeft: (
<Text> </Text>
),
});
render() {
return (
<View style={{width:350,alignSelf:'center'}}>
<Text>Waiting for Doctor's Prescription...{'\n'}</Text>
<Button title="Get Electronic Presciption" onPress={()=>{
this.postit()
Linking.openURL(this.state.text).catch((err) => console.error('An error occurred', err));
}}></Button>
<Text></Text>
<Text>{this.state.text}</Text>
</View>
);
}
}
export default withNavigation(ScanScreen)