rm forward ref from profiles
This commit is contained in:
@@ -1,9 +1,4 @@
|
|||||||
import React, {
|
import {useCallback, useEffect, useImperativeHandle, useState} from 'react'
|
||||||
useCallback,
|
|
||||||
useEffect,
|
|
||||||
useImperativeHandle,
|
|
||||||
useState,
|
|
||||||
} from 'react'
|
|
||||||
import {
|
import {
|
||||||
findNodeHandle,
|
findNodeHandle,
|
||||||
type ListRenderItemInfo,
|
type ListRenderItemInfo,
|
||||||
@@ -42,6 +37,7 @@ interface SectionRef {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface ProfileFeedgensProps {
|
interface ProfileFeedgensProps {
|
||||||
|
ref?: React.Ref<SectionRef>
|
||||||
scrollElRef: ListRef
|
scrollElRef: ListRef
|
||||||
did: string
|
did: string
|
||||||
headerOffset: number
|
headerOffset: number
|
||||||
@@ -56,11 +52,8 @@ function keyExtractor(item: AppBskyGraphDefs.StarterPackView) {
|
|||||||
return item.uri
|
return item.uri
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ProfileStarterPacks = React.forwardRef<
|
export function ProfileStarterPacks({
|
||||||
SectionRef,
|
ref,
|
||||||
ProfileFeedgensProps
|
|
||||||
>(function ProfileFeedgensImpl(
|
|
||||||
{
|
|
||||||
scrollElRef,
|
scrollElRef,
|
||||||
did,
|
did,
|
||||||
headerOffset,
|
headerOffset,
|
||||||
@@ -69,9 +62,7 @@ export const ProfileStarterPacks = React.forwardRef<
|
|||||||
testID,
|
testID,
|
||||||
setScrollViewTag,
|
setScrollViewTag,
|
||||||
isMe,
|
isMe,
|
||||||
},
|
}: ProfileFeedgensProps) {
|
||||||
ref,
|
|
||||||
) {
|
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const bottomBarOffset = useBottomBarOffset(100)
|
const bottomBarOffset = useBottomBarOffset(100)
|
||||||
const [isPTRing, setIsPTRing] = useState(false)
|
const [isPTRing, setIsPTRing] = useState(false)
|
||||||
@@ -101,7 +92,7 @@ export const ProfileStarterPacks = React.forwardRef<
|
|||||||
setIsPTRing(false)
|
setIsPTRing(false)
|
||||||
}, [refetch, setIsPTRing])
|
}, [refetch, setIsPTRing])
|
||||||
|
|
||||||
const onEndReached = React.useCallback(async () => {
|
const onEndReached = useCallback(async () => {
|
||||||
if (isFetchingNextPage || !hasNextPage || isError) return
|
if (isFetchingNextPage || !hasNextPage || isError) return
|
||||||
try {
|
try {
|
||||||
await fetchNextPage()
|
await fetchNextPage()
|
||||||
@@ -158,7 +149,7 @@ export const ProfileStarterPacks = React.forwardRef<
|
|||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
|
||||||
function CreateAnother() {
|
function CreateAnother() {
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {msg, Trans} from '@lingui/macro'
|
|||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
import {useNavigation} from '@react-navigation/native'
|
import {useNavigation} from '@react-navigation/native'
|
||||||
|
|
||||||
import {NavigationProp} from '#/lib/routes/types'
|
import {type NavigationProp} from '#/lib/routes/types'
|
||||||
import {atoms as a, useTheme} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
import {Button, ButtonText} from '#/components/Button'
|
import {Button, ButtonText} from '#/components/Button'
|
||||||
import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/icons/CircleInfo'
|
import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/icons/CircleInfo'
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React from 'react'
|
import {useCallback, useEffect, useImperativeHandle, useState} from 'react'
|
||||||
import {findNodeHandle, View} from 'react-native'
|
import {findNodeHandle, View} from 'react-native'
|
||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
@@ -18,6 +18,7 @@ import {Text} from '#/components/Typography'
|
|||||||
import {type SectionRef} from './types'
|
import {type SectionRef} from './types'
|
||||||
|
|
||||||
interface FeedSectionProps {
|
interface FeedSectionProps {
|
||||||
|
ref?: React.Ref<SectionRef>
|
||||||
feed: FeedDescriptor
|
feed: FeedDescriptor
|
||||||
headerHeight: number
|
headerHeight: number
|
||||||
isFocused: boolean
|
isFocused: boolean
|
||||||
@@ -25,31 +26,26 @@ interface FeedSectionProps {
|
|||||||
ignoreFilterFor?: string
|
ignoreFilterFor?: string
|
||||||
setScrollViewTag: (tag: number | null) => void
|
setScrollViewTag: (tag: number | null) => void
|
||||||
}
|
}
|
||||||
export const ProfileFeedSection = React.forwardRef<
|
export function ProfileFeedSection({
|
||||||
SectionRef,
|
ref,
|
||||||
FeedSectionProps
|
|
||||||
>(function FeedSectionImpl(
|
|
||||||
{
|
|
||||||
feed,
|
feed,
|
||||||
headerHeight,
|
headerHeight,
|
||||||
isFocused,
|
isFocused,
|
||||||
scrollElRef,
|
scrollElRef,
|
||||||
ignoreFilterFor,
|
ignoreFilterFor,
|
||||||
setScrollViewTag,
|
setScrollViewTag,
|
||||||
},
|
}: FeedSectionProps) {
|
||||||
ref,
|
|
||||||
) {
|
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
const [hasNew, setHasNew] = React.useState(false)
|
const [hasNew, setHasNew] = useState(false)
|
||||||
const [isScrolledDown, setIsScrolledDown] = React.useState(false)
|
const [isScrolledDown, setIsScrolledDown] = useState(false)
|
||||||
const shouldUseAdjustedNumToRender = feed.endsWith('posts_and_author_threads')
|
const shouldUseAdjustedNumToRender = feed.endsWith('posts_and_author_threads')
|
||||||
const isVideoFeed = isNative && feed.endsWith('posts_with_video')
|
const isVideoFeed = isNative && feed.endsWith('posts_with_video')
|
||||||
const adjustedInitialNumToRender = useInitialNumToRender({
|
const adjustedInitialNumToRender = useInitialNumToRender({
|
||||||
screenHeightOffset: headerHeight,
|
screenHeightOffset: headerHeight,
|
||||||
})
|
})
|
||||||
|
|
||||||
const onScrollToTop = React.useCallback(() => {
|
const onScrollToTop = useCallback(() => {
|
||||||
scrollElRef.current?.scrollToOffset({
|
scrollElRef.current?.scrollToOffset({
|
||||||
animated: isNative,
|
animated: isNative,
|
||||||
offset: -headerHeight,
|
offset: -headerHeight,
|
||||||
@@ -58,15 +54,15 @@ export const ProfileFeedSection = React.forwardRef<
|
|||||||
setHasNew(false)
|
setHasNew(false)
|
||||||
}, [scrollElRef, headerHeight, queryClient, feed, setHasNew])
|
}, [scrollElRef, headerHeight, queryClient, feed, setHasNew])
|
||||||
|
|
||||||
React.useImperativeHandle(ref, () => ({
|
useImperativeHandle(ref, () => ({
|
||||||
scrollToTop: onScrollToTop,
|
scrollToTop: onScrollToTop,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const renderPostsEmpty = React.useCallback(() => {
|
const renderPostsEmpty = useCallback(() => {
|
||||||
return <EmptyState icon="growth" message={_(msg`No posts yet.`)} />
|
return <EmptyState icon="growth" message={_(msg`No posts yet.`)} />
|
||||||
}, [_])
|
}, [_])
|
||||||
|
|
||||||
React.useEffect(() => {
|
useEffect(() => {
|
||||||
if (isIOS && isFocused && scrollElRef.current) {
|
if (isIOS && isFocused && scrollElRef.current) {
|
||||||
const nativeTag = findNodeHandle(scrollElRef.current)
|
const nativeTag = findNodeHandle(scrollElRef.current)
|
||||||
setScrollViewTag(nativeTag)
|
setScrollViewTag(nativeTag)
|
||||||
@@ -101,7 +97,7 @@ export const ProfileFeedSection = React.forwardRef<
|
|||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
|
||||||
function ProfileEndOfFeed() {
|
function ProfileEndOfFeed() {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ interface LabelsSectionProps {
|
|||||||
isFocused: boolean
|
isFocused: boolean
|
||||||
setScrollViewTag: (tag: number | null) => void
|
setScrollViewTag: (tag: number | null) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ProfileLabelsSection({
|
export function ProfileLabelsSection({
|
||||||
ref,
|
ref,
|
||||||
isLabelerLoading,
|
isLabelerLoading,
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
import React from 'react'
|
import {
|
||||||
|
useCallback,
|
||||||
|
useEffect,
|
||||||
|
useImperativeHandle,
|
||||||
|
useMemo,
|
||||||
|
useState,
|
||||||
|
} from 'react'
|
||||||
import {
|
import {
|
||||||
findNodeHandle,
|
findNodeHandle,
|
||||||
type ListRenderItemInfo,
|
type ListRenderItemInfo,
|
||||||
@@ -34,6 +40,7 @@ interface SectionRef {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface ProfileFeedgensProps {
|
interface ProfileFeedgensProps {
|
||||||
|
ref?: React.Ref<SectionRef>
|
||||||
did: string
|
did: string
|
||||||
scrollElRef: ListRef
|
scrollElRef: ListRef
|
||||||
headerOffset: number
|
headerOffset: number
|
||||||
@@ -43,17 +50,20 @@ interface ProfileFeedgensProps {
|
|||||||
setScrollViewTag: (tag: number | null) => void
|
setScrollViewTag: (tag: number | null) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ProfileFeedgens = React.forwardRef<
|
export function ProfileFeedgens({
|
||||||
SectionRef,
|
|
||||||
ProfileFeedgensProps
|
|
||||||
>(function ProfileFeedgensImpl(
|
|
||||||
{did, scrollElRef, headerOffset, enabled, style, testID, setScrollViewTag},
|
|
||||||
ref,
|
ref,
|
||||||
) {
|
did,
|
||||||
|
scrollElRef,
|
||||||
|
headerOffset,
|
||||||
|
enabled,
|
||||||
|
style,
|
||||||
|
testID,
|
||||||
|
setScrollViewTag,
|
||||||
|
}: ProfileFeedgensProps) {
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const [isPTRing, setIsPTRing] = React.useState(false)
|
const [isPTRing, setIsPTRing] = useState(false)
|
||||||
const opts = React.useMemo(() => ({enabled}), [enabled])
|
const opts = useMemo(() => ({enabled}), [enabled])
|
||||||
const {
|
const {
|
||||||
data,
|
data,
|
||||||
isPending,
|
isPending,
|
||||||
@@ -67,7 +77,7 @@ export const ProfileFeedgens = React.forwardRef<
|
|||||||
const isEmpty = !isPending && !data?.pages[0]?.feeds.length
|
const isEmpty = !isPending && !data?.pages[0]?.feeds.length
|
||||||
const {data: preferences} = usePreferencesQuery()
|
const {data: preferences} = usePreferencesQuery()
|
||||||
|
|
||||||
const items = React.useMemo(() => {
|
const items = useMemo(() => {
|
||||||
let items: any[] = []
|
let items: any[] = []
|
||||||
if (isError && isEmpty) {
|
if (isError && isEmpty) {
|
||||||
items = items.concat([ERROR_ITEM])
|
items = items.concat([ERROR_ITEM])
|
||||||
@@ -91,7 +101,7 @@ export const ProfileFeedgens = React.forwardRef<
|
|||||||
|
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
|
|
||||||
const onScrollToTop = React.useCallback(() => {
|
const onScrollToTop = useCallback(() => {
|
||||||
scrollElRef.current?.scrollToOffset({
|
scrollElRef.current?.scrollToOffset({
|
||||||
animated: isNative,
|
animated: isNative,
|
||||||
offset: -headerOffset,
|
offset: -headerOffset,
|
||||||
@@ -99,11 +109,11 @@ export const ProfileFeedgens = React.forwardRef<
|
|||||||
queryClient.invalidateQueries({queryKey: RQKEY(did)})
|
queryClient.invalidateQueries({queryKey: RQKEY(did)})
|
||||||
}, [scrollElRef, queryClient, headerOffset, did])
|
}, [scrollElRef, queryClient, headerOffset, did])
|
||||||
|
|
||||||
React.useImperativeHandle(ref, () => ({
|
useImperativeHandle(ref, () => ({
|
||||||
scrollToTop: onScrollToTop,
|
scrollToTop: onScrollToTop,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const onRefresh = React.useCallback(async () => {
|
const onRefresh = useCallback(async () => {
|
||||||
setIsPTRing(true)
|
setIsPTRing(true)
|
||||||
try {
|
try {
|
||||||
await refetch()
|
await refetch()
|
||||||
@@ -113,7 +123,7 @@ export const ProfileFeedgens = React.forwardRef<
|
|||||||
setIsPTRing(false)
|
setIsPTRing(false)
|
||||||
}, [refetch, setIsPTRing])
|
}, [refetch, setIsPTRing])
|
||||||
|
|
||||||
const onEndReached = React.useCallback(async () => {
|
const onEndReached = useCallback(async () => {
|
||||||
if (isFetchingNextPage || !hasNextPage || isError) return
|
if (isFetchingNextPage || !hasNextPage || isError) return
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -123,14 +133,14 @@ export const ProfileFeedgens = React.forwardRef<
|
|||||||
}
|
}
|
||||||
}, [isFetchingNextPage, hasNextPage, isError, fetchNextPage])
|
}, [isFetchingNextPage, hasNextPage, isError, fetchNextPage])
|
||||||
|
|
||||||
const onPressRetryLoadMore = React.useCallback(() => {
|
const onPressRetryLoadMore = useCallback(() => {
|
||||||
fetchNextPage()
|
fetchNextPage()
|
||||||
}, [fetchNextPage])
|
}, [fetchNextPage])
|
||||||
|
|
||||||
// rendering
|
// rendering
|
||||||
// =
|
// =
|
||||||
|
|
||||||
const renderItem = React.useCallback(
|
const renderItem = useCallback(
|
||||||
({item, index}: ListRenderItemInfo<any>) => {
|
({item, index}: ListRenderItemInfo<any>) => {
|
||||||
if (item === EMPTY) {
|
if (item === EMPTY) {
|
||||||
return (
|
return (
|
||||||
@@ -174,14 +184,14 @@ export const ProfileFeedgens = React.forwardRef<
|
|||||||
[_, t, error, refetch, onPressRetryLoadMore, preferences],
|
[_, t, error, refetch, onPressRetryLoadMore, preferences],
|
||||||
)
|
)
|
||||||
|
|
||||||
React.useEffect(() => {
|
useEffect(() => {
|
||||||
if (isIOS && enabled && scrollElRef.current) {
|
if (isIOS && enabled && scrollElRef.current) {
|
||||||
const nativeTag = findNodeHandle(scrollElRef.current)
|
const nativeTag = findNodeHandle(scrollElRef.current)
|
||||||
setScrollViewTag(nativeTag)
|
setScrollViewTag(nativeTag)
|
||||||
}
|
}
|
||||||
}, [enabled, scrollElRef, setScrollViewTag])
|
}, [enabled, scrollElRef, setScrollViewTag])
|
||||||
|
|
||||||
const ProfileFeedgensFooter = React.useCallback(() => {
|
const ProfileFeedgensFooter = useCallback(() => {
|
||||||
if (isEmpty) return null
|
if (isEmpty) return null
|
||||||
return (
|
return (
|
||||||
<ListFooter
|
<ListFooter
|
||||||
@@ -220,7 +230,7 @@ export const ProfileFeedgens = React.forwardRef<
|
|||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
|
||||||
function keyExtractor(item: any) {
|
function keyExtractor(item: any) {
|
||||||
return item._reactKey || item.uri
|
return item._reactKey || item.uri
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
import React from 'react'
|
import {
|
||||||
|
useCallback,
|
||||||
|
useEffect,
|
||||||
|
useImperativeHandle,
|
||||||
|
useMemo,
|
||||||
|
useState,
|
||||||
|
} from 'react'
|
||||||
import {
|
import {
|
||||||
findNodeHandle,
|
findNodeHandle,
|
||||||
type ListRenderItemInfo,
|
type ListRenderItemInfo,
|
||||||
@@ -33,6 +39,7 @@ interface SectionRef {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface ProfileListsProps {
|
interface ProfileListsProps {
|
||||||
|
ref?: React.Ref<SectionRef>
|
||||||
did: string
|
did: string
|
||||||
scrollElRef: ListRef
|
scrollElRef: ListRef
|
||||||
headerOffset: number
|
headerOffset: number
|
||||||
@@ -42,15 +49,20 @@ interface ProfileListsProps {
|
|||||||
setScrollViewTag: (tag: number | null) => void
|
setScrollViewTag: (tag: number | null) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ProfileLists = React.forwardRef<SectionRef, ProfileListsProps>(
|
export function ProfileLists({
|
||||||
function ProfileListsImpl(
|
|
||||||
{did, scrollElRef, headerOffset, enabled, style, testID, setScrollViewTag},
|
|
||||||
ref,
|
ref,
|
||||||
) {
|
did,
|
||||||
|
scrollElRef,
|
||||||
|
headerOffset,
|
||||||
|
enabled,
|
||||||
|
style,
|
||||||
|
testID,
|
||||||
|
setScrollViewTag,
|
||||||
|
}: ProfileListsProps) {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const [isPTRing, setIsPTRing] = React.useState(false)
|
const [isPTRing, setIsPTRing] = useState(false)
|
||||||
const opts = React.useMemo(() => ({enabled}), [enabled])
|
const opts = useMemo(() => ({enabled}), [enabled])
|
||||||
const {
|
const {
|
||||||
data,
|
data,
|
||||||
isPending,
|
isPending,
|
||||||
@@ -63,7 +75,7 @@ export const ProfileLists = React.forwardRef<SectionRef, ProfileListsProps>(
|
|||||||
} = useProfileListsQuery(did, opts)
|
} = useProfileListsQuery(did, opts)
|
||||||
const isEmpty = !isPending && !data?.pages[0]?.lists.length
|
const isEmpty = !isPending && !data?.pages[0]?.lists.length
|
||||||
|
|
||||||
const items = React.useMemo(() => {
|
const items = useMemo(() => {
|
||||||
let items: any[] = []
|
let items: any[] = []
|
||||||
if (isError && isEmpty) {
|
if (isError && isEmpty) {
|
||||||
items = items.concat([ERROR_ITEM])
|
items = items.concat([ERROR_ITEM])
|
||||||
@@ -88,7 +100,7 @@ export const ProfileLists = React.forwardRef<SectionRef, ProfileListsProps>(
|
|||||||
|
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
|
|
||||||
const onScrollToTop = React.useCallback(() => {
|
const onScrollToTop = useCallback(() => {
|
||||||
scrollElRef.current?.scrollToOffset({
|
scrollElRef.current?.scrollToOffset({
|
||||||
animated: isNative,
|
animated: isNative,
|
||||||
offset: -headerOffset,
|
offset: -headerOffset,
|
||||||
@@ -96,11 +108,11 @@ export const ProfileLists = React.forwardRef<SectionRef, ProfileListsProps>(
|
|||||||
queryClient.invalidateQueries({queryKey: RQKEY(did)})
|
queryClient.invalidateQueries({queryKey: RQKEY(did)})
|
||||||
}, [scrollElRef, queryClient, headerOffset, did])
|
}, [scrollElRef, queryClient, headerOffset, did])
|
||||||
|
|
||||||
React.useImperativeHandle(ref, () => ({
|
useImperativeHandle(ref, () => ({
|
||||||
scrollToTop: onScrollToTop,
|
scrollToTop: onScrollToTop,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const onRefresh = React.useCallback(async () => {
|
const onRefresh = useCallback(async () => {
|
||||||
setIsPTRing(true)
|
setIsPTRing(true)
|
||||||
try {
|
try {
|
||||||
await refetch()
|
await refetch()
|
||||||
@@ -110,7 +122,7 @@ export const ProfileLists = React.forwardRef<SectionRef, ProfileListsProps>(
|
|||||||
setIsPTRing(false)
|
setIsPTRing(false)
|
||||||
}, [refetch, setIsPTRing])
|
}, [refetch, setIsPTRing])
|
||||||
|
|
||||||
const onEndReached = React.useCallback(async () => {
|
const onEndReached = useCallback(async () => {
|
||||||
if (isFetchingNextPage || !hasNextPage || isError) return
|
if (isFetchingNextPage || !hasNextPage || isError) return
|
||||||
try {
|
try {
|
||||||
await fetchNextPage()
|
await fetchNextPage()
|
||||||
@@ -119,14 +131,14 @@ export const ProfileLists = React.forwardRef<SectionRef, ProfileListsProps>(
|
|||||||
}
|
}
|
||||||
}, [isFetchingNextPage, hasNextPage, isError, fetchNextPage])
|
}, [isFetchingNextPage, hasNextPage, isError, fetchNextPage])
|
||||||
|
|
||||||
const onPressRetryLoadMore = React.useCallback(() => {
|
const onPressRetryLoadMore = useCallback(() => {
|
||||||
fetchNextPage()
|
fetchNextPage()
|
||||||
}, [fetchNextPage])
|
}, [fetchNextPage])
|
||||||
|
|
||||||
// rendering
|
// rendering
|
||||||
// =
|
// =
|
||||||
|
|
||||||
const renderItemInner = React.useCallback(
|
const renderItemInner = useCallback(
|
||||||
({item, index}: ListRenderItemInfo<any>) => {
|
({item, index}: ListRenderItemInfo<any>) => {
|
||||||
if (item === EMPTY) {
|
if (item === EMPTY) {
|
||||||
return (
|
return (
|
||||||
@@ -138,10 +150,7 @@ export const ProfileLists = React.forwardRef<SectionRef, ProfileListsProps>(
|
|||||||
)
|
)
|
||||||
} else if (item === ERROR_ITEM) {
|
} else if (item === ERROR_ITEM) {
|
||||||
return (
|
return (
|
||||||
<ErrorMessage
|
<ErrorMessage message={cleanError(error)} onPressTryAgain={refetch} />
|
||||||
message={cleanError(error)}
|
|
||||||
onPressTryAgain={refetch}
|
|
||||||
/>
|
|
||||||
)
|
)
|
||||||
} else if (item === LOAD_MORE_ERROR_ITEM) {
|
} else if (item === LOAD_MORE_ERROR_ITEM) {
|
||||||
return (
|
return (
|
||||||
@@ -170,14 +179,14 @@ export const ProfileLists = React.forwardRef<SectionRef, ProfileListsProps>(
|
|||||||
[error, refetch, onPressRetryLoadMore, _, t.atoms.border_contrast_low],
|
[error, refetch, onPressRetryLoadMore, _, t.atoms.border_contrast_low],
|
||||||
)
|
)
|
||||||
|
|
||||||
React.useEffect(() => {
|
useEffect(() => {
|
||||||
if (isIOS && enabled && scrollElRef.current) {
|
if (isIOS && enabled && scrollElRef.current) {
|
||||||
const nativeTag = findNodeHandle(scrollElRef.current)
|
const nativeTag = findNodeHandle(scrollElRef.current)
|
||||||
setScrollViewTag(nativeTag)
|
setScrollViewTag(nativeTag)
|
||||||
}
|
}
|
||||||
}, [enabled, scrollElRef, setScrollViewTag])
|
}, [enabled, scrollElRef, setScrollViewTag])
|
||||||
|
|
||||||
const ProfileListsFooter = React.useCallback(() => {
|
const ProfileListsFooter = useCallback(() => {
|
||||||
if (isEmpty) return null
|
if (isEmpty) return null
|
||||||
return (
|
return (
|
||||||
<ListFooter
|
<ListFooter
|
||||||
@@ -216,8 +225,7 @@ export const ProfileLists = React.forwardRef<SectionRef, ProfileListsProps>(
|
|||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
},
|
}
|
||||||
)
|
|
||||||
|
|
||||||
function keyExtractor(item: any) {
|
function keyExtractor(item: any) {
|
||||||
return item._reactKey || item.uri
|
return item._reactKey || item.uri
|
||||||
|
|||||||
Reference in New Issue
Block a user