thêm FormSearch trong map

This commit is contained in:
Tran Anh Tuan
2025-12-04 15:02:53 +07:00
parent 42028eafc3
commit 4d60ce279e
6 changed files with 275 additions and 96 deletions

View File

@@ -1,4 +1,5 @@
import { Ionicons } from "@expo/vector-icons";
import { useBottomTabBarHeight } from "@react-navigation/bottom-tabs";
import React, { useEffect, useState } from "react";
import {
Pressable,
@@ -34,14 +35,10 @@ export default function DraggablePanel({
children,
}: DraggablePanelProps) {
const { height: screenHeight } = useWindowDimensions();
// Thêm chiều cao của bottom tab bar vào tính toán
const bottomOffset = 80; // 50 là chiều cao mặc định của tab bar
const bottomOffset = useBottomTabBarHeight();
const minHeight = screenHeight * minHeightPct;
const maxHeight = screenHeight * maxHeightPct;
// State để quản lý icon
const [iconName, setIconName] = useState<"chevron-down" | "chevron-up">(
initialState === "max" ? "chevron-down" : "chevron-up"
);
@@ -115,17 +112,13 @@ export default function DraggablePanel({
? screenHeight - maxHeight - bottomOffset + 40
: screenHeight - minHeight - bottomOffset;
translateY.value = withSpring(
targetY,
{
damping: 20,
stiffness: 200,
},
() => {
"worklet";
isExpanded.value = snapToMax;
}
);
isExpanded.value = snapToMax;
runOnJS(notifyExpandedChange)(snapToMax);
translateY.value = withSpring(targetY, {
damping: 20,
stiffness: 50,
});
});
const animatedStyle = useAnimatedStyle(() => {
@@ -138,7 +131,7 @@ export default function DraggablePanel({
useAnimatedReaction(
() => {
const currentHeight = screenHeight - translateY.value - bottomOffset;
return currentHeight > minHeight + 10;
return currentHeight > minHeight;
},
(isCurrentlyExpanded) => {
const newIcon = isCurrentlyExpanded ? "chevron-down" : "chevron-up";
@@ -210,7 +203,7 @@ const styles = StyleSheet.create({
elevation: 10,
},
header: {
paddingTop: 12,
paddingTop: 8,
paddingBottom: 8,
paddingHorizontal: 16,
alignItems: "center",