尝试在空对象引用 getDouble 上调用虚拟方法“double java.lang.Double.doubleValue()”

Dav*_*dze 5 android google-maps react-native react-native-maps expo

我正在使用react-native-maps库在react-native应用程序中显示谷歌地图。我正在跟踪用户移动,并希望在位置发生更改时旋转地图。对于地图旋转,我正在计算旋转角度并使用 animateCamera尝试旋转地图,如下所示:

this.map.animateCamera({
    heading: rotation,
    center: {latitude: currentLocation.latitude, longitude: currentLocation.longitude},
    pitch: this.state.currentAngle
}, {duration: 1000});
Run Code Online (Sandbox Code Playgroud)

我已经查过了,但rotation, latitude, longitude, currentAngle没有null or empty objects

但这个方法会抛出这样的错误:在此输入图像描述

之后,我尝试使用animateToBearing方法,正如文档所述,该方法已被弃用,但效果很好并旋转地图,但显示弃用警告。

Versions:
    expo: 32.0.0,
    expo-cli: 2.2.0,
    react-native-maps: 0.23.0
Run Code Online (Sandbox Code Playgroud)

有什么解决办法吗?

PS我在github.com和stackoverflow.com上搜索了类似的问题,这个问题不重复