thêm FormSearch trong map
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user