rnmapbox / rnmapbox/maps

[Bug]: insertReactSubview crash if rapidly changed markers

Open
#3,891 3 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug 🪲 Needs: Author Feedback Needs: Repro
Dominant language
Kotlin
Stars
2.9k
Forks
947
Avg merge
6d 37m
Merged PRs (30d)
1

Description

Mapbox Implementation

Mapbox

Mapbox Version

11.12.0

React Native Version

0.80.0

Platform

iOS

@rnmapbox/maps version

10.1.39

Standalone component to reproduce
import React from 'react';
import {
  MapView,
  ShapeSource,
  LineLayer,
  Camera,
} from '@rnmapbox/maps';

const aLine = {
  type: 'LineString',
  coordinates: [
    [-74.00597, 40.71427],
    [-74.00697, 40.71527],
  ],
};

class BugReportExample extends React.Component {
  render() {
    return (
      <MapView style={{flex: 1}}>
        <Camera centerCoordinate={[-74.00597, 40.71427]} zoomLevel={14} />
        <ShapeSource id="idStreetLayer" shape={aLine}>
          <LineLayer id="idStreetLayer" />
        </ShapeSource>
      </MapView>
    );
  }
}
Observed behavior and steps to reproduce

*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM insertObject:atIndex:]: index 7 beyond bounds [0 .. 5]'
*** First throw call stack:

  @objc open override func insertReactSubview(_ subview: UIView!, at atIndex: Int) {
    addToMap(subview)
    super.insertReactSubview(subview, at: atIndex)
  }
Expected behavior

No response

Notes / preliminary analysis

No response

Additional links and references

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided iOS standalone reproduction with @rnmapbox/maps 10.1.39, Mapbox 11.12.0, and React Native 0.80.0 while rapidly changing markers. Inspect insertReactSubview(_:,at:) and the reported NSRangeException; done should mean the reproduction no longer crashes, with the expected behavior clarified before implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native, swift
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.