Skip to content
Commits on Source (5)
{
"name": "react-apple-mapkitjs",
"version": "0.2.4",
"name": "@zandor300/react-apple-mapkitjs",
"version": "0.3.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
......
{
"name": "react-apple-mapkitjs",
"version": "0.2.4",
"name": "@zandor300/react-apple-mapkitjs",
"version": "0.3.0",
"description": "A react wrapper for apple mapkit.js",
"main": "lib/index.js",
"scripts": {
......@@ -44,6 +44,6 @@
"dependencies": {},
"repository": {
"type": "git",
"url": "https://github.com/tonyduanesmith/react-apple-mapkitjs"
"url": "https://github.com/Zandor300/react-apple-mapkitjs"
}
}
......@@ -10,13 +10,13 @@ function Demo() {
<Fragment>
<AppleMaps
token={YOUR_ACCESS_TOKEN_HERE}
longitude={53.8008}
latitude={-1.5491}
latitude={53.8008}
longitude={-1.5491}
zoomLevel={6}
>
<Annotation
longitude={53.8158}
latitude={-1.6017}
latitude={53.7967}
longitude={-1.5438}
color="#969696"
title="Apple"
subtitle="work"
......@@ -24,16 +24,16 @@ function Demo() {
glyphText=""
/>
<ImageAnnotation
longitude={53.8158}
latitude={-1.4017}
latitude={53.8158}
longitude={-1.4017}
title="Cat Cafe"
subtitle="scholes"
selected={true}
url='./assets/cat.jpeg'
/>
<Annotation
longitude={53.8058}
latitude={-1.5317}
latitude={53.7950}
longitude={-1.5474}
color="red"
title="Rail Station"
subtitle="Leeds"
......@@ -41,8 +41,8 @@ function Demo() {
glyphImage='./assets/railicon.png'
/>
<CurrentLocationOverride
longitude={53.7158}
latitude={-1.4017}
latitude={53.7158}
longitude={-1.4017}
direction={90}
/>
</AppleMaps>
......
import React, { Fragment } from 'react'
const Annotation = () => {
function Annotation() {
return <Fragment />
}
Annotation.defaultProps = {
visible: true
visible: true,
isAnnotation: true
}
export default Annotation
......@@ -2,7 +2,7 @@ import React, { Component } from 'react'
class AppleMaps extends Component {
componentDidMount() {
const { token, children } = this.props
const { token, children, initialMapType } = this.props
this.canvas = document.createElement('canvas')
this.canvas.id = 'currentLocationOverride'
mapkit.init({
......@@ -13,15 +13,20 @@ class AppleMaps extends Component {
this.map = new mapkit.Map('map')
// Set initial mapType
if(initialMapType !== undefined) {
this.map.mapType = initialMapType
}
// Annotations
if (children !== undefined && children.length) {
children.forEach(child => {
if (child.type.name === 'Annotation') {
if (child.props.isAnnotation) {
this.createAnnotation(child.props)
}
})
} else if (children !== undefined && children.props) {
if (children.type.name === 'Annotation') {
if (children.props.isAnnotation) {
this.createAnnotation(children.props)
}
}
......@@ -29,12 +34,12 @@ class AppleMaps extends Component {
// Image Annotations
if (children !== undefined && children.length) {
children.forEach(child => {
if (child.type.name === 'ImageAnnotation') {
if (child.props.isImageAnnotation) {
this.createImageAnnotation(child.props)
}
})
} else if (children !== undefined && children.props) {
if (children.type.name === 'ImageAnnotation') {
if (children.props.isImageAnnotation) {
this.createImageAnnotation(children.props)
}
}
......
......@@ -5,7 +5,8 @@ const ImageAnnotation = () => {
}
ImageAnnotation.defaultProps = {
visible: true
visible: true,
isImageAnnotation: true
}
export default ImageAnnotation