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

react-autosuggest-geocoder

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-autosuggest-geocoder

Autosuggest addresses using a Pelias service.

  • 1.0.0-beta.3
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

react-autosuggest-geocoder

react-autosuggest with suggestions from pelias services. Click here to try it out.

react autosuggest example

Setup / Usage

1. Install react-autosuggest-geocoder

Through NPM:

npm install --save react-autosuggest-geocoder

Through Yarn:

yarn add react-autosuggest-geocoder

2. Create a react component that wraps react-autosuggest-geocoder

import { ReactAutosuggestGeocoder } from 'react-autosuggest-geocoder'

class SearchPage extends React.Component {
  constructor(props) {
    super(props);

    this.state = {
      search: "",
      latitude: Infinity,
      longitude: Infinity
    };
  }

  render() {
    return (
      <div>
        <ReactAutosuggestGeocoder
          url='https://search.mapzen.com/v1'
          apiKey='...'
          onSuggestionSelected={(event, { search, suggestion, method }) => {
            this.setState({
              location: suggestion.properties.label,
              latitude: suggestion.geometry.coordinates[1],
              longitude: suggestion.geometry.coordinates[0]
            })
          }} />
      </div>
    );
  }
}

Props

PropTypeRequiredDefaultDescription
urlstringhttps://search.mapzen.com/v1
apiKeystringPelias service API key. Most useful with MapZen. See https://mapzen.com/developers to get a mapzen API key.
sourcesstringopenaddressesFilter data by data source. See https://mapzen.com/documentation/search/search/#filter-by-data-source for more information.
fetchDelaynumber150Debounce API requests with this delay (in milliseconds).
centerobjectOrient search results towards the provided center. See https://mapzen.com/documentation/search/search/#prioritize-results-by-proximity for more detail.
boundsarrayBounding box to limit search results. See https://mapzen.com/documentation/search/search/#search-within-a-rectangular-region for more detail.
onSuggestionSelectedfunctionSee https://github.com/moroshko/react-autosuggest#onSuggestionSelectedProp for details.
onReverseSelectedfunctionInvoked after reverse geocoding is performed.
getSuggestionValuefunctionIdentity FunctionSee https://github.com/moroshko/react-autosuggest#getsuggestionvalue-required for details.
renderSuggestionfunctionDiv Wrapper FunctionSee https://github.com/moroshko/react-autosuggest#rendersuggestion-required for details.

Ref Methods

reverseGeocode({ latitude, longitude })

Reverse geocode the given point into the component input text field.

update(newValue)

Update the autocomplete input text field.

clear()

Clear the autocomplete input text field and deselect any previously selected values.

focus()

Bring browser focus to the autocomplete input text field.

blur()

Unfocus browser from the autocomplete input text field.

License

BSD-3

Keywords

FAQs

Package last updated on 15 Sep 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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