Skip to content

Commit 4c918ff

Browse files
Yukiya Nakagawasatya164
authored andcommitted
fix: fix TypeScript typings for TextInput methods (#753)
### Motivation * paper version: v2.6.1 * typescript version: v3.2.2 The `TextInput` class has public methods `isFocused`, `clear`, `focus`, `blur`. https://github.com/callstack/react-native-paper/blob/v2.6.1/src/components/TextInput.js#L348-L374 However, they are not declared in d.ts as below. ![2019-01-24 17 51 02](https://user-images.githubusercontent.com/434227/51666158-ab726300-2000-11e9-9da1-b5a8be0ad32d.png) ### Test plan Typecheck for below function. ```typescript import { TextInput } from "react-native-paper"; function doAnything(textInput: TextInput) { textInput.isFocused(); textInput.clear(); textInput.focus(); textInput.blur(); } ```
1 parent 02a9a0e commit 4c918ff

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

typings/components/TextInput.d.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,9 @@ export interface RenderProps extends NativeTextInputProps {
3636
value?: string;
3737
}
3838

39-
export declare class TextInput extends React.Component<TextInputProps> {}
39+
export declare class TextInput extends React.Component<TextInputProps> {
40+
isFocused: () => boolean;
41+
clear: () => void;
42+
focus(): void;
43+
blur(): void;
44+
}

0 commit comments

Comments
 (0)