Skip to content

can not draw when using custom style in MapGL #11

@timeroute

Description

@timeroute

When I use custom style in MapGL, I can not draw with react-map-gl-draw, It raised the error as follow:

Uncaught TypeError: Cannot read property 'setDirty' of null

Here is my code:

<MapGL
    style={{ width: "100%", height: "400px" }}
    mapStyle={{
            version: 8,
            name: 'custom',
            glyphs: 'http://.../font/{fontstack}/{range}.pbf',
            sources: {
              ...
            },
            layers: [
              ...
            ]
          }}
    accessToken={MAPBOX_ACCESS_TOKEN}
    latitude={35.78}
    longitude={119.41}
    zoom={8}
  >
    <Draw
        mode={state.mode}
        onDrawModeChange={({ mode }) => setState({ mode })}
    />
  </MapGL>

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions