diff --git a/src/screens/StarterPack/Main/ProfilesList.tsx b/src/screens/StarterPack/Main/ProfilesList.tsx index a07aed0f23..c5cf2c4389 100644 --- a/src/screens/StarterPack/Main/ProfilesList.tsx +++ b/src/screens/StarterPack/Main/ProfilesList.tsx @@ -5,6 +5,7 @@ import {AppBskyActorDefs} from '@atproto/api' import {useBottomBarOffset} from 'lib/hooks/useBottomBarOffset' import {isNative} from 'platform/detection' import {useListMembersQuery} from 'state/queries/list-members' +import {useSession} from 'state/session' import {ProfileCardWithFollowBtn} from 'view/com/profile/ProfileCard' import {List, ListRef} from 'view/com/util/List' import {SectionRef} from '#/screens/Profile/Sections/types' @@ -32,10 +33,22 @@ export const ProfilesList = React.forwardRef( function ProfilesListImpl({listUri, headerHeight, scrollElRef}, ref) { const [initialHeaderHeight] = React.useState(headerHeight) const bottomBarOffset = useBottomBarOffset(20) + const {currentAccount} = useSession() const {data} = useListMembersQuery(listUri) const profiles = data?.pages.flatMap(p => p.items.map(i => i.subject)) + const getSortedProfiles = () => { + if (!profiles) return + + const myIndex = profiles.findIndex(p => p.did === currentAccount?.did) + + return [ + profiles[myIndex], + ...profiles.slice(0, myIndex), + ...profiles.slice(myIndex + 1), + ] + } const onScrollToTop = useCallback(() => { scrollElRef.current?.scrollToOffset({ animated: isNative, @@ -49,7 +62,7 @@ export const ProfilesList = React.forwardRef( return (