react-location-picker
react-location-picker copied to clipboard
Map and marker's place doesn't move when the lat,long state is changed by another component.
When using only handleLocationChange, it works fine.
this.state = { address: 'Kala Pattar Ascent Trail, Khumjung 56000, Nepal', position: { lat: 0, lng: 0 }
handleLocationChange({ position, address, places }) { this.setState({ position, address }); }
but when it comes to set the states by another component, map marker and map doens't move. I can set the states without any problem but i need to change map markers place when i set the new lat,long.
My other component is below: onSuggestSelect(suggest) { let newLat = suggest.location.lat; let newLng = suggest.location.lng; let newAddress = suggest.label; let newProperties = { position: { lat: newLat, lng: newLng }, address: address, places: null };
this.handleLocationChange(newProperties);
}
Can any body have an idea about how can i change the map marker's place?
Hey @ozandndar, Could you please paste your whole code for another component?