absolutely position header, set a headerheight (#9858)
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import {useCallback, useMemo, useRef} from 'react'
|
import {useCallback, useMemo, useRef, useState} from 'react'
|
||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
import {useAnimatedRef} from 'react-native-reanimated'
|
import {useAnimatedRef} from 'react-native-reanimated'
|
||||||
import {
|
import {
|
||||||
@@ -35,12 +35,13 @@ import {PagerWithHeader} from '#/view/com/pager/PagerWithHeader'
|
|||||||
import {FAB} from '#/view/com/util/fab/FAB'
|
import {FAB} from '#/view/com/util/fab/FAB'
|
||||||
import {type ListRef} from '#/view/com/util/List'
|
import {type ListRef} from '#/view/com/util/List'
|
||||||
import {ListHiddenScreen} from '#/screens/List/ListHiddenScreen'
|
import {ListHiddenScreen} from '#/screens/List/ListHiddenScreen'
|
||||||
import {atoms as a, platform} from '#/alf'
|
import {atoms as a, native, platform, useTheme} from '#/alf'
|
||||||
import {useDialogControl} from '#/components/Dialog'
|
import {useDialogControl} from '#/components/Dialog'
|
||||||
import {ListAddRemoveUsersDialog} from '#/components/dialogs/lists/ListAddRemoveUsersDialog'
|
import {ListAddRemoveUsersDialog} from '#/components/dialogs/lists/ListAddRemoveUsersDialog'
|
||||||
import * as Layout from '#/components/Layout'
|
import * as Layout from '#/components/Layout'
|
||||||
import {Loader} from '#/components/Loader'
|
import {Loader} from '#/components/Loader'
|
||||||
import * as Hider from '#/components/moderation/Hider'
|
import * as Hider from '#/components/moderation/Hider'
|
||||||
|
import {IS_WEB} from '#/env'
|
||||||
import {AboutSection} from './AboutSection'
|
import {AboutSection} from './AboutSection'
|
||||||
import {ErrorScreen} from './components/ErrorScreen'
|
import {ErrorScreen} from './components/ErrorScreen'
|
||||||
import {Header} from './components/Header'
|
import {Header} from './components/Header'
|
||||||
@@ -149,6 +150,7 @@ function ProfileListScreenLoaded({
|
|||||||
moderationOpts: ModerationOpts
|
moderationOpts: ModerationOpts
|
||||||
preferences: UsePreferencesQueryResponse
|
preferences: UsePreferencesQueryResponse
|
||||||
}) {
|
}) {
|
||||||
|
const t = useTheme()
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
const {openComposer} = useOpenComposer()
|
const {openComposer} = useOpenComposer()
|
||||||
@@ -164,6 +166,8 @@ function ProfileListScreenLoaded({
|
|||||||
const scrollElRef = useAnimatedRef()
|
const scrollElRef = useAnimatedRef()
|
||||||
const addUserDialogControl = useDialogControl()
|
const addUserDialogControl = useDialogControl()
|
||||||
const sectionTitlesCurate = [_(msg`Posts`), _(msg`People`)]
|
const sectionTitlesCurate = [_(msg`Posts`), _(msg`People`)]
|
||||||
|
// modlist only
|
||||||
|
const [headerHeight, setHeaderHeight] = useState<number | null>(null)
|
||||||
|
|
||||||
const moderation = useMemo(() => {
|
const moderation = useMemo(() => {
|
||||||
return moderateUserList(list, moderationOpts)
|
return moderateUserList(list, moderationOpts)
|
||||||
@@ -263,13 +267,24 @@ function ProfileListScreenLoaded({
|
|||||||
</Hider.Mask>
|
</Hider.Mask>
|
||||||
<Hider.Content>
|
<Hider.Content>
|
||||||
<View style={[a.util_screen_outer]}>
|
<View style={[a.util_screen_outer]}>
|
||||||
<Layout.Center>{renderHeader()}</Layout.Center>
|
<Layout.Center
|
||||||
|
onLayout={evt => setHeaderHeight(evt.nativeEvent.layout.height)}
|
||||||
|
style={[
|
||||||
|
native([a.absolute, a.z_10, t.atoms.bg]),
|
||||||
|
|
||||||
|
a.border_b,
|
||||||
|
t.atoms.border_contrast_low,
|
||||||
|
]}>
|
||||||
|
{renderHeader()}
|
||||||
|
</Layout.Center>
|
||||||
|
{headerHeight !== null && (
|
||||||
<AboutSection
|
<AboutSection
|
||||||
list={list}
|
list={list}
|
||||||
scrollElRef={scrollElRef as ListRef}
|
scrollElRef={scrollElRef as ListRef}
|
||||||
onPressAddUser={addUserDialogControl.open}
|
onPressAddUser={addUserDialogControl.open}
|
||||||
headerHeight={0}
|
headerHeight={IS_WEB ? 0 : headerHeight}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
<FAB
|
<FAB
|
||||||
testID="composeFAB"
|
testID="composeFAB"
|
||||||
onPress={() => openComposer({logContext: 'Fab'})}
|
onPress={() => openComposer({logContext: 'Fab'})}
|
||||||
|
|||||||
Reference in New Issue
Block a user