Skip to content

[Bug]: App crash due to nil unwrapping in gestureSettings on MapView #3183

@ysainson

Description

@ysainson

Mapbox Implementation

Mapbox

Mapbox Version

11.0.0-rc.1

Platform

iOS

@rnmapbox/maps version

10.1.0-beta.20

Standalone component to reproduce

import * as React from "react";

import { Platform, StyleSheet } from "react-native";
import Mapbox, { StyleImport } from "@rnmapbox/maps";

interface MapViewProps {}

const MapView = (props: MapViewProps) => {
  const {} = props;

  // refs
  const mapRef = React.useRef<Mapbox.MapView>(null);

  // render
  return (
    <Mapbox.MapView
      ref={mapRef}
      // zoomEnable={true} // same behavior
      gestureSettings={{
        rotateEnabled: false,
      }}
      style={{ flex: 1 }}
      styleURL="mapbox://styles/mapbox/standard-beta"
    >
      <StyleImport
        id="basemap"
        existing
        config={{
          lightPreset: "dusk",
          // @ts-ignore
          showRoadLabels: false,
          // @ts-ignore
          showPlaceLabels: false,
          // @ts-ignore
          showTransitLabels: false,
          // @ts-ignore
          showPointOfInterestLabels: false,
        }}
      />
    </Mapbox.MapView>
  );
};

export default MapView;

Observed behavior and steps to reproduce

When attempting to set the gestureSettings property (or zoomEnabled) on Mapbox.MapView, the application crashes. The crash occurs when unwrapping an optional value in the setReactGestureSettings method, as indicated by the runtime error 'Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value'. This issue can be reproduced by initializing a MapView with the gestureSettings prop.

With gestureSettings property:

image

With zoomEnabled property:

image

Expected behavior

The expected behavior is for the app to run without crashing when setting the gestureSettings property (or zoomEnabled).

Notes / preliminary analysis

No response

Additional links and references

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions