@ranamaps/maps-react-native 0.0.0-stage → 0.4.0-beta.0

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.
Files changed (41) hide show
  1. package/BETA-STATUS.md +13 -0
  2. package/CHANGELOG.md +40 -0
  3. package/LICENSE.md +13 -0
  4. package/NOTICES.md +230 -0
  5. package/README.md +61 -2
  6. package/RanaMapsReactNative.podspec +17 -0
  7. package/android/build.gradle +25 -0
  8. package/android/src/main/AndroidManifest.xml +1 -0
  9. package/android/src/main/java/com/ranamaps/reactnative/RanaMapManager.kt +115 -0
  10. package/android/src/main/java/com/ranamaps/reactnative/RanaMapsModule.kt +41 -0
  11. package/android/src/main/java/com/ranamaps/reactnative/RanaMapsPackage.kt +11 -0
  12. package/app.plugin.js +127 -0
  13. package/ios/RanaMapViewComponentView.mm +116 -0
  14. package/ios/RanaMapsModule.mm +32 -0
  15. package/ios/RanaNativeRuntime.swift +42 -0
  16. package/lib/bridge.d.ts +40 -0
  17. package/lib/bridge.js +152 -0
  18. package/lib/index.d.ts +31 -0
  19. package/lib/index.js +113 -0
  20. package/lib/map-lifecycle.d.ts +5 -0
  21. package/lib/map-lifecycle.js +10 -0
  22. package/lib/models.d.ts +509 -0
  23. package/lib/models.js +2 -0
  24. package/lib/sdk.d.ts +309 -0
  25. package/lib/sdk.js +588 -0
  26. package/lib/specs/NativeRanaMaps.d.ts +8 -0
  27. package/lib/specs/NativeRanaMaps.js +4 -0
  28. package/lib/specs/RanaMapViewNativeComponent.d.ts +13 -0
  29. package/lib/specs/RanaMapViewNativeComponent.js +4 -0
  30. package/lib/specs/RanaMarkerViewNativeComponent.d.ts +9 -0
  31. package/lib/specs/RanaMarkerViewNativeComponent.js +4 -0
  32. package/package.json +59 -4
  33. package/react-native.config.js +12 -0
  34. package/src/bridge.ts +184 -0
  35. package/src/index.tsx +168 -0
  36. package/src/map-lifecycle.ts +11 -0
  37. package/src/models.ts +510 -0
  38. package/src/sdk.ts +732 -0
  39. package/src/specs/NativeRanaMaps.ts +16 -0
  40. package/src/specs/RanaMapViewNativeComponent.ts +10 -0
  41. package/src/specs/RanaMarkerViewNativeComponent.ts +9 -0
