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

@zandor300/react-apple-mapkitjs

v0.11.0

Published

A react wrapper for apple mapkit.js

Downloads

315

Readme

react-apple-mapkitjs

Installation

npm install react-apple-mapkitjs

Add the script file in your reacts public index.html file

<script src="https://cdn.apple-mapkit.com/mk/5.x.x/mapkit.js"></script>

Getting an access token to use Apple's mapkitjs

Getting your token to get mapkitjs to work is not the most simple of tasks, I recommend watching this video in full to understand how to do this. https://developer.apple.com/videos/play/wwdc2018/508

If you want a simpler explanation and dont mind giving your private key to some other app to create your access token then the following link is a great resource. https://mapkitjs.rubeng.nl/#/


Once you have your access token

Import the AppleMaps component into your project

    import { AppleMaps } from 'react-apple-mapkitjs'
    <AppleMaps 
        token="your access token here"
    />

If the access token is correct then the map will default to Leeds, UK


Additional props and components

The AppleMaps component takes additional props to adjust the map view and zoom level, you can also specify a map width and height. It currently defaults to view height and width.

    <AppleMaps
        token="your access token here"
        longitude={30.8008}
        latitude={-1.5491}
        zoomLevel={1}
        height='100px'
        width='100px'
    />

You can also use additional Annotation components to put customizable drop pins on your apple map. The Annotation Components must be child components of AppleMaps.

First import both the AppleMaps and the Annotation component

import { AppleMaps, Annotation, ImageAnnotation } from 'react-apple-mapkitjs'

then add to your react application

<AppleMaps
    token="your access token here"
    longitude={53.8008}
    latitude={-1.5491}
    zoomLevel={6}
>
    <Annotation 
        longitude={53.8158}
        latitude={-1.6017}
        color="#969696"
        title="Apple"
        subtitle="work"
        selected={true}
        glyphText=""
    />
    <Annotation 
        longitude={53.8158}
        latitude={-1.5017}
        color="#349576"
        title="New Annotation"
        subtitle="work"
        selected={false}
    />
    <ImageAnnotation 
        longitude={53.8158}
        latitude={-1.4017}
        title="Cat Cafe"
        subtitle="scholes"
        selected={false}
        url='./assets/cat.jpeg'
        visible={false}
    />
</AppleMaps>

Most of the props to the Annotation component are self explanatory


Common Issues

Map not visible but no console errors - Set the width and height of the map as it may be rendering at 0px x 0px


Future Development

I'm going to carry on developing this component as it currently only has basic functionality, if there are any requests or you need any anymore help than that provided above then feel free to get in touch