Closed Epick362 closed 4 years ago
@Epick362 On iOS symbol layer supports taking snapshot of children, then adding that as image.
PointAnnotation has similiar code on android. https://github.com/react-native-mapbox-gl/maps/blob/master/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/annotation/RCTMGLPointAnnotation.java#L135
However it's less than ideal as there is no way to display different icons for symbols. We don't have this implemented in android. You can try to use react-native-view-shot or something similiar to capture view and convert to image, which symbol layer can render.
Thank you for the quick reply. So the text that is displayed on iOS is just a screenshot of SymbolLayer's children? I'm not sure I understand this part of your reply: "However it's less than ideal as there is no way to display different icons for symbols.". Wouldn't different children for each SymbolLayer create a different "screenshot" to display? Such solution would work for me and I can try implementing this on the android side with the PointAnnotation example you provided.
@Epick362 Yes that is screenshot of the RN view. Symbol layer displays images, it cannot display views on either platform.
Yes different SymbolLayers can display different images (with the current subchildern solution). But you can only have 1 image type in SymbolLayer. Normally a single simbol layer can have different image by using SymbolLayer#iconImage expression, see ShapeSourceIcon example
As a Workaround I started using the Visibility property in Symbol Layer, I know this is a not a good solution but for now it worked for me.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Please re-open this issue. Android does not support symbol layer children?
Yeah... iOS has no problem rendering arbitrary elements inside SymbolLayer. Why is it not the same for Android?
Any progress on this? Has anyone gotten children in SymbolLayer to work on Android?
Hi all. Can we please reopen this issue? I still haven't found any solutions for Android.
Yes, please reopen it
any solution?
+1
please reopen this issue
@Mstolarek it’s now deprecated on iOS too - see https://github.com/rnmapbox/maps/wiki/Deprecated-SymbolLayerChildren
Describe the bug I am looking for a way to display custom Symbols (in this case a FontAwesome Icon from rn-vector-icons). I have found issue #225 detailing a way to display such Icons inside SymbolLayer, the caveat being that this method works on iOS but not on Android as @arnaudambro tested https://github.com/react-native-mapbox-gl/maps/issues/225#issuecomment-573058350.
I have tried narrowing the issue down although I do not understand native components very well but I noticed iOS has this section in RCTMGLSymbolLayer.m
Whereas RCTMGLSymbolLayerManager.java or RCTMGLSymbolLayer.java is missing any mention of children.
To Reproduce Code to reproduce is included here: https://github.com/react-native-mapbox-gl/maps/issues/225#issuecomment-573058350
Expected behavior Consistently render SymbolLayer children on both platforms.
Screenshots iOS Android
Versions (please complete the following information):