nitaliano / react-native-mapbox-gl

A Mapbox GL react native module for creating custom maps
Other
2.16k stars 699 forks source link

App crashes while using images #1648

Closed kelcon closed 4 years ago

kelcon commented 4 years ago

On iOS:

import icon from '../assets/example.png';
this.source = { "type": "FeatureCollection", "features": [{"type":"Feature","properties":{"name":"Icon", "icon": "icon","rotation":270},"geometry":{"type":"Point","coordinates":[ 21.1, 52.1]}} ] };
<MapboxGL.Images images={{icon}} />
 <MapboxGL.ShapeSource id="_source" shape={this.source}>
<MapboxGL.SymbolLayer id="_layer"  style={ {iconImage: ['get', 'icon'] }  } />
</MapboxGL.ShapeSource>
kelcon commented 4 years ago

iconImage: '{icon}'

solved the problem (although not documented).