question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SymbolLayer fading out when zooming out of map

See original GitHub issue

Describe the bug SymbolLayer is flickering/fading when zooming out (in sync with text labels on the map).

To Reproduce Zoom out of the map.

const iconStyles =  {
  icon: {
    iconImage: ['get', 'icon'],
    iconSize: 1,
    iconAllowOverlap: true,
  }
};

return (
  <MapboxGL.MapView
    scrollEnabled={!this.initialFit}
    ref={(ref) => { this.map = ref; }}
    style={styles.flex}
    logoEnabled={false}
    contentInset={[16, 16, 200, 16]}
    onRegionDidChange={(region) => this.setState({ region })}
  >
    <MapboxGL.UserLocation onUpdate={(e) => this.setState({ userLocation: e ? e.coords : null })} />
    <MapboxGL.Images images={images} />
    <MapboxGL.ShapeSource
      id="buses"
      shape={vehiclesGeo}
    >
      <MapboxGL.SymbolLayer id="bus" iconImage="marker" style={mappyStyles.icon} />
    </MapboxGL.ShapeSource>
    <MapboxGL.Camera minZoomLevel={2} maxZoomLevel={18} />
  </MapboxGL.MapView>
);

Expected behavior The SymbolLayer should not be flickering.

Screenshots Demo gif

Versions (please complete the following information):

  • Platform: iOS
  • Device: iPhone 8
  • Emulator/ Simulator: No
  • OS: iOS 13.4.1
  • react-native-mapbox-gl Version 8.0.0
  • React Native Version 0.62.2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
jbreuer95commented, Oct 15, 2021

It happens only when zooming out. If you need more info please let me know 😃

ezgif com-gif-maker (2)

Platform: Android Device: Pixel 4a Emulator/ Simulator: No OS: Android 11 react-native-mapbox-gl Version 8.3.0 React Native Version 0.64.2 Maplibre Version 9.2.1

 const icon = {
    iconImage: ['get', 'icon'],
    iconAllowOverlap: true,
    iconSize: 0.3,
  };

  return (
    <View style={styles.container}>
      <StatusBar style="auto" />
      <MapboxGL.MapView
        ref={c => {
          map.current = c;
        }}
        style={styles.map}
        styleURL="https://example.com/style.json"
        logoEnabled={false}
        attributionEnabled={false}
        rotateEnabled={false}>
        <MapboxGL.Camera
          zoomLevel={0}
          minZoomLevel={0}
          maxZoomLevel={7}
          maxBounds={{
            ne: [180, -85.051129],
            sw: [-180, 85.051129],
          }}
        />
        <MapboxGL.Images
          images={{
            tower: require('./assets/tower.png'),
            shrine: require('./assets/shrine.png'),
          }}
        />
        {/* {renderTowers()} */}
        <MapboxGL.ShapeSource id="towers" shape={getTowers()}>
          <MapboxGL.SymbolLayer id="towers" style={icon} />
        </MapboxGL.ShapeSource>
        <MapboxGL.ShapeSource id="shrines" shape={getShrines()}>
          <MapboxGL.SymbolLayer id="shrines" style={icon} minZoomLevel={1} />
        </MapboxGL.ShapeSource>
      </MapboxGL.MapView>
    </View>
  );
  
 const styles = StyleSheet.create({
  container: {
    flex: 1,
    paddingTop: 54,
    backgroundColor: 'black',
    justifyContent: 'center',
    alignItems: 'center',
  },
  map: {
    flex: 1,
    height: '100%',
    width: '100%',
  },
});

0reactions
ferdicuscommented, Oct 21, 2021

@ferdicus that was what i was afraid of. Thanks for clarifying 😃

If it makes you feel any better, I feel like this is more straight forward than the iOS part 😅

Read more comments on GitHub >

github_iconTop Results From Across the Web

SymbolLayer component image flickering/fading after ... - GitHub
This happens only when MapView is zoomed in. If I zoom out up to a specific level - flickering stops. That can be...
Read more >
Make symbol layer icon-size zoom invariant - Stack Overflow
I am attempting to place a hexagon (centred over co-ordinates) which I can interact with, hover/onclick. The method I am using is to...
Read more >
Layers | Style Specification | Mapbox GL JS
Raster map textures such as satellite imagery. ... The background style layer covers the entire map. ... Fade out the halo towards the...
Read more >
Map | Maplibre gl js - Documentation Portal - MapTiler
When the map is zoomed out far enough that a single representation of the world does not fill the map's entire container, there...
Read more >
Making points count automatically when zooming out in QGIS?
Can I make the point count itself when there are too much stacked up points in one area when I zoom out my...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found