@hoddy-ui/core 1.0.19 → 1.0.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hoddy-ui/core",
3
- "version": "1.0.19",
3
+ "version": "1.0.21",
4
4
  "description": "Core rich react native components written in typescript",
5
5
  "main": "index.ts",
6
6
  "repository": {
@@ -1,19 +1,14 @@
1
- import {
2
- Pressable,
3
- StyleSheet,
4
- Text,
5
- TouchableOpacity,
6
- View,
7
- } from "react-native";
8
- import React, { FC } from "react";
9
1
  import { MaterialCommunityIcons } from "@expo/vector-icons";
2
+ import React, { FC } from "react";
3
+ import { TouchableOpacity, View } from "react-native";
4
+ import { ScaledSheet } from "react-native-size-matters";
10
5
  import { useColors } from "../hooks";
11
6
  import { CheckboxProps } from "../types";
12
- import { ScaledSheet } from "react-native-size-matters";
13
7
 
14
- const CheckBox: FC<CheckboxProps> = ({
8
+ export const CheckBox: FC<CheckboxProps> = ({
15
9
  color = "primary",
16
10
  checked,
11
+ size = 24,
17
12
  label,
18
13
  style = {},
19
14
  onChange,
@@ -27,12 +22,6 @@ const CheckBox: FC<CheckboxProps> = ({
27
22
  flexDirection: "row",
28
23
  ...style,
29
24
  },
30
- title: {
31
- fontSize: 16,
32
- color: "#000",
33
- marginLeft: 5,
34
- fontWeight: "600",
35
- },
36
25
  });
37
26
 
38
27
  return (
@@ -40,7 +29,7 @@ const CheckBox: FC<CheckboxProps> = ({
40
29
  <TouchableOpacity onPress={onChange}>
41
30
  <MaterialCommunityIcons
42
31
  name={iconName}
43
- size={24}
32
+ size={size}
44
33
  color={colors[color].main}
45
34
  />
46
35
  </TouchableOpacity>
@@ -48,5 +37,3 @@ const CheckBox: FC<CheckboxProps> = ({
48
37
  </View>
49
38
  );
50
39
  };
51
-
52
- export default CheckBox;
@@ -18,23 +18,28 @@ export let showFlashMessage: (msg: FlashMessageProps) => void = () => {
18
18
 
19
19
  const FlashMessage: React.FC = () => {
20
20
  const { top } = useSafeAreaInsets();
21
- const [show, setShow] = useState<null | FlashMessageProps>(null);
21
+ const [message, setMessage] = useState<null | FlashMessageProps>(null);
22
+ const [show, setShow] = useState(false);
22
23
  const colors = useColors();
23
- const type = show?.type || "success";
24
+ const type = message?.type || "success";
24
25
 
25
26
  showFlashMessage = (msg: FlashMessageProps) => {
27
+ setMessage(msg);
26
28
  setTimeout(() => {
27
- setShow(msg);
29
+ setShow(true);
28
30
  }, 50);
29
31
 
30
32
  setTimeout(() => {
31
- setShow(null);
33
+ setShow(false);
34
+ setTimeout(() => {
35
+ setMessage(null);
36
+ }, 500);
32
37
  }, msg.duration || 2000);
38
+
33
39
  console.log("done", msg);
34
40
  };
35
41
  useEffect(() => {
36
42
  LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
37
- console.log("show", show);
38
43
  }, [show]);
39
44
 
40
45
  const styles = ScaledSheet.create({
@@ -65,22 +70,22 @@ const FlashMessage: React.FC = () => {
65
70
  <View style={styles.root}>
66
71
  <View style={{ flexDirection: "row" }}>
67
72
  <View style={{ flex: 1, marginRight: 10 }}>
68
- {show?.title && (
73
+ {message?.title && (
69
74
  <Typography
70
75
  variant="h6"
71
76
  fontWeight={600}
72
77
  gutterBottom={3}
73
78
  style={{ color: "#fff" }}
74
79
  >
75
- {show?.title}
80
+ {message?.title}
76
81
  </Typography>
77
82
  )}
78
- <Typography style={{ color: "#fff" }}>{show?.message}</Typography>
83
+ <Typography style={{ color: "#fff" }}>{message?.message}</Typography>
79
84
  </View>
80
85
  {/* <MaterialIcons color="#fff" size={36} name="error-outline" /> */}
81
86
  </View>
82
87
 
83
- {show?.actions?.map((cur) => (
88
+ {message?.actions?.map((cur) => (
84
89
  <TouchableOpacity style={styles.action}>
85
90
  <Typography fontWeight={700} style={{ color: "#fff" }}>
86
91
  {cur.title}
package/src/types.ts CHANGED
@@ -103,6 +103,7 @@ export interface ButtonProps {
103
103
  export interface CheckboxProps {
104
104
  color?: colorTypes;
105
105
  label: ReactNode;
106
+ size: number;
106
107
  checked?: boolean;
107
108
  style?: ViewStyle;
108
109
  onChange?: () => void;