@@ -0,0 +1,509 @@
1
+ export type Mode = "car" | "okada" | "keke" | "bicycle" | "walk" | "transit";
2
+ export type Avoid = "tolls" | "highways" | "ferries";
3
+ export type MarkerContentKind = "pin" | "badge" | "avatar" | "dot" | "image" | "photo" | "stop";
4
+ export type RouteStopRole = "start" | "waypoint" | "destination";
5
+ export type PinGlyph = "dot" | "none" | "home" | "work" | "star" | "food" | "flag";
6
+ export type MarkerSize = "s" | "m" | "l";
7
+ export type MarkerState = "rest" | "selected" | "disabled";
8
+ export type MarkerAnchor = "center" | "top" | "bottom" | "left" | "right" | "topLeft" | "topRight" | "bottomLeft" | "bottomRight";
9
+ export type VehicleKind = "car" | "okada" | "delivery" | "keke" | "danfo" | "bicycle" | "walker";
10
+ export type VehicleState = "moving" | "selected" | "offline";
11
+ export type VehicleBase = "none" | "disc";
12
+ export type VehicleAppearanceKind = "kit" | "image" | "animated";
13
+ export type TravellerAppearanceKind = "puck" | "dot" | "vehicle";
14
+ export type PolylinePreset = "defaultLine" | "okada" | "keke" | "danfo" | "car" | "walk" | "alternative" | "trace" | "transit";
15
+ export type LineDash = "solid" | "dashed" | "dotted";
16
+ export type LineCap = "round" | "butt" | "square";
17
+ export type Traffic = "moving" | "slow" | "goSlow" | "closed";
18
+ export type ShapeStyle = "area" | "avoid";
19
+ export type ControlPlacement = "hidden" | "topLeft" | "topRight" | "bottomLeft" | "bottomRight";
20
+ export type MapCorner = "topLeft" | "topRight" | "bottomLeft" | "bottomRight";
21
+ export type LocationTracking = "none" | "follow" | "followHeading";
22
+ export type LocationMotion = "direct" | "smooth";
23
+ export type LocationActivity = "generic" | "vehicle" | "walking";
24
+ export type LocateState = "off" | "following" | "heading" | "finding" | "offPermission";
25
+ export type LocationRouteState = "none" | "matched" | "uncertain" | "offRoute";
26
+ export type ReroutingState = "disabled" | "monitoring" | "waiting" | "rerouting" | "rerouted" | "failed" | "exhausted" | "blocked" | "nearDestination";
27
+ export type JourneyTraceSource = "measured" | "simulated";
28
+ export type DataLayerKind = "circle" | "line" | "fill" | "symbol";
29
+ export type DragPhase = "started" | "changed" | "ended" | "cancelled";
30
+ export interface LatLng {
31
+ readonly latitude: number;
32
+ readonly longitude: number;
33
+ }
34
+ export interface ScreenPoint {
35
+ readonly x: number;
36
+ readonly y: number;
37
+ }
38
+ export interface CameraOptions {
39
+ readonly center?: LatLng | null;
40
+ readonly zoom?: number | null;
41
+ readonly bearing?: number | null;
42
+ readonly pitch?: number | null;
43
+ }
44
+ export interface CameraState {
45
+ readonly center: LatLng;
46
+ readonly zoom: number;
47
+ readonly bearing: number;
48
+ readonly pitch: number;
49
+ }
50
+ export interface CameraBounds {
51
+ readonly southWest: LatLng;
52
+ readonly northEast: LatLng;
53
+ }
54
+ export interface CameraConstraints {
55
+ readonly minZoom?: number | null;
56
+ readonly maxZoom?: number | null;
57
+ readonly minPitch?: number | null;
58
+ readonly maxPitch?: number | null;
59
+ readonly bounds?: CameraBounds | null;
60
+ }
61
+ export interface MapPadding {
62
+ readonly top?: number | null;
63
+ readonly left?: number | null;
64
+ readonly bottom?: number | null;
65
+ readonly right?: number | null;
66
+ }
67
+ export interface GestureOptions {
68
+ readonly pan?: boolean | null;
69
+ readonly zoom?: boolean | null;
70
+ readonly rotate?: boolean | null;
71
+ readonly tilt?: boolean | null;
72
+ readonly doubleTapZoom?: boolean | null;
73
+ readonly quickZoom?: boolean | null;
74
+ }
75
+ export interface ControlsOptions {
76
+ readonly compass?: ControlPlacement | null;
77
+ readonly zoom?: ControlPlacement | null;
78
+ readonly locate?: ControlPlacement | null;
79
+ readonly scale?: ControlPlacement | null;
80
+ }
81
+ export interface AttributionOptions {
82
+ readonly corner?: MapCorner | null;
83
+ readonly expandedDurationMs?: number | null;
84
+ }
85
+ export interface LocationOptions {
86
+ readonly tracking?: LocationTracking | null;
87
+ readonly appearance?: TravellerAppearanceWire | null;
88
+ readonly breakTrackingOnGesture?: boolean | null;
89
+ readonly maxFixAgeSeconds?: number | null;
90
+ readonly motion?: LocationMotion | null;
91
+ readonly activity?: LocationActivity | null;
92
+ readonly firstFixZoom?: number | null;
93
+ }
94
+ export interface MapSettings {
95
+ readonly camera?: CameraOptions | null;
96
+ readonly constraints?: CameraConstraints | null;
97
+ readonly gestures?: GestureOptions | null;
98
+ readonly padding?: MapPadding | null;
99
+ readonly location?: LocationOptions | null;
100
+ readonly markerAllowOverlap?: boolean | null;
101
+ readonly attribution?: AttributionOptions | null;
102
+ }
103
+ export interface RanaStyle {
104
+ readonly kind: string;
105
+ readonly code?: string | null;
106
+ readonly revision?: number | null;
107
+ }
108
+ export interface MapOptions {
109
+ readonly style?: RanaStyle | null;
110
+ readonly center?: LatLng | null;
111
+ readonly zoom?: number | null;
112
+ readonly telemetry?: boolean | null;
113
+ readonly controls?: ControlsOptions | null;
114
+ readonly settings?: MapSettings | null;
115
+ }
116
+ export interface MarkerContentWire {
117
+ readonly kind: MarkerContentKind;
118
+ readonly glyph?: PinGlyph | null;
119
+ readonly label?: string | null;
120
+ readonly size?: MarkerSize | null;
121
+ readonly drop?: boolean | null;
122
+ readonly text?: string | null;
123
+ readonly icon?: PinGlyph | null;
124
+ readonly name?: string | null;
125
+ readonly live?: boolean | null;
126
+ readonly imageBase64?: string | null;
127
+ readonly anchor?: MarkerAnchor | null;
128
+ readonly role?: RouteStopRole | null;
129
+ }
130
+ export interface MarkerStyle {
131
+ readonly color?: string | null;
132
+ readonly state?: MarkerState | null;
133
+ readonly sortKey?: number | null;
134
+ readonly rotation?: number | null;
135
+ readonly offsetX?: number | null;
136
+ readonly offsetY?: number | null;
137
+ readonly draggable?: boolean | null;
138
+ readonly accessibilityLabel?: string | null;
139
+ }
140
+ export interface CalloutWire {
141
+ readonly title: string;
142
+ readonly detail?: string | null;
143
+ readonly primary?: string | null;
144
+ readonly secondary?: string | null;
145
+ }
146
+ export interface ViewMarkerOptions {
147
+ readonly anchor?: MarkerAnchor | null;
148
+ readonly offsetX?: number | null;
149
+ readonly offsetY?: number | null;
150
+ readonly rotation?: number | null;
151
+ }
152
+ export interface ClusterOptions {
153
+ readonly color?: string | null;
154
+ readonly cluster?: boolean | null;
155
+ }
156
+ export interface VehicleAppearanceWire {
157
+ readonly kind: VehicleAppearanceKind;
158
+ readonly vehicle?: VehicleKind | null;
159
+ readonly color?: string | null;
160
+ readonly base?: VehicleBase | null;
161
+ readonly imageBase64?: string | null;
162
+ readonly framesBase64?: ReadonlyArray<string> | null;
163
+ readonly frameMs?: number | null;
164
+ readonly size?: number | null;
165
+ readonly rotates?: boolean | null;
166
+ }
167
+ export interface TravellerAppearanceWire {
168
+ readonly kind: TravellerAppearanceKind;
169
+ readonly vehicle?: VehicleAppearanceWire | null;
170
+ }
171
+ export interface VehicleOptions {
172
+ readonly heading?: number | null;
173
+ readonly size?: number | null;
174
+ readonly state?: VehicleState | null;
175
+ readonly accessibilityLabel?: string | null;
176
+ }
177
+ export interface LineOutline {
178
+ readonly color: string;
179
+ readonly width: number;
180
+ }
181
+ export interface LineSegment {
182
+ readonly from: number;
183
+ readonly to: number;
184
+ readonly traffic: Traffic;
185
+ }
186
+ export interface LineGlow {
187
+ readonly color?: string | null;
188
+ readonly width?: number | null;
189
+ readonly opacity?: number | null;
190
+ }
191
+ export interface PolylineOptions {
192
+ readonly preset?: PolylinePreset | null;
193
+ readonly mode?: Mode | null;
194
+ readonly color?: string | null;
195
+ readonly width?: number | null;
196
+ readonly outline?: LineOutline | null;
197
+ readonly outlineEnabled?: boolean | null;
198
+ readonly dash?: LineDash | null;
199
+ readonly cap?: LineCap | null;
200
+ readonly arrows?: boolean | null;
201
+ readonly opacity?: number | null;
202
+ readonly progress?: number | null;
203
+ readonly stops?: boolean | null;
204
+ readonly travelledColor?: string | null;
205
+ readonly segments?: ReadonlyArray<LineSegment> | null;
206
+ readonly glow?: LineGlow | null;
207
+ readonly belowLayerId?: string | null;
208
+ readonly accessibilityLabel?: string | null;
209
+ }
210
+ export interface ShapeOptions {
211
+ readonly color?: string | null;
212
+ readonly style?: ShapeStyle | null;
213
+ readonly selected?: boolean | null;
214
+ readonly label?: string | null;
215
+ }
216
+ export interface UserLocationOptions {
217
+ readonly accuracyMetres?: number | null;
218
+ readonly heading?: number | null;
219
+ readonly appearance?: TravellerAppearanceWire | null;
220
+ readonly stale?: boolean | null;
221
+ }
222
+ export interface LocationFix {
223
+ readonly point: LatLng;
224
+ readonly accuracyMetres?: number | null;
225
+ readonly heading?: number | null;
226
+ readonly timestampMs: number;
227
+ readonly speedMetresPerSecond?: number | null;
228
+ readonly courseAccuracyDegrees?: number | null;
229
+ }
230
+ export interface HeadingFix {
231
+ readonly heading: number;
232
+ readonly accuracyDegrees?: number | null;
233
+ readonly timestampMs: number;
234
+ }
235
+ export interface LocationRouteOptions {
236
+ readonly maxSnapDistanceMetres?: number | null;
237
+ readonly maxAccuracyMetres?: number | null;
238
+ readonly headingLookAheadMetres?: number | null;
239
+ }
240
+ export interface LocationRouteStatus {
241
+ readonly state: LocationRouteState;
242
+ readonly distanceFromRouteMetres?: number | null;
243
+ readonly progressMetres?: number | null;
244
+ }
245
+ export interface RouteLocation {
246
+ readonly latitude?: number | null;
247
+ readonly longitude?: number | null;
248
+ readonly placeId?: string | null;
249
+ }
250
+ export interface DirectionsOptions {
251
+ readonly origin: RouteLocation;
252
+ readonly destination: RouteLocation;
253
+ readonly mode?: Mode | null;
254
+ readonly waypoints?: ReadonlyArray<LatLng> | null;
255
+ readonly alternatives?: boolean | null;
256
+ readonly avoid?: ReadonlyArray<Avoid> | null;
257
+ readonly departureTime?: string | null;
258
+ }
259
+ export interface Step {
260
+ readonly instruction: string;
261
+ readonly maneuver?: string | null;
262
+ readonly distanceM: number;
263
+ readonly durationS: number;
264
+ readonly streetNames: ReadonlyArray<string>;
265
+ readonly location: LatLng;
266
+ readonly geometry: string;
267
+ }
268
+ export interface Leg {
269
+ readonly distanceM: number;
270
+ readonly durationS: number;
271
+ readonly start: LatLng;
272
+ readonly end: LatLng;
273
+ readonly steps: ReadonlyArray<Step>;
274
+ }
275
+ export interface Route {
276
+ readonly distanceM: number;
277
+ readonly durationS: number;
278
+ readonly geometry: string;
279
+ readonly legs: ReadonlyArray<Leg>;
280
+ }
281
+ export interface DirectionsResult {
282
+ readonly routes: ReadonlyArray<Route>;
283
+ readonly attribution: string;
284
+ }
285
+ export interface MatrixOptions {
286
+ readonly origins: ReadonlyArray<LatLng>;
287
+ readonly destinations: ReadonlyArray<LatLng>;
288
+ readonly mode?: Mode | null;
289
+ readonly avoid?: ReadonlyArray<Avoid> | null;
290
+ }
291
+ export interface MatrixCell {
292
+ readonly distanceM?: number | null;
293
+ readonly durationS?: number | null;
294
+ }
295
+ export interface MatrixResult {
296
+ readonly rows: ReadonlyArray<ReadonlyArray<MatrixCell>>;
297
+ readonly attribution: string;
298
+ }
299
+ export interface SnapOptions {
300
+ readonly points: ReadonlyArray<LatLng>;
301
+ readonly mode?: Mode | null;
302
+ readonly interpolate?: boolean | null;
303
+ }
304
+ export interface SnappedPoint {
305
+ readonly point: LatLng;
306
+ readonly originalIndex?: number | null;
307
+ }
308
+ export interface SnapResult {
309
+ readonly points: ReadonlyArray<SnappedPoint>;
310
+ readonly distanceM: number;
311
+ readonly geometry: string;
312
+ readonly attribution: string;
313
+ }
314
+ export interface Address {
315
+ readonly street?: string | null;
316
+ readonly streetSource?: string | null;
317
+ readonly area?: string | null;
318
+ readonly ward?: string | null;
319
+ readonly city?: string | null;
320
+ readonly lga?: string | null;
321
+ readonly state?: string | null;
322
+ readonly country?: string | null;
323
+ readonly formatted?: string | null;
324
+ readonly attribution: string;
325
+ }
326
+ export interface SearchOptions {
327
+ readonly query: string;
328
+ readonly near?: LatLng | null;
329
+ readonly limit?: number | null;
330
+ }
331
+ export interface OsmTag {
332
+ readonly osmClass: string;
333
+ readonly kind: string;
334
+ }
335
+ export interface GeocodeResult {
336
+ readonly label: string;
337
+ readonly point: LatLng;
338
+ readonly kind: string;
339
+ readonly placeId: string;
340
+ readonly source?: string | null;
341
+ readonly osm?: OsmTag | null;
342
+ readonly alsoKnownAs?: ReadonlyArray<string> | null;
343
+ readonly sources?: ReadonlyArray<string> | null;
344
+ }
345
+ export interface PlaceSuggestion {
346
+ readonly placeId: string;
347
+ readonly name: string;
348
+ readonly secondary: string;
349
+ readonly kind: string;
350
+ readonly point: LatLng;
351
+ readonly source?: string | null;
352
+ readonly osm?: OsmTag | null;
353
+ readonly alsoKnownAs?: ReadonlyArray<string> | null;
354
+ readonly sources?: ReadonlyArray<string> | null;
355
+ }
356
+ export interface Gate {
357
+ readonly name: string;
358
+ readonly role: string;
359
+ readonly point: LatLng;
360
+ readonly status: string;
361
+ readonly hours?: string | null;
362
+ }
363
+ export interface PlacePhoto {
364
+ readonly id: string;
365
+ readonly url: string;
366
+ }
367
+ export interface PlaceDetails {
368
+ readonly placeId: string;
369
+ readonly name: string;
370
+ readonly aliases: ReadonlyArray<string>;
371
+ readonly kind: string;
372
+ readonly point: LatLng;
373
+ readonly street?: string | null;
374
+ readonly houseNumber?: string | null;
375
+ readonly howToFind?: string | null;
376
+ readonly gates: ReadonlyArray<Gate>;
377
+ readonly photos: ReadonlyArray<PlacePhoto>;
378
+ readonly updatedAt?: string | null;
379
+ readonly attribution: string;
380
+ }
381
+ export interface NearbyOptions {
382
+ readonly point: LatLng;
383
+ readonly radiusM?: number | null;
384
+ readonly kind?: string | null;
385
+ readonly keyword?: string | null;
386
+ readonly limit?: number | null;
387
+ }
388
+ export interface NearbyPlace {
389
+ readonly placeId: string;
390
+ readonly name: string;
391
+ readonly kind: string;
392
+ readonly point: LatLng;
393
+ readonly distanceM: number;
394
+ readonly source?: string | null;
395
+ readonly osm?: OsmTag | null;
396
+ readonly alsoKnownAs?: ReadonlyArray<string> | null;
397
+ readonly sources?: ReadonlyArray<string> | null;
398
+ }
399
+ export interface KeyInfo {
400
+ readonly organisationId: string;
401
+ readonly keyId: string;
402
+ readonly kind: string;
403
+ readonly plan: string;
404
+ readonly perMinute: Readonly<Record<string, number>>;
405
+ readonly perDay: Readonly<Record<string, number>>;
406
+ }
407
+ export interface ReroutingOptions {
408
+ readonly destination: RouteLocation;
409
+ readonly mode?: Mode | null;
410
+ readonly remainingWaypoints?: ReadonlyArray<LatLng> | null;
411
+ readonly avoid?: ReadonlyArray<Avoid> | null;
412
+ readonly offRouteDurationSeconds?: number | null;
413
+ readonly minOffRouteFixes?: number | null;
414
+ readonly cooldownSeconds?: number | null;
415
+ readonly maxAccuracyMetres?: number | null;
416
+ readonly maxFixAgeSeconds?: number | null;
417
+ readonly responseMaxMovementMetres?: number | null;
418
+ readonly requestTimeoutSeconds?: number | null;
419
+ readonly nearDestinationMetres?: number | null;
420
+ }
421
+ export interface ReroutingRequest {
422
+ readonly origin: LocationFix;
423
+ readonly destination: RouteLocation;
424
+ readonly mode: Mode;
425
+ readonly remainingWaypoints: ReadonlyArray<LatLng>;
426
+ readonly avoid: ReadonlyArray<Avoid>;
427
+ }
428
+ export interface ReroutingResult {
429
+ readonly path: ReadonlyArray<LatLng>;
430
+ readonly route?: Route | null;
431
+ }
432
+ export interface ErrorInfo {
433
+ readonly code: string;
434
+ readonly message: string;
435
+ readonly status: number;
436
+ readonly requestId?: string | null;
437
+ readonly retryAfter?: number | null;
438
+ }
439
+ export interface ReroutingStatus {
440
+ readonly state: ReroutingState;
441
+ readonly requestsMade: number;
442
+ readonly error?: ErrorInfo | null;
443
+ }
444
+ export interface JourneyTraceOptions {
445
+ readonly consent: boolean;
446
+ readonly source: JourneyTraceSource;
447
+ readonly mode?: Mode | null;
448
+ }
449
+ export interface JourneyTraceReceipt {
450
+ readonly accepted: number;
451
+ readonly simulated: boolean;
452
+ }
453
+ export interface JourneyTraceStatus {
454
+ readonly buffered: number;
455
+ readonly uploaded: number;
456
+ readonly dropped: number;
457
+ readonly stopped: boolean;
458
+ readonly error?: ErrorInfo | null;
459
+ }
460
+ export interface OfflineRegionOptions {
461
+ readonly id: string;
462
+ readonly bounds: CameraBounds;
463
+ readonly style?: RanaStyle | null;
464
+ readonly minZoom?: number | null;
465
+ readonly maxZoom?: number | null;
466
+ readonly maxBytes?: number | null;
467
+ }
468
+ export interface OfflineRegionInfo {
469
+ readonly id: string;
470
+ readonly styleUrl: string;
471
+ readonly bounds: CameraBounds;
472
+ readonly minZoom: number;
473
+ readonly maxZoom: number;
474
+ readonly maxBytes: number;
475
+ }
476
+ export interface OfflineProgress {
477
+ readonly completedResources: number;
478
+ readonly requiredResources: number;
479
+ readonly completedBytes: number;
480
+ readonly complete: boolean;
481
+ readonly active: boolean;
482
+ readonly precise: boolean;
483
+ }
484
+ export interface JourneyTracePoint {
485
+ readonly latitude: number;
486
+ readonly longitude: number;
487
+ readonly timestampMs: number;
488
+ readonly accuracyM: number;
489
+ readonly speedMps?: number | null;
490
+ readonly headingDeg?: number | null;
491
+ }
492
+ export interface JourneyTraceBatch {
493
+ readonly journeyId: string;
494
+ readonly batchId: string;
495
+ readonly consent: boolean;
496
+ readonly source: JourneyTraceSource;
497
+ readonly mode: Mode;
498
+ readonly points: ReadonlyArray<JourneyTracePoint>;
499
+ }
500
+ export interface NativeLocationOptions {
501
+ readonly intervalMs?: number | null;
502
+ readonly minDistanceMetres?: number | null;
503
+ readonly desiredAccuracyMetres?: number | null;
504
+ }
505
+ export interface MarkerDragEvent {
506
+ readonly markerId: string;
507
+ readonly point: LatLng;
508
+ readonly phase: DragPhase;
509
+ }
package/lib/models.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });