forked from wonday/react-native-orientation-locker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
51 lines (46 loc) · 2.04 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
/**
* 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.
*/
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",
}
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,
}