-
-
Notifications
You must be signed in to change notification settings - Fork 200
/
index.d.ts
287 lines (273 loc) · 8.37 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
declare module "react-native-maps-directions" {
// Type definitions for react-native-maps-directions 1.6
// Project: https://github.com/bramus/react-native-maps-directions
// Definitions by: Ali Oguzhan Yildiz <https://github.com/alioguzhan>
// Definitions by: Chris Shaffer (methodbox)<https://github.com/methodbox>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.3
import * as React from "react";
export type MapDirectionsLegs =[
{
distance: {
text: string,
value: number
},
duration: {
text: string,
value: number
},
end_address: string,
end_location: {
lat: number,
lng: number
},
start_address: string,
start_location: {
lat: number,
lng: number
},
steps: [{
distance: {
text: string,
value: number
},
duration: {
text: string,
value: number
},
end_location: {
lat: number,
lng: number
},
start_location: {
lat: number,
lng: number
},
html_instructions: string,
polyline: {
points: string
},
travel_mode: string,
maneuver: string | undefined
}],
traffic_speed_entry: [],
via_waypoint: [],
}]
export type MapDirectionsResponse = {
coordinates: [
{
latitude: number,
longitude: number
}],
distance: number,
duration: number,
fares: [],
legs: MapDirectionsLegs,
waypointOrder: [[number]]
}
export type MapViewDirectionsOrigin =
| string
| {
latitude: number;
longitude: number;
};
export type MapViewDirectionsWaypoints =
| string
| {
latitude: number;
longitude: number;
};
export type MapViewDirectionsDestination =
| string
| {
latitude: number;
longitude: number;
};
export type MapViewDirectionsMode =
| "DRIVING"
| "BICYCLING"
| "TRANSIT"
| "WALKING";
export type MapViewDirectionsPrecision =
| "high"
| "low";
export type MapViewDirectionsTimePrecision =
| "now"
| "none";
export interface MapViewDirectionsProps {
/**
* The origin location to start routing from.
*/
origin?: MapViewDirectionsOrigin;
/**
* Array of waypoints to use between origin and destination.
*/
waypoints?: MapViewDirectionsWaypoints[];
/**
* The destination location to start routing to.
*/
destination?: MapViewDirectionsDestination;
/**
* Your Google Maps API Key
*/
apikey: string;
/**
* Callback that is called when the routing has started.
*/
onStart?: (...args: any[]) => any;
/**
* Callback that is called when the routing has succesfully finished.
*/
onReady?: (...args: MapDirectionsResponse[]) => any;
/**
* Callback that is called in case the routing has failed.
*/
onError?: (...args: any[]) => any;
/**
* Which transportation mode to use when calculating directions.
* Allowed values are "DRIVING", "BICYCLING", "WALKING", and "TRANSIT".
*/
mode?: MapViewDirectionsMode;
/**
* The precision to draw the polyline with.
* Allowed values are "high", and "low".
* Defaults to "low"
*/
precision?: MapViewDirectionsPrecision;
/**
* The timePrecision to get Realtime traffic info.
* Allowed values are "none", and "now".
* Defaults to "none"
*/
timePrecision?: MapViewDirectionsTimePrecision;
/**
* If you include the channel parameter in your requests,
* you can generate a Successful Requests report that shows a breakdown
* of your application's API requests across different applications that
* use the same client ID (such as externally facing access vs. internally
* facing access).
*/
channel?: string;
/**
* The language to use when calculating directions.
*/
language?: string;
/**
* Tweak if the rendered MapView. Polyline should reset or not
* when calculating the route between origin and destionation.
* Set to false if you see the directions line glitching.
*/
resetOnChange?: boolean;
/**
* Set it to true if you would like Google Maps to re-order all the
* waypoints to optimize the route for the fastest route.
* Please be aware that if this option is enabled,
* you will be billed for a higher rate by Google
*/
optimizeWaypoints?: boolean;
/**
* Directions API has a limit of 10 or 25 (depends on the billing plan)
* waypoints per route. So waypoints array size is limited to those numbers.
* Set this to true if you would like to automatically split waypoints to
* multiple routes and by that avoid waypoints limit.
*/
splitWaypoints?: boolean;
/**
* Base URL of the Directions Service (API) you are using.
* By default the Google Directions API is used
* ("https://maps.googleapis.com/maps/api/directions/json").
* Usually you won't need to change this.
*/
directionsServiceBaseUrl?: string;
/**
* If you are using strings for origin or destination,
* sometimes you will get an incorrect route because
* Google Maps API needs the region where this places belong to.
*/
region?: string;
/**
* @number
* The stroke width to use for the path - the line displayed
* by polyline between two navigation points.
* Default: 1
*/
strokeWidth?: number;
/**
* @string
* The stroke color to use for the path.
* Default: "#000"
*/
strokeColor?: string;
/**
* @Array
* The stroke colors to use for the path (iOS only).
* Must be the same length as coordinates.
* Default: null
*/
strokeColors?: Array<string>;
/**
* @string
* The line cap style to apply to the open ends of the path.
* Possible values are butt, round or square.
* Note: lineCap is not yet supported for GoogleMaps provider on iOS.
* Default: "round"
*/
lineCap?: string;
/**
* @string
* The line join style to apply to corners of the path.
* Possible values are miter, round or bevel.
* Default: "round"
*/
lineJoin?: string;
/**
* @number
* The limiting value that helps avoid spikes at junctions
* between connected line segments. The miter limit helps you avoid
* spikes in paths that use the miter lineJoin style. If the ratio of
* the miter length—that is, the diagonal length of the miter join—to
* the line thickness exceeds the miter limit, the joint is converted
* to a bevel join. The default miter limit is 10, which results in the
* conversion of miters whose angle at the joint is less than 11 degrees.
*/
miterLimit?: number;
/**
* @boolean
* Boolean to indicate whether to draw each segment of the line as a geodesic
* as opposed to straight lines on the Mercator projection. A geodesic is the
* shortest path between two points on the Earth's surface.
* The geodesic curve is constructed assuming the Earth is a sphere.
*/
geodesic?: boolean;
/**
* @number
* (iOS only) The offset (in points) at which to start drawing the
* dash pattern. Use this property to start drawing a dashed line
* partway through a segment or gap. For example, a phase value of 6 for
* the patter 5-2-3-2 would cause drawing to begin in the middle of the first gap.
* Default: 0
*/
lineDashPhase?: number;
/**
* @Array
* An array of numbers specifying the dash pattern to use for the path.
* The array contains one or more numbers that indicate the lengths (measured in points)
* of the line segments and gaps in the pattern. The values in the array alternate,
* starting with the first line segment length, followed by the first gap length,
* followed by the second line segment length, and so on.
* Default: null
*/
lineDashPattern?: Array<number>;
/**
* @boolean
* Boolean to allow a polyline to be tappable and use the onPress function.
*/
tappable?: boolean;
}
export default class MapViewDirections extends React.Component<
MapViewDirectionsProps,
any
> {
render(): JSX.Element;
}
}