Skip to content

setCamera doesn't take effect if followUserLocation set to true #1079

@mkraina

Description

@mkraina

Describe the bug
setCamera doesn't take effect if followUserLocation set to true

To Reproduce
set Camera's component followUserLocation prop to true and try to call setCamera on it's ref

Example:

const MapView = (props) => {
  const resetRotation = useCallback(() => {
    camera.current?.setCamera({
      heading: 0,
      animationDuration: 200,
    });
  }, []);

  return (
    <MapboxGL.MapView>
      <MapboxGL.Camera
        ref={camera}
        followUserLocation
        followUserMode={'normal'}
      />
    </MapboxGL.MapView>
  );
};

Expected behavior
it should be possible to setCamera or at least some of it's props in case followUserLocation===true
while i see there can be some conflict updating the coords (which one should be prioritized?) at least zoomLevel, pitch and rotation should be just fine

Screenshots

Versions (please complete the following information):

  • Platform:both ios and android
  • react-native-mapbox-gl 8.1.0-rc.4, 8.1.0-rc.6
  • React Native Version 0.62

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions