Skip to main content
FillLayer is a style layer that renders one or more filled (and optionally stroked) polygons on the map. Mapbox Style Specification

Props

id
string
required
A unique identifier for the layer.
existing
boolean
If true, references an existing layer in the style instead of creating a new one.
sourceID
string
default:"Mapbox.StyleSource.DefaultSourceID"
The source from which to obtain the data to style.
sourceLayerID
string
Identifier of the layer within the source identified by sourceID.
aboveLayerID
string
Inserts the layer above the specified layer ID.
belowLayerID
string
Inserts the layer below the specified layer ID.
layerIndex
number
Inserts the layer at a specified index.
slot
'bottom' | 'middle' | 'top'
The slot this layer is assigned to. v11 only
minZoomLevel
number
Minimum zoom level for layer visibility.
maxZoomLevel
number
Maximum zoom level for layer visibility.
filter
FilterExpression
Filters features based on a condition.
style
FillLayerStyleProps
Customizable style attributes.

Style Properties

style.visibility
'visible' | 'none'
default:"visible"
Controls layer visibility.
style.fillAntialias
boolean
default:"true"
Whether or not the fill should be antialiased.
style.fillOpacity
number
default:"1"
The opacity of the entire fill layer. Range: 0-1.
style.fillColor
string
default:"#000000"
The color of the filled part of this layer. Disabled by: fillPattern
style.fillOutlineColor
string
The outline color of the fill. Matches fillColor if unspecified. Disabled by: fillPattern
style.fillPattern
string
Name of image in sprite to use for drawing image fills.

Example

import { MapView, ShapeSource, FillLayer } from '@rnmapbox/maps';

const polygon = {
  type: 'Feature',
  geometry: {
    type: 'Polygon',
    coordinates: [[
      [-122.4, 37.8],
      [-122.4, 37.7],
      [-122.5, 37.7],
      [-122.5, 37.8],
      [-122.4, 37.8],
    ]],
  },
};

function Map() {
  return (
    <MapView>
      <ShapeSource id="polygon" shape={polygon}>
        <FillLayer
          id="polygon-fill"
          style={{
            fillColor: '#3bb2d0',
            fillOpacity: 0.5,
            fillOutlineColor: '#088',
          }}
        />
      </ShapeSource>
    </MapView>
  );
}

Build docs developers (and LLMs) love