Skip to content

minZoomLevel / maxZoomLevel props have no effect on Android during active navigation #550

@christian-apollo

Description

@christian-apollo

Bug Description

The minZoomLevel and maxZoomLevel props on NavigationView have no effect on Android when the camera is in follow-my-location mode during active navigation. The same props work correctly on iOS.

Steps to Reproduce

  1. Render a NavigationView with minZoomLevel and maxZoomLevel set to the same value (to lock zoom):
    <NavigationView
      minZoomLevel={15}
      maxZoomLevel={15}
      // ...
    />
  2. Start navigation to a destination
  3. Observe that the map zoom level changes freely despite the constraints

Expected Behavior

The map zoom should be constrained to the specified min/max range (or locked to a single level when both are equal), matching the iOS behavior.

Actual Behavior

On Android, the Navigation SDK's followMyLocation() auto-zoom algorithm overrides the setMinZoomPreference() / setMaxZoomPreference() constraints set by the props.

Root Cause

In MapViewController.java, setFollowingPerspective calls the single-parameter mGoogleMap.followMyLocation(perspective), which gives the Navigation SDK full control over camera zoom via its own auto-zoom algorithm. This overrides the min/max zoom preferences.

The Navigation SDK v7.x provides a two-parameter overload — followMyLocation(perspective, FollowMyLocationOptions) — that accepts a FollowMyLocationOptions with a fixed zoom level. When minZoomLevel == maxZoomLevel (locked zoom), this overload should be used so the SDK follows the user's location at the specified zoom instead of auto-managing it.

Proposed Fix

Track the current following perspective and, when min/max zoom preferences are locked to the same value, call followMyLocation(perspective, FollowMyLocationOptions.builder().setZoomLevel(zoom).build()) instead of the single-parameter version. Also re-apply followMyLocation when zoom preferences change so the camera respects new constraints immediately.

Environment

  • @googlemaps/react-native-navigation-sdk: 0.14.2
  • Navigation SDK (Android): 7.4.0
  • React Native: 0.76+
  • Platform: Android

Metadata

Metadata

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