diff --git a/types/react-native-modal-dropdown/index.d.ts b/types/react-native-modal-dropdown/index.d.ts index c0358fe746..99c00b7ec3 100644 --- a/types/react-native-modal-dropdown/index.d.ts +++ b/types/react-native-modal-dropdown/index.d.ts @@ -1,45 +1,46 @@ -// Type definitions for react-native-modal-dropdown 0.6 +// Type definitions for react-native-modal-dropdown 0.7 // Project: https://github.com/sohobloo/react-native-modal-dropdown // Definitions by: Carlos Li +// Ruslan Yurchenko // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 -import * as React from "react"; +import * as React from 'react'; +import { StyleProp, TextStyle, ViewProps, ViewStyle, Constructor, NativeMethodsMixin } from 'react-native'; -import ModalDropdown = RNModalDropdown.ModalDropdown; -export = ModalDropdown; - -declare namespace RNModalDropdown { - interface PositionStyle { - left?: number; - right?: number; - width?: number; - } - interface ModalDropdownProps { - disabled?: boolean; - defaultIndex?: number; - defaultValue?: string; - options?: any[]; - animated?: boolean; - scrollEnabled?: boolean; - showsVerticalScrollIndicator?: boolean; - style?: any; - textStyle?: any; - dropdownStyle?: any; - dropdownTextStyle?: any; - dropdownTextHighlightStyle?: any; - adjustFrame?: (positionStyle: PositionStyle) => void; - renderRow?: (option: any, index: number, isSelected: boolean) => any; - renderSeparator?: () => any; - renderButtonText?: (text: any) => any; - onDropdownWillShow?: () => any; - onDropdownWillHide?: () => any; - onSelect?: (index: number, option: any) => void; - accessible?: boolean; - keyboardShouldPersistTaps?: "always" | "never" | "handled"; - } - - class ModalDropdown extends React.Component { - static default: typeof ModalDropdown; - } +export interface PositionStyle { + top?: number; + left?: number; + right?: number; + width?: number; + height?: number; +} + +export interface ModalDropdownProps extends ViewProps { + disabled?: boolean; + defaultIndex?: number; + defaultValue?: string; + options?: T[]; + animated?: boolean; + scrollEnabled?: boolean; + showsVerticalScrollIndicator?: boolean; + textStyle?: StyleProp; + dropdownStyle?: StyleProp; + dropdownTextStyle?: StyleProp; + dropdownTextHighlightStyle?: StyleProp; + adjustFrame?: (positionStyle: PositionStyle) => PositionStyle; + renderRow?: (option: T, index: string, isSelected: boolean) => React.ReactNode; + renderSeparator?: (sectionID: string, index: string, adjacentRowHighlighted: boolean) => React.ReactNode; + renderButtonText?: (text: string) => string; + onDropdownWillShow?: () => void | boolean; + onDropdownWillHide?: () => void | boolean; + onSelect?: (index: string, option: T) => void | boolean; + accessible?: boolean; + keyboardShouldPersistTaps?: 'always' | 'never' | 'handled'; +} + +export default class ModalDropdown extends React.Component> { + show(): void; + hide(): void; + select(index: number): void; } diff --git a/types/react-native-modal-dropdown/react-native-modal-dropdown-tests.tsx b/types/react-native-modal-dropdown/react-native-modal-dropdown-tests.tsx index 685dd1f531..e0471b8478 100644 --- a/types/react-native-modal-dropdown/react-native-modal-dropdown-tests.tsx +++ b/types/react-native-modal-dropdown/react-native-modal-dropdown-tests.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import ModalDropdown from "react-native-modal-dropdown"; -class Test extends React.Component { +class Test extends React.Component { render() { return ( diff --git a/types/react-native-modal-dropdown/tsconfig.json b/types/react-native-modal-dropdown/tsconfig.json index 9800a11341..4dba1b8071 100644 --- a/types/react-native-modal-dropdown/tsconfig.json +++ b/types/react-native-modal-dropdown/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6", - "dom" + "es6" ], "noImplicitAny": true, "noImplicitThis": true,