Skip to content

Commit 44d37d2

Browse files
authored
fix(images): register image views mounted after the map is ready (iOS) (#4423)
RNMBXImages wires its children into the style only from addToMap, through addImageViews. An RNMBXImage inserted later is appended to imageViews but never given `images`, so it never calls setImage and its name never reaches the style. A SymbolLayer that references it falls back or renders nothing. Applications work around it by remounting the whole <Images> block whenever a new image appears, which tears down and re-snapshots every image already on the map to add one. addImageView now wires the image immediately when the component already has a style. This is the iOS counterpart of #4283.
1 parent 8a55c05 commit 44d37d2

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎ios/RNMBX/RNMBXImages.swift‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ open class RNMBXImages : UIView, RNMBXMapComponent {
4444

4545
@objc public func addImageView(_ image: RNMBXImage) {
4646
imageViews.append(image)
47+
// addImageViews only runs from addToMap, so wire an image mounted after that here
48+
if style != nil {
49+
image.images = self
50+
}
4751
}
4852

4953
@objc public func removeImageView(_ image: RNMBXImage) {

0 commit comments

Comments
 (0)