Skip to content

Commit

Permalink
Merge commit '3d28a7d9fd005d59219668cf61177fe574170b84'
Browse files Browse the repository at this point in the history
* 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
  ...
  • Loading branch information
Tim Matthews committed Nov 22, 2016
2 parents c07a062 + 3d28a7d commit 4dc9995
Show file tree
Hide file tree
Showing 59 changed files with 1,291 additions and 263 deletions.
34 changes: 33 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,42 @@
[#675](https://github.com/airbnb/react-native-maps/pull/675)
(@mlanter)

## 0.10.4 (October 31, 2016)

### Patches

* [iOS] implement fitToSuppliedMarkers and fitToCoordinates for google maps
[#750](https://github.com/airbnb/react-native-maps/pull/750)
(@gilbox)
* [android] If we've disabled scrolling within the map, then don't capture the touch events
[#664](https://github.com/airbnb/react-native-maps/pull/664)
(@mikelambert)
* [iOS] Fix Anchor point on Google Maps iOS
[#734](https://github.com/airbnb/react-native-maps/pull/734)
(@btoueg)
* [iOS] Added showsUserLocation property support for Google Maps
[#721](https://github.com/airbnb/react-native-maps/pull/721)
(@julien-rodrigues)
* [iOS][android] Add support for setting zIndex on markers
[#675](https://github.com/airbnb/react-native-maps/pull/675)
(@mlanter)
* [android] Add parameter to disable the moving on marker press
[#676](https://github.com/airbnb/react-native-maps/pull/676)
(@mlanter)
* NOTE: v0.10.3 was not published

## 0.10.2 (October 19, 2016)

### Patches

* [android] Fixes crash during Activity onPause() (fixes #414)
[#694](https://github.com/airbnb/react-native-maps/pull/694)
(@felipecsl)

## 0.10.1 (October 10, 2016)

This release fixes issue [#656](https://github.com/airbnb/react-native-maps/issues/656)

### Patches

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

## 0.10.0 (October 5, 2016)

Expand Down
29 changes: 14 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@ Since react-native 0.25.0, `React` should be required from `node_modules`.
React Native versions from 0.18 should be working out of the box, for lower
versions you should add `react` as a dependency in your `package.json`.

## Component API

[`<MapView />` Component API](docs/mapview.md)

[`<MapView.Marker />` Component API](docs/marker.md)

[`<MapView.Callout />` Component API](docs/callout.md)

[`<MapView.Polygon />` Component API](docs/polygon.md)

[`<MapView.Polyline />` Component API](docs/polyline.md)

[`<MapView.Circle />` Component API](docs/circle.md)

## General Usage

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

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

## Component API

[`<MapView />` Component API](docs/mapview.md)

[`<MapView.Marker />` Component API](docs/marker.md)

[`<MapView.Callout />` Component API](docs/callout.md)

[`<MapView.Polygon />` Component API](docs/polygon.md)

[`<MapView.Polyline />` Component API](docs/polyline.md)

[`<MapView.Circle />` Component API](docs/circle.md)


### Animated Region

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.
Expand Down
6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ android {
}

dependencies {
compile 'com.facebook.react:react-native:+'
compile "com.google.android.gms:play-services-base:9.4.0"
compile 'com.google.android.gms:play-services-maps:9.4.0'
compile "com.facebook.react:react-native:+"
compile "com.google.android.gms:play-services-base:9.6.1"
compile "com.google.android.gms:play-services-maps:9.6.1"
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public Object getFeature() {
@Override
public void addToMap(GoogleMap map) {
polygon = map.addPolygon(getPolygonOptions());
polygon.setClickable(true);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@

import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.common.MapBuilder;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.ViewGroupManager;
import com.facebook.react.uimanager.annotations.ReactProp;

import java.util.HashMap;
import java.util.Map;
import javax.annotation.Nullable;

public class AirMapPolygonManager extends ViewGroupManager<AirMapPolygon> {
private final DisplayMetrics metrics;

Expand Down Expand Up @@ -67,4 +72,12 @@ public void setGeodesic(AirMapPolygon view, boolean geodesic) {
public void setZIndex(AirMapPolygon view, float zIndex) {
view.setZIndex(zIndex);
}

@Override
@Nullable
public Map getExportedCustomDirectEventTypeConstants() {
return MapBuilder.of(
"onPress", MapBuilder.of("registrationName", "onPress")
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public Object getFeature() {
@Override
public void addToMap(GoogleMap map) {
polyline = map.addPolyline(getPolylineOptions());
polyline.setClickable(true);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@

import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.common.MapBuilder;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.ViewGroupManager;
import com.facebook.react.uimanager.annotations.ReactProp;

import java.util.HashMap;
import java.util.Map;
import javax.annotation.Nullable;

public class AirMapPolylineManager extends ViewGroupManager<AirMapPolyline> {
private final DisplayMetrics metrics;

Expand Down Expand Up @@ -62,4 +67,12 @@ public void setGeodesic(AirMapPolyline view, boolean geodesic) {
public void setZIndex(AirMapPolyline view, float zIndex) {
view.setZIndex(zIndex);
}

@Override
@Nullable
public Map getExportedCustomDirectEventTypeConstants() {
return MapBuilder.of(
"onPress", MapBuilder.of("registrationName", "onPress")
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.Polygon;
import com.google.android.gms.maps.model.Polyline;

import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -72,6 +74,8 @@ public class AirMapView extends MapView implements GoogleMap.InfoWindowAdapter,

private final List<AirMapFeature> features = new ArrayList<>();
private final Map<Marker, AirMapMarker> markerMap = new HashMap<>();
private final Map<Polyline, AirMapPolyline> polylineMap = new HashMap<>();
private final Map<Polygon, AirMapPolygon> polygonMap = new HashMap<>();
private final ScaleGestureDetector scaleDetector;
private final GestureDetectorCompat gestureDetector;
private final AirMapManager manager;
Expand Down Expand Up @@ -165,6 +169,24 @@ public boolean onMarkerClick(Marker marker) {
}
});

map.setOnPolygonClickListener(new GoogleMap.OnPolygonClickListener() {
@Override
public void onPolygonClick(Polygon polygon) {
WritableMap event = makeClickEventData(polygon.getPoints().get(0));
event.putString("action", "polygon-press");
manager.pushEvent(polygonMap.get(polygon), "onPress", event);
}
});

map.setOnPolylineClickListener(new GoogleMap.OnPolylineClickListener() {
@Override
public void onPolylineClick(Polyline polyline) {
WritableMap event = makeClickEventData(polyline.getPoints().get(0));
event.putString("action", "polyline-press");
manager.pushEvent(polylineMap.get(polyline), "onPress", event);
}
});

map.setOnInfoWindowClickListener(new GoogleMap.OnInfoWindowClickListener() {
@Override
public void onInfoWindowClick(Marker marker) {
Expand Down Expand Up @@ -381,10 +403,14 @@ public void addFeature(View child, int index) {
AirMapPolyline polylineView = (AirMapPolyline) child;
polylineView.addToMap(map);
features.add(index, polylineView);
Polyline polyline = (Polyline) polylineView.getFeature();
polylineMap.put(polyline, polylineView);
} else if (child instanceof AirMapPolygon) {
AirMapPolygon polygonView = (AirMapPolygon) child;
polygonView.addToMap(map);
features.add(index, polygonView);
Polygon polygon = (Polygon) polygonView.getFeature();
polygonMap.put(polygon, polygonView);
} else if (child instanceof AirMapCircle) {
AirMapCircle circleView = (AirMapCircle) child;
circleView.addToMap(map);
Expand Down Expand Up @@ -571,13 +597,15 @@ public boolean dispatchTouchEvent(MotionEvent ev) {

switch (action) {
case (MotionEvent.ACTION_DOWN):
this.getParent().requestDisallowInterceptTouchEvent(true);
this.getParent().requestDisallowInterceptTouchEvent(
map != null && map.getUiSettings().isScrollGesturesEnabled());
isTouchDown = true;
break;
case (MotionEvent.ACTION_MOVE):
startMonitoringRegion();
break;
case (MotionEvent.ACTION_UP):
// Clear this regardless, since isScrollGesturesEnabled() may have been updated
this.getParent().requestDisallowInterceptTouchEvent(false);
isTouchDown = false;
break;
Expand Down
4 changes: 2 additions & 2 deletions components/MapCircle.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
} from 'react-native';
import decorateMapComponent, {
USES_DEFAULT_IMPLEMENTATION,
NOT_SUPPORTED,
SUPPORTED,
} from './decorateMapComponent';

const propTypes = {
Expand Down Expand Up @@ -140,7 +140,7 @@ module.exports = decorateMapComponent(MapCircle, {
componentType: 'Circle',
providers: {
google: {
ios: NOT_SUPPORTED,
ios: SUPPORTED,
android: USES_DEFAULT_IMPLEMENTATION,
},
},
Expand Down
5 changes: 2 additions & 3 deletions components/MapPolygon.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
} from 'react-native';
import decorateMapComponent, {
USES_DEFAULT_IMPLEMENTATION,
NOT_SUPPORTED,
SUPPORTED,
} from './decorateMapComponent';

const propTypes = {
Expand Down Expand Up @@ -92,7 +92,6 @@ const propTypes = {
* points on the Earth's surface. The geodesic curve is constructed assuming the Earth is
* a sphere.
*
* @platform android
*/
geodesic: PropTypes.bool,

Expand Down Expand Up @@ -145,7 +144,7 @@ module.exports = decorateMapComponent(MapPolygon, {
componentType: 'Polygon',
providers: {
google: {
ios: NOT_SUPPORTED,
ios: SUPPORTED,
android: USES_DEFAULT_IMPLEMENTATION,
},
},
Expand Down
9 changes: 7 additions & 2 deletions components/MapPolyline.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
} from 'react-native';
import decorateMapComponent, {
USES_DEFAULT_IMPLEMENTATION,
NOT_SUPPORTED,
SUPPORTED,
} from './decorateMapComponent';

const propTypes = {
Expand All @@ -26,6 +26,11 @@ const propTypes = {
*/
onPress: PropTypes.func,

/**
* The fill color to use for the path.
*/
fillColor: PropTypes.string,

/**
* The stroke width to use for the path.
*/
Expand Down Expand Up @@ -140,7 +145,7 @@ module.exports = decorateMapComponent(MapPolyline, {
componentType: 'Polyline',
providers: {
google: {
ios: NOT_SUPPORTED,
ios: SUPPORTED,
android: USES_DEFAULT_IMPLEMENTATION,
},
},
Expand Down
20 changes: 16 additions & 4 deletions components/MapUrlTile.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import React, { PropTypes } from 'react';

import {
View,
requireNativeComponent,
} from 'react-native';

import decorateMapComponent, {
USES_DEFAULT_IMPLEMENTATION,
SUPPORTED,
} from './decorateMapComponent';

const propTypes = {
...View.propTypes,

Expand All @@ -25,6 +30,7 @@ const propTypes = {

class MapUrlTile extends React.Component {
render() {
const AIRMapUrlTile = this.getAirComponent();
return (
<AIRMapUrlTile
{...this.props}
Expand All @@ -35,6 +41,12 @@ class MapUrlTile extends React.Component {

MapUrlTile.propTypes = propTypes;

const AIRMapUrlTile = requireNativeComponent('AIRMapUrlTile', MapUrlTile);

module.exports = MapUrlTile;
module.exports = decorateMapComponent(MapUrlTile, {
componentType: 'UrlTile',
providers: {
google: {
ios: SUPPORTED,
android: USES_DEFAULT_IMPLEMENTATION,
},
},
});
Loading

0 comments on commit 4dc9995

Please sign in to comment.