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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 160 additions and 87 deletions

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: {