mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
[react-native-modal-dropdown] Add definitions (#31735)
* react-native-modal-dropdown: initial definitions * fix the project path and export class * fix member-access
This commit is contained in:
+44
@@ -0,0 +1,44 @@
|
||||
// Type definitions for react-native-modal-dropdown 0.6
|
||||
// Project: https://github.com/sohobloo/react-native-modal-dropdown
|
||||
// Definitions by: Carlos Li <https://github.com/echoulen>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import * as React from "react";
|
||||
|
||||
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;
|
||||
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?: () => boolean;
|
||||
onDropdownWillHide?: () => boolean;
|
||||
onSelect?: (index: number, option: any) => void;
|
||||
accessible?: boolean;
|
||||
keyboardShouldPersistTaps?: "always" | "never" | "handled";
|
||||
}
|
||||
|
||||
class ModalDropdown extends React.Component<ModalDropdownProps> {
|
||||
static default: typeof ModalDropdown;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import * as React from 'react';
|
||||
import ModalDropdown from "react-native-modal-dropdown";
|
||||
|
||||
class Test extends React.Component<any> {
|
||||
render() {
|
||||
return (
|
||||
<ModalDropdown options={["option 1", "option 2"]}/>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"jsx": "react",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-native-modal-dropdown-tests.tsx"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user