Add scrollview to drawer
parent
8fa33ac928
commit
dd1bbcfb0b
|
@ -3,3 +3,13 @@ export const formatCount = (num: number) =>
|
||||||
notation: 'compact',
|
notation: 'compact',
|
||||||
maximumFractionDigits: 1,
|
maximumFractionDigits: 1,
|
||||||
}).format(num)
|
}).format(num)
|
||||||
|
|
||||||
|
export function formatCountShortOnly(num: number): string {
|
||||||
|
if (num >= 1000000) {
|
||||||
|
return (num / 1000000).toFixed(1) + 'M'
|
||||||
|
}
|
||||||
|
if (num >= 1000) {
|
||||||
|
return (num / 1000).toFixed(1) + 'K'
|
||||||
|
}
|
||||||
|
return String(num)
|
||||||
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import React, {ComponentProps} from 'react'
|
||||||
import {
|
import {
|
||||||
Linking,
|
Linking,
|
||||||
SafeAreaView,
|
SafeAreaView,
|
||||||
|
ScrollView,
|
||||||
StyleProp,
|
StyleProp,
|
||||||
StyleSheet,
|
StyleSheet,
|
||||||
TouchableOpacity,
|
TouchableOpacity,
|
||||||
|
@ -41,7 +42,7 @@ import {getTabState, TabState} from 'lib/routes/helpers'
|
||||||
import {NavigationProp} from 'lib/routes/types'
|
import {NavigationProp} from 'lib/routes/types'
|
||||||
import {useNavigationTabState} from 'lib/hooks/useNavigationTabState'
|
import {useNavigationTabState} from 'lib/hooks/useNavigationTabState'
|
||||||
import {isWeb} from 'platform/detection'
|
import {isWeb} from 'platform/detection'
|
||||||
import {formatCount} from 'view/com/util/numeric/format'
|
import {formatCount, formatCountShortOnly} from 'view/com/util/numeric/format'
|
||||||
|
|
||||||
export const DrawerContent = observer(() => {
|
export const DrawerContent = observer(() => {
|
||||||
const theme = useTheme()
|
const theme = useTheme()
|
||||||
|
@ -154,19 +155,18 @@ export const DrawerContent = observer(() => {
|
||||||
type="xl"
|
type="xl"
|
||||||
style={[pal.textLight, styles.profileCardFollowers]}>
|
style={[pal.textLight, styles.profileCardFollowers]}>
|
||||||
<Text type="xl-medium" style={pal.text}>
|
<Text type="xl-medium" style={pal.text}>
|
||||||
{formatCount(store.me.followersCount ?? 0)}
|
{formatCountShortOnly(store.me.followersCount ?? 0)}
|
||||||
</Text>{' '}
|
</Text>{' '}
|
||||||
{pluralize(store.me.followersCount || 0, 'follower')} ·{' '}
|
{pluralize(store.me.followersCount || 0, 'follower')} ·{' '}
|
||||||
<Text type="xl-medium" style={pal.text}>
|
<Text type="xl-medium" style={pal.text}>
|
||||||
{formatCount(store.me.followsCount ?? 0)}
|
{formatCountShortOnly(store.me.followsCount ?? 0)}
|
||||||
</Text>{' '}
|
</Text>{' '}
|
||||||
following
|
following
|
||||||
</Text>
|
</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
<InviteCodes />
|
<InviteCodes />
|
||||||
<View style={s.flex1} />
|
<ScrollView style={styles.main}>
|
||||||
<View style={styles.main}>
|
|
||||||
<MenuItem
|
<MenuItem
|
||||||
icon={
|
icon={
|
||||||
isAtSearch ? (
|
isAtSearch ? (
|
||||||
|
@ -292,8 +292,8 @@ export const DrawerContent = observer(() => {
|
||||||
accessibilityHint=""
|
accessibilityHint=""
|
||||||
onPress={onPressSettings}
|
onPress={onPressSettings}
|
||||||
/>
|
/>
|
||||||
</View>
|
<View style={styles.smallSpacer} />
|
||||||
<View style={s.flex1} />
|
</ScrollView>
|
||||||
<View style={styles.footer}>
|
<View style={styles.footer}>
|
||||||
{!isWeb && (
|
{!isWeb && (
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
|
@ -449,6 +449,10 @@ const styles = StyleSheet.create({
|
||||||
},
|
},
|
||||||
main: {
|
main: {
|
||||||
paddingLeft: 20,
|
paddingLeft: 20,
|
||||||
|
paddingTop: 20,
|
||||||
|
},
|
||||||
|
smallSpacer: {
|
||||||
|
height: 20,
|
||||||
},
|
},
|
||||||
|
|
||||||
profileCardDisplayName: {
|
profileCardDisplayName: {
|
||||||
|
|
Loading…
Reference in New Issue