|
| 1 | +import { ImageStyle, TextStyle, StyleProp } from 'react-native'; |
| 2 | +import { BaseComponentInjectedProps, ForwardRefInjectedProps, TypographyModifiers, ColorsModifiers, BackgroundColorModifier, MarginModifiers } from '../../commons/new'; |
| 3 | +import { TouchableOpacityProps } from '../touchableOpacity'; |
| 4 | +import { TextProps } from '../text'; |
| 5 | +export declare enum ButtonSize { |
| 6 | + xSmall = "xSmall", |
| 7 | + small = "small", |
| 8 | + medium = "medium", |
| 9 | + large = "large" |
| 10 | +} |
| 11 | +export declare enum ButtonAnimationDirection { |
| 12 | + center = "center", |
| 13 | + left = "left", |
| 14 | + right = "right" |
| 15 | +} |
| 16 | +export declare type ButtonProps = TouchableOpacityProps & TypographyModifiers & ColorsModifiers & BackgroundColorModifier & MarginModifiers & { |
| 17 | + /** |
| 18 | + * Text to show inside the button |
| 19 | + */ |
| 20 | + label?: string; |
| 21 | + /** |
| 22 | + * The Button text color (inherited from Text component) |
| 23 | + */ |
| 24 | + color?: string; |
| 25 | + /** |
| 26 | + * Icon image source or a callback function that returns a source |
| 27 | + */ |
| 28 | + iconSource?: object | number | Function; |
| 29 | + /** |
| 30 | + * Icon image style |
| 31 | + */ |
| 32 | + iconStyle?: StyleProp<ImageStyle>; |
| 33 | + /** |
| 34 | + * Should the icon be right to the label |
| 35 | + */ |
| 36 | + iconOnRight?: boolean; |
| 37 | + /** |
| 38 | + * whether the icon should flip horizontally on RTL locals |
| 39 | + */ |
| 40 | + supportRTL?: boolean; |
| 41 | + /** |
| 42 | + * Color of the button background |
| 43 | + */ |
| 44 | + backgroundColor?: string; |
| 45 | + /** |
| 46 | + * Color of the disabled button background |
| 47 | + */ |
| 48 | + disabledBackgroundColor?: string; |
| 49 | + /** |
| 50 | + * Size of the button [large, medium, small, xSmall] |
| 51 | + */ |
| 52 | + size?: ButtonSize; |
| 53 | + /** |
| 54 | + * Custom border radius. |
| 55 | + */ |
| 56 | + borderRadius?: number; |
| 57 | + /** |
| 58 | + * Actions handler |
| 59 | + */ |
| 60 | + onPress?: (props: any) => void; |
| 61 | + /** |
| 62 | + * Disable interactions for the component |
| 63 | + */ |
| 64 | + disabled?: boolean; |
| 65 | + /** |
| 66 | + * Button will have outline style |
| 67 | + */ |
| 68 | + outline?: boolean; |
| 69 | + /** |
| 70 | + * The outline color |
| 71 | + */ |
| 72 | + outlineColor?: string; |
| 73 | + /** |
| 74 | + * The outline width |
| 75 | + */ |
| 76 | + outlineWidth?: number; |
| 77 | + /** |
| 78 | + * Button will look like a link |
| 79 | + */ |
| 80 | + link?: boolean; |
| 81 | + /** |
| 82 | + * label color for when it's displayed as link |
| 83 | + */ |
| 84 | + linkColor?: string; |
| 85 | + /** |
| 86 | + * Additional styles for label text |
| 87 | + */ |
| 88 | + labelStyle?: StyleProp<TextStyle>; |
| 89 | + /** |
| 90 | + * Props that will be passed to the button's Text label. |
| 91 | + */ |
| 92 | + labelProps?: TextProps; |
| 93 | + /** |
| 94 | + * should the button act as a coast to coast button (no border radius) |
| 95 | + */ |
| 96 | + fullWidth?: boolean; |
| 97 | + /** |
| 98 | + * should the button be a round button |
| 99 | + */ |
| 100 | + round?: boolean; |
| 101 | + /** |
| 102 | + * Control shadow visibility (iOS-only) |
| 103 | + */ |
| 104 | + enableShadow?: boolean; |
| 105 | + /** |
| 106 | + * avoid inner button padding |
| 107 | + */ |
| 108 | + avoidInnerPadding?: boolean; |
| 109 | + /** |
| 110 | + * avoid minimum width constraints |
| 111 | + */ |
| 112 | + avoidMinWidth?: boolean; |
| 113 | + /** |
| 114 | + * callback for getting activeBackgroundColor (e.g. (calculatedBackgroundColor, prop) => {...}) |
| 115 | + * better set using ThemeManager |
| 116 | + */ |
| 117 | + getActiveBackgroundColor?: (backgroundColor: string, props: any) => string; |
| 118 | + /** |
| 119 | + * should animate layout change |
| 120 | + * Note?: For Android you must set 'setLayoutAnimationEnabledExperimental(true)' via RN's 'UIManager' |
| 121 | + */ |
| 122 | + animateLayout?: boolean; |
| 123 | + /** |
| 124 | + * the direction of the animation ('left' and 'right' will effect the button's own alignment) |
| 125 | + */ |
| 126 | + animateTo?: ButtonAnimationDirection; |
| 127 | +}; |
| 128 | +export declare type ButtonPropTypes = ButtonProps; |
| 129 | +export declare type ButtonState = { |
| 130 | + size?: number; |
| 131 | + borderRadius?: number; |
| 132 | + isLandscape?: boolean; |
| 133 | +}; |
| 134 | +export declare type Props = ButtonProps & BaseComponentInjectedProps & ForwardRefInjectedProps; |
| 135 | +export declare const DEFAULT_PROPS: { |
| 136 | + iconOnRight: boolean; |
| 137 | +}; |
0 commit comments