gribnoysup / react-yandex-maps

Yandex Maps API bindings for React
MIT License
329 stars 116 forks source link

How to open specific ballon by click on a button? #156

Closed chuprik closed 5 years ago

chuprik commented 5 years ago

I have a list with an address list and when a user clicks on an address balloon must open. How I can implement this? Plus I'm using the cluster feature.

A rough example:

react-yandex-maps issue

I tried to do an array with refs and then search a ref and open but it's ugly and works only without the cluster feature.

I think much relevant doc article is https://tech.yandex.ru/maps/jsbox/2.1/object_manager_balloon, I didn't try ObjectManager and I will go to try it in a few mins :)

Thanks!

mmarkelov commented 5 years ago

@kotchuprik i think you will understand idea: Edit react-yandex-maps issue #165

chuprik commented 5 years ago

thanks! that looks good for me, going to check for my case.

chuprik commented 5 years ago

well, I have another question :D how I can zoom to cluster automatically? I do not need two column balloon view I need just open balloon X for button X.

chuprik commented 5 years ago

I did it! I just must to add instanceRef={ref => this.map = ref} to my Map and then this.map.setCenter :)