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.

iOS: Adding PointAnnotation with custom child causes map performance to drop

See original GitHub issue

Describe the bug
On iOS device, when I add a PointAnnotation component with custom children (works well with default marker - i.e. no children or when using Callout component), when I start moving the map or zooming in and out, the framerate drops down significantly

To Reproduce
Create a MapView with a single PointAnnotation component, with children (e.g. View component). Then start zooming in and out and moving the map around. You will see a significant drop in framerate.

Example:

import React from 'react';
import {
  MapView,
  PointAnnotation,
  Camera,
} from '@react-native-mapbox-gl/maps';

class BugReportExample extends React.Component {
  render() {
    return (
      <MapView style={{flex: 1}}>
        <Camera centerCoordinate={[-122.452652, 37.762963]} zoomLevel={14} />
        <PointAnnotation
          id='idPointAnnotation'
          coordinate={[-122.452652, 37.762963]}
        >
          <View
            style={{
              width: 40,
              height: 40,
              backgroundColor: 'red',
            }}
          />
        </PointAnnotation>
      </MapView>
    );
  }
}

Expected behavior
The framerate should not drop.

Actual behavior
Framerate drops when moving or zooming the map.

Screenshots If you look at the performance monitor, you will see a significant drop in framerate. ezgif-6-896f18386612

Versions (please complete the following information):

  • Platform: iOS
  • Platform OS: iOS 14.4
  • Device: iPhone X
  • Emulator/ Simulator: no
  • Dev OS: macOS 10.15.1
  • react-native-mapbox-gl Version 8.2.0-beta1
  • React Native Version 0.63.3

Additional context
Works well if remove the View component from inside the PointAnnotation component.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:18
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
sdacunhacommented, Aug 29, 2021

Hi @ferdicus,

Facing the same issue unfortunately. Using the Expo managed workflow + the expo plugin with 8.3.0. Unfortunately, on iOS, adding a child to the PointAnnotation component causes rendering issues whenever I move (fitBounds, setCamera, etc) the camera - seems mostly tied to zooms since panning doesn’t cause noticeable drops .

For now for the static pins I can use a ShapeSource + SymbolLayer, but I feel like this will become a blocker when I need dynamic content to be rendered.

FWIW, the same code does not experience frame drops on Android.

EDIT: Just got some more context potentially that may be helpful:

I ended up forking the project and hacking around the podspec + expo plugin to support the metal pre-release of MapLibre (5.13.0-pre.1) and the issue seems to have disappeared, so it could possibly be an upstream issue with the version of MapBox (5.9.0) used (seems that above it works with 6.3.0, but I am unable to test since I do not use MapBox tileservers anymore).

0reactions
stale[bot]commented, Apr 18, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

iOS: Adding PointAnnotation with custom child causes map ...
Framerate drops when moving or zooming the map. ... If you look at the performance monitor, you will see a significant drop in...
Read more >
Bountysource
iOS : Adding PointAnnotation with custom child causes map performance to drop.
Read more >
Swift 3 - MKPointAnnotation custom Image - Stack Overflow
I tried to use MKPinAnnotationView and MKAnnotationView but i couldn't add coordinates, subtitles and title. I'm new to iOS development.
Read more >
rnmapbox/Lobby - Gitter
It's part of the map, so has good performance, and pans smoothly. PointAnnotation same as MarkerView on iOS, on android it's emulated with ......
Read more >
Add a marker to the map | Maps SDK | iOS - Mapbox docs
Use MapView's AnnotationManager class to add a single red marker pin to the map using the Maps SDK for iOS.
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