maplibre-react-native
maplibre-react-native copied to clipboard
MGLSymbolStyleLayer incorrect scale in release build
trafficstars
Steps to Trigger Behavior
- create a MGLSymbolStyleLayer with some image
- observe image size differs based on build configuration
Minimal Reproducible Example
const point_icon = require('@assets/icons/point/Group.png');
<MapLibreGL.SymbolLayer id={id + '_layer'} style={{ iconImage: point_icon }} />
where @assets/icons/point/Group.png has [email protected] and [email protected] variants
point_asset_image.zip
Expected Behavior
Image stays same size as in debug build
Actual Behavior
Image is @3x.png scale size instead
Screenshots (if applicable)
| release | debug |
|---|---|
![]() |
![]() |
Version(s) affected
- Platform: iOS
- OS version: 16.4.1
- Device type: iPhone 14 Pro Max
- Development OS: macOS 13.3.1 (22E261)
- maplibre-react-native Version 9.0.1
- React Native Version: 0.71.6
Additional context
Maybe related to https://github.com/facebook/react-native/issues/28670
workaround: remove @2 and @3 scales of the asset, make the @3 size default, but multiply iconSize by 0.3.

I've created these assets:
And tested with this example:
import {
MapView,
ShapeSource,
SymbolLayer,
} from "@maplibre/maplibre-react-native";
import { Image } from "react-native";
import image from "../assets/images/example.png";
export function BugReport() {
return (
<>
<Image source={image} />
<MapView style={{ flex: 1 }}>
<ShapeSource id="shape" shape={{ type: "Point", coordinates: [0, 0] }}>
<SymbolLayer id="symbol" style={{ iconImage: image }} />
</ShapeSource>
</MapView>
</>
);
}
Tested with debug and release builds:
| Debug | Release |
|---|---|
When measuring the images they are both inside and outside the map in the corresponding pixel ratio size. I guess this is fixed by any of the previous upgrades.

