All Projects → brh55 → React Native Open Maps

brh55 / React Native Open Maps

Licence: mit
🗺 A simple react-native library to perform cross-platform map actions (Google or Apple Maps)

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Native Open Maps

React Native Maps
React Native Mapview component for iOS + Android
Stars: ✭ 12,795 (+6564.06%)
Mutual labels:  google-maps, maps
Airbnb Android Google Map View
This is a sample Android Application which has Google Map view similar to what AirBnb Android Application. Moving Markers like Uber/Ola. Custom Google Search for places. Recycler view with Animations added.
Stars: ✭ 175 (-8.85%)
Mutual labels:  google-maps, maps
Leku
🌍 Map location picker component for Android. Based on Google Maps. An alternative to Google Place Picker.
Stars: ✭ 612 (+218.75%)
Mutual labels:  google-maps, maps
Google Maps
Google Maps Web Services API wrapper for .NET
Stars: ✭ 171 (-10.94%)
Mutual labels:  google-maps, maps
Eon Map
Realtime maps with PubNub and MapBox.
Stars: ✭ 121 (-36.98%)
Mutual labels:  google-maps, maps
Jquery Store Locator Plugin
A store locator plugin using Google Maps API version 3
Stars: ✭ 471 (+145.31%)
Mutual labels:  google-maps, maps
Sketch Map Generator
Sketch plugin to fill a shape with a map generated from a given location using Google Maps and Mapbox
Stars: ✭ 824 (+329.17%)
Mutual labels:  google-maps, maps
carto-react-template
CARTO for React. The best way to develop Location Intelligence (LI) Apps usign CARTO platform and React
Stars: ✭ 24 (-87.5%)
Mutual labels:  maps, google-maps
Making Maps With React
🌐 Example React components for React-Leaflet, Pigeon Maps, React MapGL and more
Stars: ✭ 66 (-65.62%)
Mutual labels:  google-maps, maps
Curve Fit
Curve-Fit is an Android library for drawing curves on Google Maps
Stars: ✭ 63 (-67.19%)
Mutual labels:  google-maps, maps
polylineencoder
A C++ implementation of Google Encoded Polyline Algorithm Format (encoder/decoder)
Stars: ✭ 15 (-92.19%)
Mutual labels:  maps, google-maps
Benmaps.fr
Web maps that don't track you.
Stars: ✭ 147 (-23.44%)
Mutual labels:  google-maps, maps
EasyWayLocation
This library contain all utils related to google location. like, getting lat or long, Address and Location Setting dialog, many more...
Stars: ✭ 142 (-26.04%)
Mutual labels:  maps, google-maps
Flask Googlemaps
Easy way to add GoogleMaps to Flask applications. maintainer: @RiverFount
Stars: ✭ 550 (+186.46%)
Mutual labels:  google-maps, maps
google-maps-at-88-mph
Google Maps keeps old satellite imagery around for a while – this tool collects what's available for a user-specified region in the form of a GIF.
Stars: ✭ 93 (-51.56%)
Mutual labels:  maps, google-maps
Gmaps
Google maps for Jupyter notebooks
Stars: ✭ 705 (+267.19%)
Mutual labels:  google-maps, maps
carto-react
CARTO for React packages
Stars: ✭ 17 (-91.15%)
Mutual labels:  maps, google-maps
SimplePlacePicker
Android place picker module for searching and selecting a location on google maps
Stars: ✭ 42 (-78.12%)
Mutual labels:  maps, google-maps
Maplace.js
A Google Maps Javascript plugin for jQuery.
Stars: ✭ 1,021 (+431.77%)
Mutual labels:  google-maps, maps
Placepicker
Free Android Map Place Picker alternative using Geocoder instead of Google APIs
Stars: ✭ 126 (-34.37%)
Mutual labels:  google-maps, maps

react-native-open-maps

Travis David npm

🗺 A simple cross-platform library to help perform map actions to the corresponding device's map (Google or Apple Maps)

react-native-open-maps works by creating a deep link for either Apple maps or Google maps that can be used to open up the relevant map application. In order to maximize compatibility some platform specific parameters are omitted, but simplifies development efforts and ensures a smooth user experience.

Features

  • ✅ Open the map coordinates immediately
  • ✅ Create a delayed invoked function that will open the map
  • ✅ Create a string of the map link
  • Cross-compatible properties among both map applications

