-
Notifications
You must be signed in to change notification settings - Fork 30
/
index.d.ts
70 lines (63 loc) · 2.92 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
declare module "react-native-yusha-customkeyboard" {
import React from 'react'
import {
ComponentType,
ComponentClass,
} from 'react'
import {
NativeMethodsMixin,
Constructor,
ScrollViewProps,
TextInputProps,
EmitterSubscription
} from 'react-native'
//keyBoardAPI
type ShowTipDataType = {
isShow: boolean, //是否显示tip
ref: React.Component<any, any>, //显示tip的元素
keyValue: string, //要tip的值
}
interface InjectedKeyboardApiProps {
onKeyPress?: (key: string) => void,
onDelete?: () => void,
onClearAll?: () => void,
showTip?: (showTipData: ShowTipDataType) => void
}
interface WrapedCustomKeyboardViewConfig {
customKeyboardTop?: boolean, //是否自定义键盘头部
getKeyBoardIcon?: () => JSX.Element, //键盘图标
getKeyBoardName?: () => string, //返回键盘名称
}
type CustomKeyboardViewProps<P> = ComponentType<P & InjectedKeyboardApiProps> & WrapedCustomKeyboardViewConfig;
type KeyboardDecorator<P> = (component: CustomKeyboardViewProps<P>) => ComponentType<any>;
export function keyBoardAPI<P>(customKeyboardType: string): KeyboardDecorator<P>;
//NumberKeyBoardView
interface NumberKeyBoardViewProps {
keyboardType: 'decimal-pad' | 'number-pad', //可切换为ABC的键盘 | 单纯的数字键盘
disableDot: boolean, //是否有小数点
}
class NumberKeyBoardViewComponent extends React.Component<NumberKeyBoardViewProps> { }
const NumberKeyBoardViewBase: Constructor<NativeMethodsMixin> & typeof NumberKeyBoardViewComponent;
export class NumberKeyBoardView extends NumberKeyBoardViewBase { }
//SafeKeyBoardView
class SafeKeyBoardViewComponent extends React.Component<{}> { }
const SafeKeyBoardViewBase: Constructor<NativeMethodsMixin> & typeof SafeKeyBoardViewComponent;
export class SafeKeyBoardView extends SafeKeyBoardViewBase { }
//AwareCusKeyBoardScrollView
type ScrollViewStatic = React.ComponentClass<ScrollViewProps>
export var AwareCusKeyBoardScrollView: ScrollViewStatic;
export type AwareCusKeyBoardScrollView = ScrollViewStatic;
//CustomTextInput
type CustomTextInputProps = { customKeyboardType: string }
type CustomTextInputStatic = React.ComponentClass<TextInputProps & CustomTextInputProps>
export var CustomTextInput: CustomTextInputStatic;
export type CustomTextInput = CustomTextInputStatic;
//currentHeight
export const currentHeight: number;
//listener
type iOSKeyBoardSubscription = 'keyboardDidShow' | 'keyboardDidHide'
type KeyBoardSubscription = EmitterSubscription | iOSKeyBoardSubscription
export function addKeyBoardHideListener(): KeyBoardSubscription
export function addKeyBoardShowListener(): KeyBoardSubscription
export function removeKeyBoardListener(subscription: KeyBoardSubscription): void
}