Image
The Image component allows you to register a single image with the map using a React Native View as the source. This is useful for creating custom marker icons from React components.Import
Basic Usage
Props
name
ID of the image. This name is used to reference the image in layer styles.
sdf
Make image an SDF (Signed Distance Field) icon. SDF icons can be recolored using style properties.See SDF icons documentation for more information.
stretchX
An array of two-element arrays, consisting of two numbers that represent the from position and the to position of areas that can be stretched horizontally.Useful for creating resizable UI elements like buttons or speech bubbles.
stretchY
An array of two-element arrays, consisting of two numbers that represent the from position and the to position of areas that can be stretched vertically.Useful for creating resizable UI elements like buttons or speech bubbles.
content
An array of four numbers, with the first two specifying the left-top corner, and the last two specifying the right-bottom corner.If present, and if the icon uses
icon-text-fit, the symbol’s text will be fit inside the content box.scale
Scale factor for the image. Use values greater than 1 for higher resolution displays.
children
Single React Native view rendering the image. This can be any React Native component.
Methods
refresh()
Examples
- Custom Marker
- SDF Icon
- With FastImage
- Stretchable Image
Related Components
- Images - Container for multiple images
- SymbolLayer - Layer that displays icons and text
- ShapeSource - GeoJSON data source