1
0
mirror of https://github.com/tooot-app/app synced 2025-02-12 09:50:49 +01:00

Fix warnings and errors

This commit is contained in:
xmflsct 2023-01-09 22:28:53 +01:00
parent b9c4b139f5
commit a4e97ccb1c
6 changed files with 25 additions and 22 deletions

View File

@ -55,14 +55,9 @@ const GracefullyImage = ({
const { colors } = useTheme() const { colors } = useTheme()
const [imageLoaded, setImageLoaded] = useState(false) const [imageLoaded, setImageLoaded] = useState(false)
const [currentUri, setCurrentUri] = useState<string | undefined>(uri.original || uri.remote)
const source = { const source = {
uri: reduceMotionEnabled && uri.static ? uri.static : uri.original uri: reduceMotionEnabled && uri.static ? uri.static : currentUri
}
const onLoad = () => {
setImageLoaded(true)
if (setImageDimensions && source.uri) {
Image.getSize(source.uri, (width, height) => setImageDimensions({ width, height }))
}
} }
const blurhashView = () => { const blurhashView = () => {
@ -92,11 +87,19 @@ const GracefullyImage = ({
/> />
) : null} ) : null}
<FastImage <FastImage
source={{ source={source}
uri: reduceMotionEnabled && uri.static ? uri.static : uri.original
}}
style={[{ flex: 1 }, imageStyle]} style={[{ flex: 1 }, imageStyle]}
onLoad={onLoad} onLoad={() => {
setImageLoaded(true)
if (setImageDimensions && source.uri) {
Image.getSize(source.uri, (width, height) => setImageDimensions({ width, height }))
}
}}
onError={() => {
if (uri.original && uri.original === currentUri && uri.remote) {
setCurrentUri(uri.remote)
}
}}
/> />
{blurhashView()} {blurhashView()}
</Pressable> </Pressable>

View File

@ -126,7 +126,7 @@ const TimelineNotifications: React.FC<Props> = ({ notification, queryKey }) => {
} }
if (filterResults?.length && !filterRevealed) { if (filterResults?.length && !filterRevealed) {
return !filterResults.filter(result => result.filter_action === 'hide').length ? ( return !filterResults.filter(result => result.filter_action === 'hide')?.length ? (
<Pressable onPress={() => setFilterRevealed(!filterRevealed)}> <Pressable onPress={() => setFilterRevealed(!filterRevealed)}>
<TimelineFiltered filterResults={filterResults} /> <TimelineFiltered filterResults={filterResults} />
</Pressable> </Pressable>

View File

@ -144,7 +144,7 @@ const TimelineRefresh: React.FC<Props> = ({
>(queryKey)?.pages[0] >(queryKey)?.pages[0]
prevActive.current = true prevActive.current = true
prevStatusId.current = firstPage?.body[0].id prevStatusId.current = firstPage?.body[0]?.id
await queryFunctionTimeline({ await queryFunctionTimeline({
queryKey, queryKey,
@ -182,7 +182,7 @@ const TimelineRefresh: React.FC<Props> = ({
flRef.current?.scrollToOffset({ offset: scrollY.value - 15, animated: true }) flRef.current?.scrollToOffset({ offset: scrollY.value - 15, animated: true })
} }
await new Promise(promise => setTimeout(promise, 32)) await new Promise(promise => setTimeout(promise, 64))
queryClient.setQueryData< queryClient.setQueryData<
InfiniteData< InfiniteData<
PagedResponse<(Mastodon.Status | Mastodon.Notification | Mastodon.Conversation)[]> PagedResponse<(Mastodon.Status | Mastodon.Notification | Mastodon.Conversation)[]>

View File

@ -49,7 +49,7 @@ const TabMeProfileRoot: React.FC<
<ProfileAvatarHeader type='header' messageRef={messageRef} /> <ProfileAvatarHeader type='header' messageRef={messageRef} />
<MenuRow <MenuRow
title={t('screenTabs:me.profile.root.note.title')} title={t('screenTabs:me.profile.root.note.title')}
content={data?.source.note} content={data?.source?.note}
loading={isFetching} loading={isFetching}
iconBack='ChevronRight' iconBack='ChevronRight'
onPress={() => { onPress={() => {

View File

@ -18,7 +18,7 @@ const AccountInformationAccount: React.FC = () => {
const [acct] = useAccountStorage.string('auth.account.acct') const [acct] = useAccountStorage.string('auth.account.acct')
const domain = getAccountStorage.string('auth.account.domain') const domain = getAccountStorage.string('auth.account.domain')
const localInstance = account?.acct.includes('@') ? account?.acct.includes(`@${domain}`) : true const localInstance = account?.acct?.includes('@') ? account?.acct?.includes(`@${domain}`) : true
if (account || pageMe) { if (account || pageMe) {
return ( return (

View File

@ -182,7 +182,7 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
}, },
{ {
enabled: enabled:
query.isFetched && (toot._remote ? true : query.isFetched) &&
['public', 'unlisted'].includes(toot.visibility) && ['public', 'unlisted'].includes(toot.visibility) &&
match?.domain !== getAccountStorage.string('auth.domain'), match?.domain !== getAccountStorage.string('auth.domain'),
staleTime: 0, staleTime: 0,
@ -193,12 +193,12 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
return return
} }
if ((query.data?.pages[0].body.length || 0) < data.length) { if ((query.data?.pages[0].body.length || 0) - 1 <= data.length) {
queryClient.cancelQueries(queryKey.local) queryClient.cancelQueries(queryKey.local)
queryClient.setQueryData<{ queryClient.setQueryData<{
pages: { body: Mastodon.Status[] }[] pages: { body: Mastodon.Status[] }[]
}>(queryKey.local, old => { }>(queryKey.local, old => {
if (!old) return old if (!old) return { pages: [{ body: [toot] }] }
setHasRemoteContent(true) setHasRemoteContent(true)
return { return {
@ -355,7 +355,7 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
`h ${ARC}` `h ${ARC}`
} }
strokeWidth={1} strokeWidth={1}
stroke={colors.red} stroke={colors.border}
strokeOpacity={0.6} strokeOpacity={0.6}
/> />
</Svg> </Svg>
@ -375,7 +375,7 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
} }
}) })
: null} : null}
<CustomText {/* <CustomText
children={query.data?.pages[0].body[index - 1]?._level} children={query.data?.pages[0].body[index - 1]?._level}
style={{ position: 'absolute', top: 4, left: 4, color: colors.red }} style={{ position: 'absolute', top: 4, left: 4, color: colors.red }}
/> />
@ -386,7 +386,7 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
<CustomText <CustomText
children={query.data?.pages[0].body[index + 1]?._level} children={query.data?.pages[0].body[index + 1]?._level}
style={{ position: 'absolute', top: 36, left: 4, color: colors.green }} style={{ position: 'absolute', top: 36, left: 4, color: colors.green }}
/> /> */}
</View> </View>
) )
}} }}