Memoize rows

This commit is contained in:
Dan Abramov
2025-01-19 14:28:09 +00:00
parent f69946a435
commit d61da11c50
+4 -3
View File
@@ -1,4 +1,4 @@
import {useCallback, useEffect, useMemo, useRef, useState} from 'react' import {memo, useCallback, useEffect, useMemo, useRef, useState} from 'react'
import { import {
LayoutAnimation, LayoutAnimation,
ListRenderItem, ListRenderItem,
@@ -444,7 +444,7 @@ function keyExtractor(item: FeedPostSliceItem) {
return item._reactKey return item._reactKey
} }
function VideoItem({ let VideoItem = ({
player, player,
post, post,
embed, embed,
@@ -460,7 +460,7 @@ function VideoItem({
scrollGesture: NativeGesture scrollGesture: NativeGesture
moderation?: ModerationDecision moderation?: ModerationDecision
feedContext: string | undefined feedContext: string | undefined
}) { }): React.ReactNode => {
const postShadow = usePostShadow(post) const postShadow = usePostShadow(post)
const {width, height} = useSafeAreaFrame() const {width, height} = useSafeAreaFrame()
const {sendInteraction} = useFeedFeedbackContext() const {sendInteraction} = useFeedFeedbackContext()
@@ -525,6 +525,7 @@ function VideoItem({
</View> </View>
) )
} }
VideoItem = memo(VideoItem)
function VideoItemInner({ function VideoItemInner({
player, player,