UNPKG

react-native-anavi

Version:

react native amap navigation component, Android + iOS

112 lines (92 loc) 3.32 kB
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } import * as React from 'react'; import { bool, number, oneOf } from 'prop-types'; import { requireNativeComponent, ViewPropTypes, processColor, Image } from 'react-native'; import { LatLngPropType, LocationStylePropType, RegionPropType, mapEventsPropType } from '../prop-types'; import Component from './component'; import Marker from './marker'; import Polyline from './polyline'; import Polygon from './polygon'; import Circle from './circle'; import HeatMap from './heat-map'; import MultiPoint from './multi-point'; import TexturePolyline from './texture-polyline'; import { DrivePath, RidePath, WalkPath } from '../route-view'; const events = ['onClick', 'onLongClick', 'onStatusChange', 'onStatusChangeComplete', 'onLocation', 'onAnimateCancel', 'onAnimateFinished']; /** * @ignore */ export default class MapView extends Component { constructor(...args) { super(...args); _defineProperty(this, "nativeComponent", 'AMapView'); } /** * 设置地图状态(坐标、缩放级别、倾斜度、旋转角度),支持动画过度 * * @param status * @param duration */ setStatus(status, duration = 0) { this.call('setStatus', [status, duration]); } render() { const locationStyle = { ...this.props.locationStyle }; for (let k in locationStyle) { if (k === 'image') { locationStyle[k] = Image.resolveAssetSource(locationStyle[k]); } else if (k.indexOf('Color') > -1) { locationStyle[k] = processColor(locationStyle[k]); } } const props = { ...this.props, ...this.handlers(events), locationStyle }; return /*#__PURE__*/React.createElement(AMapView, props); } } // @ts-ignore _defineProperty(MapView, "propTypes", { ...ViewPropTypes, ...mapEventsPropType(events), wheather: number, mapType: number, locationEnabled: bool, userTrackingMode: oneOf(['none', 'follow', 'followWithHeading']), locationInterval: number, locationStyle: LocationStylePropType, distanceFilter: number, showsIndoorMap: bool, showsIndoorSwitch: bool, showsBuildings: bool, showsLabels: bool, showsCompass: bool, showsZoomControls: bool, showsScale: bool, showsLocationButton: bool, showsTraffic: bool, maxZoomLevel: number, minZoomLevel: number, zoomLevel: number, center: LatLngPropType, region: RegionPropType, limitRegion: RegionPropType, tilt: number, rotation: number, zoomEnabled: bool, scrollEnabled: bool, rotateEnabled: bool, tiltEnabled: bool }); _defineProperty(MapView, "Marker", Marker); _defineProperty(MapView, "Polyline", Polyline); _defineProperty(MapView, "Polygon", Polygon); _defineProperty(MapView, "Circle", Circle); _defineProperty(MapView, "HeatMap", HeatMap); _defineProperty(MapView, "MultiPoint", MultiPoint); _defineProperty(MapView, "DrivePath", DrivePath); _defineProperty(MapView, "RidePath", RidePath); _defineProperty(MapView, "WalkPath", WalkPath); _defineProperty(MapView, "TexturePolyline", TexturePolyline); const AMapView = requireNativeComponent('AMapView', MapView); //# sourceMappingURL=index.js.map