ripal-ui 1.0.72 → 1.0.74

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.
Files changed (2) hide show
  1. package/elements/Toast.tsx +12 -6
  2. package/package.json +1 -1
@@ -6,9 +6,10 @@ import config from "../config";
6
6
 
7
7
  interface ToastProps {
8
8
  label?: string;
9
+ color?: string;
9
10
  right?: React.ReactNode; // Allows for any valid React node
10
11
  visible?: boolean;
11
- setVisible: (visible: boolean) => void;
12
+ onDismiss: () => void;
12
13
  timeout?: number;
13
14
  containerStyle?: ViewStyle; // Style for the container View
14
15
  style?: ViewStyle; // Additional style for the Toast
@@ -19,24 +20,30 @@ const Toast: React.FC<ToastProps> = ({
19
20
  label = "Percakapan berhasil dihapus",
20
21
  right = null,
21
22
  visible = true,
22
- setVisible,
23
+ color = config.colors.slate[800],
24
+ onDismiss,
23
25
  timeout = 3000,
24
26
  containerStyle,
27
+ style,
25
28
  textProps,
26
29
  }) => {
27
30
  useEffect(() => {
28
31
  if (visible) {
29
32
  const timer = setTimeout(() => {
30
- setVisible(false);
33
+ onDismiss();
31
34
  }, timeout);
32
35
 
33
36
  return () => clearTimeout(timer);
34
37
  }
35
- }, [visible, setVisible, timeout]);
38
+ }, [visible, onDismiss, timeout]);
36
39
 
37
40
  return visible ? (
38
41
  <View style={{ ...styles.container, ...containerStyle }}>
39
- <Inline style={styles.area}>
42
+ <Inline style={{
43
+ ...styles.area,
44
+ backgroundColor: color,
45
+ ...style
46
+ }}>
40
47
  <Text size={12} style={{ flexGrow: 1 }} color="#fff" {...textProps}>
41
48
  {label}
42
49
  </Text>
@@ -55,7 +62,6 @@ const styles = StyleSheet.create({
55
62
  padding: 20,
56
63
  },
57
64
  area: {
58
- backgroundColor: config.colors.slate[800],
59
65
  borderRadius: 999,
60
66
  padding: 20,
61
67
  paddingHorizontal: 30,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ripal-ui",
3
- "version": "1.0.72",
3
+ "version": "1.0.74",
4
4
  "description": "A collection of React elements and components",
5
5
  "main": "index.js",
6
6
  "scripts": {