New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-native-google-places-autocomplete

Package Overview
Dependencies
Maintainers
7
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-google-places-autocomplete

Customizable Google Places autocomplete component for iOS and Android React-Native apps

  • 2.5.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
180K
increased by55.8%
Maintainers
7
Weekly downloads
 
Created

What is react-native-google-places-autocomplete?

The react-native-google-places-autocomplete package is a customizable React Native component that provides a Google Places autocomplete input field. It allows users to search for places and get location details using the Google Places API.

What are react-native-google-places-autocomplete's main functionalities?

Autocomplete Input

This feature provides an input field where users can type in a location name, and it will suggest places using Google Places API. The code sample demonstrates how to set up the autocomplete input and handle the selection of a place.

import React from 'react';
import { GooglePlacesAutocomplete } from 'react-native-google-places-autocomplete';

const GooglePlacesInput = () => {
  return (
    <GooglePlacesAutocomplete
      placeholder="Search"
      onPress={(data, details = null) => {
        console.log(data, details);
      }}
      query={{
        key: 'YOUR_API_KEY',
        language: 'en',
      }}
    />
  );
};

export default GooglePlacesInput;

Customizable Components

This feature allows customization of the autocomplete component, including styles and behavior. The code sample shows how to customize the input field, such as setting the minimum length for search, autofocus, and styling the input container.

import React from 'react';
import { GooglePlacesAutocomplete } from 'react-native-google-places-autocomplete';

const CustomGooglePlacesInput = () => {
  return (
    <GooglePlacesAutocomplete
      placeholder="Search"
      minLength={2}
      autoFocus={false}
      returnKeyType={'search'}
      listViewDisplayed={false}
      fetchDetails={true}
      renderDescription={row => row.description}
      onPress={(data, details = null) => {
        console.log(data, details);
      }}
      query={{
        key: 'YOUR_API_KEY',
        language: 'en',
      }}
      styles={{
        textInputContainer: {
          width: '100%',
        },
        description: {
          fontWeight: 'bold',
        },
        predefinedPlacesDescription: {
          color: '#1faadb',
        },
      }}
    />
  );
};

export default CustomGooglePlacesInput;

Other packages similar to react-native-google-places-autocomplete

Keywords

FAQs

Package last updated on 02 Nov 2022

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