Skip to content

State is not getting updated when clearing input value #351

@FullerWeb

Description

@FullerWeb

When you click on the 'X' to clear the input value, the state for that input value is not getting updated.

              <GooglePlacesAutocomplete
                selectProps={{
                  inputId: "pickUPLocation",
                  value: originAddr,
                  placeholder: "Pickup Location",
                  onChange: (place) => { handleOriginChange(place) },
                  isClearable: true,
                  autoFocus: true,
                  className: "w-full text-black",
                  components: {
                    DropdownIndicator: false
                  },
                  styles: {
                    control: (provided) => ({
                      ...provided,
                      backgroundColor: 'transparent',
                      border: 'none'
                    })
                  }
                }}
              />
  const handleOriginChange = async (place) => {
    if(!place) return;
    setOriginAddr(place.formatted_address)
    const originDetails = await getLatAndLng(place);
    setOrigin(originDetails);
  };

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions