React Native Maps - 标记从一个坐标到另一个坐标的平滑移动

时间:2017-11-18 15:37:15

标签: android react-native react-native-android react-native-maps

我正在制作一个RN 0.50.1的跟踪应用程序,并使用react-native-maps在MapView.Marker" image"上自定义图像的地图上显示用户位置。道具。

该位置工作正常,跟踪工作正常,但问题是标记从一个坐标跳到另一个坐标长期变化。 尝试使用MapView.AnimatedRegion设置状态并使用计时方法更新坐标,但没有运气。 也使用https://github.com/airbnb/react-native-maps/blob/master/example/examples/AnimatedMarkers.js示例,但仍然没有运气解释使用Animated.Region,但它给了我Animated.Region的错误不是构造函数。

我需要在长时间更换时平稳移动标记。

我的Package.JSON文件 -

{
"name": "XXXX",
"version": "0.0.1",
"private": true,
"scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
},
"dependencies": {
    "firebase": "^4.6.1",
    "lottie-react-native": "^2.2.7",
    "moment": "^2.19.1",
    "react": "^16.0.0",
    "react-native": "0.50.1",
    "react-native-android-permissions": "^1.0.0",
    "react-native-code-push": "^5.1.3-beta",
    "react-native-maps": "^0.17.1",
    "react-native-responsive-dimensions": "^1.0.1",
    "react-native-router-flux": "^4.0.0-beta.22",
    "react-native-simple-toast": "0.0.7",
    "react-native-vector-icons": "^4.4.2"
},
"devDependencies": {
    "babel-jest": "21.2.0",
    "babel-preset-react-native": "4.0.0",
    "jest": "21.2.1",
    "react-test-renderer": "16.0.0"
},
"jest": {
    "preset": "react-native"
}

}

任何帮助表示赞赏。请。

1 个答案:

答案 0 :(得分:0)

我想你想看看MapView methods(例如animateToCoordinates)。