1.3.2 • Published 1 year ago

react-places v1.3.2

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

React-places - this is the npm package you need to find or suggest addresses on the map

Features

  • Find addresses with drop down suggestions
  • Map with functionaluty to scroll, zoom, click
  • Show addresses on map
  • Use Leaflet or TomTom map

Installation

To install the stable version

npm install --save react-places

with Yarn:

yarn add react-places

Usage

Import package as React Component

import ReactPlaces from 'react-places'

If you want use our css styles

import "react-places/dist/index.css";

Finally you will have:

import ReactPlaces from 'react-places'
import "react-places/dist/index.css";

function App() {
  return (
      <ReactPlaces
        initiallyCoord={[51.505, -0.09]}
      />
  );
}

export default App;

Props

PropTypeRequiredDescription
initiallyCoordarrayCoordinates for map (lat, lng)
inputTitlestringTitle for input
placeholderstringPlaceholder for input
langstringLanguage of map and search text
countrystringCountry for search params (will show addresses only from this coutry )
zoomnumberZoom for map )
mapTypeobject (IMapType)Map Package to use ( Leaflet or TomTom )
getRefInputfunction (data: HTMLInputElement)Get Ref of input
getMapDatafunction (data: IData)Returns selected address from map

Interface

interface IMapTypes {
    type: MapsPackages
    api_key?: string
}

export enum MapsPackages {
    LEAFLET = 0,
    TOMTOM = 1
}