This repository was archived by the owner on Apr 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmap.ios.js
More file actions
105 lines (82 loc) · 1.77 KB
/
map.ios.js
File metadata and controls
105 lines (82 loc) · 1.77 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
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
'use strict';
var React = require('react-native');
var foundation = require('react-native-foundation');
var Dimensions = require('Dimensions');
var {width, height} = Dimensions.get('window');
var TimerMixin = require('react-timer-mixin');
var {
StyleSheet,
View,
Text,
Component,
MapView,
AlertIOS,
TouchableOpacity,
VibrationIOS,
ScrollView
} = React;
var styles = StyleSheet.create({
background: {
flex: 1,
justifyContent: 'center',
},
map: {
flex: 1
},
body: {
fontSize: 16
},
headline: {
fontSize: 20
},
container: {
flex: 1,
left: 0, // https://github.com/facebook/react-native/issues/1332
backgroundColor: 'white'
},
});
var MapScreen = React.createClass({
mixins: [TimerMixin],
getInitialState: function() {
return {
mapRegion: {
latitude: 40.725992,
longitude: -73.995707,
latitudeDelta: .01,
longitudeDelta: .01
},
annotations: [{
latitude: 40.725992,
longitude: -73.995707,
title: "Meetup HQ",
subtitle: "16 people already there"
}]
};
},
componentDidMount: function() {
// delay map display
this.setTimeout(function() {
this.setState({showMap: true});
}.bind(this), 400);
},
renderMap: function() {
if (this.state.showMap) {
return (
<MapView region={this.state.mapRegion} style={styles.map}
annotations={this.state.annotations}/>
);
} else {
return (
<View style={[styles.map, {backgroundColor: '#cccccc'}]} />
);
}
},
render: function() {
return (
<View style={styles.container}>
{this.renderMap()}
</View>
);
}
});
module.exports = MapScreen;