Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
andrei-tofan opened this issue Nov 1, 2023 · 4 comments

Comments

@andrei-tofan
Copy link
Contributor

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

@andrei-tofan andrei-tofan 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 Nov 1, 2023
@andrei-tofan
Copy link
Contributor Author

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

@mfazekas
Copy link
Contributor

mfazekas commented Nov 9, 2023

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

@mfazekas
Copy link
Contributor

Pls check <ViewPort onStatusChanged

@andrei-tofan
Copy link
Contributor Author

Thanks @mfazekas!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants