реагировать родная карта полилинии не показывает - PullRequest
0 голосов
/ 21 января 2019

Это мой код.


<View style={styles.map}>
        <MapView
          style={styles.map}
          initialRegion={this.state.region}
          onRegionChangeComplete={this.onRegionChange}
        />
        {
          this.state.allow_set_location ?
            <View style={styles.markerFixed}>
              <Image style={styles.marker} source={marker} />
            </View> : null
        }

        <Polyline
          coordinates={this.state.route_data}
          strokeWidth={1}
          strokeColor="red"
          fillColor="rgba(255,0,0,0.5)"
        />
      </View>

Я не могу получить полилинию. мои данные_путешествия - это массив объектов, например [{широта: данные, долгота: данные} .....]

1 Ответ

0 голосов
/ 21 января 2019

Polyline следует обернуть компонентом MapView, а не рядом.

       <View style={styles.map}>
        <MapView
          style={styles.map}
          initialRegion={this.state.region}
          onRegionChangeComplete={this.onRegionChange}
        >
          <Polyline
            coordinates={this.state.route_data}
            strokeWidth={1}
            strokeColor="red"
            fillColor="rgba(255,0,0,0.5)"
          />
       </MapView>
      </View>
...