Images
The Images component defines the images used in Symbol and other layers. It provides a way to register images with the map so they can be referenced in layer styles.Import
Basic Usage
Props
images
Specifies the external images in key-value pairs required for the shape source. Keys are names that can be referenced in layer styles (e.g., in
iconImage expressions). Values can be:- URL strings (e.g.,
'https://...','file://...','asset://...') - Objects with format
{ uri: 'http://...' } require('image.png')import 'image.png'- Objects with additional properties for SDF icons and stretchable images
nativeAssetImages
If you have assets under
Image.xcassets on iOS and the drawables directory on Android, you can specify an array of string names or objects with additional properties.Objects can include properties for SDF icons and stretchable images:name: string - The asset namesdf: boolean - Whether the image is an SDF iconstretchX: [number, number][] - Horizontal stretch areasstretchY: [number, number][] - Vertical stretch areascontent: [number, number, number, number] - Content box for text fittingscale: number - Scale factor
onImageMissing
Called when a layer is trying to render an image whose key is not present in any of the
Images components of the map. This is useful for lazy-loading images.children
Child
Image components for more advanced image configuration. Each child must be an Image component.Examples
- Basic Images
- SDF Icons
- Native Assets
- Lazy Loading
Related Components
- Image - Individual image component
- SymbolLayer - Layer that displays icons and text
- ShapeSource - GeoJSON data source