-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ios.js
55 lines (51 loc) · 1.2 KB
/
index.ios.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
'use strict';
var React = require('react-native');
var Mapbox = require('react-native-mapbox-gl');
var mapRef = 'OpenStreetMap';
var {
AppRegistry,
StyleSheet,
View,
Text,
StatusBar
} = React;
var map = React.createClass({
mixins: [Mapbox.Mixin],
getInitialState() {
return {
center: {
latitude: 47.38,
longitude: 8.54
},
zoom: 13
};
},
render: function() {
StatusBar.setHidden(true);
return (
<View style={styles.container}>
<Mapbox
style={styles.container}
direction={0}
rotateEnabled={true}
scrollEnabled={true}
zoomEnabled={true}
showsUserLocation={true}
ref={mapRef}
accessToken={'your-mapbox.com-access-token'}
styleURL={'https://raw.githubusercontent.com/osm2vectortiles/mapbox-gl-styles/master/styles/streets-v9-cdn.json'}
centerCoordinate={this.state.center}
zoomLevel={this.state.zoom}
logoIsHidden={true}
attributionButtonIsHidden={true}
/>
</View>
);
}
});
const styles = StyleSheet.create({
container: {
flex: 1
}
});
AppRegistry.registerComponent('map', () => map);