Re-rendering improvements for like/unlike (#2180)

* Add a few memos

* Memo PostDropdownBtn better

* More memo

* More granularity

* Extract PostContent

* Fix a usage I missed

* oops
This commit is contained in:
dan
2023-12-12 21:50:43 +00:00
committed by GitHub
parent a5e25a7a16
commit 5c701f8e0b
7 changed files with 160 additions and 87 deletions
+4 -2
View File
@@ -1,4 +1,4 @@
import React from 'react'
import React, {memo} from 'react'
import {StyleProp, StyleSheet, TextStyle, View, ViewStyle} from 'react-native'
import {Text} from './text/Text'
import {TextLinkOnWebOnly} from './Link'
@@ -29,7 +29,7 @@ interface PostMetaOpts {
style?: StyleProp<ViewStyle>
}
export function PostMeta(opts: PostMetaOpts) {
let PostMeta = (opts: PostMetaOpts): React.ReactNode => {
const pal = usePalette('default')
const displayName = opts.author.displayName || opts.author.handle
const handle = opts.author.handle
@@ -92,6 +92,8 @@ export function PostMeta(opts: PostMetaOpts) {
</View>
)
}
PostMeta = memo(PostMeta)
export {PostMeta}
const styles = StyleSheet.create({
container: {