react-native-maps 0.31.0 → 1.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -5
- package/android/src/main/AndroidManifest.xml +0 -3
- package/android/src/main/java/com/airbnb/android/react/maps/AirMapLocalTile.java +11 -4
- package/android/src/main/java/com/airbnb/android/react/maps/AirMapLocalTileManager.java +5 -1
- package/android/src/main/java/com/airbnb/android/react/maps/AirMapManager.java +2 -41
- package/android/src/main/java/com/airbnb/android/react/maps/AirMapTileProvider.java +5 -5
- package/android/src/main/java/com/airbnb/android/react/maps/AirMapView.java +0 -32
- package/ios/AirGoogleMaps/AIRGoogleMap.m +37 -31
- package/ios/AirGoogleMaps/AIRGoogleMapManager.m +0 -95
- package/ios/AirMaps/AIRMap.h +0 -1
- package/ios/AirMaps/AIRMap.m +0 -12
- package/ios/AirMaps/AIRMapManager.m +2 -132
- package/lib/AnimatedRegion.d.ts +19 -0
- package/lib/AnimatedRegion.js +134 -0
- package/lib/Geojson.d.ts +166 -0
- package/lib/Geojson.js +165 -0
- package/lib/MapCallout.d.ts +40 -0
- package/lib/MapCallout.js +51 -0
- package/lib/MapCalloutSubview.d.ts +34 -0
- package/lib/MapCalloutSubview.js +48 -0
- package/lib/MapCircle.d.ts +117 -0
- package/lib/MapCircle.js +53 -0
- package/lib/MapHeatmap.d.ts +77 -0
- package/lib/MapHeatmap.js +59 -0
- package/lib/MapLocalTile.d.ts +35 -0
- package/lib/MapLocalTile.js +44 -0
- package/lib/MapMarker.d.ts +289 -0
- package/lib/MapMarker.js +113 -0
- package/lib/MapOverlay.d.ts +86 -0
- package/lib/MapOverlay.js +63 -0
- package/lib/MapPolygon.d.ts +156 -0
- package/lib/MapPolygon.js +74 -0
- package/lib/MapPolyline.d.ts +156 -0
- package/lib/MapPolyline.js +53 -0
- package/lib/MapUrlTile.d.ts +134 -0
- package/lib/MapUrlTile.js +44 -0
- package/lib/MapView.d.ts +825 -0
- package/lib/MapView.js +418 -0
- package/{src/MapView.web.js → lib/MapView.web.d.ts} +0 -0
- package/lib/MapView.web.js +9 -0
- package/lib/MapWMSTile.d.ts +116 -0
- package/lib/MapWMSTile.js +44 -0
- package/lib/ProviderConstants.d.ts +2 -0
- package/lib/ProviderConstants.js +5 -0
- package/lib/decorateMapComponent.d.ts +35 -0
- package/lib/decorateMapComponent.js +80 -0
- package/{src/index.js → lib/index.d.ts} +5 -16
- package/lib/index.js +66 -0
- package/lib/sharedTypes.d.ts +82 -0
- package/lib/sharedTypes.js +2 -0
- package/package.json +19 -28
- package/react-native-google-maps.podspec +1 -1
- package/react-native-maps.podspec +1 -1
- package/index.d.ts +0 -637
- package/src/AnimatedRegion.js +0 -164
- package/src/Geojson.js +0 -334
- package/src/MapCallout.js +0 -51
- package/src/MapCalloutSubview.js +0 -44
- package/src/MapCircle.js +0 -150
- package/src/MapHeatmap.js +0 -99
- package/src/MapLocalTile.js +0 -52
- package/src/MapMarker.js +0 -377
- package/src/MapOverlay.js +0 -86
- package/src/MapPolygon.js +0 -202
- package/src/MapPolyline.js +0 -168
- package/src/MapUrlTile.js +0 -131
- package/src/MapView.js +0 -1160
- package/src/MapWMSTile.js +0 -122
- package/src/ProviderConstants.js +0 -2
- package/src/decorateMapComponent.js +0 -112
package/src/MapCircle.js
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
ColorPropType,
|
|
5
|
-
ViewPropTypes,
|
|
6
|
-
} from 'deprecated-react-native-prop-types';
|
|
7
|
-
import decorateMapComponent, {
|
|
8
|
-
USES_DEFAULT_IMPLEMENTATION,
|
|
9
|
-
SUPPORTED,
|
|
10
|
-
} from './decorateMapComponent';
|
|
11
|
-
|
|
12
|
-
const propTypes = {
|
|
13
|
-
...ViewPropTypes,
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* The coordinate of the center of the circle
|
|
17
|
-
*/
|
|
18
|
-
center: PropTypes.shape({
|
|
19
|
-
/**
|
|
20
|
-
* Coordinates for the center of the circle.
|
|
21
|
-
*/
|
|
22
|
-
latitude: PropTypes.number.isRequired,
|
|
23
|
-
longitude: PropTypes.number.isRequired,
|
|
24
|
-
}).isRequired,
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* The radius of the circle to be drawn (in meters)
|
|
28
|
-
*/
|
|
29
|
-
radius: PropTypes.number.isRequired,
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Callback that is called when the user presses on the circle
|
|
33
|
-
*/
|
|
34
|
-
onPress: PropTypes.func,
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* The stroke width to use for the path.
|
|
38
|
-
*/
|
|
39
|
-
strokeWidth: PropTypes.number,
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* The stroke color to use for the path.
|
|
43
|
-
*/
|
|
44
|
-
strokeColor: ColorPropType,
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* The fill color to use for the path.
|
|
48
|
-
*/
|
|
49
|
-
fillColor: ColorPropType,
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* The order in which this tile overlay is drawn with respect to other overlays. An overlay
|
|
53
|
-
* with a larger z-index is drawn over overlays with smaller z-indices. The order of overlays
|
|
54
|
-
* with the same z-index is arbitrary. The default zIndex is 0.
|
|
55
|
-
*
|
|
56
|
-
* @platform android
|
|
57
|
-
*/
|
|
58
|
-
zIndex: PropTypes.number,
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* The line cap style to apply to the open ends of the path.
|
|
62
|
-
* The default style is `round`.
|
|
63
|
-
*
|
|
64
|
-
* @platform ios
|
|
65
|
-
*/
|
|
66
|
-
lineCap: PropTypes.oneOf(['butt', 'round', 'square']),
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* The line join style to apply to corners of the path.
|
|
70
|
-
* The default style is `round`.
|
|
71
|
-
*
|
|
72
|
-
* @platform ios
|
|
73
|
-
*/
|
|
74
|
-
lineJoin: PropTypes.oneOf(['miter', 'round', 'bevel']),
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* The limiting value that helps avoid spikes at junctions between connected line segments.
|
|
78
|
-
* The miter limit helps you avoid spikes in paths that use the `miter` `lineJoin` style. If
|
|
79
|
-
* the ratio of the miter length—that is, the diagonal length of the miter join—to the line
|
|
80
|
-
* thickness exceeds the miter limit, the joint is converted to a bevel join. The default
|
|
81
|
-
* miter limit is 10, which results in the conversion of miters whose angle at the joint
|
|
82
|
-
* is less than 11 degrees.
|
|
83
|
-
*
|
|
84
|
-
* @platform ios
|
|
85
|
-
*/
|
|
86
|
-
miterLimit: PropTypes.number,
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* The offset (in points) at which to start drawing the dash pattern.
|
|
90
|
-
*
|
|
91
|
-
* Use this property to start drawing a dashed line partway through a segment or gap. For
|
|
92
|
-
* example, a phase value of 6 for the patter 5-2-3-2 would cause drawing to begin in the
|
|
93
|
-
* middle of the first gap.
|
|
94
|
-
*
|
|
95
|
-
* The default value of this property is 0.
|
|
96
|
-
*
|
|
97
|
-
* @platform ios
|
|
98
|
-
*/
|
|
99
|
-
lineDashPhase: PropTypes.number,
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* An array of numbers specifying the dash pattern to use for the path.
|
|
103
|
-
*
|
|
104
|
-
* The array contains one or more numbers that indicate the lengths (measured in points) of the
|
|
105
|
-
* line segments and gaps in the pattern. The values in the array alternate, starting with the
|
|
106
|
-
* first line segment length, followed by the first gap length, followed by the second line
|
|
107
|
-
* segment length, and so on.
|
|
108
|
-
*
|
|
109
|
-
* This property is set to `null` by default, which indicates no line dash pattern.
|
|
110
|
-
*
|
|
111
|
-
* @platform ios
|
|
112
|
-
*/
|
|
113
|
-
lineDashPattern: PropTypes.arrayOf(PropTypes.number),
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
const defaultProps = {
|
|
117
|
-
strokeColor: '#000',
|
|
118
|
-
strokeWidth: 1,
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
class MapCircle extends React.Component {
|
|
122
|
-
setNativeProps(props) {
|
|
123
|
-
this.circle.setNativeProps(props);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
render() {
|
|
127
|
-
const AIRMapCircle = this.getAirComponent();
|
|
128
|
-
return (
|
|
129
|
-
<AIRMapCircle
|
|
130
|
-
{...this.props}
|
|
131
|
-
ref={(ref) => {
|
|
132
|
-
this.circle = ref;
|
|
133
|
-
}}
|
|
134
|
-
/>
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
MapCircle.propTypes = propTypes;
|
|
140
|
-
MapCircle.defaultProps = defaultProps;
|
|
141
|
-
|
|
142
|
-
export default decorateMapComponent(MapCircle, {
|
|
143
|
-
componentType: 'Circle',
|
|
144
|
-
providers: {
|
|
145
|
-
google: {
|
|
146
|
-
ios: SUPPORTED,
|
|
147
|
-
android: USES_DEFAULT_IMPLEMENTATION,
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
});
|
package/src/MapHeatmap.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { processColor } from 'react-native';
|
|
4
|
-
import { ViewPropTypes } from 'deprecated-react-native-prop-types';
|
|
5
|
-
import decorateMapComponent, {
|
|
6
|
-
SUPPORTED,
|
|
7
|
-
USES_DEFAULT_IMPLEMENTATION,
|
|
8
|
-
} from './decorateMapComponent';
|
|
9
|
-
|
|
10
|
-
const propTypes = {
|
|
11
|
-
...ViewPropTypes,
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Array of heatmap entries to apply towards density.
|
|
15
|
-
*/
|
|
16
|
-
points: PropTypes.arrayOf(
|
|
17
|
-
PropTypes.shape({
|
|
18
|
-
/**
|
|
19
|
-
* Latitude/Longitude coordinates
|
|
20
|
-
*/
|
|
21
|
-
latitude: PropTypes.number.isRequired,
|
|
22
|
-
longitude: PropTypes.number.isRequired,
|
|
23
|
-
weight: PropTypes.number,
|
|
24
|
-
})
|
|
25
|
-
),
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* The radius of the heatmap points in pixels, between 10 and 50
|
|
29
|
-
* (default 20).
|
|
30
|
-
*/
|
|
31
|
-
radius: PropTypes.number,
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* The opacity of the heatmap (default 0.7).
|
|
35
|
-
*/
|
|
36
|
-
opacity: PropTypes.number,
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Heatmap gradient configuration.
|
|
40
|
-
*/
|
|
41
|
-
gradient: PropTypes.shape({
|
|
42
|
-
/**
|
|
43
|
-
* Colors (one or more) to use for gradient.
|
|
44
|
-
*/
|
|
45
|
-
colors: PropTypes.arrayOf(PropTypes.string),
|
|
46
|
-
/**
|
|
47
|
-
* Array of floating point values from 0 to 1 representing
|
|
48
|
-
* where each color starts.
|
|
49
|
-
*/
|
|
50
|
-
startPoints: PropTypes.arrayOf(PropTypes.number),
|
|
51
|
-
/**
|
|
52
|
-
* Resolution of color map -- number corresponding to the
|
|
53
|
-
* number of steps colors are interpolated into (default 256).
|
|
54
|
-
*/
|
|
55
|
-
colorMapSize: PropTypes.number,
|
|
56
|
-
}),
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const defaultProps = {
|
|
60
|
-
strokeColor: '#000',
|
|
61
|
-
strokeWidth: 1,
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
class MapHeatmap extends React.Component {
|
|
65
|
-
setNativeProps(props) {
|
|
66
|
-
this.heatmap.setNativeProps(props);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
render() {
|
|
70
|
-
const AIRMapHeatmap = this.getAirComponent();
|
|
71
|
-
let gradient;
|
|
72
|
-
if (this.props.gradient) {
|
|
73
|
-
gradient = Object.assign({}, this.props.gradient);
|
|
74
|
-
gradient.colors = gradient.colors.map((c) => processColor(c));
|
|
75
|
-
}
|
|
76
|
-
return (
|
|
77
|
-
<AIRMapHeatmap
|
|
78
|
-
{...this.props}
|
|
79
|
-
gradient={gradient}
|
|
80
|
-
ref={(ref) => {
|
|
81
|
-
this.heatmap = ref;
|
|
82
|
-
}}
|
|
83
|
-
/>
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
MapHeatmap.propTypes = propTypes;
|
|
89
|
-
MapHeatmap.defaultProps = defaultProps;
|
|
90
|
-
|
|
91
|
-
export default decorateMapComponent(MapHeatmap, {
|
|
92
|
-
componentType: 'Heatmap',
|
|
93
|
-
providers: {
|
|
94
|
-
google: {
|
|
95
|
-
ios: SUPPORTED,
|
|
96
|
-
android: USES_DEFAULT_IMPLEMENTATION,
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
});
|
package/src/MapLocalTile.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { ViewPropTypes } from 'deprecated-react-native-prop-types';
|
|
4
|
-
|
|
5
|
-
import decorateMapComponent, {
|
|
6
|
-
USES_DEFAULT_IMPLEMENTATION,
|
|
7
|
-
SUPPORTED,
|
|
8
|
-
} from './decorateMapComponent';
|
|
9
|
-
|
|
10
|
-
const propTypes = {
|
|
11
|
-
...ViewPropTypes,
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* The path template of the local tile source.
|
|
15
|
-
* The patterns {x} {y} {z} will be replaced at runtime,
|
|
16
|
-
* for example, /storage/emulated/0/tiles/{z}/{x}/{y}.png.
|
|
17
|
-
*/
|
|
18
|
-
pathTemplate: PropTypes.string.isRequired,
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* The order in which this tile overlay is drawn with respect to other overlays. An overlay
|
|
22
|
-
* with a larger z-index is drawn over overlays with smaller z-indices. The order of overlays
|
|
23
|
-
* with the same z-index is arbitrary. The default zIndex is -1.
|
|
24
|
-
*
|
|
25
|
-
* @platform android
|
|
26
|
-
*/
|
|
27
|
-
zIndex: PropTypes.number,
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Size of tile images.
|
|
31
|
-
*/
|
|
32
|
-
tileSize: PropTypes.number,
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
class MapLocalTile extends React.Component {
|
|
36
|
-
render() {
|
|
37
|
-
const AIRMapLocalTile = this.getAirComponent();
|
|
38
|
-
return <AIRMapLocalTile {...this.props} />;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
MapLocalTile.propTypes = propTypes;
|
|
43
|
-
|
|
44
|
-
export default decorateMapComponent(MapLocalTile, {
|
|
45
|
-
componentType: 'LocalTile',
|
|
46
|
-
providers: {
|
|
47
|
-
google: {
|
|
48
|
-
ios: SUPPORTED,
|
|
49
|
-
android: USES_DEFAULT_IMPLEMENTATION,
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
});
|
package/src/MapMarker.js
DELETED
|
@@ -1,377 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
StyleSheet,
|
|
5
|
-
Platform,
|
|
6
|
-
NativeModules,
|
|
7
|
-
Animated,
|
|
8
|
-
Image,
|
|
9
|
-
findNodeHandle,
|
|
10
|
-
} from 'react-native';
|
|
11
|
-
import {
|
|
12
|
-
ColorPropType,
|
|
13
|
-
ViewPropTypes,
|
|
14
|
-
} from 'deprecated-react-native-prop-types';
|
|
15
|
-
|
|
16
|
-
import decorateMapComponent, {
|
|
17
|
-
SUPPORTED,
|
|
18
|
-
USES_DEFAULT_IMPLEMENTATION,
|
|
19
|
-
} from './decorateMapComponent';
|
|
20
|
-
|
|
21
|
-
const viewConfig = {
|
|
22
|
-
uiViewClassName: 'AIR<provider>MapMarker',
|
|
23
|
-
validAttributes: {
|
|
24
|
-
coordinate: true,
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const propTypes = {
|
|
29
|
-
...ViewPropTypes,
|
|
30
|
-
|
|
31
|
-
// TODO(lmr): get rid of these?
|
|
32
|
-
identifier: PropTypes.string,
|
|
33
|
-
reuseIdentifier: PropTypes.string,
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* The title of the marker. This is only used if the <Marker /> component has no children that
|
|
37
|
-
* are a `<Callout />`, in which case the default callout behavior will be used, which
|
|
38
|
-
* will show both the `title` and the `description`, if provided.
|
|
39
|
-
*/
|
|
40
|
-
title: PropTypes.string,
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* The description of the marker. This is only used if the <Marker /> component has no children
|
|
44
|
-
* that are a `<Callout />`, in which case the default callout behavior will be used,
|
|
45
|
-
* which will show both the `title` and the `description`, if provided.
|
|
46
|
-
*/
|
|
47
|
-
description: PropTypes.string,
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Test ID for end to end test automation
|
|
51
|
-
*/
|
|
52
|
-
testID: PropTypes.string,
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* A custom image to be used as the marker's icon. Only local image resources are allowed to be
|
|
56
|
-
* used.
|
|
57
|
-
*/
|
|
58
|
-
image: PropTypes.any,
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Marker icon to render (equivalent to `icon` property of GMSMarker Class).
|
|
62
|
-
* Using this property has an advantage over `image` in term of performance, battery usage...
|
|
63
|
-
* because it doesn't trigger tracksViewChanges.
|
|
64
|
-
* (tracksViewChanges is set to YES by default if iconView is not nil).
|
|
65
|
-
*/
|
|
66
|
-
icon: PropTypes.any,
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Opacity level of view/image based markers
|
|
70
|
-
*/
|
|
71
|
-
opacity: PropTypes.number,
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* If no custom marker view or custom image is provided, the platform default pin will be used,
|
|
75
|
-
* which can be customized by this color. Ignored if a custom marker is being used.
|
|
76
|
-
*/
|
|
77
|
-
pinColor: ColorPropType,
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* When true, the marker will be pre-selected. Setting this to true allows the user to
|
|
81
|
-
* drag the marker without needing to tap on it once to focus on it.
|
|
82
|
-
*/
|
|
83
|
-
isPreselected: PropTypes.bool,
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* The coordinate for the marker.
|
|
87
|
-
*/
|
|
88
|
-
coordinate: PropTypes.shape({
|
|
89
|
-
/**
|
|
90
|
-
* Coordinates for the anchor point of the marker.
|
|
91
|
-
*/
|
|
92
|
-
latitude: PropTypes.number.isRequired,
|
|
93
|
-
longitude: PropTypes.number.isRequired,
|
|
94
|
-
}).isRequired,
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* The offset (in points) at which to display the view.
|
|
98
|
-
*
|
|
99
|
-
* By default, the center point of an annotation view is placed at the coordinate point of the
|
|
100
|
-
* associated annotation. You can use this property to reposition the annotation view as
|
|
101
|
-
* needed. This x and y offset values are measured in points. Positive offset values move the
|
|
102
|
-
* annotation view down and to the right, while negative values move it up and to the left.
|
|
103
|
-
*
|
|
104
|
-
* For android, see the `anchor` prop.
|
|
105
|
-
*
|
|
106
|
-
* @platform ios
|
|
107
|
-
*/
|
|
108
|
-
centerOffset: PropTypes.shape({
|
|
109
|
-
/**
|
|
110
|
-
* Offset from the anchor point
|
|
111
|
-
*/
|
|
112
|
-
x: PropTypes.number.isRequired,
|
|
113
|
-
y: PropTypes.number.isRequired,
|
|
114
|
-
}),
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* The offset (in points) at which to place the callout bubble.
|
|
118
|
-
*
|
|
119
|
-
* This property determines the additional distance by which to move the callout bubble. When
|
|
120
|
-
* this property is set to (0, 0), the anchor point of the callout bubble is placed on the
|
|
121
|
-
* top-center point of the marker view’s frame. Specifying positive offset values moves the
|
|
122
|
-
* callout bubble down and to the right, while specifying negative values moves it up and to
|
|
123
|
-
* the left.
|
|
124
|
-
*
|
|
125
|
-
* For android, see the `calloutAnchor` prop.
|
|
126
|
-
*
|
|
127
|
-
* @platform ios
|
|
128
|
-
*/
|
|
129
|
-
calloutOffset: PropTypes.shape({
|
|
130
|
-
/**
|
|
131
|
-
* Offset to the callout
|
|
132
|
-
*/
|
|
133
|
-
x: PropTypes.number.isRequired,
|
|
134
|
-
y: PropTypes.number.isRequired,
|
|
135
|
-
}),
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Sets the anchor point for the marker.
|
|
139
|
-
*
|
|
140
|
-
* The anchor specifies the point in the icon image that is anchored to the marker's position
|
|
141
|
-
* on the Earth's surface.
|
|
142
|
-
*
|
|
143
|
-
* The anchor point is specified in the continuous space [0.0, 1.0] x [0.0, 1.0], where (0, 0)
|
|
144
|
-
* is the top-left corner of the image, and (1, 1) is the bottom-right corner. The anchoring
|
|
145
|
-
* point in a W x H image is the nearest discrete grid point in a (W + 1) x (H + 1) grid,
|
|
146
|
-
* obtained by scaling the then rounding. For example, in a 4 x 2 image, the anchor point
|
|
147
|
-
* (0.7, 0.6) resolves to the grid point at (3, 1).
|
|
148
|
-
*
|
|
149
|
-
* For ios, see the `centerOffset` prop.
|
|
150
|
-
*
|
|
151
|
-
* @platform android
|
|
152
|
-
*/
|
|
153
|
-
anchor: PropTypes.shape({
|
|
154
|
-
/**
|
|
155
|
-
* Offset to the callout
|
|
156
|
-
*/
|
|
157
|
-
x: PropTypes.number.isRequired,
|
|
158
|
-
y: PropTypes.number.isRequired,
|
|
159
|
-
}),
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Specifies the point in the marker image at which to anchor the callout when it is displayed.
|
|
163
|
-
* This is specified in the same coordinate system as the anchor. See the `andor` prop for more
|
|
164
|
-
* details.
|
|
165
|
-
*
|
|
166
|
-
* The default is the top middle of the image.
|
|
167
|
-
*
|
|
168
|
-
* For ios, see the `calloutOffset` prop.
|
|
169
|
-
*
|
|
170
|
-
* @platform android
|
|
171
|
-
*/
|
|
172
|
-
calloutAnchor: PropTypes.shape({
|
|
173
|
-
/**
|
|
174
|
-
* Offset to the callout
|
|
175
|
-
*/
|
|
176
|
-
x: PropTypes.number.isRequired,
|
|
177
|
-
y: PropTypes.number.isRequired,
|
|
178
|
-
}),
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Sets whether this marker should be flat against the map true or a billboard facing the
|
|
182
|
-
* camera false.
|
|
183
|
-
*
|
|
184
|
-
* @platform android
|
|
185
|
-
*/
|
|
186
|
-
flat: PropTypes.bool,
|
|
187
|
-
|
|
188
|
-
draggable: PropTypes.bool,
|
|
189
|
-
|
|
190
|
-
tappable: PropTypes.bool,
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Sets whether this marker should track view changes true.
|
|
194
|
-
*/
|
|
195
|
-
|
|
196
|
-
tracksViewChanges: PropTypes.bool,
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Sets whether this marker should track view changes in info window true.
|
|
200
|
-
*
|
|
201
|
-
* @platform ios
|
|
202
|
-
*/
|
|
203
|
-
|
|
204
|
-
tracksInfoWindowChanges: PropTypes.bool,
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Stops Marker onPress events from propagating to and triggering MapView onPress events.
|
|
208
|
-
*
|
|
209
|
-
* @platform ios
|
|
210
|
-
*/
|
|
211
|
-
|
|
212
|
-
stopPropagation: PropTypes.bool,
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* Callback that is called when the user presses on the marker
|
|
216
|
-
*/
|
|
217
|
-
onPress: PropTypes.func,
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Callback that is called when the user selects the marker, before the callout is shown.
|
|
221
|
-
*
|
|
222
|
-
* @platform ios
|
|
223
|
-
*/
|
|
224
|
-
onSelect: PropTypes.func,
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Callback that is called when the marker is deselected, before the callout is hidden.
|
|
228
|
-
*
|
|
229
|
-
* @platform ios
|
|
230
|
-
*/
|
|
231
|
-
onDeselect: PropTypes.func,
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Callback that is called when the user taps the callout view.
|
|
235
|
-
*/
|
|
236
|
-
onCalloutPress: PropTypes.func,
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* Callback that is called when the user initiates a drag on this marker (if it is draggable)
|
|
240
|
-
*/
|
|
241
|
-
onDragStart: PropTypes.func,
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Callback called continuously as the marker is dragged
|
|
245
|
-
*/
|
|
246
|
-
onDrag: PropTypes.func,
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* Callback that is called when a drag on this marker finishes. This is usually the point you
|
|
250
|
-
* will want to setState on the marker's coordinate again
|
|
251
|
-
*/
|
|
252
|
-
onDragEnd: PropTypes.func,
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
const defaultProps = {
|
|
256
|
-
stopPropagation: false,
|
|
257
|
-
};
|
|
258
|
-
|
|
259
|
-
class MapMarker extends React.Component {
|
|
260
|
-
constructor(props) {
|
|
261
|
-
super(props);
|
|
262
|
-
|
|
263
|
-
this.showCallout = this.showCallout.bind(this);
|
|
264
|
-
this.hideCallout = this.hideCallout.bind(this);
|
|
265
|
-
this.redrawCallout = this.redrawCallout.bind(this);
|
|
266
|
-
this.animateMarkerToCoordinate = this.animateMarkerToCoordinate.bind(this);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
setNativeProps(props) {
|
|
270
|
-
this.marker.setNativeProps(props);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
showCallout() {
|
|
274
|
-
this._runCommand('showCallout', []);
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
hideCallout() {
|
|
278
|
-
this._runCommand('hideCallout', []);
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
redrawCallout() {
|
|
282
|
-
this._runCommand('redrawCallout', []);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
animateMarkerToCoordinate(coordinate, duration) {
|
|
286
|
-
this._runCommand('animateMarkerToCoordinate', [
|
|
287
|
-
coordinate,
|
|
288
|
-
duration || 500,
|
|
289
|
-
]);
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
redraw() {
|
|
293
|
-
this._runCommand('redraw', []);
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
_getHandle() {
|
|
297
|
-
return findNodeHandle(this.marker);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
_runCommand(name, args) {
|
|
301
|
-
switch (Platform.OS) {
|
|
302
|
-
case 'android':
|
|
303
|
-
NativeModules.UIManager.dispatchViewManagerCommand(
|
|
304
|
-
this._getHandle(),
|
|
305
|
-
this.getUIManagerCommand(name),
|
|
306
|
-
args
|
|
307
|
-
);
|
|
308
|
-
break;
|
|
309
|
-
|
|
310
|
-
case 'ios':
|
|
311
|
-
this.getMapManagerCommand(name)(this._getHandle(), ...args);
|
|
312
|
-
break;
|
|
313
|
-
|
|
314
|
-
default:
|
|
315
|
-
break;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
render() {
|
|
320
|
-
let image;
|
|
321
|
-
if (this.props.image) {
|
|
322
|
-
image = Image.resolveAssetSource(this.props.image) || {};
|
|
323
|
-
image = image.uri || this.props.image;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
let icon;
|
|
327
|
-
if (this.props.icon) {
|
|
328
|
-
icon = Image.resolveAssetSource(this.props.icon) || {};
|
|
329
|
-
icon = icon.uri;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
const AIRMapMarker = this.getAirComponent();
|
|
333
|
-
|
|
334
|
-
return (
|
|
335
|
-
<AIRMapMarker
|
|
336
|
-
ref={(ref) => {
|
|
337
|
-
this.marker = ref;
|
|
338
|
-
}}
|
|
339
|
-
{...this.props}
|
|
340
|
-
image={image}
|
|
341
|
-
icon={icon}
|
|
342
|
-
style={[styles.marker, this.props.style]}
|
|
343
|
-
onPress={(event) => {
|
|
344
|
-
if (this.props.stopPropagation) {
|
|
345
|
-
event.stopPropagation();
|
|
346
|
-
}
|
|
347
|
-
if (this.props.onPress) {
|
|
348
|
-
this.props.onPress(event);
|
|
349
|
-
}
|
|
350
|
-
}}
|
|
351
|
-
/>
|
|
352
|
-
);
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
MapMarker.propTypes = propTypes;
|
|
357
|
-
MapMarker.defaultProps = defaultProps;
|
|
358
|
-
MapMarker.viewConfig = viewConfig;
|
|
359
|
-
|
|
360
|
-
const styles = StyleSheet.create({
|
|
361
|
-
marker: {
|
|
362
|
-
position: 'absolute',
|
|
363
|
-
backgroundColor: 'transparent',
|
|
364
|
-
},
|
|
365
|
-
});
|
|
366
|
-
|
|
367
|
-
MapMarker.Animated = Animated.createAnimatedComponent(MapMarker);
|
|
368
|
-
|
|
369
|
-
export default decorateMapComponent(MapMarker, {
|
|
370
|
-
componentType: 'Marker',
|
|
371
|
-
providers: {
|
|
372
|
-
google: {
|
|
373
|
-
ios: SUPPORTED,
|
|
374
|
-
android: USES_DEFAULT_IMPLEMENTATION,
|
|
375
|
-
},
|
|
376
|
-
},
|
|
377
|
-
});
|