Skip to content

Commit 4dc9995

Browse files
author
Tim Matthews
committed
Merge commit '3d28a7d9fd005d59219668cf61177fe574170b84'
* commit '3d28a7d9fd005d59219668cf61177fe574170b84': (24 commits) examples-setup.md: update android instructions (react-native-maps#743) add example for overlay overpress and docs iOS google maps custom tile support (react-native-maps#770) [Docs] Fix capitalisation of Xcode and CocoaPods (react-native-maps#749) Implements animateToRegion to Google Maps iOS (react-native-maps#779) [RN][iOS][google] Set region only when view has width&height - Fix type issue in AIRMapManager - Setup Gemfile in example/ios dir to avoid problems with different versions of cocoapods - Update examples-setup.md to use bundler - Change MapView so that we only set the native region prop when there is a width and height. GoogleMaps iOS requires the width and height to properly calculate the map zoom level. updates [marker flicker] Fix flicker of map pins on state change (react-native-maps#728) add onPress for polygons and polylines on iOS and Android Use latest Google Play Services (react-native-maps#731) Update installation.md (react-native-maps#742) Add latest patch releases to the changelog (react-native-maps#752) [ios][google] implement fitToSuppliedMarkers and fitToCoordinates (react-native-maps#750) If we've disabled scrolling within the map, then don't capture the touch events (react-native-maps#664) Fix dynamic imageSrc removal, fix flicker in react-native-maps#738 (react-native-maps#737) Fix Anchor point on Google Maps iOS Added ios google maps circle support Added google map type only check Fixed typo in google maps podspec Added ios google maps polygon, polyline, maptype support ...
2 parents c07a062 + 3d28a7d commit 4dc9995

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1291
-263
lines changed

CHANGELOG.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,42 @@
2929
[#675](https://github.com/airbnb/react-native-maps/pull/675)
3030
(@mlanter)
3131

32+
## 0.10.4 (October 31, 2016)
33+
34+
### Patches
35+
36+
* [iOS] implement fitToSuppliedMarkers and fitToCoordinates for google maps
37+
[#750](https://github.com/airbnb/react-native-maps/pull/750)
38+
(@gilbox)
39+
* [android] If we've disabled scrolling within the map, then don't capture the touch events
40+
[#664](https://github.com/airbnb/react-native-maps/pull/664)
41+
(@mikelambert)
42+
* [iOS] Fix Anchor point on Google Maps iOS
43+
[#734](https://github.com/airbnb/react-native-maps/pull/734)
44+
(@btoueg)
45+
* [iOS] Added showsUserLocation property support for Google Maps
46+
[#721](https://github.com/airbnb/react-native-maps/pull/721)
47+
(@julien-rodrigues)
48+
* [iOS][android] Add support for setting zIndex on markers
49+
[#675](https://github.com/airbnb/react-native-maps/pull/675)
50+
(@mlanter)
51+
* [android] Add parameter to disable the moving on marker press
52+
[#676](https://github.com/airbnb/react-native-maps/pull/676)
53+
(@mlanter)
54+
* NOTE: v0.10.3 was not published
55+
56+
## 0.10.2 (October 19, 2016)
57+
58+
### Patches
59+
60+
* [android] Fixes crash during Activity onPause() (fixes #414)
61+
[#694](https://github.com/airbnb/react-native-maps/pull/694)
62+
(@felipecsl)
3263

3364
## 0.10.1 (October 10, 2016)
3465

66+
This release fixes issue [#656](https://github.com/airbnb/react-native-maps/issues/656)
67+
3568
### Patches
3669

3770
* [android] fix gradle build setup for explorer, bump to gradle 2.2.0
@@ -40,7 +73,6 @@
4073
* [android] fix getAirMapName to fix ref-based commands
4174
[#665](https://github.com/airbnb/react-native-maps/pull/665)
4275
(@gilbox)
43-
* Hopefully this release will fix issue [#656](https://github.com/airbnb/react-native-maps/issues/656)
4476

4577
## 0.10.0 (October 5, 2016)
4678

README.md

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,20 @@ Since react-native 0.25.0, `React` should be required from `node_modules`.
2222
React Native versions from 0.18 should be working out of the box, for lower
2323
versions you should add `react` as a dependency in your `package.json`.
2424

25+
## Component API
26+
27+
[`<MapView />` Component API](docs/mapview.md)
28+
29+
[`<MapView.Marker />` Component API](docs/marker.md)
30+
31+
[`<MapView.Callout />` Component API](docs/callout.md)
32+
33+
[`<MapView.Polygon />` Component API](docs/polygon.md)
34+
35+
[`<MapView.Polyline />` Component API](docs/polyline.md)
36+
37+
[`<MapView.Circle />` Component API](docs/circle.md)
38+
2539
## General Usage
2640

2741
```js
@@ -272,21 +286,6 @@ Enable lite mode on Android with `liteMode` prop. Ideal when having multiple map
272286

273287
![](http://i.giphy.com/qZ2lAf18s89na.gif)
274288

275-
## Component API
276-
277-
[`<MapView />` Component API](docs/mapview.md)
278-
279-
[`<MapView.Marker />` Component API](docs/marker.md)
280-
281-
[`<MapView.Callout />` Component API](docs/callout.md)
282-
283-
[`<MapView.Polygon />` Component API](docs/polygon.md)
284-
285-
[`<MapView.Polyline />` Component API](docs/polyline.md)
286-
287-
[`<MapView.Circle />` Component API](docs/circle.md)
288-
289-
290289
### Animated Region
291290

292291
The MapView can accept an `MapView.AnimatedRegion` value as its `region` prop. This allows you to utilize the Animated API to control the map's center and zoom.

android/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ android {
5353
}
5454

5555
dependencies {
56-
compile 'com.facebook.react:react-native:+'
57-
compile "com.google.android.gms:play-services-base:9.4.0"
58-
compile 'com.google.android.gms:play-services-maps:9.4.0'
56+
compile "com.facebook.react:react-native:+"
57+
compile "com.google.android.gms:play-services-base:9.6.1"
58+
compile "com.google.android.gms:play-services-maps:9.6.1"
5959
}

android/src/main/java/com/airbnb/android/react/maps/AirMapPolygon.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ public Object getFeature() {
102102
@Override
103103
public void addToMap(GoogleMap map) {
104104
polygon = map.addPolygon(getPolygonOptions());
105+
polygon.setClickable(true);
105106
}
106107

107108
@Override

android/src/main/java/com/airbnb/android/react/maps/AirMapPolygonManager.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,15 @@
88

99
import com.facebook.react.bridge.ReactApplicationContext;
1010
import com.facebook.react.bridge.ReadableArray;
11+
import com.facebook.react.common.MapBuilder;
1112
import com.facebook.react.uimanager.ThemedReactContext;
1213
import com.facebook.react.uimanager.ViewGroupManager;
1314
import com.facebook.react.uimanager.annotations.ReactProp;
1415

16+
import java.util.HashMap;
17+
import java.util.Map;
18+
import javax.annotation.Nullable;
19+
1520
public class AirMapPolygonManager extends ViewGroupManager<AirMapPolygon> {
1621
private final DisplayMetrics metrics;
1722

@@ -67,4 +72,12 @@ public void setGeodesic(AirMapPolygon view, boolean geodesic) {
6772
public void setZIndex(AirMapPolygon view, float zIndex) {
6873
view.setZIndex(zIndex);
6974
}
75+
76+
@Override
77+
@Nullable
78+
public Map getExportedCustomDirectEventTypeConstants() {
79+
return MapBuilder.of(
80+
"onPress", MapBuilder.of("registrationName", "onPress")
81+
);
82+
}
7083
}

android/src/main/java/com/airbnb/android/react/maps/AirMapPolyline.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ public Object getFeature() {
9292
@Override
9393
public void addToMap(GoogleMap map) {
9494
polyline = map.addPolyline(getPolylineOptions());
95+
polyline.setClickable(true);
9596
}
9697

9798
@Override

android/src/main/java/com/airbnb/android/react/maps/AirMapPolylineManager.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,15 @@
88

99
import com.facebook.react.bridge.ReactApplicationContext;
1010
import com.facebook.react.bridge.ReadableArray;
11+
import com.facebook.react.common.MapBuilder;
1112
import com.facebook.react.uimanager.ThemedReactContext;
1213
import com.facebook.react.uimanager.ViewGroupManager;
1314
import com.facebook.react.uimanager.annotations.ReactProp;
1415

16+
import java.util.HashMap;
17+
import java.util.Map;
18+
import javax.annotation.Nullable;
19+
1520
public class AirMapPolylineManager extends ViewGroupManager<AirMapPolyline> {
1621
private final DisplayMetrics metrics;
1722

@@ -62,4 +67,12 @@ public void setGeodesic(AirMapPolyline view, boolean geodesic) {
6267
public void setZIndex(AirMapPolyline view, float zIndex) {
6368
view.setZIndex(zIndex);
6469
}
70+
71+
@Override
72+
@Nullable
73+
public Map getExportedCustomDirectEventTypeConstants() {
74+
return MapBuilder.of(
75+
"onPress", MapBuilder.of("registrationName", "onPress")
76+
);
77+
}
6578
}

android/src/main/java/com/airbnb/android/react/maps/AirMapView.java

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
import com.google.android.gms.maps.model.LatLng;
4040
import com.google.android.gms.maps.model.LatLngBounds;
4141
import com.google.android.gms.maps.model.Marker;
42+
import com.google.android.gms.maps.model.Polygon;
43+
import com.google.android.gms.maps.model.Polyline;
4244

4345
import java.util.ArrayList;
4446
import java.util.Arrays;
@@ -72,6 +74,8 @@ public class AirMapView extends MapView implements GoogleMap.InfoWindowAdapter,
7274

7375
private final List<AirMapFeature> features = new ArrayList<>();
7476
private final Map<Marker, AirMapMarker> markerMap = new HashMap<>();
77+
private final Map<Polyline, AirMapPolyline> polylineMap = new HashMap<>();
78+
private final Map<Polygon, AirMapPolygon> polygonMap = new HashMap<>();
7579
private final ScaleGestureDetector scaleDetector;
7680
private final GestureDetectorCompat gestureDetector;
7781
private final AirMapManager manager;
@@ -165,6 +169,24 @@ public boolean onMarkerClick(Marker marker) {
165169
}
166170
});
167171

172+
map.setOnPolygonClickListener(new GoogleMap.OnPolygonClickListener() {
173+
@Override
174+
public void onPolygonClick(Polygon polygon) {
175+
WritableMap event = makeClickEventData(polygon.getPoints().get(0));
176+
event.putString("action", "polygon-press");
177+
manager.pushEvent(polygonMap.get(polygon), "onPress", event);
178+
}
179+
});
180+
181+
map.setOnPolylineClickListener(new GoogleMap.OnPolylineClickListener() {
182+
@Override
183+
public void onPolylineClick(Polyline polyline) {
184+
WritableMap event = makeClickEventData(polyline.getPoints().get(0));
185+
event.putString("action", "polyline-press");
186+
manager.pushEvent(polylineMap.get(polyline), "onPress", event);
187+
}
188+
});
189+
168190
map.setOnInfoWindowClickListener(new GoogleMap.OnInfoWindowClickListener() {
169191
@Override
170192
public void onInfoWindowClick(Marker marker) {
@@ -381,10 +403,14 @@ public void addFeature(View child, int index) {
381403
AirMapPolyline polylineView = (AirMapPolyline) child;
382404
polylineView.addToMap(map);
383405
features.add(index, polylineView);
406+
Polyline polyline = (Polyline) polylineView.getFeature();
407+
polylineMap.put(polyline, polylineView);
384408
} else if (child instanceof AirMapPolygon) {
385409
AirMapPolygon polygonView = (AirMapPolygon) child;
386410
polygonView.addToMap(map);
387411
features.add(index, polygonView);
412+
Polygon polygon = (Polygon) polygonView.getFeature();
413+
polygonMap.put(polygon, polygonView);
388414
} else if (child instanceof AirMapCircle) {
389415
AirMapCircle circleView = (AirMapCircle) child;
390416
circleView.addToMap(map);
@@ -571,13 +597,15 @@ public boolean dispatchTouchEvent(MotionEvent ev) {
571597

572598
switch (action) {
573599
case (MotionEvent.ACTION_DOWN):
574-
this.getParent().requestDisallowInterceptTouchEvent(true);
600+
this.getParent().requestDisallowInterceptTouchEvent(
601+
map != null && map.getUiSettings().isScrollGesturesEnabled());
575602
isTouchDown = true;
576603
break;
577604
case (MotionEvent.ACTION_MOVE):
578605
startMonitoringRegion();
579606
break;
580607
case (MotionEvent.ACTION_UP):
608+
// Clear this regardless, since isScrollGesturesEnabled() may have been updated
581609
this.getParent().requestDisallowInterceptTouchEvent(false);
582610
isTouchDown = false;
583611
break;

components/MapCircle.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
} from 'react-native';
55
import decorateMapComponent, {
66
USES_DEFAULT_IMPLEMENTATION,
7-
NOT_SUPPORTED,
7+
SUPPORTED,
88
} from './decorateMapComponent';
99

1010
const propTypes = {
@@ -140,7 +140,7 @@ module.exports = decorateMapComponent(MapCircle, {
140140
componentType: 'Circle',
141141
providers: {
142142
google: {
143-
ios: NOT_SUPPORTED,
143+
ios: SUPPORTED,
144144
android: USES_DEFAULT_IMPLEMENTATION,
145145
},
146146
},

components/MapPolygon.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
} from 'react-native';
55
import decorateMapComponent, {
66
USES_DEFAULT_IMPLEMENTATION,
7-
NOT_SUPPORTED,
7+
SUPPORTED,
88
} from './decorateMapComponent';
99

1010
const propTypes = {
@@ -92,7 +92,6 @@ const propTypes = {
9292
* points on the Earth's surface. The geodesic curve is constructed assuming the Earth is
9393
* a sphere.
9494
*
95-
* @platform android
9695
*/
9796
geodesic: PropTypes.bool,
9897

@@ -145,7 +144,7 @@ module.exports = decorateMapComponent(MapPolygon, {
145144
componentType: 'Polygon',
146145
providers: {
147146
google: {
148-
ios: NOT_SUPPORTED,
147+
ios: SUPPORTED,
149148
android: USES_DEFAULT_IMPLEMENTATION,
150149
},
151150
},

0 commit comments

Comments
 (0)