react-native-earl-toastify 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +71 -0
- package/LICENSE +21 -0
- package/README.md +513 -0
- package/dist/Toast.d.ts +12 -0
- package/dist/Toast.d.ts.map +1 -0
- package/dist/Toast.js +143 -0
- package/dist/Toast.js.map +1 -0
- package/dist/ToastContainer.d.ts +12 -0
- package/dist/ToastContainer.d.ts.map +1 -0
- package/dist/ToastContainer.js +46 -0
- package/dist/ToastContainer.js.map +1 -0
- package/dist/ToastProvider.d.ts +22 -0
- package/dist/ToastProvider.d.ts.map +1 -0
- package/dist/ToastProvider.js +163 -0
- package/dist/ToastProvider.js.map +1 -0
- package/dist/animations.d.ts +54 -0
- package/dist/animations.d.ts.map +1 -0
- package/dist/animations.js +118 -0
- package/dist/animations.js.map +1 -0
- package/dist/icons.d.ts +12 -0
- package/dist/icons.d.ts.map +1 -0
- package/dist/icons.js +110 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.d.ts +63 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/styles.js +182 -0
- package/dist/styles.js.map +1 -0
- package/dist/types.d.ts +100 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/useToast.d.ts +40 -0
- package/dist/useToast.d.ts.map +1 -0
- package/dist/useToast.js +48 -0
- package/dist/useToast.js.map +1 -0
- package/dist/useToastAnimation.d.ts +24 -0
- package/dist/useToastAnimation.d.ts.map +1 -0
- package/dist/useToastAnimation.js +59 -0
- package/dist/useToastAnimation.js.map +1 -0
- package/package.json +58 -0
- package/src/Toast.tsx +250 -0
- package/src/ToastContainer.tsx +70 -0
- package/src/ToastProvider.tsx +271 -0
- package/src/animations.ts +161 -0
- package/src/icons.tsx +152 -0
- package/src/index.ts +41 -0
- package/src/styles.ts +208 -0
- package/src/types.ts +157 -0
- package/src/useToast.ts +53 -0
- package/src/useToastAnimation.ts +108 -0
package/dist/Toast.js
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useCallback } from "react";
|
|
2
|
+
import { Animated, Text, TouchableOpacity, View, StyleSheet, AccessibilityInfo, } from "react-native";
|
|
3
|
+
import { useToastAnimation } from "./useToastAnimation";
|
|
4
|
+
import { getToastColors, baseToastStyle, getPositionalStyle, titleStyle, descriptionStyle, messageStyle, textContainerStyle, iconContainerStyle, closeButtonStyle, } from "./styles";
|
|
5
|
+
import { DefaultIcons } from "./icons";
|
|
6
|
+
/**
|
|
7
|
+
* Individual Toast component with animations
|
|
8
|
+
*/
|
|
9
|
+
export const Toast = ({ toast, position, onHide }) => {
|
|
10
|
+
const { id, title, message, type = "default", duration = 3000, animationIn = "fade", animationOut = "fade", animationDuration = 300, dismissable = true, icon, hideIcon = false, backgroundColor, textColor, borderColor, style, textStyle, onShow, onHide: onHideCallback, onPress, } = toast;
|
|
11
|
+
const timerRef = useRef(null);
|
|
12
|
+
const isHidingRef = useRef(false);
|
|
13
|
+
// Get colors based on type
|
|
14
|
+
const colors = getToastColors(type);
|
|
15
|
+
const finalBackgroundColor = backgroundColor || colors.background;
|
|
16
|
+
const finalTextColor = textColor || colors.text;
|
|
17
|
+
const finalBorderColor = borderColor || colors.border;
|
|
18
|
+
// Animation hook
|
|
19
|
+
const { animatedStyle, startExitAnimation } = useToastAnimation(animationIn, animationOut, position, animationDuration);
|
|
20
|
+
/**
|
|
21
|
+
* Handle hiding the toast
|
|
22
|
+
*/
|
|
23
|
+
const handleHide = useCallback(() => {
|
|
24
|
+
if (isHidingRef.current)
|
|
25
|
+
return;
|
|
26
|
+
isHidingRef.current = true;
|
|
27
|
+
// Clear timer
|
|
28
|
+
if (timerRef.current) {
|
|
29
|
+
clearTimeout(timerRef.current);
|
|
30
|
+
timerRef.current = null;
|
|
31
|
+
}
|
|
32
|
+
// Start exit animation
|
|
33
|
+
startExitAnimation(() => {
|
|
34
|
+
onHideCallback?.();
|
|
35
|
+
onHide(id);
|
|
36
|
+
});
|
|
37
|
+
}, [id, onHide, onHideCallback, startExitAnimation]);
|
|
38
|
+
/**
|
|
39
|
+
* Handle press on toast
|
|
40
|
+
*/
|
|
41
|
+
const handlePress = useCallback(() => {
|
|
42
|
+
onPress?.();
|
|
43
|
+
if (dismissable) {
|
|
44
|
+
handleHide();
|
|
45
|
+
}
|
|
46
|
+
}, [onPress, dismissable, handleHide]);
|
|
47
|
+
// Setup auto-dismiss timer
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
// Call onShow callback
|
|
50
|
+
onShow?.();
|
|
51
|
+
// Announce to accessibility
|
|
52
|
+
AccessibilityInfo.announceForAccessibility(message);
|
|
53
|
+
// Setup auto-dismiss if duration > 0
|
|
54
|
+
if (duration > 0) {
|
|
55
|
+
timerRef.current = setTimeout(() => {
|
|
56
|
+
handleHide();
|
|
57
|
+
}, duration);
|
|
58
|
+
}
|
|
59
|
+
return () => {
|
|
60
|
+
if (timerRef.current) {
|
|
61
|
+
clearTimeout(timerRef.current);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}, [duration, message, onShow, handleHide]);
|
|
65
|
+
// Render icon
|
|
66
|
+
const renderIcon = () => {
|
|
67
|
+
if (hideIcon)
|
|
68
|
+
return null;
|
|
69
|
+
if (icon) {
|
|
70
|
+
return <View style={iconContainerStyle}>{icon}</View>;
|
|
71
|
+
}
|
|
72
|
+
// Use default icon based on type
|
|
73
|
+
const DefaultIcon = DefaultIcons[type];
|
|
74
|
+
if (DefaultIcon) {
|
|
75
|
+
return (<View style={iconContainerStyle}>
|
|
76
|
+
<DefaultIcon color={colors.icon} size={20}/>
|
|
77
|
+
</View>);
|
|
78
|
+
}
|
|
79
|
+
return null;
|
|
80
|
+
};
|
|
81
|
+
// Render close button
|
|
82
|
+
const renderCloseButton = () => {
|
|
83
|
+
if (!dismissable)
|
|
84
|
+
return null;
|
|
85
|
+
return (<TouchableOpacity style={closeButtonStyle} onPress={handleHide} accessibilityRole="button" accessibilityLabel="Dismiss notification" hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}>
|
|
86
|
+
<DefaultIcons.close color={colors.icon} size={16}/>
|
|
87
|
+
</TouchableOpacity>);
|
|
88
|
+
};
|
|
89
|
+
const containerStyles = [
|
|
90
|
+
baseToastStyle,
|
|
91
|
+
getPositionalStyle(position),
|
|
92
|
+
{
|
|
93
|
+
backgroundColor: finalBackgroundColor,
|
|
94
|
+
borderLeftColor: finalBorderColor,
|
|
95
|
+
},
|
|
96
|
+
style,
|
|
97
|
+
];
|
|
98
|
+
// Accessibility label combines title and message
|
|
99
|
+
const accessibilityLabel = title ? `${title}. ${message}` : message;
|
|
100
|
+
// Render text content - title + description or just message
|
|
101
|
+
const renderTextContent = () => {
|
|
102
|
+
if (title) {
|
|
103
|
+
// Has title: render title (larger) + message as description (smaller)
|
|
104
|
+
return (<View style={textContainerStyle}>
|
|
105
|
+
<Text style={[
|
|
106
|
+
titleStyle,
|
|
107
|
+
{ color: finalTextColor },
|
|
108
|
+
textStyle,
|
|
109
|
+
]} numberOfLines={2}>
|
|
110
|
+
{title}
|
|
111
|
+
</Text>
|
|
112
|
+
<Text style={[descriptionStyle, { color: finalTextColor }]} numberOfLines={2}>
|
|
113
|
+
{message}
|
|
114
|
+
</Text>
|
|
115
|
+
</View>);
|
|
116
|
+
}
|
|
117
|
+
// No title: render message as main text
|
|
118
|
+
return (<Text style={[messageStyle, { color: finalTextColor }, textStyle]} numberOfLines={3}>
|
|
119
|
+
{message}
|
|
120
|
+
</Text>);
|
|
121
|
+
};
|
|
122
|
+
return (<Animated.View style={[
|
|
123
|
+
containerStyles,
|
|
124
|
+
{
|
|
125
|
+
opacity: animatedStyle.opacity,
|
|
126
|
+
transform: animatedStyle.transform,
|
|
127
|
+
},
|
|
128
|
+
]} accessibilityRole="alert" accessibilityLiveRegion="polite">
|
|
129
|
+
<TouchableOpacity style={styles.content} onPress={handlePress} activeOpacity={dismissable ? 0.8 : 1} disabled={!dismissable && !onPress} accessibilityRole="button" accessibilityLabel={accessibilityLabel} accessibilityHint={dismissable ? "Double tap to dismiss" : undefined}>
|
|
130
|
+
{renderIcon()}
|
|
131
|
+
{renderTextContent()}
|
|
132
|
+
{renderCloseButton()}
|
|
133
|
+
</TouchableOpacity>
|
|
134
|
+
</Animated.View>);
|
|
135
|
+
};
|
|
136
|
+
const styles = StyleSheet.create({
|
|
137
|
+
content: {
|
|
138
|
+
flex: 1,
|
|
139
|
+
flexDirection: "row",
|
|
140
|
+
alignItems: "center",
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
//# sourceMappingURL=Toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.js","sourceRoot":"","sources":["../src/Toast.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,EACN,QAAQ,EACR,IAAI,EACJ,gBAAgB,EAChB,IAAI,EACJ,UAAU,EACV,iBAAiB,GACjB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EACN,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,GAChB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAQvC;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAyB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;IAC1E,MAAM,EACL,EAAE,EACF,KAAK,EACL,OAAO,EACP,IAAI,GAAG,SAAS,EAChB,QAAQ,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AAC,CACnC,iBAAiB,CAAC,QAAQ,CAC1B,kBAAkB,CAAC,CAAC,kBAAkB,CAAC,CACvC,iBAAiB,CAAC,CACjB,WAAW,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,SACzC,CAAC,CAED;IAAA,CAAC,UAAU,EAAE,CACb;IAAA,CAAC,iBAAiB,EAAE,CACpB;IAAA,CAAC,iBAAiB,EAAE,CACrB;GAAA,EAAE,gBAAgB,CACnB;EAAA,EAAE,QAAQ,CAAC,IAAI,CAAC,CAChB,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAChC,OAAO,EAAE;QACR,IAAI,EAAE,CAAC;QACP,aAAa,EAAE,KAAK;QACpB,UAAU,EAAE,QAAQ;KACpB;CACD,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Toast as ToastData, ToastPosition } from "./types";
|
|
3
|
+
export interface ToastContainerProps {
|
|
4
|
+
toasts: ToastData[];
|
|
5
|
+
position: ToastPosition;
|
|
6
|
+
onHide: (id: string) => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Container component that positions and renders toasts
|
|
10
|
+
*/
|
|
11
|
+
export declare const ToastContainer: React.FC<ToastContainerProps>;
|
|
12
|
+
//# sourceMappingURL=ToastContainer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastContainer.d.ts","sourceRoot":"","sources":["../src/ToastContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG5D,MAAM,WAAW,mBAAmB;IACnC,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,QAAQ,EAAE,aAAa,CAAC;IACxB,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAyCxD,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import { View, StyleSheet } from "react-native";
|
|
3
|
+
import { Toast } from "./Toast";
|
|
4
|
+
/**
|
|
5
|
+
* Container component that positions and renders toasts
|
|
6
|
+
*/
|
|
7
|
+
export const ToastContainer = ({ toasts, position, onHide, }) => {
|
|
8
|
+
// Filter toasts for this position
|
|
9
|
+
const positionedToasts = useMemo(() => {
|
|
10
|
+
return toasts.filter((toast) => (toast.position || "top") === position);
|
|
11
|
+
}, [toasts, position]);
|
|
12
|
+
if (positionedToasts.length === 0)
|
|
13
|
+
return null;
|
|
14
|
+
// Get container positioning based on position
|
|
15
|
+
const getContainerPositionStyle = () => {
|
|
16
|
+
switch (position) {
|
|
17
|
+
case "top":
|
|
18
|
+
return { top: 0, paddingTop: 50 }; // 50px for status bar
|
|
19
|
+
case "bottom":
|
|
20
|
+
return { bottom: 0, paddingBottom: 34 }; // 34px for home indicator
|
|
21
|
+
case "center":
|
|
22
|
+
return { top: 0, bottom: 0, justifyContent: "center" };
|
|
23
|
+
default:
|
|
24
|
+
return { top: 0, paddingTop: 50 };
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
return (<View style={[styles.container, getContainerPositionStyle()]} pointerEvents="box-none">
|
|
28
|
+
{positionedToasts.map((toast, index) => (<View key={toast.id} style={index > 0 ? styles.toastGap : undefined}>
|
|
29
|
+
<Toast toast={toast} position={position} onHide={onHide}/>
|
|
30
|
+
</View>))}
|
|
31
|
+
</View>);
|
|
32
|
+
};
|
|
33
|
+
const styles = StyleSheet.create({
|
|
34
|
+
container: {
|
|
35
|
+
position: "absolute",
|
|
36
|
+
left: 0,
|
|
37
|
+
right: 0,
|
|
38
|
+
zIndex: 9999,
|
|
39
|
+
elevation: 9999,
|
|
40
|
+
pointerEvents: "box-none",
|
|
41
|
+
},
|
|
42
|
+
toastGap: {
|
|
43
|
+
marginTop: 8,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=ToastContainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastContainer.js","sourceRoot":"","sources":["../src/ToastContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAQhC;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAkC,CAAC,EAC7D,MAAM,EACN,QAAQ,EACR,MAAM,GACN,EAAE,EAAE;IACJ,kCAAkC;IAClC,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,EAAE;QACrC,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,KAAK,QAAQ,CAAC,CAAC;IACzE,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEvB,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAE/C,8CAA8C;IAC9C,MAAM,yBAAyB,GAAG,GAAG,EAAE;QACtC,QAAQ,QAAQ,EAAE,CAAC;YAClB,KAAK,KAAK;gBACT,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC,sBAAsB;YAC1D,KAAK,QAAQ;gBACZ,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,CAAC,0BAA0B;YACpE,KAAK,QAAQ;gBACZ,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,cAAc,EAAE,QAAiB,EAAE,CAAC;YACjE;gBACC,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;QACpC,CAAC;IACF,CAAC,CAAC;IAEF,OAAO,CACN,CAAC,IAAI,CACJ,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,yBAAyB,EAAE,CAAC,CAAC,CACvD,aAAa,CAAC,UAAU,CAExB;GAAA,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CACvC,CAAC,IAAI,CACJ,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CACd,KAAK,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAE/C;KAAA,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,EACzD;IAAA,EAAE,IAAI,CAAC,CACP,CAAC,CACH;EAAA,EAAE,IAAI,CAAC,CACP,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAChC,SAAS,EAAE;QACV,QAAQ,EAAE,UAAU;QACpB,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,IAAI;QACZ,SAAS,EAAE,IAAI;QACf,aAAa,EAAE,UAAU;KACzB;IACD,QAAQ,EAAE;QACT,SAAS,EAAE,CAAC;KACZ;CACD,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import { ToastContextValue, ToastProviderConfig } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Toast context for accessing toast functions
|
|
5
|
+
*/
|
|
6
|
+
export declare const ToastContext: React.Context<ToastContextValue | null>;
|
|
7
|
+
export interface ToastProviderProps {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
config?: ToastProviderConfig;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* ToastProvider - Wrap your app with this component to enable toasts
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <ToastProvider config={{ defaultPosition: 'bottom' }}>
|
|
17
|
+
* <App />
|
|
18
|
+
* </ToastProvider>
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare const ToastProvider: React.FC<ToastProviderProps>;
|
|
22
|
+
//# sourceMappingURL=ToastProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastProvider.d.ts","sourceRoot":"","sources":["../src/ToastProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAKb,SAAS,EACT,MAAM,OAAO,CAAC;AAEf,OAAO,EAGN,iBAAiB,EACjB,mBAAmB,EAEnB,MAAM,SAAS,CAAC;AAGjB;;GAEG;AACH,eAAO,MAAM,YAAY,yCAAgD,CAAC;AAqB1E,MAAM,WAAW,kBAAkB;IAClC,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,CAAC,EAAE,mBAAmB,CAAC;CAC7B;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAgNtD,CAAC"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import React, { createContext, useState, useCallback, useMemo, } from "react";
|
|
2
|
+
import { View, StyleSheet } from "react-native";
|
|
3
|
+
import { ToastContainer } from "./ToastContainer";
|
|
4
|
+
/**
|
|
5
|
+
* Toast context for accessing toast functions
|
|
6
|
+
*/
|
|
7
|
+
export const ToastContext = createContext(null);
|
|
8
|
+
/**
|
|
9
|
+
* Generate unique ID for toasts
|
|
10
|
+
*/
|
|
11
|
+
const generateId = () => {
|
|
12
|
+
return `toast-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Default configuration values
|
|
16
|
+
*/
|
|
17
|
+
const DEFAULT_CONFIG = {
|
|
18
|
+
defaultPosition: "top",
|
|
19
|
+
defaultDuration: 3000,
|
|
20
|
+
defaultAnimationIn: "fade",
|
|
21
|
+
defaultAnimationOut: "fade",
|
|
22
|
+
defaultAnimationDuration: 300,
|
|
23
|
+
maxToasts: 5,
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* ToastProvider - Wrap your app with this component to enable toasts
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* <ToastProvider config={{ defaultPosition: 'bottom' }}>
|
|
31
|
+
* <App />
|
|
32
|
+
* </ToastProvider>
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export const ToastProvider = ({ children, config = {}, }) => {
|
|
36
|
+
const [toasts, setToasts] = useState([]);
|
|
37
|
+
// Merge config with defaults
|
|
38
|
+
const mergedConfig = useMemo(() => ({ ...DEFAULT_CONFIG, ...config }), [config]);
|
|
39
|
+
/**
|
|
40
|
+
* Show a toast notification
|
|
41
|
+
*/
|
|
42
|
+
const show = useCallback((toastConfig) => {
|
|
43
|
+
const id = generateId();
|
|
44
|
+
const newToast = {
|
|
45
|
+
id,
|
|
46
|
+
title: toastConfig.title,
|
|
47
|
+
message: toastConfig.message,
|
|
48
|
+
type: toastConfig.type || "default",
|
|
49
|
+
position: toastConfig.position || mergedConfig.defaultPosition,
|
|
50
|
+
duration: toastConfig.duration ?? mergedConfig.defaultDuration,
|
|
51
|
+
animationIn: toastConfig.animationIn || mergedConfig.defaultAnimationIn,
|
|
52
|
+
animationOut: toastConfig.animationOut ||
|
|
53
|
+
mergedConfig.defaultAnimationOut,
|
|
54
|
+
animationDuration: toastConfig.animationDuration ||
|
|
55
|
+
mergedConfig.defaultAnimationDuration,
|
|
56
|
+
dismissable: toastConfig.dismissable ?? true,
|
|
57
|
+
icon: toastConfig.icon,
|
|
58
|
+
hideIcon: toastConfig.hideIcon,
|
|
59
|
+
backgroundColor: toastConfig.backgroundColor,
|
|
60
|
+
textColor: toastConfig.textColor,
|
|
61
|
+
borderColor: toastConfig.borderColor,
|
|
62
|
+
style: toastConfig.style,
|
|
63
|
+
textStyle: toastConfig.textStyle,
|
|
64
|
+
onShow: toastConfig.onShow,
|
|
65
|
+
onHide: toastConfig.onHide,
|
|
66
|
+
onPress: toastConfig.onPress,
|
|
67
|
+
};
|
|
68
|
+
setToasts((prev) => {
|
|
69
|
+
// Limit to maxToasts
|
|
70
|
+
const updated = [...prev, newToast];
|
|
71
|
+
if (updated.length > mergedConfig.maxToasts) {
|
|
72
|
+
return updated.slice(-mergedConfig.maxToasts);
|
|
73
|
+
}
|
|
74
|
+
return updated;
|
|
75
|
+
});
|
|
76
|
+
return id;
|
|
77
|
+
}, [mergedConfig]);
|
|
78
|
+
/**
|
|
79
|
+
* Helper to parse flexible arguments: (message) or (title, description)
|
|
80
|
+
*/
|
|
81
|
+
const parseArgs = (titleOrMessage, descriptionOrConfig, config) => {
|
|
82
|
+
if (typeof descriptionOrConfig === "string") {
|
|
83
|
+
// Called as (title, description, config?)
|
|
84
|
+
return {
|
|
85
|
+
title: titleOrMessage,
|
|
86
|
+
message: descriptionOrConfig,
|
|
87
|
+
config,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
// Called as (message, config?)
|
|
92
|
+
return {
|
|
93
|
+
message: titleOrMessage,
|
|
94
|
+
config: descriptionOrConfig,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Show a success toast
|
|
100
|
+
*/
|
|
101
|
+
const success = useCallback((titleOrMessage, descriptionOrConfig, config) => {
|
|
102
|
+
const { title, message, config: cfg, } = parseArgs(titleOrMessage, descriptionOrConfig, config);
|
|
103
|
+
return show({ ...cfg, title, message, type: "success" });
|
|
104
|
+
}, [show]);
|
|
105
|
+
/**
|
|
106
|
+
* Show a warning toast
|
|
107
|
+
*/
|
|
108
|
+
const warning = useCallback((titleOrMessage, descriptionOrConfig, config) => {
|
|
109
|
+
const { title, message, config: cfg, } = parseArgs(titleOrMessage, descriptionOrConfig, config);
|
|
110
|
+
return show({ ...cfg, title, message, type: "warning" });
|
|
111
|
+
}, [show]);
|
|
112
|
+
/**
|
|
113
|
+
* Show an error toast
|
|
114
|
+
*/
|
|
115
|
+
const error = useCallback((titleOrMessage, descriptionOrConfig, config) => {
|
|
116
|
+
const { title, message, config: cfg, } = parseArgs(titleOrMessage, descriptionOrConfig, config);
|
|
117
|
+
return show({ ...cfg, title, message, type: "error" });
|
|
118
|
+
}, [show]);
|
|
119
|
+
/**
|
|
120
|
+
* Show an info toast
|
|
121
|
+
*/
|
|
122
|
+
const info = useCallback((titleOrMessage, descriptionOrConfig, config) => {
|
|
123
|
+
const { title, message, config: cfg, } = parseArgs(titleOrMessage, descriptionOrConfig, config);
|
|
124
|
+
return show({ ...cfg, title, message, type: "info" });
|
|
125
|
+
}, [show]);
|
|
126
|
+
/**
|
|
127
|
+
* Hide a specific toast by ID
|
|
128
|
+
*/
|
|
129
|
+
const hide = useCallback((id) => {
|
|
130
|
+
setToasts((prev) => prev.filter((toast) => toast.id !== id));
|
|
131
|
+
}, []);
|
|
132
|
+
/**
|
|
133
|
+
* Hide all toasts
|
|
134
|
+
*/
|
|
135
|
+
const hideAll = useCallback(() => {
|
|
136
|
+
setToasts([]);
|
|
137
|
+
}, []);
|
|
138
|
+
// Context value
|
|
139
|
+
const contextValue = useMemo(() => ({
|
|
140
|
+
show,
|
|
141
|
+
success,
|
|
142
|
+
warning,
|
|
143
|
+
error,
|
|
144
|
+
info,
|
|
145
|
+
hide,
|
|
146
|
+
hideAll,
|
|
147
|
+
}), [show, success, warning, error, info, hide, hideAll]);
|
|
148
|
+
// Group toasts by position
|
|
149
|
+
const positions = ["top", "center", "bottom"];
|
|
150
|
+
return (<ToastContext.Provider value={contextValue}>
|
|
151
|
+
<View style={styles.container}>
|
|
152
|
+
{children}
|
|
153
|
+
{/* Render toast containers for each position */}
|
|
154
|
+
{positions.map((position) => (<ToastContainer key={position} toasts={toasts} position={position} onHide={hide}/>))}
|
|
155
|
+
</View>
|
|
156
|
+
</ToastContext.Provider>);
|
|
157
|
+
};
|
|
158
|
+
const styles = StyleSheet.create({
|
|
159
|
+
container: {
|
|
160
|
+
flex: 1,
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
//# sourceMappingURL=ToastProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastProvider.js","sourceRoot":"","sources":["../src/ToastProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACb,aAAa,EACb,QAAQ,EACR,WAAW,EACX,OAAO,GAEP,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQhD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAA2B,IAAI,CAAC,CAAC;AAE1E;;GAEG;AACH,MAAM,UAAU,GAAG,GAAW,EAAE;IAC/B,OAAO,SAAS,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;AACzE,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,cAAc,GAAkC;IACrD,eAAe,EAAE,KAAK;IACtB,eAAe,EAAE,IAAI;IACrB,kBAAkB,EAAE,MAAM;IAC1B,mBAAmB,EAAE,MAAM;IAC3B,wBAAwB,EAAE,GAAG;IAC7B,SAAS,EAAE,CAAC;CACZ,CAAC;AAO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,EAAE,YAAY,CAAC,QAAQ,CAAC,CACxB,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAChC,SAAS,EAAE;QACV,IAAI,EAAE,CAAC;KACP;CACD,CAAC,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Animated } from "react-native";
|
|
2
|
+
import { ToastAnimation, ToastPosition } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Animation configuration
|
|
5
|
+
*/
|
|
6
|
+
export interface AnimationConfig {
|
|
7
|
+
duration: number;
|
|
8
|
+
useNativeDriver: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Default animation configuration
|
|
12
|
+
*/
|
|
13
|
+
export declare const DEFAULT_ANIMATION_CONFIG: AnimationConfig;
|
|
14
|
+
/**
|
|
15
|
+
* Get initial animated values based on animation type
|
|
16
|
+
*/
|
|
17
|
+
export declare const getInitialAnimatedValues: (animation: ToastAnimation, position: ToastPosition) => {
|
|
18
|
+
opacity: number;
|
|
19
|
+
translateX: number;
|
|
20
|
+
translateY: number;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Get final animated values (visible state)
|
|
24
|
+
*/
|
|
25
|
+
export declare const getFinalAnimatedValues: () => {
|
|
26
|
+
opacity: number;
|
|
27
|
+
translateX: number;
|
|
28
|
+
translateY: number;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Get exit animated values based on animation type
|
|
32
|
+
*/
|
|
33
|
+
export declare const getExitAnimatedValues: (animation: ToastAnimation, position: ToastPosition) => {
|
|
34
|
+
opacity: number;
|
|
35
|
+
translateX: number;
|
|
36
|
+
translateY: number;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Create enter animation
|
|
40
|
+
*/
|
|
41
|
+
export declare const createEnterAnimation: (animatedValues: {
|
|
42
|
+
opacity: Animated.Value;
|
|
43
|
+
translateX: Animated.Value;
|
|
44
|
+
translateY: Animated.Value;
|
|
45
|
+
}, config?: AnimationConfig) => Animated.CompositeAnimation;
|
|
46
|
+
/**
|
|
47
|
+
* Create exit animation
|
|
48
|
+
*/
|
|
49
|
+
export declare const createExitAnimation: (animatedValues: {
|
|
50
|
+
opacity: Animated.Value;
|
|
51
|
+
translateX: Animated.Value;
|
|
52
|
+
translateY: Animated.Value;
|
|
53
|
+
}, animation: ToastAnimation, position: ToastPosition, config?: AnimationConfig) => Animated.CompositeAnimation;
|
|
54
|
+
//# sourceMappingURL=animations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animations.d.ts","sourceRoot":"","sources":["../src/animations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAc,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAIxD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,eAGtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,GACpC,WAAW,cAAc,EACzB,UAAU,aAAa,KACrB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAwB3D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,QAAO;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CAGnB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,GACjC,WAAW,cAAc,EACzB,UAAU,aAAa,KACrB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAwB3D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAChC,gBAAgB;IACf,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC;IACxB,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC;IAC3B,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC;CAC3B,EACD,SAAQ,eAA0C,KAChD,QAAQ,CAAC,kBAoBX,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC/B,gBAAgB;IACf,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC;IACxB,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC;IAC3B,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC;CAC3B,EACD,WAAW,cAAc,EACzB,UAAU,aAAa,EACvB,SAAQ,eAA0C,KAChD,QAAQ,CAAC,kBAoBX,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { Animated, Dimensions } from "react-native";
|
|
2
|
+
const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = Dimensions.get("window");
|
|
3
|
+
/**
|
|
4
|
+
* Default animation configuration
|
|
5
|
+
*/
|
|
6
|
+
export const DEFAULT_ANIMATION_CONFIG = {
|
|
7
|
+
duration: 300,
|
|
8
|
+
useNativeDriver: true,
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Get initial animated values based on animation type
|
|
12
|
+
*/
|
|
13
|
+
export const getInitialAnimatedValues = (animation, position) => {
|
|
14
|
+
switch (animation) {
|
|
15
|
+
case "fade":
|
|
16
|
+
return { opacity: 0, translateX: 0, translateY: 0 };
|
|
17
|
+
case "up":
|
|
18
|
+
return {
|
|
19
|
+
opacity: 1,
|
|
20
|
+
translateX: 0,
|
|
21
|
+
translateY: position === "bottom" ? 100 : -100,
|
|
22
|
+
};
|
|
23
|
+
case "down":
|
|
24
|
+
return {
|
|
25
|
+
opacity: 1,
|
|
26
|
+
translateX: 0,
|
|
27
|
+
translateY: position === "top" ? -100 : 100,
|
|
28
|
+
};
|
|
29
|
+
case "left":
|
|
30
|
+
return { opacity: 1, translateX: -SCREEN_WIDTH, translateY: 0 };
|
|
31
|
+
case "right":
|
|
32
|
+
return { opacity: 1, translateX: SCREEN_WIDTH, translateY: 0 };
|
|
33
|
+
case "none":
|
|
34
|
+
default:
|
|
35
|
+
return { opacity: 1, translateX: 0, translateY: 0 };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Get final animated values (visible state)
|
|
40
|
+
*/
|
|
41
|
+
export const getFinalAnimatedValues = () => {
|
|
42
|
+
return { opacity: 1, translateX: 0, translateY: 0 };
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Get exit animated values based on animation type
|
|
46
|
+
*/
|
|
47
|
+
export const getExitAnimatedValues = (animation, position) => {
|
|
48
|
+
switch (animation) {
|
|
49
|
+
case "fade":
|
|
50
|
+
return { opacity: 0, translateX: 0, translateY: 0 };
|
|
51
|
+
case "up":
|
|
52
|
+
return {
|
|
53
|
+
opacity: 1,
|
|
54
|
+
translateX: 0,
|
|
55
|
+
translateY: position === "top" ? -100 : 100,
|
|
56
|
+
};
|
|
57
|
+
case "down":
|
|
58
|
+
return {
|
|
59
|
+
opacity: 1,
|
|
60
|
+
translateX: 0,
|
|
61
|
+
translateY: position === "bottom" ? 100 : -100,
|
|
62
|
+
};
|
|
63
|
+
case "left":
|
|
64
|
+
return { opacity: 1, translateX: -SCREEN_WIDTH, translateY: 0 };
|
|
65
|
+
case "right":
|
|
66
|
+
return { opacity: 1, translateX: SCREEN_WIDTH, translateY: 0 };
|
|
67
|
+
case "none":
|
|
68
|
+
default:
|
|
69
|
+
return { opacity: 0, translateX: 0, translateY: 0 };
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Create enter animation
|
|
74
|
+
*/
|
|
75
|
+
export const createEnterAnimation = (animatedValues, config = DEFAULT_ANIMATION_CONFIG) => {
|
|
76
|
+
const finalValues = getFinalAnimatedValues();
|
|
77
|
+
return Animated.parallel([
|
|
78
|
+
Animated.timing(animatedValues.opacity, {
|
|
79
|
+
toValue: finalValues.opacity,
|
|
80
|
+
duration: config.duration,
|
|
81
|
+
useNativeDriver: config.useNativeDriver,
|
|
82
|
+
}),
|
|
83
|
+
Animated.timing(animatedValues.translateX, {
|
|
84
|
+
toValue: finalValues.translateX,
|
|
85
|
+
duration: config.duration,
|
|
86
|
+
useNativeDriver: config.useNativeDriver,
|
|
87
|
+
}),
|
|
88
|
+
Animated.timing(animatedValues.translateY, {
|
|
89
|
+
toValue: finalValues.translateY,
|
|
90
|
+
duration: config.duration,
|
|
91
|
+
useNativeDriver: config.useNativeDriver,
|
|
92
|
+
}),
|
|
93
|
+
]);
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Create exit animation
|
|
97
|
+
*/
|
|
98
|
+
export const createExitAnimation = (animatedValues, animation, position, config = DEFAULT_ANIMATION_CONFIG) => {
|
|
99
|
+
const exitValues = getExitAnimatedValues(animation, position);
|
|
100
|
+
return Animated.parallel([
|
|
101
|
+
Animated.timing(animatedValues.opacity, {
|
|
102
|
+
toValue: exitValues.opacity,
|
|
103
|
+
duration: config.duration,
|
|
104
|
+
useNativeDriver: config.useNativeDriver,
|
|
105
|
+
}),
|
|
106
|
+
Animated.timing(animatedValues.translateX, {
|
|
107
|
+
toValue: exitValues.translateX,
|
|
108
|
+
duration: config.duration,
|
|
109
|
+
useNativeDriver: config.useNativeDriver,
|
|
110
|
+
}),
|
|
111
|
+
Animated.timing(animatedValues.translateY, {
|
|
112
|
+
toValue: exitValues.translateY,
|
|
113
|
+
duration: config.duration,
|
|
114
|
+
useNativeDriver: config.useNativeDriver,
|
|
115
|
+
}),
|
|
116
|
+
]);
|
|
117
|
+
};
|
|
118
|
+
//# sourceMappingURL=animations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animations.js","sourceRoot":"","sources":["../src/animations.ts"],"names":[],"mappings":"AA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,EAAE,MAAM,CAAC,QAAQ;YACzB,eAAe,EAAE,MAAM,CAAC,eAAe;SACvC,CAAC;QACF,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE;YAC1C,OAAO,EAAE,UAAU,CAAC,UAAU;YAC9B,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,eAAe,EAAE,MAAM,CAAC,eAAe;SACvC,CAAC;KACF,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/icons.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ToastType } from "./types";
|
|
3
|
+
interface IconProps {
|
|
4
|
+
color: string;
|
|
5
|
+
size: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Default icons for each toast type
|
|
9
|
+
*/
|
|
10
|
+
export declare const DefaultIcons: Record<ToastType | "close", React.FC<IconProps>>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../src/icons.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,UAAU,SAAS;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACb;AAsGD;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,SAAS,GAAG,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,CAQzE,CAAC"}
|