UNPKG

react-native-dualscreeninfo

Version:

React Native package for dual screen devices support (Surface Duo)

45 lines (44 loc) 1.72 kB
/** * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. */ import { DualScreenInfoEvent, DualScreenInfoPayload, SpannedChangeHandler, WindowRect, DeviceOrientation } from "../types"; import { EmitterSubscription } from "react-native"; declare module 'react-native' { namespace NativeModules { interface DualScreenInfo { isDualScreenDevice: boolean; hingeWidth: number; orientation: DeviceOrientation; getPayload(): Promise<DualScreenInfoPayload>; } } } export interface ExposedNativeMethods { addEventListener: (type: DualScreenInfoEvent, handler: SpannedChangeHandler) => void; removeEventListener: (type: DualScreenInfoEvent, handler: SpannedChangeHandler) => void; } interface IDualScreenInfoModule extends ExposedNativeMethods { isDualScreenDevice: boolean; hingeWidth: number; isSpanning: boolean; windowRects: WindowRect[]; orientation: DeviceOrientation; } declare class RNDualScreenInfoModule implements IDualScreenInfoModule { private mIsSpanning; private mWindowRects; private mOrientation; private eventEmitter; constructor(); addEventListener(type: DualScreenInfoEvent, handler: SpannedChangeHandler): EmitterSubscription; removeEventListener(type: DualScreenInfoEvent, handler: SpannedChangeHandler): void; getPayload(): Promise<DualScreenInfoPayload>; get isDualScreenDevice(): boolean; get hingeWidth(): number; get isSpanning(): boolean; get windowRects(): WindowRect[]; get orientation(): DeviceOrientation; } export declare const DualScreenInfo: RNDualScreenInfoModule; export {};