FaridSafi / react-native-google-places-autocomplete

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

I am not able to see the list of addresses. #907

Open ravi2611gupta opened 12 months ago

ravi2611gupta commented 12 months ago

Describe the problem

I am not able to see the list of addresses I am starts typing in the input box. I am using this library in my react-native CLI project and the version of react-native is 0.72.3, If there is any issue in my code or I forgot any step then please let me know because it is really very urgent to me.

Here is my code! ```javascript import React from 'react'; import { GooglePlacesAutocomplete } from 'react-native-google-places-autocomplete'; import { COLORS, SIZES, SPACING } from '../../lib/theme'; import { MAP_KEY } from '../../lib/utils'; const AddressPicker = ({ setRegion, region, }: { setRegion: any; region: any; }) => { return ( { console.log(data, details); setRegion({ latitude: details && details.geometry.location.lat, longitude: details && details.geometry.location.lng, latitudeDelta: 0.0922, longitudeDelta: 0.0421, }); }} query={{ key: MAP_KEY, language: 'en', location: `${region.latitude}, ${region.longitude}`, }} styles={{ container: { backgroundColor: COLORS.white, height: 48, borderRadius: SIZES.base, color: COLORS.gray, borderWidth: 2, marginTop: SPACING.small, }, }} /> ); }; export default AddressPicker; ```

Additional context

If you are using expo please indicate here:

Add any other context about the problem here, screenshots etc

kyadalu1 commented 11 months ago

https://www.youtube.com/watch?v=vA9hVdE4UkI

misterlib commented 11 months ago

I ran into the same thing and found that wrapping the component in a larger view solved it:

    <View
        style={{
            margin: 12,
            backgroundColor: "transparent",
            zIndex: 10,
            height: 500,
        }}
    >
        <GooglePlacesAutocomplete ... />
    </View>
Motoxpro commented 8 months ago

I ran into the same thing and found that wrapping the component in a larger view solved it:

    <View
        style={{
            margin: 12,
            backgroundColor: "transparent",
            zIndex: 10,
            height: 500,
        }}
    >
        <GooglePlacesAutocomplete ... />
    </View>

This helped me get this working in a Modal. List wouldn't show up without setting a parent zIndex > 0