Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/**
* 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'