diff --git a/Examples/UIExplorer/MapViewExample.js b/Examples/UIExplorer/MapViewExample.js
index c236a7781..d39370228 100644
--- a/Examples/UIExplorer/MapViewExample.js
+++ b/Examples/UIExplorer/MapViewExample.js
@@ -252,6 +252,56 @@ var AnnotationExample = React.createClass({
});
+var DraggableAnnotationExample = React.createClass({
+
+ createAnnotation(longitude, latitude) {
+ return {
+ longitude,
+ latitude,
+ draggable: true,
+ onDragStateChange: (event) => {
+ if (event.state === 'idle') {
+ this.setState({
+ annotations: [this.createAnnotation(event.longitude, event.latitude)],
+ });
+ }
+ console.log('Drag state: ' + event.state);
+ },
+ };
+ },
+
+ getInitialState() {
+ return {
+ isFirstLoad: true,
+ annotations: [],
+ mapRegion: undefined,
+ };
+ },
+
+ render() {
+ if (this.state.isFirstLoad) {
+ var onRegionChangeComplete = (region) => {
+ //When the MapView loads for the first time, we can create the annotation at the
+ //region that was loaded.
+ this.setState({
+ isFirstLoad: false,
+ annotations: [this.createAnnotation(region.longitude, region.latitude)],
+ });
+ };
+ }
+
+ return (
+
+ );
+ },
+
+});
+
var styles = StyleSheet.create({
map: {
height: 150,
@@ -338,12 +388,7 @@ exports.examples = [
{
title: 'Draggable pin',
render() {
- return {
- console.log('Drag state: ' + event.state);
- },
- }}/>;
+ return ;
}
},
{
diff --git a/Libraries/Components/MapView/MapView.js b/Libraries/Components/MapView/MapView.js
index 60c751527..be15531ce 100644
--- a/Libraries/Components/MapView/MapView.js
+++ b/Libraries/Components/MapView/MapView.js
@@ -437,9 +437,6 @@ const MapView = React.createClass({
onAnnotationDragStateChange = (event: Event) => {
const annotation = findByAnnotationId(event.nativeEvent.annotationId);
if (annotation) {
- // Update location
- annotation.latitude = event.nativeEvent.latitude;
- annotation.longitude = event.nativeEvent.longitude;
// Call callback
annotation.onDragStateChange &&
annotation.onDragStateChange(event.nativeEvent);