This repository has been archived by the owner on Jul 10, 2024. It is now read-only.
forked from wonday/react-native-orientation-locker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
89 lines (60 loc) · 2.85 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
/**
* Copyright (c) 2017-present, Wonday (@wonday.org)
* All rights reserved.
*
* This source code is licensed under the MIT-style license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
export enum OrientationType {
"PORTRAIT" = "PORTRAIT",
"PORTRAIT-UPSIDEDOWN" = "PORTRAIT-UPSIDEDOWN",
"LANDSCAPE-LEFT" = "LANDSCAPE-LEFT",
"LANDSCAPE-RIGHT" = "LANDSCAPE-RIGHT",
"FACE-UP" = "FACE-UP",
"FACE-DOWN" = "FACE-DOWN",
"UNKNOWN" = "UNKNOWN",
}
export const UNLOCK = 'UNLOCK';
export const PORTRAIT = 'PORTRAIT';
export const LANDSCAPE = 'LANDSCAPE';
export const LANDSCAPE_LEFT = 'LANDSCAPE_LEFT';
export const LANDSCAPE_RIGHT = 'LANDSCAPE_RIGHT';
export const PORTRAIT_UPSIDE_DOWN = 'PORTRAIT_UPSIDE_DOWN';
export const ALL_ORIENTATIONS_BUT_UPSIDE_DOWN = 'ALL_ORIENTATIONS_BUT_UPSIDE_DOWN';
export interface OrientationLockerProps {
orientation: typeof UNLOCK | typeof PORTRAIT | typeof LANDSCAPE | typeof LANDSCAPE_LEFT | typeof LANDSCAPE_RIGHT | typeof PORTRAIT_UPSIDE_DOWN | typeof ALL_ORIENTATIONS_BUT_UPSIDE_DOWN;
onChange?: (orientation: OrientationType) => void;
onDeviceChange?: (deviceOrientation: OrientationType) => void;
}
export const OrientationLocker: React.ComponentType<OrientationLockerProps>;
declare class Orientation {
static addOrientationListener(callback: (orientation: OrientationType) => void): void;
static removeOrientationListener(callback: (orientation: OrientationType) => void): void;
static addDeviceOrientationListener(callback: (deviceOrientation: OrientationType) => void): void;
static removeDeviceOrientationListener(callback: (deviceOrientation: OrientationType) => void): void;
static addLockListener(callback: (orientation: OrientationType) => void): void;
static removeLockListener(callback: (orientation: OrientationType) => void): void;
static removeAllListeners(): void;
static getInitialOrientation(): OrientationType;
static isLocked(): boolean;
static lockToPortrait(): void;
static lockToLandscape(): void;
static lockToLandscapeLeft(): void;
static lockToAllOrientationsButUpsideDown(): void;
static lockToLandscapeRight(): void;
static lockToPortraitUpsideDown(): void;
static unlockAllOrientations(): void;
static getOrientation(callback: (orientation: OrientationType) => void): void;
static getDeviceOrientation(callback: (orientation: OrientationType) => void): void;
static getAutoRotateState(callback: (state: boolean) => void): void;
}
export default Orientation;
declare function useOrientationChange(listener: (orientation: OrientationType) => void);
declare function useDeviceOrientationChange(listener: (orientation: OrientationType) => void);
declare function useLockListener(listener: (orientation: OrientationType) => void);
export {
useOrientationChange,
useDeviceOrientationChange,
useLockListener,
}