-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSummarySheet.js
102 lines (97 loc) · 2.08 KB
/
SummarySheet.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import React from 'react';
import { Image, StyleSheet, Text, TouchableWithoutFeedback, View } from 'react-native';
import BottomSheet from 'reanimated-bottom-sheet';
const styles = StyleSheet.create({
container: {
backgroundColor: '#F5FCFF',
flex: 1,
zIndex: 3,
},
panelContainer: {
// position: 'absolute',
// top: 0,
// bottom: 0,
// left: 0,
// right: 0,
},
panel: {
height: 600,
padding: 20,
backgroundColor: '#ffffff',
},
header: {
backgroundColor: '#ffffff',
shadowColor: '#000000',
paddingTop: 20,
borderTopLeftRadius: 20,
borderTopRightRadius: 20,
},
panelHeader: {
alignItems: 'center',
},
panelHandle: {
width: 40,
height: 8,
borderRadius: 4,
backgroundColor: '#00000040',
marginBottom: 10,
},
panelTitle: {
fontSize: 27,
height: 35,
},
panelSubtitle: {
fontSize: 14,
color: 'gray',
height: 30,
marginBottom: 10,
flexWrap: 'wrap',
flex: 0.8,
},
panelButton: {
padding: 20,
borderRadius: 10,
backgroundColor: '#318bfb',
alignItems: 'center',
marginVertical: 10,
},
panelButtonTitle: {
fontSize: 17,
fontWeight: 'bold',
color: 'white',
},
});
function SummarySheet({ title, txt }) {
const renderContent = () => {
return (
<View style={styles.panel}>
<Text style={styles.panelTitle}>{title}</Text>
<Text style={styles.panelSubtitle}>
{`${txt} grams of CO2 (or CO2 equivalent) emitted during transportation ${title} on that route`}
</Text>
</View>
);
};
const renderHeader = () => {
return (
<View style={styles.header}>
<View style={styles.panelHeader}>
<View style={styles.panelHandle} />
</View>
</View>
);
};
const bs = React.createRef();
return (
<View style={styles.container}>
<BottomSheet
ref={bs}
snapPoints={[250, 50, 50]}
renderContent={renderContent}
renderHeader={renderHeader}
initialSnap={0}
/>
</View>
);
}
export default SummarySheet;