如果两个位置点超过了当前地图的可视范围,会显示异常
Created by: RaySaii
render() {
return <MapView style={StyleSheet.absoluteFill}>
<Marker
active
draggable
title={'一个可拖拽的标记 ' + this.state.time.toLocaleTimeString()}
onDragEnd={this._onDragEvent}
onInfoWindowPress={this._onInfoWindowPress}
coordinate={this._coordinates[0]}
/>
<Marker
icon='green'
onInfoWindowPress={this._onCustomInfoWindowPress}
coordinate={this._coordinates[1]}>
<TouchableOpacity activeOpacity={0.9} onPress={this._onCustomInfoWindowPress}>
<View style={styles.customInfoWindow}>
<Text>Custom View InfoWindow</Text>
</View>
</TouchableOpacity>
</Marker>
<Marker
icon={() =>
<View style={styles.customIcon}>
<Image style={styles.customIcon} />
</View>
}
title='自定义图片'
description="Sometimes you'll have some special properties that you need to expose for the native component, but don't actually want them as part of the API for the associated React component."
coordinate={this._coordinates[2]}
/>
<Marker
title='自定义标记'
icon={() =>
<View style={styles.customMarker}>
<Text style={styles.markerText}>{this.state.time.toLocaleTimeString()}</Text>
</View>
}
coordinate={{latitude:30.182159,longitude:120.139843}}
/>
</MapView>
}