@prosperitainova/dumbo-react-native
Version:
Dumbo for React Native Library
60 lines • 2.8 kB
TypeScript
import React, { Ref } from 'react';
import { GestureResponderEvent, PressableProps, StyleProp, TextProps as ReactTextProps, View, ViewStyle } from 'react-native';
import type { CarbonIcon } from '../../types/shared';
import { ThemeChoices } from '../../styles/colors';
import { TextBreakModes, TextTypes } from '../Text';
/** Props for Button component */
export type ButtonProps = {
/** Text to render (for iconOnlyMode use descriptive text) */
text: string;
/** Icon to render (size 20) */
icon?: CarbonIcon;
/** Indicate if icon only mode should be used (text is not rendered) */
iconOnlyMode?: boolean;
/** Indicate if button is disabled */
disabled?: boolean;
/** Button kind. Primary is default */
kind?: 'primary' | 'secondary' | 'tertiary' | 'danger' | 'ghost' | 'danger-tertiary' | 'danger-ghost' | 'high-contrast' | 'high-contrast-inverse';
/** Text type to render (Standard is default) */
textType?: TextTypes;
/** onPress event */
onPress?: (event: GestureResponderEvent) => void;
/** onLongPress event */
onLongPress?: (event: GestureResponderEvent) => void;
/** Indicate if keyboard should be dismissed onPress */
dismissKeyboardOnPress?: boolean;
/** Style to set on the item */
style?: StyleProp<ViewStyle>;
/** Override text icon and border color for edge cases */
overrideColor?: string;
/** Direct props to set on the React Native component (including iOS and Android specific props). Most use cases should not need this. */
componentProps?: PressableProps;
/** Direct props to set on the React Native component for Text (including iOS and Android specific props). Most use cases should not need this. */
textComponentProps?: ReactTextProps;
/** Ref property for parent */
forwardRef?: Ref<View>;
/** Disable extra padding on right of buttons */
disableDesignPadding?: boolean;
/** Break mode used on string type content (default is tail) */
breakMode?: TextBreakModes;
/** Force theme color (useful for rendering on light items in other mode) */
forceTheme?: ThemeChoices;
};
/**
* Button component for rendering a button
* To not have a button be pressable 100% of screen format parent or pass style appropriately. `alignSelf: 'flex-start'` is useful.
*
* {@link https://github.com/carbon-design-system/carbon-react-native/blob/main/example/src/Views/Button.tsx | Example code}
*/
export declare class Button extends React.Component<ButtonProps> {
private basicButton;
private get styles();
private getBackgroundColor;
private getStateStyle;
private get buttonStyle();
private get iconTextColor();
private get textStyle();
private onPress;
render(): React.ReactNode;
}
//# sourceMappingURL=index.d.ts.map