Commit e881cd01 authored by Qiu Xiang's avatar Qiu Xiang

去掉颜色代码 HUE_ 前缀

parent a43880e1
...@@ -78,10 +78,10 @@ class AMapMarker(context: ThemedReactContext) : ReactViewGroup(context) { ...@@ -78,10 +78,10 @@ class AMapMarker(context: ThemedReactContext) : ReactViewGroup(context) {
} }
fun setIcon(icon: String) { fun setIcon(icon: String) {
if (icon.startsWith("HUE_")) { bitmapDescriptor = COLORS[icon.toUpperCase()]?.let {
bitmapDescriptor = COLORS[icon]?.let { BitmapDescriptorFactory.defaultMarker(it) } BitmapDescriptorFactory.defaultMarker(it)
marker?.setIcon(bitmapDescriptor)
} }
marker?.setIcon(bitmapDescriptor)
} }
fun sendEvent(name: String, data: WritableMap) { fun sendEvent(name: String, data: WritableMap) {
...@@ -120,16 +120,16 @@ class AMapMarker(context: ThemedReactContext) : ReactViewGroup(context) { ...@@ -120,16 +120,16 @@ class AMapMarker(context: ThemedReactContext) : ReactViewGroup(context) {
companion object { companion object {
private val COLORS = mapOf( private val COLORS = mapOf(
"HUE_AZURE" to BitmapDescriptorFactory.HUE_AZURE, "AZURE" to BitmapDescriptorFactory.HUE_AZURE,
"HUE_BLUE" to BitmapDescriptorFactory.HUE_BLUE, "BLUE" to BitmapDescriptorFactory.HUE_BLUE,
"HUE_CYAN" to BitmapDescriptorFactory.HUE_CYAN, "CYAN" to BitmapDescriptorFactory.HUE_CYAN,
"HUE_GREEN" to BitmapDescriptorFactory.HUE_GREEN, "GREEN" to BitmapDescriptorFactory.HUE_GREEN,
"HUE_MAGENTA" to BitmapDescriptorFactory.HUE_MAGENTA, "MAGENTA" to BitmapDescriptorFactory.HUE_MAGENTA,
"HUE_ORANGE" to BitmapDescriptorFactory.HUE_ORANGE, "ORANGE" to BitmapDescriptorFactory.HUE_ORANGE,
"HUE_RED" to BitmapDescriptorFactory.HUE_RED, "RED" to BitmapDescriptorFactory.HUE_RED,
"HUE_ROSE" to BitmapDescriptorFactory.HUE_ROSE, "ROSE" to BitmapDescriptorFactory.HUE_ROSE,
"HUE_VIOLET" to BitmapDescriptorFactory.HUE_VIOLET, "VIOLET" to BitmapDescriptorFactory.HUE_VIOLET,
"HUE_YELLOW" to BitmapDescriptorFactory.HUE_YELLOW "YELLOW" to BitmapDescriptorFactory.HUE_YELLOW
) )
} }
} }
...@@ -39,7 +39,7 @@ export default class MarkerExample extends Component { ...@@ -39,7 +39,7 @@ export default class MarkerExample extends Component {
/> />
<Marker <Marker
selected selected
icon='HUE_RED' icon='red'
infoWindowWidth={100} infoWindowWidth={100}
coordinate={{ coordinate={{
latitude: 39.806901, latitude: 39.806901,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment