-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
35 lines (35 loc) · 1.23 KB
/
index.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
import React from 'react'
import {View} from 'react-native'
import MapboxGL from '@mapbox/react-native-mapbox-gl'
export default class extends React.Component {
render(){
const rasterSourceProps = {
id: 'stamenWatercolorSource',
url: 'http://www.google.cn/maps/vt?lyrs=s@810&gl=cn&x={x}&y={y}&z={z}',
tileSize: 256,
};
return (
<MapboxGL.MapView
ref={(c) => (this.map = c)}
style={{flex:1}}
animated={true}
localizeLabels={true}
showUserLocation={true}
logoEnabled={false}
rotateEnabled={false}
attributionEnabled={false}
compassEnabled={false}
>
{/*瓦片图层(资源来自google.cn)*/}
<MapboxGL.RasterSource {...rasterSourceProps}>
<MapboxGL.RasterLayer
layerIndex={100}
id="stamenWatercolorLayer"
sourceID="stamenWatercolorSource"
style={{ rasterOpacity: 1 }}
/>
</MapboxGL.RasterSource>
</MapboxGL.MapView>
)
}
}