FaridSafi / react-native-google-places-autocomplete

Customizable Google Places autocomplete component for iOS and Android React-Native apps
MIT License
2k stars 848 forks source link

Unselectable search results in the list #674

Closed rezkiy37 closed 3 years ago

rezkiy37 commented 3 years ago

Describe the bug

Usually in the list of results (Autocomplete Google API) when clicking on an element (result), the error "request could not be completed or has been aborted" appears, and because of this, I do not receive data when clicking on this address for use it to the state.

Reproduction - (required - issue will be closed without this)

  1. Type request to the input.
  2. Select any item from the predictive list.
  3. Library sends request to Google Places API
  4. Response returns error "request could not be completed or has been aborted"

My code.

Click to expand! ``` const Events = { onValueChange: (value: string) => { onValueChange(value); }, onComplexValueChange: (data: GooglePlaceData, details: GooglePlaceDetail | null) => { let complexValue: AddressItemType['googleAddress'] = { description: data.description, formatted_address: details?.formatted_address || data.description, geometry: { ...details?.geometry?.location ? { location: details.geometry.location } : {} } } onComplexValueChange(complexValue); Log.hazel('GooglePlaces.onComplexValueChange()', { data, details, complexValue }); } } return ( value} value={value} onFail={(error) => Log.ruddy(error, { error })} placeholder='Начните вводить' minLength={2} autoFocus={false} returnKeyType="search" listViewDisplayed={isFocused} fetchDetails={true} renderDescription={row => row.description} onPress={(data, details = null) => { Events.onValueChange(details?.formatted_address || 'Sumy'); Events.onComplexValueChange(data, details); }} query={{ key: KEYS.google.geocoding, language: 'uk', types: 'address', components: 'country:ua', }} styles={{ listView: { backgroundColor: '#F9F9F9', overflow: 'scroll', paddingTop: 10, marginTop: 3 }, container: { backgroundColor: '#F9F9F9', }, textInput: { fontFamily: FontFamily + '-Regular', }, description: { fontFamily: FontFamily + '-Regular', color: '#333333', fontSize: (isDeviceS && 14) || 16 }, predefinedPlacesDescription: { color: '#A5A5A5', }, loader: { }, poweredContainer: { opacity: 0 }, powered: { }, separator: { opacity: 0 }, row: { overflow: 'visible', height: (isDeviceS && 38) || 43, padding: 6 }, textInputContainer: { backgroundColor: '#F9F9F9', borderTopWidth: 0, borderBottomWidth: 0 }, }} currentLocation={false} currentLocationLabel="Current location" nearbyPlacesAPI="GooglePlacesSearch" GoogleReverseGeocodingQuery={{ region: 'ua' }} // @ts-expect-error predefinedPlaces={predefinedPlaces} debounce={200} /> ```

Additional context

Add any other context about the problem here, screenshots etc

bell-steven commented 3 years ago

Does you google maps API key work without using this library? This sounds like an API key issue (billing not configured etc), as opposed to a bug in this library.

ApWin commented 3 years ago

@rezkiy37 Can you find any solutions ? It's also happens with me ++

bell-steven commented 3 years ago

I can't reproduce this with the code sample provided. Please provide a reproducible minimal code sample in a new issue.