From fbfb50acdf374bb920912caff785d49eb384237a Mon Sep 17 00:00:00 2001 From: Brian Kim Date: Wed, 26 May 2021 16:06:05 -0400 Subject: Merged with master --- src/components/moments/MomentPostContent.tsx | 44 ++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/components/moments/MomentPostContent.tsx b/src/components/moments/MomentPostContent.tsx index 97bf2a0b..982fc035 100644 --- a/src/components/moments/MomentPostContent.tsx +++ b/src/components/moments/MomentPostContent.tsx @@ -1,6 +1,8 @@ import {useNavigation} from '@react-navigation/native'; import React, {useEffect, useRef, useState} from 'react'; import {Image, StyleSheet, Text, View, ViewProps} from 'react-native'; +import {TouchableWithoutFeedback} from 'react-native-gesture-handler'; +import Animated, {Easing} from 'react-native-reanimated'; import {useDispatch, useStore} from 'react-redux'; import {getCommentsCount, loadMomentTags} from '../../services'; import {RootState} from '../../store/rootReducer'; @@ -34,10 +36,15 @@ const MomentPostContent: React.FC = ({ const [elapsedTime, setElapsedTime] = useState(''); const [comments_count, setCommentsCount] = useState(''); const [tags, setTags] = useState([]); + const [visible, setVisible] = useState(false); const state: RootState = useStore().getState(); const navigation = useNavigation(); const dispatch = useDispatch(); const imageRef = useRef(null); + + const [fadeValue, setFadeValue] = useState>( + new Animated.Value(0), + ); const [imageDimensions, setImageDimensions] = useState([0, 0]); useEffect(() => { @@ -73,14 +80,36 @@ const MomentPostContent: React.FC = ({ fetchCommentsCount(); }, [dateTime, momentId]); + useEffect(() => { + const fade = async () => { + Animated.timing(fadeValue, { + toValue: 1, + duration: 250, + easing: Easing.linear, + }).start(); + }; + fade(); + }, [fadeValue]); + return ( - + { + setVisible(!visible); + setFadeValue(new Animated.Value(0)); + }}> + + + {visible && ( + + + + )} {tags.length > 0 && (