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);

posted @ 2022-04-26 15:02  haibalai  阅读(55)  评论(0编辑  收藏  举报