@towsila/expo-ui-library 1.1.1 → 1.2.1
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
|
@@ -26,7 +26,7 @@ export default function Toast({
|
|
|
26
26
|
}: ToastProps) {
|
|
27
27
|
const { colors } = useAppTheme();
|
|
28
28
|
|
|
29
|
-
const translateY = useRef(new Animated.Value(-
|
|
29
|
+
const translateY = useRef(new Animated.Value(-200)).current;
|
|
30
30
|
const opacity = useRef(new Animated.Value(0)).current;
|
|
31
31
|
|
|
32
32
|
useEffect(() => {
|
|
@@ -48,7 +48,7 @@ export default function Toast({
|
|
|
48
48
|
const timer = setTimeout(() => {
|
|
49
49
|
Animated.parallel([
|
|
50
50
|
Animated.timing(translateY, {
|
|
51
|
-
toValue: -
|
|
51
|
+
toValue: -200,
|
|
52
52
|
duration: 250,
|
|
53
53
|
useNativeDriver: true,
|
|
54
54
|
}),
|
|
@@ -132,6 +132,7 @@ const styles = StyleSheet.create({
|
|
|
132
132
|
|
|
133
133
|
container: {
|
|
134
134
|
flexDirection:"row",
|
|
135
|
+
alignItems: "flex-start",
|
|
135
136
|
gap:10,
|
|
136
137
|
position: "absolute",
|
|
137
138
|
top: 60,
|
|
@@ -156,5 +157,6 @@ const styles = StyleSheet.create({
|
|
|
156
157
|
text: {
|
|
157
158
|
fontFamily: Fonts.montserrat.semiBold,
|
|
158
159
|
fontSize: textSize.sm,
|
|
160
|
+
flex: 1,
|
|
159
161
|
},
|
|
160
162
|
});
|
package/src/hooks/useToast.ts
CHANGED
|
@@ -8,7 +8,7 @@ interface Toast{
|
|
|
8
8
|
message: string;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export function useToast(
|
|
11
|
+
export function useToast(){
|
|
12
12
|
const [toast, setToast] = useState<Toast>({
|
|
13
13
|
visible: false,
|
|
14
14
|
type: "success",
|
|
@@ -17,6 +17,9 @@ export function useToast({visible, type, message}: Toast){
|
|
|
17
17
|
const showToast = (type: ToastType, message: string)=>{
|
|
18
18
|
setToast({visible: true, type, message});
|
|
19
19
|
}
|
|
20
|
+
const hideToast = () => {
|
|
21
|
+
setToast({visible: false, type:"success", message:""})
|
|
22
|
+
}
|
|
20
23
|
|
|
21
|
-
return{toast, showToast}
|
|
24
|
+
return{toast, showToast, hideToast}
|
|
22
25
|
}
|