Skip to content

Commit

Permalink
Export Input in TypeScript definitions (#953)
Browse files Browse the repository at this point in the history
* Fixes #947 Input is not exported in TypeScript definitions

* Use react-native TextInputProperties and match type description to docs description

* Add missing methods for Input component
  • Loading branch information
msevestre authored and iRoachie committed Feb 28, 2018
1 parent 5025bba commit 29f30d4
Showing 1 changed file with 85 additions and 0 deletions.
85 changes: 85 additions & 0 deletions src/index.d.ts
Expand Up @@ -730,11 +730,96 @@ export interface FormValidationMessageProps extends ViewProperties {
*/
fontFamily?: string;
}

export class FormValidationMessage extends React.Component<
FormValidationMessageProps,
any
> {}

export interface InputProps extends TextInputProperties {
/**
* Styling for Input Component Container (optional)
*/
containerStyle?: StyleProp<ViewStyle>;

/**
* Displays an icon to the left (optional)
*/
leftIcon?: JSX.Element;

/**
* Styling for left Icon Component container
*/
leftIconContainerStyle?: StyleProp<ViewStyle>;

/**
* Displays an icon to the right (optional)
*/
rightIcon?: JSX.Element;

/**
* Styling for the right icon container
*/
rightIconContainerStyle?: StyleProp<ViewStyle>;

/**
* Adds styling to input component (optional)
*/
inputStyle?: StyleProp<TextStyle>;

/**
* Adds shaking effect to input component (optional)
*/
shake?: any;

/**
* Displays error (optional)
*/
displayError?: boolean

/**
* Add styling to error message (optional)
*/
errorStyle?: StyleProp<TextStyle>;

/**
* Adds error message (optional)
* *
* @default 'Error!'
*/
errorMessage?: string
}

export class Input extends React.Component<InputProps, any> {
/**
* Shakes the Input
*
* eg `this.inputRef.shake()`
*/
shake(): void;

/**
* Calls focus on the Input
*
* eg `this.inputRef.focus()`
*/
focus(): void;

/**
* Calls blur on the Input
*
* eg `this.inputRef.blur()`
*/
blur(): void;

/**
* Calls clear on the Input
*
* eg `this.inputRef.clear()`
*/
clear(): void;
}

export interface FormInputProps extends TextInputProperties {
/**
* TextInput container styling
Expand Down

0 comments on commit 29f30d4

Please sign in to comment.