mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
Better lookback update
This commit is contained in:
@@ -8,7 +8,6 @@ import {
|
||||
RootStackScreenProps
|
||||
} from '@utils/navigation/navigators'
|
||||
import { useTheme } from '@utils/styles/ThemeManager'
|
||||
import { findIndex } from 'lodash'
|
||||
import React, { RefObject, useCallback, useRef, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { Platform, Share, StatusBar, View } from 'react-native'
|
||||
@@ -120,7 +119,7 @@ const ScreenImagesViewer = ({
|
||||
|
||||
const { mode } = useTheme()
|
||||
|
||||
const initialIndex = findIndex(imageUrls, ['id', id])
|
||||
const initialIndex = imageUrls.findIndex(image => image.id === id)
|
||||
const [currentIndex, setCurrentIndex] = useState(initialIndex)
|
||||
|
||||
const messageRef = useRef<FlashMessage>(null)
|
||||
|
@@ -3,11 +3,11 @@ import Button from '@components/Button'
|
||||
import haptics from '@components/haptics'
|
||||
import ComponentInstance from '@components/Instance'
|
||||
import { useNavigation } from '@react-navigation/native'
|
||||
import initQuery from '@utils/initQuery'
|
||||
import {
|
||||
getInstanceActive,
|
||||
getInstances,
|
||||
Instance,
|
||||
updateInstanceActive
|
||||
Instance
|
||||
} from '@utils/slices/instancesSlice'
|
||||
import { StyleConstants } from '@utils/styles/constants'
|
||||
import { useTheme } from '@utils/styles/ThemeManager'
|
||||
@@ -21,8 +21,7 @@ import {
|
||||
View
|
||||
} from 'react-native'
|
||||
import { ScrollView } from 'react-native-gesture-handler'
|
||||
import { useQueryClient } from 'react-query'
|
||||
import { useDispatch, useSelector } from 'react-redux'
|
||||
import { useSelector } from 'react-redux'
|
||||
|
||||
interface Props {
|
||||
instance: Instance
|
||||
@@ -30,9 +29,7 @@ interface Props {
|
||||
}
|
||||
|
||||
const AccountButton: React.FC<Props> = ({ instance, selected = false }) => {
|
||||
const queryClient = useQueryClient()
|
||||
const navigation = useNavigation()
|
||||
const dispatch = useDispatch()
|
||||
|
||||
return (
|
||||
<Button
|
||||
@@ -45,8 +42,7 @@ const AccountButton: React.FC<Props> = ({ instance, selected = false }) => {
|
||||
onPress={() => {
|
||||
haptics('Light')
|
||||
analytics('switch_existing_press')
|
||||
dispatch(updateInstanceActive(instance))
|
||||
queryClient.clear()
|
||||
initQuery({ instance, prefetch: { enabled: true } })
|
||||
navigation.goBack()
|
||||
}}
|
||||
/>
|
||||
|
@@ -3,7 +3,6 @@ import TimelineDefault from '@components/Timeline/Default'
|
||||
import { useNavigation } from '@react-navigation/native'
|
||||
import { TabSharedStackScreenProps } from '@utils/navigation/navigators'
|
||||
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
|
||||
import { findIndex } from 'lodash'
|
||||
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
||||
import { FlatList } from 'react-native'
|
||||
import { InfiniteQueryObserver, useQueryClient } from 'react-query'
|
||||
@@ -40,7 +39,7 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
||||
}
|
||||
if (!scrolled.current) {
|
||||
scrolled.current = true
|
||||
const pointer = findIndex(flattenData, ['id', toot.id])
|
||||
const pointer = flattenData.findIndex(({ id }) => id === toot.id)
|
||||
try {
|
||||
pointer < flattenData.length &&
|
||||
setTimeout(() => {
|
||||
|
Reference in New Issue
Block a user