From 6e5a2abc11ed1ae4b87fab103e4efcbde42c78ee Mon Sep 17 00:00:00 2001 From: Dylan Date: Mon, 18 Nov 2024 22:50:05 -0500 Subject: [PATCH] Added right side drawer with mock values and adjusted chat footer padding --- .../app/components/chat/ChatScreenFooter.tsx | 2 +- client/app/components/chat/NearbyHeader.tsx | 18 ++- .../app/components/chat/NearbyUserDrawer.tsx | 117 ++++++++++++++---- client/app/screens/chat/ChatScreen.tsx | 6 +- client/package-lock.json | 14 +-- client/package.json | 1 + 6 files changed, 107 insertions(+), 51 deletions(-) diff --git a/client/app/components/chat/ChatScreenFooter.tsx b/client/app/components/chat/ChatScreenFooter.tsx index c96420f44..c0ea4ff2b 100644 --- a/client/app/components/chat/ChatScreenFooter.tsx +++ b/client/app/components/chat/ChatScreenFooter.tsx @@ -57,7 +57,7 @@ const styles = StyleSheet.create({ borderWidth: 1, borderRadius: Dimensions.get("window").width * 0.058, marginHorizontal: Dimensions.get("window").width * 0.005, - marginBottom: Platform.OS === "ios" ? 0 : 5, + marginBottom: 5, minHeight: Dimensions.get("window").width * 0.113, maxHeight: Dimensions.get("window").width * 0.3, }, diff --git a/client/app/components/chat/NearbyHeader.tsx b/client/app/components/chat/NearbyHeader.tsx index f86d32ad3..03b8db8b2 100644 --- a/client/app/components/chat/NearbyHeader.tsx +++ b/client/app/components/chat/NearbyHeader.tsx @@ -9,19 +9,24 @@ import { } from "react-native"; import { ChevronLeft } from "react-native-feather"; -export const NearbyHeader: React.FC = () => { +interface NearbyHeaderProps { + onClick: () => void; +} + +export const NearbyHeader: React.FC = ({ onClick }) => { return ( Nearby - - {}}> + + - - {5} - + + {5} + + ); }; @@ -42,6 +47,7 @@ const styles = StyleSheet.create({ paddingRight: "5%", paddingLeft: "10%", gap: 10, + zIndex: 1, }, nearbyText: { fontFamily: "Quicksand", diff --git a/client/app/components/chat/NearbyUserDrawer.tsx b/client/app/components/chat/NearbyUserDrawer.tsx index 3f520573f..058a752fb 100644 --- a/client/app/components/chat/NearbyUserDrawer.tsx +++ b/client/app/components/chat/NearbyUserDrawer.tsx @@ -1,36 +1,99 @@ -import * as React from "react"; -import { Dimensions, Text, StyleSheet, View } from "react-native"; -import { Drawer } from "react-native-drawer-layout"; -import { Button } from "react-native"; +import React, { useState } from "react"; +import { View, Text, StyleSheet, FlatList, Dimensions } from "react-native"; +import Animated, { + useSharedValue, + useAnimatedStyle, + withTiming, + Easing, +} from "react-native-reanimated"; +import NearbyHeader from "./NearbyHeader"; +import { Pressable } from "react-native"; -export const NearbyUserDrawer = () => { - const [open, setOpen] = React.useState(true); +const SCREEN_WIDTH = Dimensions.get("window").width; + +const NearbyUserDrawer = () => { + const [isOpen, setIsOpen] = useState(false); + const translateX = useSharedValue(SCREEN_WIDTH); + + const toggleDrawer = () => { + translateX.value = isOpen + ? withTiming(SCREEN_WIDTH, { + duration: 300, // Duration in milliseconds + easing: Easing.out(Easing.ease), // Smooth easing out + }) + : withTiming(0, { + duration: 300, + easing: Easing.out(Easing.ease), // Smooth easing out + }); + setIsOpen(!isOpen); + }; + + const animatedStyle = useAnimatedStyle(() => ({ + transform: [{ translateX: translateX.value }], + })); + + const nearbyUsers = ["Alice", "Bob", "Charlie", "Diana", "Eve"]; // Example names return ( - setOpen(true)} - onClose={() => setOpen(false)} - drawerType={"front"} - renderDrawerContent={() => { - return ( - - Drawer content - - ); - }}> -