gribnoysup / react-yandex-maps

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

How to use LoadingObjectManager? Are there any solutions? #116

Open kshepelev opened 5 years ago

kshepelev commented 5 years ago

Hi!

react-yandex-maps has ObjectManager component for managment of object collections, but I need dinamically load objects with LoadingObjectManager in yandex API.

Are there any solutions for this with the current version of react-yandex-maps or do I need to create wrapper component for LoadingObjectManager as an ObjectManager?

mmarkelov commented 5 years ago

@nadador2011 Hi! There is no solution for LoadingObjectManager, you can use hoc withYMaps. You can check it here. I need time to figure out on implementation, cause I just haven't got any experience with it.

kshepelev commented 5 years ago

@mmarkelov Yes, when I use hoc withYMaps I can use LoadingObjectManager const objectManager = new ymaps.LoadingObjectManager('https://myServer.com/tile?bbox=%b, {}) as described in the yandex API documentation, but after that it's necessarry add objectManager to the map myMap.geoObjects.add(objectManager). In the react-yandex-maps it's implemented with hoc withParentContext, but it's inner component of react-yandex-maps.

ObjectManager, LoadingObjectManager, RemoteObjectManager extends the same objects and has the same way of adding them to map myMap.geoObjects.add(objectManager), therefore I think it would be great, if react-yandex-maps would have component for adding objectManager to the map, instead of separate components for ObjectManager(already implemented), LoadingObjectManager and RemoteObjectManager.

mmarkelov commented 5 years ago

@nadador2011 I just started work on it. So you can check my branch It will be very helpful if you could provide some example of LoadingObjectManager cause I just don't have any experience with it and it is a bit difficult to work with it