# react-leaflet-night-region

> Add night region to react leaflet map

Latest version **1.1.0** (published 2021-09-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-leaflet-night-region
pnpm add react-leaflet-night-region
yarn add react-leaflet-night-region
bun add react-leaflet-night-region
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2021-09-03 |
| First published | 2021-02-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 1 |
| Unpacked size | 28.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | tammaroivan |
| Maintainers | tammaroivan |

## Links

- npm: https://www.npmjs.com/package/react-leaflet-night-region
- Repository: https://github.com/tammaroivan/react-leaflet-night-region
- Homepage: https://github.com/tammaroivan/react-leaflet-night-region#readme
- Issues: https://github.com/tammaroivan/react-leaflet-night-region/issues
- npm.io page: https://npm.io/package/react-leaflet-night-region

## Dependencies (1)

- [use-interval](https://npm.io/package/use-interval.md) ^1.3.0

## Recent versions

- 1.1.0 (latest) — 2021-09-03
- 1.0.2 — 2021-02-03
- 1.0.1 — 2021-02-01
- 1.0.0 — 2021-02-01

## README

# react-leaflet-night-region

> Add night region to react leaflet map

> Calculation algorithms based on [Leaflet.Terminator](https://github.com/joergdietrich/Leaflet.Terminator)

[![NPM](https://img.shields.io/npm/v/react-leaflet-night-region.svg)](https://www.npmjs.com/package/react-leaflet-night-region) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

## Install

```bash
npm install --save react-leaflet-night-region
```

## Usage

```jsx
import React, { Component } from 'react'
import { MapContainer, TileLayer } from 'react-leaflet'
import { NightRegion } from 'react-leaflet-night-region'

const App = () => {
  render() {
    return (
        <MapContainer
          center={{ lat: '20.4058379', lng: '21.7496284' }}
          zoom={3}
          minZoom={3}
          worldCopyJump={true}
        >
          <TileLayer
            attribution='&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
            url='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
          />
          <NightRegion
            fillColor='#00345c'
            color='#001a2e'
            refreshInterval={1000} // custom refresh rate in milliseconds, default set to 5000ms
          />
        </MapContainer>
    )
  }
}
```

## Image
![Example](https://i.imgur.com/slcDhpV.png)

## Options

You can use the same options as in a [Leaflet Polygon](https://leafletjs.com/reference-1.7.1.html#polygon) 

## To-Dos
- [ ] Multiple layers with different night intensity

## License

MIT © [tammaroivan](https://github.com/tammaroivan)

---
_Source: https://npm.io/package/react-leaflet-night-region · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
