Fix double border on web hashtag list (#3091)
* add `topBorder` to Views.tsx * fix double borderzio/stable
parent
7a592d8140
commit
b8f36a8bca
|
@ -1,6 +1,7 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {atoms as a, useBreakpoints, useTheme} from '#/alf'
|
import {atoms as a, useBreakpoints, useTheme} from '#/alf'
|
||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
|
import {CenteredView} from 'view/com/util/Views'
|
||||||
import {Loader} from '#/components/Loader'
|
import {Loader} from '#/components/Loader'
|
||||||
import {Trans} from '@lingui/macro'
|
import {Trans} from '@lingui/macro'
|
||||||
import {cleanError} from 'lib/strings/errors'
|
import {cleanError} from 'lib/strings/errors'
|
||||||
|
@ -143,7 +144,7 @@ export function ListMaybePlaceholder({
|
||||||
}) {
|
}) {
|
||||||
const navigation = useNavigation<NavigationProp>()
|
const navigation = useNavigation<NavigationProp>()
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const {gtMobile} = useBreakpoints()
|
const {gtMobile, gtTablet} = useBreakpoints()
|
||||||
|
|
||||||
const canGoBack = navigation.canGoBack()
|
const canGoBack = navigation.canGoBack()
|
||||||
const onGoBack = React.useCallback(() => {
|
const onGoBack = React.useCallback(() => {
|
||||||
|
@ -165,14 +166,16 @@ export function ListMaybePlaceholder({
|
||||||
if (!isEmpty) return null
|
if (!isEmpty) return null
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View
|
<CenteredView
|
||||||
style={[
|
style={[
|
||||||
a.flex_1,
|
a.flex_1,
|
||||||
a.align_center,
|
a.align_center,
|
||||||
!gtMobile ? [a.justify_between, a.border_t] : a.gap_5xl,
|
!gtMobile ? a.justify_between : a.gap_5xl,
|
||||||
t.atoms.border_contrast_low,
|
t.atoms.border_contrast_low,
|
||||||
{paddingTop: 175, paddingBottom: 110},
|
{paddingTop: 175, paddingBottom: 110},
|
||||||
]}>
|
]}
|
||||||
|
sideBorders={gtMobile}
|
||||||
|
topBorder={!gtTablet}>
|
||||||
{isLoading ? (
|
{isLoading ? (
|
||||||
<View style={[a.w_full, a.align_center, {top: 100}]}>
|
<View style={[a.w_full, a.align_center, {top: 100}]}>
|
||||||
<Loader size="xl" />
|
<Loader size="xl" />
|
||||||
|
@ -241,6 +244,6 @@ export function ListMaybePlaceholder({
|
||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</View>
|
</CenteredView>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {ListRenderItemInfo, Pressable} from 'react-native'
|
import {ListRenderItemInfo, Pressable} from 'react-native'
|
||||||
import {atoms as a, useBreakpoints} from '#/alf'
|
|
||||||
import {useFocusEffect} from '@react-navigation/native'
|
import {useFocusEffect} from '@react-navigation/native'
|
||||||
import {useSetMinimalShellMode} from 'state/shell'
|
import {useSetMinimalShellMode} from 'state/shell'
|
||||||
import {ViewHeader} from 'view/com/util/ViewHeader'
|
import {ViewHeader} from 'view/com/util/ViewHeader'
|
||||||
|
@ -19,7 +18,6 @@ import {List} from 'view/com/util/List'
|
||||||
import {msg} from '@lingui/macro'
|
import {msg} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
import {sanitizeHandle} from 'lib/strings/handles'
|
import {sanitizeHandle} from 'lib/strings/handles'
|
||||||
import {CenteredView} from 'view/com/util/Views'
|
|
||||||
import {ArrowOutOfBox_Stroke2_Corner0_Rounded} from '#/components/icons/ArrowOutOfBox'
|
import {ArrowOutOfBox_Stroke2_Corner0_Rounded} from '#/components/icons/ArrowOutOfBox'
|
||||||
import {shareUrl} from 'lib/sharing'
|
import {shareUrl} from 'lib/sharing'
|
||||||
import {HITSLOP_10} from 'lib/constants'
|
import {HITSLOP_10} from 'lib/constants'
|
||||||
|
@ -38,7 +36,6 @@ export default function HashtagScreen({
|
||||||
}: NativeStackScreenProps<CommonNavigatorParams, 'Hashtag'>) {
|
}: NativeStackScreenProps<CommonNavigatorParams, 'Hashtag'>) {
|
||||||
const {tag, author} = route.params
|
const {tag, author} = route.params
|
||||||
const setMinimalShellMode = useSetMinimalShellMode()
|
const setMinimalShellMode = useSetMinimalShellMode()
|
||||||
const {gtMobile} = useBreakpoints()
|
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const [isPTR, setIsPTR] = React.useState(false)
|
const [isPTR, setIsPTR] = React.useState(false)
|
||||||
|
|
||||||
|
@ -103,7 +100,7 @@ export default function HashtagScreen({
|
||||||
}, [isFetching, hasNextPage, error, fetchNextPage])
|
}, [isFetching, hasNextPage, error, fetchNextPage])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CenteredView style={a.flex_1} sideBorders={gtMobile}>
|
<>
|
||||||
<ViewHeader
|
<ViewHeader
|
||||||
title={headerTitle}
|
title={headerTitle}
|
||||||
subtitle={author ? _(msg`From @${sanitizedAuthor}`) : undefined}
|
subtitle={author ? _(msg`From @${sanitizedAuthor}`) : undefined}
|
||||||
|
@ -159,6 +156,6 @@ export default function HashtagScreen({
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</CenteredView>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,4 +5,6 @@ export function CenteredView({
|
||||||
style,
|
style,
|
||||||
sideBorders,
|
sideBorders,
|
||||||
...props
|
...props
|
||||||
}: React.PropsWithChildren<ViewProps & {sideBorders?: boolean}>)
|
}: React.PropsWithChildren<
|
||||||
|
ViewProps & {sideBorders?: boolean; topBorder?: boolean}
|
||||||
|
>)
|
||||||
|
|
|
@ -32,8 +32,11 @@ interface AddedProps {
|
||||||
export function CenteredView({
|
export function CenteredView({
|
||||||
style,
|
style,
|
||||||
sideBorders,
|
sideBorders,
|
||||||
|
topBorder,
|
||||||
...props
|
...props
|
||||||
}: React.PropsWithChildren<ViewProps & {sideBorders?: boolean}>) {
|
}: React.PropsWithChildren<
|
||||||
|
ViewProps & {sideBorders?: boolean; topBorder?: boolean}
|
||||||
|
>) {
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const {isMobile} = useWebMediaQueries()
|
const {isMobile} = useWebMediaQueries()
|
||||||
if (!isMobile) {
|
if (!isMobile) {
|
||||||
|
@ -46,6 +49,12 @@ export function CenteredView({
|
||||||
})
|
})
|
||||||
style = addStyle(style, pal.border)
|
style = addStyle(style, pal.border)
|
||||||
}
|
}
|
||||||
|
if (topBorder) {
|
||||||
|
style = addStyle(style, {
|
||||||
|
borderTopWidth: 1,
|
||||||
|
})
|
||||||
|
style = addStyle(style, pal.border)
|
||||||
|
}
|
||||||
return <View style={style} {...props} />
|
return <View style={style} {...props} />
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue