Skip to content

Map and marker's place doesn't move when the lat,long state is changed by another component. #8

@ozandndar

Description

@ozandndar

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions