0
我开发样本反应,本地应用程序如何定位到特定的位置,在该应用程序我使用的反应 - 原生地图。它的工作精细地图显示当前位置,但是,我有自定义纬度经度,现在我想要导航到特定的位置,当我点击一个按钮。基于纬度经度
这儿,这是我的代码:
<MapView
ref='map'
style={styles.map}
region={this.state.mapRegion}
showsUserLocation={true}
followUserLocation={true}
zoomEnabled={true}
pitchEnabled={true}
showsCompass={true}
showsBuildings={true}
showsTraffic={true}
showsIndoors={true}
onRegionChange={this.onRegionChange.bind(this)}
onPress={this.onMapPress.bind(this)}>
{this.state.markers.length != 0 || this.state.markers != undefined ?(
this.state.markers.map(marker => (
<MapView.Marker
coordinate={{
latitude: marker.Latitude||this.state.lastLat||region.latitude,
longitude:marker.Longitude||this.state.lastLong||region.longitude
}}
image = {
marker.EmergencyService == true ?(
require('./Imgs/emergencyService.png')):
(require('./Imgs/regularService.png'))
}
onCalloutPress={() => this.bookDoctorsAppointment(marker)}
>
<MyCustomMarkerView marker={marker} navigator={this.props.navigator}/>
</MapView.Marker>
)
)):(<View></View>)}
</MapView>
我没有得到你能解释一下这个 – Lavaraju
原谅我请,我不擅长英语,我可以写,但我的理解能力和表达能力很差。 @Lavaraju给你的组件附加'ref',然后你可以在ref实例中看到这些方法。 – ystal