React native 隐藏标记标注直到完成动画区域

React native 隐藏标记标注直到完成动画区域,react-native,react-native-maps,React Native,React Native Maps,在完成animateToRegion之前,如何隐藏详图索引以使其不显示 <Marker ref={(ref) => {this.markerRef = ref; }} coordinate={mapMarker.location.latlng} title={mapMarker.location.streetName} stopPro

在完成animateToRegion之前,如何隐藏详图索引以使其不显示

            <Marker
                ref={(ref) => {this.markerRef = ref; }}
                coordinate={mapMarker.location.latlng}
                title={mapMarker.location.streetName}
                stopPropagation={true}
                pointerEvents='auto'
                onPress={() => console.log('pressed')}
                onSelect={() => {
                    this.props.handlePress();
                }}
            >
{this.markerRef=ref;}
坐标={mapMarker.location.latlng}
title={mapMarker.location.streetName}
stopPropagation={true}
pointerEvents='auto'
onPress={()=>console.log('pressed')}
onSelect={()=>{
这个.props.handlePress();
}}
>
传递的
handlePress
方法只是一个
animateToRegion
,它工作正常并移动到正确的位置。但我需要将详图索引的显示延迟到区域移动之后,因为由于区域更改,详图索引现在不再居中


我曾尝试使用
showCallout
设置超时,但由于超时会导致调用闪烁,因此无法正常工作。有什么建议吗?

我没有试图延迟显示标注,而是决定适当地设置地图动画,以确保标注始终适合屏幕。基本上,每当按下一个标记时,我都会选择标记的lat、long并移动地图,使标记位于地图的较低25%处并居中(取决于iOS或Android,因为它们呈现的标注略有不同)。这使我能够确保标注永远不会位于屏幕顶部的组件后面

我将我的
代码移动到一个单独的自定义组件,我现在正在使用该组件

<MapMarker 
    key={index}
    mapMarker={marker}
    handlePress={() => this.moveMapToCoordinate(marker.location)}
/>
moveMapToCoordinate(markerLocationInfo) {
        this.map.animateToRegion({
            ...this.state.region,
            latitude: this.state.region.latitude + ((markerLocationInfo.latlng.latitude) - (this.state.region.latitude - (this.state.region.latitudeDelta/4))),
            longitude: Platform.OS === 'ios' ? this.state.region.longitude : this.state.region.longitude + ((markerLocationInfo.latlng.longitude) - (this.state.region.longitude))
        }, 500)
}