Skip to content

Commit d03a648

Browse files
committed
refactor: add "type" prop to Alert component (for alignment), deprecate "alertType" prop
1 parent 1a05ad0 commit d03a648

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

src/ui-components/Alert.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,14 @@ const s = StyleSheet.create({
3939
export interface AlertComponentProps extends NotifierComponentProps {
4040
/** Background color will be changed depending on the type. Available values: `error`(red), `success`(green), `warn`(orange) and `info`(blue).
4141
* @default 'success' */
42-
alertType: AlertTypes;
42+
type: AlertTypes;
4343

44-
/** While the background of the alert depends on `alertType`, you can also set the other color you want.
44+
/**
45+
* @deprecated use `type` instead
46+
*/
47+
alertType?: AlertTypes;
48+
49+
/** While the background of the alert depends on `type`, you can also set the other color you want.
4550
* @default null */
4651
backgroundColor?: string;
4752

@@ -58,7 +63,7 @@ export interface AlertComponentProps extends NotifierComponentProps {
5863
maxDescriptionLines?: number;
5964

6065
/** A container of the component. Set it in case you use different SafeAreaView than the custom `ViewWithOffsets`
61-
* @default SafeAreaView */
66+
* @default ViewWithOffsets */
6267
ContainerComponent?: React.ElementType;
6368

6469
/** The style to use for rendering title
@@ -75,6 +80,7 @@ export const AlertComponent = ({
7580
titleStyle,
7681
description,
7782
descriptionStyle,
83+
type = 'success',
7884
alertType = 'success',
7985
backgroundColor,
8086
textColor,
@@ -88,7 +94,7 @@ export const AlertComponent = ({
8894
return (
8995
<Container
9096
style={{
91-
backgroundColor: backgroundColor || bgColors[alertType],
97+
backgroundColor: backgroundColor || bgColors[type ?? alertType],
9298
}}
9399
>
94100
<View style={s.container}>

0 commit comments

Comments
 (0)