Maps: iOS: SymbolLayer icons don't load

Created on 21 Nov 2020  路  13Comments  路  Source: react-native-mapbox-gl/maps

Describe the bug
On iOS, images added through MapboxGL.Image fail to load.
Using a URL (e.g. https://cdn.onlinewebfonts.com/svg/img_525159.png) works, but loading from disk seems to result in something else entirely.

To Reproduce

Example:

const images = {
  marker_red: require("./markers/marker_red.png"),
  marker_orange: require("./markers/marker_orange.png"),
  marker_yellow: require("./markers/marker_yellow.png"),
  marker_limegreen: require("./markers/marker_limegreen.png"),
  marker_green: require("./markers/marker_green.png"),
}

<MapboxGL.MapView>
  <MapboxGL.Images images={images} />
  <MapboxGL.ShapeSource
    id="reports-source"
    shape={{
      type: "FeatureCollection",
      features: rootStore.reportFeatures,
    }}
  >
    <MapboxGL.SymbolLayer
      id="report-markers"
      style={{
        iconImage: ["get", "icon"],
        iconSize: 0.025,
        iconAllowOverlap: true,
      }}
    />
  </MapboxGL.ShapeSource>
</MapboxGL.MapView>;

Expected behavior
I expect to see markers on the map, like I do on Android.

The markers are actually present on the map because I can tap on them and get a callback, but they seem to be transparent (or 'missing').

|Android|iOS|
|-|-|
|Screenshot_20201121-183445|Simulator Screen Shot - iPhone 12 Pro Max - 2020-11-21 at 19 30 08|

Versions

  • Platform: iOS
  • Device: iPhone XR (physical device), iPhone 12 Pro Max (simulator)
  • Emulator/Simulator: both
  • OS: iOS 14.1
  • react-native-mapbox-gl Version: 8.1.0-rc.8
  • React Native Version: 0.63.3
Author Feedback Verify on Latest Version

Most helpful comment

Cool, glad I could help - looks like a great product.
Let us know if you find any other issues and contribution are always welcome :)

All 13 comments

I've a feeling this might be related to: https://github.com/facebook/react-native/issues/29279

@developius, can you please try one of the mentioned solutions and report back to us - thanks in advance 馃檱馃徔

Hey @ferdicus,

I tried the patch from: https://github.com/facebook/react-native/issues/29279#issuecomment-658244428
And also the one here: https://github.com/facebook/react-native/issues/29279#issuecomment-657201709

Neither seem to work for the Mapbox icons. I have a standard <Image> loading correctly in my app so not sure if it's related or not.

This is what I now get 馃槅

This is what I now get 馃槅

Oh lovely... 馃槅

I'll have a look - might take a few days though, hope that's ok

@ferdicus no problem 馃 let me know if you need any more info. I can ship Android anyway 馃榿

@ferdicus not sure if it helps, but I'm getting this exception when getting to the minZoomLayer of the SymbolLayer with failing icons.

Hey @ferdicus, did you get anywhere with this?

hey, sorry for getting back so late to you.

Can you do me a favor and try the /example app within our repo.
In there is a scene called: Symbol/CircleLayer => Shape Source From Icon
Source of that file: https://github.com/react-native-mapbox-gl/maps/blob/master/example/src/examples/ShapeSourceIcon.js

I tried it on simulator/ emulator and it works fine on current master:

| ANDROID | iOS |
|---|---|
| | |

@ferdicus not sure if it helps, but I'm getting this exception when getting to the minZoomLayer of the SymbolLayer with failing icons.

I think you can dismiss this one for the issue at hand.
Seems to be related to an error loading tiles from your map server

@ferdicus yeah, that appears to work on iOS 14.2 simulator.
I'll see if I can work out what I'm doing differently in my app.

@ferdicus think I figured it out 馃
My images were _massive_ (like 4500x3000px). Once I realised and scaled them down, everything started looking good again 馃榿

This is a screenshot from v2 of Sandfly Map which I'm in the midst of rebuilding with this library.
Thanks for your help!

Cool, glad I could help - looks like a great product.
Let us know if you find any other issues and contribution are always welcome :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

atomheartother picture atomheartother  路  3Comments

dorthwein picture dorthwein  路  3Comments

fvieira picture fvieira  路  4Comments

ivari picture ivari  路  3Comments

gmaclennan picture gmaclennan  路  3Comments