question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Autocomplete does not work

See original GitHub issue

My component Search

import React, { Component } from 'react';
import { GooglePlacesAutocomplete } from 'react-native-google-places-autocomplete';
import { Dimensions } from 'react-native';


export default class Search extends Component {
  render() {
    return <GooglePlacesAutocomplete

    keyboardShouldPersistTaps='always' 

    placeholder="Para Onde ?"
    placeholderTextColor="#333"
    minLength={2} // minimum length of text to search
    
    onPress={(data, details = null) => { // 'details' is provided when fetchDetails = true

    console.log('pressinou');
    console.log(data, details);
  }}
    query={{
        key: 'MY-API-KEY',
        language:'pt',
        
    }}

    nearbyPlacesAPI='GooglePlacesSearch'

    textInputProps={{
        autoCapitalize:"none",
        autoCorrect:false,
    }}
    fetchDetails={true}
   //enabledPoweredByContainer={false}
    
    styles={{
        container: {
          position: "absolute",
          top: Platform.select({ ios: 60, android: 40 }),
          width: "100%"
        },
        textInputContainer: {
          flex: 1,
          backgroundColor: "transparent",
          height: 54,
          marginHorizontal: 20,
          borderTopWidth: 0,
          borderBottomWidth: 0
        },
        textInput: {
          height: 54,
          margin: 0,
          borderRadius: 0,
          paddingTop: 0,
          paddingBottom: 0,
          paddingLeft: 20,
          paddingRight: 20,
          marginTop: 0,
          marginLeft: 0,
          marginRight: 0,
          elevation: 5,
          shadowColor: "#000",
          shadowOpacity: 0.1,
          shadowOffset: { x: 0, y: 0 },
          shadowRadius: 15,
          borderWidth: 1,
          borderColor: "#ddd",
          fontSize: 18
        },
        listView: {
          borderWidth: 1,
          borderColor: "#ddd",
          backgroundColor: "#fff",
          marginHorizontal: 20,
          elevation: 5,
          shadowColor: "#000",
          shadowOpacity: 0.1,
          shadowOffset: { x: 0, y: 0 },
          shadowRadius: 15,
          marginTop: 10
        },
        description: {
          fontSize: 16
        },
        row: {
          padding: 20,
          height: 58
        }
      }}



    >

    </GooglePlacesAutocomplete>;
  }
}

And my index.js

import React, { Component } from 'react';
import MapView from 'react-native-maps';
import Geolocation from '@react-native-community/geolocation';  // instalar por causa da nova versao do REACT-NATIVE
import { View } from 'react-native';
import Search from '../Search';

// import { Container } from './styles';


// yarn add react-native-google-places-autocomplete

export default class Map extends Component {

    state = {
        region: null,
    }

    async componentDidMount() {
        
        Geolocation.getCurrentPosition(
            ({ 
                coords: { latitude, longitude } 
            }) => {
               // console.log('latitude', latitude);
                this.setState({

                    region: {
                        latitude,
                        longitude,
                        latitudeDelta: 0.0143,
                        longitudeDelta: 0.0134
                    }
                })
               // alert('pegou');
            }, // sucesso 
            () => { alert(' erro ')}, // erro
            {
                timeout: 2000,
                enableHighAccuracy: true,
                maximumAge: 10000,
            }
        )
    }


    render() {
        const { region } = this.state;
        console.log('REGIAO', region);
        return (
            <View style={{ flex: 1 }}  >
                <MapView
                    style={{ flex: 1 }}
                    region={ region }
                    showsUserLocation
                    loadingEnabled

                ></MapView>
                <Search>

                </Search>
            </View>
        );
    }
}

After put 2 or 3 digits of address, nothing happens

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
jaingcommented, May 10, 2020

This package is no longer maintained and simply not working. I tried on IOS with expo. I didn’t even get a list of results. I found a other package that is working like a charm:

https://www.npmjs.com/package/react-native-places-input

0reactions
andymurakamicommented, Feb 9, 2021

Yes I solved re-install the components and use the flex:1.

Verify the key too, sometimes is only the wrong key.

RGDS

Em ter., 9 de fev. de 2021 às 15:11, Walter Devia notifications@github.com escreveu:

@andymurakami https://github.com/andymurakami did you solved it?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/FaridSafi/react-native-google-places-autocomplete/issues/510#issuecomment-776134560, or unsubscribe https://github.com/notifications/unsubscribe-auth/AECG445M7GHW3GVXU6A7N2DS6F3DNANCNFSM4K75MACQ .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Terminal autocomplete doesn't work properly - Ask Ubuntu
I use xfce4-terminal so I thought it might be the terminal and not the bash. But editing: ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4- ...
Read more >
Google Search Autocomplete Not Working? Try This Fix - Alphr
If the autocomplete feature is enabled but still not working, try disabling the account sync feature in the You and Google tab as...
Read more >
AutoComplete not working correctly - Outlook - Microsoft Learn
Check to see if AutoComplete is turned on · In Outlook, select File > Options. · Select the Mail tab. · Scroll roughly...
Read more >
autocomplete not working on Chrome [closed] - Stack Overflow
I have a problem on our website where Chrome autocomplete seems not to work. It has been working in the past, but not...
Read more >
Autocomplete does NOT work at all. #1695 - GitHub
Describe the current behavior: Tab only gives two spaces after say np. · Describe the expected behavior: autocomplete selection list should ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found