diff --git a/index.d.ts b/index.d.ts index e9daca8..f71ec75 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,76 +1,107 @@ -declare module "react-device-detect" { - import * as React from "react"; - export class BrowserView extends React.Component { - device: any; +// Type definitions for react-device-detect 1.6.4 +// Project: https://github.com/duskload/react-device-detect +// Definitions by: Michael Laktionov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 - render(): JSX.Element; - } +declare module "react-device-detect" { + export import BrowserView = ReactDeviceDetect.BrowserView; + export import MobileView = ReactDeviceDetect.MobileView; + export import AndroidView = ReactDeviceDetect.AndroidView; + export import IEView = ReactDeviceDetect.IEView; + export import IOSView = ReactDeviceDetect.IOSView; + export import TabletView = ReactDeviceDetect.TabletView; + export import WinPhoneView = ReactDeviceDetect.WinPhoneView; + export import MobileOnlyView = ReactDeviceDetect.MobileOnlyView; + export import SmartTVView = ReactDeviceDetect.SmartTVView; + export import ConsoleView = ReactDeviceDetect.ConsoleView; + export import WearableView = ReactDeviceDetect.WearableView; + export import CustomView = ReactDeviceDetect.CustomView; + export import CustomViewProps = ReactDeviceDetect.CustomViewProps; + export import ViewProps = ReactDeviceDetect.ViewProps; + export import isBrowser = ReactDeviceDetect.isBrowser; + export import isMobile = ReactDeviceDetect.isMobile; + export import isTablet = ReactDeviceDetect.isTablet; + export import isSmartTV = ReactDeviceDetect.isSmartTV; + export import isConsole = ReactDeviceDetect.isConsole; + export import isWearable = ReactDeviceDetect.isWearable; + export import isMobileSafari = ReactDeviceDetect.isMobileSafari; + export import isChromium = ReactDeviceDetect.isChromium; + export import isMobileOnly = ReactDeviceDetect.isMobileOnly; + export import isAndroid = ReactDeviceDetect.isAndroid; + export import isWinPhone = ReactDeviceDetect.isWinPhone; + export import isIOS = ReactDeviceDetect.isIOS; + export import isChrome = ReactDeviceDetect.isChrome; + export import isFirefox = ReactDeviceDetect.isFirefox; + export import isSafari = ReactDeviceDetect.isSafari; + export import isOpera = ReactDeviceDetect.isOpera; + export import isIE = ReactDeviceDetect.isIE; + export import isEdge = ReactDeviceDetect.isEdge; + export import isYandex = ReactDeviceDetect.isYandex; + export import osVersion = ReactDeviceDetect.osVersion; + export import osName = ReactDeviceDetect.osName; + export import fullBrowserVersion = ReactDeviceDetect.fullBrowserVersion; + export import browserVersion = ReactDeviceDetect.browserVersion; + export import browserName = ReactDeviceDetect.browserName; + export import mobileVendor = ReactDeviceDetect.mobileVendor; + export import mobileModel = ReactDeviceDetect.mobileModel; + export import engineName = ReactDeviceDetect.engineName; + export import engineVersion = ReactDeviceDetect.engineVersion; + export import getUA = ReactDeviceDetect.getUA; +} - export class MobileView extends React.Component { - device: any; +declare namespace ReactDeviceDetect { - render(): JSX.Element; + export interface ViewProps { + renderWithFragment?: boolean; + children?: React.ReactNode; + viewClassName?: string; + style?: React.CSSProperties; } - export class AndroidView extends React.Component { - device: any; - - render(): JSX.Element; + export interface CustomViewProps { + renderWithFragment?: boolean; + children?: React.ReactNode; + viewClassName?: string; + style?: React.CSSProperties; + condition?: boolean } - export class IEView extends React.Component { - device: any; - - render(): JSX.Element; + export class BrowserView extends React.Component { } - export class IOSView extends React.Component { - device: any; - - render(): JSX.Element; + export class MobileView extends React.Component { } - export class TabletView extends React.Component { - device: any; - - render(): JSX.Element; + export class AndroidView extends React.Component { } - export class WinPhoneView extends React.Component { - device: any; - - render(): JSX.Element; + export class IEView extends React.Component { } - export class MobileOnlyView extends React.Component { - device: any; - - render(): JSX.Element; + export class IOSView extends React.Component { } - export class SmartTVView extends React.Component { - device: any; - - render(): JSX.Element; + export class TabletView extends React.Component { } - export class ConsoleView extends React.Component { - device: any; + export class WinPhoneView extends React.Component { + } - render(): JSX.Element; + export class MobileOnlyView extends React.Component { } - export class WearableView extends React.Component { - device: any; + export class SmartTVView extends React.Component { + } - render(): JSX.Element; + export class ConsoleView extends React.Component { } - export class CustomView extends React.Component { - device: any; + export class WearableView extends React.Component { + } - render(): JSX.Element; + export class CustomView extends React.Component { } export const isBrowser: boolean; diff --git a/package.json b/package.json index 759b86f..e4c653a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-device-detect", - "version": "1.6.4", + "version": "1.6.5", "description": "Detect device type and render your component according to it", "main": "dist/index.js", "typings": "./index.d.ts",