React native 在滑块更改时动态更新地图标记-反应本机

React native 在滑块更改时动态更新地图标记-反应本机,react-native,react-native-maps,React Native,React Native Maps,我在渲染标记时有点问题。 一切都变得缓慢和滞后。 您可以在此视频中看到: 有没有办法使我的标记更平滑 这就是我试过的 <View style={styles.slider}> <Slider maximumValue={1000} minimumValue={100} step={50} value={this.state.newRadius}

我在渲染标记时有点问题。 一切都变得缓慢和滞后。 您可以在此视频中看到:

有没有办法使我的标记更平滑

这就是我试过的

<View style={styles.slider}>
          <Slider
            maximumValue={1000}
            minimumValue={100}
            step={50}
            value={this.state.newRadius}
            onValueChange={newRadius => {
            this.setState({newRadius})
            this.getLocation()
           }}
          />
          <View>
            <Text>Radius: {this.state.newRadius} meter</Text>
          </View>
</View>

{
this.setState({newRadius})
这个文件名为getLocation()
}}
/>
半径:{this.state.newRadius}米
onValueChange我正在加载getLocation()

我的getLocation用于显示和过滤我的RadiusValue中的标记

getLocation(){
       let { region } = this.state;
       let { latitude, longitude } = region;
       let markers = spielanlagen.map(marker =>  {
       let name = marker.name
       let image = marker.image
       let street = marker.street
       console.log(name);
       console.log(marker.coordinate);
       let coords = marker.coordinate
         return {
           coordinate: {
             latitude: coords[0],
             longitude: coords[1],
           },
           name: marker.name,
           street: marker.street,
           image: marker.image
         }
       }).filter(marker => {
           let distance = this.calculateDistance(latitude, longitude, marker.coordinate.latitude, marker.coordinate.longitude);
           return distance <= this.state.newRadius;
         });
      this.setState({
         markers: markers,
         loaded: true,
       });
  };

calculateDistance(origLat, origLon, markerLat, markerLon) {
      return geolib.getDistance(
        {latitude: origLat, longitude: origLon},
        {latitude: markerLat, longitude: markerLon}
      );
  }
getLocation(){
设{region}=this.state;
设{纬度,经度}=区域;
让markers=spielanagen.map(marker=>{
让name=marker.name
让image=marker.image
let street=marker.street
console.log(名称);
console.log(marker.coordinate);
让coords=marker.coordinate
返回{
协调:{
纬度:坐标[0],
经度:坐标[1],
},
name:marker.name,
街道:马克街,
图像:marker.image
}
}).filter(标记=>{
让距离=this.calculatedInstance(纬度、经度、marker.coordinate.lation、marker.coordinate.longitude);
返回距离