Skip to content

Commit

Permalink
ts fixes for MapboxGLMap
Browse files Browse the repository at this point in the history
  • Loading branch information
igorDykhta committed Jun 28, 2022
1 parent 4907189 commit 97f2d4d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/components/map-container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

// libraries
import React, {Component, createRef} from 'react';
import MapboxGLMap from 'react-map-gl';
import MapboxGLMap, {MapRef} from 'react-map-gl';
import DeckGL from '@deck.gl/react';
import {createSelector} from 'reselect';
import WebMercatorViewport from 'viewport-mercator-project';
Expand Down Expand Up @@ -152,7 +152,7 @@ interface MapContainerProps {
onMapToggleLayer?: Function;
onMapStyleLoaded?: Function;
onMapRender?: Function;
getMapboxRef?: (mapbox?: MapboxGLMap | null, index?: number) => void;
getMapboxRef?: (mapbox?: MapRef | null, index?: number) => void;
index?: number;

locale?: any;
Expand Down Expand Up @@ -273,7 +273,7 @@ export default function MapContainerFactory(
}
};

_setMapboxMap: React.LegacyRef<MapboxGLMap> = mapbox => {
_setMapboxMap: React.Ref<MapRef> = mapbox => {
if (!this._map && mapbox) {
this._map = mapbox.getMap();
// i noticed in certain context we don't access the actual map element
Expand Down
4 changes: 2 additions & 2 deletions src/components/modals/add-map-style-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import React, {Component} from 'react';
import {polyfill} from 'react-lifecycles-compat';
import classnames from 'classnames';
import styled from 'styled-components';
import MapboxGLMap from 'react-map-gl';
import MapboxGLMap, {MapRef} from 'react-map-gl';
import {
StyledModalContent,
InputLight,
Expand Down Expand Up @@ -141,7 +141,7 @@ function AddMapStyleModalFactory() {
return null;
}

mapRef: MapboxGLMap | null | undefined;
mapRef: MapRef | null | undefined;
_map: mapboxgl.Map | undefined;

componentDidUpdate() {
Expand Down

0 comments on commit 97f2d4d

Please sign in to comment.