I’m creating a StoreLocator Page and I’m wondering if there is a better way to add the controls of the Mapbox (eg. zoom and rotation controls). Currently I added the controls using the custom pin using the “PinComponent” props but I encountered an issue.
When there is no store on the user’s current location coordinate, the controls will not be displayed since the custom pin component doesn’t get mounted.
Looks like you can use providerOptions in mapconfig for managing and controlling the Zoom.
You can specify a JSON object to pass through to the map provider (Google or Mapbox) in your mapConfig.
for reference and more details, information is available on this page Maps | Hitchhikers
Thank you so much for the help. I am using MapboxMap react component for the project which I am not sure it is the same as Theme results page component. I have tried using MapBoxMap mapOptions parameter to use zoom control but was unable. Please let me know, thanks.
Hi @Shah_Emran
in case need of React Component, you can refer the same url shared in last post above to use mapboxoptions for implementing the Zoom control facility.
It is all about the React component available for implement the possible features on page. Feelfree to go through the information shared on the page to proceed with the implementation.
The page you referred in one of your answers has a link to the props that I can use for mapboxOptions but I need add one of the instance member for zoom control which is the addControl() inside the mapboxOptions. Do you have any example specific document for how to add instance members inside the mapboxOptions. Here is the link that I need to add inside the mapboxOptions. “https://docs.mapbox.com/mapbox-gl-js/api/map/#map#addcontrol”. Thank you again for your prompt repsonses.
@Lovely_Jaca
I not sure, but after analysis the Yext component and the component don’t provides the map instance, only on PinComponent, I did a copy from the original component here:
and
interface
export interface CustomMapboxMapProps<T> extends MapboxMapProps<T> {
/**
* Custom zoom controls for the map.
* Whether to show zoom controls on the map.
* */
zoomControls?: boolean
}