Open nappalm opened 10 months ago
Because my current code does not work, however if I use only a console.log within onPlaceSelected the selection in the input is maintained correctly.
<Controller name="location" render={({ field, fieldState: { error } }) => { return ( <div> <span style={{ color: 'black' }}>Location</span> <Input fullWidth inputComponent={({ inputRef, onFocus, onBlur, ...props }) => ( <Autocomplete apiKey="..." {...props} onPlaceSelected={(selected) => { const lat = selected.geometry.location.lat(); const lng = selected.geometry.location.lng(); field.onChange({ lat, lng, formatted_address: selected.formatted_address, }); }} /> )} /> </div> ); }} />
Gif error:
First idea: did you checked if your Input or Controller component is rerendered for some reason, so it resets the value?
Input
Controller
Because my current code does not work, however if I use only a console.log within onPlaceSelected the selection in the input is maintained correctly.
Gif error: