Skip to content
This repository has been archived by the owner on Feb 6, 2020. It is now read-only.

Icon; where other properties? #10

Open
Daniil-Pabolkov opened this issue Mar 29, 2017 · 1 comment
Open

Icon; where other properties? #10

Daniil-Pabolkov opened this issue Mar 29, 2017 · 1 comment

Comments

@Daniil-Pabolkov
Copy link

Daniil-Pabolkov commented Mar 29, 2017

I look it: https://github.com/2gis/2gis-maps-react/blob/master/src/Icon.js
In the setIcon method I see the next code:

DG.icon({
    iconUrl: this.props.iconUrl,
    iconSize: this.props.iconSize
})

Where other properties? For example: I don't see iconAnchor property, but it's so much important.

Maybe, have make sense change setIcon method body to this.props.element.setIcon(DG.icon({...this.props}));

@Daniil-Pabolkov
Copy link
Author

I did extend Icon component. And it look like that:

import React from 'react';
import DG from '2gis-maps';
import {Icon as Icon2Gis} from '2gis-maps-react-patched';

export class Icon extends Icon2Gis {
	static propsTypes = {
		iconUrl: React.PropTypes.string,
		iconRetinaUrl: React.PropTypes.string,
		iconSize: React.PropTypes.array,
		iconAnchor: React.PropTypes.array,
		popupAnchor: React.PropTypes.array,
		shadowUrl: React.PropTypes.string,
		shadowRetinaUrl: React.PropTypes.string,
		shadowSize: React.PropTypes.array,
		shadowAnchor: React.PropTypes.array,
		className: React.PropTypes.string,
	};

	setIcon() {
		let {element, ...props} = this.props;
		element.setIcon(DG.icon(props));
	}
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant