Skip to content

Commit

Permalink
Merge branch 'master' into fix(android)/new_google_maps_renderer_func
Browse files Browse the repository at this point in the history
  • Loading branch information
monholm committed Mar 19, 2022
2 parents dc5a587 + 71727a5 commit 30045ce
Show file tree
Hide file tree
Showing 30 changed files with 153 additions and 133 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ render() {
region={this.state.region}
/>
<OverlayComponent
style={{position: absolute, bottom: 50}}
style={{position: "absolute", bottom: 50}}
/>
);
}
Expand Down
2 changes: 2 additions & 0 deletions docs/heatmap.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# `<Heatmap />` Component API

**Note**: Supported on Google Maps only.

## Props

| Prop | Type | Default | Note |
Expand Down
2 changes: 1 addition & 1 deletion docs/mapview.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ To access event data, you will need to use `e.nativeEvent`. For example, `onPres
| `fitToElements` | `options: { edgePadding: EdgePadding, animated: Boolean }` | **Note** edgePadding is Google Maps only
| `fitToSuppliedMarkers` | `markerIDs: String[], options: { edgePadding: EdgePadding, animated: Boolean }` | If you need to use this in `ComponentDidMount`, make sure you put it in a timeout or it will cause performance problems. **Note** edgePadding is Google Maps only
| `fitToCoordinates` | `coordinates: Array<LatLng>, options: { edgePadding: EdgePadding, animated: Boolean }` | If called in `ComponentDidMount` in android, it will cause an exception. It is recommended to call it from the MapView `onLayout` event.
| `addressForCoordinate` | `coordinate: LatLng` | Converts a map coordinate to a address (`Address`). Returns a `Promise<Address>`.
| `addressForCoordinate` | `coordinate: LatLng` | Converts a map coordinate to a address (`Address`). Returns a `Promise<Address>` **Note** Not supported on Google Maps for iOS.
| `pointForCoordinate` | `coordinate: LatLng` | Converts a map coordinate to a view coordinate (`Point`). Returns a `Promise<Point>`.
| `coordinateForPoint` | `point: Point` | Converts a view coordinate (`Point`) to a map coordinate. Returns a `Promise<Coordinate>`.
| `getMarkersFrames` | `onlyVisible: Boolean` | Get markers' centers and frames in view coordinates. Returns a `Promise<{ "markerID" : { point: Point, frame: Frame } }>`. **Note**: iOS only.
Expand Down
2 changes: 1 addition & 1 deletion docs/overlay.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
|---|---|---|---|
| `image` | `ImageSource` | A custom image to be used as the overlay. Only required local image resources and uri (as for images located in the net) are allowed to be used.
| `bounds` | `Array<LatLng>` | | The coordinates for the image (left-top corner, right-bottom corner). ie.```[[lat, long], [lat, long]]```
+| `bearing` | `Number ` | `0` | `Google Maps API only` The bearing in degrees clockwise from north. Values outside the range [0, 360) will be normalized.
| `bearing` | `Number ` | `0` | `Google Maps API only` The bearing in degrees clockwise from north. Values outside the range [0, 360) will be normalized.
| `tappable` | `Bool` | `false` | `Android only` Boolean to allow an overlay to be tappable and use the onPress function.
| `opacity` | `Number` | `1.0` | `Google maps only` The opacity of the overlay.

Expand Down
2 changes: 1 addition & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '11.0'
platform :ios, '12.0'

target 'example' do
config = use_native_modules!
Expand Down
48 changes: 24 additions & 24 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -71,29 +71,29 @@ PODS:
- FlipperKit/FlipperKitNetworkPlugin
- fmt (6.2.1)
- glog (0.3.5)
- Google-Maps-iOS-Utils (3.10.3):
- Google-Maps-iOS-Utils/Clustering (= 3.10.3)
- Google-Maps-iOS-Utils/Geometry (= 3.10.3)
- Google-Maps-iOS-Utils/GeometryUtils (= 3.10.3)
- Google-Maps-iOS-Utils/Heatmap (= 3.10.3)
- Google-Maps-iOS-Utils/QuadTree (= 3.10.3)
- Google-Maps-iOS-Utils (4.0.0):
- Google-Maps-iOS-Utils/Clustering (= 4.0.0)
- Google-Maps-iOS-Utils/Geometry (= 4.0.0)
- Google-Maps-iOS-Utils/GeometryUtils (= 4.0.0)
- Google-Maps-iOS-Utils/Heatmap (= 4.0.0)
- Google-Maps-iOS-Utils/QuadTree (= 4.0.0)
- GoogleMaps
- Google-Maps-iOS-Utils/Clustering (3.10.3):
- Google-Maps-iOS-Utils/Clustering (4.0.0):
- Google-Maps-iOS-Utils/QuadTree
- GoogleMaps
- Google-Maps-iOS-Utils/Geometry (3.10.3):
- Google-Maps-iOS-Utils/Geometry (4.0.0):
- GoogleMaps
- Google-Maps-iOS-Utils/GeometryUtils (3.10.3):
- Google-Maps-iOS-Utils/GeometryUtils (4.0.0):
- GoogleMaps
- Google-Maps-iOS-Utils/Heatmap (3.10.3):
- Google-Maps-iOS-Utils/Heatmap (4.0.0):
- Google-Maps-iOS-Utils/QuadTree
- GoogleMaps
- Google-Maps-iOS-Utils/QuadTree (3.10.3):
- Google-Maps-iOS-Utils/QuadTree (4.0.0):
- GoogleMaps
- GoogleMaps (5.1.0):
- GoogleMaps/Maps (= 5.1.0)
- GoogleMaps/Base (5.1.0)
- GoogleMaps/Maps (5.1.0):
- GoogleMaps (6.0.1):
- GoogleMaps/Maps (= 6.0.1)
- GoogleMaps/Base (6.0.1)
- GoogleMaps/Maps (6.0.1):
- GoogleMaps/Base
- libevent (2.1.12)
- OpenSSL-Universal (1.1.180)
Expand Down Expand Up @@ -292,11 +292,11 @@ PODS:
- React-jsi (= 0.65.1)
- React-perflogger (= 0.65.1)
- React-jsinspector (0.65.1)
- react-native-google-maps (0.29.3):
- Google-Maps-iOS-Utils (= 3.10.3)
- GoogleMaps (= 5.1.0)
- react-native-google-maps (0.30.1):
- Google-Maps-iOS-Utils (= 4.0.0)
- GoogleMaps (= 6.0.1)
- React-Core
- react-native-maps (0.29.3):
- react-native-maps (0.30.1):
- React-Core
- React-perflogger (0.65.1)
- React-RCTActionSheet (0.65.1):
Expand Down Expand Up @@ -520,8 +520,8 @@ SPEC CHECKSUMS:
FlipperKit: 651f50a42eb95c01b3e89a60996dd6aded529eeb
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: 5337263514dd6f09803962437687240c5dc39aa4
Google-Maps-iOS-Utils: 95d5ca4d2004314eff88c1819b969db6cac37ab6
GoogleMaps: 086ae1dab659eaa7339bdb30fc88e2f44e7c597c
Google-Maps-iOS-Utils: a06cb5c3a0e5b2a505fed82d936ba1b935f8971f
GoogleMaps: c213fc2334b7374144cede914da779b99be0ab74
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
OpenSSL-Universal: 1aa4f6a6ee7256b83db99ec1ccdaa80d10f9af9b
RCT-Folly: 0dd9e1eb86348ecab5ba76f910b56f4b5fef3c46
Expand All @@ -535,8 +535,8 @@ SPEC CHECKSUMS:
React-jsi: 12913c841713a15f64eabf5c9ad98592c0ec5940
React-jsiexecutor: 43f2542aed3c26e42175b339f8d37fe3dd683765
React-jsinspector: 41e58e5b8e3e0bf061fdf725b03f2144014a8fb0
react-native-google-maps: c3c9e5e1e0eefabb9c5da32dc6461c0a8b266eef
react-native-maps: 41d01d8e0afcebe32bec9eea3bd945adc1b18f7a
react-native-google-maps: abae7a731a7f1eff7d9a7cf33020497c50a66ba0
react-native-maps: 85a3dc2fe4e9b9bb7b3bc7b976b79d65137e894f
React-perflogger: fd28ee1f2b5b150b00043f0301d96bd417fdc339
React-RCTActionSheet: 7f3fa0855c346aa5d7c60f9ced16e067db6d29fa
React-RCTAnimation: 2119a18ee26159004b001bc56404ca5dbaae6077
Expand All @@ -552,6 +552,6 @@ SPEC CHECKSUMS:
Yoga: aa0cb45287ebe1004c02a13f279c55a95f1572f4
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

PODFILE CHECKSUM: 946fd66a3f622c64dfb19b965c250df957e88acf
PODFILE CHECKSUM: 3e75f15a762d95604cf07c140bd34642e2243406

COCOAPODS: 1.10.1
4 changes: 2 additions & 2 deletions example/ios/example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@
CURRENT_PROJECT_VERSION = 1;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = example/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -734,7 +734,7 @@
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 1;
INFOPLIST_FILE = example/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
Expand Down
6 changes: 3 additions & 3 deletions example/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5177,9 +5177,9 @@ node-dir@^0.1.17:
minimatch "^3.0.2"

node-fetch@^2.2.0, node-fetch@^2.6.0:
version "2.6.6"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.6.tgz#1751a7c01834e8e1697758732e9efb6eeadfaf89"
integrity sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==
version "2.6.7"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad"
integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==
dependencies:
whatwg-url "^5.0.0"

Expand Down
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ declare module 'react-native-maps' {
}

export default class MapView extends React.Component<MapViewProps, any> {
private __lastRegion?: Region;
getCamera(): Promise<Camera>;
setCamera(camera: Partial<Camera>): void;
animateCamera(camera: Partial<Camera>, opts?: { duration?: number }): void;
Expand Down
2 changes: 1 addition & 1 deletion lib/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ android {
}

dependencies {
def work_version = "2.5.0"
def work_version = safeExtGet('targetSdkVersion', 27) < 31 ? "2.5.0" : "2.7.1"
def supportLibVersion = safeExtGet('supportLibVersion', '28.0.0')
def supportLibMajorVersion = supportLibVersion.split('\\.')[0] as int
def appCompatLibName = (supportLibMajorVersion < 20) ? "androidx.appcompat:appcompat" : "com.android.support:appcompat-v7"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public class AirMapView extends MapView implements GoogleMap.InfoWindowAdapter,
private boolean handlePanDrag = false;
private boolean moveOnMarkerPress = true;
private boolean cacheEnabled = false;
private ReadableMap initialRegion;
private boolean initialRegionSet = false;
private boolean initialCameraSet = false;
private LatLngBounds cameraLastIdleBounds;
Expand Down Expand Up @@ -218,6 +219,10 @@ public void onMapReady(final GoogleMap map) {
this.map.setOnMarkerDragListener(this);
this.map.setOnPoiClickListener(this);
this.map.setOnIndoorStateChangeListener(this);
if(initialRegion != null) {
setRegion(initialRegion);
initialRegionSet = true;
}

manager.pushEvent(context, this, "onMapReady", new WritableNativeMap());

Expand Down Expand Up @@ -395,7 +400,7 @@ public void onCameraIdle() {
lifecycleListener = new LifecycleEventListener() {
@Override
public void onHostResume() {
if (hasPermissions()) {
if (hasPermissions() && map != null) {
//noinspection MissingPermission
map.setMyLocationEnabled(showUserLocation);
map.setLocationSource(fusedLocationSource);
Expand All @@ -410,7 +415,7 @@ public void onHostResume() {

@Override
public void onHostPause() {
if (hasPermissions()) {
if (hasPermissions() && map != null) {
//noinspection MissingPermission
map.setMyLocationEnabled(false);
}
Expand Down Expand Up @@ -458,7 +463,10 @@ public synchronized void doDestroy() {
}

public void setInitialRegion(ReadableMap initialRegion) {
if (!initialRegionSet && initialRegion != null) {
this.initialRegion = initialRegion;
// Theoretically onMapReady might be called before setInitialRegion
// In that case, trigger setRegion manually
if (!initialRegionSet && map != null) {
setRegion(initialRegion);
initialRegionSet = true;
}
Expand Down Expand Up @@ -1011,7 +1019,9 @@ public boolean dispatchTouchEvent(MotionEvent ev) {

int X = (int)ev.getX();
int Y = (int)ev.getY();
tapLocation = map.getProjection().fromScreenLocation(new Point(X,Y));
if(map != null) {
tapLocation = map.getProjection().fromScreenLocation(new Point(X,Y));
}

int action = MotionEventCompat.getActionMasked(ev);

Expand Down
2 changes: 1 addition & 1 deletion lib/components/Geojson.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import Marker from './MapMarker';
import Polyline from './MapPolyline';
import Polygon from './MapPolygon';
import { ColorPropType } from 'react-native';
import { ColorPropType } from 'deprecated-react-native-prop-types';

const propTypes = {
/**
Expand Down
8 changes: 3 additions & 5 deletions lib/components/MapCallout.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import PropTypes from 'prop-types';
import React from 'react';
import { StyleSheet, ViewPropTypes, View } from 'react-native';
import { StyleSheet } from 'react-native';
import { ViewPropTypes } from 'deprecated-react-native-prop-types';
import decorateMapComponent, {
SUPPORTED,
USES_DEFAULT_IMPLEMENTATION,
} from './decorateMapComponent';

// if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)
const viewPropTypes = ViewPropTypes || View.propTypes;

const propTypes = {
...viewPropTypes,
...ViewPropTypes,
tooltip: PropTypes.bool,
onPress: PropTypes.func,
alphaHitTest: PropTypes.bool,
Expand Down
8 changes: 3 additions & 5 deletions lib/components/MapCalloutSubview.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import PropTypes from 'prop-types';
import React from 'react';
import { StyleSheet, ViewPropTypes, View } from 'react-native';
import { StyleSheet } from 'react-native';
import { ViewPropTypes } from 'deprecated-react-native-prop-types';
import decorateMapComponent, {
SUPPORTED,
NOT_SUPPORTED,
} from './decorateMapComponent';

// if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)
const viewPropTypes = ViewPropTypes || View.propTypes;

const propTypes = {
...viewPropTypes,
...ViewPropTypes,
onPress: PropTypes.func,
};

Expand Down
10 changes: 5 additions & 5 deletions lib/components/MapCircle.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import PropTypes from 'prop-types';
import React from 'react';
import { ColorPropType, ViewPropTypes, View } from 'react-native';
import {
ColorPropType,
ViewPropTypes,
} from 'deprecated-react-native-prop-types';
import decorateMapComponent, {
USES_DEFAULT_IMPLEMENTATION,
SUPPORTED,
} from './decorateMapComponent';

// if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)
const viewPropTypes = ViewPropTypes || View.propTypes;

const propTypes = {
...viewPropTypes,
...ViewPropTypes,

/**
* The coordinate of the center of the circle
Expand Down
8 changes: 3 additions & 5 deletions lib/components/MapHeatmap.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import PropTypes from 'prop-types';
import React from 'react';
import { ViewPropTypes, View, processColor } from 'react-native';
import { processColor } from 'react-native';
import { ViewPropTypes } from 'deprecated-react-native-prop-types';
import decorateMapComponent, {
SUPPORTED,
USES_DEFAULT_IMPLEMENTATION,
} from './decorateMapComponent';

// if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)
const viewPropTypes = ViewPropTypes || View.propTypes;

const propTypes = {
...viewPropTypes,
...ViewPropTypes,

/**
* Array of heatmap entries to apply towards density.
Expand Down
8 changes: 2 additions & 6 deletions lib/components/MapLocalTile.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import PropTypes from 'prop-types';
import React from 'react';

import { ViewPropTypes, View } from 'react-native';
import { ViewPropTypes } from 'deprecated-react-native-prop-types';

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

// if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)
const viewPropTypes = ViewPropTypes || View.propTypes;

const propTypes = {
...viewPropTypes,
...ViewPropTypes,

/**
* The path template of the local tile source.
Expand Down
Loading

0 comments on commit 30045ce

Please sign in to comment.