-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMapInput.js
51 lines (50 loc) · 1.89 KB
/
MapInput.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import React, {Component} from 'react';
import { GooglePlacesAutocomplete } from 'react-native-google-places-autocomplete';
function MapInput(props){
return (
<GooglePlacesAutocomplete
placeholder='Search'
minLength={2} // minimum length of text to search
autoFocus={true}
returnKeyType={'search'} // Can be left out for default return key
listViewDisplayed={false} // true/false/undefined
fetchDetails={true}
onPress={(data, details = null) => { // 'details' is provided when fetchDetails = true
console.log(data)
console.log(details)
props.notifyChange(details.geometry.location);
}}
query={{
key: 'YOUR_API_KEY_HERE',
language: 'en'
}}
nearbyPlacesAPI='GooglePlacesSearch'
debounce={300}
styles={{
textInputContainer: {
width: '100%',
backgroundColor: 'rgba(0,0,0,0)',
borderTopWidth: 0,
borderBottomWidth: 0
},
textInput: {
marginLeft: 0,
marginRight: 0,
height: 38,
color: '#5d5d5d',
fontSize: 16
},
description: {
fontWeight: 'bold'
},
predefinedPlacesDescription: {
color: '#1faadb'
},
listView: {
backgroundColor: 'rgba(255,255,255,1)'
}
}}
/>
);
}
export default MapInput;