Alireza Noori
Alireza Noori

Reputation: 178

Mapbox React Native, ShapeSource#images is deprecated, please use Images#images

I'm using the last version of MapBox React Native on my project, and everything is working great except I'm getting a warning, ShapeSource#images is deprecated, please use Images#images how can I fix that?

thanks for your help

Edit: my implementation after riastard answer, I hope it helps someone.

    <>
            <MapboxGL.Images
              images={{someIcon: someIcon, someIcon2: someIcon2, someIcon3: someIcon3}}
            />
            <MapboxGL.ShapeSource
            id="symbolLocationSource"
            hitbox={{ width: 20, height: 20 }}
            onPress={this.onSourceLayerPress}
            shape={featureCollection}
            >

            <MapboxGL.SymbolLayer
              id="symbolLocationSymbols"
              minZoomLevel={1}
              style={{
                iconImage: '{icon}',
                iconSize: 0.25,
                iconAllowOverlap: true
              }}
            />

          </MapboxGL.ShapeSource>
    </>

Upvotes: 4

Views: 1310

Answers (1)

riastrad
riastrad

Reputation: 1774

Based on the descriptive error you're seeing, it sounds like you can avoid this warning by using the Images object to indicate what client side bitmap/drawable to use as the icon for your symbol layer rather than the older API. Doing this now will probably save you some frustration in the future when ShapeSource#images is fully deprecated.

Upvotes: 2

Related Questions