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

react-native-leaflet-ts-beta

v0.2.14

Published

React Native Leaflet with Typescript support

Downloads

8

Readme

React Native Leaflet TS

Please show your support by adding a star! :)

react-native-leaflet-ts is a library with Typescript support that let's you to render a Leaflet in a WebView.

NOTE! Library is new, this will be updated & more stuff will be added.

npm npm npm

Installation

Npm

npm install react-native-leaflet-ts

Yarn

yarn add react-native-leaflet-ts

Usage

import Leaflet from 'react-native-leaflet-ts';

Usage with props

import Leaflet, { Markers, TileOptions } from 'react-native-leaflet-ts';

Release log

  • [2022-12-01][v0.2.12] - Fixed webview dependency
  • [2022-10-17][v0.2.9] - Added prop for detecting retina-screens
  • [2022-10-17][v0.2.8] - Fixed loading issue for iOS
  • [2022-10-11][v0.2.6] - Fixed support for Android
  • [2022-10-06][v0.2.1] - Fixed path for custom icon.
  • [2022-10-06][v0.2.0] - Minor changes to readme-file.
  • [2022-10-04][v0.1.8] - Support for custom icons & increased performance.
  • [2022-10-04][v0.1.7] - Added webview to peerDependencies.
  • [2022-10-04][v0.1.6] - Added dependencies to peerDependencies to prevent useRef crash.

API Reference

Leaflet

| Parameter | Type | Default | Status | Description | | :-------------------- | :-------------------------------------- | :---------- | :----------- | :-------------------------------- | | map | src: string, tileOptions: TileOptions | | Required | | | zoom | number | 0 | Optional | | | maxZoom | number | | Optional | | | minZoom | number | | Optional | | | flyTo | { latLng: number[], zoom number } | | Optional | Flies to a specific marker | | startInLoadingState | boolean | true | Optional | Map starts in loading state | | backgroundColor | string | transparent | Optional | BackgroundColor of map | | onMessage | function | | Optional | (event: any) => void; | | onError | function | | Optional | (event: any) => void | | onLoadStart | function | | Optional | When webview loads starts loading |

map

| Parameter | Type | Default | Status | Description | | :-------- | :------------ | :------ | :----------- | :------------------------------------ | | src | string | | Required | Source to "{z}/{x}/{-y}.png" tile url | | options | TileOptions | | Optional | |

TileOptions

https://leafletjs.com/reference.html#tilelayer

| Parameter | Type | Default | Status | Description | | :------------------ | :----------- | :------ | :----------- | :---------------------------------------- | | tileSize | number | 256 | Optional | Width and height of the tails in the grid | | opacity | number | 1 | Optional | Opacity of the map | | updateWhenIdle | boolean | | Optional | Load new tiles only when panning ends | | updateWhenZooming | boolean | true | Optional | Zoom animation | | updateInterval | number | 200 | Optional | Tile update speed | | zIndex | number | 1 | Optional | zIndex of tile | | bounds | [number[]] | | Optional | | | noWrap | boolean | false | Optional | If map should be repeated | | pane | string | | Optional | | | className | string | | Optional | | | keepBuffer | number | 2 | Optional | | | detectRetina | boolean | false | Optional | |

Markers

| Parameter | Type | Default | Status | Description | | :--------- | :--------------------------------- | :------ | :----------- | :----------------------------------------- | | latLng | number[] | | Required | Position of the marker on the map | | icon | string | | Optional | example: "src/assets/pin.png" | | iconSize | { width: number, height: number} | | Optional | size of icon | | disabled | boolean | false | Optional | Weather it's clickable or not | | title | string | "" | Optional | Text in textbox after clicking on a marker |

Examples

const markerList: Markers[] = [
  {
    latLng: [-38.31571580761326, -23.735463483398522],
    iconSize: {
      width: 25,
      height: 25,
    },
    icon: './src/assets/mapPin.png',
    title: 'Title 1',
    disabled: true,
  },
  {
    latLng: [-58.31571543253336, -43.535453281293517],
    iconSize: {
      width: 25,
      height: 25,
    },
    title: 'Title 2',
  },
];
<Leaflet
  map={{
    src: source,
    tileOptions: {
      noWrap: true,
    },
  }}
  minZoom={1}
  zoom={2}
  maxZoom={6}
  flyTo={{
    latLng: [-38.31571580761326, -23.735463483398522],
    zoom: 5,
  }}
  markers={markerList}
  backgroundColor="green"
/>

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Links

We App GitHub

Help / Info

If you need any of the other Leaflet properties just let me know and I'll add them in. Send me a mail at [email protected].