-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
98 lines (80 loc) · 2.17 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
declare module 'react-native-geolocation-service' {
export type AuthorizationLevel = 'always' | 'whenInUse'
export type AuthorizationResult = 'disabled' | 'granted' | 'denied' | 'restricted'
export type AccuracyIOS =
| 'bestForNavigation'
| 'best'
| 'nearestTenMeters'
| 'hundredMeters'
| 'kilometer'
| 'threeKilometers'
| 'reduced';
export type AccuracyAndroid =
| 'high'
| 'balanced'
| 'low'
| 'passive';
interface BaseOptions {
accuracy?: {
android?: AccuracyAndroid;
ios?: AccuracyIOS;
};
enableHighAccuracy?: boolean
distanceFilter?: number
showLocationDialog?: boolean
forceRequestLocation?: boolean
}
interface GeoOptions extends BaseOptions {
timeout?: number
maximumAge?: number
}
interface GeoWatchOptions extends BaseOptions {
interval?: number
fastestInterval?: number
useSignificantChanges?: boolean
showsBackgroundLocationIndicator?: boolean
}
export enum PositionError {
PERMISSION_DENIED = 1,
POSITION_UNAVAILABLE = 2,
TIMEOUT = 3,
PLAY_SERVICE_NOT_AVAILABLE = 4,
SETTINGS_NOT_SATISFIED = 5,
INTERNAL_ERROR = -1
}
export interface GeoError {
code: PositionError
message: string
}
export interface GeoCoordinates {
latitude: number
longitude: number
accuracy: number
altitude: number | null
heading: number | null
speed: number | null
altitudeAccuracy: number | null
}
export interface GeoPosition {
coords: GeoCoordinates
timestamp: number
mocked?: boolean;
}
type SuccessCallback = (position: GeoPosition) => void
type ErrorCallback = (error: GeoError) => void
export function requestAuthorization(
authorizationLevel: AuthorizationLevel
): Promise<AuthorizationResult>
export function getCurrentPosition(
successCallback: SuccessCallback,
errorCallback?: ErrorCallback,
options?: GeoOptions
): void
export function watchPosition(
successCallback: SuccessCallback,
errorCallback?: ErrorCallback,
options?: GeoWatchOptions
): number
export function clearWatch(watchID: number): void
export function stopObserving(): void
}