New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-apple-mapkit

Package Overview
Dependencies
Maintainers
0
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-apple-mapkit

A lightweight React wrapper for Apple MapKit JS with an easy-to-use API.

latest
Source
npmnpm
Version
1.2.8
Version published
Weekly downloads
1
Maintainers
0
Weekly downloads
 
Created
Source

MapKit React Integration

A comprehensive library to seamlessly integrate Apple MapKit JS with React. This library provides TypeScript support and rich configuration options for maps, markers, and annotations.

Table of Contents

  • Installation
  • Getting Started
  • Configuration
  • Event Handling
  • Examples
  • API Reference
  • License

1. Installation

Install the package using npm or yarn:

npm install react-apple-mapkit

or

yarn add react-apple-mapkit

2. Getting Started

Initialization

Before using the map, you need to initialize MapKit with an authentication token.

import React from 'react';
import Map from 'react-apple-mapkit';

const App = () => {
  return (
    <Map token="YOUR_MAPKIT_JS_TOKEN">
      <h1>Apple MapKit Integration</h1>
    </Map>
  );
};

export default App;

3. Configuration

3.1 Map Configuration

PropTypeDefaultDescription
tokenstringRequiredMapKit JS API token.
mapTypestandard, mutedStandard, hybrid, satellitestandardMap type.
distancesadaptive, metric, imperialadaptiveDistance measurement system.
showsCompassFeatureVisibilityadaptiveCompass visibility.
showsScaleFeatureVisibilityhiddenScale visibility.
cameraBoundaryCoordinateRegionnullRestrict map camera boundary.
cameraZoomRange{ min: number, max: number }{ min: 0, max: Infinity }Define zoom limits for the camera.
paddingTop, paddingRight, paddingBottom, paddingLeftnumber0Map padding.
onRegionChangeStart(region: CoordinateRegion) => voidundefinedEvent triggered at region change start.
onRegionChangeEnd(region: CoordinateRegion) => voidundefinedEvent triggered at region change end.

3.2 Marker Configuration

PropTypeDefaultDescription
latitudenumberRequiredMarker latitude.
longitudenumberRequiredMarker longitude.
titlestring""Marker title.
subtitlestring""Marker subtitle.
colorstring#fb0000Marker color.
glyphColorstring#ffffffGlyph text color.
collisionMode'Rectangle' or 'Circle' or nullnullCollision detection mode.
subtitleVisibilityFeatureVisibilityadaptiveSubtitle visibility.
titleVisibilityFeatureVisibilityadaptiveTitle visibility.

3.3 Annotation Configuration

PropTypeDefaultDescription
latitudenumberRequiredAnnotation latitude.
longitudenumberRequiredAnnotation longitude.
titlestring""Annotation title.
subtitlestring""Annotation subtitle.
collisionMode'Rectangle' or 'Circle' or nullnullCollision detection mode.
calloutElementReactNodeundefinedCustom callout content.
calloutOffsetX, calloutOffsetYnumber0Callout offset adjustments.

4. Event Handling

Events can be easily attached to map and markers.

Map Events

EventDescription
onLoadTriggered when the map is loaded.
onRegionChangeStartTriggered at the start of region change.
onRegionChangeEndTriggered at the end of region change.
onSingleTapTriggered on single tap.

Marker Events

EventDescription
onSelectTriggered when a marker is selected.
onDeselectTriggered when a marker is deselected.
onDragStartTriggered when dragging starts.
onDragEndTriggered when dragging ends.

5. Examples

Basic Map

import React from 'react';
import Map from 'react-apple-mapkit';

const App = () => (
  <Map token="YOUR_MAPKIT_JS_TOKEN">
    <h2>My Map</h2>
  </Map>
);

export default App;

Map with Marker

import React from 'react';
import Map from 'react-apple-mapkit';
import Marker from 'react-apple-mapkit/Marker';

const App = () => (
  <Map token="YOUR_MAPKIT_JS_TOKEN">
    <Marker latitude={37.7749} longitude={-122.4194} title="San Francisco" />
  </Map>
);

export default App;

6. API Reference

Coordinate

Represents a point on the Earth’s surface.

interface Coordinate {
  latitude: number;
  longitude: number;
}

CoordinateRegion

Represents a geographic region.

interface CoordinateRegion {
  centerLatitude: number;
  centerLongitude: number;
  latitudeDelta: number;
  longitudeDelta: number;
}

7. License

This project is licensed under the MIT License. See the LICENSE file for details.

For more detailed information, visit the official documentation. 🎉

Keywords

react

FAQs

Package last updated on 13 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts