реагировать-родной-google-мест-автозаполнение не работает, я сталкиваюсь с несколькими проблемами 1. раскрывающийся список мест не отображается 2. обработчик onPress не запускается вообще
Примечание: все Google api для местоположения включены, API для карт Google, API для мест и API для геокодирования включены, и задан действительный ключ API.
Я перепробовал все возможные решения, доступные в Интернете 1. Установка zIndex: 1000 - высокое значение, чтобы избежать его быть скрытым за каким-то другим видом 2. Попытался создать новое приложение RN и добавил только этот компонент, чтобы сохранить проект в чистоте 3. Ссылался на другой пост SO и пытался его исправить
здесь фрагмент кода
<GooglePlacesAutocomplete
placeholder="Search"
minLength={2} // minimum length of text to search
autoFocus={false}
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: 'VALID_API_KEY',
language: 'en', // language of the results
}}
styles={{
description: {
fontWeight: 'bold',
},
predefinedPlacesDescription: {
color: '#1faadb',
},
listView: {
color: 'black', //To see where exactly the list is
zIndex: 1000, //To popover the component outwards
position: 'absolute',
top: 45
},
}}
currentLocation={true} // 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
}
}
GooglePlacesDetailsQuery={{
// available options for GooglePlacesDetails API : https://developers.google.com/places/web-service/details
fields: 'formatted_address',
}}
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
predefinedPlaces={[homePlace, workPlace]}
predefinedPlacesAlwaysVisible={true}
/>