Commit b9afcfbb authored by Qiu Xiang's avatar Qiu Xiang

添加 marker 自定义颜色方案说明

parent 57df96f8
...@@ -26,7 +26,11 @@ export default class Marker extends Component { ...@@ -26,7 +26,11 @@ export default class Marker extends Component {
* 自定义图标 * 自定义图标
* *
* 可以是回调函数返回的自定义 View,需要注意的是, * 可以是回调函数返回的自定义 View,需要注意的是,
* Root View 必须是 Overlay,且需设置 style width * Root View 必须是 Overlay,且需设置 style width。
*
* 内置的颜色有限,如需真正的自定义颜色,
* 建议使用自定义 View 引用 Image,如此,
* 任何颜色都可以通过 tintColor 进行设置。
*/ */
icon: PropTypes.oneOfType([ icon: PropTypes.oneOfType([
Platform.select({ Platform.select({
......
example/images/marker.png

10.2 KB | W: | H:

example/images/marker.png

683 Bytes | W: | H:

example/images/marker.png
example/images/marker.png
example/images/marker.png
example/images/marker.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -52,7 +52,7 @@ export default class MarkerExample extends Component { ...@@ -52,7 +52,7 @@ export default class MarkerExample extends Component {
<Marker <Marker
icon={() => icon={() =>
<View style={styles.customIcon}> <View style={styles.customIcon}>
<Image style={styles.customIcon} source={require('../../images/marker.png')}/> <Image style={styles.customIcon} source={require('../../images/flag.png')}/>
</View> </View>
} }
title='自定义图片' title='自定义图片'
...@@ -62,6 +62,20 @@ export default class MarkerExample extends Component { ...@@ -62,6 +62,20 @@ export default class MarkerExample extends Component {
longitude: 116.397972, longitude: 116.397972,
}} }}
/> />
<Marker
icon={() =>
<View style={styles.customIcon}>
<Image
style={[styles.customIcon, {tintColor: '#e91e63'}]}
source={require('../../images/marker.png')}/>
</View>
}
title='自定义颜色'
coordinate={{
latitude: 39.806901,
longitude: 116.457972,
}}
/>
<Marker <Marker
title='Custom View Marker' title='Custom View Marker'
icon={() => icon={() =>
......
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