Demo Gif

Usage

  1. Install the repository
    $ npm install --save react-native-open-maps
    
  2. Add an import to the top of your file
    import openMap from 'react-native-open-maps';
    
  3. Put it all together
    import React, { Component } from 'react';
    import { Button } from 'react-native';
    import openMap from 'react-native-open-maps';
    
    export default class App extends Component {
      _goToYosemite() {
        openMap({ latitude: 37.865101, longitude: -119.538330 });
      }
      
      render() {
        return (
          <Button
            color={'#bdc3c7'}
            onPress={this._goToYosemite}
            title="Click To Open Maps 🗺" />
        );
      }
    }
    
  4. BONUS: You can also create delayed functions for more of that 1 - 1 mapping flavor 🍦.
import { createOpenLink } from 'react-native-open-maps';

const yosemite = { latitude: 37.865101, longitude: -119.538330 };
const openYosemite = createOpenLink(yosemite);
const openYosemiteZoomedOut = createOpenLink({ ...yosemite, zoom: 30 });

const facebookHQ = { latitude: 37.4847, longitude: 122.1477 };
const openFacebookHQ = createOpenLink(facebookHQ);

// Condensed for Readability...
    render() {
        return (
          <Button
            color={'#bdc3c7'}
            onPress={openYosemite}
            title="Go to Yosemite 🏔" />
          <Button
            color={'#bdc3c7'}
            onPress={openFacebookHQ}
            title="Go to Facebook HQ 🕋" />
        );

API

default function open(options)

react-native-open-maps immediately opens the map of the coordinates and the settings

{ createOpenLink(options) }

Creates a delayed invoked function to open the map. This is useful for binding functions to onPress() in a succinct manner. Think of it like ... function openToMe() { open(coordinates) }

{ createMapLink(options) }

Creates the raw link for the map.

options

🔑 Italicize indicates optional

Properties Type Description Example
latitude number The latitude 37.865101
longitude number The longitude -119.538330
zoom number The zoom level, only works with latitude and longitude 18
Default: 15
provider string
[google,apple]
If no provider set, it will determine according to Platform.OS apple
query string Will act according to the map used. Refer to query property "Yosemite Trail"
travelType enumeration : [drive, walk,public_transport] Use this parameter in conjunction with start and end to determine transportation type. Default is drive "drive"
start string that geolocation can understand The start location that can be interpreted as a geolocation, omit if you want to use current location / "My Location". See Apple and Google docs for more details on how to define geolocations. "New York City, New York, NY"
end string that geolocation can understand. The end location that can be interpreted as a geolocation. See Apple and Google docs for more details on how to define geolocations. "SOHO, New York, NY"
navigate_mode string
[preview,navigate]
Determines whether map should open in preview mode or in navigate mode (with turn-by-turn navigation).
This parameter only works in conjunction with end. Platform map uses current location as start parameter
"navigate"
default: "preview"

Note: Combining query with latitude and longitude will override the query parameter.

Map Actions

To perform certain map actions refer these necessary parameters

  • Setting Directions: end, [ start, travelType ]
  • Display Map Around Coordinates: latitude + longitude, [ zoom ]
  • Query Map For Location: query
Query Property

The query behavior differs per platform:

  • Apple Maps: If latitude and longitude is provided, this will place a marker with the query as a label. If no latitude or longitude is provided, it will center map to closest query match.
  • Google Maps: Will override latitude and longitude if present and center map to closest query match. Without a query, you may however use <latitude>,<longitude> as a string value in the query to have a unnamed marker on the map.

License

MIT © Brandon Him

Shameless Plug 🔌

If you like this repository, check out my other react-native projects or follow me for other open-source projects:

  • react-native-masonry: A pure JS react-native component to render a masonry~ish layout for images with support for dynamic columns, progressive image loading, device rotation, on-press handlers, and headers/captions.
  • react-native-hero: A super duper easy hero unit react-native component with support for dynamic image, dynamic sizing, color overlays, and more
  • rn-component-cookbook: A open-source cookbook with recipes for handling everyday issues when building robust, modular react-native components
  • generator-rnc: A yeoman generator to scaffold a ready-to-go, open-source react-native component (Jest, Package dependencies, Travis, etc)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].