Optimize notifications rendering (#1957)

zio/stable
dan 2023-11-17 17:51:44 +00:00 committed by GitHub
parent d1c14940fb
commit 7c51a3931a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -1,4 +1,4 @@
import React, {useMemo, useState, useEffect} from 'react' import React, {memo, useMemo, useState, useEffect} from 'react'
import { import {
Animated, Animated,
TouchableOpacity, TouchableOpacity,
@ -56,7 +56,7 @@ interface Author {
moderation: ProfileModeration moderation: ProfileModeration
} }
export function FeedItem({ let FeedItem = ({
item, item,
dataUpdatedAt, dataUpdatedAt,
moderationOpts, moderationOpts,
@ -64,7 +64,7 @@ export function FeedItem({
item: FeedNotification item: FeedNotification
dataUpdatedAt: number dataUpdatedAt: number
moderationOpts: ModerationOpts moderationOpts: ModerationOpts
}) { }): React.ReactNode => {
const pal = usePalette('default') const pal = usePalette('default')
const [isAuthorsExpanded, setAuthorsExpanded] = useState<boolean>(false) const [isAuthorsExpanded, setAuthorsExpanded] = useState<boolean>(false)
const itemHref = useMemo(() => { const itemHref = useMemo(() => {
@ -262,6 +262,8 @@ export function FeedItem({
</Link> </Link>
) )
} }
FeedItem = memo(FeedItem)
export {FeedItem}
function ExpandListPressable({ function ExpandListPressable({
hasMultipleAuthors, hasMultipleAuthors,