maps icon indicating copy to clipboard operation
maps copied to clipboard

[Bug]: Render Error : undefined is not an object (evaluating '_maps.default.UserTrackingModes.FollowWithCourse')

Open MagdaHennebo opened this issue 3 years ago • 1 comments

Mapbox Implementation

Mapbox

Mapbox Version

default

Platform

iOS, Android

@rnmapbox/maps version

#main

Standalone component to reproduce

import React, { useState } from 'react'; import MapboxGL from '@rnmapbox/maps';

const Camera = (props) => {

const [zoom, setZoom] = useState(12);

if (props && props?.coordinates?.pointsOfInterest?.length > 0) {
    return (
      <MapboxGL.Camera
        zoomLevel={zoom}
        centerCoordinate={[
            props?.coordinates?.pointsOfInterest[0]?.longitude,
            props?.coordinates?.pointsOfInterest[0]?.latitude,
        ]}
        animationDuration={10}
        animationMode={'none'}
        followUserLocation={true}
        followUserMode={MapboxGL.UserTrackingModes.FollowWithCourse}
        followZoomLevel={zoom}
      />
    );
}

};

export default Camera;

Observed behavior and steps to reproduce

[Bug]: Render Error : undefined is not an object (evaluating '_maps.default.UserTrackingModes.FollowWithCourse')

Expected behavior

The map should appear, the camera should start at the coordinates sent through props (latitude, longitude) and the camera should follow the user's location...

Notes / preliminary analysis

I am fairly new to mapbox, and I don't really know what could be wrong here...

Additional links and references

No response

MagdaHennebo avatar Sep 19 '22 15:09 MagdaHennebo

The issue seems to be this line.

followUserMode={MapboxGL.UserTrackingModes.FollowWithCourse}

as a workaround you can try with the actual value "course":

followUserMode={"course"}

mfazekas avatar Sep 20 '22 13:09 mfazekas