React-native-google-places-autocomplete: TextInput value not clearing

Created on 6 Apr 2019  路  5Comments  路  Source: FaridSafi/react-native-google-places-autocomplete

I'm using the command this.GooglePlaceRef.setAddressText("") after press a button with the intention to clear what was typed in the TextInput. Initially looked like it was working because the TextInput returned to its placeholder, but when I type a new letter, the value showed is the sum of the what it was typed before press the button with this new letter.

Example to a better understanding:
I type "Street" and press the clear button, the TextInput shows the placeholder, when I type the letter "a" the word showed is "Streeta".

And I used this dependency some months ago with the same code I'm using now and I remember that everything was working very fine.

Most helpful comment

use

<GooglePlacesAutocomplete
                ref={c => this.googlePlacesAutocomplete = c}

and then usethis.googlePlacesAutocomplete._handleChangeText('');

this will clear the value

All 5 comments

text={this.state.value}
Do it null via state. on clear clicking button.

text={this.state.value}
Do it null via state. on clear clicking button.

Thanks for your reply @Biplovkumar, but the TextInput keeps the same behaviour that I described before.

use

<GooglePlacesAutocomplete
                ref={c => this.googlePlacesAutocomplete = c}

and then usethis.googlePlacesAutocomplete._handleChangeText('');

this will clear the value

use

<GooglePlacesAutocomplete
                ref={c => this.googlePlacesAutocomplete = c}

and then usethis.googlePlacesAutocomplete._handleChangeText('');

this will clear the value

i am getting _handleChangeText is not a function, when i try to call this

use

<GooglePlacesAutocomplete
                ref={c => this.googlePlacesAutocomplete = c}

and then usethis.googlePlacesAutocomplete._handleChangeText('');

this will clear the value

The app project was freezed for some months and only some hours ago I could try your suggestion @i1990jain. Thanks for it but the autocomplete showed the same behavior described before.
I've already gave up because it's not a great flaw at all. However I won't close the issue because others suggestions can appear.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sohel-tech picture sohel-tech  路  3Comments

miguel-pm picture miguel-pm  路  3Comments

tgreco picture tgreco  路  3Comments

mbelgrader picture mbelgrader  路  4Comments

yashwanth15 picture yashwanth15  路  3Comments