diff --git a/app/(tabs)/tripInfo.tsx b/app/(tabs)/tripInfo.tsx
index 98e810a..f29d659 100644
--- a/app/(tabs)/tripInfo.tsx
+++ b/app/(tabs)/tripInfo.tsx
@@ -1,22 +1,22 @@
import { ThemedText } from "@/components/themed-text";
-import { ThemedView } from "@/components/themed-view";
import TripCostTable from "@/components/tripInfo/TripCostTable";
-import { StyleSheet } from "react-native";
+import { StyleSheet, View } from "react-native";
+import { SafeAreaView } from "react-native-safe-area-context";
export default function TripInfoScreen() {
return (
-
- Thông Tin Chuyến Đi
-
-
+
+
+ Thông Tin Chuyến Đi
+
+
+
);
}
const styles = StyleSheet.create({
container: {
- flex: 1,
alignItems: "center",
- justifyContent: "center",
padding: 20,
},
});
diff --git a/components/tripInfo/TripCostTable.tsx b/components/tripInfo/TripCostTable.tsx
index 6b76190..043d289 100644
--- a/components/tripInfo/TripCostTable.tsx
+++ b/components/tripInfo/TripCostTable.tsx
@@ -1,6 +1,16 @@
-import React from "react";
-import { FlatList, ListRenderItem, Text, View } from "react-native";
-import styles from "./TripCostTable.styles";
+import { IconSymbol } from "@/components/ui/icon-symbol";
+import React, { useRef, useState } from "react";
+import {
+ Animated,
+ FlatList,
+ ListRenderItem,
+ Platform,
+ Text,
+ TouchableOpacity,
+ UIManager,
+ View,
+} from "react-native";
+import styles from "./style/TripCostTable.styles";
// ---------------------------
// 🧩 Interface
@@ -55,7 +65,18 @@ const data: CostItem[] = [
// ---------------------------
// 💰 Component chính
// ---------------------------
+
const TripCostTable: React.FC = () => {
+ // Enable LayoutAnimation for Android
+ if (
+ Platform.OS === "android" &&
+ UIManager.setLayoutAnimationEnabledExperimental
+ ) {
+ UIManager.setLayoutAnimationEnabledExperimental(true);
+ }
+
+ const [collapsed, setCollapsed] = useState(true);
+ const animatedHeight = useRef(new Animated.Value(0)).current;
const tongCong = data.reduce((sum, item) => sum + item.tongChiPhi, 0);
const renderItem: ListRenderItem = ({ item }) => (
@@ -67,32 +88,80 @@ const TripCostTable: React.FC = () => {
);
+ const contentHeight = 220; // Chiều cao cố định cho bảng, có thể điều chỉnh
+ const handleToggle = () => {
+ if (collapsed) {
+ Animated.timing(animatedHeight, {
+ toValue: contentHeight,
+ duration: 350,
+ useNativeDriver: false,
+ }).start();
+ } else {
+ Animated.timing(animatedHeight, {
+ toValue: 0,
+ duration: 350,
+ useNativeDriver: false,
+ }).start();
+ }
+ setCollapsed((prev) => !prev);
+ };
+
return (
- Chi phí chuyến đi
+
+ Chi phí chuyến đi
+ {collapsed && (
+
+ {tongCong.toLocaleString()}
+
+ )}
+
+
- {/* Header */}
-
- Loại
- Tổng chi phí
-
+
+ {/* Header */}
+
+
+ Loại
+
+ Tổng chi phí
+
- {/* Body */}
- item.id}
- />
+ {/* Body */}
+ item.id}
+ />
- {/* Footer */}
-
-
- Tổng cộng
-
-
- {tongCong.toLocaleString()}
-
-
+ {/* Footer */}
+
+
+ Tổng cộng
+
+
+ {tongCong.toLocaleString()}
+
+
+
);
};
diff --git a/components/tripInfo/TripCostTable.styles.ts b/components/tripInfo/style/TripCostTable.styles.ts
similarity index 92%
rename from components/tripInfo/TripCostTable.styles.ts
rename to components/tripInfo/style/TripCostTable.styles.ts
index 50d1d2b..a7096a2 100644
--- a/components/tripInfo/TripCostTable.styles.ts
+++ b/components/tripInfo/style/TripCostTable.styles.ts
@@ -12,11 +12,14 @@ const styles = StyleSheet.create({
shadowRadius: 4,
elevation: 2,
},
+ icon: {
+ fontSize: 10,
+ },
title: {
fontSize: 18,
fontWeight: "700",
textAlign: "center",
- marginBottom: 12,
+ // marginBottom: 12,
},
row: {
flexDirection: "row",
@@ -52,7 +55,7 @@ const styles = StyleSheet.create({
color: "#007bff",
},
total: {
- color: "#007bff",
+ color: "#ff6600",
fontWeight: "700",
},
});
diff --git a/components/ui/icon-symbol.tsx b/components/ui/icon-symbol.tsx
index cd0a4cd..6557c59 100644
--- a/components/ui/icon-symbol.tsx
+++ b/components/ui/icon-symbol.tsx
@@ -23,6 +23,8 @@ const MAPPING = {
"chevron.right": "chevron-right",
"ferry.fill": "directions-boat",
"map.fill": "map",
+ "arrowshape.down.fill": "arrow-drop-down",
+ "arrowshape.up.fill": "arrow-drop-up",
} as IconMapping;
/**
diff --git a/config/axios.ts b/config/axios.ts
index 8f907e1..3bc6d31 100644
--- a/config/axios.ts
+++ b/config/axios.ts
@@ -53,7 +53,6 @@ api.interceptors.response.use(
return response;
},
(error) => {
-
if (!error.response) {
const networkErrorMsg =
error.message || "Network error - please check connection";