this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

isReply/hasReply logic

+26 -10
+2 -1
apps/expo/src/app/(tabs)/notifications.tsx
··· 307 307 throw Error("Post not found"); 308 308 assert(AppBskyFeedDefs.validateThreadViewPost(data.thread)); 309 309 310 + // convert thread view post to feed view post 310 311 return { 311 312 post: data.thread.post, 312 313 ...(AppBskyFeedDefs.isThreadViewPost(data.thread.parent) && 313 - AppBskyFeedDefs.validateFeedViewPost(data.thread.parent.post).success 314 + AppBskyFeedDefs.validateThreadViewPost(data.thread.parent).success 314 315 ? { 315 316 reply: { 316 317 parent: data.thread.parent.post,
+6 -2
apps/expo/src/app/(tabs)/timeline.tsx
··· 153 153 <FlashList 154 154 ref={ref} 155 155 data={data} 156 - renderItem={({ item: { hasReply, item } }) => ( 157 - <FeedPost item={item} hasReply={hasReply} /> 156 + renderItem={({ item: { hasReply, item }, index }) => ( 157 + <FeedPost 158 + item={item} 159 + hasReply={hasReply} 160 + isReply={data[index - 1]?.hasReply} 161 + /> 158 162 )} 159 163 onEndReachedThreshold={0.5} 160 164 onEndReached={() => void timeline.fetchNextPage()}
+6 -2
apps/expo/src/app/profile/[handle]/post/[id].tsx
··· 147 147 data={thread.data.posts} 148 148 estimatedItemSize={91} 149 149 getItemType={(item) => (item.primary ? "big" : "small")} 150 - renderItem={({ item }) => 150 + renderItem={({ item, index }) => 151 151 item.primary ? ( 152 152 <Post post={item.post} hasParent={item.hasParent} /> 153 153 ) : ( 154 - <FeedPost item={{ post: item.post }} hasReply={item.hasReply} /> 154 + <FeedPost 155 + item={{ post: item.post }} 156 + hasReply={item.hasReply} 157 + isReply={thread.data.posts[index - 1]?.hasReply} 158 + /> 155 159 ) 156 160 } 157 161 ListFooterComponent={<View className="h-screen" />}
+3 -2
apps/expo/src/components/feed-post.tsx
··· 18 18 19 19 interface Props { 20 20 item: AppBskyFeedDefs.FeedViewPost; 21 + isReply?: boolean; 21 22 hasReply?: boolean; 22 23 unread?: boolean; 23 24 inlineParent?: boolean; ··· 25 26 26 27 export const FeedPost = ({ 27 28 item, 29 + isReply = false, 28 30 hasReply = false, 29 31 unread, 30 32 inlineParent, ··· 50 52 <View 51 53 className={cx( 52 54 "bg-white px-2 pt-2", 53 - // todo: better approach 54 - // item.reply?.parent && "pt-0", 55 + isReply && !item.reason && "pt-0", 55 56 !hasReply && "border-b border-neutral-200", 56 57 unread && "border-blue-200 bg-blue-50", 57 58 )}
+9 -3
apps/expo/src/components/profile-view.tsx
··· 107 107 .map((item) => { 108 108 switch (mode) { 109 109 case "posts": 110 - return item.reply ? [] : [{ item, hasReply: false }]; 110 + return item.reply && !item.reason 111 + ? [] 112 + : [{ item, hasReply: false }]; 111 113 case "replies": 112 114 return item.reply && !item.reason 113 115 ? [ ··· 176 178 <FlashList 177 179 ref={ref} 178 180 data={[null, ...data]} 179 - renderItem={({ item }) => 181 + renderItem={({ item, index }) => 180 182 item === null ? ( 181 183 <Tabs> 182 184 <Tab ··· 217 219 /> 218 220 </Tabs> 219 221 ) : ( 220 - <FeedPost {...item} inlineParent={mode === "likes"} /> 222 + <FeedPost 223 + {...item} 224 + isReply={mode === "replies" && data[index]?.hasReply} 225 + inlineParent={mode !== "replies"} 226 + /> 221 227 ) 222 228 } 223 229 stickyHeaderIndices={[0]}