1 | import * as React from 'react';
|
2 | import { StyleProp, TextStyle } from 'react-native';
|
3 | import type { $Omit, ThemeProp } from '../../types';
|
4 | import AnimatedText from '../Typography/AnimatedText';
|
5 | export type Props = $Omit<$Omit<React.ComponentPropsWithRef<typeof AnimatedText>, 'padding'>, 'type'> & {
|
6 | /**
|
7 | * Type of the helper text.
|
8 | */
|
9 | type: 'error' | 'info';
|
10 | /**
|
11 | * Text content of the HelperText.
|
12 | */
|
13 | children: React.ReactNode;
|
14 | /**
|
15 | * Whether to display the helper text.
|
16 | */
|
17 | visible?: boolean;
|
18 | /**
|
19 | * Whether to apply padding to the helper text.
|
20 | */
|
21 | padding?: 'none' | 'normal';
|
22 | /**
|
23 | * Whether the text input tied with helper text is disabled.
|
24 | */
|
25 | disabled?: boolean;
|
26 | style?: StyleProp<TextStyle>;
|
27 | /**
|
28 | * @optional
|
29 | */
|
30 | theme?: ThemeProp;
|
31 | /**
|
32 | * TestID used for testing purposes
|
33 | */
|
34 | testID?: string;
|
35 | };
|
36 | /**
|
37 | * Helper text is used in conjuction with input elements to provide additional hints for the user.
|
38 | *
|
39 | * ## Usage
|
40 | * ```js
|
41 | * import * as React from 'react';
|
42 | * import { View } from 'react-native';
|
43 | * import { HelperText, TextInput } from 'react-native-paper';
|
44 | *
|
45 | * const MyComponent = () => {
|
46 | * const [text, setText] = React.useState('');
|
47 | *
|
48 | * const onChangeText = text => setText(text);
|
49 | *
|
50 | * const hasErrors = () => {
|
51 | * return !text.includes('@');
|
52 | * };
|
53 | *
|
54 | * return (
|
55 | * <View>
|
56 | * <TextInput label="Email" value={text} onChangeText={onChangeText} />
|
57 | * <HelperText type="error" visible={hasErrors()}>
|
58 | * Email address is invalid!
|
59 | * </HelperText>
|
60 | * </View>
|
61 | * );
|
62 | * };
|
63 | *
|
64 | * export default MyComponent;
|
65 | * ```
|
66 | */
|
67 | declare const HelperText: ({ style, type, visible, theme: themeOverrides, onLayout, padding, disabled, ...rest }: Props) => React.JSX.Element;
|
68 | export default HelperText;
|
69 | //# sourceMappingURL=HelperText.d.ts.map |
\ | No newline at end of file |