Slightly reduce rerenders in drawer (#6270)
* slightly reduce renders in drawer * fix missing hook
This commit is contained in:
+38
-31
@@ -122,9 +122,8 @@ let DrawerProfileCard = ({
|
|||||||
DrawerProfileCard = React.memo(DrawerProfileCard)
|
DrawerProfileCard = React.memo(DrawerProfileCard)
|
||||||
export {DrawerProfileCard}
|
export {DrawerProfileCard}
|
||||||
|
|
||||||
let DrawerContent = ({}: {}): React.ReactNode => {
|
let DrawerContent = ({}: React.PropsWithoutRef<{}>): React.ReactNode => {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const {_} = useLingui()
|
|
||||||
const insets = useSafeAreaInsets()
|
const insets = useSafeAreaInsets()
|
||||||
const setDrawerOpen = useSetDrawerOpen()
|
const setDrawerOpen = useSetDrawerOpen()
|
||||||
const navigation = useNavigation<NavigationProp>()
|
const navigation = useNavigation<NavigationProp>()
|
||||||
@@ -137,7 +136,6 @@ let DrawerContent = ({}: {}): React.ReactNode => {
|
|||||||
isAtMessages,
|
isAtMessages,
|
||||||
} = useNavigationTabState()
|
} = useNavigationTabState()
|
||||||
const {hasSession, currentAccount} = useSession()
|
const {hasSession, currentAccount} = useSession()
|
||||||
const kawaii = useKawaiiMode()
|
|
||||||
|
|
||||||
// events
|
// events
|
||||||
// =
|
// =
|
||||||
@@ -277,34 +275,7 @@ let DrawerContent = ({}: {}): React.ReactNode => {
|
|||||||
|
|
||||||
<View style={[a.px_xl]}>
|
<View style={[a.px_xl]}>
|
||||||
<Divider style={[a.mb_xl, a.mt_sm]} />
|
<Divider style={[a.mb_xl, a.mt_sm]} />
|
||||||
|
<ExtraLinks />
|
||||||
<View style={[a.flex_col, a.gap_md, a.flex_wrap]}>
|
|
||||||
<InlineLinkText
|
|
||||||
style={[a.text_md]}
|
|
||||||
label={_(msg`Terms of Service`)}
|
|
||||||
to="https://bsky.social/about/support/tos">
|
|
||||||
<Trans>Terms of Service</Trans>
|
|
||||||
</InlineLinkText>
|
|
||||||
<InlineLinkText
|
|
||||||
style={[a.text_md]}
|
|
||||||
to="https://bsky.social/about/support/privacy-policy"
|
|
||||||
label={_(msg`Privacy Policy`)}>
|
|
||||||
<Trans>Privacy Policy</Trans>
|
|
||||||
</InlineLinkText>
|
|
||||||
{kawaii && (
|
|
||||||
<Text style={t.atoms.text_contrast_medium}>
|
|
||||||
<Trans>
|
|
||||||
Logo by{' '}
|
|
||||||
<InlineLinkText
|
|
||||||
style={[a.text_md]}
|
|
||||||
to="/profile/sawaratsuki.bsky.social"
|
|
||||||
label="@sawaratsuki.bsky.social">
|
|
||||||
@sawaratsuki.bsky.social
|
|
||||||
</InlineLinkText>
|
|
||||||
</Trans>
|
|
||||||
</Text>
|
|
||||||
)}
|
|
||||||
</View>
|
|
||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
@@ -633,3 +604,39 @@ function MenuItem({icon, label, count, bold, onPress}: MenuItemProps) {
|
|||||||
</Button>
|
</Button>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ExtraLinks() {
|
||||||
|
const {_} = useLingui()
|
||||||
|
const t = useTheme()
|
||||||
|
const kawaii = useKawaiiMode()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View style={[a.flex_col, a.gap_md, a.flex_wrap]}>
|
||||||
|
<InlineLinkText
|
||||||
|
style={[a.text_md]}
|
||||||
|
label={_(msg`Terms of Service`)}
|
||||||
|
to="https://bsky.social/about/support/tos">
|
||||||
|
<Trans>Terms of Service</Trans>
|
||||||
|
</InlineLinkText>
|
||||||
|
<InlineLinkText
|
||||||
|
style={[a.text_md]}
|
||||||
|
to="https://bsky.social/about/support/privacy-policy"
|
||||||
|
label={_(msg`Privacy Policy`)}>
|
||||||
|
<Trans>Privacy Policy</Trans>
|
||||||
|
</InlineLinkText>
|
||||||
|
{kawaii && (
|
||||||
|
<Text style={t.atoms.text_contrast_medium}>
|
||||||
|
<Trans>
|
||||||
|
Logo by{' '}
|
||||||
|
<InlineLinkText
|
||||||
|
style={[a.text_md]}
|
||||||
|
to="/profile/sawaratsuki.bsky.social"
|
||||||
|
label="@sawaratsuki.bsky.social">
|
||||||
|
@sawaratsuki.bsky.social
|
||||||
|
</InlineLinkText>
|
||||||
|
</Trans>
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user