From 0c76fb642dcc20e3aca5b33c3ce46a0c2c9c46fa Mon Sep 17 00:00:00 2001 From: Zhiyuan Zheng Date: Sat, 13 Feb 2021 12:33:51 +0100 Subject: [PATCH] Fixed #9 --- src/@types/react-navigation.d.ts | 5 +++-- src/Screens.tsx | 16 ++++++++++------ src/components/Timeline.tsx | 2 +- src/components/Timeline/Shared/Attachment.tsx | 2 -- src/screens/ImagesViewer.tsx | 4 +++- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/@types/react-navigation.d.ts b/src/@types/react-navigation.d.ts index 492bda1f..8addefc8 100644 --- a/src/@types/react-navigation.d.ts +++ b/src/@types/react-navigation.d.ts @@ -49,11 +49,12 @@ declare namespace Nav { } | undefined 'Screen-ImagesViewer': { - imageUrls: (App.IImageInfo & { + imageUrls: { + url: Mastodon.AttachmentImage['url'] preview_url: Mastodon.AttachmentImage['preview_url'] remote_url?: Mastodon.AttachmentImage['remote_url'] imageIndex: number - })[] + }[] imageIndex: number } } diff --git a/src/Screens.tsx b/src/Screens.tsx index 5e6b5632..554669b3 100644 --- a/src/Screens.tsx +++ b/src/Screens.tsx @@ -37,7 +37,7 @@ const Screens: React.FC = ({ localCorrupt }) => { const { t } = useTranslation('common') const dispatch = useDispatch() const localActiveIndex = useSelector(getLocalActiveIndex) - const { mode } = useTheme() + const { mode, theme } = useTheme() enum barStyle { light = 'dark-content', dark = 'light-content' @@ -137,7 +137,7 @@ const Screens: React.FC = ({ localCorrupt }) => { return ( <> - + = ({ localCorrupt }) => { component={ScreenActions} options={{ stackPresentation: 'transparentModal', - stackAnimation: 'fade' + stackAnimation: 'fade', + headerShown: false // Android }} /> = ({ localCorrupt }) => { component={ScreenAnnouncements} options={{ stackPresentation: 'transparentModal', - stackAnimation: 'fade' + stackAnimation: 'fade', + headerShown: false // Android }} /> = ({ localCorrupt }) => { component={ScreenImagesViewer} options={{ stackPresentation: 'fullScreenModal', - stackAnimation: 'fade' + stackAnimation: 'fade', + headerShown: false // Android }} /> diff --git a/src/components/Timeline.tsx b/src/components/Timeline.tsx index c62fae7a..9f4287a0 100644 --- a/src/components/Timeline.tsx +++ b/src/components/Timeline.tsx @@ -76,7 +76,7 @@ const Timeline: React.FC = ({ firstPage.links?.prev && { min_id: firstPage.links.prev, // https://github.com/facebook/react-native/issues/25239#issuecomment-731100372 - limit: '8' + limit: '6' }, getNextPageParam: lastPage => diff --git a/src/components/Timeline/Shared/Attachment.tsx b/src/components/Timeline/Shared/Attachment.tsx index 8f034904..bb3e3b76 100644 --- a/src/components/Timeline/Shared/Attachment.tsx +++ b/src/components/Timeline/Shared/Attachment.tsx @@ -50,8 +50,6 @@ const TimelineAttachment: React.FC = ({ status }) => { case 'image': imageUrls.push({ url: attachment.url, - width: attachment.meta?.original?.width, - height: attachment.meta?.original?.height, preview_url: attachment.preview_url, remote_url: attachment.remote_url, imageIndex: index diff --git a/src/screens/ImagesViewer.tsx b/src/screens/ImagesViewer.tsx index e1a26daa..a54d31b3 100644 --- a/src/screens/ImagesViewer.tsx +++ b/src/screens/ImagesViewer.tsx @@ -12,6 +12,7 @@ import { PermissionsAndroid, Platform, Share, + StatusBar, StyleSheet, View } from 'react-native' @@ -52,7 +53,7 @@ const ScreenImagesViewer = ({ return } CameraRoll.save( - imageUrls[imageIndex].originUrl || + imageUrls[imageIndex].url || imageUrls[imageIndex].remote_url || imageUrls[imageIndex].preview_url ) @@ -133,6 +134,7 @@ const ScreenImagesViewer = ({ return ( + ({ uri: urls.url }))} imageIndex={imageIndex}