Siang Cheng Pang
Siang Cheng Pang

Reputation: 93

react-native-mapbox-gl / Unable to use number[] in any types of expression

I have a SymbolLayer of which I want to set its iconTranslate to some dynamic values, but however for some reason no expressions is working on the field:

      <MapboxGL.SymbolLayer
        id="img"
        style={{
          iconOpacity: 1,
          iconImage: ['get', 'img'],
          iconSize: ['interpolate', ['linear'], ['zoom'], 13, 0.5, 22, 0.75],
          iconAllowOverlap: true,
          textAllowOverlap: true,
          iconAnchor: 'center',
          iconTranslateAnchor: 'viewport',
          iconTranslate: ['get', 'offset'], //NOT WORKING
        }}
      />

Doesn't matter if offset is set, or if I use [['get', 'x'], ['get', 'y']] or any workarounds I can think of, there seems to be no way to get a dynamic values that's not a double onto the field.

Thanks for your time.

Upvotes: 0

Views: 20

Answers (0)

Related Questions