mirror of https://github.com/tooot-app/app
Try to solve scrollToIndex was called during going back to previous page
This commit is contained in:
parent
4ea4e39759
commit
55b7b0b0cd
|
@ -24,9 +24,12 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
||||||
const scrolled = useRef(false)
|
const scrolled = useRef(false)
|
||||||
const navigation = useNavigation()
|
const navigation = useNavigation()
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
const observer = new InfiniteQueryObserver(queryClient, { queryKey })
|
const observer = new InfiniteQueryObserver(queryClient, {
|
||||||
|
queryKey,
|
||||||
|
enabled: false
|
||||||
|
})
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const unsubscribe = observer.subscribe(result => {
|
return observer.subscribe(result => {
|
||||||
if (result.isSuccess) {
|
if (result.isSuccess) {
|
||||||
const flattenData = result.data?.pages
|
const flattenData = result.data?.pages
|
||||||
? // @ts-ignore
|
? // @ts-ignore
|
||||||
|
@ -62,7 +65,6 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return () => unsubscribe()
|
|
||||||
}, [scrolled.current])
|
}, [scrolled.current])
|
||||||
|
|
||||||
// Toot page auto scroll to selected toot
|
// Toot page auto scroll to selected toot
|
||||||
|
|
Loading…
Reference in New Issue