React Native for Arcgis 地图开发 MapView 使用 (四)
对于地图调用
-
import { MapView } from '@haibalai/react-native-arcgis';
-
-
class MainMapView extends React.Component<any, any, any> {
-
-
-
render() {
-
return (
-
<View style={{flex: 1}} testID={'map_page'}>
-
<MapView mapId="baseMap" style={{flex: 1}} />
-
</View>
-
)
-
}
-
-
}
针对之前说的配置底图,可以支持切换
```javascript
import { MapManager } from '@haibalai/react-native-arcgis';
changeLayer(layerName: string) {
console.log(layerName);
// 选择地图类型
switch (layerName) {
case '天地图':
MapManager.switchBaseMap('baseMap', '天地图')
.then((r: any) => {
console.log('成功切换到天地图', r);
})
.catch((e: any) => {
console.log('失败切换到天地图', e);
https://xiaozhuanlan.com/topic/0824173659