diff --git a/src/layout/Header.tsx b/src/layout/Header.tsx index 5d0d575..ab3a7bd 100644 --- a/src/layout/Header.tsx +++ b/src/layout/Header.tsx @@ -2,6 +2,10 @@ import React from 'react'; import {View, Text, StyleSheet, Image, TouchableOpacity} from 'react-native'; import {useNavigation} from '@react-navigation/native'; import {ChatIcon} from '../assets/icons/navigation/home'; +import { ScrollView } from 'react-native'; +import { Animated, Easing } from 'react-native'; + + type Props = { toggler: () => void; changeStack: (type: string) => void; @@ -10,10 +14,45 @@ type Props = { const Header: React.FC = ({toggler, changeStack, registerName}) => { const navigation = useNavigation(); + const slideAnim = useRef(new Animated.Value(-250)).current; // hidden sidebar + const [sidebarOpen, setSidebarOpen] = useState(false); + const toggleSidebar = () => { + if (sidebarOpen) { + Animated.timing(slideAnim, { + toValue: -250, + duration: 300, + easing: Easing.in(Easing.cubic), + useNativeDriver: true, + }).start(() => setSidebarOpen(false)); + } else { + setSidebarOpen(true); + Animated.timing(slideAnim, { + toValue: 0, + duration: 300, + easing: Easing.out(Easing.cubic), + useNativeDriver: true, + }).start(); + } + }; + + return ( - + = ({toggler, changeStack, registerName}) => { {registerName} + navigation.navigate('Settings' as never)}> + onPress={() => navigation.navigate('Settings' as never)} + style={{ + backgroundColor: '#27272A', + padding: 8, + borderRadius: 50, + shadowColor: '#000', + shadowOffset: { width: 0, height: 1 }, + shadowOpacity: 0.2, + shadowRadius: 3, + elevation: 3, + }} + > + + {/* Animated Sidebar */} + + + {['Home', 'Profile', 'Schedule', 'Settings', 'Help'].map((item, index) => ( + { + console.log(`${item} pressed`); + // You can call navigation or changeStack here + }} + > + {item} + + ))} + + ); }; @@ -39,7 +127,7 @@ const styles = StyleSheet.create({ backgroundColor: '#18181B', paddingVertical: 10, }, - registerIcon: {width: 42, height: 42}, + registerIcon: { width: 42, height: 42 }, headerContent: { margin: 'auto', flexDirection: 'row', @@ -47,7 +135,6 @@ const styles = StyleSheet.create({ alignItems: 'center', width: '92%', paddingBottom: 5, - // paddingTop: 20, }, registerNameTxt: { fontSize: 20, @@ -55,16 +142,6 @@ const styles = StyleSheet.create({ marginLeft: 10, color: 'white', }, - addBtn: { - padding: 7, - paddingHorizontal: 15, - backgroundColor: '#27272A', - borderColor: 'grey', - borderWidth: 1, - borderRadius: 10, - textAlign: 'center', - }, - addBtnTxt: {color: 'white', fontSize: 16, fontWeight: 'bold'}, }); export default Header;