Visual alignment of tab bar and headers
This commit is contained in:
@@ -1,5 +1,12 @@
|
|||||||
import {memo, useCallback, useEffect, useMemo, useRef, useState} from 'react'
|
import {memo, useCallback, useEffect, useMemo, useRef, useState} from 'react'
|
||||||
import {ScrollView, TextInput, useWindowDimensions, View} from 'react-native'
|
import {
|
||||||
|
ScrollView,
|
||||||
|
type StyleProp,
|
||||||
|
TextInput,
|
||||||
|
useWindowDimensions,
|
||||||
|
View,
|
||||||
|
type ViewStyle,
|
||||||
|
} from 'react-native'
|
||||||
import Animated, {
|
import Animated, {
|
||||||
LayoutAnimationConfig,
|
LayoutAnimationConfig,
|
||||||
LinearTransition,
|
LinearTransition,
|
||||||
@@ -453,6 +460,7 @@ let Tabs = ({
|
|||||||
hasSearchText,
|
hasSearchText,
|
||||||
interestsDisplayNames,
|
interestsDisplayNames,
|
||||||
TabComponent = Tab,
|
TabComponent = Tab,
|
||||||
|
contentContainerStyle,
|
||||||
}: {
|
}: {
|
||||||
onSelectTab: (tab: string) => void
|
onSelectTab: (tab: string) => void
|
||||||
interests: string[]
|
interests: string[]
|
||||||
@@ -460,6 +468,7 @@ let Tabs = ({
|
|||||||
hasSearchText: boolean
|
hasSearchText: boolean
|
||||||
interestsDisplayNames: Record<string, string>
|
interestsDisplayNames: Record<string, string>
|
||||||
TabComponent?: React.ComponentType<React.ComponentProps<typeof Tab>>
|
TabComponent?: React.ComponentType<React.ComponentProps<typeof Tab>>
|
||||||
|
contentContainerStyle?: StyleProp<ViewStyle>
|
||||||
}): React.ReactNode => {
|
}): React.ReactNode => {
|
||||||
const listRef = useRef<ScrollView>(null)
|
const listRef = useRef<ScrollView>(null)
|
||||||
const [scrollX, setScrollX] = useState(0)
|
const [scrollX, setScrollX] = useState(0)
|
||||||
@@ -520,7 +529,7 @@ let Tabs = ({
|
|||||||
<ScrollView
|
<ScrollView
|
||||||
ref={listRef}
|
ref={listRef}
|
||||||
horizontal
|
horizontal
|
||||||
contentContainerStyle={[a.gap_sm, a.px_lg]}
|
contentContainerStyle={[a.gap_sm, a.px_lg, contentContainerStyle]}
|
||||||
showsHorizontalScrollIndicator={false}
|
showsHorizontalScrollIndicator={false}
|
||||||
decelerationRate="fast"
|
decelerationRate="fast"
|
||||||
snapToOffsets={
|
snapToOffsets={
|
||||||
|
|||||||
@@ -6,14 +6,7 @@ import {PressableScale} from '#/lib/custom-animations/PressableScale'
|
|||||||
import {makeCustomFeedLink} from '#/lib/routes/links'
|
import {makeCustomFeedLink} from '#/lib/routes/links'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {UserAvatar} from '#/view/com/util/UserAvatar'
|
import {UserAvatar} from '#/view/com/util/UserAvatar'
|
||||||
import {
|
import {atoms as a, native, useTheme, type ViewStyleProp, web} from '#/alf'
|
||||||
atoms as a,
|
|
||||||
native,
|
|
||||||
useGutters,
|
|
||||||
useTheme,
|
|
||||||
type ViewStyleProp,
|
|
||||||
web,
|
|
||||||
} from '#/alf'
|
|
||||||
import {Button, ButtonIcon} from '#/components/Button'
|
import {Button, ButtonIcon} from '#/components/Button'
|
||||||
import * as FeedCard from '#/components/FeedCard'
|
import * as FeedCard from '#/components/FeedCard'
|
||||||
import {sizes as iconSizes} from '#/components/icons/common'
|
import {sizes as iconSizes} from '#/components/icons/common'
|
||||||
@@ -27,13 +20,12 @@ export function Container({
|
|||||||
headerHeight,
|
headerHeight,
|
||||||
}: {children: React.ReactNode; headerHeight?: number} & ViewStyleProp) {
|
}: {children: React.ReactNode; headerHeight?: number} & ViewStyleProp) {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const gutters = useGutters([0, 'base'])
|
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
style={[
|
style={[
|
||||||
gutters,
|
|
||||||
a.flex_row,
|
a.flex_row,
|
||||||
a.align_center,
|
a.align_center,
|
||||||
|
a.px_lg,
|
||||||
a.pt_2xl,
|
a.pt_2xl,
|
||||||
a.pb_md,
|
a.pb_md,
|
||||||
a.gap_sm,
|
a.gap_sm,
|
||||||
|
|||||||
@@ -87,6 +87,12 @@ export function SuggestedAccountsTabBar({
|
|||||||
...interestsDisplayNames,
|
...interestsDisplayNames,
|
||||||
}}
|
}}
|
||||||
TabComponent={Tab}
|
TabComponent={Tab}
|
||||||
|
contentContainerStyle={[
|
||||||
|
{
|
||||||
|
// visual alignment
|
||||||
|
paddingLeft: a.px_lg.paddingLeft - 2,
|
||||||
|
},
|
||||||
|
]}
|
||||||
/>
|
/>
|
||||||
</BlockDrawerGesture>
|
</BlockDrawerGesture>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user