@prosperitainova/dumbo-react-native
Version:
Dumbo for React Native Library
54 lines • 2.6 kB
TypeScript
import React from 'react';
import { ViewProps, StyleProp, ViewStyle } from 'react-native';
/** Types of notifications */
export type NotificationTypes = 'info' | 'error' | 'warning' | 'success';
/** Props for Notification component */
export type NotificationProps = {
/** Notification kind (defeault is info) */
kind?: NotificationTypes;
/** Title of the notification */
title: string;
/** Subtitle of the notification */
subTitle?: string;
/** Action area for buttons or other content. Anything can be used; recommended is ghost or tertiary [this may be out of date with new dark mode tertiary] button. */
actionArea?: React.ReactNode;
/** Callback when dismiss is pressed (will render X to dismiss if set) */
onDismiss?: () => void;
/** Text to use for on dismiss icon (accessibility). Defaults to ENGLISH "Close" */
onDismissText?: string;
/** Indicate if low contrast mode should be used */
lowContrast?: boolean;
/** Indicate if items should stack instead of being side by side */
multiLine?: boolean;
/** Indicates if drop shadow should be added (for floating notifications) */
dropShadow?: boolean;
/** Style to set on the item */
style?: StyleProp<ViewStyle>;
/** Direct props to set on the React Native component (including iOS and Android specific props). Most use cases should not need this. */
componentProps?: ViewProps;
};
/**
* Notification component for showing the accept legal terms flow
*
* Notification component is "InlineNotification" by default and can be
* used as "ToastNotification" by using multiLine flag and setting max width (follow Carbon web for Toast).
*
* Buttons (actionArea) in Notifications can require some funky color enforcing due to light theme use in non standard background colors. See the Example app for real world examples. Example usage:
*
* ```javascript
* <Button forceTheme={lowContrast ? 'light' : undefined} kind={lowContrast ? 'high-contrast' : 'high-contrast-inverse'} style={this.styles.button} onPress={this.actionCallback} text="Action" />
* ```
*
* {@link https://github.com/carbon-design-system/carbon-react-native/blob/main/example/src/Views/Notification.tsx | Example code}
*/
export declare class Notification extends React.Component<NotificationProps> {
private get styles();
private get accentColor();
private get textColor();
private get backgroundColor();
private get icon();
private get notificationContent();
private get dismissArea();
render(): React.ReactNode;
}
//# sourceMappingURL=index.d.ts.map