Skip to content

[Bug]: Setting Camera.followUserLocation programmatically on Android does not trigger onUserTrackingModeChange callback #3155

Closed

Description

@andrei-tofan

Mapbox Implementation

Mapbox

Mapbox Version

default

Platform

Android

@rnmapbox/maps version

10.1.0-beta.17

Standalone component to reproduce

// In: https://github.com/rnmapbox/maps/blob/main/example/src/examples/UserLocation/UserLocationRenderMode.tsx
// added console logs to debug this issue
/*
<Button
  title={
    followUserLocation
      ? 'Don`t follow User Location'
      : 'Follow user location'
  }
  onPress={() => setFollowUserLocation((prevState) => { 
    console.log(`setFollowUserLocation(${!prevState})`);
    return !prevState
  })}
/>
*/

/*
<Camera
  defaultSettings={{
    centerCoordinate: DEFAULT_CENTER_COORDINATE,
    zoomLevel: 18,
  }}
  followUserLocation={followUserLocation}
  followUserMode={followUserMode}
  followZoomLevel={18}
  onUserTrackingModeChange={(event) => {
    const payload = event.nativeEvent.payload;
    console.log(`onUserTrackingModeChange(${JSON.stringify({followUserLocation: payload.followUserLocation, followUserMode: payload.followUserMode})})`);
    if (!event.nativeEvent.payload.followUserLocation) {
      setFollowUserLocation(false);
    }
  }}
/>
*/

Observed behavior and steps to reproduce

Using the example app, change the followUserLocation flag on Android.

Expected behavior

The onUserTrackingModeChange callback should be called as it is called on iOS when followUserLocation is changed programmatically.

Notes / preliminary analysis

No response

Additional links and references

No response

Activity

  1. changed the title [-][Bug]: Setting Camera.followUserLocation programmatically on Android dose not trigger onUserTrackingModeChange callback[/-] [+][Bug]: Setting Camera.followUserLocation programmatically on Android does not trigger onUserTrackingModeChange callback[/+] on Nov 1, 2023
  2. andrei-tofan commented on Nov 8, 2023

    @andrei-tofan
    ContributorAuthor

    @mfazekas do you know what may be causing this? can you point me to a starting point for debugging this issue

  3. mfazekas commented on Nov 9, 2023

    @mfazekas
    Contributor

    @andrei-tofan FYI I'm adding a new Viewport component that will replace ononUserTrackingModeChange see: #3162

  4. mfazekas commented on Nov 14, 2023

    @mfazekas
    Contributor

    Pls check <ViewPort onStatusChanged

  5. andrei-tofan commented on Nov 16, 2023

    @andrei-tofan
    ContributorAuthor

    Thanks @mfazekas!

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions