Skip to content

Recenter view on button click does not work #36

Closed Answered by giorgiabosello
JoppeMeijers asked this question in Help
Discussion options

You must be logged in to vote

Hi @JoppeMeijers. Center and Zoom are not managed in this way. You should change them by using the methods in map ref.
Example:

const zoom = {
    default: 13,
    in: 20,
}
    
const onMarkerClick = (business) => {
    mapRef.current.setCenter(business.coordinates)
    mapRef.current.setZoom(zoom.in)
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@JoppeMeijers
Comment options

@fandy-vitex
Comment options

Answer selected by giorgiabosello
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants