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

camera.setCamera does not work on Android (but fine on iOS) #291

Closed
palok opened this issue Mar 7, 2024 · 2 comments
Closed

camera.setCamera does not work on Android (but fine on iOS) #291

palok opened this issue Mar 7, 2024 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@palok
Copy link

palok commented Mar 7, 2024

Steps to Trigger Behavior

  1. Trigger the camera.setCamera on a physical Android device

Link to Minimal Reproducible Example

No link but this is the relevant code:

  const flyToCenter = useCallback((lat: number, lng: number, zoomTo: number = 9) => {
      if (cameraRef.current) {
        cameraRef.current.setCamera({
          stops: [
            {
              centerCoordinate: [lng, lat],
              zoomLevel: zoomTo,
              heading: 0,
              animationMode: 'flyTo',
              animationDuration: 300,
            },
          ],
        });
      }

    },
    [],
  );

Expected Behavior

The map camera should pan and zoom to the setCamera config params.

Actual Behavior

On Android, neither panning or zooming happens.

Version(s) affected

  • Platform: Android
  • OS version: Android 11
  • Device type: OnePlus Nord
  • Emulator/ Simulator: no
  • Development OS: MacOs Sonoma 14.3
  • maplibre-react-native Version 10.0.0-alpha2
  • MapLibre GL version [e.g. 6.3.0]
  • React Native Version: 0.72.7

Additional context

Works as expected on iOS

@palok
Copy link
Author

palok commented Mar 8, 2024

Found out if I change the code to a single stop, then it works for Android:

cameraRef.current.setCamera({
  centerCoordinate: [lng, lat],
  zoomLevel: zoomTo,
  heading: 0,
  animationMode: 'flyTo',
  animationDuration: 300,
});

@KiwiKilian
Copy link
Collaborator

Also there were quite some improvements with the latest v10 pre-releases. Please report if there are still problems.

@KiwiKilian KiwiKilian added the bug Something isn't working label Nov 15, 2024
@KiwiKilian KiwiKilian added this to the 10.0.0 milestone Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants