maps icon indicating copy to clipboard operation
maps copied to clipboard

[Bug]: iOS requests background location permission, although it shouldn't

Open derscott opened this issue 1 year ago • 0 comments

Mapbox Implementation

Mapbox

Mapbox Version

default

Platform

iOS

@rnmapbox/maps version

10.0.0-beta.64

Standalone component to reproduce

import React from 'react';
import {
  MapView,
  ShapeSource,
  LineLayer,
  Camera,
  MapboxGL,
} 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>
          <MapboxGL.UserLocation
            requestsAlwaysUse={false}
            showsUserHeadingIndicator
            visible
          />
      </MapView>
    );
  }
}

Observed behavior and steps to reproduce

When rendering the MapboxGL.UserLocation component, on iOS there will always be a request for the background location permission, even with requestAlwaysUse explicitly set to false. The request is most likely triggered by this component, as it doesn't appear when commenting it out. I tested all scenarios after completely removing the app from iOS simulator to reset all permissions.

Expected behavior

When requestAlwaysUse is set to false (or not explicitly set), no request for background location permission appears.

Notes / preliminary analysis

No response

Additional links and references

UserLocation.md

derscott avatar Jun 15 '23 12:06 derscott