maps icon indicating copy to clipboard operation
maps copied to clipboard

[Bug]: defaultSettings centerCoordinates not applying

Open Alvi24 opened this issue 9 months ago • 3 comments

Mapbox Implementation

Mapbox

Mapbox Version

11.6.0

React Native Version

0.76.7

Platform

Android

@rnmapbox/maps version

10.1.37

Standalone component to reproduce

import React from 'react';
import {
  MapView,
  Camera,
} from '@rnmapbox/maps';

const MapExample=()=>{
return (
<MapView>
<Camera
   defaultSettings={{
   centerCoordinate: [-122.084, 37.4219983],
   zoomLevel: 14,
    }}
    />
</MapView>
)
}

Observed behavior and steps to reproduce

when opening the app for the first time provided the [-122.084, 37.4219983] coordinates initial camera position is in africa, if then updating the code

first time the app is opened: Image

when i reopen the app:

Image

Expected behavior

camera position should be in the same positions as it is when the app is reopened

Notes / preliminary analysis

No response

Additional links and references

No response

Alvi24 avatar Mar 28 '25 16:03 Alvi24

Facing the same issue

IAlphaOmegaI avatar Mar 28 '25 17:03 IAlphaOmegaI

I successfully reproduced this bug. The map doesn’t center randomly.

https://github.com/user-attachments/assets/16a2cc1a-499c-4ece-9f9a-181cfa17e490

After further analysis, I found the cause: during the first flyTo method call, Mapbox doesn’t center the map on the latitude. I’m not sure why it behaves this way.

My only idea for a fix is to call setInitialCamera twice (if the center doesn’t update correctly), but that feels like an inefficient workaround. @mfazekas — any hints on where to look for a proper solution?

Elter71 avatar Apr 05 '25 14:04 Elter71

Related issue: https://github.com/rnmapbox/maps/issues/3449

SethArchambault avatar Apr 23 '25 16:04 SethArchambault

Could reproduce on Android, ~seems to be an upstream issue.~ Actually this is a race between defaultStop and initial stop. In this case the initial stop was empty. But in case it applied just after default stop

mfazekas avatar Oct 15 '25 11:10 mfazekas