An ATproto social media client -- with an independent Appview.

Slightly reduce rerenders in drawer (#6270)

* slightly reduce renders in drawer

* fix missing hook

authored by samuel.fm and committed by

GitHub f2916ce5 427f3a8b

+38 -31
+38 -31
src/view/shell/Drawer.tsx
··· 122 122 DrawerProfileCard = React.memo(DrawerProfileCard) 123 123 export {DrawerProfileCard} 124 124 125 - let DrawerContent = ({}: {}): React.ReactNode => { 125 + let DrawerContent = ({}: React.PropsWithoutRef<{}>): React.ReactNode => { 126 126 const t = useTheme() 127 - const {_} = useLingui() 128 127 const insets = useSafeAreaInsets() 129 128 const setDrawerOpen = useSetDrawerOpen() 130 129 const navigation = useNavigation<NavigationProp>() ··· 137 136 isAtMessages, 138 137 } = useNavigationTabState() 139 138 const {hasSession, currentAccount} = useSession() 140 - const kawaii = useKawaiiMode() 141 139 142 140 // events 143 141 // = ··· 277 275 278 276 <View style={[a.px_xl]}> 279 277 <Divider style={[a.mb_xl, a.mt_sm]} /> 280 - 281 - <View style={[a.flex_col, a.gap_md, a.flex_wrap]}> 282 - <InlineLinkText 283 - style={[a.text_md]} 284 - label={_(msg`Terms of Service`)} 285 - to="https://bsky.social/about/support/tos"> 286 - <Trans>Terms of Service</Trans> 287 - </InlineLinkText> 288 - <InlineLinkText 289 - style={[a.text_md]} 290 - to="https://bsky.social/about/support/privacy-policy" 291 - label={_(msg`Privacy Policy`)}> 292 - <Trans>Privacy Policy</Trans> 293 - </InlineLinkText> 294 - {kawaii && ( 295 - <Text style={t.atoms.text_contrast_medium}> 296 - <Trans> 297 - Logo by{' '} 298 - <InlineLinkText 299 - style={[a.text_md]} 300 - to="/profile/sawaratsuki.bsky.social" 301 - label="@sawaratsuki.bsky.social"> 302 - @sawaratsuki.bsky.social 303 - </InlineLinkText> 304 - </Trans> 305 - </Text> 306 - )} 307 - </View> 278 + <ExtraLinks /> 308 279 </View> 309 280 </ScrollView> 310 281 ··· 633 604 </Button> 634 605 ) 635 606 } 607 + 608 + function ExtraLinks() { 609 + const {_} = useLingui() 610 + const t = useTheme() 611 + const kawaii = useKawaiiMode() 612 + 613 + return ( 614 + <View style={[a.flex_col, a.gap_md, a.flex_wrap]}> 615 + <InlineLinkText 616 + style={[a.text_md]} 617 + label={_(msg`Terms of Service`)} 618 + to="https://bsky.social/about/support/tos"> 619 + <Trans>Terms of Service</Trans> 620 + </InlineLinkText> 621 + <InlineLinkText 622 + style={[a.text_md]} 623 + to="https://bsky.social/about/support/privacy-policy" 624 + label={_(msg`Privacy Policy`)}> 625 + <Trans>Privacy Policy</Trans> 626 + </InlineLinkText> 627 + {kawaii && ( 628 + <Text style={t.atoms.text_contrast_medium}> 629 + <Trans> 630 + Logo by{' '} 631 + <InlineLinkText 632 + style={[a.text_md]} 633 + to="/profile/sawaratsuki.bsky.social" 634 + label="@sawaratsuki.bsky.social"> 635 + @sawaratsuki.bsky.social 636 + </InlineLinkText> 637 + </Trans> 638 + </Text> 639 + )} 640 + </View> 641 + ) 642 + }