From 9d1c366eda3f35c1d5ee2ab4b38e82f7d26c9e42 Mon Sep 17 00:00:00 2001 From: Zhiyuan Zheng Date: Fri, 25 Dec 2020 21:51:46 +0100 Subject: [PATCH] Hide header bottom shadow --- src/Index.tsx | 9 +++++---- src/components/Timelines.tsx | 2 +- src/components/Timelines/Timeline.tsx | 4 ++-- src/screens/Me.tsx | 2 +- src/screens/Notifications.tsx | 5 ++++- src/screens/Shared/Announcements.tsx | 8 ++++++++ src/screens/Shared/Compose/EditAttachment.tsx | 2 +- src/screens/Shared/ImagesViewer.tsx | 2 +- src/utils/fetches/timelineFetch.ts | 1 - 9 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/Index.tsx b/src/Index.tsx index 1eacc0b2..3bb22221 100644 --- a/src/Index.tsx +++ b/src/Index.tsx @@ -5,7 +5,7 @@ import { NavigationContainerRef } from '@react-navigation/native' -import React, { useEffect, useMemo, useRef } from 'react' +import React, { useEffect, useRef } from 'react' import { StatusBar } from 'react-native' import Toast from 'react-native-toast-message' import { Feather } from '@expo/vector-icons' @@ -27,8 +27,7 @@ import { updateLocalAccountPreferences, updateNotification } from '@utils/slices/instancesSlice' -import { useInfiniteQuery, useQuery } from 'react-query' -import { announcementFetch } from './utils/fetches/announcementsFetch' +import { useInfiniteQuery } from 'react-query' import client from './api/client' import { timelineFetch } from './utils/fetches/timelineFetch' @@ -80,7 +79,9 @@ export const Index: React.FC = ({ localCorrupt }) => { }) .then(({ body }: { body?: Mastodon.Announcement[] }) => { if (body?.filter(announcement => !announcement.read).length) { - navigationRef.current?.navigate('Screen-Shared-Announcements') + navigationRef.current?.navigate('Screen-Shared-Announcements', { + showAll: false + }) } }) .catch(() => {}) diff --git a/src/components/Timelines.tsx b/src/components/Timelines.tsx index d963831a..5440d469 100644 --- a/src/components/Timelines.tsx +++ b/src/components/Timelines.tsx @@ -67,7 +67,7 @@ const Timelines: React.FC = ({ name, content }) => { ) return ( - + = ({ () => , [status] ) - const onEndReached = useCallback(() => fetchNextPage(), []) + const onEndReached = useCallback(() => !disableRefresh && fetchNextPage(), []) const ListFooterComponent = useCallback( - () => , + () => , [hasNextPage] ) const refreshControl = useMemo( diff --git a/src/screens/Me.tsx b/src/screens/Me.tsx index f275a8e7..b14a2f47 100644 --- a/src/screens/Me.tsx +++ b/src/screens/Me.tsx @@ -19,7 +19,7 @@ const ScreenMe: React.FC = () => { const { t } = useTranslation() return ( - + { return ( {() => (localRegistered ? : null)} diff --git a/src/screens/Shared/Announcements.tsx b/src/screens/Shared/Announcements.tsx index 23cb5065..45b66a41 100644 --- a/src/screens/Shared/Announcements.tsx +++ b/src/screens/Shared/Announcements.tsx @@ -3,6 +3,7 @@ import client from '@root/api/client' import { ButtonRow } from '@root/components/Button' import ParseContent from '@root/components/ParseContent' import { announcementFetch } from '@root/utils/fetches/announcementsFetch' +import relativeTime from '@root/utils/relativeTime' import { StyleConstants } from '@root/utils/styles/constants' import { useTheme } from '@root/utils/styles/ThemeManager' import React, { useCallback, useEffect, useState } from 'react' @@ -90,6 +91,9 @@ const ScreenSharedAnnouncements: React.FC = ({ } ]} > + + 发布于{relativeTime(item.published_at)} + = ({ return ( - + = ({ [] ) return ( - +