При изменние props карта не отображается пока не взаимодействуешь с ней

При изменении currentCoord карта (серый фон) не появится, пока вы не нажмете на саму карту

Если убрать компонент CustomMarker то все работает

const CustomMarker = ({title}) => (
    <div className="main-map__marker">
        {title}
        <span className="main-map__triangle"/>
    </div>
)

CustomMarker.propTypes = {
    title: PropTypes.string.isRequired
};


class SimpleMap extends Component {

    static propTypes = {
        city: PropTypes.string.isRequired
    };

    render() {
        const currentCoord = coord[this.props.city];
        return (
            <div className="main-map__body">
                <GoogleMapReact
                    bootstrapURLKeys={{key: ''}}
                    options={{
                        styles:                 stylesMap,
                        scrollWheel:            false,
                        disableDefaultUI:       true,
                        disableDoubleClickZoom: true,
                        draggable:              true
                    }}
                    center={currentCoord.center}
                    defaultZoom={currentCoord.zoom}
                >
                    <CustomMarker
                        title={currentCoord.title}
                        lat={currentCoord.center.lat}
                        lng={currentCoord.center.lng}
                    />
                </GoogleMapReact>
            </div>
        );
    }
}

если вы показываете компонент CustomMarker, то есть проблема, а если вы удаляете CustomMarker, то при изменении Props карта заменяется


Ответы (0 шт):