npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-maps-routes

v1.0.3

Published

Route component for react-native-maps

Downloads

411

Readme

react-native-maps-routes

npm Version License GitHub Last Commit

Component for the react-native-maps library that lets you draw a route between two coordinates. This library uses the Google Maps Routes API to compute the route.

If you still want to use the Google Maps Directions API, please use the following library: react-native-maps-directions.

Installation

yarn add react-native-maps-routes
or
npm install react-native-maps-routes

Basic Usage

Import MapViewRoute and render it as a child of a MapView component. The mandatory MapViewRoute props are:

  • origin: The origin location to start routing from
  • destination: The destination location to start routing to
  • apiKey: Your Google Maps Routes API Key (request one here; if you're using an existing Google Maps API Key make sure you've enabled the Google Maps Routes API for that key using the Google API Console).
import MapViewRoute from 'react-native-maps-routes';

const origin = { latitude: 37.332280, longitude: -122.010980 };
const destination = { latitude: 37.423199, longitude: -122.084068 };
const GOOGLE_MAPS_APIKEY = '…';

<MapView initialRegion={…}>
  <MapViewRoute
    origin={origin}
    destination={destination}
    apiKey={GOOGLE_MAPS_APIKEY}
  />
</MapView>

Component API

Props

| Prop | Type | Default | Note | |---------------|----------|------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | origin | LatLng | (Required) | The origin location to start routing from. | | destination | LatLng | (Required) | The destination location to start routing to. | | apikey | String | (Required) | Your Google Maps API Key (request one here; if you're using an existing Google Maps API Key make sure you've enabled the Google Maps Routes API for that key using the Google API Console). | | strokeColor | String | #000 | The stroke colors to use for the path (iOS only). Must be the same length as coordinates. | | strokeWidth | Number | 6 | The limiting value that helps avoid spikes at junctions between connected line segments. The miter limit helps you avoid spikes in paths that use the miter lineJoin style. If the ratio of the miter length—that is, the diagonal length of the miter join—to the line thickness exceeds the miter limit, the joint is converted to a bevel join. The default miter limit is 10, which results in the conversion of miters whose angle at the joint is less than 11 degrees. | | lineCap | String | round | The line cap style to apply to the open ends of the path. Possible values are butt, round or square. Note: lineCap is not yet supported for GoogleMaps provider on iOS. | | lineJoin | String | round | The line join style to apply to corners of the path. Possible values are miter, round or bevel. | | mode | String | WALK | Which transportation mode to use when calculating route. Allowed values are "DRIVE", "BICYCLE", "TWO_WHEELER", "WALK". | |

Types

type LatLng {
  latitude: Number,
  longitude: Number,
}

Events/Callbacks

| Event Name | Returns | Notes | |------------|-------------------------------------------|--------------------------------------------------------------------| | onStart | { origin: string; destination: string } | Callback that is called when the routing has started. | | onReady | LatLng[] | Callback that is called when the routing has succesfully finished. | | onError | any | Callback that is called in case the routing has failed. |