You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importReact,{View}from'react';importMapboxfrom'@rnmapbox/maps';Mapbox.setAccessToken('<access token>')exportdefaultfunctionExampleMap(){const[mapPinFeatures,setMapPinFeatures]=React.useState(null)const[mapKey,setMapKey]=React.useState(Date.now())constmap=React.useRef(null)constcamera=React.useRef(null)functiononLongPress(data){setMapPinFeatures({type: 'FeatureCollection',features: [{type: 'Feature',id: 'collection',properties: {},geometry: {type: 'Point',coordinates: data.coordinates}}]})// Need to do this or changing the feature without re-rendering the ShapeSource causes Android version to crashsetMapKey(Date.now())}return(<Viewstyle={{flex: 1,width: '100%'}}><Mapbox.MapViewref={(ref)=>{map.current=ref}}styleURL={Mapbox.StyleURL.Light}style={{flex: 1,width: '100%'}}zoomEnabledpitchEnabled={false}logoEnabled={false}scaleBarEnabled={false}onLongPress={onLongPress}><Mapbox.Cameraref={(ref)=>{camera.current=ref}}animationMode="moveTo"defaultSettings={{zoomLevel: 13,centerCoordinate: [-0.1996,5.5837]}}/>{mapPinFeatures
? (<Mapbox.ShapeSourcekey={mapKey}shape={mapPinFeatures}><Mapbox.SymbolLayerid={'pin'}style={{iconImage: 'map_marker_start',iconAllowOverlap: false}}/><Mapbox.ImagesnativeAssetImages={['map_marker_start']}/></Mapbox.ShapeSource>)
: null}</Mapbox.MapView></View>)}
Observed behavior and steps to reproduce
When long pressing on the map I get the coordinates data, but when I set the shape property of ShapeSource with the FeatureCollection and the desired image, I get no image appearing on the screen.
Please note that I have tried using an imported or required image and also an asset image that is pre configured in Android. I know the asset image is loaded because when I do not use the correct asset image name, I get the error: "Mapbox error cound not get native drawable with name..."
Steps to Reproduce:
set shape of ShapeSource component with feature collection and one feature with coordinate
no image (Android asset image) appears on the map
Expected behavior
set shape of ShapeSource component with feature collection and one feature with coordinate
image (Android asset image) appears on the map at the coordinate specified in the feature
Notes / preliminary analysis
No response
Additional links and references
No response
The text was updated successfully, but these errors were encountered:
Mapbox Implementation
Mapbox
Mapbox Version
default
React Native Version
0.72.4
Platform
Android
@rnmapbox/maps
version10.1.13
Standalone component to reproduce
Observed behavior and steps to reproduce
When long pressing on the map I get the coordinates data, but when I set the shape property of ShapeSource with the FeatureCollection and the desired image, I get no image appearing on the screen.
Please note that I have tried using an
imported
orrequired
image and also an asset image that is pre configured in Android. I know the asset image is loaded because when I do not use the correct asset image name, I get the error: "Mapbox error cound not get native drawable with name..."Steps to Reproduce:
Expected behavior
Notes / preliminary analysis
No response
Additional links and references
No response
The text was updated successfully, but these errors were encountered: