Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-mapview

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-mapview - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

4

lib/components/Map.d.ts
/// <reference types="apple-mapkit-js-browser" />
import React from 'react';
import MapProps from './MapProps';
import React from "react";
import MapProps from "./MapProps";
declare const Map: React.ForwardRefExoticComponent<MapProps & {

@@ -5,0 +5,0 @@ children?: React.ReactNode;

@@ -1,5 +0,5 @@

import React, { useState, useEffect, useRef, useImperativeHandle, } from 'react';
import MapContext from '../context/MapContext';
import load from '../util/loader';
import { ColorScheme, Distances, LoadPriority, MapType, toMapKitColorScheme, toMapKitCoordinateRegion, toMapKitDistances, toMapKitLoadPriority, toMapKitMapType, } from '../util/parameters';
import React, { useState, useEffect, useRef, useImperativeHandle } from "react";
import MapContext from "../context/MapContext";
import load from "../util/loader";
import { ColorScheme, Distances, LoadPriority, MapType, toMapKitColorScheme, toMapKitCoordinateRegion, toMapKitDistances, toMapKitLoadPriority, toMapKitMapType, } from "../util/parameters";
const Map = React.forwardRef(({ children = undefined, token, colorScheme = ColorScheme.Light, mapType = MapType.Standard, distances = Distances.Adaptive, loadPriority = LoadPriority.LandCover, isRotationEnabled = true, isScrollEnabled = true, isZoomEnabled = true, showsMapTypeControl = true, showsZoomControl = true, showsUserLocationControl = false, showsPointsOfInterest = true, showsUserLocation = false, tracksUserLocation = false, paddingTop = 0, paddingRight = 0, paddingBottom = 0, paddingLeft = 0, initialRegion = undefined, cameraBoundary = undefined, minCameraDistance = 0, maxCameraDistance = Infinity, region = undefined, center = undefined, onSingleTap = undefined, onDoubleTap = undefined, onLongPress = undefined, }, mapRef) => {

@@ -33,3 +33,8 @@ const [map, setMap] = useState(null);

return;
map.colorScheme = toMapKitColorScheme(colorScheme);
try {
map.colorScheme = toMapKitColorScheme(colorScheme);
}
catch (error) {
//
}
}, [map, colorScheme]);

@@ -39,3 +44,8 @@ useEffect(() => {

return;
map.mapType = toMapKitMapType(mapType);
try {
map.mapType = toMapKitMapType(mapType);
}
catch (error) {
//
}
}, [map, mapType]);

@@ -45,3 +55,8 @@ useEffect(() => {

return;
map.distances = toMapKitDistances(distances);
try {
map.distances = toMapKitDistances(distances);
}
catch (error) {
//
}
}, [map, distances]);

@@ -51,4 +66,9 @@ useEffect(() => {

return;
// @ts-ignore
map.loadPriority = toMapKitLoadPriority(loadPriority);
try {
// @ts-ignore
map.loadPriority = toMapKitLoadPriority(loadPriority);
}
catch (error) {
//
}
}, [map, loadPriority]);

@@ -85,4 +105,11 @@ // Simple values properties

return;
// @ts-ignore
map.cameraBoundary = cameraBoundary ? toMapKitCoordinateRegion(cameraBoundary) : null;
try {
// @ts-ignore
map.cameraBoundary = cameraBoundary
? toMapKitCoordinateRegion(cameraBoundary)
: null;
}
catch (error) {
//
}
}, [map, cameraBoundary]);

@@ -93,8 +120,12 @@ // region

return;
// @ts-ignore
if (region) {
console.log('region====>', region);
const coordinateRegion = toMapKitCoordinateRegion(region);
map.setRegionAnimated(coordinateRegion, false);
try {
// @ts-ignore
if (region) {
const coordinateRegion = toMapKitCoordinateRegion(region);
map.setRegionAnimated(coordinateRegion, false);
}
}
catch (error) {
//
}
}, [map, region]);

@@ -105,8 +136,12 @@ // center

return;
// @ts-ignore
if (center) {
console.log('center====>', center);
const coordinateCenter = new mapkit.Coordinate(center.centerLatitude, center.centerLongitude);
map.setCenterAnimated(coordinateCenter, false);
try {
// @ts-ignore
if (center) {
const coordinateCenter = new mapkit.Coordinate(center.centerLatitude, center.centerLongitude);
map.setCenterAnimated(coordinateCenter, false);
}
}
catch (error) {
//
}
}, [map, center]);

@@ -124,3 +159,3 @@ // Camera zoom range

catch (error) {
//
//
}

@@ -130,5 +165,5 @@ }, [map, minCameraDistance, maxCameraDistance]);

const events = [
{ name: 'single-tap', handler: onSingleTap },
{ name: 'double-tap', handler: onDoubleTap },
{ name: 'long-press', handler: onLongPress },
{ name: "single-tap", handler: onSingleTap },
{ name: "double-tap", handler: onDoubleTap },
{ name: "long-press", handler: onLongPress },
];

@@ -139,3 +174,3 @@ events.forEach(({ name, handler }) => {

return undefined;
const mapkitHandler = ({ domEvents, pointOnPage }) => {
const mapkitHandler = ({ domEvents, pointOnPage, }) => {
handler({

@@ -153,5 +188,5 @@ domEvents,

return (React.createElement(React.StrictMode, null,
React.createElement("div", { style: { width: '100%', height: '100%' }, ref: element },
React.createElement("div", { style: { width: "100%", height: "100%" }, ref: element },
React.createElement(MapContext.Provider, { value: map }, children))));
});
export default Map;
export default Map;
{
"name": "react-mapview",
"version": "1.0.4",
"version": "1.0.5",
"description": "React wrapper for Apple's mapkit.js.",

@@ -5,0 +5,0 @@ "author": "VTD",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc