aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/components/moments/MomentPostContent.tsx16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/components/moments/MomentPostContent.tsx b/src/components/moments/MomentPostContent.tsx
index 6953dca4..c3cb03f5 100644
--- a/src/components/moments/MomentPostContent.tsx
+++ b/src/components/moments/MomentPostContent.tsx
@@ -4,7 +4,7 @@ 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 {getCommentsCount} from '../../services';
import {RootState} from '../../store/rootReducer';
import {MomentTagType, ScreenType, UserType} from '../../types';
import {
@@ -24,6 +24,7 @@ interface MomentPostContentProps extends ViewProps {
caption: string;
pathHash: string;
dateTime: string;
+ momentTags: MomentTagType[];
}
const MomentPostContent: React.FC<MomentPostContentProps> = ({
screenType,
@@ -32,10 +33,11 @@ const MomentPostContent: React.FC<MomentPostContentProps> = ({
pathHash,
dateTime,
style,
+ momentTags,
}) => {
const [elapsedTime, setElapsedTime] = useState('');
const [comments_count, setCommentsCount] = useState('');
- const [tags, setTags] = useState<MomentTagType[]>([]);
+ const [tags, setTags] = useState<MomentTagType[]>(momentTags);
const [visible, setVisible] = useState(false);
const state: RootState = useStore().getState();
const navigation = useNavigation();
@@ -47,14 +49,8 @@ const MomentPostContent: React.FC<MomentPostContentProps> = ({
);
useEffect(() => {
- const loadTags = async () => {
- const response = await loadMomentTags(momentId);
- if (response) {
- setTags(response);
- }
- };
- loadTags();
- }, []);
+ setTags(momentTags);
+ }, [momentTags]);
useEffect(() => {
const fetchCommentsCount = async () => {