maps: Can't press ShapeSource on top of UserLocation
Hello,

I have a SymbolLayer located underneath the UserLocation, and I wish the SymbolLayer to be pressable.
But it seems it can’t be done: when I press the icon, it is actually the UserLocation which is pressed, and the UserLocation onPress event doesn’t have any argument and doesn’t have a pointerEvents prop or equivalent.
Is there a way to get to the SymbolLayer ?
Again, great repo, and greater to become, thanks all for the work done !
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 15 (7 by maintainers)
Commits related to this issue
- feat: override mapbox userlocation with custom userlocation There's a known issue with rnmapbox where the blue userlocation circle prevents taps on nearby location markers. The recommended workaround... — committed to techmatters/terraso-mobile-client by ajabeckett 8 months ago
- feat: override mapbox userlocation with custom userlocation There's a known issue with rnmapbox where the blue userlocation circle prevents taps on nearby location markers. The recommended workaround... — committed to techmatters/terraso-mobile-client by ajabeckett 8 months ago
- feat: home screen updates (#524) * feat: clear search input #436 * feat: override mapbox userlocation with custom userlocation There's a known issue with rnmapbox where the blue userlocation... — committed to techmatters/terraso-mobile-client by ajabeckett 8 months ago
Alright, with a proper utilisation of
belowLayerIDandaboveLayerId, I got this working. SUppose yourSymbolLayerwithin yourShapeSourcehas anidofmarkersSymbol, here is the code I used for theUserLocation@kristfal I don’t think this is a narrow usecase… If anyone has custom markers rendered (think of the earthquake example) which are clickable, none can be clicked if they are within a 1inch by 1inch square of UserLocation…
Workaround can be to put a transparent layer on top of the layer in the shape source with a higher index than user location.
We could accept a PR with a prop on UserLocation that disables the on press listener, but I honestly feel like this is a very narrow usecase with a functional workaround.
@arnaudambro Thank you very much for your help! I’m getting a step closer to what i’m looking for.
With your solution, user is hidden below the symbol so it can not be seen. What I’m trying to do is to have user on the top of the symbol but the user layer not capturing onPress event that way the layer of the symbol could catch the onPress event.
For know I did set a pulse circleRadius larger than my symbol that way the user can still guess where he is located on the map by seeing a part of the pulse circle. Bad UX but better than seeing nothing 😄