UNPKG

2.17 kBTypeScriptView Raw
1import React from 'react';
2import { StyleProp, TextStyle, LayoutChangeEvent, Animated } from 'react-native';
3import { AdornmentSide } from './enums';
4export declare type Props = {
5 /**
6 * Text to show.
7 */
8 text: string;
9 onLayout?: (event: LayoutChangeEvent) => void;
10 /**
11 * Style that is passed to the Text element.
12 */
13 textStyle?: StyleProp<TextStyle>;
14 /**
15 * @optional
16 */
17 theme: ReactNativePaper.Theme;
18};
19declare type ContextState = {
20 topPosition: number | null;
21 onLayout?: (event: LayoutChangeEvent) => void;
22 visible?: Animated.Value;
23 textStyle?: StyleProp<TextStyle>;
24 side: AdornmentSide;
25 paddingHorizontal?: number | string;
26 maxFontSizeMultiplier?: number | undefined | null;
27};
28declare const AffixAdornment: React.FunctionComponent<{
29 affix: React.ReactNode;
30 testID: string;
31} & ContextState>;
32/**
33 * A component to render a leading / trailing text in the TextInput
34 *
35 * <div class="screenshots">
36 * <figure>
37 * <img class="medium" src="screenshots/textinput-outline.affix.png" />
38 * </figure>
39 * </div>
40 *
41 * ## Usage
42 * ```js
43 * import * as React from 'react';
44 * import { TextInput } from 'react-native-paper';
45 *
46 * const MyComponent = () => {
47 * const [text, setText] = React.useState('');
48 *
49 * return (
50 * <TextInput
51 * mode="outlined"
52 * label="Outlined input"
53 * placeholder="Type something"
54 * right={<TextInput.Affix text="/100" />}
55 * />
56 * );
57 * };
58 *
59 * export default MyComponent;
60 * ```
61 */
62declare const TextInputAffix: {
63 ({ text, textStyle: labelStyle, theme }: Props): JSX.Element;
64 displayName: string;
65};
66declare const _default: React.ComponentType<Pick<Props, "text" | "onLayout" | "textStyle"> & {
67 theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
68}> & import("@callstack/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<Props> & {
69 ({ text, textStyle: labelStyle, theme }: Props): JSX.Element;
70 displayName: string;
71}, {}>;
72export default _default;
73export { TextInputAffix, AffixAdornment };