-
Notifications
You must be signed in to change notification settings - Fork 515
/
Copy pathMapPanel.js
127 lines (120 loc) · 3.28 KB
/
MapPanel.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
import React, { Component } from 'react';
import { StyleSheet, View, Dimensions, Image, Text, Animated, TouchableOpacity } from 'react-native';
import Interactable from 'react-native-interactable';
const Screen = {
width: Dimensions.get('window').width,
height: Dimensions.get('window').height - 75
}
export default class MapPanel extends Component {
constructor(props) {
super(props);
this._deltaY = new Animated.Value(Screen.height-100);
}
render() {
return (
<View style={styles.container}>
<Image style={styles.map} source={require('../../assets/map-bg.jpg')} />
<View style={styles.panelContainer} pointerEvents={'box-none'}>
<Animated.View
pointerEvents={'box-none'}
style={[styles.panelContainer, {
backgroundColor: 'black',
opacity: this._deltaY.interpolate({
inputRange: [0, Screen.height-100],
outputRange: [0.5, 0],
extrapolateRight: 'clamp'
})
}]} />
<Interactable.View
verticalOnly={true}
snapPoints={[{y: 40}, {y: Screen.height-300}, {y: Screen.height-100}]}
boundaries={{top: -300}}
initialPosition={{y: Screen.height-100}}
animatedValueY={this._deltaY}>
<View style={styles.panel}>
<View style={styles.panelHeader}>
<View style={styles.panelHandle} />
</View>
<Text style={styles.panelTitle}>San Francisco Airport</Text>
<Text style={styles.panelSubtitle}>International Airport - 40 miles away</Text>
<View style={styles.panelButton}>
<Text style={styles.panelButtonTitle}>Directions</Text>
</View>
<View style={styles.panelButton}>
<Text style={styles.panelButtonTitle}>Search Nearby</Text>
</View>
<Image style={styles.photo} source={require('../../assets/airport-photo.jpg')} />
</View>
</Interactable.View>
</View>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#efefef',
},
panelContainer: {
position: 'absolute',
top: 0,
bottom: 0,
left: 0,
right: 0
},
panel: {
height: Screen.height + 300,
padding: 20,
backgroundColor: '#f7f5eee8',
borderTopLeftRadius: 20,
borderTopRightRadius: 20,
shadowColor: 'black',
shadowOffset: {width: 0, height: 0},
shadowRadius: 5,
shadowOpacity: 0.4
},
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
},
panelButton: {
padding: 20,
borderRadius: 10,
backgroundColor: '#459FED',
alignItems: 'center',
marginVertical: 10
},
panelButtonTitle: {
fontSize: 17,
fontWeight: 'bold',
color: 'white'
},
photo: {
width: Screen.width-40,
height: 225,
marginTop: 30
},
map: {
height: Screen.height,
width: Screen.width
}
});