SymbolLayer children don't render on Android
See original GitHub issueDescribe 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
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-missing-super-calls"
- (void)insertReactSubview:(id<RCTComponent>)subview atIndex:(NSInteger)atIndex {
[_reactSubviews insertObject:(UIView *)subview atIndex:(NSUInteger) atIndex];
}
#pragma clang diagnostic pop
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-missing-super-calls"
- (void)removeReactSubview:(id<RCTComponent>)subview {
[_reactSubviews removeObject:(UIView *)subview];
}
#pragma clang diagnostic pop
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-missing-super-calls"
- (NSArray<id<RCTComponent>> *)reactSubviews {
return nil;
}
#pragma clang diagnostic pop
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):
- Platform: Android
- Device: any
- Emulator/ Simulator: no
- OS: Android 9
- react-native-mapbox-gl Version 7.2.0
- React Native Version 0.61.5
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (3 by maintainers)
Top GitHub Comments
Please re-open this issue. Android does not support symbol layer children?
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.