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.

Change in state does not change default value (getDefaultValue)

See original GitHub issue

Change in state does not change default value

<GooglePlacesAutocomplete
        placeholder='Address'
        minLength={2}
        autoFocus={false}
        returnKeyType={'default'}
        fetchDetails={true}
        styles={{
          textInputContainer: {
            backgroundColor: 'rgba(0,0,0,0)',
            borderTopWidth: 0,
            borderBottomWidth: 1,
            borderBottomColor: '#D9D5DC'
          },
          textInput: {
            marginLeft: 0,
            marginRight: 0,
            color: '#000000',
            fontSize: 13,
          },
          predefinedPlacesDescription: {
            color: '#000000'
          },
        }}
        query={{
          // available options: https://developers.google.com/places/web-service/autocomplete
          key: 'AIzaSyBAZBpWYMUskFgPU_LATPHd521AKJ3CEz4',
          language: 'en', // language of the results
          types: 'geocode' // default: 'geocode'
        }}
        placeholderTextColor='#575757'
        onPress={(data, details = null) => { // 'details' is provided when fetchDetails = true
          console.log(data, details);
          this.onAddessSelect(data, details);
        }}
        currentLocation={false}
        nearbyPlacesAPI='GooglePlacesSearch'
        getDefaultValue={ () => this.state.address_line_1 ? this.state.address_line_1 + ' ' + 
            this.state.address_line_2 + ' ' + 
            this.state.suburb + ' ' + 
            this.state.city : ''
        } />

Issue Analytics

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

github_iconTop GitHub Comments

5reactions
guilhermepontescommented, Jul 4, 2018

I’ll take a look soon, sorry for the late response

2reactions
janvdtcommented, Mar 12, 2018

Are you still working on this? I have the same issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

getDefaultValue not rerender with state value change #158
We are trying to update default value in GooglePlacesAutocomplete "getDefaultValue" attribute by changing state value.
Read more >
React-Select --- How to get default value and overwrite the ...
My question is how to change the default value('Active') to another selected value('Inactive')?. Thanks const methods = useFormContext(); const ...
Read more >
3 Ways to Set Default Value in JavaScript | SamanthaMing.com
Let's break down the 3 different ways to set Default Values using logical operator, ternary, and if/else...
Read more >
Setting a default value for an Input element in React | bobbyhadz
Set the `defaultValue` prop on uncontrolled input fields. ... state as a parameter, so the firstName state variable will get initialized to Default...
Read more >
Default values of C# types - C# reference - Microsoft Learn
Learn the default values of C# types such as bool, char, int, float, double and more.
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