How to use react-native-google-places-autocomplete - 1 common examples

To help you get started, we’ve selected a few react-native-google-places-autocomplete examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github FaridSafi / react-native-google-places-autocomplete / GooglePlacesAutocompleteExample / Example_deprecated.js View on Github external
/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 */
'use strict';

var React = require('react-native');
var {
  AppRegistry,
  StyleSheet,
  Text,
  View,
} = React;


var GooglePlacesAutocomplete = require('react-native-google-places-autocomplete').create({
  placeholder: 'Search',
  minLength: 2, // minimum length of text to search
  autoFocus: true,
  fetchDetails: true,
  onPress(data, details = null) { // details is provided when fetchDetails = true
    console.log(data);
    console.log(details);
  },
  getDefaultValue() {
    return ''; // text input default value
  },
  query: {
    // available options: https://developers.google.com/places/web-service/autocomplete
    key: 'YOUR API KEY',
    language: 'en', // language of the results
    types: '(cities)', // default: 'geocode'

react-native-google-places-autocomplete

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

MIT
Latest version published 1 month ago

Package Health Score

89 / 100
Full package analysis

Popular react-native-google-places-autocomplete functions