fix open table
This commit is contained in:
@@ -5,161 +5,6 @@ import { Animated, Text, TouchableOpacity, View } from "react-native";
|
|||||||
import CrewDetailModal from "./modal/CrewDetailModal";
|
import CrewDetailModal from "./modal/CrewDetailModal";
|
||||||
import styles from "./style/CrewListTable.styles";
|
import styles from "./style/CrewListTable.styles";
|
||||||
|
|
||||||
const mockCrews: Model.TripCrews[] = [
|
|
||||||
{
|
|
||||||
TripID: "f9884294-a7f2-46dc-aaf2-032da08a1ab6",
|
|
||||||
PersonalID: "480863197307",
|
|
||||||
role: "crew",
|
|
||||||
joined_at: new Date("2025-11-06T08:13:33.230053Z"),
|
|
||||||
left_at: null,
|
|
||||||
note: null,
|
|
||||||
Person: {
|
|
||||||
personal_id: "480863197307",
|
|
||||||
name: "Huỳnh Tấn Trang",
|
|
||||||
phone: "0838944284",
|
|
||||||
email: "huynhtantrang@crew.sgw.vn",
|
|
||||||
birth_date: new Date("2025-01-11T00:00:00Z"),
|
|
||||||
note: "",
|
|
||||||
address: "49915 Poplar Avenue",
|
|
||||||
created_at: new Date("0001-01-01T00:00:00Z"),
|
|
||||||
updated_at: new Date("0001-01-01T00:00:00Z"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
TripID: "f9884294-a7f2-46dc-aaf2-032da08a1ab6",
|
|
||||||
PersonalID: "714834545296",
|
|
||||||
role: "crew",
|
|
||||||
joined_at: new Date("2025-11-06T08:13:33.301376Z"),
|
|
||||||
left_at: null,
|
|
||||||
note: null,
|
|
||||||
Person: {
|
|
||||||
personal_id: "714834545296",
|
|
||||||
name: "Trương Văn Nam",
|
|
||||||
phone: "0773396753",
|
|
||||||
email: "truongvannam@crew.sgw.vn",
|
|
||||||
birth_date: new Date("2025-07-24T00:00:00Z"),
|
|
||||||
note: "",
|
|
||||||
address: "3287 Carlotta Underpass",
|
|
||||||
created_at: new Date("0001-01-01T00:00:00Z"),
|
|
||||||
updated_at: new Date("0001-01-01T00:00:00Z"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
TripID: "f9884294-a7f2-46dc-aaf2-032da08a1ab6",
|
|
||||||
PersonalID: "049299828990",
|
|
||||||
role: "crew",
|
|
||||||
joined_at: new Date("2025-11-06T08:13:33.373037Z"),
|
|
||||||
left_at: null,
|
|
||||||
note: null,
|
|
||||||
Person: {
|
|
||||||
personal_id: "049299828990",
|
|
||||||
name: "Đặng Anh Minh",
|
|
||||||
phone: "0827640820",
|
|
||||||
email: "danganhminh@crew.sgw.vn",
|
|
||||||
birth_date: new Date("2024-10-30T00:00:00Z"),
|
|
||||||
note: "",
|
|
||||||
address: "68909 Gerda Burgs",
|
|
||||||
created_at: new Date("0001-01-01T00:00:00Z"),
|
|
||||||
updated_at: new Date("0001-01-01T00:00:00Z"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
TripID: "f9884294-a7f2-46dc-aaf2-032da08a1ab6",
|
|
||||||
PersonalID: "851494873747",
|
|
||||||
role: "captain",
|
|
||||||
joined_at: new Date("2025-11-06T08:13:33.442774Z"),
|
|
||||||
left_at: null,
|
|
||||||
note: null,
|
|
||||||
Person: {
|
|
||||||
personal_id: "851494873747",
|
|
||||||
name: "Tô Thị Linh",
|
|
||||||
phone: "0337906041",
|
|
||||||
email: "tothilinh@crew.sgw.vn",
|
|
||||||
birth_date: new Date("2025-06-18T00:00:00Z"),
|
|
||||||
note: "",
|
|
||||||
address: "6676 Kulas Groves",
|
|
||||||
created_at: new Date("0001-01-01T00:00:00Z"),
|
|
||||||
updated_at: new Date("0001-01-01T00:00:00Z"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
TripID: "f9884294-a7f2-46dc-aaf2-032da08a1ab6",
|
|
||||||
PersonalID: "384839614682",
|
|
||||||
role: "crew",
|
|
||||||
joined_at: new Date("2025-11-06T08:13:33.515532Z"),
|
|
||||||
left_at: null,
|
|
||||||
note: null,
|
|
||||||
Person: {
|
|
||||||
personal_id: "384839614682",
|
|
||||||
name: "Lê Thanh Hoa",
|
|
||||||
phone: "0937613034",
|
|
||||||
email: "lethanhhoa@crew.sgw.vn",
|
|
||||||
birth_date: new Date("2025-07-17T00:00:00Z"),
|
|
||||||
note: "",
|
|
||||||
address: "244 Cicero Estate",
|
|
||||||
created_at: new Date("0001-01-01T00:00:00Z"),
|
|
||||||
updated_at: new Date("0001-01-01T00:00:00Z"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
TripID: "f9884294-a7f2-46dc-aaf2-032da08a1ab6",
|
|
||||||
PersonalID: "702319275290",
|
|
||||||
role: "crew",
|
|
||||||
joined_at: new Date("2025-11-06T08:13:33.588038Z"),
|
|
||||||
left_at: null,
|
|
||||||
note: null,
|
|
||||||
Person: {
|
|
||||||
personal_id: "702319275290",
|
|
||||||
name: "Nguyễn Phước Hải",
|
|
||||||
phone: "0347859214",
|
|
||||||
email: "nguyenphuochai@crew.sgw.vn",
|
|
||||||
birth_date: new Date("2025-08-13T00:00:00Z"),
|
|
||||||
note: "",
|
|
||||||
address: "6874 Devon Key",
|
|
||||||
created_at: new Date("0001-01-01T00:00:00Z"),
|
|
||||||
updated_at: new Date("0001-01-01T00:00:00Z"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
TripID: "f9884294-a7f2-46dc-aaf2-032da08a1ab6",
|
|
||||||
PersonalID: "943534816439",
|
|
||||||
role: "crew",
|
|
||||||
joined_at: new Date("2025-11-06T08:13:33.668984Z"),
|
|
||||||
left_at: null,
|
|
||||||
note: null,
|
|
||||||
Person: {
|
|
||||||
personal_id: "943534816439",
|
|
||||||
name: "Lý Hữu Hà",
|
|
||||||
phone: "0768548881",
|
|
||||||
email: "lyhuuha@crew.sgw.vn",
|
|
||||||
birth_date: new Date("2025-08-18T00:00:00Z"),
|
|
||||||
note: "",
|
|
||||||
address: "655 Middle Street",
|
|
||||||
created_at: new Date("0001-01-01T00:00:00Z"),
|
|
||||||
updated_at: new Date("0001-01-01T00:00:00Z"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
TripID: "f9884294-a7f2-46dc-aaf2-032da08a1ab6",
|
|
||||||
PersonalID: "096528446981",
|
|
||||||
role: "crew",
|
|
||||||
joined_at: new Date("2025-11-06T08:13:33.74379Z"),
|
|
||||||
left_at: null,
|
|
||||||
note: null,
|
|
||||||
Person: {
|
|
||||||
personal_id: "096528446981",
|
|
||||||
name: "Trần Xuân Thi",
|
|
||||||
phone: "0963449523",
|
|
||||||
email: "tranxuanthi@crew.sgw.vn",
|
|
||||||
birth_date: new Date("2024-09-21T00:00:00Z"),
|
|
||||||
note: "",
|
|
||||||
address: "59344 Burley Isle",
|
|
||||||
created_at: new Date("0001-01-01T00:00:00Z"),
|
|
||||||
updated_at: new Date("0001-01-01T00:00:00Z"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const CrewListTable: React.FC = () => {
|
const CrewListTable: React.FC = () => {
|
||||||
const [collapsed, setCollapsed] = useState(true);
|
const [collapsed, setCollapsed] = useState(true);
|
||||||
const [contentHeight, setContentHeight] = useState<number>(0);
|
const [contentHeight, setContentHeight] = useState<number>(0);
|
||||||
@@ -171,13 +16,13 @@ const CrewListTable: React.FC = () => {
|
|||||||
|
|
||||||
const { trip } = useTrip();
|
const { trip } = useTrip();
|
||||||
|
|
||||||
const data: Model.TripCrews[] = trip?.crews ?? mockCrews;
|
const data: Model.TripCrews[] = trip?.crews ?? [];
|
||||||
|
|
||||||
const tongThanhVien = data.length;
|
const tongThanhVien = data.length;
|
||||||
|
|
||||||
// Reset animated height khi dữ liệu thay đổi
|
// Reset animated height khi dữ liệu thay đổi
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setContentHeight(0); // Reset để tính lại chiều cao
|
// setContentHeight(0); // Reset để tính lại chiều cao
|
||||||
setCollapsed(true); // Reset về trạng thái gập lại
|
setCollapsed(true); // Reset về trạng thái gập lại
|
||||||
}, [data]);
|
}, [data]);
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const FishingToolsTable: React.FC = () => {
|
|||||||
|
|
||||||
// Reset animated height khi dữ liệu thay đổi
|
// Reset animated height khi dữ liệu thay đổi
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setContentHeight(0); // Reset để tính lại chiều cao
|
// setContentHeight(0); // Reset để tính lại chiều cao
|
||||||
setCollapsed(true); // Reset về trạng thái gập lại
|
setCollapsed(true); // Reset về trạng thái gập lại
|
||||||
}, [data]);
|
}, [data]);
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const TripCostTable: React.FC = () => {
|
|||||||
|
|
||||||
// Reset animated height khi dữ liệu thay đổi
|
// Reset animated height khi dữ liệu thay đổi
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setContentHeight(0); // Reset để tính lại chiều cao
|
// setContentHeight(0); // Reset để tính lại chiều cao
|
||||||
setCollapsed(true); // Reset về trạng thái gập lại
|
setCollapsed(true); // Reset về trạng thái gập lại
|
||||||
}, [data]);
|
}, [data]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user