how to place the autocomplete on Map
See original GitHub issueI am trying to build the autocomplete on top of a map, but the search box keeps pushing the map down, how can i overlay the search results on the map ?
<GooglePlacesAutocomplete
listViewDisplayed='true'
placeholder='Search'
minLength={1} // minimum length of text to search
autoFocus={false}
fetchDetails={true}
onPress={(data, details = null) => { // 'details' is provided when fetchDetails = true
this.setState({
latitude: details.geometry.location.lat,
longitude: details.geometry.location.lng, latitudeDelta: 0.3, longitudeDelta: 0.3
});
}}
getDefaultValue={() => {
return ''; // text input default value
}}
query={{
// available options: https://developers.google.com/places/web-service/autocomplete
key: key
language: 'ar', // language of the results
types: 'address', // default: 'geocode'
}}
styles={{
description: {
fontWeight: 'bold',
textAlign: 'right'
},
predefinedPlacesDescription: {
color: '#1faadb',
},
}}
currentLocation={false} // Will add a 'Current location' button at the top of the predefined places list
currentLocationLabel="Current location"
nearbyPlacesAPI='GooglePlacesSearch' // Which API to use: GoogleReverseGeocoding or GooglePlacesSearch
GoogleReverseGeocodingQuery={{
// available options for GoogleReverseGeocoding API : https://developers.google.com/maps/documentation/geocoding/intro
}}
GooglePlacesSearchQuery={{
// available options for GooglePlacesSearch API : https://developers.google.com/places/web-service/search
rankby: 'distance',
types: 'food',
}}
filterReverseGeocodingByTypes={['locality', 'administrative_area_level_3']} // filter the reverse geocoding results by types - ['locality', 'administrative_area_level_3'] if you want to display only cities
predefinedPlacesAlwaysVisible={true}
/>
<MapView
region={this.getMapRegion()}
style={styles.map}
// onPress={() => alert('hello')}
provider={PROVIDER_GOOGLE}
mapType="standard"
onRegionChangeComplete={(region) => this.setState({
latitude: region.latitude, longitude: region.longitude,
latitudeDelta: region.latitudeDelta, longitudeDelta: region.longitudeDelta
})}
showsCompass={true}
showsBuildings={true}
showsTraffic={true}
showsIndoors={true}
>
<MapView.Marker
coordinate={this.getMapRegion2()} />
<Image
style={{
resizeMode: 'contain',
left: '50%',
marginLeft: -24,
marginTop: -48,
height: 60, width: 60,
top: '50%'
}} source={require('../../assets/fake-marker.png')} />
</MapView>
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:10
Top Results From Across the Web
Place Autocomplete | Maps JavaScript API - Google Developers
The Place Autocomplete sample demonstrates how to use the Place Autocomplete ... Bind the map's bounds (viewport) property to the autocomplete object,
Read more >Google places autocomplete implementation: A step by step ...
You can use autocomplete to emulate the type-ahead search functionality of the Google Maps search box in your applications. When a user begins...
Read more >How to add Google Maps Autocomplete search box?
Use Google Maps JavaScript API with places library to implement Google Maps Autocomplete search box in the webpage. HTML
Read more >How to Use Places Autocomplete Google API - W3docs
Google autocomplete can give us cities, countries, places, and anything else. It's instrumental in website registrations, drawing on the map.
Read more >Google Place Autocomplete - Ride
Add google maps places javascript by adding the following script to your webpage, be sure to fill in your API key. To get...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
in your styles prop, add:
But select items on Map not work