diff --git a/mobile-client/src/screens/HomePage.js b/mobile-client/src/screens/HomePage.js index 79a57af..bed21f7 100644 --- a/mobile-client/src/screens/HomePage.js +++ b/mobile-client/src/screens/HomePage.js @@ -9,6 +9,7 @@ import { Animated, TouchableOpacity, Easing, + Keyboard, ScrollView, ImageBackground, } from "react-native"; @@ -29,7 +30,8 @@ const HomePage = ({ route, navigation }) => { const [animatedHeights, setAnimatedHeights] = useState([]); const [selectedTab, setSelectedTab] = useState(0); const [body, setBody] = useState(""); - + const [isKeyboardVisible, setKeyboardVisible] = useState(false); + const verify = () => { setLoading(true); @@ -180,7 +182,7 @@ const HomePage = ({ route, navigation }) => { const updatedValue = animatedHeights[index]._value === 0 ? 1 : 0; Animated.timing(animatedHeights[index], { toValue: updatedValue, - duration: 500, + duration: 300, easing: Easing.linear, useNativeDriver: false, }).start(()=> { @@ -216,11 +218,12 @@ const HomePage = ({ route, navigation }) => { - {openEvents[index] && } - {!openEvents[index] && } + {!openEvents[index] && } + {openEvents[index] && } @@ -230,6 +233,15 @@ const HomePage = ({ route, navigation }) => { + {openEvents[index] && onSelectedEvent(index)} + style={{flexDirection : "row", justifyContent : "flex-end"}} + > + + + + } + ); })} @@ -237,6 +249,27 @@ const HomePage = ({ route, navigation }) => { ); }; + useEffect(() => { + const keyboardDidShowListener = Keyboard.addListener( + 'keyboardDidShow', + () => { + setKeyboardVisible(true); // or some other action + } + ); + const keyboardDidHideListener = Keyboard.addListener( + 'keyboardDidHide', + () => { + setKeyboardVisible(false); // or some other action + } + ); + + return () => { + keyboardDidHideListener.remove(); + keyboardDidShowListener.remove(); + }; + }, []); + + const changeSelectedIndex = (i) => { setSelectedTab(i); }; @@ -245,7 +278,11 @@ const HomePage = ({ route, navigation }) => { - + {selectedTab===0 && Hello {name} Today's date : {writeDate()} @@ -253,7 +290,7 @@ const HomePage = ({ route, navigation }) => { { - + {!isKeyboardVisible && changeSelectedIndex(0)}> changeSelectedIndex(1)}> - + } );