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 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-native-leaflet-plus

v0.1.6

Published

Powerful and flexible mapping library that brings full Leaflet support to React Native apps. It includes out-of-the-box support for vector maps like Protomaps, interactive editing of map features, and a rich set of customization options. Whether you’re bu

Readme

React Native Leaflet Plus

Мощная и гибкая библиотека картографирования, которая обеспечивает полную поддержку Leaflet для React Native приложений. Включает в себя готовую поддержку векторных карт, таких как Protomaps, интерактивное редактирование элементов карты и богатый набор возможностей кастомизации.

npm version license platform

✨ Особенности

  • 🗺️ Полная поддержка Leaflet - Все возможности популярной библиотеки Leaflet.js
  • 🎨 Векторные карты - Встроенная поддержка Protomaps и других векторных источников
  • ✏️ Интерактивное редактирование - Возможность редактирования полигонов и прямоугольников
  • 🎯 Богатые возможности - Маркеры, полилинии, полигоны, прямоугольники
  • 📱 React Native нативный - Оптимизировано для мобильных приложений
  • 🎭 Кастомизация - Полная настройка стилей и поведения
  • 🚀 Производительность - Эффективное управление памятью и рендерингом
  • 📦 TypeScript - Полная поддержка типов

🚀 Быстрый старт

Установка

npm install react-native-leaflet-plus
# или
yarn add react-native-leaflet-plus

Зависимости

Библиотека требует следующие peer dependencies:

npm install react-native-webview @react-native-async-storage/async-storage

Затем выполните:

cd ios && pod install

Android настройка

Для Android добавьте в android/app/src/main/AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET" />

📖 Основное использование

import React from 'react';
import { View, StyleSheet } from 'react-native';
import { LeafletMap, Marker, Polyline } from 'react-native-leaflet-plus';

export default function MapScreen() {
  return (
    <View style={styles.container}>
      <LeafletMap
        style={styles.map}
        options={{
          center: [55.7558, 37.6176], // Москва
          zoom: 13,
        }}
        tileLayer={{
          url: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
          options: {
            attribution: '© OpenStreetMap contributors',
          },
        }}
      >
        <Marker
          uniqueId="marker1"
          latlng={[55.7558, 37.6176]}
          options={{
            title: 'Москва',
          }}
          onPress={() => console.log('Маркер нажат!')}
        />

        <Polyline
          uniqueId="route1"
          latlngs={[
            [55.7558, 37.6176],
            [55.7522, 37.6156],
            [55.75, 37.62],
          ]}
          options={{
            color: 'blue',
            weight: 3,
          }}
        />
      </LeafletMap>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
  map: {
    flex: 1,
  },
});

📚 Документация

🎯 Компоненты

LeafletMap

Основной компонент карты, который содержит все остальные элементы.

Marker

Маркеры для отображения точек на карте.

Polyline

Линии для отображения маршрутов или путей.

Polygon

Полигоны для отображения областей.

Rectangle

Прямоугольники с возможностью редактирования.

🗺️ Типы карт

Tile Layer (Растровые карты)

<LeafletMap
  tileLayer={{
    url: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
    options: {
      attribution: '© OpenStreetMap contributors',
    },
  }}
/>

Protomaps (Векторные карты)

<LeafletMap
  protomapsLayer={{
    url: 'https://api.protomaps.com/tiles/v3.json?key=YOUR_KEY',
    flavor: 'light',
  }}
/>

⚡ Производительность

  • Автоматическое управление памятью
  • Эффективный рендеринг через WebView
  • Оптимизированные обновления компонентов
  • Поддержка больших наборов данных

🔧 Кастомизация

Стилизация маркеров

<Marker
  uniqueId="custom-marker"
  latlng={[55.7558, 37.6176]}
  options={{
    icon: {
      divIcon: {
        html: '<div style="background: red; width: 20px; height: 20px; border-radius: 50%;"></div>',
        iconSize: [20, 20],
      },
    },
  }}
/>

Кастомные стили карты

<LeafletMap
  injectCSS={`
    .leaflet-tile {
      filter: hue-rotate(180deg);
    }
  `}
  injectJS={`
    // Кастомный JavaScript код
  `}
/>

📱 События

<LeafletMap
  onMove={(event) => console.log('Карта перемещена:', event.latlng)}
  onZoom={(event) => console.log('Масштаб изменен:', event.zoom)}
  onLoad={() => console.log('Карта загружена')}
/>

🎮 Программное управление

import { useRef } from 'react';

const mapRef = useRef(null);

// Перемещение к координатам
mapRef.current?.flyTo([55.7558, 37.6176], 15);

// Установка масштаба
mapRef.current?.setZoom(10);

// Подгонка границ
mapRef.current?.fitBounds([
  [55.7, 37.6],
  [55.8, 37.7],
]);

🤝 Вклад в проект

Мы приветствуем вклад в развитие проекта! Пожалуйста, ознакомьтесь с руководством по вкладу.

📄 Лицензия

MIT License. См. LICENSE для подробностей.

🆘 Поддержка

🙏 Благодарности


Сделано с ❤️ для сообщества React Native