From bb5df4ae77c02a058d0f6992c0bf0713a1cb754e Mon Sep 17 00:00:00 2001 From: Deepak Sangle Date: Wed, 13 Dec 2023 18:56:44 +0530 Subject: [PATCH] added expand icons --- .../Windows/UUS/State/_active.uusver | 2 +- mobile-client/src/screens/HomePage.js | 60 +++++++++++++------ mobile-client/src/styles/home.js | 10 +++- 3 files changed, 51 insertions(+), 21 deletions(-) diff --git a/mobile-client/%ProgramData%/Microsoft/Windows/UUS/State/_active.uusver b/mobile-client/%ProgramData%/Microsoft/Windows/UUS/State/_active.uusver index ba627ca..2b9ef92 100644 --- a/mobile-client/%ProgramData%/Microsoft/Windows/UUS/State/_active.uusver +++ b/mobile-client/%ProgramData%/Microsoft/Windows/UUS/State/_active.uusver @@ -1 +1 @@ -1023.922.9182.0 \ No newline at end of file +1212.2309.20012.0 \ No newline at end of file diff --git a/mobile-client/src/screens/HomePage.js b/mobile-client/src/screens/HomePage.js index e664ff9..c3d9919 100644 --- a/mobile-client/src/screens/HomePage.js +++ b/mobile-client/src/screens/HomePage.js @@ -12,7 +12,9 @@ import { ScrollView, ImageBackground, } from "react-native"; + import styles from "../styles/home"; +import { MaterialIcons } from '@expo/vector-icons'; const HomePage = ({ route, navigation }) => { const { BASE_URI, PRIMARY_COLOR } = require("../constant"); @@ -22,6 +24,8 @@ const HomePage = ({ route, navigation }) => { const [loading, setLoading] = useState(true); const [secondLoading, setSecondLoading] = useState(true); const [events, setEvents] = useState([]); + const [openEvents, setOpenEvents] = useState([]); + const [scroll, setScroll] = useState(true); const [animatedHeights, setAnimatedHeights] = useState([]); const [selectedTab, setSelectedTab] = useState(0); const [body, setBody] = useState(""); @@ -135,6 +139,7 @@ const HomePage = ({ route, navigation }) => { } else { setEvents(data.data); setAnimatedHeights(Array.from({ length: data.data.length }, () => (new Animated.Value(0)))); + setOpenEvents(Array.from({ length: data.data.length }, () => false)); } setSecondLoading(false); }; @@ -171,13 +176,18 @@ const HomePage = ({ route, navigation }) => { setBody(""); }; - const onSelectedEvent = ( index) => { + const onSelectedEvent = (index) => { + const updatedValue = animatedHeights[index]._value === 0 ? 1 : 0; Animated.timing(animatedHeights[index], { - toValue: 1 - animatedHeights[index]._value, - duration: 3000, + toValue: updatedValue, + duration: 500, easing: Easing.linear, useNativeDriver: false, - }).start(); + }).start(()=> { + const temp = [...openEvents]; + temp[index] = !temp[index]; + setOpenEvents(temp); + }); }; const RenderAllEntries = () => { @@ -189,23 +199,39 @@ const HomePage = ({ route, navigation }) => { const date = new Date(entry.createdAt); const maxHeight = animatedHeights[index].interpolate({ inputRange: [0, 1], - outputRange: [0, 10000], + outputRange: [0, 500], }); return ( - onSelectedEvent(index)} + - - {date.toLocaleDateString("en-IN")} - - - - {entry.detail} - - - + onSelectedEvent(index)} + style={{flexDirection : "row", justifyContent : "space-between"}} + > + + + {date.toLocaleDateString("en-IN")} + + + + {openEvents[index] && } + {!openEvents[index] && } + + + {/* setScroll(false)} + onMomentumScrollEnd={() => setScroll(true)} + onScrollEndDrag={() => setScroll(true)} + > */} + + + {entry.detail} + + + {/* */} + ); })} @@ -220,7 +246,7 @@ const HomePage = ({ route, navigation }) => { - + {selectedTab===0 && Hello {name} Today's date : {writeDate()} diff --git a/mobile-client/src/styles/home.js b/mobile-client/src/styles/home.js index 88f5bb4..7fc64fe 100644 --- a/mobile-client/src/styles/home.js +++ b/mobile-client/src/styles/home.js @@ -49,15 +49,19 @@ const styles = StyleSheet.create({ backgroundColor: "#FFFFFF", padding: 10, fontFamily: "Nunito_400Regular", - borderRadius: 10, + borderRadius: 7, elevation : 2, }, - // "#data:focus": { boxShadow: "0px 0px 15px 1px grey" }, entry: { textAlign: "center" }, entryDate: { - margin: 0 + margin: 0, + display : "flex", + flexDirection : "row", + justifyContent : "center", + alignItems : "center", + color : PRIMARY_COLOR, }, entriesDiv: { marginTop : 20,