Textarea.d.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import * as React from "react";
  2. import * as PropTypes from "prop-types";
  3. export type TextareaProps = React.HTMLProps<HTMLTextAreaElement> & {
  4. /** Called whenever the textarea resizes */
  5. onResize?: (e: Event) => void;
  6. /** Minimum number of visible rows */
  7. rows?: React.HTMLProps<HTMLTextAreaElement>["rows"];
  8. /** Maximum number of visible rows */
  9. maxRows?: number;
  10. /** Initialize `autosize` asynchronously.
  11. * Enable it if you are using StyledComponents
  12. * This is forced to true when `maxRows` is set.
  13. */
  14. async?: boolean;
  15. };
  16. export type State = {
  17. lineHeight: number | null;
  18. };
  19. export type DefaultProps = {
  20. rows: number;
  21. async: boolean;
  22. };
  23. export declare class Textarea extends React.Component<TextareaProps, State> {
  24. textarea: HTMLTextAreaElement | null;
  25. currentValue: TextareaProps["value"];
  26. static defaultProps: DefaultProps;
  27. static propTypes: {
  28. [key in keyof TextareaProps]: PropTypes.Requireable<any>;
  29. };
  30. state: State;
  31. onResize: (e: Event) => void;
  32. componentDidUpdate(): void;
  33. componentDidMount(): void;
  34. componentWillUnmount(): void;
  35. onChange: (e: React.SyntheticEvent<HTMLTextAreaElement>) => void;
  36. updateLineHeight: () => void;
  37. render(): React.JSX.Element;
  38. }