Skip to content

[Bug]: isUserInteraction is always true when locationPuck is shown on Android #3805

Open

Description

@ipoogleduck

Mapbox Implementation

Mapbox

Mapbox Version

11.8.0

React Native Version

0.74.5

Platform

Android

@rnmapbox/maps version

10.1.35

Standalone component to reproduce

import React, { useEffect, useRef } from 'react';
import {
    MapView,
    ShapeSource,
    LineLayer,
    Camera,
    LocationPuck,
} from '@rnmapbox/maps';

const aLine = {
    type: 'LineString',
    coordinates: [
        [-74.00597, 40.71427],
        [-74.00697, 40.71527],
    ],
}

const BugReportExample = () => {

    const mapCameraRef = useRef()
    const locationPuck = true // Set this to false to hide the location puck. The issue only presents itself when the locationPuck is shown

    useEffect(() => {
        // Re-center the map every 5 seconds. When this is done, isUserInteraction should log as false (but it doesn't when locationPuck is true)
        const interval = setInterval(() => {
            mapCameraRef.current?.setCamera({
                centerCoordinate: [-74.00597, 40.71427],
                animationDuration: 1000,
                animationMode: 'linear',
            })
        }, 5_000)

        return () => {
            clearInterval(interval)
        }

    }, [])

    const regionIsChanging = (region) => {
        console.log("isUserInteraction:", region.properties.isUserInteraction)
    }

    return (
        <MapView style={{ flex: 1 }} onRegionIsChanging={regionIsChanging}>
            <Camera ref={mapCameraRef} centerCoordinate={[-74.00597, 40.71427]} zoomLevel={14} />
            <ShapeSource id="idStreetLayer" shape={aLine}>
                <LineLayer id="idStreetLayer" />
            </ShapeSource>
            {locationPuck ? <LocationPuck puckBearingEnabled={true} puckBearing="heading" pulsing={"default"} /> : null}
        </MapView>
    )
}

Observed behavior and steps to reproduce

When the location puck is show on Android (this issue is not present on iOS), and mapCameraRef.current?.setCamera is used to animate to a location, the region.properties.isUserInteraction returned from onRegionIsChanging is true, when it should be false. The issue only occurs after the user interacts with the map for the first time.

Steps to reproduce:

  1. Use the component and view the console logs
  2. Move the map around a bit, then wait for it to recenter (recenters every 5 seconds)
  3. isUserInteraction will print as true when this animation happens, even though it should be false. The issue does not occur on iOS.
  4. Set the locationPuck constant I added to false (or comment out the locationPuck component) and the issue no longer occurs on Android

Expected behavior

isUserInteraction should print as false when a mapCameraRef.current?.setCamera animation is used

Notes / preliminary analysis

No response

Additional links and references

No response

Activity

  1. added
    bug 🪲
    on Mar 9, 2025
  2. ipoogleduck commented on Mar 9, 2025

    @ipoogleduck
    Author

    Interesting, seems to be related to #3801... the bug only exists when pulsing={"default"} is set

  3. CleverTomatoe commented on Jun 26, 2025

    @CleverTomatoe

    +1, same issue.
    Removing LocationPuck also fixed an other issue i had:
    LocationPuck Prevents onRegionDidChange from triggering properly.

  4. KijongHan commented on May 29, 2026

    @KijongHan
    Contributor

    I took some time looking into this, and I believe its related to the issue reported here mapbox/mapbox-maps-android#2116

    the state that manages isUserInteraction property gets reset on mapIdle, but when pulsing={"default"} is set we don't get that listener being invoked and so isUserInteraction is just never reset back to false.

    A quick prototype into connecting the "reset" logic against the custom onMapSteady event detector introduced here #4074 seems to be a functionally working. Keen to hear your thoughts @mfazekas if you think this would be an appropriate approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🪲

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions