Attempt to invoke virtual method 'double java.lang.Double.doubleValue()' on a null object reference getDouble

 ̄綄美尐妖づ 提交于 2019-12-10 17:12:59

问题


I am using react-native-maps library to show google maps in react-native application. I am tracking user movement and want to rotate the map when location will be changed. For map rotation I am calculating rotation angle and using animateCamera trying to rotate the map like the following:

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

I've checked and rotation, latitude, longitude, currentAngle are not null or empty objects

But this method throws an error like this:

After this, I tried to use animateToBearing method, which is deprecated, as documentation says, but works nicely and rotates the map but shows the deperecation warning.

Versions:
    expo: 32.0.0,
    expo-cli: 2.2.0,
    react-native-maps: 0.23.0

Any solutions?

P.S. I've searched similar questions on github.com and stackoverflow.com and this question is not duplicated

来源:https://stackoverflow.com/questions/55317448/attempt-to-invoke-virtual-method-double-java-lang-double-doublevalue-on-a-nu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!