diff options
author | dan <dan.abramov@gmail.com> | 2023-12-12 21:50:43 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-12 13:50:43 -0800 |
commit | 5c701f8e0bced2fe26544acc04732bdc0fcd8c40 (patch) | |
tree | d0ac3658fb3c5092d8da913b75387c43d219a1b3 /src/view/com/util/PostMeta.tsx | |
parent | a5e25a7a16cdcde64628e942c073a119bc1d7a1e (diff) | |
download | voidsky-5c701f8e0bced2fe26544acc04732bdc0fcd8c40.tar.zst |
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
Diffstat (limited to 'src/view/com/util/PostMeta.tsx')
-rw-r--r-- | src/view/com/util/PostMeta.tsx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/view/com/util/PostMeta.tsx b/src/view/com/util/PostMeta.tsx index fa5f12f6b..eef7094cd 100644 --- a/src/view/com/util/PostMeta.tsx +++ b/src/view/com/util/PostMeta.tsx @@ -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: { |