Warm tip: This article is reproduced from stackoverflow.com, please click
react-native react-native-android react-native-mapbox-gl

Can't change pitch value on MapView or Camera

发布于 2020-03-27 10:26:03

I've just switch from react-native-maps-osmdroid to react-native-mapbox-gl and havn't succeed to change pitch yet.

I've tried to set pitch in differents ways :
- directly on MapView component
- on Camera component with props "pitch" and "followPitch"
- on Camera component with props "defaultSettings"
- with ref on Camera and call this.camera.setCamera()

However none of this ways seems to work, the only way that I succeed to change pitch is from the app with three fingers.

<MapboxGL.MapView style={{ flex: 1 }}>
  <MapboxGL.Camera
    followPitch={15}
    zoomLevel={16}
    followUserLocation
  />
  <MapboxGL.UserLocation />
</MapboxGL.MapView>

No error message whatever the way I change pitch but map don't change. Someone know how to programatically change pitch?

Questioner
Ethaqnix
Viewed
113
Ethaqnix 2019-07-03 22:54

Looks like set followUserLocation to true overide others settings (like centerCoordinates, pitch, heading).

I probably need to handle Camera movement by myself to follow user with pitch.

Let me know if you find another solution.