[discussion] Camera + defaultSettings alternative
See original GitHub issueI was wondering if we could re-think the use of defaultSettings
added with https://github.com/react-native-mapbox-gl/maps/pull/132:
In a lot of cases we’d just want to define where the map camera should be initially and later we’d follow user’s location, or just let the user change camera, by pinch-zoom etc.
What if we track only the changes made on the <Camera />
positioning props (bounds
, heading
, pitch
centerCoordinate
, zoomLevel
, padding
etc) and only apply them initially + when the values change. That could still allow us to set the initial camera and enable followUserLocation
. Any future interacted / imperative change to the camera are kept (and disables follow mode). Until the positioning props are updated, only then we modify the camera.
Maybe I don’t fully get the implications yet but I feel that the Camera API is currently somewhat confusing in this aspect.
Note: I’m not sure if this is the best way to start this discussion. I also considered commenting in the closed PR itself. Let me know if I should do it differently.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:8 (5 by maintainers)
Top GitHub Comments
If I could add, this is completely unclear as to how to use. I set the properties as they were with
centerCoordinate
andzoomLevel
on the Camera and every load was zooming from Africa. Then I saw this and problem solved. I see what you’re going for here though, but why not just use the settings set initially on the component as the defaults?This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.