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

@mapbox/store-locator-react-native

v0.0.1

Published

A plug-and-play React Native app that cuts down on the set-up and development time needed to add a Store Locator into your app. Use our starter themes and features as a plug-and-play solution, or further customize your Store Locator with our flexible buil

Downloads

10

Readme

Mapbox React Native Store Locator Kit

The React Native Locator Kit is a downloadable project for you to add beautiful plug-and-play Store Locators to your React Native applications. Use the Kit to allow your users to find and browse store locations, view additional info for each store, and preview the distance and route to the store. Not building for a store owner or a business? You can use this project to locate anything from bike share hubs to ATMs to your neighborhood parks.

Included in the Kit:

  • Source files for the app
  • Five UI themes
  • A sample dataset in the form of a GeoJSON file
  • Code for retrieving directions to store locations with the Mapbox Directions API

store locator image 1

What can I customize?

We built this Kit to cut down on the set-up and development time needed to add a Store Locator into your app. Use our starter themes and features as a plug-and-play solution, or further customize your Store Locator with our flexible build.

Add custom markers

Use our pre-built markers, or add in your own by creating your own icon, using your company’s logo, or another open source image.

Card icons

Customize the style of the interactive scrolling cards (i.e. pop-ups) included in your Store Locator.

Bringing your own data

Add as many store locations as you wish as a GeoJSON file. Remember that you could use this Kit to locate not just stores, but anything else like bike share hubs, ATMs, parks, or even your friends!

Map

The Kit comes with five UI starter themes, but you can further customize these themes as you see fit. Or create your own custom map styles by using Mapbox Studio to build a style that fits your brand.

Routing profile

The Kit includes the use of the Mapbox Directions API to display estimated travel distances and display driving routes to store locations. It’s also possible to modify the routing profile to use our cycling or walking directions.

Installation

Dependencies

Git

git clone [email protected]:mapbox/store-locator-react-native-gl.git
cd store-locator-react-native

Yarn

yarn add @mapbox/store-locator-react-native

Npm

npm install @mapbox/store-locator-react-native --save

Getting Started

There are a few steps needed to get up and running.

  1. We’ll want to create a JSON dataset to use with the StoreLocatorKit here is a link to the one in our example application. There are some required feature properties needed. The id, name, phoneFormatted, addressFormatted, and hoursFormatted are all required fields that we use to render the cards on the bottom of the screen.
{
  "id": "1",
  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [
      -77.034084142948,
      38.909671288923
    ]
  },
  "properties": {
    "name": "Place 1",
    "phoneFormatted": "(202) 234-7336",
    "addressFormatted": "33 Birchwood Drive, North Arlington",
    "hoursFormatted": "10 AM - 9 PM"
  }
}
  1. Next we’ll want to create a theme to use in our application
import MapboxGL from '@mapbox/react-native-mapbox-gl';
import StoreLocatorKit from '@mapbox/store-locator-react-native';

import reallyCoolIcon from '...';
import evenCoolerIcon from '...';
import ultraCoolIcon from '...';

export const theme = new StoreLocatorKit.Theme({
  icon: reallyCoolIcon,
  activeIcon: evenCoolerIcon,
  styleURL: MapboxGL.StyleURL.Light,
  primaryColor: `#A35BCD`,
  primaryDarkColor: '#5D39BA',
  directionsLineColor: '#987DDF',
  cardIcon: ultraCoolIcon,
  cardTextColor: '#6A159B',
  accentColor: '#C7A8D9',
});
  1. Now all we need to do is add the map to our application. We need to do our basic setup with MapboxGL by setting the access token, here is a snippet. You can head over to our Maps SDK for React Native if you want any more information
async componentWillMount () {
  if (!IS_IOS) {
    const isGranted = await MapboxGL.requestAndroidLocationPermissions();
    this.setState({ isGranted: isGranted });
  }
  MapboxGL.setAccessToken(MAPBOX_ACCESS_TOKEN);
}
  1. The last and final step is adding the store locator map to our application.
import places from '...'; // this is the dataset from step one
import { theme } from '...'; // theme from step 2
...

<StoreLocatorKit.MapView
  simulateUserLocation
  accessToken={MAPBOX_ACCESS_TOKEN}
  theme={theme}
  centerCoordinate={this.state.initialLocation}
  featureCollection={places}
  zoomLevel={13}
  style={styles.matchParent} />

Example Application

There is an example application bundle with this repo, to show you a working example of a store locator. Here are the steps needed to get it up and running

cd RNStoreLocatorExample
npm i
npm start

Open up App.js in the example application and you should see a message to enter your access token. Just replace this with your access token from Mapbox Studio.

const MAPBOX_ACCESS_TOKEN = '<Enter your access token>';

There are a few ways you can run the project. You can open up Xcode or Android Studio and run them for there (highly recommend to open up the example project in each once) or you can use the React Native CLI

Android

react-native run-android

iOS

react-native run-ios

What is Mapbox?

Mapbox is the location data platform for mobile and web applications. We provide building blocks to add location features like maps, search, and navigation into any experience you create. Use our simple and powerful APIs & SDKs and our open source libraries for interactivity and control.

Sign up for Mapbox

Not a Mapbox user yet? Sign up for an account here. Once you’re signed in, all you need to start building is a Mapbox access token. Use this same short code with all of our interactive mapping libraries, Python and JavaScript SDKs, and directly against our REST APIs. You can create and manage your access tokens in Mapbox Studio.