volga-volga / react-native-yamap

React Native Yandex Maps | Яндекс Карты | Yandex.MapKit implementation for react native | YandexMaps
144 stars 80 forks source link

findDriverRoutes не возвращает маршрут #241

Open VikDay opened 1 year ago

VikDay commented 1 year ago
const LATITUDE = 55.749, LONGITUDE = 37.524
const LATITUDE1 = 59.918072, LONGITUDE1 = 30.304908
const pointA = [55.749, 37.524]; // Москва
const pointB = [59.918072, 30.304908]; // Санкт-Петербург

let _BG = '#ed812b'

export default class MapUpDn5 extends React.Component<{}, State> {

  onMapLoaded = () => {
      this.map.current.findDrivingRoutes([{ lat: LATITUDE, lon: LATITUDE }, { lat: LATITUDE1, lon: LATITUDE1}], (RoutesFoundEvent) => alert(RoutesFoundEvent.nativeEvent.id))
  }
 render() {
      return (
         <View style={{ top: 100, width: width, height: height - statusbarHeight - systembarHeight - 60 - 46 - 44 - 1 }} >
            <YaMap
               ref={this.map} 
               rotateGesturesEnabled={false}
               onMapLoaded={this.onMapLoaded}
            >

               <Marker point={{ lat: LATITUDE, lon: LONGITUDE }} >
                  <View style={{ height: 40, width: 40, borderRadius: 20, borderWidth: 1, borderColor: _BG + '32', backgroundColor: _BG + '1E', overflow: 'hidden', alignItems: 'center', justifyContent: 'center' }}>
                     <View style={{ height: 20, width: 20, borderRadius: 10, borderWidth: 3, borderColor: 'white', backgroundColor: _BG, overflow: 'hidden' }} />
                  </View>
               </Marker>

               <Marker point={{ lat: LATITUDE1, lon: LONGITUDE1 }} >
                  <View style={{ height: 40, width: 40, borderRadius: 20, borderWidth: 1, borderColor: _BG + '32', backgroundColor: _BG + '1E', overflow: 'hidden', alignItems: 'center', justifyContent: 'center' }}>
                     <View style={{ height: 20, width: 20, borderRadius: 10, borderWidth: 3, borderColor: 'white', backgroundColor: _BG, overflow: 'hidden' }} />
                  </View>
               </Marker>

       </View>
    )
    }
}

Только начинаю работать с библитекой и вообще с react native. Как в текущем примере построить маршрут между точками с помощью findDrivingRoutes?