From fc6f740fd2c9dbe1be7df5b7228ed2f61d54fe07 Mon Sep 17 00:00:00 2001 From: Adolfo Reyna Date: Tue, 24 Feb 2026 16:36:41 -0500 Subject: [PATCH] Fix single post scrolling for long content and comments --- components/Post.js | 19 ++++++++++--------- components/SinglePostComponent.js | 8 +++++--- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/components/Post.js b/components/Post.js index 38f2db3..59bae02 100644 --- a/components/Post.js +++ b/components/Post.js @@ -1,5 +1,5 @@ import React, { useMemo, useRef, useState } from 'react'; -import { Text, Pressable, FlatList, StyleSheet, View, Share, Alert, Linking, Animated, PanResponder } from 'react-native'; +import { Text, Pressable, StyleSheet, View, Share, Alert, Linking, Animated, PanResponder } from 'react-native'; import { Button, Card, Chip } from 'react-native-paper'; import API from './../API.js'; import UserName from './UserName.js'; @@ -71,9 +71,6 @@ let Post = (props) => { API.removePostBookmark(post._id) } } - const renderComment = ({ item }) => ( - - ); const handleTagPress = (tag) => { // Alert.alert("tag pressed", `You pressed the tag: ${tag}`); // You can navigate to another screen or perform any other action here @@ -278,11 +275,15 @@ let Post = (props) => { {showCommentsB && } { showCommentsB && - item.createdAt} - /> + + {post.comments.map((comment, index) => ( + + ))} + } ); diff --git a/components/SinglePostComponent.js b/components/SinglePostComponent.js index e57fa7e..843f74e 100644 --- a/components/SinglePostComponent.js +++ b/components/SinglePostComponent.js @@ -1,5 +1,5 @@ import React, { useState, useEffect } from 'react'; -import { View } from 'react-native'; +import { View, ScrollView } from 'react-native'; import API from './../API.js'; import Post from './Post.js'; @@ -19,8 +19,10 @@ let SinglePostComponent = ({ postId, hideComments }) => { } }, [postId]); return (post._id ? ( - - + + + + ) : null); };