\n \n {this.props.children}\n
\n \n );\n }\n\n static mountObject(parentElement, Map, props) {\n const { instanceRef, _events } = events.separateEvents(props);\n\n const state = getProp(props, 'state');\n const options = getProp(props, 'options');\n\n const instance = new Map(parentElement, state, options);\n\n Object.keys(_events).forEach(key =>\n events.addEvent(instance, key, _events[key])\n );\n\n applyRef(null, instanceRef, instance);\n\n return instance;\n }\n\n static updateObject(instance, oldProps, newProps) {\n const { _events: newEvents, instanceRef } = events.separateEvents(newProps);\n const { _events: oldEvents, instanceRef: oldRef } = events.separateEvents(\n oldProps\n );\n\n if (isControlledProp(newProps, 'state')) {\n const oldState = getProp(oldProps, 'state', {});\n const newState = getProp(newProps, 'state', {});\n\n if (oldState.type !== newState.type) {\n instance.setType(newState.type);\n }\n\n if (oldState.behaviors !== newState.behaviors) {\n if (oldState.behaviors) instance.behaviors.disable(oldState.behaviors);\n if (newState.behaviors) instance.behaviors.enable(newState.behaviors);\n }\n\n if (newState.zoom && oldState.zoom !== newState.zoom) {\n instance.setZoom(newState.zoom);\n }\n\n if (newState.center && oldState.center !== newState.center) {\n instance.setCenter(newState.center);\n }\n\n if (newState.bounds && oldState.bounds !== newState.bounds) {\n instance.setBounds(newState.bounds);\n }\n }\n\n if (isControlledProp(newProps, 'options')) {\n const oldOptions = getProp(oldProps, 'options');\n const newOptions = getProp(newProps, 'options', {});\n\n if (oldOptions !== newOptions) {\n instance.options.set(newOptions);\n }\n }\n\n if (\n getProp(oldProps, 'width') !== getProp(newProps, 'width') ||\n getProp(oldProps, 'height') !== getProp(newProps, 'height')\n ) {\n instance.container.fitToViewport();\n }\n\n events.updateEvents(instance, oldEvents, newEvents);\n\n applyRef(oldRef, instanceRef, instance);\n }\n\n static unmountObject(instance, props) {\n const { instanceRef, _events } = events.separateEvents(props);\n\n if (instance !== null) {\n Object.keys(_events).forEach(key =>\n events.removeEvent(instance, key, _events[key])\n );\n\n instance.destroy();\n\n // Clean used ref\n applyRef(instanceRef);\n }\n }\n}\n\nif (process.env.NODE_ENV !== 'production') {\n const MapStatePropTypes = {\n bounds: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.number)),\n center: PropTypes.arrayOf(PropTypes.number),\n controls: PropTypes.arrayOf(PropTypes.string),\n behaviors: PropTypes.arrayOf(PropTypes.string),\n margin: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.number),\n PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.number)),\n ]),\n type: PropTypes.oneOf(['yandex#map', 'yandex#satellite', 'yandex#hybrid']),\n zoom: PropTypes.number,\n };\n\n // TODO: https://tech.yandex.com/maps/doc/jsapi/2.1/ref/reference/Map-docpage/\n const MapOptionsPropTypes = {};\n\n Map.propTypes = {\n /**\n * [Map state parameters](https://tech.yandex.com/maps/doc/jsapi/2.1/ref/reference/Map-docpage/#param-state)\n */\n state: PropTypes.shape(MapStatePropTypes),\n /**\n * Uncontrolled [Map state parameters](https://tech.yandex.com/maps/doc/jsapi/2.1/ref/reference/Map-docpage/#param-state)\n */\n defaultState: PropTypes.shape(MapStatePropTypes),\n\n /**\n * [Map options](https://tech.yandex.com/maps/doc/jsapi/2.1/ref/reference/Map-docpage/#Map__param-options)\n */\n options: PropTypes.shape(MapOptionsPropTypes),\n /**\n * Uncontrolled [Map options](https://tech.yandex.com/maps/doc/jsapi/2.1/ref/reference/Map-docpage/#Map__param-options)\n */\n defaultOptions: PropTypes.shape(MapOptionsPropTypes),\n\n /**\n * YMaps object ref\n */\n instanceRef: PropTypes.func,\n\n ymaps: PropTypes.object,\n\n children: PropTypes.node,\n\n /**\n * Yandex.Maps Map parent element should have at least\n * some size set to it, otherwise the map is rendered\n * into the container with size 0\n *\n * To avoid this we will use `width` and `height` props as default\n * way of sizing the map element, but then if we see that\n * the library user also provides `style` or `className` prop,\n * we will assume that the Map is sized by those and will\n * not use these\n */\n\n /**\n * Map container width\n */\n width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n\n /**\n * Map container height\n */\n height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n\n /**\n * Map container style\n */\n style: PropTypes.object,\n\n /**\n * Map container className\n */\n className: PropTypes.string,\n };\n}\n\nMap.defaultProps = {\n width: 320,\n height: 240,\n};\n\nexport default withYMaps(Map, true, ['Map']);\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport { getProp, isControlledProp } from './util/props';\nimport withYMaps from './withYMaps';\nimport * as events from './util/events';\nimport applyRef from './util/ref';\nimport getParentElementSize from './util/getParentElementSize';\n\nexport class Panorama extends React.Component {\n constructor() {\n super();\n this.state = { instance: null };\n this._parentElement = null;\n this._getRef = ref => {\n this._parentElement = ref;\n };\n }\n\n componentDidMount() {\n this._mounted = true;\n\n if (!this.props.ymaps.panorama.isSupported()) {\n return;\n }\n\n Panorama.mountObject(\n this._parentElement,\n this.props.ymaps.panorama,\n this.props\n ).then(instance => this._mounted && this.setState({ instance }));\n }\n\n componentDidUpdate(prevProps) {\n if (this.state.instance !== null) {\n Panorama.updateObject(this.state.instance, prevProps, this.props);\n }\n }\n\n componentWillUnmount() {\n this._mounted = false;\n Panorama.unmountObject(this.state.instance, this.props);\n }\n\n render() {\n const parentElementStyle = getParentElementSize(this.props);\n\n return