来自州的react-native-map marker图像源

时间:2018-05-02 09:35:18

标签: javascript android ios react-native react-native-maps

我有这样一个州:

    <TextBlock Grid.Row="0" Grid.Column="0" Text="ddk" />
<Button Grid.Row="1" Grid.Column="1" 
        Content="{Binding Description01.Header}"
        Command="{Binding YOURCOMMANDHERE}"
        CommandParameter="{YOURPARAMETER}" 
        Style="{DynamicResource LinkStyle}">
<TextBlock Grid.Row="1" Grid.Column="0" Text="dde" />
<Button Grid.Row="1" Grid.Column="1" 
        Content="{Binding Description11.Header}"
        Command="{Binding YOUROTHERCOMMANDHERE}"
        CommandParameter="{YOUROTHERPARAMETER}"
        Style="{DynamicResource LinkStyle}">

在markerIcon中我有不同的.png:

enter image description here

din标记我有另一个对象,其中显示不同的信息和交易者类别:

enter image description here

我在渲染中将我的标记定义为:

this.state = {
        width :  Dimensions.get('window').width,
        height :  Dimensions.get('window').height,
        initialPosition:  {
          latitiude: 48.866667,
          longitude: 2.333333,
          latitudeDelta:LATITUDE_DELTA,
          longitudeDelta: LONGITUDE_DELTA
        },
        markerIcons: {},
        markers: [],
    };

我希望我的图片来源与我的交易者的类别相匹配 两个对象中的名称相同,但我如何在我的标记中执行此操作? 我怎样才能设置我的标记的图像源?

感谢您的帮助;)

2 个答案:

答案 0 :(得分:3)

您可以这种方式使用自定义图标 a busy cat

答案 1 :(得分:0)

您可以像这样访问marker icon的对象

假设您的标记图标对象存储在MarkerIcon

this.state.markerIcons[this.state.markers[marker].category]

这将为您提供相同

的对象{icon: '', label: ''}